public void OnPhotonCustomRoomPropertiesChanged(Hashtable propertiesThatChanged)
        {
            string prop = property.GetValue(null);

            if ((!string.IsNullOrEmpty(prop) && propertiesThatChanged.ContainsKey(prop)) || string.IsNullOrEmpty(prop))
            {
                this.ExecuteTrigger(gameObject);
            }
        }
        public void OnPlayerPropertiesUpdate(Player player, Hashtable props)
        {
            if (props.ContainsKey(PlayerProperties.PING))
            {
                return;
            }

            bool canExecute = true;

            Player tplayer = this.targetPlayer.GetPhotonPlayer(gameObject);

            if (tplayer != null && tplayer != player)
            {
                canExecute = false;
            }
            if (property != null && !string.IsNullOrEmpty(property.GetValue(null)) && !props.ContainsKey(property.GetValue(null)))
            {
                canExecute = false;
            }

            if (canExecute)
            {
                this.ExecuteTrigger(gameObject);
            }
        }
Exemple #3
0
        // PUBLIC METHODS: ------------------------------------------------------------------------

        public string GetValue()
        {
            string result = null;

            switch (this.target)
            {
            case Target.Input:
                result = input.text;
                break;

            case Target.Text:
                result = text.text;
                break;

            case Target.String:
                result = stringProperty.GetValue(null);
                break;

            case Target.Random:
                result = prefix.GetValue(null) + UnityEngine.Random.Range(0, 1000);
                break;
            }

            return(result);
        }
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            RoomOptions roomOptions = new RoomOptions()
            {
            };

            roomOptions.MaxPlayers    = (byte)maxPlayers.GetValue(target);
            roomOptions.PublishUserId = true;
            return(PhotonNetwork.JoinOrCreateRoom(string.IsNullOrEmpty(roomName.GetValue(target)) ? null : roomName.GetValue(target), roomOptions, TypedLobby.Default));
        }
Exemple #5
0
        private bool IsSelected(List <MutableObject> entry)
        {
            if (!StringArgument.CouldResolve(entry))
            {
                return(false);
            }

            return(StringArgument.GetValue(entry)
                   == StringProperty.GetValue(entry));
        }
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index, params object[] parameters)
        {
            if (!string.IsNullOrEmpty(gameVersion.GetValue(target)))
            {
                PhotonNetwork.GameVersion = gameVersion.GetValue(target);
            }

            bool result = false;

            switch (method)
            {
            case ConnectType.UsingSettings: result = PhotonNetwork.ConnectUsingSettings(); break;

            case ConnectType.Region: result = PhotonNetwork.ConnectToRegion(GetRegionCode(region)); break;

            case ConnectType.BestCloudServer: result = PhotonNetwork.ConnectToBestCloudServer(); break;
            }
            return(result);
        }
Exemple #7
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override IEnumerator Execute(GameObject target, IAction[] actions, int index)
        {
            RoomOptions roomOptions = new RoomOptions()
            {
            };

            roomOptions.PublishUserId = true;
            roomOptions.MaxPlayers    = (byte)((float)maxPlayers.GetValue(target));
            roomOptions.PlayerTtl     = playerTTL.GetValue(target);
            PhotonNetwork.CreateRoom(string.IsNullOrEmpty(roomName.GetValue(target)) ? null : roomName.GetValue(target), roomOptions, TypedLobby.Default);
            yield return(0);
        }
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (PhotonNetwork.InRoom)
            {
                Room room = PhotonNetwork.CurrentRoom;

                if (permission == Permission.MasterClient && !PhotonNetwork.IsMasterClient)
                {
                    return(true);
                }

                switch (variableType)
                {
                case VariableType.Int:
                    if (operation == Operation.Set)
                    {
                        room.SetInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                    }
                    else
                    {
                        room.AddInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                    }
                    break;

                case VariableType.Float:
                    if (operation == Operation.Set)
                    {
                        room.SetFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                    }
                    else
                    {
                        room.AddFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                    }
                    break;

                case VariableType.String:
                    room.SetString(propertyName.GetValue(target), stringValue.GetValue(target), webForward);
                    break;

                case VariableType.Bool:
                    room.SetBool(propertyName.GetValue(target), boolValue.GetValue(target), webForward);
                    break;
                }
            }
            else
            {
                Debug.LogWarning("You need to be inside a room in order to change a Room property.", gameObject);
            }
            return(true);
        }
Exemple #9
0
        private bool IsSelected(List <MutableObject> entry, IEnumerable <string> tokens)
        {
            if (!StringArgument.CouldResolve(entry))
            {
                return(false);
            }

            foreach (var t in tokens)
            {
                var str = StringProperty.GetValue(entry);

                if (str.StartsWith(t, true, CultureInfo.InvariantCulture))
                {
                    return(true);
                }
            }

            return(false);
        }
Exemple #10
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            if (PhotonNetwork.InRoom)
            {
                Player player = this.target.GetPhotonPlayer(target);

                if (player == null)
                {
                    return(true);
                }
                if (permission == Permission.LocalPlayer && !player.IsLocal)
                {
                    return(true);
                }
                if (permission == Permission.MasterClient && !PhotonNetwork.IsMasterClient)
                {
                    return(true);
                }

                if (player != null)
                {
                    switch (variableType)
                    {
                    case VariableType.Int:
                        if (operation == Operation.Set)
                        {
                            player.SetInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                        }
                        else
                        {
                            player.AddInt(propertyName.GetValue(target), intValue.GetValue(target), webForward);
                        }
                        break;

                    case VariableType.Float:
                        if (operation == Operation.Set)
                        {
                            player.SetFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                        }
                        else
                        {
                            player.AddFloat(propertyName.GetValue(target), floatValue.GetValue(target), webForward);
                        }
                        break;

                    case VariableType.String:
                        player.SetString(propertyName.GetValue(target), stringValue.GetValue(target), webForward);
                        break;

                    case VariableType.Bool:
                        player.SetBool(propertyName.GetValue(target), boolValue.GetValue(target), webForward);
                        break;
                    }
                }
            }
            else
            {
                Debug.LogWarning("You need to be inside a room in order to change a PhotonPlayer property.", gameObject);
            }
            return(true);
        }
Exemple #11
0
 public bool equals(StringProperty other)
 {
     return(this.GetValue() == other.GetValue());
 }
Exemple #12
0
        // EXECUTABLE: ----------------------------------------------------------------------------

        public override bool InstantExecute(GameObject target, IAction[] actions, int index)
        {
            return(PhotonNetwork.RejoinRoom(roomName.GetValue(target)));
        }