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.
39 lines
861 B
39 lines
861 B
4 years ago
|
using AX.Network.Protocols;
|
||
|
using AX.NetworkSystem;
|
||
|
using AX.Serialization;
|
||
|
using System;
|
||
|
using System.Collections;
|
||
|
using System.Collections.Generic;
|
||
|
using UnityEngine;
|
||
|
using UnityEngine.UI;
|
||
|
|
||
|
public class Duration : MonoBehaviour {
|
||
|
|
||
|
// Use this for initialization
|
||
|
void Start () {
|
||
|
|
||
|
}
|
||
|
void OnEnable()
|
||
|
{
|
||
|
NetworkMessageDispatcher.AddListener("TIME_SYNC", UpdateDuration);
|
||
|
}
|
||
|
void OnDisable()
|
||
|
{
|
||
|
NetworkMessageDispatcher.RemoveListener("TIME_SYNC", UpdateDuration);
|
||
|
}
|
||
|
void OnDestroy()
|
||
|
{
|
||
|
NetworkMessageDispatcher.RemoveListener("TIME_SYNC", UpdateDuration);
|
||
|
}
|
||
|
private void UpdateDuration(BinaryMessage message)
|
||
|
{
|
||
|
var time = message.Body.Deserialize<string>();
|
||
|
GetComponent<Text>().text = time;
|
||
|
}
|
||
|
|
||
|
// Update is called once per frame
|
||
|
void Update () {
|
||
|
|
||
|
}
|
||
|
}
|