private void HandleChangeBattleConfigFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); ChangeBattleConfigS2C feedback = ProtobufUtils.Deserialize <ChangeBattleConfigS2C>(data); if (feedback.result) { DataManager dataManager = DataManager.GetInstance(); switch (feedback.configType) { case 1: //1-army 2-rune 3-instituteSkill dataManager.SetBattleConfigArmyIndex(feedback.config.battleType, feedback.config.labelPage); break; case 2: //1-army 2-rune 3-instituteSkill dataManager.SetBattleConfigRuneIndex(feedback.config.battleType, feedback.config.labelPage); break; case 3: //1-army 2-rune 3-instituteSkill dataManager.SetBattleConfigInstituteSkillIndex(feedback.config.battleType, feedback.config.labelPage); break; } } }
private void HandleBattleMessageFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); BattleS2C feedback = ProtobufUtils.Deserialize <BattleS2C>(data); if (feedback.result) { DataManager dataManager = DataManager.GetInstance(); if (feedback.battleId != 0) { // receive this message second time dataManager.SetBattleServerIp(feedback.serverIp); dataManager.SetBattleServerPort(feedback.serverPort); dataManager.SetBattleId(feedback.battleId); dataManager.SetSeed(feedback.seed); ConnectBattleServer(); } else { // receive this message first time dataManager.SetBattlers(feedback.battlers); } } else { DebugUtils.LogError(DebugUtils.Type.Match, " HandleBattleMessage result = false, maybe some error occured! "); } }
public void SendSellC2S(int goodsIndex, PlayerBagItemType currentGoodsType, PlayerBagItemType bagType, int sellCount) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); long itemId = 0L; //switch ( currentGoodsType ) //{ // case PlayerBagItemType.Nem: // case PlayerBagItemType.Component: // case PlayerBagItemType.BluePrintItem: // itemId = GetBagGoodsList( bagType )[goodsIndex].metaId; // break; // case PlayerBagItemType.GearItem: // itemId = GetBagGoodsList( bagType )[goodsIndex].itemId; // break; // default: // DebugUtils.Log( DebugUtils.Type.UI, "Goods Type is wrong~~~" ); // break; //} //BlackMarketSellC2S blackMarketSellData = new BlackMarketSellC2S(); // blackMarketSellData.itemId = itemId; //blackMarketSellData.itemType = currentGoodsType; // blackMarketSellData.sellCount = sellCount; // byte[] data = ProtobufUtils.Serialize( blackMarketSellData ); //NetworkManager.SendRequest( MsgCode.BlackMarketSellMessage, data ); }
private void HandleRegisterLoginServerFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); RegisterS2C feedback = ProtobufUtils.Deserialize <RegisterS2C>(data); if (feedback == null) { Utils.DebugUtils.LogError(Utils.DebugUtils.Type.Login, "HandleRegisterLoginServerFeedback - feedback is null"); return; } if (feedback.result > 0) { Account account = datamanager.GetAccount(); account.userID = userID; account.password = password; account.accountId = feedback.accountId; ClientTcpMessage.sessionId = feedback.loginSessionId; PlayerPrefs.SetString("userID", userID); PlayerPrefs.SetString("userPW", password); Utils.DebugUtils.Log(Utils.DebugUtils.Type.Login, "HandleRegisterLoginServerFeedback"); view.SetPlayerChoiceWindow(true); } else { view.FailedRegister(feedback.tipType); } }
private void HandleInvationMatchFeedback( byte[] data ) { UILockManager.ResetGroupState( UIEventGroup.Middle ); InvitationMatchS2C feedback = ProtobufUtils.Deserialize<InvitationMatchS2C>( data ); if ( feedback.result ) { switch ( feedback.state ) { case InvitationState.AcceptInvitation: view.OpenFightMatchView( matcherReadyDatas ); break; case InvitationState.RefuseInvitation: case InvitationState.DestroyInvitation: view.CloseView(); break; case InvitationState.FriendInBattle: view.CloseView(); OpenPopUp( "提示", "您的好友已进入战斗" ); break; case InvitationState.FriendInMatching: view.CloseView(); OpenPopUp( "提示", "您的好友已在匹配中" ); break; } } }
private void HandleSellGoodsFeedback(byte[] data) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); // BlackMarketSellS2C feedback = ProtobufUtils.Deserialize<BlackMarketSellS2C>( data ); // if ( feedback.result ) { // int count = feedback.sellCount; // long itemId = feedback.itemId; //PlayerBagInfo itemBag = DataManager.GetInstance().GetPlayerBag( BagType.ItemBag ); //PlayerBagInfo gearBag = DataManager.GetInstance().GetPlayerBag( BagType.GearBag ); //switch ( feedback.itemType ) //{ // case PlayerBagItemType.Component: // case PlayerBagItemType.ExpItem: // case PlayerBagItemType.Nem: // case PlayerBagItemType.BluePrintItem: // itemBag.itemList.Find( p => p.metaId == (int)itemId ).count -= count; // break; // case PlayerBagItemType.GearItem: // gearBag.itemList.Remove( gearBag.itemList.Find( p => p.itemId == itemId ) ); // break; // default: // DebugUtils.Log( DebugUtils.Type.Data, "Sell Goods Type is wrong~~~" ); // break; //} view.RefreshGoodsItem(); } }
private void HandleJoinBattleListFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); JoinArmyS2C feedback = ProtobufUtils.Deserialize <JoinArmyS2C>(data); if (feedback.result) { } }
private void HandleLoginFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); LoginS2C feedback = ProtobufUtils.Deserialize <LoginS2C>(data); if (feedback == null) { Utils.DebugUtils.LogError(Utils.DebugUtils.Type.Login, "HandleLoginFeedback - feedback is null"); return; } if (feedback.result == 1) { Account account = datamanager.GetAccount(); account.userID = userID; account.password = password; datamanager.SetAccountId(feedback.accountId); ClientTcpMessage.sessionId = feedback.loginSessionId; if (feedback.playerId < 0) { Utils.DebugUtils.Log(Utils.DebugUtils.Type.Login, "HandleLoginFeedback - need to chose avatar and username"); view.SetPlayerChoiceWindow(true); } else { ClientTcpMessage.sessionId = feedback.loginSessionId; datamanager.SetPlayerId(feedback.playerId); datamanager.SetAccountId(feedback.accountId); datamanager.SetGameServerIp(feedback.gameServerIp); datamanager.SetGameServerPort(feedback.gameServerPort); gameServerIP = feedback.gameServerIp; gameServerPort = feedback.gameServerPort; socialServerIP = feedback.socialServerIp; socialServerPort = feedback.socialServerPort; PlayerPrefs.SetString("userID", userID); PlayerPrefs.SetString("userPW", password); Utils.DebugUtils.Log(Utils.DebugUtils.Type.Login, "HandleLoginFeedback"); DisconnectLoginServerAndConnectGameServer(feedback.gameServerIp, feedback.gameServerPort); SwtichScene(); } } else if (feedback.result == 2) { datamanager.SetAccountId(feedback.accountId); view.OpenPlayerChoiceWindow(); } else { view.FailedLogin(feedback.tipType); } }
public void SendCredentials(LoginType type, string userID = "", string password = "") { loginType = type; this.userID = userID; this.password = password; byte[] stream = null; MsgCode serverChannel = MsgCode.LoginMessage; switch (type) { case LoginType.Guest: { return; } case LoginType.Login: { LoginC2S loginData = new LoginC2S(); loginData.loginName = userID; loginData.password = password; loginData.UDID = DeviceUtil.Instance.GetDeviceUniqueIdentifier(); loginData.MAC = DeviceUtil.Instance.GetDeviceUniqueIdentifier(); loginData.ip = DeviceUtil.Instance.GetDeviceIP(); stream = ProtobufUtils.Serialize(loginData); serverChannel = MsgCode.LoginMessage; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); break; } case LoginType.Register: { RegisterC2S register = new RegisterC2S(); register.ip = DeviceUtil.Instance.GetDeviceIP(); register.MAC = DeviceUtil.Instance.GetDeviceUniqueIdentifier(); register.loginName = userID; register.passWord = password; stream = ProtobufUtils.Serialize(register); serverChannel = MsgCode.RegisterMessage; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); break; } } Utils.DebugUtils.Log(Utils.DebugUtils.Type.Login, string.Format("SendCredentials {0} userID: {1} password: {2}", serverChannel.ToString(), userID, password)); Utils.DebugUtils.Log(Utils.DebugUtils.Type.Login, string.Format("Sending {0} as {1} ", type == LoginType.Register ? "RegisterC2S" : "LoginC2S", serverChannel.ToString())); NetworkManager.SendRequest(serverChannel, stream); }
public void SendApplyRoomC2S() { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); ApplyRoomC2S applyRoomData = new ApplyRoomC2S(); applyRoomData.matchType = GetCurrentMatchType(); byte[] data = ProtobufUtils.Serialize(applyRoomData); NetworkManager.SendRequest(MsgCode.ApplyRoomMessage, data); }
private void HandleStoreExchangeS2CFeedback(byte[] data) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); StoreExchangeS2C feedback = ProtobufUtils.Deserialize <StoreExchangeS2C>(data); if (feedback.result) { UIManager.Instance.GetUIByType(UIType.StoreScreen, (ViewBase ui, System.Object param) => { (ui as StoreView).RefreshStoreUI(); }); view.OnExit(false); } }
private void HandleNoticeMessageFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); NoticeS2C feedback = ProtobufUtils.Deserialize <NoticeS2C>(data); if (feedback.type == NoticeType.BattleBegin) { view.currentUIType = FightMatchView.FightMatchUIType.None; view.OnExit(true); } }
public void SendUnlockSkillDeck(int skillDeckIndex) { currentUnlockSkillDeckIndex = skillDeckIndex; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); BuySciencePageC2S message = new BuySciencePageC2S(); message.pageId = skillDeckIndex; byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.BuySciencePageMessage, data); }
private void HandleChangeScienceSkillFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); ChangeScienceSkillS2C feedback = ProtobufUtils.Deserialize <ChangeScienceSkillS2C>(data); if (feedback.result) { DataManager.GetInstance().SetPlayerSetedPackageInstituteSkills(feedback.pageId, feedback.scienceSkillIds); view.RefreshInstituteItem(); } }
public void SaveJoinSkillDeckList(int skillIndex, int skillId) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); ChangeScienceSkillC2S message = new ChangeScienceSkillC2S(); message.pageId = currentSelectSkillDeckIndex; message.index = skillIndex; message.skillId = skillId; byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.ChangeScienceSkillMessage, data); }
private void SendInvitationC2S( long friendId, BattleType type, InvitationState state ) { UILockManager.SetGroupState( UIEventGroup.Middle, UIEventState.WaitNetwork ); InvitationMatchC2S message = new InvitationMatchC2S(); message.friendId = friendId; message.battleType = type; message.state = state; byte[] data = ProtobufUtils.Serialize( message ); NetworkManager.SendRequest( MsgCode.InvitationMatchMessage, data ); }
public void HandleRefreshGoodsFeedback(byte[] data) { canSendRefresh = true; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); // BlackMarketRefreshS2C feedback = ProtobufUtils.Deserialize<BlackMarketRefreshS2C>( data ); // if ( feedback.result ) { // DataManager.GetInstance().SetPlayerBlackMarketInfo( feedback.blackMarketInfo ); view.RefreshGoodsItem(); } }
private void SendJoinBattleListC2S(int battleListId, int postion, int soldierId) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); JoinArmyC2S joinListData = new JoinArmyC2S(); joinListData.armyId = battleListId; joinListData.position = postion; joinListData.soldierId = soldierId; byte[] data = ProtobufUtils.Serialize(joinListData); NetworkManager.SendRequest(MsgCode.JoinArmyMessage, data); }
private void ClickBuyPopUpLeftBtCallBack() { if (currentCount > controller.GetStoreItemLeftMaxCount(currentId)) { OpenNotEnoughAlert(""); } else { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); Data.CurrencyType type = (Data.CurrencyType)controller.GetStoreItemLeftCostType(currentId); controller.SendStoreBuyC2S(type, currentId, currentCount); } }
private void HandleBuyGoodsFeedback(byte[] data) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); //BlackMarketBuyS2C feedback = ProtobufUtils.Deserialize<BlackMarketBuyS2C>( data ); // if ( feedback.result ) { //DataManager.GetInstance().GetPlayerBlackMarketInfo().slots[feedback.slotId - 1].isSellOut = true; view.SetDescriptionUI(false); view.SetButton(false); view.RefreshGoodsItem(); } }
private void HandleApplyRoomFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); ApplyRoomS2C feedback = ProtobufUtils.Deserialize <ApplyRoomS2C>(data); if (feedback.result) { NetworkManager.Shutdown(() => MatchLobbyServer(feedback.lobbyServerIp, feedback.lobbyServerPort)); DataManager.GetInstance().SetLobbyServerIp(feedback.lobbyServerIp); DataManager.GetInstance().SetLobbyServerPort(feedback.lobbyServerPort); } }
private void SendMatchC2S(MatchClientMessageType type, long friendId = 0) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); MatchC2S message = new MatchC2S(); message.matchType = GetCurrentMatchType(); message.playerName = DataManager.GetInstance().GetPlayerNickName(); message.friendId = friendId; message.type = type; byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.MatchMessage, data); }
private void HandleChangePortraitFeedback(byte[] data) { ChangePortraitS2C feedback = ProtobufUtils.Deserialize <ChangePortraitS2C>(data); if (feedback.result) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); string icon = GetPortraitIcon(changePortraitIndex); DataManager.GetInstance().SetPlayerHeadIcon(icon); playerInfoData.portrait = icon; view.RefreshPlayerInfoView(); view.CloseChangePortraitUI(); } }
public void SendUseItemC2S(BagType bagType, int count, int itemid) { useItemId = itemid; useItemCount = count; useItemType = bagType; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); UseItemC2S message = new UseItemC2S(); message.bagType = BagType.BoxBag; message.count = count; message.itemId = itemid; byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.UseItemMessage, data); }
public void SendBuyC2S(int goodsIndex) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); int blackMarketId = 0; blackMarketId = DataManager.GetInstance().GetPlayerBlackMarketInfo().slots[goodsIndex].blackMarketPriceId; // BlackMarketBuyC2S blackMarketBuyData = new BlackMarketBuyC2S(); //blackMarketBuyData.blackMarketPriceId = blackMarketId; // blackMarketBuyData.slotId = goodsIndex + 1; // byte[] data = ProtobufUtils.Serialize( blackMarketBuyData ); // NetworkManager.SendRequest( MsgCode.BlackMarketBuyMessage, data ); }
public void HandleExChangeGoodsFeedback(byte[] data) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); // BlackMarketTradingS2C feedback = ProtobufUtils.Deserialize<BlackMarketTradingS2C>( data ); // if ( feedback.result ) { List <ItemInfo> newItemList = new List <ItemInfo>(); //PlayerBagInfo gearBag = DataManager.GetInstance().GetPlayerBag( BagType.GearBag ); //newItemList.Add( gearBag.itemList.Find( p => p.itemId == feedback.gearId ) ); //MessageDispatcher.PostMessage( Constants.MessageType.OpenChestWindow, newItemList, new List<int>() { 1 }, ChestItemType.Item ); view.ClearExChangeList(); view.RefreshGoodsItem(); view.RefreshExChangeGoods(); } }
private void HandleUseItemFeedback(byte[] data) { UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.Normal); UseItemS2C feedback = ProtobufUtils.Deserialize <UseItemS2C>(data); if (feedback.result) { PlayerBagInfo bagInfo = DataManager.GetInstance().GetPlayerBag(useItemType); ItemInfo item = bagInfo.itemList.Find(p => p.itemId == useItemId); if (item.count <= useItemCount) { bagInfo.itemList.Remove(item); } else { item.count -= useItemCount; } } }
public void SendChangeInstituteSkillC2S(int instituteSkillIndex, BattleType type) { currentBattleType = type; currentInstituteSkillIndex = instituteSkillIndex; UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); ChangeBattleConfigC2S message = new ChangeBattleConfigC2S(); message.config = new BattleTypeConfigInfo.BattleTypeConfigParamInfo(); message.config.battleType = type; message.configType = 3;// 1-army 2-rune 3-instituteSkill message.matchWithFriend = (matcherReadyDatas.Count > 1); message.config.labelPage = instituteSkillIndex; byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.ChangeBattleConfigMessage, data); }
private void HandleBuySkillArrributeFeedback(byte[] data) { UILockManager.ResetGroupState(UIEventGroup.Middle); BuySciencePageS2C feedback = ProtobufUtils.Deserialize <BuySciencePageS2C>(data); if (feedback.result) { DataManager manager = DataManager.GetInstance(); if (feedback.pageId == 1) { view.SetSecondSkillDeck(true); } else if (currentUnlockSkillDeckIndex == 2) { view.SetThirdSkillDeck(true); } manager.SetPlayerSetedPackageInstituteSkills(feedback.pageId, feedback.scienceSkillIds); } }
public void SendChangePortraitC2S(int iconIndex) { changePortraitIndex = iconIndex; string icon = GetPortraitIcon(iconIndex); DataManager dataManager = DataManager.GetInstance(); if (icon == dataManager.GetPlayerHeadIcon()) { return; } UILockManager.SetGroupState(UIEventGroup.Middle, UIEventState.WaitNetwork); ChangePortraitC2S message = new ChangePortraitC2S(); message.icon = icon; message.name = dataManager.GetPlayerNickName(); byte[] data = ProtobufUtils.Serialize(message); NetworkManager.SendRequest(MsgCode.ChangePortraitMessage, data); }