Inheritance: ScriptObject
Ejemplo n.º 1
0
 public ScriptBoolean False { get { return m_False; } }                  //false对象
 public Script() {
     m_Null = new ScriptNull(this);
     m_True = new ScriptBoolean(this, true);
     m_False = new ScriptBoolean(this, false);
     m_GlobalTable = CreateTable();
     m_GlobalTable.SetValue(GLOBAL_TABLE, m_GlobalTable);
     m_GlobalTable.SetValue(GLOBAL_VERSION, CreateString(Version));
     m_GlobalTable.SetValue(GLOBAL_SCRIPT, CreateObject(this));
     PushAssembly(typeof(object).GetTypeInfo().Assembly);                        //mscorlib.dll
     PushAssembly(typeof(System.Net.Sockets.Socket).GetTypeInfo().Assembly);     //System.dll
     PushAssembly(GetType().GetTypeInfo().Assembly);                             //当前所在的程序集
 }
Ejemplo n.º 2
0
 public void Initialize(Script script, ScriptTable table)
 {
     Table = table;
     table.SetValue("com", script.CreateUserdata(this));
     ScriptArray functions = table.GetValue("registerFunction") as ScriptArray;
     if (functions != null)
     {
         for (int i = 0; i < functions.Count();++i )
         {
             registerFunctions.Add((string)(functions.GetValue(i).ObjectValue));
         }
     }
     OnStart();
 }
Ejemplo n.º 3
0
        private IScriptUserdataFactory m_UserdataFactory = null; //Userdata工厂

        #endregion Fields

        #region Constructors

        public Script()
        {
            Null = new ScriptNull(this);
            True = new ScriptBoolean(this, true);
            False = new ScriptBoolean(this, false);
            m_UserdataFactory = new DefaultScriptUserdataFactory(this);
            m_GlobalTable = CreateTable();
            m_GlobalTable.SetValue(GLOBAL_TABLE, m_GlobalTable);
            m_GlobalTable.SetValue(GLOBAL_VERSION, CreateString(Version));
            m_GlobalTable.SetValue(GLOBAL_SCRIPT, CreateObject(this));
            #if !SCORPIO_UWP
            PushAssembly(typeof(object).Assembly);
            PushAssembly(GetType().Assembly);
            #endif
        }
Ejemplo n.º 4
0
 public void SetTable(ScriptTable table)
 {
     if (FunctionType == FunstionType.Script) {
         IsStatic = false;
         m_stackObject["this"] = table;
         m_stackObject["self"] = table;
     }
 }
Ejemplo n.º 5
0
 public TableKPairs(ScriptTable obj)
 {
     m_Enumerator = obj.GetIterator();
 }
Ejemplo n.º 6
0
 public TablePairs(Script script, ScriptTable obj)
 {
     m_Script = script;
     m_Enumerator = obj.GetIterator();
 }
Ejemplo n.º 7
0
 public static void AddComponent(GameObject obj, ScriptTable table)
 {
     if (obj == null) return;
     ScriptComponent com = obj.AddComponent<ScriptComponent>();
     com.Initialize(Launch.Script, table);
 }
Ejemplo n.º 8
0
 public static void AddComponent(Component com, ScriptTable table)
 {
     if (com == null) return;
     AddComponent(com.gameObject, table);
 }
 public void SetTable(ScriptTable table) {
     m_IsStaticFunction = false;
     m_stackObject["this"] = table;
     m_stackObject["self"] = table;
 }