public override void OnActivate(int pinID)
        {
            if (pinID != 0)
            {
                return;
            }
            GameManager instance1 = MonoSingleton <GameManager> .Instance;
            MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

            if (Object.op_Equality((Object)instance2, (Object)null))
            {
                this.ActivateOutputLinks(2);
            }
            else
            {
                MyPhoton.MyRoom myRoom = !instance1.AudienceMode ? instance2.GetCurrentRoom() : instance1.AudienceRoom;
                if (myRoom == null)
                {
                    this.ActivateOutputLinks(2);
                }
                else
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = myRoom != null?JSON_MyPhotonRoomParam.Parse(myRoom.json) : (JSON_MyPhotonRoomParam)null;

                    if (myPhotonRoomParam == null || myPhotonRoomParam.draft_type == 0)
                    {
                        this.ActivateOutputLinks(2);
                    }
                    else
                    {
                        this.ActivateOutputLinks(1);
                    }
                }
            }
        }
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 100:
                MyPhoton instance1 = PunMonoSingleton <MyPhoton> .Instance;
                if (Object.op_Inequality((Object)instance1, (Object)null) && instance1.IsOldestPlayer())
                {
                    MyPhoton.MyRoom currentRoom = instance1.GetCurrentRoom();
                    if (currentRoom != null)
                    {
                        JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
                        myPhotonRoomParam.iname = GlobalVars.SelectedQuestID;
                        instance1.SetRoomParam(myPhotonRoomParam.Serialize());
                    }
                }
                this.ActivateOutputLinks(200);
                break;

            case 101:
                MyPhoton instance2 = PunMonoSingleton <MyPhoton> .Instance;
                if (Object.op_Inequality((Object)instance2, (Object)null))
                {
                    MyPhoton.MyRoom currentRoom = instance2.GetCurrentRoom();
                    if (currentRoom != null)
                    {
                        GlobalVars.SelectedQuestID = JSON_MyPhotonRoomParam.Parse(currentRoom.json).iname;
                        break;
                    }
                    break;
                }
                break;
            }
            this.ActivateOutputLinks(200);
        }
Ejemplo n.º 3
0
        public override void OnActivate(int pinID)
        {
            if (!GameUtility.Config_UseAssetBundles.Value)
            {
                this.ActivateOutputLinks(100);
            }
            else
            {
                switch (pinID)
                {
                case 0:
                    // ISSUE: object of a compiler-generated type is created
                    // ISSUE: variable of a compiler-generated type
                    FlowNode_VersusUnitDownload.\u003COnActivate\u003Ec__AnonStorey2D7 activateCAnonStorey2D7 = new FlowNode_VersusUnitDownload.\u003COnActivate\u003Ec__AnonStorey2D7();
                    // ISSUE: reference to a compiler-generated field
                    activateCAnonStorey2D7.pt = PunMonoSingleton <MyPhoton> .Instance;
                    // ISSUE: reference to a compiler-generated field
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)activateCAnonStorey2D7.pt, (UnityEngine.Object)null))
                    {
                        // ISSUE: reference to a compiler-generated field
                        List <MyPhoton.MyPlayer> roomPlayerList = activateCAnonStorey2D7.pt.GetRoomPlayerList();
                        if (roomPlayerList != null && roomPlayerList.Count > 1)
                        {
                            // ISSUE: reference to a compiler-generated method
                            MyPhoton.MyPlayer myPlayer = roomPlayerList.Find(new Predicate <MyPhoton.MyPlayer>(activateCAnonStorey2D7.\u003C\u003Em__2CC));
                            if (myPlayer != null)
                            {
                                this.AddAssets(JSON_MyPhotonPlayerParam.Parse(myPlayer.json));
                                break;
                            }
                            break;
                        }
                        break;
                    }
                    break;

                case 1:
                    GameManager instance = MonoSingleton <GameManager> .Instance;
                    if (instance.AudienceRoom != null)
                    {
                        JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(instance.AudienceRoom.json);
                        if (myPhotonRoomParam != null)
                        {
                            for (int index = 0; index < myPhotonRoomParam.players.Length; ++index)
                            {
                                if (myPhotonRoomParam.players[index] != null)
                                {
                                    myPhotonRoomParam.players[index].SetupUnits();
                                    this.AddAssets(myPhotonRoomParam.players[index]);
                                }
                            }
                            break;
                        }
                        break;
                    }
                    break;
                }
                this.StartCoroutine(this.AsyncDownload());
            }
        }
 public override void Begin(FlowNode_MultiPlayJoinRoom self)
 {
   MyPhoton instance = PunMonoSingleton<MyPhoton>.Instance;
   self.mJoinPlayerParam = JSON_MyPhotonPlayerParam.Create(0, 0);
   if (self.mJoinPlayerParam == null)
   {
     self.FailureLobby();
   }
   else
   {
     JSON_MyPhotonRoomParam myPhotonRoomParam = new JSON_MyPhotonRoomParam();
     myPhotonRoomParam.creatorName = MonoSingleton<GameManager>.Instance.Player.Name;
     myPhotonRoomParam.creatorLV = MonoSingleton<GameManager>.Instance.Player.CalcLevel();
     myPhotonRoomParam.creatorFUID = JSON_MyPhotonRoomParam.GetMyCreatorFUID();
     myPhotonRoomParam.roomid = GlobalVars.SelectedMultiPlayRoomID;
     myPhotonRoomParam.comment = GlobalVars.SelectedMultiPlayRoomComment;
     myPhotonRoomParam.passCode = GlobalVars.EditMultiPlayRoomPassCode;
     myPhotonRoomParam.iname = GlobalVars.SelectedQuestID;
     myPhotonRoomParam.type = (int) GlobalVars.SelectedMultiPlayRoomType;
     myPhotonRoomParam.isLINE = !self.IsLINE ? 0 : 1;
     QuestParam quest = MonoSingleton<GameManager>.Instance.FindQuest(GlobalVars.SelectedQuestID);
     MultiTowerFloorParam mtFloorParam = MonoSingleton<GameManager>.Instance.GetMTFloorParam(quest.iname);
     int selectedMultiTowerFloor = GlobalVars.SelectedMultiTowerFloor;
     if (instance.CreateRoom((int) quest.playerNum, GlobalVars.SelectedMultiPlayRoomName, myPhotonRoomParam.Serialize(), self.mJoinPlayerParam.Serialize(), mtFloorParam.tower_id, selectedMultiTowerFloor, -1, (string) null, (string) null, -1, true))
       return;
     self.FailureLobby();
   }
 }
Ejemplo n.º 5
0
            public override void Begin(FlowNode_MultiPlayJoinRoom self)
            {
                GameManager instance1 = MonoSingleton <GameManager> .Instance;
                MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

                self.mJoinPlayerParam = JSON_MyPhotonPlayerParam.Create(0, 0);
                if (self.mJoinPlayerParam == null)
                {
                    self.FailureLobby();
                }
                else
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = new JSON_MyPhotonRoomParam();
                    myPhotonRoomParam.creatorName = MonoSingleton <GameManager> .Instance.Player.Name;
                    myPhotonRoomParam.creatorLV   = MonoSingleton <GameManager> .Instance.Player.CalcLevel();

                    myPhotonRoomParam.creatorFUID = JSON_MyPhotonRoomParam.GetMyCreatorFUID();
                    myPhotonRoomParam.roomid      = GlobalVars.SelectedMultiPlayRoomID;
                    myPhotonRoomParam.comment     = GlobalVars.SelectedMultiPlayRoomComment;
                    myPhotonRoomParam.passCode    = GlobalVars.EditMultiPlayRoomPassCode;
                    myPhotonRoomParam.iname       = GlobalVars.SelectedQuestID;
                    myPhotonRoomParam.type        = (int)GlobalVars.SelectedMultiPlayRoomType;
                    myPhotonRoomParam.isLINE      = !self.IsLINE ? 0 : 1;
                    myPhotonRoomParam.vsmode      = instance1.GetVSMode(-1L) != VS_MODE.THREE_ON_THREE ? 1 : 0;
                    int    creatorLv      = myPhotonRoomParam.creatorLV;
                    string deviceId       = MonoSingleton <GameManager> .Instance.DeviceId;
                    int    rankMatchScore = MonoSingleton <GameManager> .Instance.Player.RankMatchScore;
                    int    rankMatchClass = (int)MonoSingleton <GameManager> .Instance.Player.RankMatchClass;
                    if (instance2.CreateRoom(GlobalVars.SelectedMultiPlayRoomName, myPhotonRoomParam.Serialize(), self.mJoinPlayerParam.Serialize(), creatorLv, deviceId, rankMatchScore, rankMatchClass))
                    {
                        return;
                    }
                    self.FailureLobby();
                }
            }
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 0:
                string format1  = LocalizedText.Get("sys.MP_LINE_TEXT");
                string msg1     = string.Empty + "iname=" + GlobalVars.SelectedQuestID + "&type=" + (object)GlobalVars.SelectedMultiPlayRoomType + "&creatorFUID=" + JSON_MyPhotonRoomParam.GetMyCreatorFUID() + "&roomid=" + (object)GlobalVars.SelectedMultiPlayRoomID;
                byte[] inArray1 = MyEncrypt.Encrypt(JSON_MyPhotonRoomParam.LINE_PARAM_ENCODE_KEY, msg1, false);
                string str1     = string.Format(format1, (object)WWW.EscapeURL(Convert.ToBase64String(inArray1)));
                DebugUtility.Log("LINE:" + str1);
                Application.OpenURL(LocalizedText.Get("sys.MP_LINE_HTTP") + WWW.EscapeURL(str1, Encoding.UTF8));
                this.ActivateOutputLinks(1);
                break;

            case 100:
                if (JSON_MyPhotonRoomParam.GetMyCreatorFUID().Equals(FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID))
                {
                    this.ActivateOutputLinks(101);
                    break;
                }
                this.ActivateOutputLinks(102);
                break;

            case 200:
                string format2  = LocalizedText.Get("sys.MP_LINE_VERSUS_TEXT");
                string msg2     = string.Empty + "iname=" + GlobalVars.SelectedQuestID + "&type=" + (object)GlobalVars.SelectedMultiPlayRoomType + "&creatorFUID=" + JSON_MyPhotonRoomParam.GetMyCreatorFUID() + "&roomid=" + (object)GlobalVars.SelectedMultiPlayRoomID;
                byte[] inArray2 = MyEncrypt.Encrypt(JSON_MyPhotonRoomParam.LINE_PARAM_ENCODE_KEY, msg2, false);
                string str2     = string.Format(format2, (object)WWW.EscapeURL(Convert.ToBase64String(inArray2)));
                DebugUtility.Log("LINE:" + str2);
                Application.OpenURL(LocalizedText.Get("sys.MP_LINE_HTTP") + WWW.EscapeURL(str2, Encoding.UTF8));
                GlobalVars.VersusRoomReuse = true;
                this.ActivateOutputLinks(1);
                break;
            }
        }
