public void RegisterHandlers() { string handlePath = ""; if (AppConst.LuaBundleMode) { handlePath = Util.DataPath + "lua/protocol/handlers.txt"; } else { handlePath = AppConst.FrameworkRoot + "/Lua/protocol/handlers.txt"; } string text = File.ReadAllText(handlePath); string[] handlers = text.Split(';'); for (int i = 0; i < handlers.Length; ++i) { if (string.IsNullOrEmpty(handlers[i])) { continue; } string fileName = string.Format("protocol/handler/{0}", handlers[i]); LuaManager.DoFile(fileName); } }
/// <summary> /// 初始化Lua虚拟机 /// </summary> void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Manager/GameManager"); //加载游戏 Util.CallMethod("GameManager", "Init"); //初始化完成 initialize = true; }
/// <summary> /// 资源初始化结束 /// </summary> public void OnResourceInited() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/GameManager"); //加载游戏 initialize = true; //初始化完 NetManager.OnInit(); //初始化网络 object[] panels = CallMethod("LuaPanels"); //---------------------Lua面板--------------------------- foreach (object o in panels) { string name = o.ToString().Trim(); if (string.IsNullOrEmpty(name)) { continue; } LuaManager.DoFile("View/" + name); Debug.LogWarning("LoadLua---->>>>" + name + ".lua"); } //------------------------------------------------------------ CallMethod("OnInitOK"); //初始化完成 }
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); }
public void OnRefresh() { LuaManager.LuaGC(); string sceneName = SceneManager.GetCurSceneName(); LuaManager.DoFile("Logic/" + sceneName); //加载场景 Util.CallMethod(sceneName, "OnInitOK"); //初始化完成 }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 Util.CallMethod("Game", "OnInitOK"); //初始化完成 KBEngine.Event.fireIn("onResourceInitFinish"); 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; }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; }
public static void DoFile(string name) { LuaManager luaMgr = AppFacade.Instance.GetManager <LuaManager>(ManagerName.Lua); if (luaMgr == null) { return; } luaMgr.DoFile(name); }
/// <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; }
/// <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; * * }); */ }
void Init() { LuaManager.DoFile("Controller/GameCtrl"); LuaManager.CallFunction("GameCtrl.New"); if (Application.isMobilePlatform) { LuaManager.CallFunction("GameCtrl.Awake", true); } else { LuaManager.CallFunction("GameCtrl.Awake", false); } }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 Util.CallMethod("Game", "OnInitOK"); //初始化完成 KBEMain km = GameObject.Find("ClientApp").GetComponent <KBEMain>(); if (km != null) { km.initKBEngine(); } initialize = true; }
// Use this for initialization private void Start() { m_CharacterController = GetComponent <CharacterController>(); LuaManager.DoFile("Controller/FirstPersonController"); if (Application.isMobilePlatform) { LuaManager.CallFunction("GameCtrl.New", true); } else { LuaManager.CallFunction("GameCtrl.New", false); } LuaManager.CallFunction("FirstPersonController.Start", gameObject); }
public void LuaInit(string enterType = "test") { LuaManager.InitStart(); LuaManager.DoFile("start"); //加载游戏 LuaManager.DoFile("logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 //在Raz每次切换场景后,需要将之前的界面都卸载,然后根据载入场景的类型显示界面。 //LuaManager.CallLuaFunction("GameManager.OnInitOK"); LuaManager.CallLuaFunction <string>("GameManager.OnInitOK", enterType); //在Raz中已经占用了这个系统类名,在SceneManager对应的地方直接调用函数好了。 //SceneManager.sceneLoaded += delegateOnSceneLoaded; initialize = true; test(); //testSocket(); }
static int DoFile(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); LuaFramework.LuaManager obj = (LuaFramework.LuaManager)ToLua.CheckObject <LuaFramework.LuaManager>(L, 1); string arg0 = ToLua.CheckString(L, 2); obj.DoFile(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
void OnInitialize() { if (Application.loadedLevelName == "roundfight") { string[] soldierTags = new string[] { "neutraltroop", "redtroop", "bluetroop" }; foreach (string tagname in soldierTags) { foreach (GameObject soldier in GameObject.FindGameObjectsWithTag(tagname)) { soldier.GetComponent <ChampionBehaviour>().InitSlider(); } } } 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); }
private void LuaStart() { LuaManager.bundleProgress = LuaBundleProgress; LuaManager.InitStart(() => { var bar = ProgressBar.ShowCurBar(); bar.UpdateProgress(1); bar.Hide(); LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Common/define"); LuaManager.DoFile("Logic/Game"); //加载游戏 NetManager.OnInit(); //初始化网络 Util.CallMethod("Game", "OnInitOK"); //初始化完成 RegisterHandlers(); //注册协议处理 }); }
void OnInitialize() { LuaManager.InitStart(); LuaBehaviour.initialize = true; LuaManager.DoFile("Main"); //加载游戏 //LuaManager.DoFile("Logic/Network"); //加载网络 //NetManager.OnInit(); //初始化网络 Util.CallMethod("Main", "main"); //初始化完成 // 初始化数据db DbLoader.init(); // 初始化mgr gameObject.AddComponent <MgrScene>(); gameObject.AddComponent <MgrPanel>(); gameObject.AddComponent <MgrTimer>(); }
void OnInitialize() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 LuaManager.DoFile("Logic/ObjectPool"); NetManager.OnInit(); //初始化网络 ObjPoolManager.OnInit(); //初始化对象池 Util.CallMethod("Game", "OnInitOK", isReload); //初始化完成 initialize = true; //RenderTexture tex = new RenderTexture(128, 128, 1, RenderTextureFormat.ARGB32); //Texture2D texture2D = new Texture2D(256, 256); //texture2D.ReadPixels() //Sprite sprite = Sprite.Create(tx, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)); //类对象池测试 // 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); }
/// <summary> /// 资源初始化结束 /// </summary> public void OnResourceInited() { LuaManager.InitStart(); LuaManager.DoFile("Logic/Game"); //加载游戏 LuaManager.DoFile("Logic/Network"); //加载网络 NetManager.OnInit(); //初始化网络 Debug.Log("Game OnInitOk"); Util.CallMethod("Game", "OnInitOK"); //初始化完成 initialize = true; //初始化完 ShareSDK ssdk = gameObject.GetComponent <ShareSDK>(); if (ssdk == null) { ssdk = gameObject.AddComponent <ShareSDK>(); ssdk.enabled = true; } else { ssdk.enabled = true; } //TestObject(); }
public void FromAndroidData(string ip) { LuaManager.DoFile("controller/BankCtrl"); Util.CallMethod("BankCtrl", "getIpAddress", ip); }
void testSocket() { LuaManager.DoFile("ui/test/test_socket"); Util.CallMethod("TestSocket", "FuncTest"); }
public void WeChatCallBack(string response) { LuaManager.DoFile("controller/LoginCtrl"); Util.CallMethod("LoginCtrl", "wechatLogin", response); }
public void openLogin() { LuaManager.DoFile("View.lua"); LuaManager.CallFunction("View:start"); }