SetPlayerCustomProperties() public static method

Sets this (local) player's properties. This caches the properties in PhotonNetwork.player.customProperties. CreateRoom, JoinRoom and JoinRandomRoom will all apply your player's custom properties when you enter the room. While in a room, your properties are synced with the other players. If the Hashtable is null, the custom properties will be cleared. Custom properties are never cleared automatically, so they carry over to the next room, if you don't change them.
Don't set properties by modifying PhotonNetwork.player.customProperties!
public static SetPlayerCustomProperties ( Hashtable customProperties ) : void
customProperties Hashtable Only string-typed keys will be used from this hashtable. If null, custom properties are all deleted.
return void
コード例 #1
0
ファイル: RoomBro.cs プロジェクト: Colman/Bomb-Bros
    void OnJoinedRoom()
    {
        int blueCount = 0;
        int redCount  = 0;

        foreach (PhotonPlayer player in PhotonNetwork.playerList)
        {
            if (!player.Equals(PhotonNetwork.player))
            {
                if ((bool)player.CustomProperties["isBlue"])
                {
                    blueCount++;
                }
                else
                {
                    redCount++;
                }
            }
        }
        ExitGames.Client.Photon.Hashtable props = new ExitGames.Client.Photon.Hashtable();
        props.Add("isBlue", redCount >= blueCount);

        PhotonNetwork.SetPlayerCustomProperties(props);
        if (PlayerPrefs.GetString("DisplayName") == "")
        {
            int ranNum = (int)Mathf.Floor(Random.value * 1000);
            PlayerPrefs.SetString("DisplayName", "Player" + ranNum);
            PlayerPrefs.Save();
        }
        PhotonNetwork.playerName = PlayerPrefs.GetString("DisplayName");
        gameObject.SetActive(false);
        roomWait.SetActive(true);
        roomWait.GetComponent <PhotonView>().RPC("ChangeNames", PhotonTargets.All);
    }
コード例 #2
0
ファイル: Launcher.cs プロジェクト: JeongTaeLee/ProjectG
    public void MatchingStart(MatchOption matchType)
    {
        PlayerManager.Instance.CurrentMatchType = matchType;

        if (matchType == MatchOption.Match_None)
        {
            return;
        }

        if (matchType == MatchOption.Match_Debug)
        {
            MatchingDebug();
            return;
        }

        PhotonHashTable playerProperties = new PhotonHashTable
        {
            { PlayerProperties.CHARACTER.ToString().ToString(), PlayerManager.Instance.CharacterType.ToString() },
            { PlayerProperties.SPAWNPOS.ToString().ToString(), 0 },
            { PlayerProperties.TEAM.ToString(), TeamOption.NoneTeam }
        };

        PhotonNetwork.SetPlayerCustomProperties(playerProperties);

        PhotonHashTable roomProperties
            = new PhotonHashTable()
            {
            { RoomPropoerties.MATCHTYPE.ToString(), PlayerManager.Instance.CurrentMatchType }
            };

        PhotonNetwork.JoinRandomRoom(roomProperties, 0);
    }
コード例 #3
0
ファイル: StartPhoton.cs プロジェクト: hayaken8112/VRVTS
    public void CreatePhotonRoom()
    {
        roomName = roomNameIF.text;
        string password = createPasswordIF.text;

        PhotonNetwork.autoCleanUpPlayerObjects = false;
        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        //customProp.Add ("userName", userName); //ユーザ名
        customProp.Add("roomName", roomName);  //ルーム名
        PhotonNetwork.SetPlayerCustomProperties(customProp);

        RoomOptions roomOptions = new RoomOptions();

        roomOptions.customRoomProperties = customProp;
        //ロビーで見えるルーム情報としてカスタムプロパティのuserName,userIdを使いますよという宣言
        roomOptions.customRoomPropertiesForLobby = new string[] { "roomName" };
        roomOptions.maxPlayers = 10;   //部屋の最大人数
        roomOptions.isOpen     = true; //入室許可する
        roomOptions.isVisible  = true; //ロビーから見えるようにする
        Debug.Log("room名:" + roomName);
        //Photonサーバーに送信するルーム名前はパスワード付き
        if (!string.IsNullOrEmpty(password))
        {
            roomName += "_" + password;
        }
        Debug.Log(roomName);
        //userIdが名前のルームがなければ作って入室、あれば普通に入室する。
        PhotonNetwork.JoinOrCreateRoom(roomName, roomOptions, null);
    }
コード例 #4
0
    // Start is called before the first frame update
    void Start()
    {
        anim1Instanciated = false;
        anim2Instanciated = false;
        dashAnim1.SetActive(false);
        dashAnim2.SetActive(false);

        Hashtable hash = new Hashtable();

        hash.Add("boat1Dash", false);
        hash.Add("boat2Dash", false);
        PhotonNetwork.SetPlayerCustomProperties(hash);

        Vector3 boat1Position = new Vector3(-1.7f, -3.2f, 0);
        Vector3 boat2Position = new Vector3(1.7f, -3.2f, 0);

        if (PhotonNetwork.IsMasterClient)
        {
            PhotonNetwork.Instantiate(playerPrefab.name, boat1Position, Quaternion.identity);
        }
        else if (!PhotonNetwork.IsMasterClient)
        {
            PhotonNetwork.Instantiate(player2Prefab.name, boat2Position, Quaternion.identity);
        }
    }
コード例 #5
0
ファイル: PhotonRoom.cs プロジェクト: hayaken8112/VRVTS
    //Roomが存在せず、入室に失敗した時に呼ばれるメソッド
    void OnPhotonRandomJoinFailed()
    {
        //Roomを作成するメソッド
        //同一名のRoomが存在する場合は失敗する。
        //マスターサーバーでのみ呼び出し可能。
        //固有のルームメイを作成しない場合は、nullにする。
        //Roomの作成に成功した場合は、OnCreateRoomとOnJoinedRoomコールバックを呼び出す。
        //PhotonNetwork.CreateRoom(null);

        Debug.Log("なのでおそらくこのメソッドが呼ばれる");

        string userName = "******";
        string userId   = "user1";

        PhotonNetwork.autoCleanUpPlayerObjects = false;
        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        customProp.Add("userName", userName); //ユーザ名
        customProp.Add("userId", userId);     //ユーザID
        PhotonNetwork.SetPlayerCustomProperties(customProp);

        RoomOptions roomOptions = new RoomOptions();

        roomOptions.customRoomProperties = customProp;
        //ロビーで見えるルーム情報としてカスタムプロパティのuserName,userIdを使いますよという宣言
        roomOptions.customRoomPropertiesForLobby = new string[] { "userName", "userId" };
        roomOptions.maxPlayers = 2;    //部屋の最大人数
        roomOptions.isOpen     = true; //入室許可する
        roomOptions.isVisible  = true; //ロビーから見えるようにする
        //userIdが名前のルームがなければ作って入室、あれば普通に入室する。
        PhotonNetwork.JoinOrCreateRoom(userId, roomOptions, null);
    }
コード例 #6
0
        public void PlayerCharacterDied()
        {
            if (playerProps.Script &&
                playerProps.Script.photonView.IsMine &&
                playerProps.Script.currentState == CharacterState.Dead)
            {
                Hashtable NewSetting = new Hashtable();
                NewSetting.Add("Alive", false);
                PhotonNetwork.SetPlayerCustomProperties(NewSetting);
                //Setup Camera To Follow Teammate
                foreach (var character in CharacterList)
                {
                    if (character == playerProps.Script)
                    {
                        continue;
                    }

                    if (character.TeamID == playerProps.Script.TeamID)
                    {
                        CameraController.SetTarget(character.gameObject);
                        break;
                    }
                }
                if (PhotonNetwork.IsMasterClient)
                {
                    CheckGameEnded();
                }
            }
        }
