Esempio n. 1
0
        private void OpenPageWorker(string scene, string page, object arg)
        {
            LDebugger.Log(this.GetType().ToString(), "OpenPageWork() scene:{0},page:{1},arg:{2} ", scene, page, arg);
            string oldScene = SceneManager.GetActiveScene().name;

            mCurrentPage       = new UIPageTrack();
            mCurrentPage.scene = scene;
            mCurrentPage.name  = page;
            CloseAllLoadedPanels();
            if (oldScene == scene)
            {
                Open <UIPage>(page, arg);
            }
            else
            {
                mOnSceneLoaded = (sceneName) =>
                {
                    if (sceneName.Equals(scene))
                    {
                        mOnSceneLoaded = null;
                        Open <UIPage>(page, arg);
                    }
                };
                SceneManager.LoadScene(scene);
            }
        }
Esempio n. 2
0
        public static GameObject LoadPrefab(string prefabName)
        {
            LDebugger.Log("UIRes::LoadPrefab ", UIResRoot + prefabName);
            GameObject asset = Resources.Load <GameObject>(UIResRoot + prefabName);

            return(asset);
        }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     UIAPI.ShowMsgBox("testTitle", "testContent", "yes|no|cancel",
                      (args) =>
     {
         LDebugger.Log(this.GetType().ToString(), "testMsgBox" + args);
     });
 }
Esempio n. 4
0
 public void OpenPage(string scene, string page, object arg = null)
 {
     LDebugger.Log(this.GetType().ToString(), "OpenPage() scene:{0},page:{1},args:{2}", scene, page, arg);
     if (mCurrentPage != null)
     {
         mUIPageTrackStack.Push(mCurrentPage);
     }
     OpenPageWorker(scene, page, arg);
 }
Esempio n. 5
0
 public static void Save()
 {
     LDebugger.Log("GameConfig", "Save() Value=" + mConfig);
     if (mConfig != null)
     {
         byte[] data = PBSerializer.NSerialize(mConfig);
         FileUtils.SaveFile(Path, data);
     }
 }
Esempio n. 6
0
 public sealed override void Close(object args = null)
 {
     LDebugger.Log(GetType().ToString(), "Close()");
     if (this.gameObject.activeSelf)
     {
         this.gameObject.SetActive(false);
     }
     OnClose(args);
 }
Esempio n. 7
0
 public sealed override void Open(object args = null)
 {
     LDebugger.Log(this.GetType().ToString(), "Open(),{0}", args);
     mOpenArgs = args;
     if (!this.gameObject.activeSelf)
     {
         this.gameObject.SetActive(true);
     }
     OnOpen(args);
 }
Esempio n. 8
0
 public static void ReleaseEntity(EntityObject obj)
 {
     if (obj != null)
     {
         if (EnableLog && LDebugger.EnableLog)
         {
             LDebugger.Log(LOG_TAG, "ReleaseEntity() {0}:{1}", obj.GetType().Name, obj.GetHashCode());
         }
         obj.ReleaseInFactory();
     }
 }
Esempio n. 9
0
 public void GoBackPage()
 {
     LDebugger.Log(this.GetType().ToString(), "GoBackPage()");
     if (mUIPageTrackStack.Count > 0)
     {
         var track = mUIPageTrackStack.Pop();
         OpenPageWorker(track.scene, track.name, null);
     }
     else if (mUIPageTrackStack.Count == 0)
     {
         EnterMainPage();
     }
 }
Esempio n. 10
0
 public static void Init()
 {
     LDebugger.Log("GameConfig", "Init() Path=" + Path);
     byte[] data = FileUtils.ReadFile(Path);
     if (data != null && data.Length > 0)
     {
         GameConfig gameConfig = (GameConfig)PBSerializer.NDeserialize(data, typeof(GameConfig));
         if (gameConfig != null)
         {
             mConfig = gameConfig;
         }
     }
 }
Esempio n. 11
0
        internal void HandleMessage(string msg, object[] args)
        {
            LDebugger.Log(GetType().ToString(), "HandleMessage(),msg:{0},args{1}", msg, args);
            MethodInfo methodInfo = this.GetType().GetMethod(msg, BindingFlags.NonPublic | BindingFlags.Instance);

            if (methodInfo != null)
            {
                methodInfo.Invoke(this, BindingFlags.NonPublic, null, args, null);
            }
            else
            {
                OnModuleMessage(msg, args);
            }
        }
Esempio n. 12
0
        protected void OnEnable()
        {
            LDebugger.Log(this.GetType().ToString(), "OnEnable");
            if (mGoBackButton != null)
            {
                mGoBackButton.onClick.AddListener(OnGoBackButtonClicked);
            }
#if UNITY_EDITOR
            if (mIsOpenedOnce)
            {
                OnOpen(mOpenArgs);
            }
#endif
        }
Esempio n. 13
0
 public sealed override void Close(object args = null)
 {
     LDebugger.Log(this.GetType().ToString(), "Close() args= " + args);
     if (this.gameObject.activeSelf)
     {
         this.gameObject.SetActive(false);
     }
     OnClose(args);
     if (OnCloseEvent != null)
     {
         OnCloseEvent(args);
         OnCloseEvent = null;
     }
 }
