GetValue() public abstract method

获得一个类变量
public abstract GetValue ( object obj, string name ) : object
obj object
name string
return object
Ejemplo n.º 1
0
 public override ScriptObject GetValue(object key)
 {
     if (!(key is string))
     {
         throw new ExecutionException(Script, "ObjectType GetValue只支持String类型");
     }
     return(Script.CreateObject(m_UserdataType.GetValue(null, (string)key)));
 }
Ejemplo n.º 2
0
        public override ScriptObject GetValue(object key)
        {
            string name = key as string;

            if (name == null)
            {
                throw new ExecutionException(m_Script, "ObjectType GetValue只支持String类型");
            }
            return(m_Script.CreateObject(m_UserdataType.GetValue(null, name)));
        }
        public override ScriptValue GetValue(string key)
        {
            if (m_Methods.TryGetValue(key, out var value))
            {
                return(value);
            }
            var ret = m_UserdataType.GetValue(m_Value, key);

            if (ret is UserdataMethod)
            {
                return(m_Methods[key] = new ScriptValue(new ScriptInstanceMethodFunction((UserdataMethod)ret, m_Value)));
            }
            return(ScriptValue.CreateValue(ret));
        }
Ejemplo n.º 4
0
        public override ScriptValue GetValue(string key)
        {
            ScriptValue value;

            if (m_Methods.TryGetValue(key, out value))
            {
                return(value);
            }
            var ret = m_UserdataType.GetValue(null, key);

            if (ret is UserdataMethod)
            {
                return(m_Methods[key] = new ScriptValue(new ScriptStaticMethodFunction((UserdataMethod)ret)));
            }
            return(ScriptValue.CreateValue(ret));
        }
        public override ScriptObject GetValue(object key)
        {
            string name = key as string;

            if (name == null)
            {
                throw new ExecutionException(m_Script, "Object GetValue只支持String类型");
            }
            if (m_Methods.ContainsKey(name))
            {
                return(m_Methods[name]);
            }
            var ret = m_UserdataType.GetValue(m_Value, name);

            if (ret is UserdataMethod)
            {
                UserdataMethod method = (UserdataMethod)ret;
                ScriptObject   value  = m_Script.CreateObject(method.IsStatic ? (ScorpioMethod) new ScorpioStaticMethod(name, method) : (ScorpioMethod) new ScorpioObjectMethod(m_Value, name, method));
                m_Methods.Add(name, value);
                return(value);
            }
            return(m_Script.CreateObject(ret));
        }
Ejemplo n.º 6
0
 public override ScriptObject GetValue(string strName)
 {
     return(Script.CreateObject(m_Type.GetValue(null, strName)));
 }