Example #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();
            //});
        }