コード例 #1
0
        private void SyncRoomPlayer()
        {
            bool     flag1    = false;
            bool     flag2    = false;
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;
            List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList();

            if (this.m_Players == null)
            {
                flag2 = true;
            }
            else if (roomPlayerList.Count != this.m_Players.Count)
            {
                flag2 = true;
            }
            else
            {
                for (int index1 = 0; index1 < roomPlayerList.Count; ++index1)
                {
                    if (!roomPlayerList[index1].json.Equals(this.m_Players[index1].json))
                    {
                        JSON_MyPhotonPlayerParam photonPlayerParam1 = JSON_MyPhotonPlayerParam.Parse(this.m_Players[index1].json);
                        JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json);
                        if (photonPlayerParam2 != null && photonPlayerParam1 != null && photonPlayerParam2.playerIndex != instance.MyPlayerIndex)
                        {
                            if (photonPlayerParam2.units.Length != photonPlayerParam1.units.Length)
                            {
                                flag2 = true;
                            }
                            else
                            {
                                for (int index2 = 0; index2 < photonPlayerParam2.units.Length; ++index2)
                                {
                                    UnitData unitData1 = new UnitData();
                                    UnitData unitData2 = new UnitData();
                                    unitData1.Deserialize(photonPlayerParam2.units[index2].unitJson);
                                    unitData2.Deserialize(photonPlayerParam1.units[index2].unitJson);
                                    if (unitData1.UnitParam.iname != unitData2.UnitParam.iname)
                                    {
                                        flag2 = true;
                                    }
                                    else if (photonPlayerParam2.units[index2].place != photonPlayerParam1.units[index2].place)
                                    {
                                        flag1 = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            this.m_Players = roomPlayerList;
            if (flag2)
            {
                this.CloseUnitStatus();
                this.m_SyncLoad = true;
                this.StartCoroutine(this.LoadUnit());
            }
            else if (flag1)
            {
                for (int index1 = 0; index1 < roomPlayerList.Count; ++index1)
                {
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    MultiPlayVersusReady.\u003CSyncRoomPlayer\u003Ec__AnonStorey34E playerCAnonStorey34E = new MultiPlayVersusReady.\u003CSyncRoomPlayer\u003Ec__AnonStorey34E();
                    // ISSUE: reference to a compiler-generated field
                    playerCAnonStorey34E.param = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json);
                    // ISSUE: reference to a compiler-generated field
                    if (playerCAnonStorey34E.param != null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        for (int index2 = 0; index2 < playerCAnonStorey34E.param.units.Length; ++index2)
                        {
                            // ISSUE: object of a compiler-generated type is created
                            // ISSUE: variable of a compiler-generated type
                            MultiPlayVersusReady.\u003CSyncRoomPlayer\u003Ec__AnonStorey34D playerCAnonStorey34D = new MultiPlayVersusReady.\u003CSyncRoomPlayer\u003Ec__AnonStorey34D();
                            // ISSUE: reference to a compiler-generated field
                            playerCAnonStorey34D.\u003C\u003Ef__ref\u0024846 = playerCAnonStorey34E;
                            // ISSUE: reference to a compiler-generated field
                            playerCAnonStorey34D.unitData = new UnitData();
                            // ISSUE: reference to a compiler-generated field
                            if (playerCAnonStorey34D.unitData != null)
                            {
                                // ISSUE: reference to a compiler-generated field
                                // ISSUE: reference to a compiler-generated field
                                playerCAnonStorey34D.unitData.Deserialize(playerCAnonStorey34E.param.units[index2].unitJson);
                                // ISSUE: reference to a compiler-generated method
                                TacticsUnitController controller = this.m_Units.Find(new Predicate <TacticsUnitController>(playerCAnonStorey34D.\u003C\u003Em__3AF));
                                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)controller, (UnityEngine.Object)null))
                                {
                                    // ISSUE: reference to a compiler-generated field
                                    OIntVector2 pos = this.CurrentMap.PartyUnitSettings[playerCAnonStorey34E.param.units[index2].place].pos;
                                    controller.Unit.x = (int)pos.x;
                                    controller.Unit.y = (int)pos.y;
                                    this.CalcPosition(controller);
                                }
                            }
                        }
                    }
                }
            }
            this.UpdateGridColor();
        }
コード例 #2
0
        private void SyncRoomPlayer()
        {
            bool     flag1    = false;
            bool     flag2    = false;
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;
            List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList();

            if (this.m_Players == null)
            {
                flag2 = true;
            }
            else if (roomPlayerList.Count != this.m_Players.Count)
            {
                flag2 = true;
            }
            else
            {
                for (int index1 = 0; index1 < roomPlayerList.Count; ++index1)
                {
                    if (!roomPlayerList[index1].json.Equals(this.m_Players[index1].json))
                    {
                        JSON_MyPhotonPlayerParam photonPlayerParam1 = JSON_MyPhotonPlayerParam.Parse(this.m_Players[index1].json);
                        JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json);
                        if (photonPlayerParam2 != null && photonPlayerParam1 != null && photonPlayerParam2.playerIndex != instance.MyPlayerIndex)
                        {
                            if (photonPlayerParam1.playerID != photonPlayerParam2.playerID)
                            {
                                flag2 = true;
                                break;
                            }
                            if (photonPlayerParam2.units.Length != photonPlayerParam1.units.Length)
                            {
                                flag2 = true;
                                break;
                            }
                            for (int index2 = 0; index2 < photonPlayerParam2.units.Length; ++index2)
                            {
                                UnitData unitData1 = new UnitData();
                                UnitData unitData2 = new UnitData();
                                unitData1.Deserialize(photonPlayerParam2.units[index2].unitJson);
                                unitData2.Deserialize(photonPlayerParam1.units[index2].unitJson);
                                if (unitData1.UnitParam.iname != unitData2.UnitParam.iname)
                                {
                                    flag2 = true;
                                    break;
                                }
                                if (photonPlayerParam2.units[index2].place != photonPlayerParam1.units[index2].place)
                                {
                                    flag1 = true;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            this.m_Players = roomPlayerList;
            if (flag2)
            {
                this.CloseUnitStatus();
                this.m_SyncLoad = true;
                this.StartCoroutine(this.LoadUnit());
            }
            else if (flag1)
            {
                for (int index1 = 0; index1 < roomPlayerList.Count; ++index1)
                {
                    JSON_MyPhotonPlayerParam param = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index1].json);
                    if (param != null)
                    {
                        for (int index2 = 0; index2 < param.units.Length; ++index2)
                        {
                            UnitData unitData = new UnitData();
                            if (unitData != null)
                            {
                                unitData.Deserialize(param.units[index2].unitJson);
                                TacticsUnitController controller = this.m_Units.Find((Predicate <TacticsUnitController>)(data =>
                                {
                                    if (data.Unit.UnitParam.iname == unitData.UnitParam.iname)
                                    {
                                        return(data.Unit.OwnerPlayerIndex == param.playerIndex);
                                    }
                                    return(false);
                                }));
                                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)controller, (UnityEngine.Object)null))
                                {
                                    OIntVector2 pos = this.CurrentMap.PartyUnitSettings[param.units[index2].place].pos;
                                    controller.Unit.x = (int)pos.x;
                                    controller.Unit.y = (int)pos.y;
                                    this.CalcPosition(controller);
                                }
                            }
                        }
                    }
                }
            }
            this.UpdateGridColor();
        }