public void SetVariableValue(string name, object value)
        {
            SharedVariable variable = this.GetVariable(name);

            if (variable != null)
            {
                variable.SetValue(value);
                variable.ValueChanged();
            }
        }
Esempio n. 2
0
        public void SetVariableValue(string name, object value)
        {
            SharedVariable variable = this.GetVariable(name);

            if (variable != null)
            {
                variable.SetValue(value);
                variable.ValueChanged();
            }
            else
            {
                Debug.LogError("Error: No variable exists with name " + name);
            }
        }
Esempio n. 3
0
        public void SetVariableValue(string name, object value)
        {
            SharedVariable variable = this.GetVariable(name);

            if (variable != null)
            {
                if (value is SharedVariable)
                {
                    SharedVariable sharedVariable = value as SharedVariable;
                    if (!string.IsNullOrEmpty(sharedVariable.PropertyMapping))
                    {
                        variable.PropertyMapping      = sharedVariable.PropertyMapping;
                        variable.PropertyMappingOwner = sharedVariable.PropertyMappingOwner;
                        variable.InitializePropertyMapping(this.mBehaviorSource);
                    }
                    else
                    {
                        variable.SetValue(sharedVariable.GetValue());
                    }
                }
                else
                {
                    variable.SetValue(value);
                }
                variable.ValueChanged();
            }
            else if (value is SharedVariable)
            {
                SharedVariable sharedVariable = value as SharedVariable;
                SharedVariable instance       = TaskUtility.CreateInstance(sharedVariable.GetType()) as SharedVariable;
                instance.Name     = sharedVariable.Name;
                instance.IsShared = sharedVariable.IsShared;
                instance.IsGlobal = sharedVariable.IsGlobal;
                if (!string.IsNullOrEmpty(sharedVariable.PropertyMapping))
                {
                    instance.PropertyMapping      = sharedVariable.PropertyMapping;
                    instance.PropertyMappingOwner = sharedVariable.PropertyMappingOwner;
                    instance.InitializePropertyMapping(this.mBehaviorSource);
                }
                else
                {
                    instance.SetValue(sharedVariable.GetValue());
                }
                this.mBehaviorSource.SetVariable(name, instance);
            }
            else
            {
                Debug.LogError((object)("Error: No variable exists with name " + name));
            }
        }
Esempio n. 4
0
 static int ValueChanged(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         BehaviorDesigner.Runtime.SharedVariable obj = (BehaviorDesigner.Runtime.SharedVariable)ToLua.CheckObject <BehaviorDesigner.Runtime.SharedVariable>(L, 1);
         obj.ValueChanged();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }