コード例 #1
0
        void SetPlayerProperty()
        {
            if (customPropertyValue == null)
            {
                LogError("customPropertyValue is null ");
                Fsm.Event(failureEvent);
                return;
            }

            _player = player.GetPlayer(this);

            if (_player != null)
            {
                if (!_player.Equals(PhotonNetwork.LocalPlayer) && !PhotonNetwork.IsMasterClient)
                {
                    LogError("setting a player custom property different from your LocalPlayer is not allowed, unless you are the current MasterClient");
                    Fsm.Event(failureEvent);
                }
                else
                {
                    ExitGames.Client.Photon.Hashtable _prop = new ExitGames.Client.Photon.Hashtable();
                    //Log(" set key "+customPropertyKey.Value+"="+ PlayMakerUtils.GetValueFromFsmVar(this.Fsm,customPropertyValue));

                    _prop[customPropertyKey.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertyValue);
                    _player.SetCustomProperties(_prop);
                    Fsm.Event(successEvent);
                }
            }
            else
            {
                LogError("Player reference is null");
                Fsm.Event(failureEvent);
            }
        }
コード例 #2
0
ファイル: HashTableAdd.cs プロジェクト: K07H/The-Forest
 public void AddToHashTable()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     this.proxy.hashTable.Add(this.key.Value, PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable));
 }
コード例 #3
0
ファイル: ArrayListSet.cs プロジェクト: K07H/The-Forest
 public void SetToArrayList()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     this.proxy.Set(this.atIndex.Value, PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable), this.variable.Type.ToString());
 }
コード例 #4
0
ファイル: ArrayListAdd.cs プロジェクト: K07H/The-Forest
 public void AddToArrayList()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     this.proxy.Add(PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable), this.variable.Type.ToString(), false);
 }
コード例 #5
0
 public void SetHashTable()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     this.proxy.hashTable[this.key.Value] = PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable);
 }
コード例 #6
0
        public void SetToArrayList()
        {
            if (!isProxyValid())
            {
                return;
            }

            proxy.Set(atIndex.Value, PlayMakerUtils.GetValueFromFsmVar(Fsm, variable), variable.Type.ToString());
        }
コード例 #7
0
        public void AddToHashTable()
        {
            if (!isProxyValid())
            {
                return;
            }

            proxy.hashTable.Add(key.Value, PlayMakerUtils.GetValueFromFsmVar(Fsm, variable));
        }
コード例 #8
0
        public void AddToArrayList()
        {
            if (!isProxyValid())
            {
                return;
            }

            proxy.Add(PlayMakerUtils.GetValueFromFsmVar(Fsm, variable), variable.Type.ToString());
        }
コード例 #9
0
        public void SetHashTable()
        {
            if (!isProxyValid())
            {
                return;
            }

            proxy.hashTable[key.Value] = PlayMakerUtils.GetValueFromFsmVar(Fsm, variable);
        }
コード例 #10
0
        public override void OnEnter()
        {
            bool withExpections = false;
            int  _maxPlayer     = 0;


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

            int i = 0;

            foreach (FsmString _prop in customPropertyKeys)
            {
                withExpections      = true;
                _props[_prop.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertiesValues[i]);
                i++;
            }


            if ((!maxPlayer.IsNone) || maxPlayer.Value > 0)
            {
                _maxPlayer     = maxPlayer.Value;
                withExpections = true;
            }

            if (customPropertyKeys.Length > 0)
            {
                withExpections = true;
            }

            if (matchMakingMode != PhotonMatchMakingMode.FillRoom)
            {
                withExpections = true;
            }

            if (withExpections)
            {
                MatchmakingMode _mode = MatchmakingMode.FillRoom;
                if (matchMakingMode == PhotonMatchMakingMode.RandomMatching)
                {
                    _mode = MatchmakingMode.RandomMatching;
                }
                else if (matchMakingMode == PhotonMatchMakingMode.SerialMatching)
                {
                    _mode = MatchmakingMode.SerialMatching;
                }

                Debug.Log(_props.ToStringFull());
                PhotonNetwork.JoinRandomRoom(_props, (byte)_maxPlayer, _mode, TypedLobby.Default, sqlLobbyFilter.Value);
            }
            else
            {
                PhotonNetwork.JoinRandomRoom();
            }


            Finish();
        }
