コード例 #1
0
        public void Open(NavigationObject obj)
        {
            if (CurrentArea != null && CurrentArea.AreaName == obj.AreaName)
            {
                return;
            }

            if (CurrentArea != null)
            {
                nextAreas.Add(obj);

                NextArea = GameObject.Instantiate(GetAreaReferenceFromName(obj.AreaName));

                NextArea.Init(obj.Params);

                Close();
                return;
            }

            history.Add(obj);


            if (NextArea != null)
            {
                CurrentArea = NextArea;
            }
            else
            {
                CurrentArea = GameObject.Instantiate(GetAreaReferenceFromName(obj.AreaName));
                CurrentArea.Init(obj.Params);
            }

            NextArea = null;

            //SimpleTimer.StartTimer (0.1f, delegate() {

            CurrentArea.transform.SetParent(areaTarget.transform);
            CurrentArea.transform.position = Vector3.zero;

            CurrentArea.GetComponent <Image>().rectTransform.offsetMin = new Vector2(0, 0);
            CurrentArea.GetComponent <Image>().rectTransform.offsetMax = new Vector2(0, 0);
            CurrentArea.OnNavigationEven += CurrentArea_OnNavigationEven;

            CurrentArea.transform.localScale = Vector3.one;

            CurrentArea.Open();
            //});
        }
コード例 #2
0
        void CurrentArea_OnNavigationEven(AreaState state, BaseArea area)
        {
            switch (state)
            {
            case AreaState.startOpen:

                break;

            case AreaState.endOpen:

                break;

            case AreaState.startClose:

                break;

            case AreaState.endClose:

                CurrentArea.OnNavigationEven -= CurrentArea_OnNavigationEven;
                Destroy(CurrentArea.gameObject);

                CurrentArea = null;

                if (nextAreas.Count > 0)
                {
                    NavigationObject next = nextAreas[0];
                    nextAreas.RemoveAt(0);
                    Open(next);
                }
                break;
            }

            if (OnNavigationEvent != null)
            {
                OnNavigationEvent(state, area);
            }
        }