Esempio n. 1
0
 protected void Start()
 {
     if (table != null)
     {
         table.Invoke("Start", table);
     }
 }
Esempio n. 2
0
 void Start()
 {
     if (luaClass != "")
     {
         lua = Util.GetTable(luaClass);
         if (lua.GetLuaFunction("New") != null)
         {
             lua = lua.Invoke("New", lua, gameObject)[0] as LuaTable;
         }
     }
     lua["param"] = param;
     lua.Invoke("Start", lua);
 }
Esempio n. 3
0
        public bool CheckPlayer(PlayerDisplay display, PlayerDisplay owner)
        {
            if (display == null || owner == null || !m_IsEnabled)
            {
                return(false);
            }

            if ((m_StandTypes != 0 && ((byte)display.StateType & m_StandTypes) != 0) ||
                (m_PhysicsTypes != 0 && ((byte)display.PhysicsType & m_PhysicsTypes) != 0) ||
                (m_MoveTypes != 0 && (m_MoveTypes & (byte)display.MoveType) != 0))
            {
                return(false);
            }

            if (owner.ShowType == DisplayType.Projectile && m_NoProj)
            {
                return(false);
            }

            if (string.IsNullOrEmpty(m_LuaFuncName))
            {
                return(true);
            }
            LuaTable luaPlayer = display.LuaPly;

            if (luaPlayer == null)
            {
                return(false);
            }

            bool ret = luaPlayer.Invoke <LuaTable, bool>(m_LuaFuncName, luaPlayer);

            return(ret);
        }
Esempio n. 4
0
 protected void Awake()
 {
     table = Util.GetTable(name);
     if (table != null)
     {
         table.Invoke("Awake", table, gameObject);
     }
 }
Esempio n. 5
0
    private static IEnumerator OnRequestDownload(long downloadSize)
    {
        hotUpdateClass  = LuaFacade.GetTable("HotUpdate");
        hotUpdateObject = hotUpdateClass.Invoke <LuaTable>("new");
        hotUpdateClass.Call("Initialize", hotUpdateObject, downloadSize);
        yield return(null);

        while (!hotUpdateClass.Invoke <LuaTable, bool>("Response", hotUpdateObject))
        {
            yield return(null);
        }
        if (hotUpdateClass.Invoke <LuaTable, bool>("Result", hotUpdateObject))
        {
            AddressablesUpdater.Result = RequestDownloadResult.Agree;
        }
        else
        {
            AddressablesUpdater.Result = RequestDownloadResult.Disagree;
        }
    }
        public object ExecuteTableMethod(LuaTable self, string methodName)
        {
            object ret = null;

            try{
                ret = self.Invoke <LuaTable, object>(methodName, self);
            }catch (Exception e) {
                ret = e.Message;
                //Debug.LogException (e);
            }
            return(ret);
        }
Esempio n. 7
0
    void InitLuaSetting()
    {
        try
        {
            if (string.IsNullOrEmpty(fullLuaFileName))
            {
                return;
            }
            fullLuaFileName = fullLuaFileName.ReplaceEx('\\', '/');
            _luaClassName   = fullLuaFileName.Substring(fullLuaFileName.LastIndexOf('/') + 1);

            if (string.IsNullOrEmpty(_luaClassName))
            {
                return;
            }

            luaState.Require(fullLuaFileName);
            _luaTable = luaState.GetTable(_luaClassName);

            update             = _luaTable.RawGetLuaFunction("Update");
            lateUpdate         = _luaTable.RawGetLuaFunction("LateUpdate");
            fixedUpdate        = _luaTable.RawGetLuaFunction("FixedUpdate");
            onTriggerEnterFunc = _luaTable.RawGetLuaFunction("OnTriggerEnter");
            onTriggerStayFunc  = _luaTable.RawGetLuaFunction("OnTriggerStay");
            onTriggerExitFunc  = _luaTable.RawGetLuaFunction("OnTriggerExit");

            if (isMulti)
            {
                LuaTable table = _luaTable.Invoke <LuaTable>("New");

                if (table == null)
                {
                    throw new LuaException(_luaClassName + " does not have a New function, GameObject is" + gameObject.name);
                }

                _luaTable.Dispose();
                _luaTable = table;
            }

            LuaFunction luafunc = luaState.GetFunction("luaObjMgr.AddLuaUIObject");
            luafunc.Call(gameObject, _luaTable);
            _luaTable.name = _luaClassName;
            _luaTable.RawSet("gameObject", gameObject);
            _luaTable.RawSet("transform", transform);
            _luaTable.RawSet("ID", ID);
            _luaTable.Call("Awake", _luaTable);
            isFinishLuaInit = true;
        }
        catch (Exception e)
        {
            luaState.ThrowLuaException(e);
        }
    }
Esempio n. 8
0
 private TaskStatus CallFunc(string name)
 {
     if (self == null)
     {
         return(TaskStatus.Failure);
     }
     try{
         return((TaskStatus)self.Invoke <LuaTable, int>(name, self));
     }catch (Exception e) {
         Debug.LogErrorFormat("CallFunc {0}", name);
         Debug.LogException(e);
     }
     return(TaskStatus.Failure);
 }
Esempio n. 9
0
    public LuaTable NewLuaPlayer(PlayerDisplay display)
    {
        if (m_LuaClass == null || display == null)
        {
            return(null);
        }
        LuaTable ret = m_LuaClass.Invoke <LuaTable, LuaTable>("new", m_LuaClass);

        if (ret != null)
        {
            ret.Call <LuaTable, PlayerDisplay>("OnInit", ret, display);
        }
        return(ret);
    }
Esempio n. 10
0
    public string Call_LuaPly_GetAIName(string cmdName)
    {
        if (string.IsNullOrEmpty(cmdName) || m_LuaPlayer == null)
        {
            return(string.Empty);
        }
        try
        {
            string ret = m_LuaPlayer.Invoke <LuaTable, string, string>("OnGetAICommandName", m_LuaPlayer, cmdName);
            return(ret);
        } catch (System.Exception e)
        {
#if DEBUG
            Debug.LogError(e.ToString());
#endif
        }

        return(string.Empty);
    }
Esempio n. 11
0
 public LuaCommand(string commandName)
 {
     CommandName   = commandName;
     commandClass  = LuaFacade.GetTable(commandName);
     commandObject = commandClass.Invoke <LuaTable>("new");
 }
Esempio n. 12
0
 public override string[] ListNotificationInterests()
 {
     return(mediatorClass.Invoke <LuaTable, string[]>("ListNotificationInterests", mediatorObject));
 }
Esempio n. 13
0
 public LuaMediator(string mediatorName, object viewComponent = null) : base(mediatorName, viewComponent)
 {
     mediatorClass  = LuaFacade.GetTable(mediatorName);
     mediatorObject = mediatorClass.Invoke <LuaTable>("new");
 }
Esempio n. 14
0
 public LuaTable GetEmptyTable()
 {
     Assert.IsTrue(Started, "LuaState未启动");
     return _UtilityScope.Invoke<LuaTable>("GetEmptyTable");
 }
Esempio n. 15
0
 public LuaProxy(string proxyName, object data = null) : base(proxyName, data)
 {
     proxyClass  = LuaFacade.GetTable(proxyName);
     proxyObject = proxyClass.Invoke <LuaTable>("new");
 }