IEnumerator CountDown() { while (WorldManager.worldManager.station != WorldManager.WorldStation.Enter) { yield return(null); } var uiRoot = WindowMng.windowMng.GetMainUI(); var lt = NGUITools.AddChild(uiRoot, Resources.Load <GameObject>("UI/LeftTimeUI")); ltui = lt.GetComponent <LeftTimeUI>(); var sui = NGUITools.AddChild(uiRoot, Resources.Load <GameObject>("UI/ScoreUI")); scoreUI = sui.GetComponent <ScoreUI>(); var rtp = Util.FindChildRecursive(uiRoot.transform, "RightTop"); rtp.gameObject.SetActive(false); while (leftTime > 0) { ltui.SetLabel("" + leftTime); if (NetworkUtil.IsNetMaster()) { NetDateInterface.SyncTime(leftTime); } leftTime--; yield return(new WaitForSeconds(1)); } if (NetworkUtil.IsNetMaster()) { NetDateInterface.GameOver(); NetworkGameOver(); } }
private IEnumerator CountDown() { while (WorldManager.worldManager.station != WorldManager.WorldStation.Enter) { yield return(null); } var uiRoot = WindowMng.windowMng.GetMainUI(); while (uiRoot == null) { uiRoot = WindowMng.windowMng.GetMainUI(); yield return(null); } var lt = WindowMng.windowMng.AddChild(uiRoot, Resources.Load <GameObject>("UI/LeftTimeUI")); ltui = lt.GetComponent <LeftTimeUI>(); var sui = WindowMng.windowMng.AddChild(uiRoot, Resources.Load <GameObject>("UI/ScoreUI")); scoreUI = sui.GetComponent <ScoreUI>(); var rtp = Util.FindChildRecursive(uiRoot.transform, "RightTop"); rtp.gameObject.SetActive(false); Color32 white = new Color32(255, 255, 255, 255); Color32 red = new Color32(255, 0, 0, 255); while (leftTime > 0) { var color = white; if (leftTime <= 60 & leftTime % 2 == 0) { color = red; } ltui.SetLabel("" + Util.ConvertTime(leftTime), color); leftTime--; yield return(new WaitForSeconds(1)); } }