123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using System;
- using UnityEngine.UI;
- public class MetaExhibit : MonoBehaviour {
-
- [System.Serializable]
- public class ExhibitContents
- {
- public GameObject gameObject;
- [TextArea]
- public string text;
- public Texture2D picture;
- public Transform model;
- public AudioClip audioClip;
- public string videoURL;
- public MovieTexture movieTexture;
- }
- [System.Serializable]
- public class ExhibitManifest
- {
- public string title = "Untitled";
- public string caption = "Test exhibit please ignore.";
- public string[] tags = { "test", "ignore" };
- /// <summary>
- /// Who made the content.
- /// </summary>
- public string creator = "";
- /// <summary>
- /// Email to contact the creator.
- /// </summary>
- public string creatorContactEmail = "";
- /// <summary>
- /// When the content itself was originally created.
- /// </summary>
- public string curator = "";
- /// <summary>
- /// Email to contact the curator.
- /// </summary>
- public string curatorContactEmail = "";
- /// <summary>
- /// When the content itself was originally curator.
- /// </summary>
- public DateTime dateCreated;
- /// <summary>
- /// When the item was added to the exhibits.
- /// </summary>
- public DateTime dateAdded;
- /// <summary>
- /// When the item was made public.
- /// </summary>
- public DateTime dateReleased;
-
- public DateTime dateModified;
- /// <summary>
- /// License of the content.
- /// </summary>
- public string license = "";
- }
-
- [System.Serializable]
- public class ExhibitReferences
- {
- public Transform parentTransform;
- public Transform modelParentTransform;
- public GameObject model;
- public Text titleText;
- public Text captionText;
- public Text textText;
- public Renderer pictureRenderer;
- public AudioSource audioClipSource;
- public MovieTexture movieTexture;
- }
-
-
-
- /// <summary>
- /// CCLicense repreent a creative commons license and enables user-generated licenses using CC.
- /// </summary>
- /// <remarks>
- /// 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.
- /// </remarks>
- public class CCLicense
- {
- public bool attribution = true;
- public bool remix = true;
- public bool sharealike = false;
- }
-
- public ExhibitContents contents = new ExhibitContents();
- public ExhibitManifest manifest = new ExhibitManifest();
- public ExhibitReferences references = new ExhibitReferences();
-
- public void InitContents()
- {
- if (contents.model != null)
- {
- references.modelParentTransform.gameObject.SetActive(true);
- references.pictureRenderer.material.mainTexture = contents.picture;
- GameObject newGO = GameObject.Instantiate(contents.model).gameObject;
- newGO.transform.parent = references.modelParentTransform;
- newGO.transform.localPosition = Vector3.zero;
- references.model = newGO;
- }
- else
- {
- references.modelParentTransform.gameObject.SetActive(false);
- }
-
- if (contents.picture != null)
- {
- references.pictureRenderer.gameObject.SetActive(true);
- references.pictureRenderer.material.mainTexture = contents.picture;
- }
- else
- {
- references.pictureRenderer.gameObject.SetActive(false);
- }
-
- if (contents.text != "")
- {
- references.textText.gameObject.SetActive(true);
- references.textText.text = contents.text;
- }
- else
- {
- references.textText.gameObject.SetActive(false);
- }
-
- if (contents.audioClip != null)
- {
- references.audioClipSource.gameObject.SetActive(true);
- references.audioClipSource.clip = contents.audioClip;
- }
- else
- {
- references.audioClipSource.gameObject.SetActive(false);
- }
- }
- // Use this for initialization
- void Start () {
- InitContents();
- }
-
- // Update is called once per frame
- void Update () {
-
- }
- }
|