private static void OnSelectHeroTimeout(int seq) { CUIFormScript form = Singleton <CUIManager> .GetInstance().GetForm(CHeroSelectNormalSystem.s_heroSelectFormPath); if (form != null) { RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; if (roomInfo != null && roomInfo.GetMasterMemberInfo() != null) { ListView <IHeroData> pvPHeroList = CHeroDataFactory.GetPvPHeroList(CMallSortHelper.HeroViewSortType.Name); DebugHelper.Assert(pvPHeroList.get_Count() > CFakePvPHelper.ChosenHeroes.get_Count(), "May have not enough Candidate Heroes!!!"); int num = Random.Range(0, pvPHeroList.get_Count()); IHeroData heroData = pvPHeroList.get_Item(num); while (CFakePvPHelper.ChosenHeroes.ContainsValue(heroData.cfgID)) { num = Random.Range(0, pvPHeroList.get_Count()); heroData = pvPHeroList.get_Item(num); } MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo(); masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = heroData.cfgID; CFakePvPHelper.ReqStartSingleWarmBattle(); } } }
public static void SetRoomData(GameObject root, RoomInfo data) { SetStartBtnStatus(root, data); UpdateBtnStatus(root, data); ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); int num = pvpMapCommonInfo.bMaxAcntNum / 2; root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = pvpMapCommonInfo.szName; root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", num)); GameObject item = null; MemberInfo memberInfo = null; MemberInfo masterMemberInfo = data.GetMasterMemberInfo(); DebugHelper.Assert(masterMemberInfo != null); for (int i = 1; i <= 5; i++) { item = root.transform.Find(string.Format("Panel_Main/Left_Player{0}", i)).gameObject; memberInfo = data.GetMemberInfo(COM_PLAYERCAMP.COM_PLAYERCAMP_1, i - 1); SetPlayerSlotData(item, memberInfo, masterMemberInfo, COM_PLAYERCAMP.COM_PLAYERCAMP_1, i - 1, num >= i); } for (int j = 1; j <= 5; j++) { item = root.transform.Find(string.Format("Panel_Main/Right_Player{0}", j)).gameObject; memberInfo = data.GetMemberInfo(COM_PLAYERCAMP.COM_PLAYERCAMP_2, j - 1); SetPlayerSlotData(item, memberInfo, masterMemberInfo, COM_PLAYERCAMP.COM_PLAYERCAMP_2, j - 1, num >= j); } SetComEnable(CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId).stPickRuleInfo.bPickType != 3); }
public static void SetRoomData(GameObject root, RoomInfo data) { CRoomView.SetStartBtnStatus(root, data); CRoomView.UpdateBtnStatus(root, data); ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); int num = (int)(pvpMapCommonInfo.bMaxAcntNum / 2); root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().text = pvpMapCommonInfo.szName; root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().text = Singleton <CTextManager> .get_instance().GetText(string.Format("Common_Team_Player_Type_{0}", num)); MemberInfo masterMemberInfo = data.GetMasterMemberInfo(); DebugHelper.Assert(masterMemberInfo != null); for (int i = 1; i <= 5; i++) { GameObject gameObject = root.transform.Find(string.Format("Panel_Main/LeftPlayers/Left_Player{0}", i)).gameObject; MemberInfo memberInfo = data.GetMemberInfo(1, i - 1); CRoomView.SetPlayerSlotData(gameObject, memberInfo, masterMemberInfo, 1, i - 1, num >= i); } for (int j = 1; j <= 5; j++) { GameObject gameObject = root.transform.Find(string.Format("Panel_Main/RightPlayers/Right_Player{0}", j)).gameObject; MemberInfo memberInfo = data.GetMemberInfo(2, j - 1); CRoomView.SetPlayerSlotData(gameObject, memberInfo, masterMemberInfo, 2, j - 1, num >= j); } ResDT_LevelCommonInfo pvpMapCommonInfo2 = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); CRoomView.SetComEnable(pvpMapCommonInfo2.stPickRuleInfo.bPickType != 3); }
private static void OnSelectHeroTimeout(int seq) { if (Singleton <CUIManager> .GetInstance().GetForm(CHeroSelectNormalSystem.s_heroSelectFormPath) != null) { RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; if ((roomInfo != null) && (roomInfo.GetMasterMemberInfo() != null)) { ListView <IHeroData> pvPHeroList = CHeroDataFactory.GetPvPHeroList(); DebugHelper.Assert(pvPHeroList.Count > ChosenHeroes.Count, "May have not enough Candidate Heroes!!!"); int num = UnityEngine.Random.Range(0, pvPHeroList.Count); IHeroData data = pvPHeroList[num]; while (ChosenHeroes.ContainsValue(data.cfgID)) { num = UnityEngine.Random.Range(0, pvPHeroList.Count); data = pvPHeroList[num]; } roomInfo.GetMasterMemberInfo().ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = data.cfgID; ReqStartSingleWarmBattle(); } } }
public static void SetRoomData(GameObject root, RoomInfo data) { ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); int num = (int)(pvpMapCommonInfo.bMaxAcntNum / 2); CRoomView.SetStartBtnStatus(root, data, (int)pvpMapCommonInfo.bMaxAcntNum); CRoomView.UpdateBtnStatus(root, data); if (data.fromType == COM_ROOM_FROMTYPE.COM_ROOM_FROM_QQSPROT) { Transform transform = root.transform.Find("Btn_Back"); if (transform) { transform.gameObject.CustomSetActive(false); } } root.transform.Find("Panel_Main/MapInfo/txtMapName").gameObject.GetComponent <Text>().set_text(pvpMapCommonInfo.szName); root.transform.Find("Panel_Main/MapInfo/txtTeam").gameObject.GetComponent <Text>().set_text(Singleton <CTextManager> .instance.GetText(string.Format("Common_Team_Player_Type_{0}", num))); MemberInfo masterMemberInfo = data.GetMasterMemberInfo(); DebugHelper.Assert(masterMemberInfo != null); COM_ROOM_FROMTYPE fromType = data.fromType; for (int i = 1; i <= 5; i++) { GameObject gameObject = root.transform.Find(string.Format("Panel_Main/LeftPlayers/Left_Player{0}", i)).gameObject; MemberInfo memberInfo = data.GetMemberInfo(COM_PLAYERCAMP.COM_PLAYERCAMP_1, i - 1); CRoomView.SetPlayerSlotData(gameObject, memberInfo, masterMemberInfo, COM_PLAYERCAMP.COM_PLAYERCAMP_1, i - 1, num >= i, fromType); } for (int j = 1; j <= 5; j++) { GameObject gameObject2 = root.transform.Find(string.Format("Panel_Main/RightPlayers/Right_Player{0}", j)).gameObject; MemberInfo memberInfo2 = data.GetMemberInfo(COM_PLAYERCAMP.COM_PLAYERCAMP_2, j - 1); CRoomView.SetPlayerSlotData(gameObject2, memberInfo2, masterMemberInfo, COM_PLAYERCAMP.COM_PLAYERCAMP_2, j - 1, num >= j, fromType); } ResDT_LevelCommonInfo pvpMapCommonInfo2 = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); CRoomView.SetComEnable(pvpMapCommonInfo2.stPickRuleInfo.bPickType != 3); if (fromType == COM_ROOM_FROMTYPE.COM_ROOM_FROM_QQSPROT) { CRoomView.DontShowComEnable(false); } }
private static void ReqStartSingleWarmBattle() { CFakePvPHelper.bInFakeSelect = false; Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout)); CFakePvPHelper.RemoveAllFakeTimer(); CSPkg cSPkg = NetworkModule.CreateDefaultCSPKG(1050u); RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; if (roomInfo == null) { DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!"); return; } if (roomInfo != null) { cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.bGameType = 1; cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.stGameDetail.set_stGameOfCombat(Singleton <CHeroSelectBaseSystem> .get_instance().m_stGameOfCombat); cSPkg.stPkgData.get_stStartSingleGameReq().stBattleList.stBattleList.wHeroCnt = 1; if (cSPkg.stPkgData.get_stStartSingleGameReq().stBattleParam.stGameDetail.get_stGameOfCombat() == null) { return; } MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo(); if (masterMemberInfo == null) { DebugHelper.Assert(roomInfo != null, "selfInfo Should not be NULL!!!"); return; } cSPkg.stPkgData.get_stStartSingleGameReq().stBattleList.stBattleList.BattleHeroList[0] = masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(roomInfo.roomAttrib.bMapType, roomInfo.roomAttrib.dwMapId); if (pvpMapCommonInfo != null) { COM_PLAYERCAMP cOM_PLAYERCAMP = 1; int dwHeroID = 0; for (COM_PLAYERCAMP cOM_PLAYERCAMP2 = 1; cOM_PLAYERCAMP2 < 3; cOM_PLAYERCAMP2++) { ListView <MemberInfo> listView = roomInfo[cOM_PLAYERCAMP2]; for (int i = 0; i < listView.get_Count(); i++) { if (listView.get_Item(i).ullUid == roomInfo.selfInfo.ullUid) { cOM_PLAYERCAMP = listView.get_Item(i).camp; dwHeroID = (int)listView.get_Item(i).ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; break; } } } CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = cSPkg.stPkgData.get_stStartSingleGameReq().stBattlePlayer; int num = 0; for (COM_PLAYERCAMP cOM_PLAYERCAMP3 = 1; cOM_PLAYERCAMP3 < 3; cOM_PLAYERCAMP3++) { ListView <MemberInfo> listView2 = roomInfo[cOM_PLAYERCAMP3]; for (int j = 0; j < listView2.get_Count(); j++) { MemberInfo memberInfo = listView2.get_Item(j); if (memberInfo != null) { if (memberInfo.RoomMemberType == 2u) { stBattlePlayer.astFighter[num].bObjType = 2; stBattlePlayer.astFighter[num].bPosOfCamp = (byte)j; stBattlePlayer.astFighter[num].bObjCamp = cOM_PLAYERCAMP3; stBattlePlayer.astFighter[num].dwLevel = memberInfo.dwMemberPvpLevel; CFakePvPHelper.FakeHeroSelect fakeHeroSelect = CFakePvPHelper.GetFakeHeroSelect(memberInfo.ullUid); if (fakeHeroSelect != null) { stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = fakeHeroSelect.selectedHero; stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeHeroSelect.selectedPlayerSkill; stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo.stCommonInfo.wSkinID = (ushort)fakeHeroSelect.selectedSkin; stBattlePlayer.astFighter[num].szName = fakeHeroSelect.FakePlayer.szUserName; stBattlePlayer.astFighter[num].stDetail.set_stPlayerOfNpc(new COMDT_PLAYERINFO_OF_NPC()); stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().ullFakeUid = fakeHeroSelect.FakePlayer.ullUid; stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakePvpLevel = fakeHeroSelect.FakePlayer.dwAcntPvpLevel; stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID = fakeHeroSelect.FakePlayer.dwLogicWorldId; } else { CFakePvPHelper.SelectHeroForEnemyPlayer(ref stBattlePlayer.astFighter[num].astChoiceHero[0].stBaseInfo, stBattlePlayer.astFighter[num].dwLevel); stBattlePlayer.astFighter[num].szName = memberInfo.WarmNpc.szUserName; stBattlePlayer.astFighter[num].stDetail.set_stPlayerOfNpc(new COMDT_PLAYERINFO_OF_NPC()); stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().ullFakeUid = memberInfo.WarmNpc.ullUid; stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakePvpLevel = memberInfo.WarmNpc.dwAcntPvpLevel; stBattlePlayer.astFighter[num].stDetail.get_stPlayerOfNpc().dwFakeLogicWorldID = memberInfo.WarmNpc.dwLogicWorldId; } } else if (memberInfo.RoomMemberType == 1u) { stBattlePlayer.astFighter[num].bObjType = 1; stBattlePlayer.astFighter[num].bPosOfCamp = (byte)j; stBattlePlayer.astFighter[num].bObjCamp = cOM_PLAYERCAMP; for (int k = 0; k < (int)pvpMapCommonInfo.bHeroNum; k++) { stBattlePlayer.astFighter[num].astChoiceHero[k].stBaseInfo.stCommonInfo.dwHeroID = (uint)dwHeroID; } } num++; } } } stBattlePlayer.bNum = (byte)num; roomInfo.roomAttrib.bWarmBattle = false; roomInfo.roomAttrib.npcAILevel = 2; Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref cSPkg, true); Singleton <WatchController> .GetInstance().Stop(); } } }
private static void ReqStartSingleWarmBattle() { bInFakeSelect = false; Singleton <CTimerManager> .GetInstance().RemoveTimer(new CTimer.OnTimeUpHandler(CFakePvPHelper.OnSelectHeroTimeout)); RemoveAllFakeTimer(); CSPkg msg = NetworkModule.CreateDefaultCSPKG(0x41a); RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; if (roomInfo == null) { DebugHelper.Assert(roomInfo != null, "RoomInfo Should not be NULL!!!"); } else if (roomInfo != null) { msg.stPkgData.stStartSingleGameReq.stBattleParam.bGameType = 1; msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat = Singleton <CHeroSelectBaseSystem> .instance.m_stGameOfCombat; msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.wHeroCnt = 1; if (msg.stPkgData.stStartSingleGameReq.stBattleParam.stGameDetail.stGameOfCombat != null) { MemberInfo masterMemberInfo = roomInfo.GetMasterMemberInfo(); if (masterMemberInfo != null) { msg.stPkgData.stStartSingleGameReq.stBattleList.stBattleList.BattleHeroList[0] = masterMemberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(roomInfo.roomAttrib.bMapType, roomInfo.roomAttrib.dwMapId); if (pvpMapCommonInfo != null) { COM_PLAYERCAMP camp = COM_PLAYERCAMP.COM_PLAYERCAMP_1; int dwHeroID = 0; for (COM_PLAYERCAMP com_playercamp2 = COM_PLAYERCAMP.COM_PLAYERCAMP_1; com_playercamp2 < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; com_playercamp2 += 1) { ListView <MemberInfo> view = roomInfo[com_playercamp2]; for (int i = 0; i < view.Count; i++) { if (view[i].ullUid == roomInfo.selfInfo.ullUid) { camp = view[i].camp; dwHeroID = (int)view[i].ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID; break; } } } CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer = msg.stPkgData.stStartSingleGameReq.stBattlePlayer; int index = 0; for (COM_PLAYERCAMP com_playercamp3 = COM_PLAYERCAMP.COM_PLAYERCAMP_1; com_playercamp3 < COM_PLAYERCAMP.COM_PLAYERCAMP_COUNT; com_playercamp3 += 1) { ListView <MemberInfo> view2 = roomInfo[com_playercamp3]; for (int j = 0; j < view2.Count; j++) { MemberInfo info4 = view2[j]; if (info4 != null) { if (info4.RoomMemberType == 2) { stBattlePlayer.astFighter[index].bObjType = 2; stBattlePlayer.astFighter[index].bPosOfCamp = (byte)j; stBattlePlayer.astFighter[index].bObjCamp = (byte)com_playercamp3; stBattlePlayer.astFighter[index].dwLevel = info4.dwMemberPvpLevel; FakeHeroSelect fakeHeroSelect = GetFakeHeroSelect(info4.ullUid); if (fakeHeroSelect != null) { stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = fakeHeroSelect.selectedHero; stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeHeroSelect.selectedPlayerSkill; stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo.stCommonInfo.wSkinID = (ushort)fakeHeroSelect.selectedSkin; stBattlePlayer.astFighter[index].szName = fakeHeroSelect.FakePlayer.szUserName; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc = new COMDT_PLAYERINFO_OF_NPC(); stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid = fakeHeroSelect.FakePlayer.ullUid; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel = fakeHeroSelect.FakePlayer.dwAcntPvpLevel; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = fakeHeroSelect.FakePlayer.dwLogicWorldId; } else { SelectHeroForEnemyPlayer(ref stBattlePlayer.astFighter[index].astChoiceHero[0].stBaseInfo, stBattlePlayer.astFighter[index].dwLevel); stBattlePlayer.astFighter[index].szName = info4.WarmNpc.szUserName; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc = new COMDT_PLAYERINFO_OF_NPC(); stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.ullFakeUid = info4.WarmNpc.ullUid; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakePvpLevel = info4.WarmNpc.dwAcntPvpLevel; stBattlePlayer.astFighter[index].stDetail.stPlayerOfNpc.dwFakeLogicWorldID = info4.WarmNpc.dwLogicWorldId; } } else if (info4.RoomMemberType == 1) { stBattlePlayer.astFighter[index].bObjType = 1; stBattlePlayer.astFighter[index].bPosOfCamp = (byte)j; stBattlePlayer.astFighter[index].bObjCamp = (byte)camp; for (int k = 0; k < pvpMapCommonInfo.bHeroNum; k++) { stBattlePlayer.astFighter[index].astChoiceHero[k].stBaseInfo.stCommonInfo.dwHeroID = (uint)dwHeroID; } } index++; } } } stBattlePlayer.bNum = (byte)index; roomInfo.roomAttrib.bWarmBattle = false; roomInfo.roomAttrib.npcAILevel = 2; Singleton <NetworkModule> .GetInstance().SendLobbyMsg(ref msg, true); } } else { DebugHelper.Assert(roomInfo != null, "selfInfo Should not be NULL!!!"); } } } }