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.
72 lines
2.0 KiB
72 lines
2.0 KiB
3 years ago
|
using UnityEngine;
|
||
|
using System.Collections;
|
||
|
using UnityEngine.UI;
|
||
|
using AX.MessageSystem;
|
||
|
using System;
|
||
|
using AX.TrackRecord;
|
||
|
|
||
|
public class FluvioUIControl : MonoBehaviour
|
||
|
{
|
||
|
|
||
|
// Use this for initialization
|
||
|
public Slider lifeTime;
|
||
|
public Slider speed;
|
||
|
public Image image;
|
||
|
public InputField hour;
|
||
|
public InputField minute;
|
||
|
public InputField second;
|
||
|
public GameObject colorPanel;
|
||
|
private GameObject controlObject;
|
||
|
void Start()
|
||
|
{
|
||
|
MessageDispatcher.AddListener("COLOR_RESET", SetColor);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
MessageDispatcher.RemoveListener("COLOR_RESET", SetColor);
|
||
|
}
|
||
|
|
||
|
private void SetColor(IMessage obj)
|
||
|
{
|
||
|
image.color = (Color)obj.Data;
|
||
|
}
|
||
|
public void ShowColorPanel()
|
||
|
{
|
||
|
colorPanel.SetActive(true);
|
||
|
colorPanel.GetComponent<ColorRGBA>().setRGBAValue(image.color);
|
||
|
}
|
||
|
public void setPanelValue(GameObject obj)
|
||
|
{
|
||
|
controlObject = obj;
|
||
|
var message = controlObject.GetComponent<FluvioMessage>();
|
||
|
lifeTime.value = message.lifeTime;
|
||
|
speed.value = message.speed;
|
||
|
image.color = message.color;
|
||
|
hour.text = message.hour.ToString();
|
||
|
minute.text = message.minute.ToString();
|
||
|
second.text = message.second.ToString();
|
||
|
}
|
||
|
public void submitPanelValue()
|
||
|
{
|
||
|
var message = controlObject.GetComponent<FluvioMessage>();
|
||
|
message.lifeTime = lifeTime.value;
|
||
|
message.speed = speed.value;
|
||
|
message.color = image.color;
|
||
|
message.hour = int.Parse(hour.text);
|
||
|
message.minute = int.Parse(minute.text);
|
||
|
message.second = int.Parse(second.text);
|
||
|
message.messageValueToObj();
|
||
|
if (RecordManager.Instance.IsRecording)
|
||
|
{
|
||
|
MessageDispatcher.SendMessage("RecordEditFluvioEvent", (object)controlObject.name);
|
||
|
}
|
||
|
colorPanel.SetActive(false);
|
||
|
gameObject.SetActive(false);
|
||
|
}
|
||
|
// Update is called once per frame
|
||
|
void Update()
|
||
|
{
|
||
|
|
||
|
}
|
||
|
}
|