init() public method

public init ( Action tick, System.Action complete, LuaSvrFlag flag = LuaSvrFlag.LSF_BASIC ) : void
tick Action
complete System.Action
flag LuaSvrFlag
return void
Exemplo n.º 1
0
 void Start()
 {
     net     = LNet.instance;
     ChatNet = LNet.ChatInstance;
     lua.init(null, () =>
              { LoadBundle(true); });
 }
Exemplo n.º 2
0
	// Use this for initialization
	void Start () {
        l = new LuaSvr();
		l.init(null, () =>
		{
			l.start("valuetype");
		});
	}
Exemplo n.º 3
0
	// Use this for initialization
	void Start()
	{
		l = new LuaSvr();
		l.init(null,()=>{
			l.start("delegate");
		});
	}
Exemplo n.º 4
0
 private LuaModule()
 {
     #if UNITY_EDITOR
     UnityEngine.Debug.Log("Consturct LuaModule...");
     #endif
     _luaSvr = new LuaSvr();
     _luaSvr.init(progress => { }, () => { });
 }
Exemplo n.º 5
0
	// Use this for initialization
	void Start()
	{
		l = new LuaSvr();
		l.init(null, () =>
		{
			l.start("varobj");
		});
	}
Exemplo n.º 6
0
	void Start () {
		svr = new LuaSvr();
		svr.init(null, () =>
		{
			self = (LuaTable)svr.start("circle/circle");
			update = (LuaFunction)self["update"];
		});
	}
Exemplo n.º 7
0
 void Start()
 {
     CUtils.DebugCastTime("Plua Start");
     lua.init(null, () =>
     {
         CUtils.DebugCastTime("Slua binded");
         DoMain();
     });
 }
Exemplo n.º 8
0
 public static LuaSvr getInstance()
 {
     if (_inst == null)
     {
         _inst = new LuaSvr();
         _inst.init(null, () => { });
     }
     return(_inst);
 }
Exemplo n.º 9
0
	void Start()
	{
		c = this;
		l = new LuaSvr();
		l.init(null, () =>
		{
			l.start("custom");
		});
	}
Exemplo n.º 10
0
 void Start()
 {
     #if UNITY_5
     Application.logMessageReceived += this.log;
     #else
     Application.RegisterLogCallback(this.log);
     #endif
     _l = new LuaSvr();
     _l.init(tick, complete, LuaSvrFlag.LSF_BASIC);
 }
Exemplo n.º 11
0
	// Use this for initialization
	void Start()
	{
#if UNITY_5
		Application.logMessageReceived += this.log;
#else
		Application.RegisterLogCallback(this.log);
#endif

		l = new LuaSvr();
		l.init(tick,complete,true);
	}
Exemplo n.º 12
0
        /// <summary>
        /// Pre Init Lua.
        /// </summary>
        /// <param name="sconds">Sconds.</param>
        public void PreInitLua () {
#if !HUGULA_RELEASE
            Debug.LogFormat ("ManagedThreadId = {0},frame={1}", System.Threading.Thread.CurrentThread.ManagedThreadId, Time.frameCount);
#endif
            if (lua == null) lua = new Lua ();
            Debug.LogFormat ("PreInitLua {0}", lua);
            CUtils.DebugCastTime ("");
            lua.init (null, () => {
                CUtils.DebugCastTime ("Slua binded");
                isLuaInitFinished = true;
            }, LuaSvrFlag.LSF_3RDDLL);
        }
Exemplo n.º 13
0
    private void doInit()
    {
        luacache = new Dictionary <string, byte[]>();
        lua      = new Lua();
        Lua.mainState.loaderDelegate = Loader;

        lua.init(this.progress, () =>
        {
            LoadBundle();
            this.m_tick = null;
        }, LuaSvrFlag.LSF_BASIC | LuaSvrFlag.LSF_EXTLIB | LuaSvrFlag.LSF_3RDDLL);
    }
Exemplo n.º 14
0
 /// <summary>
 /// Pre Init Lua.
 /// </summary>
 /// <param name="sconds">Sconds.</param>
 public static void PreInitLua()
 {
     if (lua == null)
     {
         lua = new Lua();
     }
     CUtils.DebugCastTime("");
     lua.init(null, () =>
     {
         CUtils.DebugCastTime("Slua binded");
         isLuaInitFinished = true;
     }, LuaSvrFlag.LSF_3RDDLL);
 }
