GetValue() public abstract method

public abstract GetValue ( object obj ) : object
obj object
return object
Exemplo n.º 1
0
        /// <summary> 获得一个类变量 </summary>
        public override object GetValue_impl(object obj, string name)
        {
            if (m_Functions.ContainsKey(name))
            {
                return(m_Functions[name]);
            }
            if (m_NestedTypes.ContainsKey(name))
            {
                return(m_NestedTypes[name]);
            }
            UserdataVariable variable = GetVariable(name);

            if (variable != null)
            {
                return(variable.GetValue(obj));
            }
            ScriptUserdata nestedType = GetNestedType(name);

            if (nestedType != null)
            {
                return(nestedType);
            }
            UserdataMethod func = GetMethod(name);

            if (func != null)
            {
                return(func);
            }
            throw new ExecutionException(m_Script, "GetValue Type[" + m_Type.ToString() + "] 变量 [" + name + "] 不存在");
        }
Exemplo n.º 2
0
        /// <summary> 获得一个类变量 </summary>
        public override object GetValue(object obj, string name)
        {
            if (m_ScorpioMethods.ContainsKey(name))
            {
                return(m_ScorpioMethods[name]);
            }
            if (m_Functions.ContainsKey(name))
            {
                return(GetMethod(obj, name, m_Functions[name]));
            }
            if (m_NestedTypes.ContainsKey(name))
            {
                return(m_NestedTypes[name]);
            }
            UserdataVariable variable = GetVariable(name);

            if (variable != null)
            {
                return(variable.GetValue(obj));
            }
            Type nestedType = m_Type.GetNestedType(name, Script.BindingFlag);

            if (nestedType != null)
            {
                ScriptUserdata ret = m_Script.CreateUserdata(nestedType);
                m_NestedTypes.Add(name, ret);
                return(ret);
            }
            UserdataMethod func = GetMethod(name);

            if (func != null)
            {
                return(GetMethod(obj, name, func));
            }
            throw new ExecutionException(m_Script, "GetValue Type[" + m_Type.ToString() + "] 变量 [" + name + "] 不存在");
        }