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); }); }
private void OnSceneLoadComplete() { DelayEvents.Remove(m_delayEventID); firstLoading = false; m_curLoadingWindow?.Hide(false, !m_curLoadingWindow.Equals(m_defaultLoadingWindow)); }
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); }
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"); } }
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); }
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 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)); }
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); }
/// <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; } }