コード例 #1
0
 public override void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
     if (PhotonNetwork.LocalPlayer.ActorNumber == newMasterClient.ActorNumber)
     {
         StartGameButton.gameObject.SetActive(CheckPlayersReady());
     }
 }
コード例 #2
0
        public void SetPlayerTarget(Realtime.Player player)
        {
            //Debug.Log("SetPlayerTarget " + player);
            this._player = player;

            ContentPanel.SetActive(true);
            NotInRoomLabel.SetActive(false);

            this.ResetList();

            foreach (DictionaryEntry item in this.GetAllPlayerBuiltIntProperties())
            {
                this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.BuiltInPropertiesPanel);
            }

            // PlayerNumbering extension
            this.AddProperty("Player Number", "#" + player.GetPlayerNumber().ToString("00"), this.PlayerNumberingExtensionPanel);


            // Score extension
            this.AddProperty(PunPlayerScores.PlayerScoreProp, player.GetScore().ToString(), this.ScoreExtensionPanel);


            foreach (DictionaryEntry item in _player.CustomProperties)
            {
                this.AddProperty(ParseKey(item.Key), item.Value.ToString(), this.CustomPropertiesPanel);
            }

            MasterClientToolBar.SetActive(PhotonNetwork.CurrentRoom.PlayerCount > 1 && PhotonNetwork.LocalPlayer.IsMasterClient);
        }
コード例 #3
0
        public override void OnPlayerLeftRoom(Realtime.Player otherPlayer)
        {
            Destroy(playerListEntries[otherPlayer.ActorNumber].gameObject);
            playerListEntries.Remove(otherPlayer.ActorNumber);

            StartGameButton.gameObject.SetActive(CheckPlayersReady());
        }
 public override void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
     if (PhotonNetwork.LocalPlayer.ActorNumber == newMasterClient.ActorNumber)
     {
         StartCoroutine(SpawnAsteroid());
     }
 }
        public override void OnPlayerPropertiesUpdate(Realtime.Player targetPlayer, Hashtable changedProps)
        {
            if (changedProps.ContainsKey(AsteroidsGame.PLAYER_LIVES))
            {
                CheckEndOfGame();
                return;
            }

            if (!PhotonNetwork.IsMasterClient)
            {
                return;
            }

            if (changedProps.ContainsKey(AsteroidsGame.PLAYER_LOADED_LEVEL))
            {
                if (CheckAllPlayerLoadedLevel())
                {
                    Hashtable props = new Hashtable
                    {
                        { CountdownTimer.CountdownStartTime, (float)PhotonNetwork.Time }
                    };
                    PhotonNetwork.CurrentRoom.SetCustomProperties(props);
                }
            }
        }
 public override void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
     foreach (KeyValuePair <int, Realtime.Player> _entry in PhotonNetwork.CurrentRoom.Players)
     {
         playerCellList[_entry.Key].RefreshInfo(null);
     }
 }
        public override void OnPlayerLeftRoom(Realtime.Player otherPlayer)
        {
            //Debug.Log("OnPlayerLeftRoom isinactive " + otherPlayer.IsInactive);

            //	bool _remove = false;

            if (!PhotonNetwork.PlayerListOthers.Contains(otherPlayer))
            {
                playerCellList[otherPlayer.ActorNumber].RemoveFromList();
                playerCellList.Remove(otherPlayer.ActorNumber);
            }
            else
            {
                playerCellList[otherPlayer.ActorNumber].RefreshInfo(null);
            }

            //		_remove = otherPlayer.IsInactive && playerCellList [otherPlayer.ID].isInactiveCache;
            //
            //		if (otherPlayer.IsInactive && ! playerCellList [otherPlayer.ID].isInactiveCache) {
            //
            //			//playerCellList [otherPlayer.ID].isInactiveCache = true;
            //			playerCellList[otherPlayer.ID].RefreshInfo(null);
            //		}
            //
            //		if (_remove)
            //		{
            //			playerCellList[otherPlayer.ID].RemoveFromList ();
            //			playerCellList.Remove (otherPlayer.ID);
            //		}

            StartCoroutine("UpdateUIPing");
        }
コード例 #8
0
 /// <summary>
 /// Gets called whenever the current MasterClient has left the room and a new one is selected.
 /// If the local client is the new MasterClient, we make the UI controls available for him.
 /// </summary>
 public override void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
     seedInputField.interactable      = newMasterClient.IsLocal;
     worldSizeDropdown.interactable   = newMasterClient.IsLocal;
     clusterSizeDropdown.interactable = newMasterClient.IsLocal;
     worldTypeDropdown.interactable   = newMasterClient.IsLocal;
     generateWorldButton.interactable = newMasterClient.IsLocal;
 }
