public override void OnActivate(int pinID)
        {
            switch (pinID)
            {
            case 101:
                MyPhoton instance1 = PunMonoSingleton <MyPhoton> .Instance;
                if (!instance1.IsOldestPlayer())
                {
                    DebugUtility.Log("I'm not room owner");
                    this.ActivateOutputLinks(2);
                    break;
                }
                MyPhoton.MyRoom currentRoom1 = instance1.GetCurrentRoom();
                if (currentRoom1 == null)
                {
                    DebugUtility.Log("CurrentRoom is null");
                    this.ActivateOutputLinks(2);
                    break;
                }
                JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom1.json);
                if (myPhotonRoomParam == null)
                {
                    DebugUtility.Log("no roomParam");
                    this.ActivateOutputLinks(2);
                    break;
                }
                myPhotonRoomParam.challegedMTFloor = GlobalVars.SelectedMultiTowerFloor;
                myPhotonRoomParam.iname            = GlobalVars.SelectedMultiTowerID + "_" + myPhotonRoomParam.challegedMTFloor.ToString();
                instance1.SetRoomParam(myPhotonRoomParam.Serialize());
                instance1.UpdateRoomParam("floor", (object)GlobalVars.SelectedMultiTowerFloor);
                GlobalVars.SelectedQuestID = myPhotonRoomParam.iname;
                this.ActivateOutputLinks(1);
                break;

            case 102:
                MyPhoton instance2 = PunMonoSingleton <MyPhoton> .Instance;
                if (!instance2.IsOldestPlayer())
                {
                    DebugUtility.Log("I'm not room owner");
                    this.ActivateOutputLinks(2);
                    break;
                }
                MyPhoton.MyRoom currentRoom2 = instance2.GetCurrentRoom();
                if (currentRoom2 == null)
                {
                    DebugUtility.Log("CurrentRoom is null");
                    this.ActivateOutputLinks(2);
                    break;
                }
                if (JSON_MyPhotonRoomParam.Parse(currentRoom2.json) == null)
                {
                    DebugUtility.Log("no roomParam");
                    this.ActivateOutputLinks(2);
                    break;
                }
                instance2.UpdateRoomParam("Lock", (object)(GlobalVars.EditMultiPlayRoomPassCode != "0"));
                this.ActivateOutputLinks(1);
                break;
            }
        }
    private bool UpdatePendingParam()
    {
        string paramString = MonoSingleton <UrlScheme> .Instance.ParamString;

        if (string.IsNullOrEmpty(paramString))
        {
            return(false);
        }
        MonoSingleton <UrlScheme> .Instance.ParamString = (string)null;
        DebugUtility.Log("OnUrlSchemeLaunch:" + paramString);
        FlowNode_OnUrlSchemeLaunch.LINEParam lineParam = this.Analyze(paramString);
        if (lineParam == null)
        {
            return(false);
        }
        if (FlowNode_OnUrlSchemeLaunch.LINEParam_decided != null && FlowNode_OnUrlSchemeLaunch.LINEParam_decided.Equals((object)lineParam))
        {
            DebugUtility.Log("Checking param is same...");
            MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;
            if (instance.CurrentState == MyPhoton.MyState.ROOM)
            {
                DebugUtility.Log("in room.");
                MyPhoton.MyRoom        currentRoom       = instance.GetCurrentRoom();
                JSON_MyPhotonRoomParam myPhotonRoomParam = currentRoom != null?JSON_MyPhotonRoomParam.Parse(currentRoom.json) : (JSON_MyPhotonRoomParam)null;

                if (myPhotonRoomParam.isLINE == 0)
                {
                    DebugUtility.Log("not LINE.");
                }
                else if (!FlowNode_OnUrlSchemeLaunch.IsEqual(myPhotonRoomParam.iname, lineParam.iname))
                {
                    DebugUtility.Log("iname is not match.");
                }
                else if (!FlowNode_OnUrlSchemeLaunch.IsEqual(myPhotonRoomParam.creatorFUID, lineParam.creatorFUID))
                {
                    DebugUtility.Log("creatorFUID is not match.");
                }
                else if ((JSON_MyPhotonRoomParam.EType)myPhotonRoomParam.type != lineParam.type)
                {
                    DebugUtility.Log("type is not match.");
                }
                else
                {
                    DebugUtility.Log("UrlScheme MultiPlayLINE start skip. same param.");
                    return(false);
                }
            }
        }
        DebugUtility.Log("UrlScheme MultiPlayLINE start get pending." + (object)(lineParam != null));
        FlowNode_OnUrlSchemeLaunch.LINEParam_Pending = lineParam;
        return(true);
    }
        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
                    {
                        GlobalVars.SelectedMultiPlayRoomComment = GlobalVars.EditMultiPlayRoomComment;
                        myPhotonRoomParam.passCode = GlobalVars.EditMultiPlayRoomPassCode;
                        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());
                            PlayerPrefsUtility.SetString(PlayerPrefsUtility.ROOM_COMMENT_KEY, myPhotonRoomParam.comment, false);
                            this.ActivateOutputLinks(1);
                        }
                    }
                }
            }
        }
Esempio n. 4
0
    private void Update()
    {
        MyPhoton instance = PunMonoSingleton <MyPhoton> .Instance;

        if (this.mIgnore)
        {
            return;
        }
        if (instance.CurrentState != MyPhoton.MyState.ROOM)
        {
            if (instance.CurrentState != MyPhoton.MyState.NOP)
            {
                instance.Disconnect();
            }
            this.ActivateOutputLinks(1);
        }
        else
        {
            List <MyPhoton.MyPlayer> roomPlayerList = instance.GetRoomPlayerList();
            bool flag1 = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.RAID;
            bool flag2 = GlobalVars.SelectedMultiPlayRoomType == JSON_MyPhotonRoomParam.EType.VERSUS && GlobalVars.SelectedMultiPlayVersusType == VERSUS_TYPE.Friend;
            if (roomPlayerList.Find((Predicate <MyPhoton.MyPlayer>)(p => p.playerID == 1)) == null && (flag1 || flag2))
            {
                this.ActivateOutputLinks(7);
            }
            else
            {
                MyPhoton.MyRoom currentRoom = instance.GetCurrentRoom();
                if (instance.IsUpdateRoomProperty)
                {
                    if (currentRoom.start)
                    {
                        this.ActivateOutputLinks(5);
                        return;
                    }
                    instance.IsUpdateRoomProperty = false;
                }
                JSON_MyPhotonRoomParam myPhotonRoomParam = JSON_MyPhotonRoomParam.Parse(currentRoom.json);
                string str = myPhotonRoomParam != null ? myPhotonRoomParam.comment : string.Empty;
                if (!this.mRoomComment.Equals(str))
                {
                    DebugUtility.Log("change room comment");
                    this.ActivateOutputLinks(6);
                }
                this.mRoomComment = str;
                bool flag3 = false;
                if (roomPlayerList == null)
                {
                    instance.Disconnect();
                }
                else if (this.mPlayers == null)
                {
                    flag3 = true;
                }
                else if (this.mPlayers.Count != roomPlayerList.Count)
                {
                    flag3 = true;
                }
                else
                {
                    for (int index = 0; index < this.mPlayers.Count; ++index)
                    {
                        if (this.mPlayers[index].playerID != roomPlayerList[index].playerID)
                        {
                            flag3 = true;
                            break;
                        }
                        if (!this.mPlayers[index].json.Equals(roomPlayerList[index].json))
                        {
                            flag3 = true;
                            break;
                        }
                    }
                }
                if (!string.IsNullOrEmpty(this.mQuestName) && !this.mQuestName.Equals(myPhotonRoomParam.iname))
                {
                    DebugUtility.Log("change quest iname" + myPhotonRoomParam.iname);
                    this.ActivateOutputLinks(10);
                }
                this.mQuestName = myPhotonRoomParam.iname;
                if (flag3)
                {
                    this.mPlayers = new List <MyPhoton.MyPlayer>((IEnumerable <MyPhoton.MyPlayer>)roomPlayerList);
                    this.ActivateOutputLinks(2);
                    if (instance.IsOldestPlayer())
                    {
                        JSON_MyPhotonPlayerParam[] photonPlayerParamArray = new JSON_MyPhotonPlayerParam[roomPlayerList.Count];
                        for (int index = 0; index < photonPlayerParamArray.Length; ++index)
                        {
                            photonPlayerParamArray[index] = JSON_MyPhotonPlayerParam.Parse(roomPlayerList[index].json);
                        }
                        myPhotonRoomParam.players = photonPlayerParamArray;
                        instance.SetRoomParam(myPhotonRoomParam.Serialize());
                    }
                    bool flag4 = true;
                    using (List <MyPhoton.MyPlayer> .Enumerator enumerator = this.mPlayers.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            JSON_MyPhotonPlayerParam photonPlayerParam = JSON_MyPhotonPlayerParam.Parse(enumerator.Current.json);
                            if (photonPlayerParam.state == 0 || photonPlayerParam.state == 4)
                            {
                                flag4 = false;
                                break;
                            }
                        }
                    }
                    if (flag4)
                    {
                        this.ActivateOutputLinks(3);
                    }
                    else
                    {
                        this.ActivateOutputLinks(4);
                    }
                }
                else
                {
                    int count = instance.GetRoomPlayerList().Count;
                    if (count == 1 && this.mMemberCnt != count)
                    {
                        this.ActivateOutputLinks(9);
                    }
                    this.mMemberCnt = instance.GetRoomPlayerList().Count;
                    if (this.mIgnoreFullMember || instance.GetCurrentRoom().maxPlayers != count)
                    {
                        return;
                    }
                    this.ActivateOutputLinks(8);
                }
            }
        }
    }
    private void Start()
    {
        if (!Object.op_Inequality((Object)this.Target, (Object)null))
        {
            return;
        }
        string empty = string.Empty;

        MyPhoton.MyRoom currentRoom = PunMonoSingleton <MyPhoton> .Instance.GetCurrentRoom();

        JSON_MyPhotonRoomParam myPhotonRoomParam = currentRoom == null || string.IsNullOrEmpty(currentRoom.json) ? (JSON_MyPhotonRoomParam)null : JSON_MyPhotonRoomParam.Parse(currentRoom.json);
        string str = myPhotonRoomParam != null ? myPhotonRoomParam.comment : string.Empty;

        this.Target.set_text(str);
        GlobalVars.EditMultiPlayRoomComment = str;
        // ISSUE: method pointer
        ((UnityEvent <string>) this.Target.get_onEndEdit()).AddListener(new UnityAction <string>((object)this, __methodptr(\u003CStart\u003Em__1FC)));
        ((Behaviour)this).set_enabled(true);
    }