コード例 #7
0
ファイル: LocalManager.cs プロジェクト: yyl893653496/FPS
    private void Start()
    {
        photonView = GetComponent <PhotonView>();
        if (photonView.IsMine)
        {
            gameObject.AddComponent <AudioListener>();
            Cursor.visible   = false;
            Cursor.lockState = CursorLockMode.Locked;
            return;
        }

        FPArms.SetActive(false);
        FP_Camera.enabled  = false;
        ENV_Camera.enabled = false;
        foreach (MonoBehaviour behaviour in LocalScripts)
        {
            behaviour.enabled = false;
        }

        foreach (Renderer tpRenderer in TPRenderers)
        {
            tpRenderer.shadowCastingMode = ShadowCastingMode.On;
        }
        Hashtable tmp_hashtable = new Hashtable();

        tmp_hashtable.Add("Weapon", "M4");
        PhotonNetwork.SetPlayerCustomProperties(tmp_hashtable);
    }
コード例 #8
0
    public void getPlayersScores()
    {
        //playerList[0] is master client
        int t1P1Index = (int)PhotonNetwork.PlayerList[0].CustomProperties["t1P1Index"];
        int t1P2Index = (int)PhotonNetwork.PlayerList[0].CustomProperties["t1P2Index"];
        //Debug.Log("TEAM 1 INDEXES ARE: " + t1P1Index + " and " + t1P2Index);

        int t2P1Index = (int)PhotonNetwork.PlayerList[0].CustomProperties["t2P1Index"];
        int t2P2Index = (int)PhotonNetwork.PlayerList[0].CustomProperties["t2P2Index"];
        //Debug.Log("TEAM 2 INDEXES ARE: " + t2P1Index + " and " + t2P2Index);

        int userIndex = PhotonNetwork.LocalPlayer.ActorNumber;

        if ((userIndex == t1P1Index) || (userIndex == t1P2Index))
        {
            t1ScoreText.color     = Color.red;
            t1ScoreText.fontStyle = FontStyle.BoldAndItalic;
        }
        if ((userIndex == t2P1Index) || (userIndex == t2P2Index))
        {
            t2ScoreText.color     = Color.red;
            t2ScoreText.fontStyle = FontStyle.BoldAndItalic;
        }

        string t1P1Name = PhotonNetwork.PlayerList[t1P1Index].NickName;
        string t1P2Name = PhotonNetwork.PlayerList[t1P2Index].NickName;
        string t2P1Name = PhotonNetwork.PlayerList[t2P1Index].NickName;
        string t2P2Name = PhotonNetwork.PlayerList[t2P2Index].NickName;

        Debug.Log("NAMES:" + t1P1Name + "  " + t1P2Name + " " + t2P1Name + " " + t2P2Name);

        int t1P1Score = (int)PhotonNetwork.PlayerList[t1P1Index].CustomProperties["score"];
        int t1P2Score = (int)PhotonNetwork.PlayerList[t1P2Index].CustomProperties["score"];
        int t2P1Score = (int)PhotonNetwork.PlayerList[t2P1Index].CustomProperties["score"];
        int t2P2Score = (int)PhotonNetwork.PlayerList[t2P2Index].CustomProperties["score"];

        Debug.Log("T1P1 SCORE: " + t1P1Score + "T1P2 SCORE: " + t1P2Score + "T2P1 SCORE: " + t2P1Score + "T2P2 SCORE: " + t2P2Score);

        int team1Score = t1P1Score + t1P2Score;
        int team2Score = t2P1Score + t2P2Score;

        Debug.Log("Team1 Score:" + team1Score + "and Team2 Score: " + team2Score);

        t1ScoreText.text = "Team 1: " + team1Score;
        t2ScoreText.text = "Team 2: " + team2Score;

        Hashtable hash = new Hashtable();

        hash.Add("t1P1Name", t1P1Name);
        hash.Add("t1P2Name", t1P2Name);
        hash.Add("t2P1Name", t2P1Name);
        hash.Add("t2P2Name", t2P2Name);
        hash.Add("t1P1Score", t1P1Score);
        hash.Add("t1P2Score", t1P2Score);
        hash.Add("t2P1Score", t2P1Score);
        hash.Add("t2P2Score", t2P2Score);
        hash.Add("team1Score", team1Score);
        hash.Add("team2Score", team2Score);
        PhotonNetwork.SetPlayerCustomProperties(hash);
    }
