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.
62 lines
1.7 KiB
62 lines
1.7 KiB
5 years ago
|
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<KeyValuePair<long, string>> AllLiquipSetTime = new List<KeyValuePair<long, string>>();
|
||
|
protected override void Execute(BinaryMessage message)
|
||
|
{
|
||
|
time = message.Body.Deserialize<string>();
|
||
|
if (GameObject.Find("TopPanel/Tool/TimeText"))
|
||
|
{
|
||
|
GameObject.Find("TopPanel/Tool/TimeText").GetComponent<Text>().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<long, string>(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]);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|