コード例 #9
0
        public override void OnPlayerPropertiesUpdate(Realtime.Player targetPlayer, Hashtable changedProps)
        {
            GameObject entry;

            if (playerListEntries.TryGetValue(targetPlayer.ActorNumber, out entry))
            {
                entry.GetComponent <Text>().text = string.Format("{0}\nScore: {1}\nLives: {2}", targetPlayer.NickName, targetPlayer.GetScore(), targetPlayer.CustomProperties[AsteroidsGame.PLAYER_LIVES]);
            }
        }
コード例 #10
0
        /// <summary>
        /// Called when a Photon Player got disconnected. We need to load a smaller scene.
        /// </summary>
        /// <param name="other">Other.</param>
        public override void OnPlayerLeftRoom(Realtime.Player other)
        {
            Debug.Log("OnPlayerLeftRoom() " + other.NickName);               // seen when other disconnects

            if (PhotonNetwork.IsMasterClient)
            {
                Debug.LogFormat("OnPlayerEnteredRoom IsMasterClient {0}", PhotonNetwork.IsMasterClient);                   // called before OnPlayerLeftRoom

                LoadArena();
            }
        }
コード例 #11
0
        public void InitializeBullet(Realtime.Player owner, Vector3 originalDirection, float lag)
        {
            Owner = owner;

            transform.forward = originalDirection;

            Rigidbody rigidbody = GetComponent <Rigidbody>();

            rigidbody.velocity  = originalDirection * 200.0f;
            rigidbody.position += rigidbody.velocity * lag;
        }
コード例 #12
0
        public override void OnPlayerEnteredRoom(Realtime.Player newPlayer)
        {
            GameObject entry = Instantiate(PlayerListEntryPrefab);

            entry.transform.SetParent(InsideRoomPanel.transform);
            entry.transform.localScale = Vector3.one;
            entry.GetComponent <PlayerListEntry>().Initialize(newPlayer.ActorNumber, newPlayer.NickName);

            playerListEntries.Add(newPlayer.ActorNumber, entry);

            StartGameButton.gameObject.SetActive(CheckPlayersReady());
        }
コード例 #13
0
ファイル: Speaker.cs プロジェクト: na0ki-ikeda/MirageMulti
 internal void OnRemoteVoiceRemove()
 {
     if (this.audioOutput != null)
     {
         this.audioOutput.Stop();
     }
     this.Actor = null;
     if (this.OnRemoteVoiceRemoveAction != null)
     {
         this.OnRemoteVoiceRemoveAction(this);
     }
 }
        public override void OnPlayerPropertiesUpdate(Realtime.Player target, ExitGames.Client.Photon.Hashtable changedProps)
        {
            if (playerCellList.ContainsKey(target.ActorNumber))
            {
                playerCellList[target.ActorNumber].RefreshInfo(changedProps);
            }
            else
            {
                Debug.LogWarning("PlayerListView: missing Player Ui Cell for " + target, this);
            }

            StartCoroutine("UpdateUIPing");
        }
        public override void OnPlayerEnteredRoom(Realtime.Player newPlayer)
        {
            //Debug.Log("PlayerListView:OnPlayerEnteredRoom:" + newPlayer);

            // we create the cell
            playerCellList[newPlayer.ActorNumber] = Instantiate(CellPrototype.gameObject).GetComponent <PlayerListCell>();
            playerCellList[newPlayer.ActorNumber].transform.SetParent(CellPrototype.transform.parent, false);
            playerCellList[newPlayer.ActorNumber].gameObject.SetActive(true);
            playerCellList[newPlayer.ActorNumber].AddToList(newPlayer, true);


            StartCoroutine("UpdateUIPing");
        }