Ejemplo n.º 7
0
        private void Search()
        {
            GameManager instance1 = MonoSingleton <GameManager> .Instance;
            int         selectedMultiPlayRoomId = GlobalVars.SelectedMultiPlayRoomID;
            MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

            instance1.AudienceRoom = instance2.SearchRoom(selectedMultiPlayRoomId);
            if (instance1.AudienceRoom != null)
            {
                JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(instance1.AudienceRoom.json);
                if (myPhotonRoomParam != null && myPhotonRoomParam.audience == 0)
                {
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "AudienceDisable");
                }
                else if (instance1.AudienceRoom.battle)
                {
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "AlreadyStartFriendMode");
                }
                else
                {
                    FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "FindRoom");
                }
            }
            else
            {
                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "NotFindRoom");
            }
        }
Ejemplo n.º 8
0
        public void RefreshFloorQuest()
        {
            JSON_MyPhotonRoomParam data  = JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom().json);
            QuestParam             quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

            DataSource.Bind <JSON_MyPhotonRoomParam>(this.Root, data);
            DataSource.Bind <QuestParam>(this.Root, quest);
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 3);
        }
        private void Update()
        {
            this.mUpdateTime -= Time.get_deltaTime();
            if ((double)this.mUpdateTime > 0.0)
            {
                return;
            }
            GameManager instance1 = MonoSingleton <GameManager> .Instance;
            MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

            if (!Object.op_Inequality((Object)instance2, (Object)null) || instance1.AudienceRoom == null || instance1.AudienceRoom.battle)
            {
                return;
            }
            if (!instance2.IsConnected() && !instance1.AudienceRoom.battle)
            {
                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "FORCE_LEAVE");
                instance1.AudienceRoom = (MyPhoton.MyRoom)null;
            }
            else
            {
                if (!instance2.IsRoomListUpdated)
                {
                    return;
                }
                JSON_MyPhotonRoomParam myPhotonRoomParam1 = JSON_MyPhotonRoomParam.Parse(instance1.AudienceRoom.json);
                if (myPhotonRoomParam1 != null)
                {
                    MyPhoton.MyRoom room = instance2.SearchRoom(myPhotonRoomParam1.roomid);
                    if (room != null)
                    {
                        if (!room.json.Equals(instance1.AudienceRoom.json))
                        {
                            this.Refresh(room);
                            JSON_MyPhotonRoomParam myPhotonRoomParam2 = JSON_MyPhotonRoomParam.Parse(room.json);
                            if (myPhotonRoomParam2 != null && myPhotonRoomParam2.audience == 0)
                            {
                                FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "AUDIENCE_DISABLE");
                                instance1.AudienceRoom = (MyPhoton.MyRoom)null;
                                return;
                            }
                        }
                        instance1.AudienceRoom = room;
                        if (room.battle)
                        {
                            FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "START_AUDIENCE");
                        }
                    }
                    else
                    {
                        FlowNode_TriggerLocalEvent.TriggerLocalEvent((Component)this, "DISBANDED");
                    }
                }
                instance2.IsRoomListUpdated = false;
                this.mUpdateTime            = this.UPDATE_INTERVAL;
            }
        }
Ejemplo n.º 10
0
        public override void OnActivate(int pinID)
        {
            if (!GameUtility.Config_UseAssetBundles.Value)
            {
                this.ActivateOutputLinks(100);
            }
            else
            {
                switch (pinID)
                {
                case 0:
                    MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance;
                    if (UnityEngine.Object.op_Inequality((UnityEngine.Object)pt, (UnityEngine.Object)null))
                    {
                        List <MyPhoton.MyPlayer> roomPlayerList = pt.GetRoomPlayerList();
                        if (roomPlayerList != null && roomPlayerList.Count > 1)
                        {
                            MyPhoton.MyPlayer myPlayer = roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID != pt.GetMyPlayer().playerID));
                            if (myPlayer != null)
                            {
                                this.AddAssets(JSON_MyPhotonPlayerParam.Parse(myPlayer.json));
                                break;
                            }
                            break;
                        }
                        break;
                    }
                    break;

                case 1:
                    GameManager instance = MonoSingleton <GameManager> .Instance;
                    if (instance.AudienceRoom != null)
                    {
                        JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(instance.AudienceRoom.json);
                        if (myPhotonRoomParam != null)
                        {
                            for (int index = 0; index < myPhotonRoomParam.players.Length; ++index)
                            {
                                if (myPhotonRoomParam.players[index] != null)
                                {
                                    myPhotonRoomParam.players[index].SetupUnits();
                                    this.AddAssets(myPhotonRoomParam.players[index]);
                                }
                            }
                            break;
                        }
                        break;
                    }
                    break;
                }
                this.StartCoroutine(this.AsyncDownload());
            }
        }
Ejemplo n.º 11
0
 public override void OnActivate(int pinID)
 {
     if (pinID == 100)
     {
         GameManager instance          = MonoSingleton <GameManager> .Instance;
         JSON_MyPhotonPlayerParam data = (JSON_MyPhotonPlayerParam)null;
         if (instance.AudienceMode)
         {
             MyPhoton.MyRoom audienceRoom = instance.AudienceRoom;
             if (audienceRoom != null)
             {
                 JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(audienceRoom.json);
                 if (myPhotonRoomParam != null && myPhotonRoomParam.players != null && myPhotonRoomParam.players.Length >= this.ROOM_MAX_PLAYERCNT)
                 {
                     data = myPhotonRoomParam.players[!this.MyPlayer ? 1 : 0];
                 }
             }
         }
         else
         {
             // ISSUE: object of a compiler-generated type is created
             // ISSUE: variable of a compiler-generated type
             FlowNode_VersusAward.\u003COnActivate\u003Ec__AnonStorey2D6 activateCAnonStorey2D6 = new FlowNode_VersusAward.\u003COnActivate\u003Ec__AnonStorey2D6();
             // ISSUE: reference to a compiler-generated field
             activateCAnonStorey2D6.pt = PunMonoSingleton <MyPhoton> .Instance;
             // ISSUE: reference to a compiler-generated field
             List <MyPhoton.MyPlayer> roomPlayerList = activateCAnonStorey2D6.pt.GetRoomPlayerList();
             if (roomPlayerList != null)
             {
                 if (this.MyPlayer)
                 {
                     data = JSON_MyPhotonPlayerParam.Create(0, 0);
                 }
                 else
                 {
                     // ISSUE: reference to a compiler-generated method
                     MyPhoton.MyPlayer myPlayer = roomPlayerList.Find(new Predicate <MyPhoton.MyPlayer>(activateCAnonStorey2D6.\u003C\u003Em__2CB));
                     if (myPlayer != null)
                     {
                         data = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                     }
                 }
             }
         }
         if (data != null)
         {
             DataSource.Bind <JSON_MyPhotonPlayerParam>(this.BindObj, data);
         }
     }
     this.ActivateOutputLinks(200);
 }
        public override void OnActivate(int pinID)
        {
            if (pinID != 101)
            {
                return;
            }
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            if (!instance.IsOldestPlayer())
            {
                DebugUtility.Log("I'm not room owner");
                this.ActivateOutputLinks(2);
            }
            else
            {
                MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom();
                if (currentRoom == null)
                {
                    DebugUtility.Log("CurrentRoom is null");
                    this.ActivateOutputLinks(2);
                }
                else
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
                    if (myPhotonRoomParam == null)
                    {
                        DebugUtility.Log("no roomParam");
                        this.ActivateOutputLinks(2);
                    }
                    else
                    {
                        myPhotonRoomParam.comment = GlobalVars.EditMultiPlayRoomComment;
                        if (!MyMsgInput.isLegal(myPhotonRoomParam.comment))
                        {
                            DebugUtility.Log("comment is not legal");
                            this.ActivateOutputLinks(2);
                        }
                        else
                        {
                            DebugUtility.Log("comment:" + myPhotonRoomParam.comment);
                            instance.SetRoomParam(myPhotonRoomParam.Serialize());
                            PlayerPrefs.SetString(PlayerData.ROOM_COMMENT_KEY, myPhotonRoomParam.comment);
                            this.ActivateOutputLinks(1);
                        }
                    }
                }
            }
        }
