Beispiel #1
0
		public static LuaMain getInstance()
		{
			if (mInstance == null) {
				mInstance = new LuaMain();  
				mInstance.init();
			}
			return mInstance;
		}
Beispiel #2
0
 public static LuaMain getInstance()
 {
     if (mInstance == null)
     {
         mInstance = new LuaMain();
         mInstance.init();
     }
     return(mInstance);
 }
Beispiel #3
0
        public static void Dispose()
        {
            mInstance = null;
            if (luaCoroutine != null)
            {
                GameObject.Destroy(luaCoroutine);
            }
            if (mLuaState != null)
            {
                mLuaState.Dispose();
                mLuaState = null;
            }

//			UnityEngine.SceneManagement.SceneManager.LoadScene ("ARBookFramework_BookMenu");
//			LuaMain.assetBundleLoaded = false;
//			LuaMain.getDisposeInstance().Destroy ();
        }
Beispiel #4
0
        //初始化函数,可以被重写,已添加其他
        protected virtual bool Init()
        {
            mSelfLuaTable = LuaMain.getInstance().addLuaFile(LuaPath, gameObject);
            LuaClassName  = CallLuaFunctionRString("getClassName");

            mSelfLuaTable["gameObject"] = gameObject;
            mSelfLuaTable["transform"]  = transform;


            // if (gameObject.GetComponent<Button>() != null)
            // {
            //  gameObject.GetComponent<Button>().onClick.AddListener(
            //      onClick
            //  );
            // }

            return(true);
        }
Beispiel #5
0
        void Awake()
        {
#if UNITY_EDITOR
            QLuaComponent.isFirstLaunch = false;
#endif
            if (LuaMain.nextClearBundles)
            {
                LuaMain.Dispose();
                LuaMain.nextClearBundles = false;
            }
            if (LuaMain.loadBundles != null && LuaMain.loadBundles.Length > 0)
            {
                bundles = LuaMain.loadBundles;
            }
            for (int i = 0; i < bundles.Length; i++)
            {
                AddBundle(bundles [i]);
            }
        }
Beispiel #6
0
        //初始化函数,可以被重写,已添加其他
        protected virtual bool Init()
        {
            mSelfLuaTable = LuaMain.getInstance().addLuaFile(LuaPath, gameObject);

            LuaClassName = CallLuaFunctionRString("getClassName");
            mSelfLuaTable["gameObject"] = gameObject;
            mSelfLuaTable["transform"]  = transform;
//			mSelfLuaTable.Push ();
            //add button func
            if (gameObject.GetComponent <Button>() != null)
            {
                gameObject.GetComponent <Button>().onClick.AddListener(
                    delegate() {
                    onClick();
                }
                    );
            }


            return(true);
        }
Beispiel #7
0
		public static void Dispose(){
			mInstance = null;
			if (luaCoroutine != null) {
				GameObject.Destroy (luaCoroutine);
			}
			if (mLuaState != null) {
				mLuaState.Dispose ();
				mLuaState = null;
			}

//			UnityEngine.SceneManagement.SceneManager.LoadScene ("ARBookFramework_BookMenu");
//			LuaMain.assetBundleLoaded = false;
//			LuaMain.getDisposeInstance().Destroy ();

		}