コード例 #16
0
ファイル: SyncState.cs プロジェクト: ajinkya2020/FPS-GAME
        //        private void TransferToMountOwner(Mount mount)
        //        {
        //#if PUN_2_OR_NEWER


        //            //Debug.LogWarning(Time.time + name + " <b>TransferToMountOwner</b> " + mountPV.IsMine + " " + pv.OwnerActorNr + " " + mountOwnerId);

        //            //if (mountPV.IsMine && photonView.OwnerActorNr != mountOwnerId)
        //            {
        //                //var ownershipTransfer = photonView.OwnershipTransfer;
        //                //if (ownershipTransfer == Photon.Pun.OwnershipOption.Takeover || (ownershipTransfer == Photon.Pun.OwnershipOption.Request && photonView.IsMine))
        //                //{
        //                //    photonView.TransferOwnership(mountOwnerId);

        //                //}

        //                // TEST: Locally set ownership on apply rather than waiting for Pun2 to do it

        //                // Ownership changes are deferred, to let the current tick finish processing before changing Owner/Controller.
        //                NetMasterCallbacks.onPostSimulationActions.Enqueue(ChangeOwnerToParentMountsOwner);
        //            }
        //#endif
        //        }

        /// <summary>
        /// Deferred method that applies pending onwer changes. This is used internally.
        /// </summary>
        private void ChangeOwnerToParentMountsOwner()
        {
            if (!IsMine)
            {
                return;
            }

            if (!syncOwner)
            {
                Debug.LogWarning(name + " cannot automatically change owner without a " + typeof(SyncOwner).Name + " component.");
                return;
            }

            // We are only changing ownership if there is a mount.
            // This null test is for the edge case of throwing at the same time as colliding with another players object creates a race condition and the owner ends up being null/0
            if (currentMount == null)
            {
                return;
            }

            PhotonView mountView = currentMount.PhotonView;

            //Debug.LogError(Time.time + " DEFERRED New Owner " + (mountView ? mountView.name + ":" + mountView.Owner.ToString() : "null"));

            if (mountView)
            {
                Realtime.Player pendingOwner   = mountView.Owner;
                int             pendingOwnerId = pendingOwner == null ? 0 : pendingOwner.ActorNumber;

                //photonView.SetOwnerInternal(pendingOwner, pendingOwnerId);
                if (this.autoOwnerChange)
                {
                    this.syncOwner.TransferOwner(pendingOwnerId);
                }
            }
            else
            {
                //photonView.SetOwnerInternal(null, 0);
                if (this.autoOwnerChange)
                {
                    GetComponent <SyncOwner>().TransferOwner(0);
                }
            }

            // TEST invalidate all netobj buffers on ownership change
            //netObj.frameValidMask.SetAllFalse();
        }
        public void AddToList(Realtime.Player info, bool animate = false)
        {
            //Debug.Log("AddToList " + info.ToStringFull());

            _player = info;

            UpdateInfo();

            if (animate)
            {
                StartCoroutine("Add");
            }
            else
            {
                LayoutElement.minHeight = 30f;
            }
        }
コード例 #18
0
        public override void OnPlayerPropertiesUpdate(Realtime.Player targetPlayer, Hashtable changedProps)
        {
            if (playerListEntries == null)
            {
                playerListEntries = new Dictionary <int, GameObject>();
            }

            GameObject entry;

            if (playerListEntries.TryGetValue(targetPlayer.ActorNumber, out entry))
            {
                object isPlayerReady;
                if (changedProps.TryGetValue(AsteroidsGame.PLAYER_READY, out isPlayerReady))
                {
                    entry.GetComponent <PlayerListEntry>().SetPlayerReady((bool)isPlayerReady);
                }
            }

            StartGameButton.gameObject.SetActive(CheckPlayersReady());
        }
コード例 #19
0
        public override void OnPlayerPropertiesUpdate(Realtime.Player target, ExitGames.Client.Photon.Hashtable changedProps)
        {
            //Debug.Log("OnPlayerPropertiesUpdate " + target.ActorNumber + " " + target.ToStringFull() + " " + changedProps.ToStringFull());

            //Debug.Log("_player.ID " + _player.ActorNumber);
            if (_player.ActorNumber == target.ActorNumber)
            {
                foreach (DictionaryEntry entry in changedProps)
                {
                    string _key = this.ParseKey(entry.Key);
                    if (this.builtInPropsCellList.ContainsKey(_key))
                    {
                        this.builtInPropsCellList[_key].UpdateInfo(entry.Value.ToString());
                    }
                    else
                    {
                        this.AddProperty(_key, entry.Value.ToString(), this.CustomPropertiesPanel);
                    }
                }
            }

            StartCoroutine("UpdateUIPing");
        }
コード例 #20
0
 public override void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
     MasterClientToolBar.SetActive(_player == newMasterClient);
 }
コード例 #21
0
 public override void OnPlayerLeftRoom(Realtime.Player otherPlayer)
 {
     NotInRoomLabel.SetActive(otherPlayer == _player);
     ContentPanel.SetActive(otherPlayer != _player);
 }
コード例 #22
0
 public override void OnPlayerLeftRoom(Realtime.Player otherPlayer)
 {
     Destroy(playerListEntries[otherPlayer.ActorNumber].gameObject);
     playerListEntries.Remove(otherPlayer.ActorNumber);
 }
コード例 #23
0
 public void OnMasterClientSwitched(Realtime.Player newMasterClient)
 {
 }
コード例 #24
0
 public void OnPlayerPropertiesUpdate(Realtime.Player targetPlayer, Hashtable changedProps)
 {
 }
コード例 #25
0
 public void OnPlayerLeftRoom(Realtime.Player otherPlayer)
 {
     RemoveConnection(otherPlayer.ActorNumber);
 }
コード例 #26
0
 public void OnPlayerEnteredRoom(Realtime.Player newPlayer)
 {
     AddConnection(newPlayer.ActorNumber);
 }
 public override void OnPlayerLeftRoom(Realtime.Player otherPlayer)
 {
     CheckEndOfGame();
 }
 public void SelectPlayer(Realtime.Player player)
 {
     PlayerDetailManager.SetPlayerTarget(player);
 }