Пример #1
0
 protected void Awake()
 {
     Util.CallMethod(base.get_name(), "Awake", new object[]
     {
         base.get_gameObject()
     });
 }
Пример #2
0
 protected void OnClickEvent(GameObject go)
 {
     Util.CallMethod(base.get_name(), "OnClick", new object[]
     {
         go
     });
 }
Пример #3
0
 protected void Awake()
 {
     if (!string.IsNullOrWhiteSpace(sLogicName))
     {
         Util.CallMethod("ViewMgr", "Awake", sLogicName, gameObject);
     }
 }
Пример #4
0
 void OnInitialize()
 {
     LuaManager.InitStart();
     LuaManager.DoFile("Logic/Game");         //加载游戏
     LuaManager.DoFile("Logic/Network");      //加载网络
     NetManager.OnInit();                     //初始化网络
     Util.CallMethod("Game", "OnInitOK");     //初始化完成
     initialize = true;
     //类对象池测试
     //var classObjPool = ObjPoolManager.CreatePool<TestObjectClass>(OnPoolGetElement, OnPoolPushElement);
     ////方法1
     ////objPool.Release(new TestObjectClass("abcd", 100, 200f));
     ////var testObj1 = objPool.Get();
     ////方法2
     //ObjPoolManager.Release<TestObjectClass>(new TestObjectClass("abcd", 100, 200f));
     //var testObj1 = ObjPoolManager.Get<TestObjectClass>();
     //Debugger.Log("TestObjectClass--->>>" + testObj1.ToString());
     //游戏对象池测试
     //var prefab = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject;
     //var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab);
     //var gameObj = Instantiate(prefab) as GameObject;
     //gameObj.name = "TestGameObject_01";
     //gameObj.transform.localScale = Vector3.one;
     //gameObj.transform.localPosition = Vector3.zero;
     //ObjPoolManager.Release("TestGameObject", gameObj);
     //var backObj = ObjPoolManager.Get("TestGameObject");
     //backObj.transform.SetParent(null);
     //Debug.Log("TestGameObject--->>>" + backObj);
 }
Пример #5
0
 void Update()
 {
     if (initialize)
     {
         Util.CallMethod("Game", "Update");     //初始化完成
     }
 }
Пример #6
0
 /// <summary>
 /// 初始化Lua虚拟机
 /// </summary>
 void OnInitialize()
 {
     LuaManager.InitStart();
     LuaManager.DoFile("Manager/GameManager");   //加载游戏
     Util.CallMethod("GameManager", "Init");     //初始化完成
     initialize = true;
 }
Пример #7
0
        void OnSceneLoaded(Scene scence, LoadSceneMode mod)
        {
            int level = scence.buildIndex;

            Util.CallMethod("GameMain", "OnLevelWasLoaded", level);
            Debug.Log("level:" + level);
        }
Пример #8
0
 protected void Awake()
 {
     Util.CallMethod(base.name, "Awake", new object[]
     {
         base.gameObject
     });
 }
Пример #9
0
 private void OnClick()
 {
     Util.CallMethod("ITEMLOGIC", "OnClickItemInfo", new object[]
     {
         this.itemId
     });
 }
Пример #10
0
 void OnApplicationPause(bool paused)
 {
     if (paused)
     {
         inBackground  = true;
         lastPauseTime = Time.realtimeSinceStartup;
     }
     else
     {
         //SocketClient.ResetTimeout();
         if (!inCharge)
         {
             inBackground = false;
             SocketClient.CheckHeartBeat();
             //if (!SocketClient.IsConnected())
             //{
             //    KickOut();
             //}
         }
         inCharge = false;
     }
     if (SocketClient.IsConnected())
     {
         Util.CallMethod("Game", "OnApplicationPause", paused, observer.lostConnect);
     }
 }
Пример #11
0
 /// <summary>
 /// 析构函数
 /// </summary>
 void OnDestroy()
 {
     if (LuaManager != null)
     {
         Util.CallMethod("Game", "OnDestroy");
         LuaManager.Close();
     }
 }
Пример #12
0
 void OnApplicationFocus(bool state)
 {
     Debug.Log("========OnApplicationFocus " + state);
     if (state)
     {
         Util.CallMethod("Game", "OnApplicationFocus", state);
     }
 }
