Inheritance: ScriptObject
Exemple #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);                             //当前所在的程序集
 }
 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();
 }
Exemple #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
        }
 public void SetTable(ScriptTable table)
 {
     if (FunctionType == FunstionType.Script) {
         IsStatic = false;
         m_stackObject["this"] = table;
         m_stackObject["self"] = table;
     }
 }
 public TableKPairs(ScriptTable obj)
 {
     m_Enumerator = obj.GetIterator();
 }
 public TablePairs(Script script, ScriptTable obj)
 {
     m_Script = script;
     m_Enumerator = obj.GetIterator();
 }
Exemple #7
0
 public static void AddComponent(GameObject obj, ScriptTable table)
 {
     if (obj == null) return;
     ScriptComponent com = obj.AddComponent<ScriptComponent>();
     com.Initialize(Launch.Script, table);
 }
Exemple #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;
 }