コード例 #11
0
        public override void OnEnter()
        {
            for (int i = 0; i < keys.Length; i++)
            {
                if (!keys[i].IsNone || !keys[i].Value.Equals(""))
                {
                    string key    = keys[i].Value;
                    FsmVar fsmVar = values[i];

                    switch (fsmVar.Type)
                    {
                    case VariableType.Int:
                        PlayerPrefs.SetInt(key, fsmVar.IsNone ? 0 : (int)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Float:
                        PlayerPrefs.SetFloat(key, fsmVar.IsNone ? 0f : (float)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Bool:
                        PlayerPrefsX.SetBool(key, fsmVar.IsNone ? false : (bool)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Color:
                        PlayerPrefsX.SetColor(key, fsmVar.IsNone ? Color.black : (Color)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Quaternion:
                        PlayerPrefsX.SetQuaternion(key, fsmVar.IsNone ? Quaternion.identity : (Quaternion)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Rect:
                        PlayerPrefsX.SetRect(key, fsmVar.IsNone ? new Rect(0f, 0f, 0f, 0f) : (Rect)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Vector2:
                        PlayerPrefsX.SetVector2(key, fsmVar.IsNone ? Vector2.zero : (Vector2)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.Vector3:
                        PlayerPrefsX.SetVector3(key, fsmVar.IsNone ? Vector3.zero : (Vector3)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    case VariableType.String:
                        PlayerPrefs.SetString(key, fsmVar.IsNone ? "" : (string)PlayMakerUtils.GetValueFromFsmVar(this.Fsm, fsmVar));
                        break;

                    default:
                        LogError("PlayerPrefsx does not support saving " + fsmVar.Type);
                        break;
                    }
                }
            }

            Finish();
        }
コード例 #12
0
        public override void OnEnter()
        {
            bool withExpections = false;
            int  _maxPlayer     = 0;


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

            int i = 0;

            foreach (FsmString _prop in customPropertyKeys)
            {
                withExpections      = true;
                _props[_prop.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertiesValues[i]);
                i++;
            }


            if ((!maxPlayer.IsNone) || maxPlayer.Value > 0)
            {
                _maxPlayer     = maxPlayer.Value;
                withExpections = true;
            }

            if (customPropertyKeys.Length > 0)
            {
                withExpections = true;
            }

            if ((MatchmakingMode)matchMakingMode.Value != MatchmakingMode.FillRoom)
            {
                withExpections = true;
            }

            bool _result;

            if (withExpections)
            {
                _result = PhotonNetwork.JoinRandomRoom(_props, (byte)_maxPlayer, (MatchmakingMode)matchMakingMode.Value, TypedLobby.Default, sqlLobbyFilter.Value);
            }
            else
            {
                _result = PhotonNetwork.JoinRandomRoom();
            }

            if (!result.IsNone)
            {
                result.Value = _result;
            }

            Fsm.Event(_result ? willProceed : willNotProceed);

            Finish();
        }
コード例 #13
0
ファイル: ArrayListRemove.cs プロジェクト: K07H/The-Forest
 public void DoRemoveFromArrayList()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     if (!this.proxy.Remove(PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable), this.variable.Type.ToString(), false))
     {
         base.Fsm.Event(this.notFoundEvent);
     }
 }
コード例 #14
0
 public void DoArrayListAddRange()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     foreach (FsmVar fsmVar in this.variables)
     {
         this.proxy.Add(PlayMakerUtils.GetValueFromFsmVar(base.Fsm, fsmVar), fsmVar.Type.ToString(), true);
     }
 }
コード例 #15
0
 public void SetHashTable()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     for (int i = 0; i < this.keys.Length; i++)
     {
         this.proxy.hashTable[this.keys[i].Value] = PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variables[i]);
     }
 }
コード例 #16
0
        public override void OnEnter()
        {
            properties = new Dictionary <string, object>();

            for (int i = 0; i < keys.Length; i++)
            {
                properties[keys[i].Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, datas[i]);
                //UnityEngine.Debug.Log(keys[i].Value+" "+_props.properties[keys[i].Value]);
            }

            Finish();
        }
コード例 #17
0
        public void DoArrayListAddRange()
        {
            if (!isProxyValid())
            {
                return;
            }

            foreach (FsmVar _var in variables)
            {
                proxy.Add(PlayMakerUtils.GetValueFromFsmVar(Fsm, _var), _var.Type.ToString(), true);
            }
        }
コード例 #18
0
        public void SetHashTable()
        {
            if (!isProxyValid())
            {
                return;
            }

            for (int i = 0; i < keys.Length; i++)
            {
                proxy.hashTable[keys[i].Value] = PlayMakerUtils.GetValueFromFsmVar(Fsm, variables[i]);
            }
        }
コード例 #19
0
        public void DoArrayListIndexOf()
        {
            if (!isProxyValid())
            {
                return;
            }

            object item = PlayMakerUtils.GetValueFromFsmVar(Fsm, variable);

            int indexOfResult = -1;

            try{
                if (startIndex.IsNone)
                {
                    UnityEngine.Debug.Log("hello");
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
                else if (count.IsNone || count.Value == 0)
                {
                    if (startIndex.Value < 0 || startIndex.Value >= proxy.arrayList.Count)
                    {
                        LogError("start index out of range");
                        return;
                    }
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
                else
                {
                    if (startIndex.Value < 0 || startIndex.Value >= (proxy.arrayList.Count - count.Value))
                    {
                        LogError("start index and count out of range");
                        return;
                    }
                    indexOfResult = PlayMakerUtils_Extensions.IndexOf(proxy.arrayList, item);
                }
            }catch (System.Exception e) {
                Debug.LogError(e.Message);
                Fsm.Event(failureEvent);
                return;
            }


            indexOf.Value = indexOfResult;
            if (indexOfResult == -1)
            {
                Fsm.Event(itemNotFound);
            }
            else
            {
                Fsm.Event(itemFound);
            }
        }
コード例 #20
0
 public void DoArrayListAddRange()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     FsmVar[] array = this.variables;
     for (int i = 0; i < array.Length; i++)
     {
         FsmVar fsmVar = array[i];
         this.proxy.Add(PlayMakerUtils.GetValueFromFsmVar(base.Fsm, fsmVar), fsmVar.Type.ToString(), true);
     }
 }
コード例 #21
0
        public void DoArrayListLastIndex()
        {
            if (!isProxyValid())
            {
                return;
            }

            object item = PlayMakerUtils.GetValueFromFsmVar(Fsm, variable);

            int index = -1;

            try{
                if (startIndex.Value == 0 && count.Value == 0)
                {
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item);
                }
                else if (count.Value == 0)
                {
                    if (startIndex.Value < 0 || startIndex.Value >= proxy.arrayList.Count)
                    {
                        Debug.LogError("start index out of range");
                        return;
                    }
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item, startIndex.Value);
                }
                else
                {
                    if (startIndex.Value < 0 || startIndex.Value >= (proxy.arrayList.Count - count.Value))
                    {
                        Debug.LogError("start index and count out of range");
                        return;
                    }
                    index = PlayMakerUtils_Extensions.LastIndexOf(proxy.arrayList, item, startIndex.Value, count.Value);
                }
            }catch (System.Exception e) {
                Debug.LogError(e.Message + " on " + Fsm.GameObjectName + "\nFsm: " + Fsm.Name + "\nState: " + Fsm.ActiveStateName);
                Fsm.Event(failureEvent);
                return;
            }

            lastIndexOf.Value = index;
            if (index == -1)
            {
                Fsm.Event(itemNotFound);
            }
            else
            {
                Fsm.Event(itemFound);
            }
        }
コード例 #22
0
        void SetPlayerProperty()
        {
            if (customPropertyValue == null)
            {
                LogError("customPropertyValue is null ");
                return;
            }

            ExitGames.Client.Photon.Hashtable _prop = new ExitGames.Client.Photon.Hashtable();
            //Log(" set key "+customPropertyKey.Value+"="+ PlayMakerUtils.GetValueFromFsmVar(this.Fsm,customPropertyValue));

            _prop[customPropertyKey.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertyValue);
            PhotonNetwork.LocalPlayer.SetCustomProperties(_prop);
        }
コード例 #23
0
        public void ResetArrayList()
        {
            if (!isProxyValid())
            {
                return;
            }

            object _val = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, resetValue);

            for (int i = 0; i < proxy.arrayList.Count; i++)
            {
                proxy.arrayList[i] = _val;
            }
        }
コード例 #24
0
        public void DoRemoveFromArrayList()
        {
            if (!isProxyValid())
            {
                return;
            }

            bool success = proxy.Remove(PlayMakerUtils.GetValueFromFsmVar(Fsm, variable), variable.Type.ToString());

            if (!success)
            {
                Fsm.Event(notFoundEvent);
            }
        }
コード例 #25
0
ファイル: ArrayListIndexOf.cs プロジェクト: K07H/The-Forest
        public void DoArrayListIndexOf()
        {
            if (!base.isProxyValid())
            {
                return;
            }
            object valueFromFsmVar = PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable);
            int    num             = -1;

            try
            {
                if (this.startIndex == null)
                {
                    num = this.proxy.arrayList.IndexOf(valueFromFsmVar);
                }
                else if (this.count == null || this.count.Value == 0)
                {
                    if (this.startIndex.Value < 0 || this.startIndex.Value >= this.proxy.arrayList.Count)
                    {
                        base.LogError("start index out of range");
                        return;
                    }
                    num = this.proxy.arrayList.IndexOf(valueFromFsmVar, this.startIndex.Value);
                }
                else
                {
                    if (this.startIndex.Value < 0 || this.startIndex.Value >= this.proxy.arrayList.Count - this.count.Value)
                    {
                        base.LogError("start index and count out of range");
                        return;
                    }
                    num = this.proxy.arrayList.IndexOf(valueFromFsmVar, this.startIndex.Value, this.count.Value);
                }
            }
            catch (Exception ex)
            {
                Debug.LogError(ex.Message);
                base.Fsm.Event(this.failureEvent);
                return;
            }
            this.indexOf.Value = num;
            if (num == -1)
            {
                base.Fsm.Event(this.itemNotFound);
            }
            else
            {
                base.Fsm.Event(this.itemFound);
            }
        }
