using UnityEngine; using UnityEngine.UI; using System.Collections; using GCGame.Table; public class TombCopyUI : MonoBehaviour { public Text kills; //杀怪数 public Text timeDownText; //副本剩余时间倒计时 public Text Text1; public Text Text2; private int _CDStart; public void Awake() { Hashtable add = new Hashtable(); add["name"] = "TombCopyUI"; Games.Events.MessageEventCallBack call = OnOpenWndOver; add["callFun"] = call; Games.Events.EventDispatcher.Instance.AddMessageEvent(Games.Events.EventId.CopyRightOpen, add); Games.Events.EventDispatcher.Instance.Add(Games.Events.EventId.FreshImpactInfo, ItemsFresh); } void OnDestroy() { Games.Events.EventDispatcher.Instance.RemoveMessage(Games.Events.EventId.CopyRightOpen, "TombCopyUI"); Games.Events.EventDispatcher.Instance.Remove(Games.Events.EventId.FreshImpactInfo, ItemsFresh); CancelInvoke(); } public void ItemsFresh(object param) { GCGame.Table.Tab_Fuben fuben = GCGame.Table.TableManager.GetFubenByID(GameManager.gameManager.PlayerDataPool.EnterSceneCache.EnterCopySceneID, 0); if (fuben == null) { return; } if (Singleton.Instance.MainPlayer == null) return; Games.ImpactModle.ClientImpactInfo clientImpact = Singleton.Instance.MainPlayer.GetInpact(fuben.SuccConditionType); Tab_Impact impact = TableManager.GetImpactByID(fuben.SuccConditionType, 0); if(impact != null && GameManager.gameManager.RunningScene != 292) { int Count = 0; if (clientImpact != null) { Count = clientImpact.AddNum; } if (Count < 1) { kills.text = StrDictionary.GetClientDictionaryString("#{9016}", impact.Name + string.Format("({0}/1)", Count)); } else kills.text = StrDictionary.GetClientDictionaryString("#{9016}", impact.Name + string.Format("({0}/1)", Count)); Text2.gameObject.SetActive(false); Text1.gameObject.SetActive(true); Text1.text = StrDictionary.GetClientDictionaryString("#{9028}"); } else { Text1.gameObject.SetActive(false); Text2.gameObject.SetActive(true); Text2.text = StrDictionary.GetClientDictionaryString("#{9027}"); kills.text = StrDictionary.GetClientDictionaryString("#{9026}"); } } public void OnOpenWndOver(Hashtable addparam, Hashtable sendparam) { if (sendparam.ContainsKey("operator")) { GC_NOTIFY_COPYINFO packet = (GC_NOTIFY_COPYINFO)sendparam["operator"]; if (packet == null) return; InitInfo(packet); } ItemsFresh(null); } void Start() { transform.SetSiblingIndex(0); InvokeRepeating("RemainTimeDown", 0, 1); } void OnEnable() { //if (MissionDialogAndLeftTabsLogic.Instance() != null) //{ // MissionDialogAndLeftTabsLogic.Instance().HideMissionDialog(false); //} //MissionDialogAndLeftTabsLogic.SetSwitch(UIInfo.TombCopyUI); OnBtnShow(); } void OnDisable() { if (MissionDialogAndLeftTabsLogic.Instance() != null) MissionDialogAndLeftTabsLogic.Instance().HideMissionDialog(true); } public void RemainTimeDown() { if (Time.realtimeSinceStartup - _CDStart > 0) return; timeDownText.text = GCGame.Utils.GetTimeStr(_CDStart - Time.realtimeSinceStartup); } public void InitInfo(GC_NOTIFY_COPYINFO packet) { _CDStart = packet.TimeRemain; } //public void OpenMissionLeftTab() //{ // if(MissionDialogAndLeftTabsLogic.Instance()==null) // { // UIManager.ShowUI(UIInfo.MissionInfoController,delegate(bool bSuccess, object param) // { // if (bSuccess == false) // return; // MissionDialogAndLeftTabsLogic.SetSwitch(UIInfo.TombCopyUI); // MissionDialogAndLeftTabsLogic.Instance().SetSwitchBtn(); // UIManager.CloseUI(UIInfo.TombCopyUI); // }); // } // else // { // MissionDialogAndLeftTabsLogic.Instance().HideMissionDialog(true); // MissionDialogAndLeftTabsLogic.SetSwitch(UIInfo.TombCopyUI); // MissionDialogAndLeftTabsLogic.Instance().SetSwitchBtn(); // UIManager.CloseUI(UIInfo.TombCopyUI); // } //} public void Desc_Click() { PlayHelpMessageRoot.ShowHelpMessage(4); } #region move public ObjectTween _MoveTo; public RectTransform _TitleBGRec; public GameObject _ShowBtn; public GameObject _HideBtn; public GameObject _InfoPanel; private bool isShow = false; public void OnBtnShow() { ShowPanel(); _ShowBtn.SetActive(false); _HideBtn.SetActive(true); isShow = true; } public void OnBtnHide() { HidePanel(); _ShowBtn.SetActive(true); _HideBtn.SetActive(false); isShow = false; } public void OnTitleBtn() { if (isShow) { OnBtnHide(); } else { OnBtnShow(); } } public void ShowPanel() { _MoveTo.Reset(); _MoveTo.destantPos = new Vector3(0, 0, 0); GCGame.Utils.HideMainTopRightUI(); _TitleBGRec.sizeDelta = new Vector2(300, _TitleBGRec.sizeDelta.y); _InfoPanel.gameObject.SetActive(true); } public void HidePanel() { _MoveTo.Reset(); _MoveTo.destantPos = new Vector3(0, -192, 0); GCGame.Utils.ShowMainTopRightUI(); _TitleBGRec.sizeDelta = new Vector2(230, _TitleBGRec.sizeDelta.y); _InfoPanel.gameObject.SetActive(false); } #endregion }