Exemple #1
0
 public void LoadLibrary()
 {
     LibraryBasis.Load(this);
     LibraryJson.Load(this);
     LibraryMath.Load(this);
     LibraryUserdata.Load(this);
     LibraryIO.Load(this);
 }
Exemple #2
0
 public void LoadLibrary()
 {
     LibraryBasis.Load(this);
     LibraryArray.Load(this);
     LibraryString.Load(this);
     LibraryTable.Load(this);
     LibraryJson.Load(this);
     LibraryMath.Load(this);
     LibraryFunc.Load(this);
     LibraryUserdata.Load(this);
 }
Exemple #3
0
        public Script()
        {
            Global = new ScriptGlobal();

            TypeObject      = new ScriptTypeObject("Object");
            TypeObjectValue = new ScriptValue(TypeObject);
            Global.SetValue(TypeObject.TypeName, TypeObjectValue);

            AddPrimitivePrototype("Bool", ref m_TypeBool, ref m_TypeValueBool);
            AddPrimitivePrototype("Number", ref m_TypeNumber, ref m_TypeValueNumber);
            AddPrimitivePrototype("String", ref m_TypeString, ref m_TypeValueString);
            AddPrimitivePrototype("Function", ref m_TypeFunction, ref m_TypeValueFunction);

            AddBasicPrototype(m_TypeArray         = new ScriptTypeBasicArray(this, "Array", TypeObjectValue), ref m_TypeValueArray);
            AddBasicPrototype(m_TypeMap           = new ScriptTypeBasicMap(this, "Map", TypeObjectValue), ref m_TypeValueMap);
            AddBasicPrototype(m_TypeStringBuilder = new ScriptTypeBasicStringBuilder(this, "StringBuilder", TypeObjectValue), ref m_TypeValueStringBuilder);

            Global.SetValue(GLOBAL_NAME, new ScriptValue(Global));
            Global.SetValue(GLOBAL_SCRIPT, ScriptValue.CreateValue(this));
            Global.SetValue(GLOBAL_VERSION, ScriptValue.CreateValue(typeof(Version)));

            ProtoObject.Load(this, TypeObject);
            ProtoBoolean.Load(this, TypeBoolean);
            ProtoNumber.Load(this, TypeNumber);
            ProtoString.Load(this, TypeString);
            ProtoArray.Load(this, TypeArray);
            ProtoMap.Load(this, TypeMap);
            ProtoFunction.Load(this, TypeFunction);
            ProtoStringBuilder.Load(this, TypeStringBuilder);

            TypeManager.PushAssembly(typeof(object).Assembly);                        //mscorlib.dll
            TypeManager.PushAssembly(typeof(System.Net.Sockets.Socket).Assembly);     //System.dll
            TypeManager.PushAssembly(GetType().Assembly);                             //当前所在的程序集

            LibraryBasis.Load(this);
            LibraryJson.Load(this);
            LibraryMath.Load(this);
            LibraryUserdata.Load(this);
            LibraryIO.Load(this);
        }