コード例 #26
0
        public void doArrayListInsert()
        {
            if (!isProxyValid())
            {
                return;
            }

            try
            {
                proxy.arrayList.Insert(index.Value, PlayMakerUtils.GetValueFromFsmVar(Fsm, variable));
            }catch (System.Exception e) {
                Debug.LogError(e.Message);
                Fsm.Event(failureEvent);
            }
        }
コード例 #27
0
 public void doContainsValue()
 {
     if (!base.isProxyValid())
     {
         return;
     }
     this.containsValue.Value = this.proxy.hashTable.ContainsValue(PlayMakerUtils.GetValueFromFsmVar(base.Fsm, this.variable));
     if (this.containsValue.Value)
     {
         base.Fsm.Event(this.valueFoundEvent);
     }
     else
     {
         base.Fsm.Event(this.valueNotFoundEvent);
     }
 }
コード例 #28
0
        void SetRoomProperty()
        {
            if (!PhotonNetwork.InRoom)
            {
                Fsm.Event(failureEvent);
                return;
            }

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

            _prop[customPropertyKey.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertyValue);

            PhotonNetwork.CurrentRoom.SetCustomProperties(_prop);

            Fsm.Event(successEvent);
        }
        void SetRoomProperty()
        {
            Room _room     = PhotonNetwork.room;
            bool _isInRoom = _room != null;

            if (!_isInRoom)
            {
                Fsm.Event(failureEvent);
                return;
            }

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

            _prop[customPropertyKey.Value] = PlayMakerUtils.GetValueFromFsmVar(this.Fsm, customPropertyValue);
            _room.SetCustomProperties(_prop);
            Fsm.Event(successEvent);
        }
コード例 #30
0
        public void SetToArrayList()
        {
            if (!isProxyValid())
            {
                return;
            }

            if (proxy._arrayList.Count <= atIndex.Value && forceResizeIdNeeded)
            {
                while (proxy._arrayList.Count <= atIndex.Value)
                {
                    proxy._arrayList.Add(null);
                }
            }

            proxy.Set(atIndex.Value, PlayMakerUtils.GetValueFromFsmVar(Fsm, variable), variable.Type.ToString());
        }