コード例 #9
0
        public bool JoinRoom(string roomName, string playerJson, bool isResume = false)
        {
            if (this.mState != MyPhoton.MyState.LOBBY)
            {
                this.mError = MyPhoton.MyError.ILLEGAL_STATE;
                return(false);
            }
            PhotonNetwork.player.SetCustomProperties((Hashtable)null, (Hashtable)null, false);
            PhotonNetwork.SetPlayerCustomProperties((Hashtable)null);
            this.SetMyPlayerParam(playerJson);
            bool flag;

            if (isResume)
            {
                flag = PhotonNetwork.JoinRoom(roomName);
            }
            else
            {
                Hashtable expectedCustomRoomProperties = new Hashtable();
                ((Dictionary <object, object>)expectedCustomRoomProperties).Add((object)"name", (object)roomName);
                ((Dictionary <object, object>)expectedCustomRoomProperties).Add((object)"start", (object)false);
                flag = PhotonNetwork.JoinRandomRoom(expectedCustomRoomProperties, (byte)0);
            }
            if (flag)
            {
                this.mState = MyPhoton.MyState.JOINING;
            }
            else
            {
                this.mError = MyPhoton.MyError.UNKNOWN;
            }
            return(flag);
        }
コード例 #10
0
    // Update is called once per frame
    void Update()
    {
        Player p1 = PhotonNetwork.PlayerList[0];
        Player p2 = PhotonNetwork.PlayerList[1];


        if ((bool)p1.CustomProperties["LeftObstacleCollided"] == true)
        {
            Debug.Log("LEFT OBS COLLIDED");
            breakAnim.SetActive(false);
            breakAnim.SetActive(true);
            float breakAnimPos = (float)p1.CustomProperties["LeftObstacleCollidePos"];
            breakAnim.transform.position = new Vector2(breakAnimPos, breakAnim.transform.position.y);

            Hashtable hash = new Hashtable();
            hash.Add("LeftObstacleCollided", false);
            PhotonNetwork.SetPlayerCustomProperties(hash);
        }
        if ((bool)p2.CustomProperties["RightObstacleCollided"] == true)
        {
            Debug.Log("RIGHT OBS COLLIDED");
            breakAnim2.SetActive(false);
            breakAnim2.SetActive(true);
            float breakAnimPos = (float)p2.CustomProperties["RightObstacleCollidePos"];
            breakAnim2.transform.position = new Vector2(breakAnimPos, breakAnim.transform.position.y);

            Hashtable hash = new Hashtable();
            hash.Add("RightObstacleCollided", false);
            PhotonNetwork.SetPlayerCustomProperties(hash);
        }
    }
コード例 #11
0
    public void DoBet()
    {
        if ((int)PhotonNetwork.LocalPlayer.CustomProperties["bet"] != 0 || (int)PhotonNetwork.CurrentRoom.CustomProperties["phase"] == 2 || (int)PhotonNetwork.CurrentRoom.CustomProperties["phase"] == 4)
        {
            return;
        }
        byte evCode = 66;

        CasinoWarPlayer player = PlayerSingleton.GetPlayer();

        player.setBet(100);
        player.setActorNumber(PhotonNetwork.LocalPlayer.ActorNumber);
        PhotonNetwork.SetPlayerCustomProperties(new Hashtable()
        {
            { "bet", 100 }
        });

        string playerString = JsonUtility.ToJson(player);

        UpdatePlayerGui(PhotonNetwork.LocalPlayer);

        Debug.Log(playerString);
        RaiseEventOptions raiseEventOptions = new RaiseEventOptions {
            Receivers = ReceiverGroup.All
        };                                                                                             // You would have to set the Receivers to All in order to receive this event on the local client as well
        SendOptions sendOptions = new SendOptions {
            Reliability = true
        };

        PhotonNetwork.RaiseEvent(evCode, playerString, raiseEventOptions, sendOptions);
    }
