public static void OnRaidQueryFriend(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCRaidQueryFriend; if (themsg != null) { //var e = new FriendEvent(); //e.RaidFriend = themsg; //EventManager.Instance.Post(e); MissionModelLocator.Instance.FriendsMsg = themsg; if (HeroModelLocator.AlreadyRequest == false) { HeroModelLocator.Instance.GetHeroPos = RaidType.GetHeroInBattle; var csmsg = new CSHeroList(); NetManager.SendMessage(csmsg); } else { WindowManager.Instance.Show(typeof(SetBattleWindow), true); WindowManager.Instance.Show<RaidsWindow>(false); } } else { PopTextManager.PopTip("返回战斗的数据错误"); } }
public static void OnBattlePveStart(ThriftSCMessage msg) { var battleStartMsg = msg.GetContent() as SCBattlePveStartMsg; //battleStartMsg.BattleType = (sbyte)BattleType.TESTPVE.index; if (battleStartMsg == null) { Logger.LogError("Battle start message should not be null."); return; } if (PersistenceHandler.Instance.Enabled) { PersistenceHandler.Instance.Enabled = (battleStartMsg.BattleType != BattleType.GREENHANDPVE.Index); } //Store missionmodellocator and battlestartmsg for battle persistence. PersistenceHandler.Instance.StoreStartBattle(battleStartMsg); // initialize battle model locator from battle start message. BattleModelLocator.Instance.Init(battleStartMsg); // client side show. WindowManager.Instance.Show<RaidsWindow>(false); WindowManager.Instance.Show<SetBattleWindow>(false); WindowManager.Instance.Show<BattleWindow>(true); }
public static void OnServerConfigMsg(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCServerConfigMsg; if (themsg != null) { ItemModeLocator.Instance.ServerConfigMsg = themsg; EnergyIncreaseControl.Instance.Init(themsg.RecoverEnergyMinutes); MailModelLocator.Instance.MailUpdateInterval = themsg.MailUpdateInterval; Debug.Log("Go to finish in itemHandler."); //WindowManager.Instance.Show<LoginAccountWindow>(false); //WindowManager.Instance.Show<LoginCreateRoleWindow>(false); //WindowManager.Instance.Show<LoginMainWindow>(false); //WindowManager.Instance.Show<LoginRegisterWindow>(false); //WindowManager.Instance.Show<LoginServersWindow>(false); //WindowManager.Instance.Show<LoadingWaitWindow>(false); //WindowManager.Instance.Show(WindowGroupType.Popup, false); GreenHandGuideHandler.Instance.ShowMainScreen(); Debug.Log("Go to persistence way."); //BattlePersistence PersistenceHandler.Instance.GoToPersistenceWay(); } }
public static void OnMailList(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCMailListMsg; if (themsg != null) { if(themsg.ListType == MailConstant.ListTypeUpdate) { var mailListCached = MailModelLocator.Instance.ScMailListMsg.MailList; var mailList = themsg.MailList; foreach(var info in mailList) { var mail = MailModelLocator.Instance.FindMailViaMailId(info.Uuid); if(mail != null) { mailListCached.Remove(mail); } mailListCached.Add(info); } } else { MailModelLocator.Instance.ScMailListMsg = themsg; } MailModelLocator.Instance.MailListVersion = themsg.ListVersion != -1 ? themsg.ListVersion : MailModelLocator.Instance.MailListVersion; MailConstant.SortMailList(MailModelLocator.Instance.ScMailListMsg.MailList); var mailEntry = WindowManager.Instance.Show<UIEmailEntryWindow>(true); mailEntry.Refresh(); } }
public static void OnAllItemInfos(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCAllItemInfos; if (themsg != null) { if (ItemModeLocator.Instance.GetItemPos == ItemType.GetItemInPanel) { if (themsg.BagType == ItemType.MainItemBagType) { ItemModeLocator.Instance.ScAllItemInfos = themsg; ItemModeLocator.AlreadyMainRequest = true; WindowManager.Instance.Show<UIItemCommonWindow>(true); } if (themsg.BagType == ItemType.BuyBackItemBagType) { ItemModeLocator.Instance.BuyBackItems = themsg; ItemModeLocator.AlreadyBuyBackRequest = true; } if (ItemListInItemPanel != null) { ItemListInItemPanel(); } } else { if (themsg.BagType == ItemType.MainItemBagType) { ItemModeLocator.Instance.ScAllItemInfos = themsg; WindowManager.Instance.GetWindow<UIHeroCommonWindow>().HeroDetailHandler.RefreshCanEquipItems(); ItemModeLocator.AlreadyMainRequest = true; } } } }
public static void OnFriendQueryByName(ThriftSCMessage msg) { if(msg != null) { var friendInfo = msg.GetContent() as SCFriendQueryByName; var friendApplyWindow = WindowManager.Instance.Show<UIFriendApplyWindow>(true); friendApplyWindow.Refresh(friendInfo.ApplyFriendInfo); } }
public static void OnFriendGiveEnergySucc(ThriftSCMessage msg) { if(msg != null) { var friendList = msg.GetContent() as SCFriendGiveEnergySucc; var friendEntryWindow = WindowManager.Instance.GetWindow<UIFriendEntryWindow>(); var friendListHandler = friendEntryWindow.FriendHandlers[FriendConstant.FriendHandlerListIndex] as FriendListHandler; friendListHandler.RefreshGivenSucc(friendList.FriendUuid); } }
public static void OnFriendLoadingAll(ThriftSCMessage msg) { if(msg != null) { FriendModelLocator.Instance.ScFriendLoadingAll = msg.GetContent() as SCFriendLoadingAll; FriendModelLocator.Instance.ExtendFriendTimes = FriendModelLocator.Instance.ScFriendLoadingAll.FriendLimitExtendTimes; WindowManager.Instance.Show<UIFriendEntryWindow>(true); } }
/// <summary> /// Set RandomCharName from server. /// </summary> /// <param name="msg"></param> public static void OnRandomCharName(ThriftSCMessage msg) { var scRandomNameMsg = msg.GetContent() as SCRandomCharNameMsg; var windowObject = WindowManager.Instance.GetWindow<LoginCreateRoleWindow>().gameObject; var inputObject = Utils.FindChild(windowObject.transform, "Input - account"); var labelObject = Utils.FindChild(inputObject.transform, "Label"); inputObject.GetComponent<UIInput>().value = labelObject.GetComponent<UILabel>().text = scRandomNameMsg.CharName; }
public static void OnAddItemsAndHeros(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCAddItemsAndHeros; if (themsg != null) { var heroInfos = themsg.HeroInfos; AddToCacheHeroList(heroInfos); var itemInfos = themsg.ItemInfos; AddToCacheItemList(itemInfos); } }
public static void OnRaidAddition(ThriftSCMessage msg) { var addmsg = msg.GetContent() as SCRaidAddtion; if (addmsg != null) { MissionModelLocator.Instance.RaidAddition = addmsg; } else { PopTextManager.PopTip("返回战斗的数据错误"); } }
public static void OnRaidClearDailyTimes(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCRaidClearDailyTimes; if (themsg != null) { } else { //PopTextManager.PopTip("返回战斗的数据错误"); } }
public static void OnErrorInfo(ThriftSCMessage msg) { var errmsg = msg.GetContent() as SCErrorInfoMsg; if (errmsg != null) { Logger.Log("服务端系统消息error:" + errmsg.ErrorCode); string str = "系统提示:"; switch (errmsg.ErrorCode) { case (short)ErrorType.ACCOUNT_NOT_ACTIVE: str += "账号未激活"; break; case (short)ErrorType.CREATE_CHAR_FAIL: str += "创建角色失败"; break; case (short)ErrorType.DECODE_EXCEPTION: str += "解码异常"; break; case (short)ErrorType.ILLEGAL_REQUEST: str += "非法请求"; break; case (short)ErrorType.LOGIN_CHECK_FAIL: str += "登录信息检查未通过"; break; case (short)ErrorType.DATA_SAVING_CANT_LOGIN: str += "保存数据中,稍后登录"; break; case (short)ErrorType.LOGIN_INVALID: str += "登录失效"; AlertHandler();//登录失效时返回登录页面 break; case (short)ErrorType.MSG_EXEC_EXCEPTION: str += "消息执行异常"; break; case (short)ErrorType.NAME_EXISTS: str += "名字已存在"; break; case (short)ErrorType.NO_ACCOUNT_OR_ERR_PWD: str += "帐号不存在或密码错误"; break; case (short)ErrorType.SERVER_NOT_OPEN: str += "服务器未开放"; break; case (short)ErrorType.USER_LOCKED: str += "帐号被锁定"; break; default: str = "未处理的ErrorCode:" + errmsg.ErrorCode; break; } PopTextManager.PopTip(str, false); } }
//public static bool IsHeroFirstLoginGive = false; //public static ThriftSCMessage HeroFirstLoginGiveMsg; #endregion #region Public Methods public static void OnLotteryList(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCLotteryList; if (themsg != null) { PlayerModelLocator.Instance.Famous = themsg.Famous; PlayerModelLocator.Instance.SuperChip = themsg.SuperChip; var window = WindowManager.Instance.GetWindow<ChooseCardWindow>(); window.ScLotteryList = themsg; window.InitializeToggleButtons(); } }
public static void OnMailUpdateMsg(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCMailUpdateMsg; if (themsg != null) { var mail = MailModelLocator.Instance.FindMailViaMailId(themsg.MailId); mail.State = themsg.State; if (MailIsUpdated != null) { MailIsUpdated(themsg.MailId, themsg.State); } } }
public static void OnFriendApplyList(ThriftSCMessage msg) { if(msg != null) { FriendModelLocator.Instance.ScFriendApplyList = msg.GetContent() as SCFriendApplyList; var friendEntryWindow = WindowManager.Instance.GetWindow<UIFriendEntryWindow>(); var addFriendHandler = friendEntryWindow.FriendHandlers[FriendConstant.AddFriendHandlerIndex] as AddFriendHandler; if(addFriendHandler.gameObject.activeInHierarchy) { addFriendHandler.Refresh(FriendModelLocator.Instance.ScFriendApplyList.ApplyList); } } }
public static void OnAddItem(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCAddItem; if (themsg != null) { ChooseCardHandler.AddToCacheItemList(new List<ItemInfo> {themsg.Info}); var itemWindow = WindowManager.Instance.GetWindow<UIItemCommonWindow>(); if(NGUITools.GetActive(itemWindow)) { itemWindow.Refresh(ItemModeLocator.Instance.ScAllItemInfos.ItemInfos); } } }
public static void OnLottery(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCLottery; if (themsg != null) { var window = WindowManager.Instance.GetWindow<ChooseCardEffectWindow>(); if (NGUITools.GetActive(window.gameObject)) { window.CleanUp(); } window = WindowManager.Instance.Show<ChooseCardEffectWindow>(true); window.Refresh(themsg); } }
public static void OnEnergyNotEnough(ThriftSCMessage msg) { var energyNotEnough = msg.GetContent() as SCEnergyNotEnough; if (energyNotEnough != null) { var assertWindow = WindowManager.Instance.GetWindow<AssertionWindow>(); assertWindow.AssertType = AssertionWindow.Type.OkCancel; assertWindow.Title = string.Format(LanguageManager.Instance.GetTextValue(EnergyNotEnoughKey), energyNotEnough.BuyEnergyCost); assertWindow.Message = ""; assertWindow.OkButtonClicked = OkClicked; assertWindow.CancelButtonClicked = CancelClicked; WindowManager.Instance.Show(typeof(AssertionWindow), true); } }
public static void OnRaidLoadingAll(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCRaidLoadingAll; if (themsg != null) { MissionModelLocator.Instance.RaidLoadingAll = themsg; WindowManager.Instance.Show(typeof(RaidsWindow), true); WindowManager.Instance.Show<MainMenuBarWindow>(false); } else { //PopTextManager.PopTip("返回的副本数据错误"); } }
public static void DoPay(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCRechargeIdMsg; GameId = themsg.GameOrderId.ToString(); if (IsUiInGame) { PayInGame(); } else { PayInSDK(); } }
public static void OnMailDetailMsg(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCMailDetailMsg; if (themsg != null) { var mailId = themsg.Uuid; var mail = MailModelLocator.Instance.FindMailViaMailId(mailId); var content = themsg.Content; mail.Content = content; if(MailDetailed != null) { MailDetailed(mailId, content); } } }
public static void OnRaidReward(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCRaidReward; if (themsg != null) { MissionModelLocator.Instance.BattleReward = themsg; PersistenceHandler.IsRaidFinish = true; WindowManager.Instance.Show(typeof(BattleWinWindow), true); } else { //PopTextManager.PopTip("返回战斗的数据错误"); } }
public static void OnSystemInfo(ThriftSCMessage msg) { var sysmsg = msg.GetContent() as SCSystemInfoMsg; if (sysmsg != null && sysmsg.Info != null && sysmsg.Info != "") { Logger.Log("服务端系统消息1:" + sysmsg.Info); PopTextManager.PopTip(sysmsg.Info, false); } else { var clientmsg = msg as ClientSCMessage; Logger.Log("服务端系统消息2:" + clientmsg.Info); //PopTextManager.PopTip(clientmsg.Info); Alert.Show(AssertionWindow.Type.Ok, "系统提示", clientmsg.Info, AlertHandler); } }
public static void OnFriendReciveEnergySucc(ThriftSCMessage msg) { if(msg != null) { var energySucc = msg.GetContent() as SCFriendRecieveEnergySucc; if (energySucc != null) { var friendEntryWindow = WindowManager.Instance.GetWindow<UIFriendEntryWindow>(); var energyHandler = friendEntryWindow.FriendHandlers[FriendConstant.FriendEnergyHandlerIndex] as FriendEnergyHandler; if(energyHandler != null) { energyHandler.RefreshReceiveSucc(energySucc.FriendUuid, energySucc.RefreshRecieveEnergyTimes); } } } }
public static void OnFriendRecieveEnergyList(ThriftSCMessage msg) { if(msg != null) { var energyList = FriendModelLocator.Instance.ScFriendRecieveEnergyList = msg.GetContent() as SCFriendRecieveEnergyList; if (energyList != null) { var friendEntryWindow = WindowManager.Instance.GetWindow<UIFriendEntryWindow>(); var energyHandler = friendEntryWindow.FriendHandlers[FriendConstant.FriendEnergyHandlerIndex] as FriendEnergyHandler; if(energyHandler != null) { energyHandler.Refresh(energyList.RecieveEnergyList, energyList.RecieveEnergyTimes, energyList.RecieveEnergyTimesLimit); } } } }
public static void OnHeroFirstLoginGive(ThriftSCMessage msg) { //PopTextManager.PopTip("Get hero in first login today!"); var themsg = msg.GetContent() as SCHeroFristLoginGive; if (themsg != null) { themsg.HeroInfos = themsg.HeroInfos.OrderByDescending(item => HeroModelLocator.Instance.HeroTemplates.HeroTmpls[item.TemplateId].Star).ToList(); Logger.Log("!!!!!!!!!!!!!!!!themsg is:" + themsg.HeroInfos[0].Uuid + "," + themsg.HeroInfos[1].Uuid + "," + themsg.HeroInfos[2].Uuid); var window = WindowManager.Instance.Show<ChooseCardSuccWindow>(true); window.StoredHeroFristLoginGiveMsg = themsg; window.ShowHeroFirstGive(); if (HeroModelLocator.AlreadyRequest) { AddToCacheHeroList(themsg.HeroInfos); } } }
public static void OnPlayerInfo(ThriftSCMessage msg) { Debug.Log("Receive scplayerinfo msg from server."); PopTextManager.PopTip("登录成功,返回玩家角色信息"); var themsg = msg.GetContent() as SCPlayerInfoMsg; if (themsg != null) { PlayerModelLocator.Instance.HeroId = themsg.HeroId; PlayerModelLocator.Instance.RoleId = themsg.CId; PlayerModelLocator.Instance.Name = themsg.Name; PlayerModelLocator.Instance.HeadIconId = themsg.HeadIconId; PlayerModelLocator.Instance.Level = themsg.Lvl; PlayerModelLocator.Instance.Exp = themsg.Exp; PlayerModelLocator.Instance.Diamond = themsg.Diamond; PlayerModelLocator.Instance.Gold = themsg.Gold; PlayerModelLocator.Instance.Sprit = themsg.Spirit; PlayerModelLocator.Instance.ExtendHeroTimes = themsg.HeroExtendTimes; PlayerModelLocator.Instance.ExtendItemTimes = themsg.ItemExtendTimes; PlayerModelLocator.Instance.HeroMax = themsg.HeroMax; PlayerModelLocator.Instance.CanSign = themsg.CanSign; PlayerModelLocator.Instance.HasFinishedQuest = themsg.HasFinishedQuest; EnergyIncreaseControl.Instance.Energy = themsg.Energy; PlayerModelLocator.Instance.TeamProp = new Dictionary<int, int>(themsg.TeamProp); PlayerModelLocator.Instance.TeamList = new List<int>(themsg.TeamList); Debug.Log("Set PlayerModelLocator ends."); ServiceManager.UserID = themsg.UId; var csMsg = new CSGameNoticeList(); NetManager.SendMessage(csMsg); Debug.Log("Sended CSGameNoticeList"); if (ServiceManager.IsDebugAccount == 1) { MtaManager.ReportGameUser(ServiceManager.DebugUserName, ServiceManager.ServerData.ID, PlayerModelLocator.Instance.Level.ToString()); } else { ServiceManager.AddServer(ServiceManager.ServerData.Url); ServiceManager.SetAccount(themsg.UName); MtaManager.ReportGameUser(ServiceManager.UserName, ServiceManager.ServerData.ID, PlayerModelLocator.Instance.Level.ToString()); } } EventManager.Instance.Post(new LoginEvent { Message = "This is login event." }); }
public static void OnMailOptionResultMsg(ThriftSCMessage msg) { var themsg = msg.GetContent() as SCMailOptionResultMsg; if (themsg != null) { switch ((MailConstant.OptionResult)themsg.OptionResult) { case MailConstant.OptionResult.OutOfDate: PopTextManager.PopTip(LanguageManager.Instance.GetTextValue(MailConstant.MailOutOfDateKey), false); break; case MailConstant.OptionResult.Succeed: PopTextManager.PopTip(LanguageManager.Instance.GetTextValue(MailConstant.MailOperSucceedKey), false); break; case MailConstant.OptionResult.NotExit: PopTextManager.PopTip(LanguageManager.Instance.GetTextValue(MailConstant.MailNotExitKey), false); break; case MailConstant.OptionResult.NoNeedToUpdate: PopTextManager.PopTip(LanguageManager.Instance.GetTextValue(MailConstant.MailNoNeedUpdateKey), false); break; } } }
public static void OnPropertyChangedNumber(ThriftSCMessage msg) { var propertyChangedMsg = msg.GetContent() as SCPropertyChangedNumber; if (propertyChangedMsg != null) { if (propertyChangedMsg.RoleType == 2) { var uuid = propertyChangedMsg.Uuid; var hero = HeroModelLocator.Instance.FindHero(uuid); if(propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLE_ATK)) { hero.Prop[RoleProperties.ROLE_ATK] = propertyChangedMsg.PropertyChanged[RoleProperties.ROLE_ATK]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLE_HP)) { hero.Prop[RoleProperties.ROLE_HP] = propertyChangedMsg.PropertyChanged[RoleProperties.ROLE_HP]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLE_RECOVER)) { hero.Prop[RoleProperties.ROLE_RECOVER] = propertyChangedMsg.PropertyChanged[RoleProperties.ROLE_RECOVER]; } if(propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLE_MP)) { hero.Prop[RoleProperties.ROLE_MP] = propertyChangedMsg.PropertyChanged[RoleProperties.ROLE_MP]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_LEVEL)) { hero.Lvl = (short)propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_LEVEL]; } var playerModel = PlayerModelLocator.Instance; var isInTeam = TeamMemberManager.Instance.CurTeam.Contains(uuid); if(isInTeam) { foreach (var key in HeroConstant.PropKeys) { playerModel.TeamProp[key] += (propertyChangedMsg.PropertyChanged[key] - hero.Prop[key]); } } if(HeroPropertyChanged != null) { HeroPropertyChanged(propertyChangedMsg); } } if (propertyChangedMsg.RoleType == 1) { if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_DIAMOND)) { PlayerModelLocator.Instance.Diamond = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_DIAMOND]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_HERO_SPIRIT)) { PlayerModelLocator.Instance.Sprit = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_HERO_SPIRIT]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_GOLD)) { PlayerModelLocator.Instance.Gold = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_GOLD]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_CURRENT_EXP)) { PlayerModelLocator.Instance.Exp = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_CURRENT_EXP]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_ENERGY)) { EnergyIncreaseControl.Instance.Energy = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_ENERGY]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_EXTEND_HREO_BAG_TIMES)) { PlayerModelLocator.Instance.ExtendHeroTimes = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_EXTEND_HREO_BAG_TIMES]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_EXTEND_ITEM_BAG_TIMES)) { PlayerModelLocator.Instance.ExtendItemTimes = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_EXTEND_ITEM_BAG_TIMES]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_LEVEL)) { PlayerModelLocator.Instance.Level = (short)propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_LEVEL]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_FAMOUS)) { PlayerModelLocator.Instance.Famous = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_FAMOUS]; } if (propertyChangedMsg.PropertyChanged.ContainsKey(RoleProperties.ROLEBASE_SUPER_CHIP)) { PlayerModelLocator.Instance.SuperChip = propertyChangedMsg.PropertyChanged[RoleProperties.ROLEBASE_SUPER_CHIP]; } if (PlayerPropertyChanged != null) { PlayerPropertyChanged(propertyChangedMsg); } } } }