void _ME(ModuleEvent <Module_Union> e) { switch (e.moduleEvent) { case Module_Union.EventUnionCardSign: if (!actived) { return; } moduleUnion.RemoveFirstSign(); SetSignInfo(); break; case Module_Union.EventUnionCardChange: SetTimesTxt(); break; case Module_Union.EventUnionCardReward: var point = Util.Parse <int>(e.param1.ToString()); DelayEvents.Add(() => { moduleGlobal.ShowMessage(string.Format(ConfigText.GetDefalutString(629, 15), point)); }, 0.5f); SetTimesTxt(); break; } }
void _Packet(ScWorldSession p) { if (p.code == 1) { chatContentTimes++; if (chatContentTimes > 15) { DelayEvents.Remove("chat_content"); Logger.LogError("chat packet can not content !!"); } else if (chatContentTimes > 6) { DelayEvents.Add(() => { WorldSession(); }, 60f, "chat_content"); } else { DelayEvents.Add(() => { WorldSession(); }, 1f, "chat_content"); } } else if (p.code == 0) { Logger.LogChat("Connect chat server succed!"); chatContentTimes = 0; if (moduleFriend.GetAllChatInfo) { moduleChat.GetLateInfo(); moduleChat.GetServerMes(); } } else { Logger.LogError("Connect chat server info is error"); } }
private void ReturnToLoginGuard() { DelayEvents.Remove(m_waitEventHandler); m_waitEventHandler = -1; if (session.connected) { session.Disconnect(); } if (modulePVP.connected) { modulePVP.Disconnect(); } if (moduleTeam.connected) { moduleTeam.Disconnect(); } if (moduleChat.connected) { moduleChat.Disconnect(); } Game.paused = false; ObjectManager.timeScale = 1.0; ClearData(); Game.ResetGameData(); Game.LoadLevelGuard(0); DispatchModuleEvent(EventReturnToLogin); }
private void OnSceneLoadComplete() { DelayEvents.Remove(m_delayEventID); firstLoading = false; m_curLoadingWindow?.Hide(false, !m_curLoadingWindow.Equals(m_defaultLoadingWindow)); }
void _Packet(ScLogin p) { firstEnter = p.result == 1; loggedIn = p.result < 2; if (p.result > 1) { waitLoginTimer = 0; LoginEnd(p.result); return; } moduleSelectRole.SetRoleSummary(p.roleList); var wait = Level.realTime - m_sendLoginTime; if (wait >= waitLoginTimer) { LoginEnd(p.result); } else { var result = p.result; m_waitEventHandler = DelayEvents.Add(() => { LoginEnd(result); }, (waitLoginTimer - wait) * 0.001f); } waitLoginTimer = 0; }
private void OnOtherLoadingState(Event_ e) { var show = e.param1 == null || (bool)e.param1; var window = e.param2 as string; var delay = e.param3 == null ? 0 : (float)e.param3; var mode = e.param4 == null ? 0 : (int)e.param4; DelayEvents.Remove(m_delayEventID); if (!show) { m_curLoadingWindow?.Hide(false, !m_curLoadingWindow.Equals(m_defaultLoadingWindow)); } else { if (delay <= 0f) { ShowLoadingWindow(window, mode); } else { m_delayEventID = DelayEvents.Add(() => { ShowLoadingWindow(window, mode); }, delay); } } }
private void Login() { if (session.connected) { session.Disconnect(); } moduleGlobal.LockUI(0.5f); session.Connect(account.server.host, account.server.port, s => { moduleGlobal.UnLockUI(); DispatchModuleEvent(EventConnection, s.connected ? 0 : 1); if (!s.connected || account == null) { return; // Connect aborted if account is null } m_preventLoginMessage = 0; DelayEvents.Remove(m_waitEventHandler); m_sendLoginTime = Level.realTime; var p = PacketObject.Create <CsLogin>(); p.accName = account.acc_name; p.accId = account.acc_id; p.tick = account.tick; p.type = WebAPI.PLATFORM_TYPE; s.Send(p); }); }
protected override void OnEnterState(int oldMask, BattleStates state) { if (state == BattleStates.Ended) { PlayerPrefs.SetInt("FinishTrain", 1); m_loadTime = Time.realtimeSinceStartup - m_loadTime; DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelEnd, 1)); DispatchEvent(Events.LAUNCH_PROCESS, Event_.Pop(LaunchProcess.ShowLevelTime, m_loadTime)); moduleStory.workOffline = false; DelayEvents.Add(() => { moduleGlobal.FadeIn(1.0f, 1, false, () => { Root.instance.StartCoroutine(WaitLoginLoaded()); }); }, 1.5f); return; } base.OnEnterState(oldMask, state); }
private void OnWindowSettlementVisible(Window rWindow) { DelayEvents.Add(() => { Module_PVP.instance.isInvation = false; Module_PVP.instance.isMatchAgain = false; Module_Match.instance.isbaning = true; Game.GoHome(); }, 2); }
public static ControllerEffect_ShowText Create(CombatConfig.ShowText rInfo, Transform rParent) { var controller = pool.Pop(); DelayEvents.Add(() => { controller.Initialize(rInfo, rParent); }, rInfo.delay); return(controller); }
protected override void OnGameDataReset() { base.OnGameDataReset(); m_allNpcInfo.Clear(); m_allNpcs.Clear(); curNpc = null; DelayEvents.Remove(eventIndex); isNpcLv = false; lvupNpc = null; }
protected override void OnClose() { base.OnClose(); m_player = null; m_hero1 = null; m_hero1 = null; DelayEvents.Remove(m_bossDelayEvent); EventManager.RemoveEventListener(this); }
private void OnWindowHomeVisible(Window rWindow) { if (targetRoleId <= 0) { return; } DelayEvents.Add(() => { Window.ShowAsync <Window_PVP>(); }, 10); }
protected void ClearData() { account = null; ok = false; loggedIn = false; moduleGlobal.Hidepao(); DelayEvents.Remove(m_waitEventHandler); m_waitEventHandler = -1; }
protected override void OnGameDataReset() { base.OnGameDataReset(); if (!m_useGameSession) { Disconnect(); } chatContentTimes = 0; DelayEvents.Remove("chat_content"); }
private void OnFocusPointChange(Event_ e) { var id = (int)e.param1; var current = ConfigManager.Get <AwakeInfo>(id); if (!current) { return; } DelayEvents.Add(() => { if (current.nextInfoList.Count != 0) { if (!controller.isDraging) { controller.curve = null; var l = current.layer; while (Module_Awake.instance.CanEnterNextLayer(CurrentType, l)) { l += 1; } FocusLayer = l; Watch(true); } else { Refresh(); } } var currentController = GetAwakeController(current.layer, current.index); if (currentController) { currentController.RefreshState(); } var nextList = Module_Awake.NextAwakeInfo(id); foreach (var next in nextList) { var c = GetAwakeController(next.layer, next.index); if (c) { c.RefreshState(); } } }, 0.3f); }
private void OnBossCameraAnimWhiteFadeIn() { if (!m_bossWhiteObj) { return; } DelayEvents.Remove(m_bossDelayEvent); m_bossWhiteObj.SafeSetActive(true); (m_bossWhiteObj.transform as RectTransform).SetAsLastSibling(); m_bossDelayEvent = DelayEvents.Add(() => { m_bossWhiteObj.SafeSetActive(false); }, (float)(CombatConfig.spveBossAnimWhiteFadeIn + CombatConfig.spveBossAnimWhiteFadeOut)); }
private void ResponseMoppingUp(ScChaseMoppingUp msg) { if (msg.result != 0) { moduleGlobal.ShowMessage(9605, msg.result); return; } moduleChase.ProcessTimes(task, msg.rewards?.Length ?? 0); parentWindow.RefreshChallengeTimes(); RefreshMatrial(); PReward[] arr = null; msg.rewards.CopyTo(ref arr); waitList.AddRange(arr); DelayEvents.Add(StartShow, 0.05f); }
private void BeInvited(Event_ e) { if (!isStart) { return; } if (targetRoleId > 0) { return; } DelayEvents.Add(() => { var wg = Window.GetOpenedWindow <Window_Global>(); wg?.overtime(0); }, 1); }
private void InvationFailed(Event_ e) { if (!isStart) { return; } if (targetRoleId <= 0) { return; } DelayEvents.Add(() => { var wg = Window.GetOpenedWindow <Window_Global>(); wg?.overtime(2); }, 1); }
private void SetAnimation(int boxId, Image lockImg) { if (!actived) { return; } var key = "union" + modulePlayer.id_.ToString() + boxId.ToString(); var show = moduleWelfare.FrirstOpen(key, false); if (show) { DelayEvents.Add(() => { lockImg.gameObject.SetActive(true); PlayerPrefs.SetString(key, Util.GetServerLocalTime().ToString()); }, 1.5f * AnmiaDelayTimes); AnmiaDelayTimes++; } }
private void CheckDeviceKeyInput() { if (!Game.started) { return; // Do not handle key input if game not started } if (Input.GetKeyUp(KeyCode.Escape)) { var t = GeneralConfigInfo.swaitToQuit; if (m_waittingQuit || t < 0.1f) { Game.Quit(); } else { m_waittingQuit = true; DelayEvents.Add(() => m_waittingQuit = false, t); Module_Global.instance.ShowGlobalNotice(31, t * 0.65f, t * 0.35f); } } }
void _Packet(ScNpcExpLock p) { if (p == null) { return; } var npc = GetTargetNpc((NpcTypeID)p.npcId); if (npc == null) { return; } moduleGlobal.ShowMessage(Util.Format(Util.GetString(210, 10), npc.name)); var task = npc.npcInfo.tasks.Find(o => o.fetterLv == npc.fetterLv); var hintID = task.hintStoryID; if (hintID <= 0) { return; } //触发对话--引导玩家完成羁绊进阶任务 var window = Window.GetOpenedWindow <Window_NPCDatingSettlement>(); var settle = Window.GetOpenedWindow <Window_Settlement>(); if (window != null && window.actived) { DelayEvents.Remove(eventIndex); eventIndex = DelayEvents.Add(() => moduleNPCDating.DoDatingEvent(hintID), GeneralConfigInfo.defaultConfig.wstOnEngagement); } else if (settle != null && settle.actived) { DelayEvents.Remove(eventIndex); eventIndex = DelayEvents.Add(() => moduleNPCDating.DoDatingEvent(hintID), GeneralConfigInfo.defaultConfig.wstOnPve); } else { moduleNPCDating.DoDatingEvent(hintID); } }
private void ShowLoadingWindow(string n, int mode) { if (string.IsNullOrEmpty(n)) { n = Window_DefaultLoading.defaultName; } DelayEvents.Remove(m_delayEventID); Window.SetWindowParam(n, mode); var o = m_curLoadingWindow; if (string.IsNullOrEmpty(n) || n == Window_DefaultLoading.defaultName) { m_curLoadingWindow = m_defaultLoadingWindow; m_defaultLoadingWindow.Show(true); } else { Window.ShowImmediatelyAsync(n, w => { m_curLoadingWindow = w; if (!m_curLoadingWindow) { m_curLoadingWindow = m_defaultLoadingWindow; m_curLoadingWindow.Show(true); } else { m_curLoadingWindow.markedGlobal = true; m_curLoadingWindow.isFullScreen = false; } }); } if (o && !o.Equals(m_curLoadingWindow)) { o.Hide(true, o.hideDestroy); } }
public override bool UnInitialize(bool hide = true) { if (base.UnInitialize(hide)) { for (var i = 0; i < delayEventIDList.Count; i++) { var delayID = delayEventIDList[i]; DelayEvents.Remove(delayID); } petSelectModule.UnInitalize(); talkButton?.onClick.RemoveListener(OnTease); fightButton?.onClick.RemoveListener(OnPetFight); restButton?.onClick.RemoveListener(RestButton); skillButton?.onClick.RemoveAllListeners(); m_pet?.Destroy(); m_lockEffect?.Destroy(); m_modeName = null; return(true); } return(false); }
private void RefreshMessage(string msg) { var t = m_messageRoot.AddNewChild(m_messageTemp); Util.SetText(t.gameObject, msg); t.SafeSetActive(true); m_messageList.Enqueue(t.gameObject); if (m_messageList.Count > Module_FactionBattle.MESSAGE_MAX) { Object.Destroy(m_messageList.Dequeue()); } if (m_scrollRect != null) { DelayEvents.Add(() => { DOTween.To(() => m_scrollRect.verticalNormalizedPosition, v => m_scrollRect.verticalNormalizedPosition = v, 0, 0.3f); }, 0.1f); } }
/// <summary> /// 宠物信息更新 /// </summary> public void Refresh() { if (SelectPet == null) { return; } Util.SetText(nameText, SelectPet.CPetInfo.itemNameId); RefreshSkill(); RefreshDescColor(); RefreshStar(); RefreshModule(); RefreshAttribute(); RefreshButtonState(); RefreshMood(); RefreshEvolve(); RefreshNotice(); //要等scrollView先刷新把new标签显示出来 DelayEvents.Add(() => { modulePet.NewPetList.Remove(SelectPet.ID); }, 0.2f); petSelectModule.SetItem(SelectPet); }
/// <summary> /// 送礼动画 /// </summary> private void OnPlayGift() { if (!enabled || currentNpc == null) { return; } TweenPosition target = null; if (tweenTarget && npc_Type == NpcTypeID.WishNpc) { target = tweenTarget.GetComponent <TweenPosition>(); target?.PlayReverse(); } if (!Module_Gift.instance.isGiveGift) { return; } if (target) { delayIndex = DelayEvents.Add(() => { npc_creatrue.stateMachine.TranslateTo(currentNpc.actionInfo?.sendGiftState); Logger.LogDetail("播送礼动画={0}", currentNpc.actionInfo?.sendGiftState); Module_Gift.instance.isGiveGift = false; DelayEvents.Remove(delayIndex); }, target.duration); } else { npc_creatrue.stateMachine.TranslateTo(currentNpc.actionInfo?.sendGiftState); Logger.LogDetail("播送礼动画={0}", currentNpc.actionInfo?.sendGiftState); Module_Gift.instance.isGiveGift = false; } }
public void _LogicUpdate(int diff, int unscaledDiff) { if (m_logicUpdating) { return; } m_logicUpdating = true; deltaTime = unscaledDiff; globalDeltaTime = diff; Level.levelTime += unscaledDiff; ++m_frameCount; DispatchEvent(Events.ROOT_ENTER_FRAME, m_globalEvent, false); PhysicsManager.Update(diff); DelayEvents.Update(diff); var size = m_objects.Count; for (var i = 0; i < size;) { var o = m_objects[i]; try { if (!o.destroyed && o.enableUpdate) { o.EnterFrame(); o.Update((int)(diff * o.localTimeScale)); o.QuitFrame(); } if (o.pendingDestroy) { o.Destroy(); } } #if DEVELOPMENT_BUILD || UNITY_EDITOR catch (Exception e) { Logger.LogException(e); } #else catch { } #endif if (o.destroyed) { m_objects.RemoveAt(i); size--; m_rootSize--; if (i <= m_rootIdx) { --m_rootIdx; } } else { ++i; } } DispatchEvent(Events.ROOT_QUIT_FRAME, m_globalEvent, false); onLogicUpdate?.Invoke(diff); m_logicUpdating = false; }