Ejemplo n.º 13
0
 public void Reset()
 {
     if (this.mTurnLog == null)
     {
         this.mTurnLog = new Dictionary <int, List <SceneBattle.MultiPlayRecvData> >();
     }
     this.mTurnLog.Clear();
     this.mStartedParam           = (AudienceStartParam)null;
     this.mRoomParam              = (JSON_MyPhotonRoomParam)null;
     this.mNonAnalyzeLog          = (string)null;
     this.mReadCnt                = 0;
     this.mRetryStartQuestCnt     = 0;
     this.mDownloadLogger         = (DownloadLogger)null;
     this.mDownloadLogger         = new DownloadLogger();
     this.mDownloadLogger.Manager = this;
     this.mState = VersusAudienceManager.CONNECT_STATE.REQ;
 }
Ejemplo n.º 14
0
        private void FailureStartMulti()
        {
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            if (Object.op_Inequality((Object)instance, (Object)null) && instance.IsOldestPlayer())
            {
                MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom();
                if (currentRoom != null)
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null;
                    myPhotonRoomParam.started = 0;
                    instance.SetRoomParam(myPhotonRoomParam.Serialize());
                }
                instance.OpenRoom();
            }
            this.Failure();
        }
Ejemplo n.º 15
0
 public override void OnActivate(int pinID)
 {
     if (pinID == 100)
     {
         GameManager instance          = MonoSingleton <GameManager> .Instance;
         JSON_MyPhotonPlayerParam data = (JSON_MyPhotonPlayerParam)null;
         if (instance.AudienceMode)
         {
             MyPhoton.MyRoom audienceRoom = instance.AudienceRoom;
             if (audienceRoom != null)
             {
                 JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(audienceRoom.json);
                 if (myPhotonRoomParam != null && myPhotonRoomParam.players != null && myPhotonRoomParam.players.Length >= this.ROOM_MAX_PLAYERCNT)
                 {
                     data = myPhotonRoomParam.players[!this.MyPlayer ? 1 : 0];
                 }
             }
         }
         else
         {
             MyPhoton pt = PunMonoSingleton <MyPhoton> .Instance;
             List <MyPhoton.MyPlayer> roomPlayerList = pt.GetRoomPlayerList();
             if (roomPlayerList != null)
             {
                 if (this.MyPlayer)
                 {
                     data = JSON_MyPhotonPlayerParam.Create(0, 0);
                 }
                 else
                 {
                     MyPhoton.MyPlayer myPlayer = roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID != pt.GetMyPlayer().playerID));
                     if (myPlayer != null)
                     {
                         data = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                     }
                 }
             }
         }
         if (data != null)
         {
             DataSource.Bind <JSON_MyPhotonPlayerParam>(this.BindObj, data);
         }
     }
     this.ActivateOutputLinks(200);
 }
Ejemplo n.º 16
0
            public override void Begin(FlowNode_MultiPlayJoinRoom self)
            {
                GameManager instance1 = MonoSingleton <GameManager> .Instance;
                MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

                self.mJoinPlayerParam = JSON_MyPhotonPlayerParam.Create(0, 0);
                if (self.mJoinPlayerParam == null)
                {
                    self.FailureLobby();
                }
                else
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = new JSON_MyPhotonRoomParam();
                    myPhotonRoomParam.creatorName = MonoSingleton <GameManager> .Instance.Player.Name;
                    myPhotonRoomParam.creatorLV   = MonoSingleton <GameManager> .Instance.Player.CalcLevel();

                    myPhotonRoomParam.creatorFUID = JSON_MyPhotonRoomParam.GetMyCreatorFUID();
                    myPhotonRoomParam.roomid      = GlobalVars.SelectedMultiPlayRoomID;
                    myPhotonRoomParam.comment     = GlobalVars.SelectedMultiPlayRoomComment;
                    myPhotonRoomParam.passCode    = GlobalVars.EditMultiPlayRoomPassCode;
                    myPhotonRoomParam.iname       = GlobalVars.SelectedQuestID;
                    myPhotonRoomParam.type        = (int)GlobalVars.SelectedMultiPlayRoomType;
                    myPhotonRoomParam.isLINE      = !self.IsLINE ? 0 : 1;
                    myPhotonRoomParam.vsmode      = instance1.GetVSMode(-1L) != VS_MODE.THREE_ON_THREE ? 1 : 0;
                    myPhotonRoomParam.draft_type  = !GlobalVars.IsVersusDraftMode ? 0 : 1;
                    int    plv         = -1;
                    int    floor       = -1;
                    int    audienceMax = (int)MonoSingleton <GameManager> .Instance.MasterParam.FixParam.AudienceMax;
                    string uid         = (string)null;
                    string luid        = (string)null;
                    if (GlobalVars.SelectedMultiPlayVersusType == VERSUS_TYPE.Tower)
                    {
                        plv   = myPhotonRoomParam.creatorLV;
                        floor = MonoSingleton <GameManager> .Instance.Player.VersusTowerFloor;
                        uid   = MonoSingleton <GameManager> .Instance.DeviceId;
                        luid  = MonoSingleton <GameManager> .Instance.VersusLastUid;
                    }
                    if (instance2.CreateRoom((int)self.VERSUS_PLAYER_MAX, GlobalVars.SelectedMultiPlayRoomName, myPhotonRoomParam.Serialize(), self.mJoinPlayerParam.Serialize(), GlobalVars.MultiPlayVersusKey, floor, plv, luid, uid, audienceMax, false))
                    {
                        return;
                    }
                    self.FailureLobby();
                }
            }
Ejemplo n.º 17
0
        private void Awake()
        {
            ((Behaviour)this).set_enabled(true);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null) && this.ItemTemplate.get_activeInHierarchy())
            {
                this.ItemTemplate.SetActive(false);
            }
            JSON_MyPhotonRoomParam data  = JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom().json);
            QuestParam             quest = MonoSingleton <GameManager> .Instance.FindQuest(data.iname);

            DataSource.Bind <JSON_MyPhotonRoomParam>(this.Root, data);
            DataSource.Bind <QuestParam>(this.Root, quest);
            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.RankButton, (UnityEngine.Object)null))
            {
                this.RankButton.get_gameObject().SetActive(quest.IsJigen);
            }
            GameParameter.UpdateAll(this.Root);
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1);
        }
Ejemplo n.º 18
0
 public void Activated(int pinID)
 {
     if (pinID == 0)
     {
         this.Refresh();
     }
     if (pinID == 2)
     {
         this.RefreshFloorQuest();
     }
     else
     {
         if (pinID != 10)
         {
             return;
         }
         DataSource.Bind <JSON_MyPhotonRoomParam>(this.Root, JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom().json));
     }
 }