コード例 #12
0
    //ルームクリエイト
    public void CreateRoom(string roomName = GAMEROOM_NAME)
    {
        Debug.Log(string.Format("CreateRoom({0})", roomName));

        //UserIdを1に設定
        string userId = "001";

        GlobalGameManager._instance.UserId = 1;
        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        customProp.Add("roomName", roomName);
        customProp.Add("roomOwnerId", userId);

        PhotonNetwork.SetPlayerCustomProperties(customProp);

        //カスタムプロパティをルームのオプションに設定
        RoomOptions roomOptions = new RoomOptions();

        roomOptions.CustomRoomProperties         = customProp;
        roomOptions.CustomRoomPropertiesForLobby = new string[] { "roomName", "roomNameID" };

        roomOptions.MaxPlayers = (byte)GAMEROOM_LIMIT;

        roomOptions.IsOpen    = true;     //入室を許可するか否か
        roomOptions.IsVisible = true;     //ロビーから見えるようにする

        PhotonNetwork.CreateRoom(roomName, roomOptions, null);

        isRoomMake = true;
        StartCoroutine(WaitOtherPlayer(roomName));

        PhotonText.text = string.Format("ルームを作りました\nチーム名:{0}", roomName);
    }
コード例 #13
0
    //ルーム作成
    public void CreateRoom()
    {
        //actID = 0;
        GameObject.Find("MultiGameController").GetComponent <MultiGameControl>().actID++;
        actID = GameObject.Find("MultiGameController").GetComponent <MultiGameControl>().actID;
        //photonPlayer = new PhotonPlayer(false, actID, userName);


        //string userName = "******";
        //string userId = "user1";
        //userName[0] = "ユーザ1";
        PhotonNetwork.autoCleanUpPlayerObjects = false;

        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        customProp.Add("userName", userName);     //ユーザ名
        customProp.Add("userId", userId);         //ユーザID
        PhotonNetwork.SetPlayerCustomProperties(customProp);

        RoomOptions roomOptions = new RoomOptions();

        roomOptions.customRoomProperties = customProp;
        //ロビーで見えるルーム情報としてカスタムプロパティのuserName,userIdを使いますよという宣言
        roomOptions.customRoomPropertiesForLobby = new string[] { "userName", "userId" };
        roomOptions.maxPlayers = 2;        //部屋の最大人数
        roomOptions.isOpen     = true;     //入室許可する
        roomOptions.isVisible  = true;     //ロビーから見えるようにする
        //userIdが名前のルームがなければ作って入室、あれば普通に入室する。
        PhotonNetwork.JoinOrCreateRoom(userId, roomOptions, null);

        GameObject.Find("CreateRoomBtn").GetComponent <Button>().interactable = false;
        GameObject.Find("EnterRoomBtn").GetComponent <Button>().interactable  = false;
    }
コード例 #14
0
    private void EnterBed()
    {
        if (!DaytimeController.Instance.IsDaytime)
        {
            playerInBed = PlayerNetwork.LocalPlayer;
            playerInBed.GetComponent <PlayerMovementController>().IsFrozen = true;
            playerInBed.GetComponent <PlayerCombatController>().TogglePlayerModel(false);
            photonView.RPC(nameof(RPC_BedFeed), PhotonTargets.All, PhotonNetwork.player.NickName);
            photonView.RPC(nameof(RPC_EnterBed), PhotonTargets.AllBuffered);

            ExitGames.Client.Photon.Hashtable inBed = new ExitGames.Client.Photon.Hashtable()
            {
                { "inBed", true }
            };
            PhotonNetwork.SetPlayerCustomProperties(inBed);

            if (AllPlayersInBed())
            {
                DaytimeController.Instance.CurrentTime = DaytimeController.Instance.CurrentTime + new System.TimeSpan(DaytimeController.Instance.NightDuration, 0, 0);
            }
        }
        else
        {
            FeedUI.Instance.AddFeedItem("Its daytime you fool!", feedType: FeedItem.Type.Fail);
        }
    }
