Esempio n. 1
0
        public void Refresh()
        {
            JSON_MyPhotonPlayerParam dataOfClass = DataSource.FindDataOfClass <JSON_MyPhotonPlayerParam>(((Component)this).get_gameObject(), (JSON_MyPhotonPlayerParam)null);

            if (dataOfClass != null)
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(false);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.LeaderUnit, (Object)null) && dataOfClass.units != null)
                {
                    dataOfClass.SetupUnits();
                    DataSource.Bind <UnitData>(this.LeaderUnit, dataOfClass.units[0].unit);
                }
                if (Object.op_Inequality((Object)this.Name, (Object)null))
                {
                    this.Name.set_text(dataOfClass.playerName);
                }
                if (Object.op_Inequality((Object)this.Lv, (Object)null))
                {
                    this.Lv.set_text(dataOfClass.playerLevel.ToString());
                }
                if (Object.op_Inequality((Object)this.Total, (Object)null))
                {
                    this.Total.set_text(dataOfClass.totalAtk.ToString());
                }
                if (Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    this.ReadyObj.SetActive(dataOfClass.state != 4);
                }
                if (Object.op_Inequality((Object)this.Award, (Object)null))
                {
                    this.Award.get_gameObject().SetActive(false);
                    this.Award.get_gameObject().SetActive(true);
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
            else
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(false);
                }
                if (!Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    return;
                }
                this.ReadyObj.SetActive(false);
            }
        }
        public static JSON_MyPhotonPlayerParam Parse(string json)
        {
            if (string.IsNullOrEmpty(json))
            {
                return(new JSON_MyPhotonPlayerParam());
            }
            JSON_MyPhotonPlayerParam jsonObject = JSONParser.parseJSONObject <JSON_MyPhotonPlayerParam>(json);

            jsonObject.SetupUnits();
            return(jsonObject);
        }
            public override void Update(FlowNode_StartMultiPlay self)
            {
                DebugUtility.Log("StartMultiPlay State_ResumeStart Update");
                MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

                if (instance.CurrentState != MyPhoton.MyState.ROOM)
                {
                    self.Failure();
                }
                else
                {
                    MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom();
                    if (currentRoom == null)
                    {
                        self.Failure();
                    }
                    else
                    {
                        JSON_MyPhotonPlayerParam photonPlayerParam1 = JSON_MyPhotonPlayerParam.Parse(instance.GetMyPlayer().json);
                        if (photonPlayerParam1.state != 2)
                        {
                            photonPlayerParam1.state = 2;
                            instance.SetMyPlayerParam(photonPlayerParam1.Serialize());
                        }
                        JSON_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null;
                        if (myPhotonRoomParam == null)
                        {
                            self.Failure();
                        }
                        else
                        {
                            GlobalVars.SelectedQuestID  = myPhotonRoomParam.iname;
                            GlobalVars.SelectedFriendID = (string)null;
                            GlobalVars.SelectedFriend   = (FriendData)null;
                            GlobalVars.SelectedSupport.Set((SupportData)null);
                            self.Success();
                            DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize());
                            List <MyPhoton.MyPlayer>        roomPlayerList        = instance.GetRoomPlayerList();
                            List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>();
                            for (int index = 0; index < roomPlayerList.Count; ++index)
                            {
                                JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json);
                                photonPlayerParam2.playerID = roomPlayerList[index].playerID;
                                photonPlayerParamList.Add(photonPlayerParam2);
                            }
                            photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex));
                            List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted();
                            myPlayersStarted.Clear();
                            string roomParam = instance.GetRoomParam("started");
                            if (roomParam != null)
                            {
                                foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(roomParam).players)
                                {
                                    player.SetupUnits();
                                    myPlayersStarted.Add(player);
                                }
                            }
                            else
                            {
                                using (List <JSON_MyPhotonPlayerParam> .Enumerator enumerator = photonPlayerParamList.GetEnumerator())
                                {
                                    while (enumerator.MoveNext())
                                    {
                                        JSON_MyPhotonPlayerParam current = enumerator.Current;
                                        current.SetupUnits();
                                        myPlayersStarted.Add(current);
                                    }
                                }
                            }
                            photonPlayerParam1.state = 3;
                            instance.SetMyPlayerParam(photonPlayerParam1.Serialize());
                            instance.SetResumeMyPlayer(GlobalVars.ResumeMultiplayPlayerID);
                            instance.MyPlayerIndex = GlobalVars.ResumeMultiplaySeatID;
                        }
                    }
                }
            }
Esempio n. 4
0
        public void Refresh()
        {
            JSON_MyPhotonRoomParam   myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.SearchRoom(JSON_MyPhotonRoomParam.Parse(MonoSingleton <GameManager> .Instance.AudienceRoom.json).roomid).json);
            JSON_MyPhotonPlayerParam dataOfClass       = DataSource.FindDataOfClass <JSON_MyPhotonPlayerParam>(((Component)this).get_gameObject(), (JSON_MyPhotonPlayerParam)null);

            if (dataOfClass != null)
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(false);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.LeaderUnit, (Object)null))
                {
                    if (myPhotonRoomParam.draft_type == 1 && !string.IsNullOrEmpty(dataOfClass.support_unit))
                    {
                        Json_Unit jsonObject = JSONParser.parseJSONObject <Json_Unit>(dataOfClass.support_unit);
                        if (jsonObject != null)
                        {
                            UnitData data = new UnitData();
                            data.Deserialize(jsonObject);
                            DataSource.Bind <UnitData>(this.LeaderUnit.get_gameObject(), data);
                        }
                    }
                    else if (dataOfClass.units != null)
                    {
                        dataOfClass.SetupUnits();
                        DataSource.Bind <UnitData>(this.LeaderUnit, dataOfClass.units[0].unit);
                    }
                }
                if (Object.op_Inequality((Object)this.Name, (Object)null))
                {
                    this.Name.set_text(dataOfClass.playerName);
                }
                if (Object.op_Inequality((Object)this.Lv, (Object)null))
                {
                    this.Lv.set_text(dataOfClass.playerLevel.ToString());
                }
                if (Object.op_Inequality((Object)this.Total, (Object)null))
                {
                    this.Total.set_text(dataOfClass.totalAtk.ToString());
                }
                if (Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    this.ReadyObj.SetActive(dataOfClass.state != 4);
                }
                if (Object.op_Inequality((Object)this.Award, (Object)null))
                {
                    this.Award.get_gameObject().SetActive(false);
                    this.Award.get_gameObject().SetActive(true);
                }
                GameParameter.UpdateAll(((Component)this).get_gameObject());
            }
            else
            {
                if (Object.op_Inequality((Object)this.EmptyObj, (Object)null))
                {
                    this.EmptyObj.SetActive(true);
                }
                if (Object.op_Inequality((Object)this.ValidObj, (Object)null))
                {
                    this.ValidObj.SetActive(false);
                }
                if (!Object.op_Inequality((Object)this.ReadyObj, (Object)null))
                {
                    return;
                }
                this.ReadyObj.SetActive(false);
            }
        }