public void Load (string id, View view) {

			if (activeContainer == null) {

				// Initialize if this is the first time loading a view
				activeContainer = container1;
				activeContainer.LoadView (id, view);
				activeContainer.SetInputEnabled ();
				inactiveContainer = container2;
				inactiveContainer.RectTransform.SetAnchoredPositionX (canvasWidth);
			} else {
				inactiveContainer.LoadView (id, view);

				// Trigger the slide animation
				// If the new screen and previous screen have a transition override specified, use that
				// Otherwise, use the default behaviour
				bool slideIn;
				if (transitionOverrides.TryGetValue (prevId + " " + id, out slideIn)) {
					if (slideIn) {
						SlideIn ();
					} else {
						SlideOut ();
					}
				} else {
					if (inactiveContainer.TemplateIsBefore (id, prevId)) {
						SlideOut ();
					} else {
						SlideIn ();
					}
				}
			}

			prevId = id;
		}
        void UpdateActiveContainer()
        {
            TemplateContainer temp = activeContainer;

            activeContainer   = inactiveContainer;
            inactiveContainer = temp;
        }
 void OnEnable()
 {
     canvasWidth = canvas.GetComponent <RectTransform> ().sizeDelta.x;
     container1  = TemplateContainer.Init(this, 0);
     container2  = TemplateContainer.Init(this, 1);
     anim        = UIAnimator.AttachTo(gameObject);
 }
        public void Load(string id, View view)
        {
            if (activeContainer == null)
            {
                // Initialize if this is the first time loading a view
                activeContainer = container1;
                activeContainer.LoadView(id, view);
                activeContainer.SetInputEnabled();
                inactiveContainer = container2;
                inactiveContainer.RectTransform.SetAnchoredPositionX(canvasWidth);
            }
            else
            {
                inactiveContainer.LoadView(id, view);

                // Trigger the slide animation
                // If the new screen and previous screen have a transition override specified, use that
                // Otherwise, use the default behaviour
                bool slideIn;
                if (transitionOverrides.TryGetValue(prevId + " " + id, out slideIn))
                {
                    if (slideIn)
                    {
                        SlideIn();
                    }
                    else
                    {
                        SlideOut();
                    }
                }
                else
                {
                    if (inactiveContainer.TemplateIsBefore(id, prevId))
                    {
                        SlideOut();
                    }
                    else
                    {
                        SlideIn();
                    }
                }
            }

            prevId = id;
        }
Esempio n. 5
0
        public static TemplateContainer Init(TemplatesContainer myContainer, int siblingIndex)
        {
            TemplateContainer c = ObjectPool.Instantiate <TemplateContainer> ();

            c.transform.SetParent(myContainer.transform);
            c.transform.SetSiblingIndex(siblingIndex);
            c.RectTransform.localScale       = Vector3.one;
            c.RectTransform.anchoredPosition = Vector2.zero;
            c.RectTransform.sizeDelta        = Vector2.zero;
            c.InitOverlayElements(myContainer);

            // All templates should be deactivated to start
            foreach (Template template in c.templates)
            {
                template.gameObject.SetActive(false);
            }

            return(c);
        }
		void OnEnable () {
			canvasWidth = canvas.GetComponent<RectTransform> ().sizeDelta.x;
			container1 = TemplateContainer.Init (this, 0);
			container2 = TemplateContainer.Init (this, 1);
			anim = UIAnimator.AttachTo (gameObject);
		}
		void UpdateActiveContainer () {
			TemplateContainer temp = activeContainer;
			activeContainer = inactiveContainer;
			inactiveContainer = temp;
		}