Esempio n. 1
0
 void Update()
 {
     Dialoguer.SetGlobalFloat(0, PlayerInfo.Instance.Data.Gold.Value);
     Dialoguer.SetGlobalFloat(1, PlayerInfo.Instance.Data.Experience.Value);
     Dialoguer.SetGlobalFloat(2, PlayerInfo.Instance.Data.KeyYellow.Value);
     Dialoguer.SetGlobalFloat(3, PlayerInfo.Instance.Data.KeyBlue.Value);
     Dialoguer.SetGlobalFloat(4, PlayerInfo.Instance.Data.KeyRed.Value);
 }
Esempio n. 2
0
 // Update is called once per frame
 void Update()
 {
     Dialoguer.SetGlobalFloat(0, _PA._jinbi);
     Dialoguer.SetGlobalFloat(1, _PA._jingyan);
     Dialoguer.SetGlobalFloat(2, _PA._key_yellow);
     Dialoguer.SetGlobalFloat(3, _PA._key_blue);
     Dialoguer.SetGlobalFloat(4, _PA._key_red);
 }
        protected override void onStart()
        {
            bool success = false;

            switch (type)
            {
            case VariableEditorTypes.Boolean:
                success = bool.TryParse(setValue, out _setBool);
                switch (equation)
                {
                case VariableEditorSetEquation.Equals:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.booleans[variableId] = _setBool;
                    }
                    else
                    {
                        Dialoguer.SetGlobalBoolean(variableId, _setBool);
                    }
                    break;

                case VariableEditorSetEquation.Toggle:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.booleans[variableId] = !_localVariables.booleans[variableId];
                    }
                    else
                    {
                        Dialoguer.SetGlobalBoolean(variableId, !Dialoguer.GetGlobalBoolean(variableId));
                    }
                    success = true;
                    break;
                }
                break;

            case VariableEditorTypes.Float:
                success = float.TryParse(setValue, out _setFloat);
                switch (equation)
                {
                case VariableEditorSetEquation.Equals:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.floats[variableId] = _setFloat;
                    }
                    else
                    {
                        Dialoguer.SetGlobalFloat(variableId, _setFloat);
                    }
                    break;

                case VariableEditorSetEquation.Add:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.floats[variableId] += _setFloat;
                    }
                    else
                    {
                        Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) + _setFloat);
                    }
                    break;

                case VariableEditorSetEquation.Subtract:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.floats[variableId] -= _setFloat;
                    }
                    else
                    {
                        Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) - _setFloat);
                    }
                    break;

                case VariableEditorSetEquation.Multiply:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.floats[variableId] *= _setFloat;
                    }
                    else
                    {
                        Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) * _setFloat);
                    }
                    break;

                case VariableEditorSetEquation.Divide:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.floats[variableId] /= _setFloat;
                    }
                    else
                    {
                        Dialoguer.SetGlobalFloat(variableId, Dialoguer.GetGlobalFloat(variableId) / _setFloat);
                    }
                    break;
                }
                break;

            case VariableEditorTypes.String:
                success    = true;
                _setString = setValue;
                switch (equation)
                {
                case VariableEditorSetEquation.Equals:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.strings[variableId] = _setString;
                    }
                    else
                    {
                        Dialoguer.SetGlobalString(variableId, _setString);
                    }
                    break;

                case VariableEditorSetEquation.Add:
                    if (scope == VariableEditorScopes.Local)
                    {
                        _localVariables.strings[variableId] += _setString;
                    }
                    else
                    {
                        Dialoguer.SetGlobalString(variableId, Dialoguer.GetGlobalString(variableId) + _setString);
                    }
                    break;
                }
                break;
            }

            if (!success)
            {
                Debug.LogWarning("[SetVariablePhase] Could not parse setValue");
            }

            Continue(0);
            state = PhaseState.Complete;
        }