コード例 #15
0
    void UpdateResultGui(CasinoWarPlayer player)
    {
        Hashtable table = (Hashtable)PhotonNetwork.CurrentRoom.CustomProperties["table"];
        Text      actorField;

        for (int seat = 1; seat <= 5; seat++)
        {
            if ((int)table[seat] == player.getActorID())
            {
                actorField      = Seats.transform.GetChild(ComputeSlot(seat)).GetChild(1).gameObject.GetComponent <Text>();
                actorField.text = "Card: " + player.getMycard().ToString() +
                                  "\nWin Result: " + player.getResult();
            }
        }
        if (player.getActorID() == PhotonNetwork.LocalPlayer.ActorNumber)
        {
            if (player.getResult() == 2)
            {
                WarButton.gameObject.SetActive(true);
            }
            PlayerSingleton.GetPlayer().setCredit(player.getNewCredit());
            PhotonNetwork.SetPlayerCustomProperties(new Hashtable()
            {
                { "credit", player.getNewCredit() }
            });
            UpdatePlayerGui(PhotonNetwork.LocalPlayer);
            UpdateUserInfoText();
            // UpdatePlayerGui(PhotonNetwork.LocalPlayer);
        }
    }
コード例 #16
0
    public void GetUserDataSuccess(GetUserDataResult result)
    {
        if (result.Data.ContainsKey("Weapon"))
        {
            Debug.Log("Weapon data obtained successfully!");

            receivedWeaponData = result.Data["Weapon"].Value;

            if (result.Data.ContainsKey("MissionComplete") && result.Data.ContainsKey("Deaths"))
            {
                Debug.Log("MissionComplete and Deaths data obtained successfully");
                receivedMissionCompleteData = result.Data["MissionComplete"].Value;
                receivedDeathsData          = result.Data["Deaths"].Value;
            }
            else
            {
                UpdateUserData();
                GetUserData();
            }

            ActivatePanel(createRoomPanel);

            ExitGames.Client.Photon.Hashtable hash = new ExitGames.Client.Photon.Hashtable();

            hash.Add("Weapon", receivedWeaponData);
            hash.Add("MissionComplete", receivedMissionCompleteData);
            hash.Add("Deaths", receivedDeathsData);

            PhotonNetwork.SetPlayerCustomProperties(hash);
        }
        else
        {
            ActivatePanel(dataPanel);
        }
    }
コード例 #17
0
 // The function is called when we join the room
 public override void OnJoinedRoom()
 {
     customProps[CommandManager.PROPS.READY_PLAYER_STATUS] = false;
     PhotonNetwork.SetPlayerCustomProperties(customProps);
     OpenRoom();
     playerListing.GetCurrentRoomPlayers();
 }
コード例 #18
0
    //ルーム作成
    public void CreateRoom()
    {
        // TODO サーバから引っ張る
        string userName = "******";
        string userId   = "user1";

        PhotonNetwork.autoCleanUpPlayerObjects = false;

        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        customProp.Add("userName", userName); //ユーザ名
        customProp.Add("userId", userId);     //ユーザID
        PhotonNetwork.SetPlayerCustomProperties(customProp);

        RoomOptions roomOptions = new RoomOptions();

        roomOptions.CustomRoomProperties = customProp;
        //ロビーで見えるルーム情報としてカスタムプロパティのuserName,userIdを使いますよという宣言
        roomOptions.CustomRoomPropertiesForLobby = new string[] { "userName", "userId" };
        roomOptions.MaxPlayers = 4;    //部屋の最大人数
        roomOptions.IsOpen     = true; //入室許可する
        roomOptions.IsVisible  = true; //ロビーから見えるようにする
        //userIdが名前のルームがなければ作って入室、あれば普通に入室する。
        PhotonNetwork.JoinOrCreateRoom(userId, roomOptions, null);
    }
