コード例 #1
0
ファイル: Launcher.cs プロジェクト: sorfgame/unity3d-lolo
        /// <summary>
        /// 重启项目(动更完成后)
        /// </summary>
        private void Relaunch()
        {
            // destroy
            Common.luaMgr.Destroy();
            Destroy(Common.looper);
            Destroy(Stage.uiCanvas.gameObject);

            // clear reference
            Stage.ClearReference();
            AudioManager.ClearReference();
            SafeAreaLayout.ClearReference();
            LocalizationText.ClearReference();
            ViewPager.ClearReference();
            TcpSocket.ClearReference();
            UdpSocket.ClearReference();
            NetHelper.ClearReference();
            DestroyEventDispatcher.ClearReference();
            PointerEventDispatcher.ClearReference();
            TriggerEventDispatcher.ClearReference();
            DragDropEventDispatcher.ClearReference();
            StageTouchEventDispatcher.ClearReference();
            AvailabilityEventDispatcher.ClearReference();

            // unload
            ResManager.UnloadAll();

            // relaunch
            StartCoroutine(Launch());
        }
コード例 #2
0
        /// <summary>
        /// 在指定的 gameObject 上添加 TriggerEventDispatcher 脚本。
        /// 当 gameObject 产生 Trigger 相关行为时,派发事件。
        /// </summary>
        /// <param name="go">Go.</param>
        /// <param name="ed">Ed.</param>
        public static void AddTriggerEvent(GameObject go, LuaTable ed)
        {
            TriggerEventDispatcher dispatcher = go.GetComponent <TriggerEventDispatcher>();

            if (dispatcher == null)
            {
                dispatcher = go.AddComponent <TriggerEventDispatcher>();
            }
            dispatcher.ed = ed;
        }