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.
66 lines
2.1 KiB
66 lines
2.1 KiB
using AX.Network.Protocols; |
|
using AX.NetworkSystem; |
|
using AX.Serialization; |
|
using System.Collections; |
|
using System.Collections.Generic; |
|
using UnityEngine; |
|
using UnityEngine.UI; |
|
|
|
public class HandOverToggle : BaseToggle { |
|
public GameObject panel; |
|
public GameObject warnMark; |
|
public override void RespondFun(bool value) |
|
{ |
|
/*if (panel == null) |
|
{ |
|
GameObject prefab = Resources.Load("HandOver/HandOverPanel") as GameObject; |
|
panel = Instantiate(prefab, GameObject.Find("Canvas/ZhongDuiPanel").transform); |
|
panel.name = prefab.name; |
|
}*/ |
|
warnMark.SetActive(false); |
|
Panel.SetActive(value); |
|
} |
|
public GameObject Panel |
|
{ |
|
get |
|
{ |
|
if (panel == null) |
|
{ |
|
GameObject prefab = Resources.Load("HandOver/HandOverPanel") as GameObject; |
|
panel = Instantiate(prefab, GameObject.Find("Canvas/ZhongDuiPanel").transform); |
|
panel.name = prefab.name; |
|
panel.SetActive(false); |
|
} |
|
return panel; |
|
} |
|
} |
|
// Use this for initialization |
|
void Start () { |
|
warnMark = transform.Find("WarnMark").gameObject; |
|
warnMark.SetActive(false); |
|
NetworkMessageDispatcher.AddListener("HAND_OVER_SYNC", OnReceivePower); |
|
} |
|
public override void OnDestroy() |
|
{ |
|
base.OnDestroy(); |
|
NetworkMessageDispatcher.RemoveListener("HAND_OVER_SYNC", OnReceivePower); |
|
} |
|
void OnReceivePower(BinaryMessage message) |
|
{ |
|
var pair = message.Body.Deserialize<HandOverPair>(); |
|
//如果“我”收到了移交的力量,就提示 |
|
if (pair.acceptedID == CurrentUserInfo.mySelf.Id) |
|
{ |
|
//如果移交面板没打开,就显示warnMark提示 |
|
if (Panel.activeInHierarchy == false) |
|
{ |
|
warnMark.SetActive(true); |
|
} |
|
LoadPromptWin.Instance.LoadTextPromptWindow("获得消防力量控制权", 1); |
|
} |
|
} |
|
// Update is called once per frame |
|
void Update () { |
|
|
|
} |
|
}
|
|
|