The Swartz-Manning’s first exhibit will provide a detailed history of Aaron Swartz Day. https://www.aaronswartzday.org/vr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

MetaExhibit.cs 4.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using System;
  5. using UnityEngine.UI;
  6. public class MetaExhibit : MonoBehaviour {
  7. [System.Serializable]
  8. public class ExhibitContents
  9. {
  10. public GameObject gameObject;
  11. [TextArea]
  12. public string text;
  13. public Texture2D picture;
  14. public Transform model;
  15. public AudioClip audioClip;
  16. public string videoURL;
  17. public MovieTexture movieTexture;
  18. }
  19. [System.Serializable]
  20. public class ExhibitManifest
  21. {
  22. public string title = "Untitled";
  23. public string caption = "Test exhibit please ignore.";
  24. public string[] tags = { "test", "ignore" };
  25. /// <summary>
  26. /// Who made the content.
  27. /// </summary>
  28. public string creator = "";
  29. /// <summary>
  30. /// Email to contact the creator.
  31. /// </summary>
  32. public string creatorContactEmail = "";
  33. /// <summary>
  34. /// When the content itself was originally created.
  35. /// </summary>
  36. public string curator = "";
  37. /// <summary>
  38. /// Email to contact the curator.
  39. /// </summary>
  40. public string curatorContactEmail = "";
  41. /// <summary>
  42. /// When the content itself was originally curator.
  43. /// </summary>
  44. public DateTime dateCreated;
  45. /// <summary>
  46. /// When the item was added to the exhibits.
  47. /// </summary>
  48. public DateTime dateAdded;
  49. /// <summary>
  50. /// When the item was made public.
  51. /// </summary>
  52. public DateTime dateReleased;
  53. public DateTime dateModified;
  54. /// <summary>
  55. /// License of the content.
  56. /// </summary>
  57. public string license = "";
  58. }
  59. [System.Serializable]
  60. public class ExhibitReferences
  61. {
  62. public Transform parentTransform;
  63. public Transform modelParentTransform;
  64. public GameObject model;
  65. public Text titleText;
  66. public Text captionText;
  67. public Text textText;
  68. public Renderer pictureRenderer;
  69. public AudioSource audioClipSource;
  70. public MovieTexture movieTexture;
  71. }
  72. /// <summary>
  73. /// CCLicense repreent a creative commons license and enables user-generated licenses using CC.
  74. /// </summary>
  75. /// <remarks>
  76. /// You can create a CC to learn about CC itself and you can see the emblems of CC-enabled licenses in a more visually distinct way than the stodgy old wall-of-text licenses of the past.
  77. /// </remarks>
  78. public class CCLicense
  79. {
  80. public bool attribution = true;
  81. public bool remix = true;
  82. public bool sharealike = false;
  83. }
  84. public ExhibitContents contents = new ExhibitContents();
  85. public ExhibitManifest manifest = new ExhibitManifest();
  86. public ExhibitReferences references = new ExhibitReferences();
  87. public void InitContents()
  88. {
  89. if (contents.model != null)
  90. {
  91. references.modelParentTransform.gameObject.SetActive(true);
  92. references.pictureRenderer.material.mainTexture = contents.picture;
  93. GameObject newGO = GameObject.Instantiate(contents.model).gameObject;
  94. newGO.transform.parent = references.modelParentTransform;
  95. newGO.transform.localPosition = Vector3.zero;
  96. references.model = newGO;
  97. }
  98. else
  99. {
  100. references.modelParentTransform.gameObject.SetActive(false);
  101. }
  102. if (contents.picture != null)
  103. {
  104. references.pictureRenderer.gameObject.SetActive(true);
  105. references.pictureRenderer.material.mainTexture = contents.picture;
  106. }
  107. else
  108. {
  109. references.pictureRenderer.gameObject.SetActive(false);
  110. }
  111. if (contents.text != "")
  112. {
  113. references.textText.gameObject.SetActive(true);
  114. references.textText.text = contents.text;
  115. }
  116. else
  117. {
  118. references.textText.gameObject.SetActive(false);
  119. }
  120. if (contents.audioClip != null)
  121. {
  122. references.audioClipSource.gameObject.SetActive(true);
  123. references.audioClipSource.clip = contents.audioClip;
  124. }
  125. else
  126. {
  127. references.audioClipSource.gameObject.SetActive(false);
  128. }
  129. }
  130. // Use this for initialization
  131. void Start () {
  132. InitContents();
  133. }
  134. // Update is called once per frame
  135. void Update () {
  136. }
  137. }