using AX.MessageSystem; using AX.Network.Protocols; using AX.Serialization; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; using AX.NetworkSystem; public class TIME_SYNC : NetworkMessageBehaviour { public static string time = "00:00:00"; private List> AllLiquipSetTime = new List>(); protected override void Execute(BinaryMessage message) { time = message.Body.Deserialize(); if (GameObject.Find("TopPanel/Tool/TimeText")) { GameObject.Find("TopPanel/Tool/TimeText").GetComponent().text = time; } } // Use this for initialization void Start() { MessageDispatcher.AddListener("SetTime", SendSetSync); } protected override void OnDestroy() { base.OnDestroy(); MessageDispatcher.RemoveListener("SetTime", SendSetSync); } private void SendSetSync(IMessage obj) { var data = (SetLiquipdata)obj.Data; AllLiquipSetTime.Add(new KeyValuePair(data.LiquipId,data.time)); } // Update is called once per frame void Update() { if (time != "00:00:00") { if (AllLiquipSetTime.Count > 0) { for (int i = 0; i < AllLiquipSetTime.Count; i++) { if (AllLiquipSetTime[i].Value==time) { NetworkManager.Default.SendAsync("LIQUIP_SHOW_SYNC", AllLiquipSetTime[i].Key); AllLiquipSetTime.Remove(AllLiquipSetTime[i]); } } } } } }