示例#1
0
        private async void RemoteInstantiate(
            short jobId,
            short objNameStringId,
            Vector3 position,
            Quaternion rotation,
            object[] data,
            PhotonMessageInfo info)
        {
            // this logic must be executed on the master client
            if (PhotonNetwork.IsMasterClient)
            {
                string objName = await NetworkedStringManager.GetString(objNameStringId);

                GameObject result             = MasterSceneNetworkInstantiate(objName, position, rotation, data);
                PhotonView photonViewOnResult = result?.GetComponent <PhotonView>();
                int        resultPhotonViewId = 0;
                if (photonViewOnResult != null)
                {
                    resultPhotonViewId = photonViewOnResult.ViewID;
                    photonViewOnResult.TransferOwnership(info.Sender);
                }
                photonView.RPC("RemoteInstantiationFinished", RpcTarget.Others,
                               info.Sender.ActorNumber,
                               jobId,
                               resultPhotonViewId
                               );
            }
        }
        private async void SetConfiguration(short ownerId, short repositoryId)
        {
            string owner = await NetworkedStringManager.GetString(ownerId);

            string repository = await NetworkedStringManager.GetString(repositoryId);

            visualizer.Owner      = owner;
            visualizer.Repository = repository;
            visualizer.UpdateView();
        }
示例#3
0
        private async void ChatMessageReceived(short textId, PhotonMessageInfo messageInfo)
        {
            string text = await NetworkedStringManager.GetString(textId);

            ChatMessageEventArgs args = new ChatMessageEventArgs(text, messageInfo.Sender);

            if (RecordMessages)
            {
                ChatMessages.Add(args);
            }
            MessageReceived?.Invoke(this, args);
        }