コード例 #19
0
    public override void OnJoinedRoom()
    {
        if (PhotonNetwork.CurrentRoom.Name == "Highway")
        {
            createRoomHighway.interactable = false;
            loadingPanel.SetActive(true);
            MainMenuManager.manage.LoadEngineUpgradeOnSelectedCar();
            MainMenuManager.manage.LoadHandlingOnSelectedCar();
            MainMenuManager.manage.LoadBrakeOnSelectedCar();
            Hashtable playerCustomProps = new Hashtable();
            playerCustomProps.Add("Role", 2);
            PhotonNetwork.SetPlayerCustomProperties(playerCustomProps);
            print("Highway");
            PhotonNetwork.LoadLevel("battle_online");
        }
        else if (PhotonNetwork.CurrentRoom.Name == "City")
        {
            createRoomCity.interactable = false;
            loadingPanel.SetActive(true);
            MainMenuManager.manage.LoadEngineUpgradeOnSelectedCar();
            MainMenuManager.manage.LoadHandlingOnSelectedCar();
            MainMenuManager.manage.LoadBrakeOnSelectedCar();
            isCityOnline = true;
            print(PhotonNetwork.CurrentRoom);
            LoadAssetsBundle.manage.loadingPanel.SetActive(false);
            PhotonNetwork.LoadLevel("city_online");
        }

        Time.timeScale = 1;
    }
コード例 #20
0
        public bool JoinRandomRoom(byte maxplayer, string playerJson, string VersusHash, string roomName = null)
        {
            PhotonNetwork.player.SetCustomProperties((Hashtable)null, (Hashtable)null, false);
            PhotonNetwork.SetPlayerCustomProperties((Hashtable)null);
            this.SetMyPlayerParam(playerJson);
            Hashtable hashtable = new Hashtable();

            ((Dictionary <object, object>)hashtable).Add((object)"MatchType", (object)VersusHash);
            Hashtable expectedCustomRoomProperties = hashtable;

            if (!string.IsNullOrEmpty(roomName))
            {
                ((Dictionary <object, object>)expectedCustomRoomProperties).Add((object)"name", (object)roomName);
            }
            bool flag = PhotonNetwork.JoinRandomRoom(expectedCustomRoomProperties, maxplayer);

            if (flag)
            {
                this.mState = MyPhoton.MyState.JOINING;
            }
            else
            {
                this.mError = MyPhoton.MyError.UNKNOWN;
            }
            return(flag);
        }
コード例 #21
0
    //ルーム作成
    public void CreateRoom()
    {
        string userName = PlayerPrefs.GetString("userName", "ナナシ");

        PhotonNetwork.autoCleanUpPlayerObjects = false;
        //カスタムプロパティ
        ExitGames.Client.Photon.Hashtable customProp = new ExitGames.Client.Photon.Hashtable();
        customProp.Add("userName", userName); //ユーザ名
        PhotonNetwork.SetPlayerCustomProperties(customProp);

        RoomOptions roomOptions = new RoomOptions();

        roomOptions.customRoomProperties = customProp;
        //ロビーで見えるルーム情報としてカスタムプロパティのuserNameを使いますよという宣言
        roomOptions.customRoomPropertiesForLobby = new string[] { "userName" };
        roomOptions.maxPlayers = 2;    //部屋の最大人数
        roomOptions.isOpen     = true; //入室許可する
        roomOptions.isVisible  = true; //ロビーから見えるようにする
        //userNameが名前のルームがなければ作って入室、あれば普通に入室する。
        PhotonNetwork.JoinOrCreateRoom(userName, roomOptions, null);
        //ルームに入ったらロビー関連ボタンは消去
        for (int i = 0; i < ROOM_NUM; i++)
        {
            objRoom[i].SetActive(false);
        }
        objMakeRoomButton.SetActive(false);
        GameObject.Find("TitleText").GetComponent <Text>().text = "タイセンシャ\n   サンセンマチ";
        objBackLobbyButton.SetActive(true);
    }