Пример #13
0
 /// <summary>
 /// 关闭界面调用(销毁和隐藏都会调用)
 /// </summary>
 public void OnClose()
 {
     if (!IgnoreSoundEffect() && !isQuit)
     {
         LuaHelper.GetSoundManager().PlayUISound("panel-close");
     }
     Util.CallMethod(name, "OnClose");
 }
Пример #14
0
 /// <summary>
 /// 执行Lua方法
 /// </summary>
 protected object[] CallMethod(string func, params object[] args)
 {
     if (!initialize)
     {
         return(null);
     }
     return(Util.CallMethod(name, func, args));
 }
Пример #15
0
        public void OnRefresh()
        {
            LuaManager.LuaGC();
            string sceneName = SceneManager.GetCurSceneName();

            LuaManager.DoFile("Logic/" + sceneName);                    //加载场景
            Util.CallMethod(sceneName, "OnInitOK");                     //初始化完成
        }
Пример #16
0
 protected void OnDestroy()
 {
     if (!isQuit)
     {
         Util.CallMethod(name, "OnDestroy", gameObject);
     }
     Debugger.Log(string.Format("~{0} was destroy!", name));
 }
Пример #17
0
        void OnInitialize()
        {
            LuaManager.InitStart();
            LuaManager.DoFile("Logic/Game");         //加载游戏
            Util.CallMethod("Game", "OnInitOK");     //初始化完成

            KBEngine.Event.fireIn("onResourceInitFinish");
            initialize = true;
        }
Пример #18
0
 /// <summary>
 /// 执行Lua方法
 /// </summary>
 public static object[] CallMethod(String func, params object[] args)
 {
     //这个参数写法不熟悉,暂时只传字符串
     foreach (object s in args)
     {
         datastr = (String)s;
     }
     return(Util.CallMethod("MyNetwork", func, datastr));
 }
Пример #19
0
        void OnInitialize()
        {
            LuaManager.InitStart();
            LuaManager.DoFile("Logic/Game");         //加载游戏
            LuaManager.DoFile("Logic/Network");      //加载网络
            NetManager.OnInit();                     //初始化网络
            Util.CallMethod("Game", "OnInitOK");     //初始化完成

            initialize = true;
        }
Пример #20
0
        void OnInitialize()
        {
            LuaManager.InitStart();
            LuaManager.DoFile("GameLoader");            //加载游戏
            LuaManager.DoFile("Common/Network");        //加载网络 **可以在Gameloaer中进行require 不用写这里也行
            NetworkManager.CreateInstance();            //初始化网络  **可以在Gameloaer中进行 不用写这里也行 NetManager.OnInit();
            Util.CallMethod("GameLoader", "Init");      //初始化完成

            initialize = true;
        }
Пример #21
0
 protected void OnDestroy()
 {
     Util.CallMethod(base.name, "OnDestroy", new object[]
     {
         base.gameObject
     });
     this.ClearUIEvent();
     Util.ClearMemory();
     Debug.Log("~" + base.name + " was destroy!");
 }
Пример #22
0
        void OnInitialize()
        {
            ConfigManager.instance.LoadAllConfigs();

            LuaManager.Instance.InitStart();
            LuaManager.Instance.DoFile("Global/Game"); //加载游戏
            Util.CallMethod("Game", "OnInitOK");       //初始化完成

            initialize = true;
        }
Пример #23
0
        protected void Awake()
        {
            LuaTable table = LuaClient.GetMainState().GetTable(name);

            if (table == null)
            {
                throw new LuaException(string.Format("Lua table {0} not exists", name));
            }

            Util.CallMethod(name, "Awake", gameObject, this);
        }
Пример #24
0
        //-----------------------------------------------------------------
        protected void OnDestroy()
        {
            Util.CallMethod(name.Substring(name.IndexOf('.') + 1), "OnDestroy");
            ClearClick();
#if ASYNC_MODE
            string abName = name.Substring(0, name.IndexOf('.')).ToLower();
            ResManager.UnloadAssetBundle(abName + AppConst.ExtName);
#endif
            Util.ClearMemory();
            Debug.Log("~" + name + " was destroy!");
        }
