NetworkingPeer.GetActorPropertiesForActorNr C# (CSharp) Method

GetActorPropertiesForActorNr() private method

private GetActorPropertiesForActorNr ( ExitGames.Client.Photon.Hashtable actorProperties, int actorNr ) : ExitGames.Client.Photon.Hashtable
actorProperties ExitGames.Client.Photon.Hashtable
actorNr int
return ExitGames.Client.Photon.Hashtable
    private Hashtable GetActorPropertiesForActorNr(Hashtable actorProperties, int actorNr)
    {
        if (actorProperties.ContainsKey(actorNr))
        {
            return (Hashtable)actorProperties[actorNr];
        }

        return actorProperties;
    }

Usage Example

Exemplo n.º 1
0
        public static void CheckPlayersProperties(Hashtable hash, int targetActorNr, PhotonPlayer sender)
        {
            NetworkingPeer peer = PhotonNetwork.networkingPeer;

            if (peer == null || hash == null || hash.Count <= 0)
            {
                return;
            }
            if (targetActorNr > 0)
            {
                PhotonPlayer target = PhotonPlayer.Find(targetActorNr);
                if (target != null)
                {
                    Hashtable props = peer.GetActorPropertiesForActorNr(hash, targetActorNr);
                    if (target.IsLocal)
                    {
                        bool needSend = false;
                        if (sender == null || !sender.IsMasterClient)
                        {
                            if (props.ContainsKey(PhotonPlayerProperty.name))
                            {
                                string checkName = props[PhotonPlayerProperty.name] as string;
                                if (checkName == null || checkName != User.Name.Value)
                                {
                                    //TODO: Localize
                                    UI.Log.AddLineRaw($"{(sender == null ? "Someone" : $"[{sender.ID}]" + sender.UIName.ToHTMLFormat())} tried to change your name.");
                                    props[PhotonPlayerProperty.name] = User.Name.Value;
                                    needSend = true;
                                }
                            }
                            if (props.ContainsKey(PhotonPlayerProperty.guildName))
                            {
                                string checkName = props[PhotonPlayerProperty.guildName] as string;
                                if (checkName == null || checkName != User.AllGuildNames)
                                {
                                    //TODO: Localize
                                    UI.Log.AddLineRaw($"{(sender == null ? "Someone" : $"[{sender.ID}]" + sender.UIName.ToHTMLFormat())} tried to change your guildname.");
                                    props[PhotonPlayerProperty.guildName] = User.AllGuildNames;
                                    needSend = true;
                                }
                            }
                        }
                        if (needSend)
                        {
                            target.SetCustomProperties(props);
                        }
                    }
                    target.InternalCacheProperties(props);
                    NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnPhotonPlayerPropertiesChanged, new object[] { target, props });
                }
NetworkingPeer