Пример #1
0
        /// <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 上添加 DragDropEventDispatcher 脚本。
        /// 当 gameObject 与鼠标指针(touch)交互时,派发拖放相关事件。
        /// </summary>
        /// <param name="go">Go.</param>
        /// <param name="ed">Ed.</param>
        public static void AddDragDropEvent(GameObject go, LuaTable ed)
        {
            DragDropEventDispatcher dispatcher = go.GetComponent <DragDropEventDispatcher>();

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