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.
107 lines
3.7 KiB
107 lines
3.7 KiB
3 years ago
|
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<FluidParticleSystem>().GetParticleSystem().Play();
|
||
|
}
|
||
|
objValueToMessage();
|
||
|
t1 = DateTime.Now;
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update ()
|
||
|
{
|
||
|
if (ExamInfoHelpClass.loadSceneMode == ExamInfoHelpClass.LoadSceneMode.ExamineMode)
|
||
|
{
|
||
|
if (!fluvio.GetComponent<FluidParticleSystem>().GetParticleSystem().isPlaying)
|
||
|
{
|
||
|
if (hour== ExamineModeSet.hours&& minute==ExamineModeSet.minutes&& second== ExamineModeSet.seconds)
|
||
|
{
|
||
|
fluvio.GetComponent<FluidParticleSystem>().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<FluidParticleSystem>().GetParticleSystem().startLifetime;
|
||
|
speed = fluvio.GetComponent<FluidParticleSystem>().GetParticleSystem().startSpeed;
|
||
|
color = fluvio.GetComponent<Renderer>().material.GetColor("_FluidTintUI");
|
||
|
}
|
||
|
public void messageValueToObj()
|
||
|
{
|
||
|
fluvio.GetComponent<FluidParticleSystem>().GetParticleSystem().startLifetime = lifeTime;
|
||
|
fluvio.GetComponent<FluidParticleSystem>().GetParticleSystem().startSpeed = speed;
|
||
|
fluvio.GetComponent<Renderer>().material.SetColor("_FluidTintUI", color);
|
||
|
}
|
||
|
}
|