internal Enumerator(ScriptGlobal global) { this.keys = global.m_Indexs.Keys; this.values = global.m_Indexs.Values; this.objects = global.m_Objects; this.current = new ScorpioValue <string, ScriptValue>(); this.index = 0; }
} //全局变量 public Script() { Global = new ScriptGlobal(); TypeObject = new ScriptTypeObject("Object"); TypeObjectValue = new ScriptValue(TypeObject); Global.SetValue(TypeObject.TypeName, TypeObjectValue); TypeBoolean = new ScriptBasicType("Bool", TypeObjectValue); TypeBooleanValue = new ScriptValue(TypeBoolean); Global.SetValue(TypeBoolean.TypeName, TypeBooleanValue); TypeNumber = new ScriptBasicType("Number", TypeObjectValue); TypeNumberValue = new ScriptValue(TypeNumber); Global.SetValue(TypeNumber.TypeName, TypeNumberValue); TypeString = new ScriptBasicType("String", TypeObjectValue); TypeStringValue = new ScriptValue(TypeString); Global.SetValue(TypeString.TypeName, TypeStringValue); TypeArray = new ScriptBasicType("Array", TypeObjectValue); TypeArrayValue = new ScriptValue(TypeArray); Global.SetValue(TypeArray.TypeName, TypeArrayValue); TypeMap = new ScriptBasicType("Map", TypeObjectValue); TypeMapValue = new ScriptValue(TypeMap); Global.SetValue(TypeMap.TypeName, TypeMapValue); TypeFunction = new ScriptBasicType("Function", TypeObjectValue); TypeFunctionValue = new ScriptValue(TypeFunction); Global.SetValue(TypeFunction.TypeName, TypeFunctionValue); 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); TypeManager.PushAssembly(typeof(object).Assembly); //mscorlib.dll TypeManager.PushAssembly(typeof(System.Net.Sockets.Socket).Assembly); //System.dll TypeManager.PushAssembly(GetType().Assembly); //当前所在的程序集 LoadLibrary(); }
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); }