using UnityEngine; using System.Collections; using AX.MessageSystem; using System; using Thinksquirrel.Fluvio; using AX.TrackRecord; public class FluvioMessage : MonoBehaviour { // Use this for initialization public float lifeTime; public float speed; public Color color; public int hour; public int minute; public int second; DateTime t1, t2; private Transform fluvio; private OtherAttribute_Fluvio attri; public OtherAttribute_Fluvio Attri { set { attri = value; lifeTime = attri.lifeTime; speed = attri.speed; color.r = attri.colorR; color.g = attri.colorG; color.b = attri.colorB; color.a = attri.colorA; hour = attri.hour; minute = attri.minute; second = attri.second; messageValueToObj(); } get { attri = new OtherAttribute_Fluvio(); attri.lifeTime = lifeTime; attri.speed = speed; attri.colorR = color.r; attri.colorG = color.g; attri.colorB = color.b; attri.colorA = color.a; attri.hour = hour; attri.minute = minute; attri.second = second; return attri; } } void Awake () { fluvio = transform.Find("Paint"); if (ExamInfoHelpClass.loadSceneMode != ExamInfoHelpClass.LoadSceneMode.ExamineMode) { fluvio.GetComponent().GetParticleSystem().Play(); } objValueToMessage(); t1 = DateTime.Now; } // Update is called once per frame void Update () { if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.ExamineMode) { if (!fluvio.GetComponent().GetParticleSystem().isPlaying) { if (hour== ExamineModeSet.hours&& minute==ExamineModeSet.minutes&& second== ExamineModeSet.seconds) { fluvio.GetComponent().GetParticleSystem().Play(); } } } } void OnMouseDown() { if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CreatQuestion|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.PrepareMode || ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditCourceware || ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.SelfStudyMode|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.EditQuestion|| ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.CopyQuestion) { MessageDispatcher.SendMessage("FLUVIO_SELECTED", gameObject); t2 = DateTime.Now; if (t2 - t1 < new TimeSpan(0, 0, 0, 0, 500)) { MessageDispatcher.SendMessage("FLUVIO_EDIT", gameObject); } t1 = t2; } } public void objValueToMessage() { lifeTime = fluvio.GetComponent().GetParticleSystem().startLifetime; speed = fluvio.GetComponent().GetParticleSystem().startSpeed; color = fluvio.GetComponent().material.GetColor("_FluidTintUI"); } public void messageValueToObj() { fluvio.GetComponent().GetParticleSystem().startLifetime = lifeTime; fluvio.GetComponent().GetParticleSystem().startSpeed = speed; fluvio.GetComponent().material.SetColor("_FluidTintUI", color); } }