コード例 #22
0
        void Update()
        {
            /*
             * If we have been assigned our local toggle,
             * update it based on user input
             */
            if (mLocalToggle != null)
            {
                if (InputWrapper.Instance.SubmitPressed && !mPlayerReady)
                {
                    mLocalToggle.ToggleReadyPlayer(true);
                    mPhotonView.RPC("IncrementReadyCount", PhotonTargets.AllBuffered);
                    PhotonNetwork.SetPlayerCustomProperties(
                        new PhotonHashtable {
                        { IS_READY_KEY, true }
                    });
                    mPlayerReady = true;
                }
                if (InputWrapper.Instance.CancelPressed)
                {
                    if (mPlayerReady)
                    {
                        mLocalToggle.ToggleReadyPlayer(false);
                        mPhotonView.RPC("DecrementReadyCount", PhotonTargets.AllBuffered);
                        PhotonNetwork.SetPlayerCustomProperties(
                            new PhotonHashtable {
                            { IS_READY_KEY, false }
                        });
                        mPlayerReady = false;
                    }

                    else
                    {
                        Utility.BackToStartMenu();
                    }
                }
            }

            /*
             * Manage the countdown timer based on the number of players that have readied up
             */
            if (mNumReadyPlayers == PhotonNetwork.playerList.Length)
            {
                mUICountdown.SetActive(true);
                if (mTimer <= 0)
                {
                    StartGame();
                    return;
                }
                mCountdownText.text = "Game starting in... " + ((int)Mathf.Ceil(mTimer)).ToString();
                mTimer -= Time.deltaTime;
            }
            else
            {
                mUICountdown.SetActive(false);
                mCountdownStarted = false;
                mTimer            = COUNTDOWN_TIME;
            }
        }
コード例 #23
0
ファイル: PlayerInfos.cs プロジェクト: Madylune/jelly-hammer
    public void OnSelectCharacter(string name)
    {
        characterName = name;
        PlayerPrefs.SetString(selectedCharacter, name);

        PhotonNetwork.SetPlayerCustomProperties(_playerCustomProps);
        _playerCustomProps["PlayerSprite"] = name;
    }
コード例 #24
0
        public void SetProperties(string name, double rating)
        {
            var properties = new Hashtable();

            properties.Add("Name", name);
            properties.Add("Rating", rating);
            PhotonNetwork.SetPlayerCustomProperties(properties);
        }
コード例 #25
0
    private void SetAbility(int y)    //Sets ability choice for this player across the network
    {
        int       abilityChoice = y;
        Hashtable hash          = new Hashtable();

        hash.Add("abilityChoice", abilityChoice);
        PhotonNetwork.SetPlayerCustomProperties(hash);
    }
コード例 #26
0
 private void setProperty(string key, object value)
 {
     ExitGames.Client.Photon.Hashtable costomProperties = new ExitGames.Client.Photon.Hashtable()            //初始化玩家自定义属性
     {
         { key, value }
     };
     PhotonNetwork.SetPlayerCustomProperties(costomProperties);
 }
コード例 #27
0
 private void SetPlayerProperties()
 {
     _customProperties.Clear();
     _customProperties.Add("level", SavedData.Level());
     _customProperties.Add("kills", 0);
     _customProperties.Add("id", PlayerID);
     PhotonNetwork.SetPlayerCustomProperties(_customProperties);
 }
コード例 #28
0
 void Start()
 {
     hashtable = new ExitGames.Client.Photon.Hashtable()
     {
         { "Reday", Readycheck() }, { "", "" }
     };
     PhotonNetwork.SetPlayerCustomProperties(hashtable);
 }
コード例 #29
0
 public void SetPlayerProperties()
 {
     ExitGames.Client.Photon.Hashtable PlayerCustomProps = new ExitGames.Client.Photon.Hashtable();
     CustomProps["monto"]    = Parametros.param.monto;
     CustomProps["precio"]   = Parametros.param.precio;
     CustomProps["ganancia"] = Parametros.param.ganancia;
     PhotonNetwork.SetPlayerCustomProperties(CustomProps);
 }
コード例 #30
0
    public void SetProfile(string imgPath)
    {
        string    fileName  = imgPath.Replace(Application.streamingAssetsPath, "");
        Hashtable hashtable = new Hashtable();

        hashtable.Add("fileName", fileName);
        PhotonNetwork.SetPlayerCustomProperties(hashtable);
    }