void ParseBattleInfo(Dictionary <string, object> json) { string state = json["state"].ToString(); if (state == "finish") { OnGameFinish(); return; } if (state == "exit") { OnRivalExit(); return; } int id = System.Convert.ToInt32(json ["turn_player"]); int turn = System.Convert.ToInt32(json ["turn_count"]); int watcher = System.Convert.ToInt32(json ["watcher_count"]); BattleInfoPanel panel = BattleInfoPanel.Instance; if (panel.Watcher < watcher) { panel.IncreaseWatcher(); if (!NoticePanel.IsShowing) { NoticePanel.Show(); } } if (id == GetTurnPlayer().UserId) { if (!panel.Inited) { panel.SetPanel(GetTurnPlayer().Name, turn); return; } } isTurnChanged = true; panel.SetPanel(GetTurnPlayer().Name, turn); if (id == first.UserId) { first.SetTurn(true); last.SetTurn(false); return; } if (id == last.UserId) { first.SetTurn(false); last.SetTurn(true); return; } }
public static NoticePanel Show() { if (instance != null) return null; Debug.Log ("NoticePanel"); Transform canvas = GameObject.Find ("Canvas").transform; Transform info = canvas.FindChild ("BattleInfoPanel"); GameObject prefab = Resources.Load<GameObject> ("NoticePanel"); GameObject go = Instantiate (prefab) as GameObject; go.transform.SetParent (info, false); go.transform.localPosition = new Vector3 (-33, -79, 0); instance = go.GetComponent<NoticePanel> (); return instance; }
public static NoticePanel Show() { if (instance != null) { return(null); } Debug.Log("NoticePanel"); Transform canvas = GameObject.Find("Canvas").transform; Transform info = canvas.FindChild("BattleInfoPanel"); GameObject prefab = Resources.Load <GameObject> ("NoticePanel"); GameObject go = Instantiate(prefab) as GameObject; go.transform.SetParent(info, false); go.transform.localPosition = new Vector3(-33, -79, 0); instance = go.GetComponent <NoticePanel> (); return(instance); }
public void SetNoticePanel(NoticeType type, uint condition = 0, string str = null, object obj = null) { if (type == NoticeType.Quest)// || type == NoticeType.Achiev { if (!TownState.TownActive) { return; } } if (NoticePanel == null) { UIBasePanel noticePanel = UIMgr.OpenNoticePanel(type, condition, str, obj); NoticePanel = noticePanel as NoticePanel; } else { NoticePanel.NoticePop(type, condition, str, obj); } }
void DestroyPanel() { instance = null; Destroy (this.gameObject); }
void DestroyPanel() { instance = null; Destroy(this.gameObject); }