Esempio n. 14
0
        protected void OnDisable()
        {
            LDebugger.Log(this.GetType().ToString(), "OnDisable()");
#if UNITY_EDITOR
            if (mIsOpenedOnce)
            {
                OnClose();
            }
#endif
            if (mGoBackButton != null)
            {
                mGoBackButton.onClick.RemoveAllListeners();
            }
        }
Esempio n. 15
0
        public static void CreateView(string resPath, string resDefaultPath, EntityObject entity, Transform parent = null)
        {
            ViewObject obj = null;

            //
            string recycleType  = resPath;
            bool   userRecycler = true;

            obj = mRecycler.Pop(recycleType) as ViewObject;
            if (obj == null)
            {
                userRecycler = false;
                //TODO
                obj = InstanceViewFromPrefab(recycleType, resDefaultPath);
            }
            else
            {
                if (!obj.gameObject.activeSelf)
                {
                    obj.gameObject.SetActive(true);
                }

                if (parent != null)
                {
                    obj.transform.SetParent(parent, false);
                }
                else
                {
                    obj.transform.SetParent(mViewRoot, false);
                }

                obj.CreateInFactory(entity, recycleType);

                if (EnableLog && LDebugger.EnableLog)
                {
                    LDebugger.Log(LOG_TAG, "CreateView() {0}:{1}->{2}:{3},UseRecycler :{4}",
                                  entity.GetType().Name,
                                  entity.GetHashCode(),
                                  obj.GetRecycleType(),
                                  obj.GetInstanceID(),
                                  userRecycler);
                }
                if (mObjectsMap.ContainsKey(entity))
                {
                    LDebugger.LogError(LOG_TAG, "CreateView() 不应该存在重复的映射");
                }
                mObjectsMap[entity] = obj;
            }
        }
Esempio n. 16
0
        public static T InstanceEntity <T>() where T : EntityObject, new ()
        {
            EntityObject obj         = null;
            bool         useRecycler = true;

            Type type = typeof(T);

            obj = mRecycler.Pop(type.FullName) as EntityObject;
            if (obj == null)
            {
                useRecycler = false;
                obj         = new T();
            }
            obj.InstanceInFactory();

            if (EnableLog && LDebugger.EnableLog)
            {
                LDebugger.Log(LOG_TAG, "InstanceEntity() {0}:{1}, useRecycler:{2}", obj.GetType().Name, obj.GetHashCode(), useRecycler);
            }
            return((T)obj);
        }
Esempio n. 17
0
        public static void ReleaseView(EntityObject entity)
        {
            if (entity != null)
            {
                ViewObject obj = mObjectsMap[entity];
                if (obj != null)
                {
                    if (EnableLog && LDebugger.EnableLog)
                    {
                        LDebugger.Log(LOG_TAG, "ReleaseView() {0}:{1}->{2}:{3}",
                                      entity.GetType().Name,
                                      entity.GetHashCode(),
                                      obj.GetRecycleType(),
                                      obj.GetInstanceID());
                    }

                    mObjectsMap.Remove(entity);
                    obj.ReleaseInFactory();
                    obj.gameObject.SetActive(false);
                    mRecycler.Push(obj);
                }
            }
        }
Esempio n. 18
0
 private void OnGoBackButtonClicked()
 {
     LDebugger.Log(this.GetType().ToString(), "OnGoBackButtonClicked()");
     //UIManager回退
     UIManager.Instance.GoBackPage();
 }
Esempio n. 19
0
 protected override void OnModuleMessage(string msg, object[] args)
 {
     base.OnModuleMessage(msg, args);
     LDebugger.Log(this.GetType().ToString(), "OnModuleMessage() msg:{0},args:{1},{2},{3}", msg, args[0], args[1], args[2]);
 }
Esempio n. 20
0
 protected void MessageFromA_2(string args0, int args1)
 {
     LDebugger.Log(this.GetType().ToString(), "MessageFromA_2() args:{0},{1}", args0, args1);
 }
Esempio n. 21
0
 private void OnLogin(bool args)
 {
     LDebugger.Log(this.GetType().ToString(), "OnLogin() args:{0}", args);
 }
Esempio n. 22
0
 private void OnModuleEventC(object args)
 {
     LDebugger.Log(this.GetType().ToString(), "OnModuleEventC() args:{0}", args);
 }
Esempio n. 23
0
 private void OnGoBackButtonClicked()
 {
     LDebugger.Log(this.GetType().ToString(), "OnGoBackButtonClicked()");
     Close();
 }
Esempio n. 24
0
 protected virtual void OnClose(object args = null)
 {
     LDebugger.Log(this.GetType().ToString(), "OnClose(),{0}", args);
 }
Esempio n. 25
0
 //UI框架逻辑
 public virtual void Open(object args = null)
 {
     LDebugger.Log(this.GetType().ToString(), "Open(),{0}", args);
 }
Esempio n. 26
0
 public virtual void Create(object args = null)
 {
     LDebugger.Log(GetType().ToString(), "Create() args={0}", args);
 }
Esempio n. 27
0
 private void OnWnd1Close(object arg)
 {
     LDebugger.Log(this.GetType().ToString(), "OnWnd1Close()");
 }
Esempio n. 28
0
 protected virtual void OnModuleMessage(string msg, object[] args)
 {
     LDebugger.Log(GetType().ToString(), "OnModuleMessage(),msg:{0},args:{1}", msg, args);
 }
Esempio n. 29
0
 public virtual void Release()
 {
     LDebugger.Log(this.GetType().ToString(), "Release");
 }