Example #1
0
        public NavigationScene()
        {
            base.Visible         = false;
            this.navigationPanel = new Panel
            {
                Width           = (float)UISystem.FramebufferWidth,
                Height          = NavigationScene.navigationBarHeight,
                X               = 0f,
                Y               = -NavigationScene.navigationBarHeight,
                BackgroundColor = new UIColor(0f, 0f, 0f, 0f)
            };
            base.RootWidget.AddChildLast(this.navigationPanel);
            this.backgroundImage = new ImageBox
            {
                Width           = this.navigationPanel.Width,
                Height          = this.navigationPanel.Height,
                X               = 0f,
                Y               = 0f,
                ImageScaleType  = ImageScaleType.NinePatch,
                Image           = new ImageAsset(SystemImageAsset.NavigationBarBackground),
                NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.NavigationBarBackground)
            };
            this.navigationPanel.AddChildLast(this.backgroundImage);
            CustomButtonImageSettings customImage = new CustomButtonImageSettings
            {
                BackgroundNormalImage     = new ImageAsset(SystemImageAsset.BackButtonBackgroundNormal),
                BackgroundPressedImage    = new ImageAsset(SystemImageAsset.BackButtonBackgroundPressed),
                BackgroundDisabledImage   = new ImageAsset(SystemImageAsset.BackButtonBackgroundDisabled),
                BackgroundNinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.BackButtonBackgroundNormal)
            };
            float num  = (NavigationScene.navigationBarHeight - NavigationScene.backButtonHeight) / 2f;
            Font  font = new Font(0, NavigationScene.navigationBarFontSize, 0);

            this.backButtonCurrent = new Button
            {
                Width       = NavigationScene.backButtonWidth,
                Height      = NavigationScene.backButtonHeight,
                X           = num,
                Y           = num,
                TextFont    = font,
                Style       = ButtonStyle.Custom,
                CustomImage = customImage,
                Visible     = false
            };
            this.backButtonCurrent.ButtonAction += new EventHandler <TouchEventArgs>(NavigationScene.PopAction);
            this.navigationPanel.AddChildLast(this.backButtonCurrent);
            this.backButtonNext = new Button
            {
                Width       = NavigationScene.backButtonWidth,
                Height      = NavigationScene.backButtonHeight,
                X           = num,
                Y           = num,
                TextFont    = font,
                Style       = ButtonStyle.Custom,
                CustomImage = customImage,
                Visible     = false
            };
            this.backButtonNext.ButtonAction += new EventHandler <TouchEventArgs>(NavigationScene.PopAction);
            this.navigationPanel.AddChildLast(this.backButtonNext);
            float num2 = this.navigationPanel.Width - NavigationScene.backButtonWidth * 2f - num * 2f;

            this.leftLabelPosX   = -num2;
            this.centerLabelPosX = NavigationScene.backButtonWidth + num;
            this.rightLabelPosX  = (float)UISystem.FramebufferWidth;
            this.labelCurrent    = new Label
            {
                Width  = num2,
                Height = this.navigationPanel.Height,
                X      = this.centerLabelPosX,
                Y      = 0f,
                Font   = font,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Middle
            };
            this.navigationPanel.AddChildLast(this.labelCurrent);
            this.labelNext = new Label
            {
                Width  = num2,
                Height = this.navigationPanel.Height,
                X      = this.rightLabelPosX,
                Y      = 0f,
                Font   = font,
                HorizontalAlignment = HorizontalAlignment.Center,
                VerticalAlignment   = VerticalAlignment.Middle,
                Visible             = false
            };
            this.navigationPanel.AddChildLast(this.labelNext);
            this.panelShowMoveEffect = new MoveEffect
            {
                Widget             = this.navigationPanel,
                Interpolator       = MoveEffectInterpolator.Custom,
                CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator),
                Time = NavigationScene.showHideAnimationDuration,
                X    = 0f,
                Y    = 0f
            };
            this.panelHideMoveEffect = new MoveEffect
            {
                Widget             = this.navigationPanel,
                Interpolator       = MoveEffectInterpolator.Custom,
                CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator),
                Time = NavigationScene.showHideAnimationDuration,
                X    = 0f,
                Y    = -NavigationScene.navigationBarHeight
            };
            this.panelHideMoveEffect.EffectStopped += new EventHandler <EventArgs>(this.OnPanelHideMoveEffectStopped);
            this.labelCurrentMoveEffect             = new MoveEffect
            {
                Interpolator       = MoveEffectInterpolator.Custom,
                CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator),
                Time = NavigationScene.stackAnimationTime
            };
            this.labelCurrentMoveEffect.EffectStopped += new EventHandler <EventArgs>(this.OnLabelMoveEffectStopped);
            this.labelCurrentFadeOutEffect             = new FadeOutEffect
            {
                Interpolator = FadeOutEffectInterpolator.Linear,
                Time         = NavigationScene.stackAnimationTime
            };
            this.labelNextMoveEffect = new MoveEffect
            {
                Interpolator       = MoveEffectInterpolator.Custom,
                CustomInterpolator = new AnimationInterpolator(NavigationScene.EaseOutQuartInterpolator),
                Time = NavigationScene.stackAnimationTime
            };
            this.labelNextFadeInEffect = new FadeInEffect
            {
                Interpolator = FadeInEffectInterpolator.Linear,
                Time         = NavigationScene.stackAnimationTime
            };
            this.backButtonCurrentFadeOutEffect = new FadeOutEffect
            {
                Interpolator = FadeOutEffectInterpolator.Linear,
                Time         = NavigationScene.stackAnimationTime
            };
            this.backButtonNextFadeInEffect = new FadeInEffect
            {
                Interpolator = FadeInEffectInterpolator.Linear,
                Time         = NavigationScene.stackAnimationTime
            };
        }