void CreateCharacterDetailUIEnterBtnUp() { #region ���ƴ��� //if (m_lastSelectedCharacter.vocation == (int)Vocation.Archer) //// || m_lastSelectedCharacter.vocation == (int)Vocation.Mage) //{ // return; //} #endregion string characterName = NewLoginUIViewManager.Instance.GetCharacterNameInputText(); if (string.IsNullOrEmpty(characterName)) { MogoMessageBox.RespError(LangOffset.Character, (int)CharacterCode.INPUT_NAME); return; } var isMatch = System.Text.RegularExpressions.Regex.IsMatch(characterName, @"[\s]+") || characterName.Contains(@"\") || characterName.Contains(@"/") || characterName.Contains(@"[") || characterName.Contains(@"]"); Debug.Log("characterName: " + characterName + " isMatch: " + isMatch); if (isMatch) { MogoMessageBox.RespError(LangOffset.Character, (int)CharacterCode.INVALID_NAME); return; } EventDispatcher.TriggerEvent <string, byte, byte>(Events.UIAccountEvent.OnCreateCharacter, characterName, 1, (byte)m_lastSelectedCharacter.vocation); GameProcManager.SetGameProgress(ProcType.CreateCharacter, "ChreateCharacter"); }
public void ShowChooseServerUIFormCreateChr(bool isConnectSuccess = true) { ShowChooseServerUI(isConnectSuccess); m_onChooseServerUIBackBtnUp = () => { if (!m_isConnectSuccess) { MogoMessageBox.Info("Please select a server."); return; } MogoWorld.LoadCharacterScene(); }; m_onChooseServerGridUp = (index) => { if (index != 0 && m_isConnectSuccess && SystemConfig.SelectedServerIndex == index) { MogoWorld.LoadCharacterScene(); return; } //Debug.Log(index); SystemConfig.SelectedServerIndex = index; var server = SystemConfig.GetServerInfoByIndex(index); Debug.Log("server.id: " + server.id); if (server != null) { SystemConfig.Instance.SelectedServer = server.id; } SystemConfig.SaveConfig(); MogoWorld.Login(); //EventDispatcher.TriggerEvent<int>(Events.UIAccountEvent.OnChangeServer, id); }; }
/// <summary> /// 显示服务回调错误信息。 /// </summary> /// <param name="offset">语言表分段偏移量。</param> /// <param name="errorId">错误码。</param> /// <param name="args">错误信息填充内容。</param> public static void RespError(Mogo.Game.LangOffset offset, int errorId, params object[] args) { var errorCode = (int)offset + errorId; var content = LanguageData.dataMap.GetValueOrDefault(errorCode, new LanguageData() { content = String.Format(ERROR_CODE_DEFAULT, errorCode) }); MogoMessageBox.Info(content.Format(args)); }
public void OnBuffClick(int index) { Debug.Log("OnBuffClick:" + index); if (index == 0) { int priceId = DragonBaseData.dataMap[1].cutCompleteTimeFiveMinPrice; int price = PriceListData.GetPrice(priceId, 0); MogoMessageBox.Confirm(LanguageData.dataMap[26307].Format(price), (isOk) => { if (isOk) { if (price > MogoWorld.thePlayer.diamond) { ShowLackOfDiamondTip(); } else { RpcCall("ReduceConvoyTimeReq"); } //todo请求缩短5分钟 } }); } else { int priceId = DragonBaseData.dataMap[1].immediateCompleteConvoyPrice; int time = (int)m_currentData.matchTimeLeft / 60; if (time == 0) { time++; } int price = PriceListData.GetPrice(priceId, time); price *= time; MogoMessageBox.Confirm(LanguageData.dataMap[26308].Format(price), (isOk) => { if (isOk) { if (price > MogoWorld.thePlayer.diamond) { ShowLackOfDiamondTip(); } else { //todo请求立刻完成比赛 RpcCall("ImmediateCompleteConvoyReq"); } } }); } }
/// <summary> /// 点击领悟UI重置按钮 /// </summary> void OnLearnSkillUIResetUp() { MogoMessageBox.Confirm(LanguageData.GetContent(29602, PriceListData.GetPrice(22, 0)), (flag) => { if (flag) { ElfSystem.Instance.ResetElfSkillReq(); } }); }
void OnCreateCharacterUp() { LoggerHelper.Debug("Create Character " + CreateCharacterUIViewManager.Instance.GetNewCharacterName() + " With Job " + m_iJobID); string characterName = CreateCharacterUIViewManager.Instance.GetNewCharacterName(); if (string.IsNullOrEmpty(characterName)) { MogoMessageBox.RespError(LangOffset.Character, (int)CharacterCode.INPUT_NAME); return; } EventDispatcher.TriggerEvent <string, byte, byte>(Events.UIAccountEvent.OnCreateCharacter, characterName, 1, m_iJobID); }
/// <summary> /// 增加挑战次数Btn /// </summary> void OnBtnAddTimesUp() { MogoMessageBox.Confirm(LanguageData.GetContent(24002, PriceListData.dataMap. Get(8).priceList[1]), (flag) => { if (flag) { EventDispatcher.TriggerEvent(Events.ArenaEvent.AddArenaTimes); } }); }
/// <summary> /// 清除CDBtn /// </summary> void OnBtnClearCDUp() { MogoMessageBox.Confirm(LanguageData.GetContent(812, PriceListData.dataMap. Get(5).priceList[1] * Math.Ceiling(TimerManager.GetTimer(NewArenaUIViewManager.Instance.m_lblArenaUIChallengeCDNum.gameObject).GetSeconds() / 60.0f)), (flag) => { if (flag) { EventDispatcher.TriggerEvent(Events.ArenaEvent.ClearArenaCD); } }); }
public void OnClearCD() { MogoMessageBox.Confirm(LanguageData.GetContent(812, PriceListData.dataMap. Get(5).priceList[1] * Math.Ceiling(TimerManager.GetTimer(m_view.m_arenaCD).GetSeconds() / 60.0f)), (flag) => { if (flag) { EventDispatcher.TriggerEvent(Events.ArenaEvent.ClearArenaCD); } }); }
// 删除角色 private void DelCharacter(int gridID) { // todo confirm dialog var avatar = GetAvatarInfo(gridID); if (avatar == null) { MogoMessageBox.RespError(LangOffset.Character, (int)CharacterCode.NOT_SELECTED); //MogoGlobleUIManager.Instance.Confirm("no select role", (rst) => { MogoGlobleUIManager.Instance.ConfirmHide(); }); return; } this.RpcCall("DelCharacterReq", avatar.DBID); GuideSystem.Instance.DelCharacterGuideConfig(avatar.DBID); }
public void OnHitTimesAddUp() { int priceId = DragonBaseData.dataMap[1].attackTimesPrice; int price = PriceListData.GetPrice(priceId, 0); MogoMessageBox.Confirm(LanguageData.dataMap[26310].Format(price), (isOk) => { if (isOk) { Debug.Log("BuyAtkTimesReq"); //todo请求增加袭击次数 RpcCall("BuyAtkTimesReq"); } }); }
public void OnRefreshOtherPlayers() { int priceId = DragonBaseData.dataMap[1].freshAdversaryPrice; int price = PriceListData.GetPrice(priceId, 0); MogoMessageBox.Confirm(LanguageData.dataMap[26315].Format(price), (isOk) => { if (isOk) { //todo请求刷新其他玩家 Debug.Log("OnRefreshOtherPlayers"); MogoWorld.thePlayer.RpcCall("FreshAdversaryReq"); } }); }
public void ShowSkillPointBox(int index) { if (ElfNodeData.dataMap.Get(Int32.Parse(start) * 100 + index + 1).AwardSkillPoint > 0) { MogoMessageBox.Confirm(LanguageData.GetContent(29619), LanguageData.GetContent(29620), (flag) => { if (flag) { SpriteUIViewManager.Instance.SwitchSpriteSkillDetailUIToSpriteSkillUI(); SpriteUIViewManager.Instance.SwitchSpriteSkillUIToSpriteLearnSkillUI(); ElfSystem.Instance.ElfSkillInfoReq(); } }); } }
public void OnBuyDragon(int id) { //请求购买 int priceId = DragonBaseData.dataMap[1].goldDragonPrice; int price = PriceListData.GetPrice(priceId, 0); MogoMessageBox.Confirm(LanguageData.dataMap[26311].Format(price), (isOk) => { if (isOk) { //todo请求购买金龙 MogoWorld.thePlayer.RpcCall("BuyGoldDragonReq"); } }); }
void OnDeleteCharacterBtnUp() { var avatarInfo = MogoWorld.theAccount.GetAvatarInfo(m_selectedCharacterId); if (avatarInfo == null) { return; } MogoMessageBox.Confirm(LanguageData.GetContent((int)LangOffset.Character + (int)CharacterCode.DELETE_CHARACTER, avatarInfo.Level, avatarInfo.Name), LanguageData.GetContent(MogoMessageBox.LANGUAGE_CANCEL), LanguageData.GetContent(LANGUAGE_DELETE), (flag) => { if (!flag) { EventDispatcher.TriggerEvent <int>(Events.UIAccountEvent.OnDelCharacter, m_selectedCharacterId); } }, -1, ButtonBgType.Blue, ButtonBgType.Brown); }
public void NormalSweep() { if (m_view.m_sweepReady) { int cost = 0; foreach (var item in TowerSweepCdClearCostData.dataMap.Values) { if (item.times == Data.NormalSweepUsed) { cost = item.cost; } } if (cost > 0) { MogoMessageBox.Confirm(LanguageData.GetContent(812, cost), (rst) => { if (rst) { EventDispatcher.TriggerEvent(Events.TowerEvent.ClearCD); MogoGlobleUIManager.Instance.ConfirmHide(); } else { MogoGlobleUIManager.Instance.ConfirmHide(); } }); } else { MogoMsgBox.Instance.ShowFloatingText(LanguageData.dataMap.Get(799).content); } } else { Debug.Log("not vip"); EventDispatcher.TriggerEvent(Events.TowerEvent.NormalSweep); } }
private void OnLoginResp(byte errorID) { //Debug.Log("OnLoginResp(" + errorID+")"); if (errorID == 0) { NewLoginUILogicManager.Instance.ReleaseCharacter(); } else { MogoMessageBox.RespError(LangOffset.StartGame, errorID); } //MogoWorld.scenesManager.LoadHomeScene((isLoadScene) => //{ // if (isLoadScene) // AssetCacheMgr.GetUIInstance("prefab_101.prefab", (prefab, id, go) => // { // var gameObject = go as GameObject; // gameObject.tag = "Player"; // gameObject.AddComponent<ActorMyself>(); // gameObject.AddComponent<CueHandler>(); // }); //}); }
// 创建角色回调 private void OnCreateCharacterResp(byte errorID, ulong characterID) { Debug.Log("OnCreateCharacterResp(" + errorID + ", " + characterID + ")"); if (errorID == 0) { //Debug.Log("OnCreateCharacterResp( " + avatarList[(int)characterID].Name+")"); //Debug.LogError("name:" + m_currentName); if (SystemSwitch.UsePlatformSDK) { PlatformSdkManager.Instance.CreateRoleLog(m_currentName, SystemConfig.Instance.SelectedServer.ToString()); } SystemConfig.Instance.SelectedCharacter = string.Concat(SystemConfig.Instance.Passport, ",", avatarList.Count); SystemConfig.SaveConfig(); this.RpcCall("StartGameReq", characterID); //MogoWorld.scenesManager.LoadCharacterScene(null); //CharaterInfoReq(); } else { MogoMessageBox.RespError(LangOffset.Character, errorID); } }
public void OnHitCDClearUp() { Debug.Log("OnHitCDClearUp"); int priceId = DragonBaseData.dataMap[1].clearAttackCDPrice; //PriceListData priceData = PriceListData.dataMap.Get(priceId); int num = DragonMatchUIViewManager.Instance.GetHitCDLastSeconds() / 60; if (num == 0) { num = 1; } long price = PriceListData.GetPrice(priceId, 0) * (num); MogoMessageBox.Confirm(LanguageData.dataMap[26309].Format(price), (isOk) => { if (isOk) { //todo请求清楚cd RpcCall("ClearAttackCDReq"); } }); }
public void LoadCharacterScene(Action loaded, Action <int> process = null, bool CreateCharacter = false, bool hideReturnBtn = false) { Action action = () => { MogoGlobleUIManager.Instance.ShowWaitingTip(true); var serverInfo = SystemConfig.GetSelectedServerInfo(); if (CreateCharacter) { //NewLoginUIViewManager.Instance.ShowCreateCharacterUI(); //NewLoginUIViewManager.Instance.ShowCreateCharacterUIBackBtn(!hideReturnBtn); //if (serverInfo != null) // NewLoginUIViewManager.Instance.SetCreateCharacterServerBtnName(serverInfo.name); NewLoginUILogicManager.Instance.LoadCreateCharacter( () => { if (loaded != null) { loaded(); } NewLoginUIViewManager.Instance.ShowCreateCharacterUI(); NewLoginUIViewManager.Instance.ShowCreateCharacterUIBackBtn(!hideReturnBtn); if (serverInfo != null) { NewLoginUIViewManager.Instance.SetCreateCharacterServerBtnName(serverInfo.name); } //MogoMessageBox.HideLoading(); MogoGlobleUIManager.Instance.ShowWaitingTip(false); }); } else { NewLoginUIViewManager.Instance.ShowChooseCharacterUI(); //NewLoginUILogicManager.Instance.LoadChooseCharacterSceneAfterDelete(); if (serverInfo != null) { NewLoginUIViewManager.Instance.SetChooseCharacterServerBtnName(serverInfo.name); } if (loaded != null) { loaded(); } } }; MogoMessageBox.ShowLoading(); LoadScene(MogoWorld.globalSetting.chooseCharaterScene, (isLoadScene, data) => { if (isLoadScene) { if (LoginUIViewManager.Instance) { LoginUIViewManager.Instance.ReleaseUIAndResources(); } LoadMainUI(() => { MogoMessageBox.HideLoading(); MogoUIManager.Instance.ShowNewLoginUI(action); }); } else { MogoMessageBox.HideLoading(); action(); } }, MogoMessageBox.Loading, false); }
/// <summary> /// 加载场景。 /// </summary> /// <param name="id">场景标识</param> /// <param name="loaded">加载结束,参数为是否加载场景</param> /// <param name="needLoading">是否需要Loading界面</param> public void LoadScene(int id, Action <Boolean, MapData> loaded, Action <int> process = null, bool needLoading = true) { if (needLoading) { MogoMessageBox.ShowLoading(); } if (m_lastScene == id) { //Debug.Log("Same scene in LoadScene: " + id); if (loaded != null) { try { loaded(false, null); } catch (Exception ex) { Debug.LogException(ex); } if (needLoading) { MogoMessageBox.HideLoading(); } } return; } //使用资源监测,在卸载前打印场景所使用的资源出来 if (m_currentMap != null) { ResourceWachter.Instance.SceneID = id; } UnloadScene(() => { MapData data; bool flag = MapData.dataMap.TryGetValue(id, out data); if (!flag) { Debug.LogError("map_setting id not exist: " + id); if (loaded != null) { try { loaded(false, null); } catch (Exception ex) { Debug.LogException(ex); } if (needLoading) { MogoMessageBox.HideLoading(); } } return; } m_lastScene = id; m_currentMap = data; if (id == MogoWorld.globalSetting.loginScene) { EventDispatcher.TriggerEvent(SettingEvent.BuildSoundEnvironment, id); } Action loadScene = () => { LoadScene(data, (isLoadScene) => { //Debug.Log("RenderSettings: " + id); if (loaded != null) { try { if (process != null) { process(80); } if (MogoWorld.thePlayer != null) { MogoWorld.thePlayer.SetLightVisible(data.characherLight == GameData.LightType.Normal); } preloadResource(id, process, () => { if (process != null) { process(99); } loaded(isLoadScene, data); if (process != null) { process(100); } }); } catch (Exception ex) { Debug.LogException(ex); } } }, data.sceneName, process); }; if (MogoWorld.thePlayer != null) { MogoWorld.thePlayer.GotoPreparePosition(); //MogoWorld.thePlayer.AddCallbackInFrames(loadScene); } //else // loadScene(); loadScene(); //TimerHeap.AddTimer(500, 0, loadScene); }); }