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); }
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); } }
public static void OnSelfHeroConfirmed() { HeroConfirmedPlayerNum++; RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; roomInfo.GetMemberInfo(roomInfo.selfInfo.ullUid).isPrepare = true; if (HeroConfirmedPlayerNum == (FakeHeroSelectList.Count + 1)) { ReqStartSingleWarmBattle(); } }
public static void OnSelfHeroConfirmed() { CFakePvPHelper.HeroConfirmedPlayerNum++; RoomInfo roomInfo = Singleton <CRoomSystem> .GetInstance().roomInfo; MemberInfo memberInfo = roomInfo.GetMemberInfo(roomInfo.selfInfo.ullUid); memberInfo.isPrepare = true; if (CFakePvPHelper.HeroConfirmedPlayerNum == CFakePvPHelper.FakeHeroSelectList.get_Count() + 1) { CFakePvPHelper.ReqStartSingleWarmBattle(); } }
public static void UpdateBtnStatus(GameObject root, RoomInfo data) { ResDT_LevelCommonInfo pvpMapCommonInfo = CLevelCfgLogicManager.GetPvpMapCommonInfo(data.roomAttrib.bMapType, data.roomAttrib.dwMapId); int bMaxAcntNum = (int)pvpMapCommonInfo.bMaxAcntNum; bool isSelfRoomOwner = Singleton <CRoomSystem> .GetInstance().IsSelfRoomOwner; GameObject gameObject = root.transform.Find("Panel_Main/bg1/LeftRobot").gameObject; GameObject gameObject2 = root.transform.Find("Panel_Main/bg2/RightRobot").gameObject; gameObject.CustomSetActive(false); gameObject2.CustomSetActive(false); CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .instance.GetMasterRoleInfo(); if (isSelfRoomOwner && masterRoleInfo != null) { MemberInfo memberInfo = data.GetMemberInfo(masterRoleInfo.playerUllUID); if (memberInfo != null) { COM_PLAYERCAMP cOM_PLAYERCAMP = (memberInfo.camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) ? COM_PLAYERCAMP.COM_PLAYERCAMP_2 : COM_PLAYERCAMP.COM_PLAYERCAMP_1; if (data.GetFreePos(memberInfo.camp, bMaxAcntNum) >= 0) { if (memberInfo.camp == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { gameObject.CustomSetActive(true); } else { gameObject2.CustomSetActive(true); } } if (data.GetFreePos(cOM_PLAYERCAMP, bMaxAcntNum) >= 0) { if (cOM_PLAYERCAMP == COM_PLAYERCAMP.COM_PLAYERCAMP_1) { gameObject.CustomSetActive(true); } else { gameObject2.CustomSetActive(true); } } } } CUIEventScript component = gameObject.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_AddRobot; component.m_onClickEventParams.tag = 1; component = gameObject2.GetComponent <CUIEventScript>(); component.m_onClickEventID = enUIEventID.Room_AddRobot; component.m_onClickEventParams.tag = 2; }
private static void DoSelectAction(ref CFakePvPHelper.FakeHeroSelect fakeSelect) { if (!CFakePvPHelper.IsInSelectHero()) { return; } if (fakeSelect.changeHeroCount < fakeSelect.maxChangeHeroCount) { uint num2; if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6u) { int num = Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count()); ResFakeAcntHero dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(num); if (dataByIndex == null) { return; } num2 = dataByIndex.dwHeroID; while (CFakePvPHelper.ChosenHeroes.ContainsValue(dataByIndex.dwHeroID)) { num = Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count()); dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(num); if (dataByIndex == null) { return; } num2 = dataByIndex.dwHeroID; } } else { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); int num3 = GameDataMgr.robotVeteranHeroSkinDatabin.Count(); int max = num3 + ((masterRoleInfo == null) ? 0 : masterRoleInfo.freeHeroList.get_Count()); int num = Random.Range(0, max); if (num < num3) { ResFakeAcntHero dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(num); if (dataByIndex == null) { return; } num2 = dataByIndex.dwHeroID; } else { num2 = masterRoleInfo.freeHeroList.get_Item(num - num3).dwFreeHeroID; } while (CFakePvPHelper.ChosenHeroes.ContainsValue(num2)) { num = Random.Range(0, max); if (num < num3) { ResFakeAcntHero dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(num); if (dataByIndex == null) { return; } num2 = dataByIndex.dwHeroID; } else { num2 = masterRoleInfo.freeHeroList.get_Item(num - num3).dwFreeHeroID; } } } CFakePvPHelper.ChosenHeroes.set_Item(fakeSelect.FakePlayer.ullUid, num2); fakeSelect.selectedHero = num2; fakeSelect.changeHeroCount++; RoomInfo roomInfo = Singleton <CHeroSelectBaseSystem> .get_instance().roomInfo; if (roomInfo == null) { return; } MemberInfo memberInfo = roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid); if (memberInfo != null && memberInfo.ChoiceHero[0] != null) { memberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = num2; Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true); } } else { if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6u) { ResFakeAcntHero dataByKey = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero); if (dataByKey != null && dataByKey.dwSkinID != 0u) { int num4 = Random.Range(0, 10000); if ((long)num4 < (long)((ulong)dataByKey.dwSkinRate)) { fakeSelect.selectedSkin = (int)dataByKey.dwSkinID; } } } else { ResFakeAcntHero dataByKey2 = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero); if (dataByKey2 != null && dataByKey2.dwSkinID != 0u) { int num5 = Random.Range(0, 10000); if ((long)num5 < (long)((ulong)dataByKey2.dwSkinRate)) { fakeSelect.selectedSkin = (int)dataByKey2.dwSkinID; } } } ResFakeAcntSkill dataByKey3 = GameDataMgr.robotPlayerSkillDatabin.GetDataByKey(fakeSelect.FakePlayer.dwAcntPvpLevel); if (dataByKey3 != null) { int num6 = Random.Range(0, dataByKey3.SkillId.Length); while (dataByKey3.SkillId[num6] == 0u) { num6 = Random.Range(0, dataByKey3.SkillId.Length); } uint selectedPlayerSkill = dataByKey3.SkillId[num6]; fakeSelect.selectedPlayerSkill = selectedPlayerSkill; } fakeSelect.bConfirmed = true; CFakePvPHelper.HeroConfirmedPlayerNum++; RoomInfo roomInfo2 = Singleton <CRoomSystem> .GetInstance().roomInfo; MemberInfo memberInfo2 = roomInfo2.GetMemberInfo(fakeSelect.FakePlayer.ullUid); if (memberInfo2 != null && memberInfo2.ChoiceHero[0] != null) { memberInfo2.ChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeSelect.selectedPlayerSkill; memberInfo2.isPrepare = true; Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true); } if (CFakePvPHelper.HeroConfirmedPlayerNum == CFakePvPHelper.FakeHeroSelectList.get_Count() + 1) { CFakePvPHelper.ReqStartSingleWarmBattle(); } } }
private static void DoSelectAction(ref FakeHeroSelect fakeSelect) { if (IsInSelectHero()) { if (fakeSelect.changeHeroCount < fakeSelect.maxChangeHeroCount) { int id = 0; uint dwHeroID = 0; ResFakeAcntHero dataByIndex = null; if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6) { id = UnityEngine.Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count()); dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(id); if (dataByIndex == null) { return; } for (dwHeroID = dataByIndex.dwHeroID; ChosenHeroes.ContainsValue(dataByIndex.dwHeroID); dwHeroID = dataByIndex.dwHeroID) { id = UnityEngine.Random.Range(0, GameDataMgr.robotRookieHeroSkinDatabin.Count()); dataByIndex = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByIndex(id); if (dataByIndex == null) { return; } } } else { CRoleInfo masterRoleInfo = Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo(); int num3 = GameDataMgr.robotVeteranHeroSkinDatabin.Count(); int max = num3 + ((masterRoleInfo == null) ? 0 : masterRoleInfo.freeHeroList.Count); id = UnityEngine.Random.Range(0, max); if (id < num3) { dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(id); if (dataByIndex == null) { return; } dwHeroID = dataByIndex.dwHeroID; } else { dwHeroID = masterRoleInfo.freeHeroList[id - num3].dwFreeHeroID; } while (ChosenHeroes.ContainsValue(dwHeroID)) { id = UnityEngine.Random.Range(0, max); if (id < num3) { dataByIndex = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByIndex(id); if (dataByIndex == null) { return; } dwHeroID = dataByIndex.dwHeroID; } else { dwHeroID = masterRoleInfo.freeHeroList[id - num3].dwFreeHeroID; } } } ChosenHeroes[fakeSelect.FakePlayer.ullUid] = dwHeroID; fakeSelect.selectedHero = dwHeroID; fakeSelect.changeHeroCount++; RoomInfo roomInfo = Singleton <CHeroSelectBaseSystem> .instance.roomInfo; if (roomInfo != null) { MemberInfo memberInfo = roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid); if ((memberInfo != null) && (memberInfo.ChoiceHero[0] != null)) { memberInfo.ChoiceHero[0].stBaseInfo.stCommonInfo.dwHeroID = dwHeroID; Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true); } } } else { if (fakeSelect.FakePlayer.dwAcntPvpLevel <= 6) { ResFakeAcntHero hero2 = GameDataMgr.robotRookieHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero); if (((hero2 != null) && (hero2.dwSkinID != 0)) && (UnityEngine.Random.Range(0, 0x2710) < hero2.dwSkinRate)) { fakeSelect.selectedSkin = (int)hero2.dwSkinID; } } else { ResFakeAcntHero hero3 = GameDataMgr.robotVeteranHeroSkinDatabin.GetDataByKey(fakeSelect.selectedHero); if (((hero3 != null) && (hero3.dwSkinID != 0)) && (UnityEngine.Random.Range(0, 0x2710) < hero3.dwSkinRate)) { fakeSelect.selectedSkin = (int)hero3.dwSkinID; } } ResFakeAcntSkill dataByKey = GameDataMgr.robotPlayerSkillDatabin.GetDataByKey(fakeSelect.FakePlayer.dwAcntPvpLevel); if (dataByKey != null) { int index = UnityEngine.Random.Range(0, dataByKey.SkillId.Length); while (dataByKey.SkillId[index] == 0) { index = UnityEngine.Random.Range(0, dataByKey.SkillId.Length); } uint num8 = dataByKey.SkillId[index]; fakeSelect.selectedPlayerSkill = num8; } fakeSelect.bConfirmed = true; HeroConfirmedPlayerNum++; MemberInfo info5 = Singleton <CRoomSystem> .GetInstance().roomInfo.GetMemberInfo(fakeSelect.FakePlayer.ullUid); if ((info5 != null) && (info5.ChoiceHero[0] != null)) { info5.ChoiceHero[0].stBaseInfo.stCommonInfo.stSkill.dwSelSkillID = fakeSelect.selectedPlayerSkill; info5.isPrepare = true; Singleton <CHeroSelectNormalSystem> .GetInstance().RefreshHeroPanel(false, true); } if (HeroConfirmedPlayerNum == (FakeHeroSelectList.Count + 1)) { ReqStartSingleWarmBattle(); } } } }