Ejemplo n.º 19
0
            public override void Begin(FlowNode_MultiPlayJoinRoom self)
            {
                MyPhoton   instance = PunMonoSingleton <MyPhoton> .Instance;
                QuestParam quest    = MonoSingleton <GameManager> .Instance.FindQuest(GlobalVars.SelectedQuestID);

                if (quest == null || !quest.IsMulti || ((int)quest.playerNum < 1 || (int)quest.unitNum < 1) || ((int)quest.unitNum > 11 || quest.map == null || quest.map.Count <= 0))
                {
                    DebugUtility.Log("illegal iname:" + GlobalVars.SelectedQuestID);
                    self.IllegalQuest();
                }
                else
                {
                    DebugUtility.Log("CreateRoom quest:" + quest.iname + " desc:" + quest.name);
                    self.mJoinPlayerParam = JSON_MyPhotonPlayerParam.Create(0, 0);
                    if (self.mJoinPlayerParam == null)
                    {
                        self.FailureLobby();
                    }
                    else
                    {
                        JSON_MyPhotonRoomParam myPhotonRoomParam = new JSON_MyPhotonRoomParam();
                        myPhotonRoomParam.creatorName = MonoSingleton <GameManager> .Instance.Player.Name;
                        myPhotonRoomParam.creatorLV   = MonoSingleton <GameManager> .Instance.Player.CalcLevel();

                        myPhotonRoomParam.creatorFUID = JSON_MyPhotonRoomParam.GetMyCreatorFUID();
                        myPhotonRoomParam.roomid      = GlobalVars.SelectedMultiPlayRoomID;
                        myPhotonRoomParam.comment     = GlobalVars.SelectedMultiPlayRoomComment;
                        myPhotonRoomParam.passCode    = GlobalVars.EditMultiPlayRoomPassCode;
                        myPhotonRoomParam.iname       = GlobalVars.SelectedQuestID;
                        myPhotonRoomParam.type        = (int)GlobalVars.SelectedMultiPlayRoomType;
                        myPhotonRoomParam.isLINE      = !self.IsLINE ? 0 : 1;
                        myPhotonRoomParam.unitlv      = !GlobalVars.SelectedMultiPlayLimit ? 0 : GlobalVars.MultiPlayJoinUnitLv;
                        DebugUtility.Log("create isLINE:" + (object)myPhotonRoomParam.isLINE + " iname:" + myPhotonRoomParam.iname + " roomid:" + (object)myPhotonRoomParam.roomid + " appID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " token:" + GlobalVars.SelectedMultiPlayRoomName + " comment:" + myPhotonRoomParam.comment + " pass:"******" type:" + (object)myPhotonRoomParam.type + " json:" + myPhotonRoomParam.Serialize());
                        if (instance.CreateRoom((int)quest.playerNum, GlobalVars.SelectedMultiPlayRoomName, myPhotonRoomParam.Serialize(), self.mJoinPlayerParam.Serialize(), (string)null, -1, -1, (string)null, (string)null, -1, false))
                        {
                            return;
                        }
                        self.FailureLobby();
                    }
                }
            }
Ejemplo n.º 20
0
 private void Refresh()
 {
     if (!this.is_active && PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom())
     {
         this.SetParam(JSON_MyPhotonRoomParam.Parse(PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom().json).iname);
         this.is_active = true;
         this.chat_window.ChangeChatTypeTab(ChatWindow.eChatType.Room);
     }
     else if (ChatUtility.IsMultiQuestNow())
     {
         this.is_active = true;
     }
     else if (this.is_active && !PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom())
     {
         this.chat_window.ExitRoomSelf();
         this.is_active = false;
     }
     else
     {
         this.is_active = PunMonoSingleton <MyPhoton> .Instance.IsConnectedInRoom();
     }
 }
Ejemplo n.º 21
0
        private void Search()
        {
            GameManager instance1 = MonoSingleton <GameManager> .Instance;
            int         selectedMultiPlayRoomId = GlobalVars.SelectedMultiPlayRoomID;
            MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;

            instance1.AudienceRoom = instance2.SearchRoom(selectedMultiPlayRoomId);
            if (instance1.AudienceRoom != null)
            {
                JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(instance1.AudienceRoom.json);
                if (myPhotonRoomParam != null && myPhotonRoomParam.audience == 0)
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 11);
                }
                else if (instance1.AudienceRoom.battle)
                {
                    if (myPhotonRoomParam.draft_type == 1 && !instance1.AudienceRoom.draft)
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 115);
                    }
                    else
                    {
                        FlowNode_GameObject.ActivateOutputLinks((Component)this, 12);
                    }
                }
                else if (myPhotonRoomParam.draft_type == 1)
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 115);
                }
                else
                {
                    FlowNode_GameObject.ActivateOutputLinks((Component)this, 15);
                }
            }
            else
            {
                FlowNode_GameObject.ActivateOutputLinks((Component)this, 16);
            }
        }
            public override void Begin(FlowNode_MultiPlayJoinRoom self)
            {
                MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

                self.mJoinPlayerParam = JSON_MyPhotonPlayerParam.Create(0, 0);
                if (self.mJoinPlayerParam == null)
                {
                    self.FailureLobby();
                }
                else
                {
                    JSON_MyPhotonRoomParam myPhotonRoomParam = new JSON_MyPhotonRoomParam();
                    myPhotonRoomParam.creatorName = MonoSingleton <GameManager> .Instance.Player.Name;
                    myPhotonRoomParam.creatorLV   = MonoSingleton <GameManager> .Instance.Player.CalcLevel();

                    myPhotonRoomParam.creatorFUID = JSON_MyPhotonRoomParam.GetMyCreatorFUID();
                    myPhotonRoomParam.roomid      = GlobalVars.SelectedMultiPlayRoomID;
                    myPhotonRoomParam.comment     = GlobalVars.SelectedMultiPlayRoomComment;
                    myPhotonRoomParam.passCode    = GlobalVars.EditMultiPlayRoomPassCode;
                    myPhotonRoomParam.iname       = GlobalVars.SelectedQuestID;
                    myPhotonRoomParam.type        = (int)GlobalVars.SelectedMultiPlayRoomType;
                    myPhotonRoomParam.isLINE      = !self.IsLINE ? 0 : 1;
                    int plv   = -1;
                    int floor = -1;
                    if (GlobalVars.SelectedMultiPlayVersusType == VERSUS_TYPE.Tower)
                    {
                        plv   = myPhotonRoomParam.creatorLV;
                        floor = MonoSingleton <GameManager> .Instance.Player.VersusTowerFloor;
                    }
                    if (instance.CreateRoom((int)self.VERSUS_PLAYER_MAX, GlobalVars.SelectedMultiPlayRoomName, myPhotonRoomParam.Serialize(), self.mJoinPlayerParam.Serialize(), GlobalVars.MultiPlayVersusKey, floor, plv))
                    {
                        return;
                    }
                    self.FailureLobby();
                }
            }
Ejemplo n.º 23
0
            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;
                        }
                    }
                }
            }
Ejemplo n.º 24
0
        public void Analyze(string log)
        {
            string json = string.Empty;
            string src  = string.Empty;

            if (!string.IsNullOrEmpty(this.mNonAnalyzeLog))
            {
                log = this.mNonAnalyzeLog + log;
                this.mNonAnalyzeLog = string.Empty;
            }
            if (log.IndexOf("creatorName") != -1)
            {
                json = log;
            }
            else if (log.IndexOf("players") != -1)
            {
                src = log;
            }
            else if (log.IndexOf("bm") != -1)
            {
                try
                {
                    byte[] data = MyEncrypt.Decrypt(((AudienceLog)JsonUtility.FromJson <AudienceLog>(log)).bm);
                    SceneBattle.MultiPlayRecvData buffer;
                    if (GameUtility.Binary2Object <SceneBattle.MultiPlayRecvData>(out buffer, data))
                    {
                        if (!this.mTurnLog.ContainsKey(buffer.b))
                        {
                            this.mTurnLog[buffer.b] = new List <SceneBattle.MultiPlayRecvData>();
                        }
                        this.mTurnLog[buffer.b].Add(buffer);
                    }
                }
                catch
                {
                    this.mNonAnalyzeLog = log;
                }
            }
            else if (log.IndexOf("bin") != -1)
            {
                try
                {
                    SceneBattle.MultiPlayRecvBinData multiPlayRecvBinData = (SceneBattle.MultiPlayRecvBinData)JsonUtility.FromJson <SceneBattle.MultiPlayRecvBinData>(log);
                    string buffer;
                    GameUtility.Binary2Object <string>(out buffer, multiPlayRecvBinData.bin);
                    this.Analyze(buffer);
                    return;
                }
                catch
                {
                    this.mNonAnalyzeLog = log;
                }
            }
            else
            {
                this.mNonAnalyzeLog = log;
            }
            if (!string.IsNullOrEmpty(json))
            {
                try
                {
                    this.mRoomParam = JSON_MyPhotonRoomParam.Parse(json);
                }
                catch
                {
                    Debug.LogWarning((object)json);
                    this.mNonAnalyzeLog = json;
                }
            }
            if (string.IsNullOrEmpty(src))
            {
                return;
            }
            try
            {
                this.mStartedParam = JSONParser.parseJSONObject <AudienceStartParam>(src);
            }
            catch
            {
                Debug.LogWarning((object)src);
                this.mNonAnalyzeLog = src;
            }
        }
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 101:
                DebugUtility.Log("Start Create Room");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE        = false;
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_CreateRoom>();
                break;

            case 102:
                DebugUtility.Log("Start Join Room");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE        = false;
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_JoinRoom>();
                break;

            case 103:
                DebugUtility.Log("Start Create/Join Room LINE");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE = true;
                if (JSON_MyPhotonRoomParam.GetMyCreatorFUID().Equals(FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID))
                {
                    DebugUtility.Log("Creating LINERoom iname:" + GlobalVars.SelectedQuestID + " type:" + (object)GlobalVars.SelectedMultiPlayRoomType + " creatorFUID:" + FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID);
                    this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                    this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_CreateRoom>();
                    break;
                }
                DebugUtility.Log("Joining LINERoom iname:" + GlobalVars.SelectedQuestID + " type:" + (object)GlobalVars.SelectedMultiPlayRoomType + " creatorFUID:" + FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID + " name:" + GlobalVars.SelectedMultiPlayRoomName);
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_JoinRoom>();
                break;

            case 200:
                DebugUtility.Log("Start Versus Create Room");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE        = false;
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_VersusCreate>();
                break;

            case 201:
                DebugUtility.Log("Start Versus Join Room");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE        = false;
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_VersusJoin>();
                break;

            case 202:
                DebugUtility.Log("Start Versus Rank Join Room");
                ((Behaviour)this).set_enabled(true);
                this.IsLINE        = false;
                this.mStateMachine = new StateMachine <FlowNode_MultiPlayJoinRoom>(this);
                this.mStateMachine.GotoState <FlowNode_MultiPlayJoinRoom.State_VersusTowerJoin>();
                break;
            }
        }
Ejemplo n.º 26
0
        public void Refresh()
        {
            MyPhoton.MyRoom dataOfClass = DataSource.FindDataOfClass <MyPhoton.MyRoom>(((Component)this).get_gameObject(), (MyPhoton.MyRoom)null);
            if (dataOfClass == null)
            {
                ((Component)this).get_gameObject().SetActive(false);
            }
            else
            {
                JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(dataOfClass.json);
                if (myPhotonRoomParam.players == null)
                {
                    ((Component)this).get_gameObject().SetActive(false);
                }
                else
                {
                    ((Component)this).get_gameObject().SetActive(true);
                    if (Object.op_Inequality((Object)this.Player1P, (Object)null))
                    {
                        if (myPhotonRoomParam.players.Length > 0)
                        {
                            DataSource.Bind <JSON_MyPhotonPlayerParam>(this.Player1P, myPhotonRoomParam.players[0]);
                        }
                        VersusViewPlayerInfo component = (VersusViewPlayerInfo)this.Player1P.GetComponent <VersusViewPlayerInfo>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.Refresh();
                        }
                    }
                    if (Object.op_Inequality((Object)this.Player2P, (Object)null))
                    {
                        if (myPhotonRoomParam.players.Length > 1)
                        {
                            DataSource.Bind <JSON_MyPhotonPlayerParam>(this.Player2P, myPhotonRoomParam.players[1]);
                        }
                        else
                        {
                            DataSource.Bind <JSON_MyPhotonPlayerParam>(this.Player2P, (JSON_MyPhotonPlayerParam)null);
                        }
                        VersusViewPlayerInfo component = (VersusViewPlayerInfo)this.Player2P.GetComponent <VersusViewPlayerInfo>();
                        if (Object.op_Inequality((Object)component, (Object)null))
                        {
                            component.Refresh();
                        }
                    }
                    if (Object.op_Inequality((Object)this.RoomType, (Object)null))
                    {
                        if (dataOfClass.name.IndexOf(this.FREE_SUFFIX) != -1)
                        {
                            this.RoomType.set_sprite(this.FreeMatch);
                        }
                        else
                        {
                            this.RoomType.set_sprite(this.TowerMatch);
                        }
                    }
                    if (Object.op_Inequality((Object)this.RoomIcon, (Object)null))
                    {
                        if (dataOfClass.name.IndexOf(this.FREE_SUFFIX) != -1)
                        {
                            this.RoomIcon.set_sprite(this.FreeIcon);
                        }
                        else
                        {
                            this.RoomIcon.set_sprite(this.TowerIcon);
                        }
                    }
                    QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(myPhotonRoomParam.iname);

                    if (quest == null)
                    {
                        return;
                    }
                    if (Object.op_Inequality((Object)this.MapThumnail, (Object)null))
                    {
                        SpriteSheet spriteSheet = AssetManager.Load <SpriteSheet>("pvp/pvp_map");
                        if (Object.op_Inequality((Object)spriteSheet, (Object)null))
                        {
                            this.MapThumnail.set_sprite(spriteSheet.GetSprite(quest.VersusThumnail));
                        }
                    }
                    if (Object.op_Inequality((Object)this.MapName, (Object)null))
                    {
                        this.MapName.set_text(quest.name);
                    }
                    if (!Object.op_Inequality((Object)this.MapDetail, (Object)null))
                    {
                        return;
                    }
                    this.MapDetail.set_text(quest.expr);
                }
            }
        }