Пример #25
0
        //-----------------------------------------------------------------
        protected void OnDestroy()
        {
            ClearClick();
#if ASYNC_MODE
            string abName = name.ToLower().Replace("panel", "");
            ResManager.UnloadAssetBundle(abName + AppConst.ExtName);
#endif
            Util.ClearMemory();
            Util.CallMethod(name, "OnDestroy");
            Debug.Log("~" + name + " was destroy!");
        }
Пример #26
0
        /// <summary>
        /// 资源初始化结束
        /// </summary>
        public void OnResourceInited()
        {
            LuaManager.InitStart();
            LuaManager.DoFile("Logic/Network");         //加载网络
            LuaManager.DoFile("Logic/GameManager");     //加载游戏
            NetManager.OnInit();                        //初始化网络
            LuaComponent.Initailize();

            Util.CallMethod("GameManager", "OnInitOK"); //初始化完成
            initialize = true;                          //初始化完
        }
Пример #27
0
        public void OnInitialize()
        {
            LuaManager.InitStart();

            LuaManager.DoFile("EscapeRoom/Game");      //加载游戏
            //LuaManager.DoFile("Logic/Network");      //加载网络
            //NetManager.OnInit();                     //初始化网络
            Util.CallMethod("Game", "OnInitOK", LuaFileUtils.Instance.GetPackagePath());       //初始化完成

            initialize = true;
        }
Пример #28
0
        void OnInitialize()
        {
            LuaManager.InitStart();
            string sceneName = SceneManager.GetCurSceneName();

            LuaManager.DoFile("Logic/" + sceneName);        //加载场景
            LuaManager.DoFile("Logic/Network");             //加载网络
            NetManager.OnInit();                            //初始化网络
            Util.CallMethod(sceneName, "OnInitOK");         //初始化完成

            initialize = true;
        }
Пример #29
0
        void Update()
        {
            float dt = Time.deltaTime;

            LuaTimerManager.instance.Update(dt);
            LuaBattleManager.instance.Update(dt);

            if (initialize)
            {
                Util.CallMethod("WindowManager", "Update", dt);
            }
        }
Пример #30
0
        /// <summary>
        /// 资源初始化结束
        /// </summary>
        public void OnResourceInited()
        {
            LuaManager.InitStart();
            LuaManager.DoFile("Logic/Game");            //加载游戏
            LuaManager.DoFile("Logic/Network");         //加载网络
            NetManager.OnInit();                        //初始化网络

            Util.CallMethod("Game", "OnInitOK");        //初始化完成
            initialize = true;                          //初始化完

            //类对象池测试
            var classObjPool = ObjPoolManager.CreatePool <TestObjectClass>(OnPoolGetElement, OnPoolPushElement);

            //方法1
            //objPool.Release(new TestObjectClass("abcd", 100, 200f));
            //var testObj1 = objPool.Get();

            //方法2
            ObjPoolManager.Release <TestObjectClass>(new TestObjectClass("abcd", 100, 200f));
            var testObj1 = ObjPoolManager.Get <TestObjectClass>();

            Debugger.Log("TestObjectClass--->>>" + testObj1.ToString());

            //游戏对象池测试
            var prefab      = Resources.Load("TestGameObjectPrefab", typeof(GameObject)) as GameObject;
            var gameObjPool = ObjPoolManager.CreatePool("TestGameObject", 5, 10, prefab);

            var gameObj = Instantiate(prefab) as GameObject;

            gameObj.name = "TestGameObject_01";
            gameObj.transform.localScale    = Vector3.one;
            gameObj.transform.localPosition = Vector3.zero;

            ObjPoolManager.Release("TestGameObject", gameObj);
            var backObj = ObjPoolManager.Get("TestGameObject");

            backObj.transform.SetParent(null);

            Debug.Log("TestGameObject--->>>" + backObj);

            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite));
            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite1));
            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite2));
            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite3));
            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite4));
            PoolManager.Instance.Get("TestGameObjectPrefab", "TestGameObjectPrefab", new Action <UnityEngine.Object>(LoadComplite5));

            /* PoolManager.Instance.Get("TestGameObjectPrefab","TestGameObjectPrefab",(obj)=>{
             *  GameObject temp = obj as GameObject;
             *
             * }); */
        }