void MiracleEnterWnd() { ShowAnimation(); //如果任务成功 if (GameCenter.miracleMng.miracleStatus == AccessState.SUCCEED) { if (totleTimer != null) { //暂停计时 totleTimer.StopTimer(); if (changeLabel != null) { changeLabel.text = ConfigMng.Instance.GetUItext(141); } } if (effect != null) { effect.SetActive(true); } } if (totleTimer != null && GameCenter.miracleMng.miracleStatus == AccessState.ACCEPTED && GameCenter.miracleMng.miracleStatus != AccessState.NONE) { totleTimer.StartIntervalTimer(GameCenter.miracleMng.restTime - (int)Time.realtimeSinceStartup); } }
private void CheckPlayerReady() { isAllReady = true; foreach (PlayerScoreCard card in playerCards) { if (!card.isReady) { isAllReady = false; break; } } if (isAllReady) { if (!timer.isRunning) //Start start-coroutine { countdownModule.SetActive(true); timer.StartTimer(startGameTime, () => { Debug.Log("START GAME"); GameManager.LoadNextLevel(); }); //This is where we start next game } } else { //Stop start-coroutine countdownModule.SetActive(false); timer.StopTimer(); } }
void StopTimer() { if (timer != null) { timer.StopTimer(); } }
//倒计时完成任务 void CountDown() { //Debug.Log("time"+time); if (countDown != null) { //Debug.Log("time" + time); countDown.StartIntervalTimer(time); countDown.onTimeOut = (x) => { if (overDialog != null && npcNextStep != null) { //Debug.Log("进入手动调用点击一次特效"); countDown.StopTimer(); Invoke("ResetCountDown", 0.1f); npcNextStep.SendMessage("OnClick", npcNextStep, SendMessageOptions.DontRequireReceiver);//这一句放到最后面,不然会报错mising... } else { Debug.LogError("预制上名为overDialog的组件为空"); } }; } else { Debug.LogError("名为countDown的Timer组件丢失"); } }
void ShowMagicTower(int _star, int time) { if (tipGo != null) { tipGo.SetActive(true); } if (tipGoCloseT != null) { tipGoCloseT.text = time.ToString(); } //if(tipGoNum != null)tipGoNum.text = num.ToString(); if (tipGoTimer != null) { tipGoTimer.StopTimer(); tipGoTimer.StartIntervalTimer(3); tipGoTimer.onTimeOut = delegate { tipGo.SetActive(false); }; } for (int i = 0, max = star.Length; i < max; i++) { if (_star > i) { star[i].gameObject.SetActive(true); } else { star[i].gameObject.SetActive(false); } } }
private void Update() { bool isAllReady = false; if (nOReadySwitches > 0 && nOReadySwitches == GameManager.Players.Length) { isAllReady = true; } countdownModule.SetActive(isAllReady); if (isAllReady) { if (!countdownTimer.isRunning) //Start start-coroutine { countdownModule.SetActive(true); countdownTimer.StartTimer(readyStartTime, () => { Debug.Log("START GAME"); SaveAllHybridModels(); GameManager.LoadNextLevel(); }); //This is where we start next game } } else { //Stop start-coroutine countdownModule.SetActive(false); countdownTimer.StopTimer(); } }
/// <summary> /// 勾选自动挂机 /// </summary> void AutoOnHook() { if (autoToggle.value) { CountDown(); } if (!autoToggle.value) { if (time != null) { time.StopTimer(); } if (autoFilish != null && autoFilish.activeSelf) { autoFilish.SetActive(false); } } GameCenter.taskMng.SetRingAutoFinishType(GameCenter.taskMng.curRingTaskType, autoToggle.value); //GameCenter.taskMng.AutoFinishRingTask = autoToggle.value; }
void RefreshMiracleWnd() { //改变自身图片显示 if (GameCenter.mainPlayerMng.MainPlayerInfo.Prof == 1) { if (myProp != null) { myProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_zs"; } } else if (GameCenter.mainPlayerMng.MainPlayerInfo.Prof == 2) { if (myProp != null) { myProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_fs"; } } else if (GameCenter.mainPlayerMng.MainPlayerInfo.Prof == 3) { if (myProp != null) { myProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_jx"; } } //改变对方显示图片 if (GameCenter.miracleMng.profInfo == 1) { if (yourProp != null) { yourProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_zs"; } } else if (GameCenter.miracleMng.profInfo == 2) { if (yourProp != null) { yourProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_fs"; } } else if (GameCenter.miracleMng.profInfo == 3) { if (yourProp != null) { yourProp.GetComponent <UISprite>().spriteName = "Pic_jj_rw_jx"; } } //系统正在进行中 if (GameCenter.miracleMng.miracleStatus == AccessState.ACCEPTED) { if (totleTime != null) { totleTime.StartIntervalTimer(GameCenter.miracleMng.restTime - (int)Time.realtimeSinceStartup); //如果计时结束,则执行下面那个函数 totleTime.onTimeOut = (x) => { UpdateShow(); }; } if (desLabel != null) { desLabel.text = ConfigMng.Instance.GetUItext(131); } } //任务获胜 else if (GameCenter.miracleMng.miracleStatus == AccessState.SUCCEED) { //暂停计时 if (totleTime != null) { totleTime.StopTimer(); } if (desLabel != null) { desLabel.text = ConfigMng.Instance.GetUItext(132); } if (rewardLabel != null) { rewardLabel.text = ConfigMng.Instance.GetUItext(139); } if (totleTime != null) { timeLabel.text = "00:00"; } if (getButton != null && addButton != null) { getButton.gameObject.SetActive(true); addButton.gameObject.SetActive(false); } if (acceptBtn != null) { acceptBtn.gameObject.SetActive(true); } } if (fightLabel != null) { fightLabel.text = GameCenter.miracleMng.scoreTarget.ToString(); } if (winReward != null) { winReward.FillInfo(GameCenter.miracleMng.info1); } if (nameLabel != null) { for (int i = 0, max = nameLabel.Length; i < max; i++) { nameLabel[i].gameObject.SetActive(false); } } if (yourName != null) { if (GameCenter.miracleMng.playerID == 0) { UpdateNameValue(); } else { //OtherPlayerInfo info = GameCenter.duplicateMng.GetInvitationPlayerData(GameCenter.miracleMng.playerID); yourName.text = GameCenter.miracleMng.targetName; } } }
void Refresh() { data = GameCenter.openServerRewardMng.wdfTaroatData; if (data != null) { bool isRed = GameCenter.openServerRewardMng.isTaroatRed(); if (needVip != null) { if (data.needVipLev > 0 && GameCenter.vipMng.VipData != null && GameCenter.vipMng.VipData.vLev < data.needVipLev) { if (needVip != null) { needVip.gameObject.SetActive(true); } if (turnCardBtn != null) { turnCardBtn.gameObject.SetActive(false); } if (rechargeBtn != null) { rechargeBtn.gameObject.SetActive(true); } } else { if (needVip != null) { needVip.gameObject.SetActive(false); } if (turnCardBtn != null) { turnCardBtn.gameObject.SetActive(true); } if (rechargeBtn != null) { rechargeBtn.gameObject.SetActive(false); } } } if (restTime != null) { restTime.StartIntervalTimer(data.restTime); restTime.onTimeOut = (x) => { GameCenter.openServerRewardMng.C2S_AskTaroatInfo(1); }; } if (activeCount != null) { activeCount.text = data.activeCount.ToString(); } if (needVip != null) { needVip.text = ConfigMng.Instance.GetUItext(338) + data.needVipLev.ToString(); } if (consumeCoin != null) { consumeCoin.text = data.consume.ToString(); } if (getCoin != null) { getCoin.text = data.getNumMax + "—" + data.getNumMin; } if (redHint != null) { redHint.gameObject.SetActive(isRed); } } else { if (restTime != null) { restTime.StopTimer(); } if (activeCount != null) { activeCount.text = "0"; } } if (activityEndGo != null) { activityEndGo.SetActive(data == null); } if (activityNotEndGo != null) { activityNotEndGo.SetActive(data != null); } }
void OnChangeBoss(BossChallengeData data) { if (data.CurBossRef != null) { if (address != null) { address.text = data.CurBossRef.wayres; } if (textureBoss != null) { textureBoss.enabled = true; GameCenter.previewManager.TryPreviewSingelMonster(data.CurBossRef.monsterId, textureBoss, PreviewConfigType.Dialog); } if (labDes != null) { labDes.text = data.CurBossRef.res; } if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(false); } if (killGo != null) { killGo.SetActive(false); } if (bossCoppyGo != null) { bossCoppyGo.SetActive(false); } if (buyTimesGo != null) { buyTimesGo.gameObject.SetActive(false); } if (lastKillerGo != null) { lastKillerGo.SetActive(true); } switch (data.CurBossRef.type) { case (int)ToggleType.UnderBoss: break; case (int)ToggleType.SceneBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } break; case (int)ToggleType.SealBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (lastKillerGo != null) { lastKillerGo.SetActive(false); } if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else { if (data.CanKill) { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } else { if (killGo != null) { killGo.SetActive(true); } if (timeGo != null) { timeGo.SetActive(false); } } } string realDes = data.CurBossRef.res.Replace("#1#", (data.CanKill?"1":"0")); realDes = realDes.Replace("#0#", (data.CurBossRef.needLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel)?"[ff0000]":"[00ff00]"); if (labDes != null) { labDes.text = realDes; //封印BOSS } break; case (int)ToggleType.RongEBoss: case (int)ToggleType.LiRongEBoss: if (timeGo != null) { timeGo.SetActive(true); } if (appearGo != null) { appearGo.SetActive(false); } if (data.CanKill) { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } } else //已击杀or倒计时 { if (data.AppearTime > (int)Time.realtimeSinceStartup) { if (timer != null) { timer.StopTimer(); timer.StartIntervalTimer(data.AppearTime - (int)Time.realtimeSinceStartup); timer.onTimeOut = (x) => { if (timeGo != null) { timeGo.SetActive(false); } if (appearGo != null) { appearGo.SetActive(true); } }; } } else //已击杀 { if (killGo != null) { killGo.SetActive(true); } if (timeGo != null) { timeGo.SetActive(false); } } } break; case (int)ToggleType.BOSSCOPPY: if (bossCoppyGo != null) { bossCoppyGo.SetActive(true); } if (remainTimes != null) { remainTimes.text = GameCenter.bossChallengeMng.RemainBuyBossCoppyTimes.ToString(); } string des = data.CurBossRef.res.Replace("#0#", GameCenter.bossChallengeMng.ChallengeBossCoppyTimes.ToString()); des = des.Replace("#1#", (data.CurBossRef.needLevel > GameCenter.mainPlayerMng.MainPlayerInfo.CurLevel)?"[ff0000]":"[00ff00]"); if (labDes != null) { labDes.text = des; } if (lastKillerGo != null) { lastKillerGo.SetActive(false); } break; } if (labDes != null) { labDes.text = labDes.text.Replace("\\n", "\n"); } if (labTip != null) { labTip.text = data.CurBossRef.tip; } if (rewardItem != null) { rewardItem.CellHeight = 80; rewardItem.CellWidth = 80; //Debug.Log("data.rewardList" + data.rewardList.Count); rewardItem.RefreshItems(data.rewardList, 3, data.rewardList.Count); } if (btnFight != null) { btnFight.enabled = true; UIEventListener.Get(btnFight.gameObject).parameter = data; } } if (lastKiller != null) { lastKiller.text = data.KillName; } }