public override void OnActivate(int pinID) { if (pinID != 0) { return; } PlayerData player = MonoSingleton <GameManager> .Instance.Player; PlayerPartyTypes type = PlayerPartyTypes.Normal; PartyData partyOfType = player.FindPartyOfType(type); List <UnitData> units = player.Units; List <UnitData> unitDataList = new List <UnitData>(); for (int mainmemberStart = partyOfType.MAINMEMBER_START; mainmemberStart < partyOfType.MAX_MAINMEMBER && mainmemberStart <= units.Count; ++mainmemberStart) { if (!units[mainmemberStart].UnitParam.IsHero()) { unitDataList.Add(units[mainmemberStart]); } } for (int count = unitDataList.Count; count < partyOfType.MAX_UNIT; ++count) { unitDataList.Add((UnitData)null); } for (int index = 0; index < unitDataList.Count; ++index) { long uniqueid = unitDataList[index] == null ? 0L : unitDataList[index].UniqueID; partyOfType.SetUnitUniqueID(index, uniqueid); } this.ExecRequest((WebAPI) new ReqParty(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), false, false, false)); ((Behaviour)this).set_enabled(true); }
protected override void ShowTooltip(Vector2 screen) { if (!this.Tooltip) { return; } UnitData instanceData = this.GetInstanceData(); if (instanceData == null) { return; } PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max); GameObject gameObject = (GameObject)Object.Instantiate <GameObject>((M0)AssetManager.Load <GameObject>("UI/UnitTooltip")); DataSource.Bind <UnitData>(gameObject, instanceData); DataSource.Bind <PlayerPartyTypes>(gameObject, dataOfClass); UnitJobDropdown componentInChildren = (UnitJobDropdown)gameObject.GetComponentInChildren <UnitJobDropdown>(); if (!Object.op_Inequality((Object)componentInChildren, (Object)null)) { return; } ((Component)componentInChildren).get_gameObject().SetActive((instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max); }
public static string GetStringFromPartyType(PlayerPartyTypes type) { switch (type) { case PlayerPartyTypes.Normal: return("norm"); case PlayerPartyTypes.Event: return("ev"); case PlayerPartyTypes.Multiplay: return("mul"); case PlayerPartyTypes.Arena: return("col"); case PlayerPartyTypes.ArenaDef: return("coldef"); case PlayerPartyTypes.Character: return("chara"); case PlayerPartyTypes.Tower: return("tower"); case PlayerPartyTypes.Versus: return("vs"); default: return("norm"); } }
private void RequestJobChange(bool immediate) { if (this.mRequestSent) { return; } PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max); this.mRequestSent = true; if ((this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0) { MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(this.mTargetUnit.UniqueID).SetJobFor(dataOfClass, this.mTargetUnit.CurrentJob); } UnitJobDropdown.OnJobChange(this.mTargetUnit.UniqueID); ReqUnitJob reqUnitJob = (this.mTargetUnit.TempFlags & UnitData.TemporaryFlags.TemporaryUnitData) != (UnitData.TemporaryFlags) 0 ? new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, PartyData.GetStringFromPartyType(dataOfClass), new Network.ResponseCallback(this.JobChangeResult)) : new ReqUnitJob(this.mTargetUnit.UniqueID, this.mTargetUnit.CurrentJob.UniqueID, new Network.ResponseCallback(this.JobChangeResult)); if (immediate) { int num = (int)Network.RequestAPIImmediate((WebAPI)reqUnitJob, true); } else { Network.RequestAPI((WebAPI)reqUnitJob, false); } }
public override void OnActivate(int pinID) { MonoSingleton <GameManager> .Instance.AudienceMode = false; if (pinID == 10) { this.mResume = true; pinID = 0; } if (pinID != 0 || ((Behaviour)this).get_enabled()) { return; } ((Behaviour)this).set_enabled(true); CriticalSection.Enter(CriticalSections.SceneChange); PlayerPartyTypes type = PlayerPartyTypes.Tower; GlobalVars.SelectedPartyIndex.Set((int)type); MonoSingleton <GameManager> .Instance.Player.SetPartyCurrentIndex((int)type); PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay = false; PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = false; if (this.mResume) { this.btlID = (long)GlobalVars.BtlID; GlobalVars.BtlID.Set(0L); this.ExecRequest((WebAPI) new ReqTowerBtlComResume(this.btlID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { GameManager instance = MonoSingleton <GameManager> .Instance; if (!string.IsNullOrEmpty(this.QuestID)) { GlobalVars.SelectedQuestID = this.QuestID; GlobalVars.SelectedFriendID = string.Empty; } this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID); if (this.PlayOffline || Network.Mode != Network.EConnectMode.Online) { return; } PartyData partyOfType = instance.Player.FindPartyOfType(type); if (this.mStartingQuest.type != QuestTypes.Tower) { return; } TowerFloorParam towerFloor = MonoSingleton <GameManager> .Instance.FindTowerFloor(this.mStartingQuest.iname); this.ExecRequest((WebAPI) new ReqBtlTowerComReq(towerFloor.tower_id, towerFloor.iname, partyOfType, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } }
protected override void ShowTooltip(Vector2 screen) { if (!this.Tooltip) { return; } this.UpdatePartyWindow(); UnitData instanceData = this.GetInstanceData(); if (instanceData == null) { return; } PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(((Component)this).get_gameObject(), PlayerPartyTypes.Max); GameObject root = (GameObject)Object.Instantiate <GameObject>((M0)AssetManager.Load <GameObject>("UI/UnitTooltip_1")); UnitData data = new UnitData(); data.Setup(instanceData); data.TempFlags = instanceData.TempFlags; DataSource.Bind <UnitData>(root, data); DataSource.Bind <PlayerPartyTypes>(root, dataOfClass); UnitJobDropdown componentInChildren1 = (UnitJobDropdown)root.GetComponentInChildren <UnitJobDropdown>(); if (Object.op_Inequality((Object)componentInChildren1, (Object)null)) { bool flag = (instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max; ((Component)componentInChildren1).get_gameObject().SetActive(true); componentInChildren1.UpdateValue = new UnitJobDropdown.ParentObjectEvent(this.UpdateValue); Selectable component1 = (Selectable)((Component)componentInChildren1).get_gameObject().GetComponent <Selectable>(); if (Object.op_Inequality((Object)component1, (Object)null)) { component1.set_interactable(flag); } Image component2 = (Image)((Component)componentInChildren1).get_gameObject().GetComponent <Image>(); if (Object.op_Inequality((Object)component2, (Object)null)) { ((Graphic)component2).set_color(!flag ? new Color(0.5f, 0.5f, 0.5f) : Color.get_white()); } } ArtifactSlots componentInChildren2 = (ArtifactSlots)root.GetComponentInChildren <ArtifactSlots>(); AbilitySlots componentInChildren3 = (AbilitySlots)root.GetComponentInChildren <AbilitySlots>(); if (Object.op_Inequality((Object)componentInChildren2, (Object)null) && Object.op_Inequality((Object)componentInChildren3, (Object)null)) { bool enable = (instanceData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max; componentInChildren2.Refresh(enable); componentInChildren3.Refresh(enable); } GameParameter.UpdateAll(root); }
public PartyData(PlayerPartyTypes type) { switch (type) { case PlayerPartyTypes.Tower: this.mMAX_UNIT = 7; this.mMAX_MAINMEMBER = 5; this.mMAX_SUBMEMBER = this.MAX_UNIT - this.MAX_MAINMEMBER; this.mMAINMEMBER_START = 0; this.mMAINMEMBER_END = 0 + this.MAX_MAINMEMBER - 1; this.mSUBMEMBER_START = this.MAX_MAINMEMBER; this.mSUBMEMBER_END = this.SUBMEMBER_START + this.MAX_SUBMEMBER - 1; break; case PlayerPartyTypes.Versus: this.mMAX_UNIT = 5; this.mMAX_MAINMEMBER = 5; this.mMAX_SUBMEMBER = this.MAX_UNIT - this.MAX_MAINMEMBER; this.mMAINMEMBER_START = 0; this.mMAINMEMBER_END = 0 + this.MAX_MAINMEMBER - 1; this.mSUBMEMBER_START = this.MAX_MAINMEMBER; this.mSUBMEMBER_END = this.SUBMEMBER_START + this.MAX_SUBMEMBER - 1; break; case PlayerPartyTypes.MultiTower: this.mMAX_UNIT = 3; this.mMAX_MAINMEMBER = 2; this.mMAX_SUBMEMBER = this.MAX_UNIT - this.MAX_MAINMEMBER; this.mMAINMEMBER_START = 0; this.mMAINMEMBER_END = 0 + this.MAX_MAINMEMBER - 1; this.mSUBMEMBER_START = this.MAX_MAINMEMBER; this.mSUBMEMBER_END = this.SUBMEMBER_START + this.MAX_SUBMEMBER - 1; break; default: this.mMAX_UNIT = 6; this.mMAX_MAINMEMBER = 4; this.mMAX_SUBMEMBER = this.MAX_UNIT - this.MAX_MAINMEMBER; this.mMAINMEMBER_START = 0; this.mMAINMEMBER_END = 0 + this.MAX_MAINMEMBER - 1; this.mSUBMEMBER_START = this.MAX_MAINMEMBER; this.mSUBMEMBER_END = this.SUBMEMBER_START + this.MAX_SUBMEMBER - 1; break; } this.mUniqueIDs = new long[this.MAX_UNIT]; }
private void BindData(GameObject go, UnitData unitData) { PlayerPartyTypes dataOfClass = DataSource.FindDataOfClass <PlayerPartyTypes>(go, PlayerPartyTypes.Max); DataSource.Bind <UnitData>(go, unitData); DataSource.Bind <PlayerPartyTypes>(go, dataOfClass); UnitJobDropdown componentInChildren1 = (UnitJobDropdown)go.GetComponentInChildren <UnitJobDropdown>(); if (Object.op_Inequality((Object)componentInChildren1, (Object)null)) { bool flag = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max; ((Component)componentInChildren1).get_gameObject().SetActive(true); componentInChildren1.UpdateValue = (UnitJobDropdown.ParentObjectEvent)null; Selectable component1 = (Selectable)((Component)componentInChildren1).get_gameObject().GetComponent <Selectable>(); if (Object.op_Inequality((Object)component1, (Object)null)) { component1.set_interactable(flag); } Image component2 = (Image)((Component)componentInChildren1).get_gameObject().GetComponent <Image>(); if (Object.op_Inequality((Object)component2, (Object)null)) { ((Graphic)component2).set_color(!flag ? new Color(0.5f, 0.5f, 0.5f) : Color.get_white()); } } ArtifactSlots componentInChildren2 = (ArtifactSlots)go.GetComponentInChildren <ArtifactSlots>(); AbilitySlots componentInChildren3 = (AbilitySlots)go.GetComponentInChildren <AbilitySlots>(); if (Object.op_Inequality((Object)componentInChildren2, (Object)null) && Object.op_Inequality((Object)componentInChildren3, (Object)null)) { bool enable = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max; componentInChildren2.Refresh(enable); componentInChildren3.Refresh(enable); } ConceptCardSlots componentInChildren4 = (ConceptCardSlots)go.GetComponentInChildren <ConceptCardSlots>(); if (!Object.op_Inequality((Object)componentInChildren4, (Object)null)) { return; } bool enable1 = (unitData.TempFlags & UnitData.TemporaryFlags.AllowJobChange) != (UnitData.TemporaryFlags) 0 && this.AllowJobChange && dataOfClass != PlayerPartyTypes.Max; componentInChildren4.Refresh(enable1); }
public RaidResult(PlayerPartyTypes type) { this.members = new List <UnitData>(MonoSingleton <GameManager> .Instance.Player.FindPartyOfType(type).MAX_UNIT); }
public override void OnActivate(int pinID) { GameManager instance = MonoSingleton <GameManager> .Instance; instance.AudienceMode = false; this.mReqID = pinID; if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 500)) { PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay = pinID == 100 || pinID == 200 || pinID == 500; PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = pinID == 200; pinID = 0; } if (pinID == 10) { this.mResume = true; pinID = 0; } if (pinID == 0) { if (((Behaviour)this).get_enabled()) { return; } ((Behaviour)this).set_enabled(true); CriticalSection.Enter(CriticalSections.SceneChange); if (this.mResume) { long btlId = (long)GlobalVars.BtlID; GlobalVars.BtlID.Set(0L); this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID); PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type); if (!string.IsNullOrEmpty(this.QuestID)) { GlobalVars.SelectedQuestID = this.QuestID; GlobalVars.SelectedFriendID = string.Empty; } if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online) { PartyData partyOfType = instance.Player.FindPartyOfType(partyIndex1); int partyIndex2 = instance.Player.Partys.IndexOf(partyOfType); if (this.mStartingQuest.type == QuestTypes.Arena) { this.ActivateOutputLinks(5); this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null)); } else { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey2CC activateCAnonStorey2Cc = new FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey2CC(); // ISSUE: reference to a compiler-generated field activateCAnonStorey2Cc.pt = PunMonoSingleton <MyPhoton> .Instance; bool multi = false; bool isHost = false; int seat = -1; int plid = -1; string uid = string.Empty; List <string> stringList = new List <string>(); // ISSUE: reference to a compiler-generated field if (UnityEngine.Object.op_Inequality((UnityEngine.Object)activateCAnonStorey2Cc.pt, (UnityEngine.Object)null)) { // ISSUE: reference to a compiler-generated field multi = activateCAnonStorey2Cc.pt.IsMultiPlay; // ISSUE: reference to a compiler-generated field isHost = activateCAnonStorey2Cc.pt.IsOldestPlayer(); // ISSUE: reference to a compiler-generated field seat = activateCAnonStorey2Cc.pt.MyPlayerIndex; // ISSUE: reference to a compiler-generated field MyPhoton.MyPlayer myPlayer = activateCAnonStorey2Cc.pt.GetMyPlayer(); if (myPlayer != null) { plid = myPlayer.playerID; } // ISSUE: reference to a compiler-generated field if (activateCAnonStorey2Cc.pt.IsMultiVersus) { // ISSUE: reference to a compiler-generated field List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey2Cc.pt.GetMyPlayersStarted(); // ISSUE: reference to a compiler-generated field MyPhoton.MyRoom currentRoom = activateCAnonStorey2Cc.pt.GetCurrentRoom(); int num = currentRoom == null ? 1 : currentRoom.playerCount; // ISSUE: reference to a compiler-generated method JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find(new Predicate <JSON_MyPhotonPlayerParam>(activateCAnonStorey2Cc.\u003C\u003Em__2AB)); if (photonPlayerParam != null) { uid = photonPlayerParam.UID; } if (string.IsNullOrEmpty(uid) || num == 1) { this.OnVersusNoPlayer(); return; } } else { // ISSUE: reference to a compiler-generated field List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey2Cc.pt.GetMyPlayersStarted(); for (int index = 0; index < myPlayersStarted.Count; ++index) { // ISSUE: reference to a compiler-generated field if (myPlayersStarted[index].playerIndex != activateCAnonStorey2Cc.pt.MyPlayerIndex) { stringList.Add(myPlayersStarted[index].UID); } } } } if (this.mReqID == 200) { this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType)); } else if (this.mReqID == 500) { this.ExecRequest((WebAPI) new ReqBtlMultiTwReq(this.mStartingQuest.iname, partyIndex2, plid, seat, stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, GlobalVars.SelectedSupport.Get(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat, GlobalVars.Location, GlobalVars.SelectedRankingQuestParam)); } } } else { this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null)); } } } else if (pinID == 20) { if (instance.AudienceRoom == null) { return; } this.StartCoroutine(this.StartAudience()); } else { if (pinID != 30) { return; } if (Network.IsError) { this.ActivateOutputLinks(300); Network.ResetError(); } else if (!Network.IsStreamConnecting) { Network.ResetError(); this.ActivateOutputLinks(300); } else { VersusAudienceManager audienceManager = instance.AudienceManager; audienceManager.AddStartQuest(); if (audienceManager.GetStartedParam() != null) { if (audienceManager.GetStartedParam().btlinfo != null) { BattleCore.Json_Battle json = new BattleCore.Json_Battle(); json.btlinfo = audienceManager.GetStartedParam().btlinfo; CriticalSection.Enter(CriticalSections.SceneChange); instance.AudienceMode = true; this.StartCoroutine(this.StartScene(json)); } else { DebugUtility.LogError("Not Exist btlInfo"); if (audienceManager.IsRetryError) { Network.Abort(); this.ActivateOutputLinks(300); } else { this.ActivateOutputLinks(9); } } } else { DebugUtility.LogError("Not Exist StartParam"); if (audienceManager.IsRetryError) { Network.Abort(); this.ActivateOutputLinks(300); } else { this.ActivateOutputLinks(9); } } } } }
public override void OnActivate(int pinID) { int num1 = pinID; if (pinID == 0 || pinID == 100 || pinID == 200) { PunMonoSingleton <MyPhoton> .Instance.IsMultiPlay = pinID == 100 || pinID == 200; PunMonoSingleton <MyPhoton> .Instance.IsMultiVersus = pinID == 200; pinID = 0; } if (pinID == 10) { this.mResume = true; pinID = 0; } if (pinID != 0 || ((Behaviour)this).get_enabled()) { return; } ((Behaviour)this).set_enabled(true); CriticalSection.Enter(CriticalSections.SceneChange); if (this.mResume) { long btlId = (long)GlobalVars.BtlID; GlobalVars.BtlID.Set(0L); this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { GameManager instance = MonoSingleton <GameManager> .Instance; this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID); PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type); if (!string.IsNullOrEmpty(this.QuestID)) { GlobalVars.SelectedQuestID = this.QuestID; GlobalVars.SelectedFriendID = string.Empty; } if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online) { PartyData partyOfType = instance.Player.FindPartyOfType(partyIndex1); int partyIndex2 = instance.Player.Partys.IndexOf(partyOfType); if (this.mStartingQuest.type == QuestTypes.Arena) { ArenaPlayer selectedArenaPlayer = (ArenaPlayer)GlobalVars.SelectedArenaPlayer; this.ExecRequest((WebAPI) new ReqBtlColoReq(this.mStartingQuest.iname, selectedArenaPlayer.FUID, selectedArenaPlayer, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), partyIndex2)); } else { // ISSUE: object of a compiler-generated type is created // ISSUE: variable of a compiler-generated type FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey20E activateCAnonStorey20E = new FlowNode_StartQuest.\u003COnActivate\u003Ec__AnonStorey20E(); // ISSUE: reference to a compiler-generated field activateCAnonStorey20E.pt = PunMonoSingleton <MyPhoton> .Instance; bool multi = false; bool isHost = false; int seat = -1; int plid = -1; string uid = string.Empty; // ISSUE: reference to a compiler-generated field if (Object.op_Inequality((Object)activateCAnonStorey20E.pt, (Object)null)) { // ISSUE: reference to a compiler-generated field multi = activateCAnonStorey20E.pt.IsMultiPlay; // ISSUE: reference to a compiler-generated field isHost = activateCAnonStorey20E.pt.IsOldestPlayer(); // ISSUE: reference to a compiler-generated field seat = activateCAnonStorey20E.pt.MyPlayerIndex; // ISSUE: reference to a compiler-generated field MyPhoton.MyPlayer myPlayer = activateCAnonStorey20E.pt.GetMyPlayer(); if (myPlayer != null) { plid = myPlayer.playerID; } // ISSUE: reference to a compiler-generated field if (activateCAnonStorey20E.pt.IsMultiVersus) { // ISSUE: reference to a compiler-generated field List <JSON_MyPhotonPlayerParam> myPlayersStarted = activateCAnonStorey20E.pt.GetMyPlayersStarted(); // ISSUE: reference to a compiler-generated field MyPhoton.MyRoom currentRoom = activateCAnonStorey20E.pt.GetCurrentRoom(); int num2 = currentRoom == null ? 1 : currentRoom.playerCount; // ISSUE: reference to a compiler-generated method JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find(new Predicate <JSON_MyPhotonPlayerParam>(activateCAnonStorey20E.\u003C\u003Em__1F5)); if (photonPlayerParam != null) { uid = photonPlayerParam.UID; } if (string.IsNullOrEmpty(uid) || num2 == 1) { this.OnVersusNoPlayer(); return; } } } if (num1 == 200) { this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType)); } else { this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat)); } } } else { this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null)); } } }
public static JSON_MyPhotonPlayerParam Create(int playerID = 0, int playerIndex = 0) { JSON_MyPhotonPlayerParam photonPlayerParam = new JSON_MyPhotonPlayerParam(); if (photonPlayerParam == null) { return((JSON_MyPhotonPlayerParam)null); } if (UnityEngine.Object.op_Equality((UnityEngine.Object)PunMonoSingleton <MyPhoton> .Instance, (UnityEngine.Object)null)) { return((JSON_MyPhotonPlayerParam)null); } PlayerData player = MonoSingleton <GameManager> .Instance.Player; photonPlayerParam.playerID = playerID; photonPlayerParam.playerIndex = playerIndex; photonPlayerParam.playerName = player.Name; photonPlayerParam.playerLevel = player.Lv; photonPlayerParam.FUID = player.FUID; photonPlayerParam.UID = MonoSingleton <GameManager> .Instance.DeviceId; photonPlayerParam.award = player.SelectedAward; PlayerPartyTypes partyType = PlayerPartyTypes.Multiplay; switch (GlobalVars.SelectedMultiPlayRoomType) { case JSON_MyPhotonRoomParam.EType.RAID: partyType = PlayerPartyTypes.Multiplay; break; case JSON_MyPhotonRoomParam.EType.VERSUS: partyType = PlayerPartyTypes.Versus; break; case JSON_MyPhotonRoomParam.EType.TOWER: partyType = PlayerPartyTypes.MultiTower; break; } QuestParam quest = (QuestParam)null; PartyData party; int length; List <PartyEditData> teams; if (partyType == PlayerPartyTypes.Versus || partyType == PlayerPartyTypes.MultiTower) { party = player.Partys[(int)partyType]; length = party.MAX_UNIT; int lastSelectionIndex; teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex); } else { party = player.Partys[(int)partyType]; length = party.MAX_UNIT; if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); if (quest != null) { length = (int)quest.unitNum; } } int lastSelectionIndex; teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex); } UnitData[] unitDataArray = new UnitData[length]; if (teams != null && teams.Count > 0) { PartyUtility.ResetToDefaultTeamIfNeeded(partyType, quest, teams); UnitData[] units = teams[0].Units; for (int index = 0; index < unitDataArray.Length && index < units.Length; ++index) { unitDataArray[index] = units[index]; } } else { for (int index = 0; index < unitDataArray.Length; ++index) { long unitUniqueId = party.GetUnitUniqueID(index); unitDataArray[index] = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(unitUniqueId); } } int num1 = 0; int num2 = 0; bool flag = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER; photonPlayerParam.leaderID = party.LeaderIndex; List <JSON_MyPhotonPlayerParam.UnitDataElem> unitDataElemList = new List <JSON_MyPhotonPlayerParam.UnitDataElem>(); for (int index = 0; index < unitDataArray.Length; ++index) { UnitData unitData = unitDataArray[index]; if (unitData != null) { unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem() { slotID = num1++, place = !flag ? player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index) : -1, sub = index < party.MAX_MAINMEMBER || party.MAX_SUBMEMBER <= 0 ? 0 : 1, unit = unitData }); num2 = num2 + (int)unitData.Status.param.atk + (int)unitData.Status.param.mag; } } photonPlayerParam.units = unitDataElemList.ToArray(); photonPlayerParam.totalAtk = num2; photonPlayerParam.rankpoint = player.VERSUS_POINT; photonPlayerParam.mtChallengeFloor = MonoSingleton <GameManager> .Instance.GetMTChallengeFloor(); photonPlayerParam.mtClearedFloor = MonoSingleton <GameManager> .Instance.GetMTClearedMaxFloor(); return(photonPlayerParam); }
public static JSON_MyPhotonPlayerParam Create(int playerID = 0, int playerIndex = 0) { JSON_MyPhotonPlayerParam photonPlayerParam = new JSON_MyPhotonPlayerParam(); if (photonPlayerParam == null) { return((JSON_MyPhotonPlayerParam)null); } if (UnityEngine.Object.op_Equality((UnityEngine.Object)PunMonoSingleton <MyPhoton> .Instance, (UnityEngine.Object)null)) { return((JSON_MyPhotonPlayerParam)null); } PlayerData player = MonoSingleton <GameManager> .Instance.Player; photonPlayerParam.playerID = playerID; photonPlayerParam.playerIndex = playerIndex; photonPlayerParam.playerName = player.Name; photonPlayerParam.playerLevel = player.Lv; photonPlayerParam.FUID = player.FUID; photonPlayerParam.UID = MonoSingleton <GameManager> .Instance.DeviceId; photonPlayerParam.award = player.SelectedAward; PlayerPartyTypes partyType = PlayerPartyTypes.Multiplay; switch (GlobalVars.SelectedMultiPlayRoomType) { case JSON_MyPhotonRoomParam.EType.RAID: partyType = PlayerPartyTypes.Multiplay; break; case JSON_MyPhotonRoomParam.EType.VERSUS: partyType = PlayerPartyTypes.Versus; break; case JSON_MyPhotonRoomParam.EType.TOWER: partyType = PlayerPartyTypes.MultiTower; break; case JSON_MyPhotonRoomParam.EType.RANKMATCH: partyType = PlayerPartyTypes.RankMatch; break; } QuestParam quest = (QuestParam)null; PartyData party; int length; List <PartyEditData> teams; switch (partyType) { case PlayerPartyTypes.Versus: party = player.Partys[(int)partyType]; length = party.MAX_MAINMEMBER; int lastSelectionIndex1; teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex1, false); if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); break; } break; case PlayerPartyTypes.MultiTower: party = player.Partys[(int)partyType]; length = party.MAX_UNIT; int lastSelectionIndex2; teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex2, false); break; case PlayerPartyTypes.RankMatch: party = player.Partys[(int)partyType]; length = party.MAX_MAINMEMBER; int lastSelectionIndex3; teams = PartyUtility.LoadTeamPresets(partyType, out lastSelectionIndex3, false); if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); break; } break; default: party = player.Partys[(int)partyType]; length = party.MAX_UNIT; if (!string.IsNullOrEmpty(GlobalVars.SelectedQuestID)) { quest = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID); if (quest != null) { length = (int)quest.unitNum; } } PartyEditData partyEditData = new PartyEditData(string.Empty, party); teams = new List <PartyEditData>(); teams.Add(partyEditData); break; } UnitData[] unitDataArray = new UnitData[length]; if (teams != null && teams.Count > 0) { PartyUtility.ResetToDefaultTeamIfNeeded(partyType, quest, teams); UnitData[] units = teams[0].Units; for (int index = 0; index < unitDataArray.Length && index < units.Length; ++index) { unitDataArray[index] = units[index]; } } else { for (int index = 0; index < unitDataArray.Length; ++index) { long unitUniqueId = party.GetUnitUniqueID(index); unitDataArray[index] = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID(unitUniqueId); } } int num1 = 0; int num2 = 0; int num3 = 0; bool flag = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER; photonPlayerParam.leaderID = party.LeaderIndex; List <JSON_MyPhotonPlayerParam.UnitDataElem> unitDataElemList = new List <JSON_MyPhotonPlayerParam.UnitDataElem>(); for (int index = 0; index < unitDataArray.Length; ++index) { UnitData unitData = unitDataArray[index]; if (unitData != null) { unitDataElemList.Add(new JSON_MyPhotonPlayerParam.UnitDataElem() { slotID = num1++, place = !flag ? (partyType != PlayerPartyTypes.RankMatch ? player.GetVersusPlacement(PlayerPrefsUtility.VERSUS_ID_KEY + (object)index) : player.GetVersusPlacement(PlayerPrefsUtility.RANKMATCH_ID_KEY + (object)index)) : -1, sub = index < party.MAX_MAINMEMBER || party.MAX_SUBMEMBER <= 0 ? 0 : 1, unit = unitData }); num2 = num2 + (int)unitData.Status.param.atk + (int)unitData.Status.param.mag; num3 = num3 + (int)((double)(int)unitData.Status.param.hp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.HP) + (int)((double)(int)unitData.Status.param.atk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Attack) + (int)((double)(int)unitData.Status.param.def * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Defense) + (int)((double)(int)unitData.Status.param.mag * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagAttack) + (int)((double)(int)unitData.Status.param.mnd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.MagDefense) + (int)((double)(int)unitData.Status.param.dex * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Dex) + (int)((double)(int)unitData.Status.param.spd * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Speed) + (int)((double)(int)unitData.Status.param.cri * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Critical) + (int)((double)(int)unitData.Status.param.luk * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Luck) + (int)((double)unitData.GetCombination() * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Combo) + (int)((double)(int)unitData.Status.param.mov * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Move) + (int)((double)(int)unitData.Status.param.jmp * (double)MonoSingleton <GameManager> .Instance.MasterParam.mStatusCoefficient.Jump); } } photonPlayerParam.units = unitDataElemList.ToArray(); photonPlayerParam.totalAtk = num2; photonPlayerParam.totalStatus = Mathf.FloorToInt((float)(num3 / unitDataElemList.Count)); photonPlayerParam.rankpoint = player.VERSUS_POINT; photonPlayerParam.mtChallengeFloor = MonoSingleton <GameManager> .Instance.GetMTChallengeFloor(); photonPlayerParam.mtClearedFloor = MonoSingleton <GameManager> .Instance.GetMTClearedMaxFloor(); photonPlayerParam.rankmatch_score = MonoSingleton <GameManager> .Instance.Player.RankMatchScore; UnitData unitDataByUniqueId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUniqueID((long)GlobalVars.SelectedSupportUnitUniqueID); photonPlayerParam.support_unit = unitDataByUniqueId.Serialize(); photonPlayerParam.draft_id = VersusDraftList.DraftID; return(photonPlayerParam); }
public override void OnActivate(int pinID) { GameManager instance = MonoSingleton <GameManager> .Instance; MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance; instance.AudienceMode = false; this.mReqID = pinID; pt.IsMultiPlay = false; pt.IsMultiVersus = false; instance.IsVSCpuBattle = false; pt.IsRankMatch = false; if (pinID == 0 || pinID == 100 || (pinID == 200 || pinID == 250) || (pinID == 500 || pinID == 700 || pinID == 1000)) { pt.IsMultiPlay = pinID == 100 || pinID == 200 || pinID == 250 || pinID == 500; pt.IsMultiVersus = pinID == 200 || pinID == 250; instance.IsVSCpuBattle = pinID == 700; pt.IsRankMatch = pinID == 250; pinID = 0; } if (pinID == 10) { this.mResume = true; pinID = 0; } if (pinID == 0) { if (((Behaviour)this).get_enabled()) { return; } ((Behaviour)this).set_enabled(true); CriticalSection.Enter(CriticalSections.SceneChange); if (this.mResume) { long btlId = (long)GlobalVars.BtlID; GlobalVars.BtlID.Set(0L); this.ExecRequest((WebAPI) new ReqBtlComResume(btlId, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { this.mStartingQuest = instance.FindQuest(GlobalVars.SelectedQuestID); PlayerPartyTypes partyIndex1 = this.QuestToPartyIndex(this.mStartingQuest.type); if (!string.IsNullOrEmpty(this.QuestID)) { GlobalVars.SelectedQuestID = this.QuestID; GlobalVars.SelectedFriendID = string.Empty; } if (!this.PlayOffline && Network.Mode == Network.EConnectMode.Online) { if (this.mStartingQuest.type == QuestTypes.Arena) { this.ActivateOutputLinks(5); this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null)); } else if (this.mStartingQuest.type == QuestTypes.Ordeal) { this.ExecRequest((WebAPI) new ReqBtlOrdealReq(this.mStartingQuest.iname, GlobalVars.OrdealSupports, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { PartyData partyOfType = instance.Player.FindPartyOfType(partyIndex1); int partyIndex2 = instance.Player.Partys.IndexOf(partyOfType); bool multi = false; bool isHost = false; int seat = -1; int plid = -1; string uid = string.Empty; List <string> stringList = new List <string>(); VersusStatusData versusStatusData = (VersusStatusData)null; int num1 = 0; if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null)) { multi = pt.IsMultiPlay; isHost = pt.IsOldestPlayer(); seat = pt.MyPlayerIndex; MyPhoton.MyPlayer myPlayer = pt.GetMyPlayer(); if (myPlayer != null) { plid = myPlayer.playerID; } if (pt.IsMultiVersus) { List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted(); MyPhoton.MyRoom currentRoom = pt.GetCurrentRoom(); int num2 = currentRoom == null ? 1 : currentRoom.playerCount; JSON_MyPhotonPlayerParam photonPlayerParam = myPlayersStarted.Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerIndex != pt.MyPlayerIndex)); if (photonPlayerParam != null) { uid = photonPlayerParam.UID; } if (!GlobalVars.IsVersusDraftMode) { if (string.IsNullOrEmpty(uid) || num2 == 1) { this.OnVersusNoPlayer(); return; } PlayerPartyTypes playerPartyTypes = PlayerPartyTypes.Versus; if (pt.IsRankMatch) { playerPartyTypes = PlayerPartyTypes.RankMatch; } PartyData party = instance.Player.Partys[(int)playerPartyTypes]; if (party != null) { versusStatusData = new VersusStatusData(); for (int index = 0; index < party.MAX_UNIT; ++index) { long unitUniqueId = party.GetUnitUniqueID(index); if (party.GetUnitUniqueID(index) != 0L) { UnitData unitDataByUniqueId = instance.Player.FindUnitDataByUniqueID(unitUniqueId); if (unitDataByUniqueId != null) { versusStatusData.Add(unitDataByUniqueId.Status.param, unitDataByUniqueId.GetCombination()); ++num1; } } } } } else { versusStatusData = new VersusStatusData(); for (int index = 0; index < VersusDraftList.VersusDraftPartyUnits.Count; ++index) { UnitData versusDraftPartyUnit = VersusDraftList.VersusDraftPartyUnits[index]; if (versusDraftPartyUnit != null) { versusStatusData.Add(versusDraftPartyUnit.Status.param, versusDraftPartyUnit.GetCombination()); ++num1; } } } } else { List <JSON_MyPhotonPlayerParam> myPlayersStarted = pt.GetMyPlayersStarted(); for (int index = 0; index < myPlayersStarted.Count; ++index) { if (myPlayersStarted[index].playerIndex != pt.MyPlayerIndex) { stringList.Add(myPlayersStarted[index].UID); } } } } if (this.mReqID == 200) { if (GlobalVars.IsVersusDraftMode) { int enemy_draft_id = 0; MyPhoton.MyPlayer player = PunMonoSingleton <MyPhoton> .Instance.GetMyPlayer(); JSON_MyPhotonPlayerParam photonPlayerParam = pt.GetMyPlayersStarted().Find((Predicate <JSON_MyPhotonPlayerParam>)(p => p.playerID != player.playerID)); if (photonPlayerParam != null) { enemy_draft_id = photonPlayerParam.draft_id; } this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, VersusDraftList.DraftID, enemy_draft_id)); } else { this.ExecRequest((WebAPI) new ReqVersus(this.mStartingQuest.iname, plid, seat, uid, versusStatusData, num1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), GlobalVars.SelectedMultiPlayVersusType, 0, 0)); } } else if (this.mReqID == 250) { this.ExecRequest((WebAPI) new ReqRankMatch(this.mStartingQuest.iname, plid, seat, uid, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else if (this.mReqID == 500) { this.ExecRequest((WebAPI) new ReqBtlMultiTwReq(this.mStartingQuest.iname, partyIndex2, plid, seat, stringList.ToArray(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else if (this.mReqID == 700) { this.ExecRequest((WebAPI) new ReqVersusCpu(this.mStartingQuest.iname, GlobalVars.VersusCpu == null ? 1 : GlobalVars.VersusCpu.Get().Deck, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback))); } else { this.ExecRequest((WebAPI) new ReqBtlComReq(this.mStartingQuest.iname, GlobalVars.SelectedFriendID, GlobalVars.SelectedSupport.Get(), new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), multi, partyIndex2, isHost, plid, seat, GlobalVars.Location, GlobalVars.SelectedRankingQuestParam)); } } } else { this.StartCoroutine(this.StartScene((BattleCore.Json_Battle)null)); } } } else if (pinID == 20) { if (instance.AudienceRoom == null) { return; } this.StartCoroutine(this.StartAudience()); } else { if (pinID != 30) { return; } if (Network.IsError) { this.ActivateOutputLinks(300); Network.ResetError(); } else if (!Network.IsStreamConnecting) { Network.ResetError(); this.ActivateOutputLinks(300); } else { VersusAudienceManager audienceManager = instance.AudienceManager; audienceManager.AddStartQuest(); if (audienceManager.GetStartedParam() != null) { if (audienceManager.GetStartedParam().btlinfo != null) { BattleCore.Json_Battle json = new BattleCore.Json_Battle(); json.btlinfo = audienceManager.GetStartedParam().btlinfo; CriticalSection.Enter(CriticalSections.SceneChange); instance.AudienceMode = true; this.StartCoroutine(this.StartScene(json)); } else if (audienceManager.IsRetryError) { DebugUtility.LogError("Not Exist btlInfo"); Network.Abort(); this.ActivateOutputLinks(300); } else { this.ActivateOutputLinks(9); } } else if (audienceManager.IsRetryError) { DebugUtility.LogError("Not Exist StartParam"); Network.Abort(); this.ActivateOutputLinks(300); } else { this.ActivateOutputLinks(9); } } } }