Ejemplo n.º 27
0
        public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 0:
            case 4:
            case 22:
                this.ResetPlacementParam();
                string empty1 = string.Empty;
                string str1   = !PlayerPrefsUtility.HasKey(PlayerPrefsUtility.ROOM_COMMENT_KEY) ? LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT") : PlayerPrefsUtility.GetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, string.Empty);
                if (string.IsNullOrEmpty(str1))
                {
                    str1 = LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT");
                }
                if (!MyMsgInput.isLegal(str1))
                {
                    DebugUtility.Log("comment is not legal");
                    this.ActivateOutputLinks(4801);
                    break;
                }
                GlobalVars.ResumeMultiplayPlayerID      = 0;
                GlobalVars.ResumeMultiplaySeatID        = 0;
                GlobalVars.SelectedMultiPlayRoomComment = str1;
                DebugUtility.Log("MakeRoom Comment:" + GlobalVars.SelectedMultiPlayRoomComment);
                bool flag = false;
                if (pinID == 4)
                {
                    GlobalVars.SelectedQuestID           = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.iname;
                    GlobalVars.SelectedMultiPlayRoomType = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.type;
                    GlobalVars.EditMultiPlayRoomPassCode = "0";
                    flag = true;
                    DebugUtility.Log("MakeRoom for LINE Quest:" + GlobalVars.SelectedQuestID + " Type:" + (object)GlobalVars.SelectedMultiPlayRoomType + " PassCodeHash:" + GlobalVars.SelectedMultiPlayRoomPassCodeHash);
                }
                GlobalVars.EditMultiPlayRoomPassCode = "0";
                string s = FlowNode_Variable.Get("MultiPlayPasscode");
                if (!string.IsNullOrEmpty(s))
                {
                    int result = 0;
                    if (int.TryParse(s, out result))
                    {
                        GlobalVars.EditMultiPlayRoomPassCode = result.ToString();
                    }
                }
                bool isPrivate = flag;
                FlowNode_MultiPlayAPI.RoomMakeTime = Time.get_realtimeSinceStartup();
                bool limit  = GlobalVars.SelectedMultiPlayLimit & GlobalVars.EditMultiPlayRoomPassCode == "0";
                int  unitlv = isPrivate || !limit ? 0 : GlobalVars.MultiPlayJoinUnitLv;
                bool clear  = !isPrivate && limit && GlobalVars.MultiPlayClearOnly;
                int  selectedMultiTowerFloor1 = GlobalVars.SelectedMultiTowerFloor;
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    GlobalVars.SelectedMultiPlayRoomID      = (int)(DateTime.Now - new DateTime(1970, 1, 1, 0, 0, 0, 0)).TotalSeconds;
                    GlobalVars.SelectedMultiPlayPhotonAppID = string.Empty;
                    GlobalVars.SelectedMultiPlayRoomName    = Guid.NewGuid().ToString();
                    DebugUtility.Log("MakeRoom RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID + " AppID:" + GlobalVars.SelectedMultiPlayPhotonAppID + " Name:" + GlobalVars.SelectedMultiPlayRoomName);
                    this.Success();
                    break;
                }
                MultiInvitationSendWindow.ClearInvited();
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.MAKE;
                if (pinID != 22)
                {
                    this.ExecRequest((WebAPI) new ReqMPRoomMake(GlobalVars.SelectedQuestID, str1, GlobalVars.EditMultiPlayRoomPassCode, isPrivate, limit, unitlv, clear, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    break;
                }
                this.ExecRequest((WebAPI) new ReqMultiTwRoomMake(GlobalVars.SelectedMultiTowerID, str1, GlobalVars.EditMultiPlayRoomPassCode, selectedMultiTowerFloor1, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 2:
            case 5:
            case 23:
            case 50:
                string fuid = (string)null;
                if (pinID == 5)
                {
                    fuid = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.creatorFUID;
                }
                else if (pinID == 50)
                {
                    fuid = GlobalVars.MultiInvitationRoomOwner;
                }
                DebugUtility.Log("ListRoom FUID:" + fuid);
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.StartCoroutine(this.GetPhotonRoomList(fuid));
                    break;
                }
                FlowNode_MultiPlayAPI.RoomList = (ReqMPRoom.Response)null;
                string iname = string.Empty;
                if (pinID == 2)
                {
                    iname = GlobalVars.SelectedQuestID;
                }
                int selectedMultiTowerFloor2 = GlobalVars.SelectedMultiTowerFloor;
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.ROOM;
                if (pinID != 23)
                {
                    this.ExecRequest((WebAPI) new ReqMPRoom(fuid, iname, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    break;
                }
                this.ExecRequest((WebAPI) new ReqMultiTwRoom(fuid, iname, selectedMultiTowerFloor2, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 3:
            case 6:
            case 24:
            case 51:
                if (FlowNode_MultiPlayAPI.RoomList == null || FlowNode_MultiPlayAPI.RoomList.rooms == null || FlowNode_MultiPlayAPI.RoomList.rooms.Length <= 0)
                {
                    this.Failure();
                    break;
                }
                this.ResetPlacementParam();
                bool LockRoom = false;
                switch (pinID)
                {
                case 6:
                    if (FlowNode_MultiPlayAPI.RoomList.rooms.Length != 1 || FlowNode_MultiPlayAPI.RoomList.rooms[0] == null)
                    {
                        this.Failure();
                        return;
                    }
                    GlobalVars.SelectedMultiPlayRoomID = FlowNode_MultiPlayAPI.RoomList.rooms[0].roomid;
                    DebugUtility.Log("JoinRoom for LINE RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID);
                    break;

                case 51:
                    if (FlowNode_MultiPlayAPI.RoomList.rooms.Length != 1 || FlowNode_MultiPlayAPI.RoomList.rooms[0] == null)
                    {
                        this.Failure();
                        return;
                    }
                    LockRoom = GlobalVars.MultiInvitationRoomLocked;
                    GlobalVars.SelectedMultiPlayRoomID = FlowNode_MultiPlayAPI.RoomList.rooms[0].roomid;
                    DebugUtility.Log("JoinRoom for Invitation RoomID:" + (object)GlobalVars.SelectedMultiPlayRoomID);
                    break;
                }
                GlobalVars.ResumeMultiplayPlayerID = 0;
                GlobalVars.ResumeMultiplaySeatID   = 0;
                GlobalVars.SelectedQuestID         = (string)null;
                for (int index = 0; index < FlowNode_MultiPlayAPI.RoomList.rooms.Length; ++index)
                {
                    if (FlowNode_MultiPlayAPI.RoomList.rooms[index].quest != null && !string.IsNullOrEmpty(FlowNode_MultiPlayAPI.RoomList.rooms[index].quest.iname) && FlowNode_MultiPlayAPI.RoomList.rooms[index].roomid == GlobalVars.SelectedMultiPlayRoomID)
                    {
                        GlobalVars.SelectedQuestID = FlowNode_MultiPlayAPI.RoomList.rooms[index].quest.iname;
                        break;
                    }
                }
                if (string.IsNullOrEmpty(GlobalVars.SelectedQuestID))
                {
                    this.Failure();
                    break;
                }
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.StartCoroutine(this.GetPhotonRoomName());
                    break;
                }
                int selectedMultiTowerFloor3 = GlobalVars.SelectedMultiTowerFloor;
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.JOIN;
                if (pinID != 24)
                {
                    this.ExecRequest((WebAPI) new ReqMPRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), LockRoom));
                    break;
                }
                this.ExecRequest((WebAPI) new ReqMultiTwRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), LockRoom, selectedMultiTowerFloor3, false));
                break;

            case 7:
            case 26:
            case 55:
            case 56:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                if (!string.IsNullOrEmpty(GlobalVars.EditMultiPlayRoomComment) && !MyMsgInput.isLegal(GlobalVars.EditMultiPlayRoomComment))
                {
                    DebugUtility.Log("comment is not legal");
                    this.ActivateOutputLinks(4801);
                    break;
                }
                switch (pinID)
                {
                case 55:
                    GlobalVars.EditMultiPlayRoomPassCode = "0";
                    GlobalVars.EditMultiPlayRoomComment  = GlobalVars.SelectedMultiPlayRoomComment;
                    break;

                case 56:
                    GlobalVars.EditMultiPlayRoomPassCode = "1";
                    GlobalVars.EditMultiPlayRoomComment  = GlobalVars.SelectedMultiPlayRoomComment;
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.UPDATE;
                if (GlobalVars.SelectedMultiPlayRoomType != JSON_MyPhotonRoomParam.EType.TOWER)
                {
                    this.ExecRequest((WebAPI) new ReqMPRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.EditMultiPlayRoomPassCode, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                    break;
                }
                string selectedMultiTowerId     = GlobalVars.SelectedMultiTowerID;
                int    selectedMultiTowerFloor4 = GlobalVars.SelectedMultiTowerFloor;
                this.ExecRequest((WebAPI) new ReqMultiTwRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.EditMultiPlayRoomPassCode, selectedMultiTowerId, selectedMultiTowerFloor4, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 8:
            case 25:
            case 28:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX)
                {
                    this.Failure();
                    break;
                }
                this.ResetPlacementParam();
                GlobalVars.ResumeMultiplayPlayerID = 0;
                GlobalVars.ResumeMultiplaySeatID   = 0;
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.JOIN;
                if (pinID != 25 && pinID != 28)
                {
                    this.ExecRequest((WebAPI) new ReqMPRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), true));
                    break;
                }
                this.API = FlowNode_MultiPlayAPI.EAPI.MT_JOIN;
                this.ExecRequest((WebAPI) new ReqMultiTwRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback), true, 0, pinID == 28));
                break;

            case 9:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSION;
                this.ExecRequest((WebAPI) new ReqMPVersion(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 10:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                GlobalVars.SelectedMultiPlayRoomName = string.Empty;
                GlobalVars.VersusRoomReuse           = false;
                GlobalVars.ResumeMultiplayPlayerID   = 0;
                GlobalVars.ResumeMultiplaySeatID     = 0;
                GlobalVars.MultiPlayVersusKey        = MonoSingleton <GameManager> .Instance.GetVersusKey(GlobalVars.SelectedMultiPlayVersusType);

                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_START;
                this.ExecRequest((WebAPI) new ReqVersusStart(GlobalVars.SelectedMultiPlayVersusType, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 11:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                string empty2 = string.Empty;
                string str2   = !PlayerPrefsUtility.HasKey(PlayerPrefsUtility.ROOM_COMMENT_KEY) ? LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT") : PlayerPrefsUtility.GetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, string.Empty);
                if (string.IsNullOrEmpty(str2))
                {
                    str2 = LocalizedText.Get("sys.DEFAULT_ROOM_COMMENT");
                }
                if (!MyMsgInput.isLegal(str2))
                {
                    DebugUtility.Log("comment is not legal");
                    this.ActivateOutputLinks(4801);
                    break;
                }
                FlowNode_MultiPlayAPI.RoomMakeTime      = Time.get_realtimeSinceStartup();
                GlobalVars.SelectedMultiPlayRoomComment = str2;
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_MAKE;
                this.ExecRequest((WebAPI) new ReqVersusMake(GlobalVars.SelectedMultiPlayVersusType, str2, GlobalVars.SelectedQuestID, false, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 12:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_JOIN;
                this.ExecRequest((WebAPI) new ReqVersusRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 13:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                if (!MyMsgInput.isLegal(GlobalVars.EditMultiPlayRoomComment))
                {
                    DebugUtility.Log("comment is not legal");
                    this.ActivateOutputLinks(4801);
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.UPDATE;
                this.ExecRequest((WebAPI) new ReqVersusRoomUpdate(GlobalVars.SelectedMultiPlayRoomID, GlobalVars.EditMultiPlayRoomComment, GlobalVars.SelectedQuestID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 14:
                GlobalVars.SelectedMultiPlayRoomName = string.Empty;
                GlobalVars.VersusRoomReuse           = false;
                GlobalVars.ResumeMultiplayPlayerID   = 0;
                GlobalVars.ResumeMultiplaySeatID     = 0;
                GlobalVars.MultiPlayVersusKey        = MonoSingleton <GameManager> .Instance.GetVersusKey(GlobalVars.SelectedMultiPlayVersusType);

                this.Success();
                break;

            case 15:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_REQ;
                this.ExecRequest((WebAPI) new ReqVersusLine(GlobalVars.SelectedMultiPlayRoomName, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 16:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Success();
                    break;
                }
                GlobalVars.VersusRoomReuse         = false;
                FlowNode_MultiPlayAPI.RoomMakeTime = Time.get_realtimeSinceStartup();
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_LINE_MAKE;
                this.ExecRequest((WebAPI) new ReqVersusLineMake(GlobalVars.SelectedMultiPlayRoomName, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 17:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                GlobalVars.SelectedMultiPlayRoomID = FlowNode_OnUrlSchemeLaunch.LINEParam_decided.roomid;
                if (GlobalVars.SelectedMultiPlayRoomID < FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MIN || GlobalVars.SelectedMultiPlayRoomID > FlowNode_MultiPlayAPI.ROOMID_VALIDATE_MAX)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_JOIN;
                this.ExecRequest((WebAPI) new ReqVersusRoomJoin(GlobalVars.SelectedMultiPlayRoomID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 18:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_STATUS;
                this.ExecRequest((WebAPI) new ReqVersusStatus(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 19:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_SEASON;
                this.ExecRequest((WebAPI) new ReqVersusSeason(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 20:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.VERSUS_FRIEND;
                this.ExecRequest((WebAPI) new ReqVersusFriendScore(new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 21:
                GameManager instance1 = MonoSingleton <GameManager> .Instance;
                MyPhoton    instance2 = PunMonoSingleton <MyPhoton> .Instance;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance2, (UnityEngine.Object)null) && instance2.IsConnectedInRoom())
                {
                    GlobalVars.CreateAutoMultiTower = true;
                    if (instance2.IsCreatedRoom())
                    {
                        instance2.OpenRoom(true, false);
                        MyPhoton.MyRoom currentRoom = instance2.GetCurrentRoom();
                        if (currentRoom != null)
                        {
                            JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
                            if (myPhotonRoomParam != null)
                            {
                                List <MultiTowerFloorParam> mtAllFloorParam = instance1.GetMTAllFloorParam(GlobalVars.SelectedMultiTowerID);
                                if (mtAllFloorParam != null)
                                {
                                    GlobalVars.SelectedMultiTowerFloor = Mathf.Min(mtAllFloorParam.Count, GlobalVars.SelectedMultiTowerFloor + 1);
                                }
                                myPhotonRoomParam.challegedMTFloor = GlobalVars.SelectedMultiTowerFloor;
                                myPhotonRoomParam.iname            = GlobalVars.SelectedMultiTowerID + "_" + myPhotonRoomParam.challegedMTFloor.ToString();
                                instance2.SetRoomParam(myPhotonRoomParam.Serialize());
                            }
                        }
                    }
                    instance2.AddMyPlayerParam("BattleStart", (object)false);
                    instance2.AddMyPlayerParam("resume", (object)false);
                    MyPhoton.MyPlayer myPlayer = instance2.GetMyPlayer();
                    if (myPlayer != null)
                    {
                        JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                        if (photonPlayerParam != null)
                        {
                            photonPlayerParam.mtChallengeFloor = instance1.GetMTChallengeFloor();
                            photonPlayerParam.mtClearedFloor   = instance1.GetMTClearedMaxFloor();
                            instance2.SetMyPlayerParam(photonPlayerParam.Serialize());
                        }
                    }
                    this.Success();
                    break;
                }
                this.Failure();
                break;

            case 27:
                if (Network.Mode != Network.EConnectMode.Online)
                {
                    this.Failure();
                    break;
                }
                ((Behaviour)this).set_enabled(true);
                this.API = FlowNode_MultiPlayAPI.EAPI.MT_STATUS;
                this.ExecRequest((WebAPI) new ReqMultiTwStatus(GlobalVars.SelectedMultiTowerID, new Network.ResponseCallback(((FlowNode_Network)this).ResponseCallback)));
                break;

            case 29:
                MyPhoton instance3 = PunMonoSingleton <MyPhoton> .Instance;
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)instance3, (UnityEngine.Object)null) && instance3.IsConnectedInRoom())
                {
                    this.Success();
                    break;
                }
                this.Failure();
                break;
            }
        }
Ejemplo n.º 28
0
        private void RefreshItems()
        {
            Transform transform = ((Component)this).get_transform();

            if (UnityEngine.Object.op_Equality((UnityEngine.Object) this.ItemTemplate, (UnityEngine.Object)null))
            {
                return;
            }
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

            MyPhoton.MyRoom          currentRoom        = instance.GetCurrentRoom();
            JSON_MyPhotonRoomParam   data1              = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
            JSON_MyPhotonPlayerParam photonPlayerParam1 = data1 != null?data1.GetOwner() : (JSON_MyPhotonPlayerParam)null;

            int num1 = photonPlayerParam1 != null ? photonPlayerParam1.playerIndex : 0;
            List <MyPhoton.MyPlayer> roomPlayerList1 = instance.GetRoomPlayerList();

            for (int count = this.UIItemList.Count; count < currentRoom.maxPlayers; ++count)
            {
                this.UIItemList.Add((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.ItemTemplate));
                if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                {
                    this.PlayerInfo.SetActive(false);
                    this.PlayerInfoList.Add((GameObject)UnityEngine.Object.Instantiate <GameObject>((M0)this.PlayerInfo));
                }
            }
            int maxPlayers = currentRoom.maxPlayers;

            if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.VERSUS)
            {
                --maxPlayers;
            }
            for (int index1 = 0; index1 < maxPlayers; ++index1)
            {
                JSON_MyPhotonPlayerParam data2 = (JSON_MyPhotonPlayerParam)null;
                int num2 = index1 + 1;
                if (num1 > 0)
                {
                    if (index1 == 0)
                    {
                        num2 = num1;
                    }
                    else if (index1 < num1)
                    {
                        num2 = index1;
                    }
                }
                using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList1.GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        MyPhoton.MyPlayer current = enumerator.Current;
                        if (current.json != null)
                        {
                            JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(current.json);
                            if (photonPlayerParam2 != null && photonPlayerParam2.playerIndex == num2)
                            {
                                data2 = photonPlayerParam2;
                                break;
                            }
                        }
                    }
                }
                if (data2 == null)
                {
                    data2             = new JSON_MyPhotonPlayerParam();
                    data2.playerIndex = num2;
                }
                GameObject uiItem = this.UIItemList[index1];
                ((UnityEngine.Object)uiItem).set_hideFlags((HideFlags)52);
                DataSource.Bind <JSON_MyPhotonPlayerParam>(uiItem, data2);
                DataSource.Bind <JSON_MyPhotonRoomParam>(uiItem, data1);
                if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                {
                    DataSource.Bind <JSON_MyPhotonPlayerParam>(this.PlayerInfoList[index1], data2);
                    DataSource.Bind <JSON_MyPhotonRoomParam>(this.PlayerInfoList[index1], data1);
                    this.PlayerInfoList[index1].get_transform().SetParent(this.PlayerInfo.get_transform().get_parent(), false);
                    this.PlayerInfoList[index1].get_gameObject().SetActive(true);
                }
                GameObjectID[] componentsInChildren = (GameObjectID[])uiItem.GetComponentsInChildren <GameObjectID>(true);
                if (data2 != null && data2.units != null && componentsInChildren != null)
                {
                    for (int index2 = 0; index2 < componentsInChildren.Length; ++index2)
                    {
                        GameObjectID gameObjectId = componentsInChildren[index2];
                        if (gameObjectId.ID != null)
                        {
                            DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), (UnitData)null);
                        }
                    }
                    for (int index2 = 0; index2 < data2.units.Length; ++index2)
                    {
                        int      slotId = data2.units[index2].slotID;
                        bool     flag1  = data2.units[index2].sub == 1;
                        UnitData data3  = data2.units[index2].unit;
                        if (data3 != null)
                        {
                            if (GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.TOWER)
                            {
                                for (int index3 = 0; index3 < componentsInChildren.Length; ++index3)
                                {
                                    GameObjectID gameObjectId = componentsInChildren[index3];
                                    if (gameObjectId.ID != null && (gameObjectId.ID.Equals("unit" + (object)slotId) || flag1) && (!flag1 || index3 == componentsInChildren.Length - 1))
                                    {
                                        data3.TempFlags |= UnitData.TemporaryFlags.AllowJobChange;
                                        DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), data3);
                                        UnitIcon component = (UnitIcon)((Component)gameObjectId).get_gameObject().GetComponent <UnitIcon>();
                                        if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null) && data2.playerIndex > 0)
                                        {
                                            DataSource.Bind <PlayerPartyTypes>(((Component)gameObjectId).get_gameObject(), PlayerPartyTypes.MultiTower);
                                            bool flag2 = data2.playerIndex == PunMonoSingleton <MyPhoton> .Instance.MyPlayerIndex;
                                            component.AllowJobChange = flag2;
                                            if (flag2)
                                            {
                                                UnitData unitDataByUnitId = MonoSingleton <GameManager> .Instance.Player.FindUnitDataByUnitID(data3.UnitParam.iname);

                                                if (unitDataByUnitId != null)
                                                {
                                                    unitDataByUnitId.TempFlags |= UnitData.TemporaryFlags.AllowJobChange;
                                                    DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), unitDataByUnitId);
                                                    data3 = unitDataByUnitId;
                                                }
                                            }
                                        }
                                        if (index3 == 0 && this.PlayerInfoList.Count > index1)
                                        {
                                            DataSource.Bind <UnitData>(this.PlayerInfoList[index1], data3);
                                            break;
                                        }
                                        break;
                                    }
                                }
                            }
                            else
                            {
                                for (int index3 = 0; index3 < componentsInChildren.Length; ++index3)
                                {
                                    GameObjectID gameObjectId = componentsInChildren[index3];
                                    if (gameObjectId.ID != null && gameObjectId.ID.Equals("unit" + (object)slotId))
                                    {
                                        DataSource.Bind <UnitData>(((Component)gameObjectId).get_gameObject(), data3);
                                        break;
                                    }
                                }
                            }
                        }
                    }
                }
                ListItemEvents component1 = (ListItemEvents)uiItem.GetComponent <ListItemEvents>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component1, (UnityEngine.Object)null))
                {
                    component1.OnSelect      = new ListItemEvents.ListItemEvent(this.OnSelectItem);
                    component1.OnOpenDetail  = new ListItemEvents.ListItemEvent(this.OnOpenItemDetail);
                    component1.OnCloseDetail = new ListItemEvents.ListItemEvent(this.OnCloseItemDetail);
                }
                uiItem.get_transform().SetParent(transform, false);
                uiItem.get_gameObject().SetActive(true);
            }
            QuestParam quest = MonoSingleton <GameManager> .Instance.FindQuest(data1.iname);

            DataSource.Bind <QuestParam>(this.Root, quest);
            bool flag = false;

            if (UnityEngine.Object.op_Inequality((UnityEngine.Object) this.SkillObj, (UnityEngine.Object)null) && quest != null)
            {
                if (quest.IsMultiLeaderSkill)
                {
                    List <MyPhoton.MyPlayer> roomPlayerList2 = instance.GetRoomPlayerList();
                    if (roomPlayerList2 != null)
                    {
                        MyPhoton.MyPlayer myPlayer = roomPlayerList2.Find((Predicate <MyPhoton.MyPlayer>)(member => member.playerID == 1));
                        if (myPlayer != null)
                        {
                            JSON_MyPhotonPlayerParam photonPlayerParam2 = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                            if (photonPlayerParam2 != null && photonPlayerParam2.units != null && photonPlayerParam2.units.Length > 0)
                            {
                                UnitData data2 = new UnitData();
                                if (data2 != null)
                                {
                                    data2.Deserialize(photonPlayerParam2.units[0].unitJson);
                                    DataSource.Bind <UnitData>(this.SkillObj, data2);
                                    flag = data2.LeaderSkill != null;
                                }
                            }
                        }
                    }
                }
                SRPG_Button component = (SRPG_Button)this.SkillObj.GetComponent <SRPG_Button>();
                if (UnityEngine.Object.op_Inequality((UnityEngine.Object)component, (UnityEngine.Object)null))
                {
                    ((Selectable)component).set_interactable(quest.IsMultiLeaderSkill && flag);
                }
            }
            GameParameter.UpdateAll(this.Root);
            FlowNode_GameObject.ActivateOutputLinks((Component)this, 1);
        }
Ejemplo n.º 29
0
            public override void Update(FlowNode_StartMultiPlay self)
            {
                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_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null;
                        if (myPhotonRoomParam == null)
                        {
                            self.Failure();
                        }
                        else
                        {
                            if (myPhotonRoomParam.started == 0)
                            {
                                myPhotonRoomParam.started = 1;
                                instance.SetRoomParam(myPhotonRoomParam.Serialize());
                            }
                            if ((double)this.mStartWait > 0.0)
                            {
                                this.mStartWait -= Time.get_deltaTime();
                                if ((double)this.mStartWait > 0.0)
                                {
                                    return;
                                }
                                GlobalVars.SelectedQuestID  = myPhotonRoomParam.iname;
                                GlobalVars.SelectedFriendID = (string)null;
                                GlobalVars.SelectedFriend   = (FriendData)null;
                                GlobalVars.SelectedSupport.Set((SupportData)null);
                                self.Success();
                                DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize());
                            }
                            else if ((double)this.mWait > 0.0)
                            {
                                this.mWait -= Time.get_deltaTime();
                            }
                            else
                            {
                                List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList();
                                if ((myPhotonRoomParam.type == 1 || myPhotonRoomParam.type == 3) && roomPlayerList.Count == 1)
                                {
                                    self.FailureStartMulti();
                                }
                                else if (this.mConfirm)
                                {
                                    using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json);
                                            if (photonPlayerParam.state != 3)
                                            {
                                                return;
                                            }
                                            if (photonPlayerParam.state < 2)
                                            {
                                                self.Failure();
                                                return;
                                            }
                                        }
                                    }
                                    this.mStartWait = 0.1f;
                                }
                                else
                                {
                                    MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer();
                                    if (this.mRecvList.Count <= 0)
                                    {
                                        this.mSend.senderPlayerID = myPlayer.photonPlayerID;
                                        this.mSend.playerListJson = (string)null;
                                        List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>();
                                        for (int index = 0; index < roomPlayerList.Count; ++index)
                                        {
                                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json);
                                            photonPlayerParamList.Add(photonPlayerParam);
                                        }
                                        photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex));
                                        FlowNode_StartMultiPlay.PlayerList playerList = new FlowNode_StartMultiPlay.PlayerList();
                                        playerList.players = photonPlayerParamList.ToArray();
                                        Json_MyPhotonPlayerBinaryParam[] playerBinaryParamArray = new Json_MyPhotonPlayerBinaryParam[playerList.players.Length];
                                        for (int index = 0; index < playerList.players.Length; ++index)
                                        {
                                            playerList.players[index].CreateJsonUnitData();
                                            playerBinaryParamArray[index] = new Json_MyPhotonPlayerBinaryParam();
                                            playerBinaryParamArray[index].Set(playerList.players[index]);
                                        }
                                        this.mSend.playerList = playerBinaryParamArray;
                                        byte[] msg = GameUtility.Object2Binary <FlowNode_StartMultiPlay.RecvData>(this.mSend);
                                        instance.SendRoomMessageBinary(true, msg, MyPhoton.SEND_TYPE.Sync, false);
                                        this.mRecvList.Add(this.mSend);
                                        this.mSend.playerListJson = playerList.Serialize();
                                    }
                                    List <MyPhoton.MyEvent> events = instance.GetEvents();
                                    for (int index = events.Count - 1; index >= 0; --index)
                                    {
                                        FlowNode_StartMultiPlay.RecvData buffer = (FlowNode_StartMultiPlay.RecvData)null;
                                        if (!GameUtility.Binary2Object <FlowNode_StartMultiPlay.RecvData>(out buffer, events[index].binary))
                                        {
                                            DebugUtility.LogError("[PUN] started player list version error: " + events[index].json);
                                            instance.Disconnect();
                                            return;
                                        }
                                        if (buffer == null || buffer.version < this.mSend.version)
                                        {
                                            DebugUtility.LogError("[PUN] started player list version error: " + events[index].json);
                                            instance.Disconnect();
                                            return;
                                        }
                                        if (buffer.version <= this.mSend.version)
                                        {
                                            buffer.senderPlayerID = events[index].playerID;
                                            DebugUtility.Log("[PUN] recv started player list: " + events[index].json);
                                            this.mRecvList.Add(buffer);
                                            events.Remove(events[index]);
                                        }
                                    }
                                    using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            MyPhoton.MyPlayer p = enumerator.Current;
                                            if (this.mRecvList.FindIndex((Predicate <FlowNode_StartMultiPlay.RecvData>)(r => r.senderPlayerID == p.photonPlayerID)) < 0)
                                            {
                                                return;
                                            }
                                        }
                                    }
                                    bool flag = true;
                                    using (List <FlowNode_StartMultiPlay.RecvData> .Enumerator enumerator = this.mRecvList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            FlowNode_StartMultiPlay.RecvData current = enumerator.Current;
                                            if (current.playerList.Length == this.mSend.playerList.Length)
                                            {
                                                for (int index = 0; index < this.mSend.playerList.Length; ++index)
                                                {
                                                    if (!Json_MyPhotonPlayerBinaryParam.IsEqual(current.playerList[index], this.mSend.playerList[index]))
                                                    {
                                                        flag = false;
                                                    }
                                                }
                                                if (!flag)
                                                {
                                                    break;
                                                }
                                            }
                                            else
                                            {
                                                flag = false;
                                                break;
                                            }
                                        }
                                    }
                                    if (!flag)
                                    {
                                        DebugUtility.Log("[PUN] started player list is not equal. ver:" + (object)this.mSend.version);
                                        this.mRecvList.Clear();
                                        ++this.mSend.version;
                                        this.mWait = 1f;
                                    }
                                    else
                                    {
                                        DebugUtility.Log("[PUN]started player list decided. ver:" + (object)this.mSend.version);
                                        List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted();
                                        myPlayersStarted.Clear();
                                        foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(this.mSend.playerListJson).players)
                                        {
                                            player.SetupUnits();
                                            myPlayersStarted.Add(player);
                                        }
                                        if (instance.IsOldestPlayer())
                                        {
                                            instance.UpdateRoomParam("started", (object)this.mSend.playerListJson);
                                        }
                                        if (events.Count > 0)
                                        {
                                            DebugUtility.LogError("[PUN] event must be empty.");
                                        }
                                        events.Clear();
                                        JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                                        photonPlayerParam.state = 3;
                                        instance.SetMyPlayerParam(photonPlayerParam.Serialize());
                                        this.mConfirm = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }
Ejemplo n.º 30
0
            public override void Update(FlowNode_StartMultiPlay self)
            {
                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_MyPhotonRoomParam myPhotonRoomParam = !string.IsNullOrEmpty(currentRoom.json) ? JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null;
                        if (myPhotonRoomParam == null)
                        {
                            self.Failure();
                        }
                        else
                        {
                            if (myPhotonRoomParam.started == 0)
                            {
                                myPhotonRoomParam.started = 1;
                                instance.SetRoomParam(myPhotonRoomParam.Serialize());
                            }
                            if ((double)this.mStartWait > 0.0)
                            {
                                this.mStartWait -= Time.get_deltaTime();
                                if ((double)this.mStartWait > 0.0)
                                {
                                    return;
                                }
                                GlobalVars.SelectedQuestID  = myPhotonRoomParam.iname;
                                GlobalVars.SelectedFriendID = (string)null;
                                GlobalVars.SelectedFriend   = (FriendData)null;
                                GlobalVars.SelectedSupport.Set((SupportData)null);
                                self.Success();
                                DebugUtility.Log("StartMultiPlay: " + myPhotonRoomParam.Serialize());
                            }
                            else if ((double)this.mWait > 0.0)
                            {
                                this.mWait -= Time.get_deltaTime();
                            }
                            else
                            {
                                List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList();
                                if (this.mConfirm)
                                {
                                    using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            if (JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json).state != 3)
                                            {
                                                return;
                                            }
                                        }
                                    }
                                    this.mStartWait = 0.1f;
                                }
                                else
                                {
                                    MyPhoton.MyPlayer myPlayer = instance.GetMyPlayer();
                                    if (this.mRecvList.Count <= 0)
                                    {
                                        this.mSend.senderPlayerID = myPlayer.playerID;
                                        List <JSON_MyPhotonPlayerParam> photonPlayerParamList = new List <JSON_MyPhotonPlayerParam>();
                                        for (int index = 0; index < roomPlayerList.Count; ++index)
                                        {
                                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json);
                                            photonPlayerParamList.Add(photonPlayerParam);
                                        }
                                        photonPlayerParamList.Sort((Comparison <JSON_MyPhotonPlayerParam>)((a, b) => a.playerIndex - b.playerIndex));
                                        this.mSend.playerListJson = new FlowNode_StartMultiPlay.PlayerList()
                                        {
                                            players = photonPlayerParamList.ToArray()
                                        }.Serialize();
                                        string msg = this.mSend.Serialize();
                                        DebugUtility.Log("[PUN] send started player list: " + msg);
                                        instance.SendRoomMessage(true, msg, MyPhoton.SEND_TYPE.Normal);
                                        this.mRecvList.Add(this.mSend);
                                    }
                                    List <MyPhoton.MyEvent> events = instance.GetEvents();
                                    for (int index = events.Count - 1; index >= 0; --index)
                                    {
                                        FlowNode_StartMultiPlay.State_GameStart.RecvData jsonObject = JSONParser.parseJSONObject <FlowNode_StartMultiPlay.State_GameStart.RecvData>(events[index].json);
                                        if (jsonObject == null || jsonObject.version < this.mSend.version)
                                        {
                                            DebugUtility.LogError("[PUN] started player list version error: " + events[index].json);
                                            instance.Disconnect();
                                            return;
                                        }
                                        if (jsonObject.version <= this.mSend.version)
                                        {
                                            jsonObject.senderPlayerID = events[index].playerID;
                                            DebugUtility.Log("[PUN] recv started player list: " + events[index].json);
                                            this.mRecvList.Add(jsonObject);
                                            events.Remove(events[index]);
                                        }
                                    }
                                    // ISSUE: object of a compiler-generated type is created
                                    // ISSUE: variable of a compiler-generated type
                                    FlowNode_StartMultiPlay.State_GameStart.\u003CUpdate\u003Ec__AnonStorey217 updateCAnonStorey217 = new FlowNode_StartMultiPlay.State_GameStart.\u003CUpdate\u003Ec__AnonStorey217();
                                    using (List <MyPhoton.MyPlayer> .Enumerator enumerator = roomPlayerList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            // ISSUE: reference to a compiler-generated field
                                            updateCAnonStorey217.p = enumerator.Current;
                                            // ISSUE: reference to a compiler-generated method
                                            if (this.mRecvList.FindIndex(new Predicate <FlowNode_StartMultiPlay.State_GameStart.RecvData>(updateCAnonStorey217.\u003C\u003Em__212)) < 0)
                                            {
                                                return;
                                            }
                                        }
                                    }
                                    bool flag = true;
                                    using (List <FlowNode_StartMultiPlay.State_GameStart.RecvData> .Enumerator enumerator = this.mRecvList.GetEnumerator())
                                    {
                                        while (enumerator.MoveNext())
                                        {
                                            if (!enumerator.Current.playerListJson.Equals(this.mSend.playerListJson))
                                            {
                                                flag = false;
                                                break;
                                            }
                                        }
                                    }
                                    if (!flag)
                                    {
                                        DebugUtility.Log("[PUN] started player list is not equal. ver:" + (object)this.mSend.version);
                                        this.mRecvList.Clear();
                                        ++this.mSend.version;
                                        this.mWait = 1f;
                                    }
                                    else
                                    {
                                        DebugUtility.Log("[PUN]started player list decided. ver:" + (object)this.mSend.version);
                                        List <JSON_MyPhotonPlayerParam> myPlayersStarted = instance.GetMyPlayersStarted();
                                        myPlayersStarted.Clear();
                                        foreach (JSON_MyPhotonPlayerParam player in JSONParser.parseJSONObject <FlowNode_StartMultiPlay.PlayerList>(this.mSend.playerListJson).players)
                                        {
                                            player.SetupUnits();
                                            myPlayersStarted.Add(player);
                                        }
                                        if (instance.IsOldestPlayer())
                                        {
                                            instance.AddRoomParam("started", this.mSend.playerListJson);
                                        }
                                        if (events.Count > 0)
                                        {
                                            DebugUtility.LogError("[PUN] event must be empty.");
                                        }
                                        events.Clear();
                                        JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(myPlayer.json);
                                        photonPlayerParam.state = 3;
                                        instance.SetMyPlayerParam(photonPlayerParam.Serialize());
                                        this.mConfirm = true;
                                    }
                                }
                            }
                        }
                    }
                }
            }