public Slider() { this.baseImageAssets = new ImageAsset[Enum.GetValues(typeof(SliderOrientation)).Length]; this.baseImageAssets[1] = new ImageAsset(SystemImageAsset.SliderVerticalBaseNormal); this.baseImageAssets[0] = new ImageAsset(SystemImageAsset.SliderHorizontalBaseNormal); this.baseImageNinePatchMargins = new NinePatchMargin[Enum.GetValues(typeof(SliderOrientation)).Length]; this.baseImageNinePatchMargins[1] = AssetManager.GetNinePatchMargin(SystemImageAsset.SliderVerticalBaseNormal); this.baseImageNinePatchMargins[0] = AssetManager.GetNinePatchMargin(SystemImageAsset.SliderHorizontalBaseNormal); this.barImageAssets = new ImageAsset[Enum.GetValues(typeof(SliderOrientation)).Length]; this.barImageAssets[1] = new ImageAsset(SystemImageAsset.SliderVerticalBarNormal); this.barImageAssets[0] = new ImageAsset(SystemImageAsset.SliderHorizontalBarNormal); this.barImageNinePatchMargins = new NinePatchMargin[Enum.GetValues(typeof(SliderOrientation)).Length]; this.barImageNinePatchMargins[1] = AssetManager.GetNinePatchMargin(SystemImageAsset.SliderVerticalBarNormal); this.barImageNinePatchMargins[0] = AssetManager.GetNinePatchMargin(SystemImageAsset.SliderHorizontalBarNormal); this.handleImageAssets = new ImageAsset[Enum.GetValues(typeof(SliderOrientation)).Length, Enum.GetValues(typeof(Slider.SliderState)).Length]; this.handleImageAssets[1, 0] = new ImageAsset(SystemImageAsset.SliderVerticalHandleNormal); this.handleImageAssets[1, 1] = new ImageAsset(SystemImageAsset.SliderVerticalHandlePressed); this.handleImageAssets[1, 2] = new ImageAsset(SystemImageAsset.SliderVerticalHandleDisabled); this.handleImageAssets[0, 0] = new ImageAsset(SystemImageAsset.SliderHorizontalHandleNormal); this.handleImageAssets[0, 1] = new ImageAsset(SystemImageAsset.SliderHorizontalHandlePressed); this.handleImageAssets[0, 2] = new ImageAsset(SystemImageAsset.SliderHorizontalHandleDisabled); this.baseImage = new ImageBox(); this.baseImage.ImageScaleType = ImageScaleType.NinePatch; this.baseImage.TouchResponse = false; base.AddChildLast(this.baseImage); this.barImage = new ImageBox(); this.barImage.ImageScaleType = ImageScaleType.NinePatch; this.barImage.TouchResponse = false; base.AddChildLast(this.barImage); this.handleImage = new ImageBox(); this.handleImage.ImageScaleType = ImageScaleType.NinePatch; base.AddChildLast(this.handleImage); this.value = 0f; this.minValue = 0f; this.maxValue = 1f; this.state = Slider.SliderState.Normal; this.ValueChangeEventEnabled = true; this.ValueChanging = null; this.ValueChanged = null; this.handleClickPos = Vector2.Zero; this.Orientation = SliderOrientation.Horizontal; base.HookChildTouchEvent = true; this.PriorityHit = true; this.UpdateView(); }
public ScrollBar(ScrollBarOrientation orientation) { this.Orientation = orientation; this.baseImage = new ImageBox(); base.AddChildLast(this.baseImage); this.barImage = new ImageBox(); base.AddChildLast(this.barImage); switch (this.Orientation) { case ScrollBarOrientation.Horizontal: base.Width = this.defaultScrollBarHorizontalWidth; base.Height = this.defaultScrollBarHorizontalHeight; this.baseImage.Image = new ImageAsset(SystemImageAsset.ScrollBarHorizontalBackground); this.baseImage.Width = this.defaultScrollBarHorizontalWidth; this.baseImage.Height = this.defaultScrollBarHorizontalHeight; this.baseImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ScrollBarHorizontalBackground); this.baseImage.ImageScaleType = ImageScaleType.NinePatch; this.barImage.Image = new ImageAsset(SystemImageAsset.ScrollBarHorizontalBar); this.barImage.Width = this.defaultScrollBarHorizontalWidth; this.barImage.Height = this.defaultScrollBarHorizontalHeight; this.barImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ScrollBarHorizontalBar); this.barImage.ImageScaleType = ImageScaleType.NinePatch; return; case ScrollBarOrientation.Vertical: base.Width = this.defaultScrollBarVerticalWidth; base.Height = this.defaultScrollBarVerticalHeight; this.baseImage.Image = new ImageAsset(SystemImageAsset.ScrollBarVerticalBackground); this.baseImage.Width = this.defaultScrollBarVerticalWidth; this.baseImage.Height = this.defaultScrollBarVerticalHeight; this.baseImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ScrollBarVerticalBackground); this.baseImage.ImageScaleType = ImageScaleType.NinePatch; this.barImage.Image = new ImageAsset(SystemImageAsset.ScrollBarVerticalBar); this.barImage.Width = this.defaultScrollBarVerticalWidth; this.barImage.Height = this.defaultScrollBarVerticalHeight; this.barImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ScrollBarVerticalBar); this.barImage.ImageScaleType = ImageScaleType.NinePatch; return; default: return; } }
public ProgressBar() { base.Width = 362f; base.Height = 16f; this.progress = 0f; this.style = ProgressBarStyle.Normal; this.animationElapsedTime = 0f; this.baseImage = new ImageBox(); this.baseImage.Image = new ImageAsset(SystemImageAsset.ProgressBarBase); this.baseImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ProgressBarBase); this.baseImage.ImageScaleType = ImageScaleType.NinePatch; this.baseImage.Width = 362f; this.baseImage.Height = 16f; base.AddChildLast(this.baseImage); this.barImage = new ImageBox(); this.barImage.Image = new ImageAsset(SystemImageAsset.ProgressBarNormal); this.barImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.ProgressBarNormal); this.barImage.ImageScaleType = ImageScaleType.NinePatch; this.barImage.Width = 0f; this.barImage.Height = 16f; base.AddChildLast(this.barImage); this.acceleratorSprt = new UISprite(1); this.acceleratorSprt.X = 3f; this.acceleratorSprt.Y = 3f; this.acceleratorSprt.ShaderType = ShaderType.Texture; this.acceleratorSprt.Image = new ImageAsset(SystemImageAsset.ProgressBarAccelerator); this.acceleratorSprt.Visible = false; this.acceleratorSprt.TextureWrapMode = 0; this.acceleratorSprt.BlendMode = BlendMode.Add; this.acceleratorSprt.Alpha = 0.5f; this.barImage.RootUIElement.AddChildLast(this.acceleratorSprt); UISpriteUnit unit = this.acceleratorSprt.GetUnit(0); unit.Width = 0f; unit.Height = (float)this.acceleratorSprt.Image.Height; }
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 }; }
public MessageDialog() : base(null, null) { base.Width = 500f; base.Height = 260f; base.X = (float)UISystem.FramebufferWidth * 0.1f; base.Y = (float)UISystem.FramebufferHeight * 0.05f; this.title = new Label(); this.title.SetPosition(15f, 15f); this.title.SetSize(470f, 70f); this.title.HorizontalAlignment = HorizontalAlignment.Center; this.title.VerticalAlignment = VerticalAlignment.Middle; this.title.TextColor = new UIColor(1f, 1f, 1f, 1f); this.title.Font = new Font(0, 28, 0); this.title.Text = ""; this.title.Anchors = (Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Right); this.AddChildLast(this.title); this.separatorImage = new ImageBox(); this.separatorImage.X = 35f; this.separatorImage.Y = 85f; this.separatorImage.Width = 430f; this.separatorImage.Height = 2f; this.separatorImage.Image = new ImageAsset(SystemImageAsset.MessageDialogSeparator); this.separatorImage.NinePatchMargin = AssetManager.GetNinePatchMargin(SystemImageAsset.MessageDialogSeparator); this.separatorImage.ImageScaleType = ImageScaleType.NinePatch; this.separatorImage.Anchors = (Anchors.Top | Anchors.Height | Anchors.Left | Anchors.Right); this.AddChildLast(this.separatorImage); this.okButton = new Button(); this.okButton.Text = "OK"; this.okButton.ButtonAction += new EventHandler <TouchEventArgs>(this.ButtonExecute); this.cancelButton = new Button(); this.cancelButton.Text = "Cancel"; this.cancelButton.ButtonAction += new EventHandler <TouchEventArgs>(this.ButtonExecute); this.buttonPanel = new Panel(); this.buttonPanel.SetPosition(15f, 230f - this.okButton.Height); this.buttonPanel.SetSize(470f, this.okButton.Height); this.buttonPanel.BackgroundColor = default(UIColor); this.buttonPanel.Anchors = (Anchors.Bottom | Anchors.Height | Anchors.Width); this.AddChildLast(this.buttonPanel); this.buttonPanel.AddChildLast(this.okButton); this.buttonPanel.AddChildLast(this.cancelButton); this.messageScrollPanel = new ScrollPanel(); this.messageScrollPanel.SetPosition(35f, 105f); this.messageScrollPanel.SetSize(445f, 58f); this.messageScrollPanel.PanelWidth = this.messageScrollPanel.Width; this.messageScrollPanel.PanelHeight = this.messageScrollPanel.Height; this.messageScrollPanel.PanelColor = new UIColor(0f, 0f, 0f, 0f); this.messageScrollPanel.ScrollBarVisibility = ScrollBarVisibility.ScrollableVisible; this.messageScrollPanel.Anchors = (Anchors.Top | Anchors.Bottom | Anchors.Left | Anchors.Right); this.AddChildLast(this.messageScrollPanel); this.message = new Label(); this.message.Width = this.messageScrollPanel.PanelWidth - 15f; this.message.Height = this.messageScrollPanel.PanelHeight; this.message.TextColor = new UIColor(1f, 1f, 1f, 1f); this.message.Font = new Font(0, 24, 0); this.message.HorizontalAlignment = HorizontalAlignment.Left; this.message.VerticalAlignment = VerticalAlignment.Top; this.message.Text = ""; this.message.Anchors = (Anchors.Top | Anchors.Bottom | Anchors.Left | Anchors.Right); this.messageScrollPanel.AddChildLast(this.message); this.Style = MessageDialogStyle.OkCancel; this.ShowTitle = true; this.PriorityHit = true; this.Width = (float)((int)((float)UISystem.FramebufferWidth * 0.8f)); this.Height = (float)((int)((float)UISystem.FramebufferHeight * 0.9f)); }