Exemplo n.º 15
0
	// Use this for initialization
	void Start()
	{
		var startMem = System.GC.GetTotalMemory (true);

		var start = Time.realtimeSinceStartup;
		l = new LuaSvr();
		l.init(null, () =>
		{
			Debug.Log ("start cost: " + (Time.realtimeSinceStartup - start));

			var endMem = System.GC.GetTotalMemory (true);
			Debug.Log ("startMem: " + startMem + ", endMem: " + endMem + ", " + "cost mem: " + (endMem - startMem));
			l.start("perf");
		});

#if UNITY_5
		Application.logMessageReceived += this.log;
#else
		Application.RegisterLogCallback(this.log);
#endif
	}
Exemplo n.º 16
0
	public override IEnumerator SetupAsync ()
	{
		Debug.Log ("~~~ setup Lua Service");

		yield return base.SetupAsync ();

		l = new LuaSvr();
		bool _isLoaded = false;

		LuaState.loaderDelegate = LoadLuaFile;

		l.init (null, () => {
			_isLoaded = true;	
		});

		while (!_isLoaded)
			yield return null;

		//TODO:在这里调用lua环境初始化脚本有一点问题,线上的版本assetbundle可能存在于两个地方:StreammingAssets or PersistentDataPath
		//在UpdateService执行完更新逻辑之前,任何调用可热更资源都可能造成读脏数据

		//Init lua libs
		RunString("require \"core/Init\"");

		//net msg callback
		var luaNetMgr = (LuaTable)RunString("return NetMgr");
		var func = luaNetMgr["OnReceiveMessage"] as LuaFunction;
		OnEvent<Packet>().ObserveOnMainThread().Subscribe((packet) => {
			//Debug.Log("call lua networkService:OnReceivePacket");
			func.call(luaNetMgr, packet);
		});


		Debug.Log ("Lua Service setup completed.");

	}
Exemplo n.º 17
0
 void Start()
 {
     lua.init(null, () =>
              { LoadBundle(true); });
 }
Exemplo n.º 18
0
	void Start()
	{
		l = new LuaSvr();
		l.init(null, () =>{
			LuaTests t = new LuaTests();
			t.lua = l.luaState;
			t.lua.doString ("TestClass=NLuaTest.Mock.TestClass");

			MethodInfo[] methods = t.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly);

			int pass = 0;
			int failed = 0;

			int i = 0;
			foreach(MethodInfo m in methods)
			{
				++i;
				try{
					Debug.Log("start test: " + m.Name);
					m.Invoke(t, null);
					++pass;
				}catch(Exception e)
				{
					++failed;
					Debug.LogError("[" + i + "] test failed: " + m.Name + ", e: "  + e);
				}
			}
			Debug.Log("test done. pass: "******", failed: " + failed);
		});
	}
Exemplo n.º 19
0
 // Use this for initialization
 void Start()
 {
     SLua.LuaState.loaderDelegate = Loader;
     lua = new SLua.LuaSvr();
     lua.init(tick,complete,true);
 }
Exemplo n.º 20
0
    void Start()
    {
        Application.targetFrameRate = LGameConfig.DEFAULT_FRAME_RATE;

        if(_l == null)
        {
        #if UNITY_5
        Application.logMessageReceived += this.log;
        #else
        Application.RegisterLogCallback(this.log);
        #endif
            LuaState.loaderDelegate = loadFileWithSuffix;
            _l = new LuaSvr();
            _l.init(tick, complete);
        }
        else
        {
            complete();
        }
    }
Exemplo n.º 21
0
	void Start()
	{
		l = new LuaSvr();
		l.init(null,()=>{l.start("sproto_test");});
	}
Exemplo n.º 22
0
    private IEnumerator _Setup()
    {
        LuaState.loaderDelegate = LoadFile;
        _svr = new LuaSvr();
        _svr.init(delegate(int obj) {

        },delegate() {
            _isInited = true;
        },LuaSvrFlag.LSF_3RDDLL);
        while(!isInited){
            yield return null;
        }
    }
Exemplo n.º 23
0
	void Start()
	{
		l = new LuaSvr();
		l.init(null,()=>{l.start("lua_socket_test");});
	}
Exemplo n.º 24
0
	void Start()
	{
		l = new LuaSvr();
		l.init(null,()=>{l.start("sqliteTest");});
	}
Exemplo n.º 25
0
	void Start()
	{
		l = new LuaSvr();
		l.init(null,()=>{l.start("cjsonTest");});
	}