protected void Awake() { Util.CallMethod(base.get_name(), "Awake", new object[] { base.get_gameObject() }); }
protected void OnClickEvent(GameObject go) { Util.CallMethod(base.get_name(), "OnClick", new object[] { go }); }
protected void Awake() { if (!string.IsNullOrWhiteSpace(sLogicName)) { Util.CallMethod("ViewMgr", "Awake", sLogicName, gameObject); } }
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); }
void Update() { if (initialize) { Util.CallMethod("Game", "Update"); //初始化完成 } }
/// <summary> /// 初始化Lua虚拟机 /// </summary> void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Manager/GameManager"); //加载游戏 Util.CallMethod("GameManager", "Init"); //初始化完成 initialize = true; }
void OnSceneLoaded(Scene scence, LoadSceneMode mod) { int level = scence.buildIndex; Util.CallMethod("GameMain", "OnLevelWasLoaded", level); Debug.Log("level:" + level); }
protected void Awake() { Util.CallMethod(base.name, "Awake", new object[] { base.gameObject }); }
private void OnClick() { Util.CallMethod("ITEMLOGIC", "OnClickItemInfo", new object[] { this.itemId }); }
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); } }
/// <summary> /// 析构函数 /// </summary> void OnDestroy() { if (LuaManager != null) { Util.CallMethod("Game", "OnDestroy"); LuaManager.Close(); } }
void OnApplicationFocus(bool state) { Debug.Log("========OnApplicationFocus " + state); if (state) { Util.CallMethod("Game", "OnApplicationFocus", state); } }
/// <summary> /// 关闭界面调用(销毁和隐藏都会调用) /// </summary> public void OnClose() { if (!IgnoreSoundEffect() && !isQuit) { LuaHelper.GetSoundManager().PlayUISound("panel-close"); } Util.CallMethod(name, "OnClose"); }
/// <summary> /// 执行Lua方法 /// </summary> protected object[] CallMethod(string func, params object[] args) { if (!initialize) { return(null); } return(Util.CallMethod(name, func, args)); }
public void OnRefresh() { LuaManager.LuaGC(); string sceneName = SceneManager.GetCurSceneName(); LuaManager.DoFile("Logic/" + sceneName); //加载场景 Util.CallMethod(sceneName, "OnInitOK"); //初始化完成 }
protected void OnDestroy() { if (!isQuit) { Util.CallMethod(name, "OnDestroy", gameObject); } Debugger.Log(string.Format("~{0} was destroy!", name)); }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 Util.CallMethod("Game", "OnInitOK"); //初始化完成 KBEngine.Event.fireIn("onResourceInitFinish"); initialize = true; }
/// <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)); }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("GameLoader"); //加载游戏 LuaManager.DoFile("Common/Network"); //加载网络 **可以在Gameloaer中进行require 不用写这里也行 NetworkManager.CreateInstance(); //初始化网络 **可以在Gameloaer中进行 不用写这里也行 NetManager.OnInit(); Util.CallMethod("GameLoader", "Init"); //初始化完成 initialize = true; }
protected void OnDestroy() { Util.CallMethod(base.name, "OnDestroy", new object[] { base.gameObject }); this.ClearUIEvent(); Util.ClearMemory(); Debug.Log("~" + base.name + " was destroy!"); }
void OnInitialize() { ConfigManager.instance.LoadAllConfigs(); LuaManager.Instance.InitStart(); LuaManager.Instance.DoFile("Global/Game"); //加载游戏 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; }
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); }
//----------------------------------------------------------------- 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!"); }
//----------------------------------------------------------------- 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!"); }
/// <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; //初始化完 }
public void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("EscapeRoom/Game"); //加载游戏 //LuaManager.DoFile("Logic/Network"); //加载网络 //NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK", LuaFileUtils.Instance.GetPackagePath()); //初始化完成 initialize = true; }
void OnInitialize() { LuaManager.InitStart(); string sceneName = SceneManager.GetCurSceneName(); LuaManager.DoFile("Logic/" + sceneName); //加载场景 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod(sceneName, "OnInitOK"); //初始化完成 initialize = true; }
void Update() { float dt = Time.deltaTime; LuaTimerManager.instance.Update(dt); LuaBattleManager.instance.Update(dt); if (initialize) { Util.CallMethod("WindowManager", "Update", dt); } }
/// <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; * * }); */ }