/// <summary> /// 点击按钮 /// </summary> public void OnClick(GameObject go) { if (GameInput.Instance.GetEnableInput() == false || mHoleOpen == false) { return; } // 玩家在安全区域内不响应 Actor localPlayer = Game.GetInstance().GetLocalPlayer(); if (localPlayer != null && localPlayer.IsInSafeArea) { UINotice.GetInstance().ShowMessage(xc.DBConstText.GetText("SKILL_CANNOT_SAFEAREA")); //在安全区无法使用技能 return; } //if (xc.SceneHelp.Instance.IsInNormalWild == false) //{ // //先提示 // ClientEventMgr.GetInstance().FireEvent(xc.EnumUtil.EnumToInt(xc.ClientEvent.CE_CLICK_MATE_SKILL), new CEventBaseArgs(mSkillIdx)); //} //else //{ // RealClick(); //} ClientEventMgr.GetInstance().FireEvent(xc.EnumUtil.EnumToInt(xc.ClientEvent.CE_CLICK_MATE_SKILL), new CEventBaseArgs(mSkillIdx)); }
protected override void UnInitEvent() { base.UnInitEvent(); ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_MONEY_UPDATE, OnMoneyUpdate); Utils.ClientEventManager <ClientEvent> .Instance.UnsubscribeClientEvent(ClientEvent.COMMODITIES_RECEIVED, OnCommoditiesInfosReceived); }
protected void StopRecord(bool upload_file) { if (mState == State.Recording) { VoiceManager.Instance.StopRecord(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_GVOICE_STOP_RECORD, new CEventBaseArgs()); if (upload_file) { if (mPressTime - DelayTime > RecordMinTime) { VoiceManager.Instance.UploadFile(); } else { if (VoiceManager.Instance.IsCanSendByGameLogic) { // 录音时间太短 UINotice.Instance.ShowMessage(DBConstText.GetText("GAME_CHAT_RECORD_TIPS1")); } } } } mState = State.Idle; }
public void OpenSys(DBSysConfig.SysConfig config, bool fire_evet = true) { if (mWaitingSysList.Contains(config)) { mWaitingSysList.Remove(config); } if (!mRawOpenSysIds.Contains(config.Id)) { mRawOpenSysIds.Add(config.Id); } if (!mOpenSysDic.ContainsKey(config.Id)) { mOpenSysList.Add(config); mOpenSysList.Sort(); mOpenSysDic[config.Id] = config; } if (fire_evet) { ClientEventMgr.Instance.FireEvent((int)ClientEvent.CE_SYS_OPEN, new CEventBaseArgs(config)); // 在野外需要发送特殊的系统开启事件 if (xc.SceneHelp.Instance.IsInWildInstance()) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SYS_OPEN_POST, new CEventBaseArgs(config.Id)); } else { ClientEventMgr.GetInstance().PostEvent((int)ClientEvent.CE_SYS_OPEN_POST, new CEventBaseArgs(config.Id)); } } }
public void Init(int id, uint excelId) { List <Dictionary <string, string> > dbs = DBManager.Instance.QuerySqliteRow <string>(GlobalConfig.DBFile, "data_collection", "id", excelId.ToString()); if (dbs.Count > 0) { mDBConfig = dbs[0]; // 帮派BOSS火把 mGuildBossFireComponent = null; if (mDBConfig["class"] == "guild_boss_fire") { mGuildBossFireComponent = gameObject.AddComponent <GuildBossFireComponent>(); mGuildBossFireComponent.Init((uint)id); } UpdateModel(); var collectionObjectBehaviour = gameObject.AddComponent <CollectionObjectBehaviour>(); collectionObjectBehaviour.Init((uint)id, excelId); // 头顶名字 if (string.IsNullOrEmpty(mDBConfig["head_name"]) == false) { UI3DText textComponent = gameObject.AddComponent <UI3DText>(); UI3DText.StyleInfo styleInfo = new UI3DText.StyleInfo(); styleInfo.Offset = DBTextResource.ParseVector3(mDBConfig["head_name_pos_offset"]); textComponent.ResetStyleInfo(styleInfo); textComponent.Text = mDBConfig["head_name"]; } } ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SETTING_QUALITY_CHANGED, OnSettingQualityChanged); }
protected virtual void HandleServerData(ushort protocol, byte[] data) { switch (protocol) { case NetMsg.MSG_NWAR_INIT_INFO: { var pack = S2CPackBase.DeserializePack <S2CNwarInitInfo>(data); OnPlayerInfo(pack); //GameDebug.LogError(">>>MSG_NWAR_INIT_INFO pos: " + pack.init_pos.px + ", " + pack.init_pos.py); GameDebug.Log(">>>MSG_NWAR_INIT_INFO"); } return; case NetMsg.MSG_NWAR_ALL_READY: // 副本开始 { xc.LocalPlayerManager.Instance.m_canShowBuffTips = true; //不允许显示buff提示 xc.LocalPlayerManager.Instance.m_isFirstLoadingScene = false; // 服务端可能会发两次ready过来,第一次是副本准备倒计时结束,第二次是本地的资源加载好,只有在本地资源加载好才是真正的ready if (IsInState(GameState.GS_LOADING_RES) == true) { OnWarReady(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_INSTANCE_START, null); } GameDebug.Log(">>>MSG_NWAR_ALL_READY"); } return; } }
public void ProcessLineCD(uint time) { SceneHelp.Instance.mChangeLineCDTime = time; mDelyLineCdTime = 0; ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHANGE_LINE_CD_TIME, new CEventBaseArgs()); uint cd = 0; cd = GameConstHelper.GetUint("GAME_LINE_CHANGE_CD"); if (SceneHelp.Instance.mChangeLineCDTime + cd > Game.GetInstance().ServerTime) { mDelyLineCdTime = SceneHelp.Instance.mChangeLineCDTime + cd - Game.GetInstance().ServerTime; mLineCDTimer = new Utils.Timer((int)mDelyLineCdTime * 1000, false, 1000, (dt) => { if (dt <= 0f) { mDelyLineCdTime = 0; ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHANGE_LINE_CD_TIME, new CEventBaseArgs()); if (mLineCDTimer != null) { mLineCDTimer.Destroy(); mLineCDTimer = null; } } else { mDelyLineCdTime = Mathf.Ceil(dt / 1000f); } }); } }
/// <summary> /// 处理服务端发送过来的分线信息 /// </summary> /// <param name="msg"></param> public void ProcessLineInfo(S2CMapLineState msg) { mLineInfos.Clear(); uint minLine = GameConstHelper.GetUint("GAME_LINE_MIN"); for (int i = 1; i <= minLine; i++) { mLineInfos.Add((uint)i, 0); } // 设置每条分线上的人数 foreach (var info in msg.hcounts) { uint count = 0; if (mLineInfos.TryGetValue(info.line, out count)) { mLineInfos[info.line] = info.count; } else { mLineInfos.Add(info.line, info.count); } } ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_LINE_INFO, new CEventBaseArgs(msg.dungeon_id)); }
/// <summary> /// 按下技能按钮 /// </summary> /// <param name="go"></param> void OnDown(GameObject go) { if (GameInput.GetInstance().GetEnableInput() == false) { return; } if (mHoleOpen == false) { /*string notice = DBConstText.GetText("SKILL_HOLE_NOTOPEN"); * UINotice.Instance.ShowMessage(notice); * StopPressWait(); * mCoroutine = OnPressLongTime(); * StartCoroutine(mCoroutine);*/ return; } if (mFitPos != 1 && !mHasCastingReadyStage) { mCoroutine = OnPressLongTime(); StartCoroutine(mCoroutine); } if (mHasCastingReadyStage) { OnClick(null); } OnPress(true); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_TRIGGER_SKILL_PRESS_BUTTON, new CEventBaseArgs(mSkillIdx)); }
/// <summary> /// 关闭一个系统的窗口 /// </summary> /// <param name="winName"></param> /// <param name="isPlayMainMapAni"></param> public void CloseSysWindow(string winName, bool isPlayMainMapAni = true) { UIBaseWindow win = null; win = this.GetWindow(winName); //mWindows.TryGetValue(winName, out win); if (mOpeningSysWin.Contains(winName)) { mOpeningSysWin.Remove(winName); } if (win == null) { return; } ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CLOSE_SYS_WIN, new CEventBaseArgs(winName)); // 如果在弹出当前窗口的时候,打开了其他系统窗口,则不需要显示主UI bool open_other_sys_window = UINavgationCtrl.Instance.Pop(winName); if (!open_other_sys_window && isPlayMainMapAni && winName.CompareTo(MainPanelName) != 0 && UINavgationCtrl.Instance.GetStackLen() == 0) { if (IsOpeningSysWinExceptMainmapWin() == false) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_MAINMAP_SWITCH_ANIMATION, new CEventBaseArgs(true)); } } UpdateSysUIMaskBg(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CLOSE_WIN, new CEventBaseArgs(winName)); }
// 响应退出按钮点击 public void OnClickExit() { if (Const.Region == RegionType.CHINA) { IBridge bridge = DBOSManager.getDBOSManager().getBridge(); bridge.logout(); } else { if (Const.Region == RegionType.KOREA) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_SERVERLIST_TO_CREATEACTOR_END, new CEventBaseArgs()); } Close(); GlobalConfig globalConfig = GlobalConfig.GetInstance(); if (globalConfig.IsEnterSDK) { UIManager.Instance.ShowWindow("UIQuickLoginWindow", true); } else { if (Game.Instance.IsSkillEditorScene == false) { UIManager.Instance.ShowWindow("UILoginWindow"); } } } }
public void Quit(bool callApplicationQuit) { // 保存用户配置 GlobalSettings.GetInstance().Save(); // 如果开启了跨服,关闭跨服Socket if (Net.NetClient.CrossToggle) { CrossServerIntegration.GetInstance().Stop(); } StopNetClient(); // 关闭Sqlite连接 DBManager.Instance.CloseAllSqliteDB(); //发送客户端关闭通知 ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_QUIT_GAME, null); LuaScriptMgr.Instance.Destroy(); #if !UNITY_EDITOR if (callApplicationQuit) { Application.Quit(); } #endif }
/// <summary> /// 响应角色死亡的消息 /// </summary> /// <param name="pack"></param> public void HandleUnitDead(S2CNwarUnitDead pack) { var uuid = pack.id; if (ActorHelper.IsPlayer(uuid)) { // 玩家死亡暂时不用做任何处理 } else { var monster = GetWildMonsterInfo(uuid, false); if (monster != null) { if (pack.killer_id == xc.Game.Instance.LocalPlayerID.obj_idx) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_MONSTER_DEAD, new CEventBaseArgs(uuid)); } monster.HandleDead(); mAppearWildMonstersInfo.Remove(uuid); mDisappearWildMonstersInfo.Remove(uuid); } } }
/// <summary> /// 传的时间戳 设置倒计时开始或者倒计时结束 /// </summary> /// <param name="time"></param> public void RestTime(uint start_cd, uint cd) { ZDetalRotation = 0; CDTime = 0; if (cd > Game.GetInstance().ServerTime) { Is_CD = true; CDTime = cd; StartTime = start_cd; gameObject.SetActive(true); var detal = (float)(CDTime - StartTime); var star_detal = Mathf.Abs((float)(Game.GetInstance().ServerTime - StartTime)); ZDetalRotation = (1 - star_detal / detal) * 360.0f; CdImageTrans.localEulerAngles = new Vector3(CdImageTrans.localEulerAngles.x, CdImageTrans.localEulerAngles.y, ZDetalRotation); CdImageTrans.gameObject.SetActive(true); State = LockState.CDIng; ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_SERVER_TIME_CHANGED, OnServerTimeUpdate); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_SERVER_TIME_CHANGED, OnServerTimeUpdate); } else { Is_CD = false; CdImageTrans.localEulerAngles = new Vector3(CdImageTrans.localEulerAngles.x, CdImageTrans.localEulerAngles.y, 360); gameObject.SetActive(true); if (CdImageTrans != null && TimeText != null) { CdImageTrans.gameObject.SetActive(false); TimeText.text = DBConstText.GetText("BAG_UNLOCK1"); } State = LockState.CDEnd; } }
void UpdateDialogWindowInfo() { if (mDialogInfo == null) { return; } DBDialogContent dbDialogContent = DBManager.GetInstance().GetDB <DBDialogContent>(); uint dialogContentInfoId = mDialogInfo.mDialogs[(int)mDialogIndex]; DBDialogContent.DialogContentInfo dialogContentInfo = dbDialogContent.GetDialogContentInfo(dialogContentInfoId); if (dialogContentInfo != null) { uint dialogNum = (uint)mDialogInfo.mDialogs.Count; CheckPlayVoice(dialogContentInfo); if (mDialogIndex < (dialogNum - 1)) // 对话还没完 { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_UPDATE_DIALOG_WINDOW_INFO, new CEventObjectArgs(mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, false)); } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_UPDATE_DIALOG_WINDOW_INFO, new CEventObjectArgs(mDialogInfo.mAutoRunTime, dialogContentInfo, mCustomName, mOtherPlayer, mActorId, mRelatedTask, true)); } } else { GameDebug.LogError("Can not find dialog content info by id " + dialogContentInfoId); } }
/// <summary> /// 点击按钮 /// </summary> void OnClick(GameObject go) { if (GameInput.Instance.GetEnableInput() == false || mHoleOpen == false) { return; } // 玩家在安全区域内不响应 Actor localPlayer = Game.GetInstance().GetLocalPlayer(); if (localPlayer != null && localPlayer.IsInSafeArea) { UINotice.GetInstance().ShowMessage(xc.DBConstText.GetText("SKILL_CANNOT_SAFEAREA")); //在安全区无法使用技能 return; } if (mFitPos == 1) // 第一装配位置的技能按键需要特殊处理 { if (localPlayer.IsShapeShift) // 角色进行了变身,只能触发普通技能 { if (mSkillIdx != 0) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, new CEventBaseArgs(mSkillIdx)); } } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, new CEventBaseArgs(0xF0000000)); } } else { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, new CEventBaseArgs(mSkillIdx)); } }
public override void Update() { if (GameInput.Instance.GetEnableInput() && mIsProcessInput) { ProcessInput(); } // 检测自动状态下,是不是按下了方向 if (mIsProcessInput && GameInput.Instance.GetEnableInput() == false && InstanceManager.Instance.IsAutoFighting) { float v = GameInput.GetInstance().Position.y; float h = GameInput.GetInstance().Position.x; bool state = v != 0 || h != 0; if (state) { Actor localPlayer = Game.GetInstance().GetLocalPlayer(); if (localPlayer != null) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_PLAYERCONTROLED, null); } } } UpdateWalk(); }
static void Clear() { if (mTimer != null) { mTimer.Destroy(); mTimer = null; } mSecond = 1; mText = ""; mPic = ""; mInterruptCallback = null; mFinishCallback = null; var localPlayer = Game.GetInstance().GetLocalPlayer(); if (localPlayer != null) { localPlayer.UnsubscribeActorEvent(Actor.ActorEvent.EXITIDLE, OnLocalPlayerBeInterrupted); localPlayer.UnsubscribeActorEvent(Actor.ActorEvent.BEATTACK, OnLocalPlayerBeInterrupted); localPlayer.UnsubscribeActorEvent(Actor.ActorEvent.DEAD, OnLocalPlayerBeInterrupted); } ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_PLAYERCONTROLED, OnPlayerControlled); ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_TRIGGER_SKILL_CLICK_BUTTON, OnPlayerControlled); ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_CLICKCOLLISION, OnPlayerControlled); ClientEventMgr.Instance.FireEvent((int)ClientEvent.CONTROL_COMMON_SLIDER, new CEventObjectArgs(false, 0f, "", "")); }
public void FireNotTouchUIEvent(GameObject hoverObj) { if ((hoverObj != null && hoverObj.layer != LayerMask.NameToLayer("UI")) || hoverObj == null) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_TOUCH_NOT_UI, null); } }
protected override void UnInitUI() { base.UnInitUI(); ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_SELECT_SERVER, OnSelectServerChange); mLoginButton.onClick.RemoveAllListeners(); mUserButton.onClick.RemoveAllListeners(); mGotoServerListButton.onClick.RemoveAllListeners(); mBtnAnnouncement.onClick.RemoveAllListeners(); DestoryMaintainingServerTimers(); ServerListHelper.Instance.ClearAllCallback(); if (mCustomLogoRawImage != null) { mCustomLogoRawImage.texture = null; mCustomLogoRawImage = null; } if (mCustoLogoTexture != null) { Resources.UnloadAsset(mCustoLogoTexture); mCustoLogoTexture = null; } }
public void Dispose() { mFunc = null; mParam = null; ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)ClientEvent.CE_SERVER_TIME_CHANGED, OnServerTimeUpdate); }
/// <summary> /// 点击怪物挂机点的按钮 /// </summary> /// <param name="info"></param> public void OnClickMonsterPoint(MiniMapPointInfo info) { MonsterTipsTrigger.gameObject.SetActive(true); MonsterTipsTrigger.transform.SetAsLastSibling(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.NEW_MINIMAP_SELECT_MONSTER_MINIMAPINFO, new CEventEventParamArgs("MiniMap", info)); SetMonsterTipsInfo(info); }
/// <summary> /// 点击返回键时调用,关闭配置相关的界面 /// </summary> /// <returns></returns> public bool TryCloseAllWindow() { bool isHasClose = false; UINavgationCtrl.Instance.Clear(); List <string> windows_list = SGameEngine.Pool <string> .List.New(mWindows.Keys.Count); foreach (var k in mWindows.Keys) { windows_list.Add(k); } foreach (string win_name in windows_list) { var wnd = mWindows[win_name]; if (wnd == null) { continue; } if (wnd.IsShow == false) { continue; } if (wnd.ReturnHandle == 0)// 不处理 { continue; } else if (wnd.ReturnHandle == 1) // 关闭 { isHasClose = true; if (wnd.IsSystemWindow) { CloseSysWindow(win_name); } else { CloseWindow(win_name); } } else // 打开 { if (wnd.IsShow == false) { UIManager.Instance.ShowSysWindow(win_name); } } } SGameEngine.Pool <string> .List.Free(windows_list); UINavgationCtrl.Instance.Clear(); // 通知主UI播放收回的动画 ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_MAINMAP_SWITCH_ANIMATION, new CEventBaseArgs(true)); return(isHasClose); }
void Update() { if (!isRecording && Time.time > triggerTime) { ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_CHAT_VOICE_START_MESSAGE, new CEventBaseArgs(this)); isRecording = true; } }
void OnDestroy() { if (mAddBtn != null) { mAddBtn.onClick.RemoveAllListeners(); } ClientEventMgr.GetInstance().UnsubscribeClientEvent((int)xc.ClientEvent.CE_MONEY_UPDATE, OnMoneyUpdate); }
public override bool Kill() { bool isDead = base.Kill(); ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.CE_NPCDEAD, new CEventBaseArgs(UID)); return(isDead); }
void Awake() { if (mAddBtn != null) { mAddBtn.onClick.AddListener(OnClickAddBtn); } ClientEventMgr.GetInstance().SubscribeClientEvent((int)xc.ClientEvent.CE_MONEY_UPDATE, OnMoneyUpdate); }
public TimelineManager() { mLoadPrefabCoroutines.Clear(); mPreloadedTimelineReses.Clear(); mPreloadingTimelines.Clear(); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_START_SWITCHSCENE, OnSwitchScene); }
public EffectManager() { m_CurEffectNum = 0; mSkillAttackMaps = new Dictionary <ulong, SkillAttackInstance>(); mEmitterTemplateMap = new Dictionary <string, EffectEmitter>(); mAnimationEffectMap = new Dictionary <uint, AnimationEffect>(); ClientEventMgr.GetInstance().SubscribeClientEvent((int)ClientEvent.CE_START_SWITCHSCENE, OnSwitchScene); }
/// <summary> /// 当选中某一UI控件 /// </summary> /// <param name="select_ui"></param> /// <param name="image_name"></param> public void OnSelectUI(Selectable select_ui, string sprite_name, string check_sprite_name) { if (select_ui != null && (string.IsNullOrEmpty(sprite_name) == false || string.IsNullOrEmpty(check_sprite_name) == false)) { AudioManager.Instance.OnSelectUI(select_ui, sprite_name, check_sprite_name); } ClientEventMgr.GetInstance().FireEvent((int)ClientEvent.SELECT_UI, new CEventEventParamArgs(select_ui, sprite_name, check_sprite_name)); }