public PagePanel() { this.panelContainer = new ContainerWidget(); this.panelContainer.Clip = false; base.AddChildLast(this.panelContainer); this.sprtContainer = new ContainerWidget(); this.sprtContainer.Clip = false; base.AddChildLast(this.sprtContainer); this.panelList = new List <Panel>(); this.sprtList = new List <UISprite>(); this.pageCount = 0; this.pageIndex = -1; base.Clip = true; base.HookChildTouchEvent = true; this.state = PagePanel.AnimationState.None; this.activeImage = new ImageAsset(SystemImageAsset.PagePanelActive); this.normalImage = new ImageAsset(SystemImageAsset.PagePanelNormal); DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.Direction = FlickDirection.Horizontal; flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); }
public LiveListPanel() { this.sprt = new UISprite(1); base.RootUIElement.AddChildLast(this.sprt); this.itemContainerPanel = new ContainerWidget(); base.AddChildLast(this.itemContainerPanel); this.scrollBar = new ScrollBar(ScrollBarOrientation.Vertical); base.AddChildLast(this.scrollBar); this.BackgroundColor = default(UIColor); this.ItemCount = 0; this.ItemVerticalGap = 32f; this.ItemHeight = 95f; this.usingItemDataList = new List <LiveListPanel.ListItemData>(); this.cacheItemDataList = new List <LiveListPanel.ListItemData>(); this.Width = 320f; this.Height = 480f; base.Clip = true; base.HookChildTouchEvent = true; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); this.elapsedTimes = new float[60]; }
public ListPanel() { this.backgroundSprt = new UISprite(1); base.RootUIElement.AddChildLast(this.backgroundSprt); UISpriteUnit unit = this.backgroundSprt.GetUnit(0); unit.Color = new UIColor(0f, 0f, 0f, 0f); this.scrollBar = new ScrollBar(ScrollBarOrientation.Vertical); this.AddChildLast(this.scrollBar); this.displayAllItems = new List <ListPanelItem>(); this.displayListItems = new List <ListPanelItem>(); this.cacheListItems = new List <ListPanelItem>(); this.displaySectionItems = new List <ListPanel.ListPanelSectionItem>(); this.cacheSectionItems = new List <ListPanel.ListPanelSectionItem>(); this.animationState = ListPanel.AnimationState.None; this.terminalState = ListPanel.TerminalState.None; this.terminalDistance = 0f; this.Sections = null; this.ShowSection = true; this.ShowEmptySection = true; this.ShowItemBorder = true; base.Clip = true; base.HookChildTouchEvent = true; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); }
public LiveScrollPanel() { this.animationSprt = new UISprite(1); this.animationSprt.InternalShaderType = InternalShaderType.LiveScrollPanel; this.animationSprt.TextureWrapMode = (TextureWrapMode)1; this.animationSprt.BlendMode = BlendMode.Premultiplied; this.animationSprt.Visible = false; base.RootUIElement.AddChildLast(this.animationSprt); this.MaxTextureWidth = this.defaultMaxTextureWidth; this.MaxTextureHeight = this.defaultMaxtextureHeight; this.needPartialTexture = false; this.textureOffsetX = 0f; this.textureOffsetY = 0f; this.frontPanel = new Panel(); base.AddChildLast(this.frontPanel); this.frontPanel.Clip = true; this.frontPanel.X = 0f; this.frontPanel.Y = 0f; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); base.Clip = true; this.HorizontalScroll = true; this.VerticalScroll = true; this.animationState = LiveScrollPanel.AnimationState.None; base.HookChildTouchEvent = true; base.Width = 600f; base.Height = 300f; this.UpdateView(); }
public LiveSphere() { int num = this.sphereDiv; int num2 = this.sphereDiv * 2; this.spherePrim = new UIPrimitive((DrawMode)4, (num + 1) * (num2 + 1), num * 2 * (num2 + 1)); this.spherePrim.Culling = true; this.spherePrim.InternalShaderType = InternalShaderType.LiveSphere; float num3 = 3.14159274f / (float)num; float num4 = 6.28318548f / (float)num2; float num5 = 1f / (float)num2; float num6 = 1f / (float)num; for (int i = 0; i < num + 1; i++) { for (int j = 0; j < num2 + 1; j++) { float num7 = -(float)Math.Sin((double)((float)i * num3)) * (float)Math.Cos((double)((float)j * num4)); float num8 = -(float)Math.Cos((double)((float)i * num3)); float num9 = -(float)Math.Sin((double)((float)i * num3)) * (float)Math.Sin((double)((float)j * num4)); UIPrimitiveVertex vertex = this.spherePrim.GetVertex(i * (num2 + 1) + j); vertex.Position3D = new Vector3(num7, num8, num9); vertex.U = num5 * (float)j; vertex.V = num6 * (float)i; } } ushort[] array = new ushort[num * 2 * (num2 + 1)]; for (int k = 0; k < num; k++) { for (int l = 0; l < num2 + 1; l++) { array[k * (num2 + 1) * 2 + l * 2] = (ushort)(k * (num2 + 1) + l); array[k * (num2 + 1) * 2 + l * 2 + 1] = (ushort)((k + 1) * (num2 + 1) + l); } } this.spherePrim.SetIndices(array); base.RootUIElement.AddChildLast(this.spherePrim); this.LightDirection = new Vector4((float)(Math.Sin((double)this.LightZAngle) * Math.Cos((double)this.LightYAngle)), (float)Math.Cos((double)this.LightZAngle), (float)(Math.Sin((double)this.LightZAngle) * Math.Sin((double)this.LightYAngle)), 0f); this.spherePrim.ShaderUniforms["Shininess"] = new float[] { this.Shininess }; this.spherePrim.ShaderUniforms["Specular"] = new float[] { this.Specular }; this.SetSize(this.radius * 2f, this.radius * 2f); this.flickGesture = new FlickGestureDetector(); this.flickGesture.Direction = FlickDirection.All; this.flickGesture.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(this.flickGesture); this.dragGesture = new DragGestureDetector(); this.dragGesture.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(this.dragGesture); this.PriorityHit = true; }
public SpinList() { this.basePanel = new Panel(); base.AddChildLast(this.basePanel); base.HookChildTouchEvent = true; this.IsLoop = true; this.scrollAreaLineNum = 1; this.listItemNum = 0; this.ItemGapLine = 0f; this.cacheLineCount = 1; this.IsItemFit = true; this.ScrollAreaFirstLine = 0; this.focusIndex = InternalSpinBox.SpinList.itemIdNoFocus; this.lastSelectIndex = InternalSpinBox.SpinList.itemIdNoSelect; this.cacheStartIndex = InternalSpinBox.SpinList.noCache; this.cacheEndIndex = InternalSpinBox.SpinList.noCache; this.isSetup = false; this.animationState = InternalSpinBox.SpinList.AnimationState.None; this.flickDistance = 0f; this.flickInterpRate = 0.09f; this.flickSpeedCoeff = 0.03f; this.fitTargetIndex = 0; this.fitTargetOffsetPixel = 0f; this.fitInterpRate = 0.2f; this.isPress = false; this.startTouchPos = Vector2.Zero; this.listItem = new List <InternalSpinBox.SpinList.ListContainer>(); this.poolItem = new List <InternalSpinBox.SpinList.ListContainer>(); this.minDelayDragDist = 5f; base.Clip = true; this.FocusChanged = null; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); }
public ScrollPanel() { this.panel = new Panel(); this.panel.Clip = true; base.AddChildLast(this.panel); this.scrollBarH = new ScrollBar(ScrollBarOrientation.Horizontal); this.scrollBarV = new ScrollBar(ScrollBarOrientation.Vertical); base.AddChildLast(this.scrollBarH); base.AddChildLast(this.scrollBarV); this.animationState = ScrollPanel.AnimationState.None; base.Clip = true; base.HookChildTouchEvent = true; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(dragGestureDetector); FlickGestureDetector flickGestureDetector = new FlickGestureDetector(); flickGestureDetector.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(flickGestureDetector); this.UpdateView(); }
public LiveFlipPanel() { this.frontPanel = new Panel(); if (!this.isUseSprite) { this.frontPanel.PivotType = PivotType.MiddleCenter; } base.AddChildLast(this.frontPanel); this.backPanel = new Panel(); if (!this.isUseSprite) { this.backPanel.PivotType = PivotType.MiddleCenter; } base.AddChildLast(this.backPanel); this.backPanel.Visible = false; this.frontSprt = new UISprite(1); this.frontSprt.ShaderType = ShaderType.OffscreenTexture; this.frontSprt.Culling = true; this.frontSprt.Visible = false; base.RootUIElement.AddChildLast(this.frontSprt); this.backSprt = new UISprite(1); this.backSprt.ShaderType = ShaderType.OffscreenTexture; this.backSprt.Culling = true; this.backSprt.Visible = false; base.RootUIElement.AddChildLast(this.backSprt); base.HookChildTouchEvent = true; this.flickGesture = new FlickGestureDetector(); this.flickGesture.Direction = FlickDirection.Horizontal; this.flickGesture.FlickDetected += new EventHandler <FlickEventArgs>(this.FlickEventHandler); base.AddGestureDetector(this.flickGesture); this.dragGesture = new DragGestureDetector(); this.dragGesture.DragDetected += new EventHandler <DragEventArgs>(this.DragEventHandler); base.AddGestureDetector(this.dragGesture); this.Width = 100f; this.Height = 100f; }
private void ShowDialog() { if (this.dialog == null) { this.previousSelectedIndex = this.SelectedIndex; this.listSelectedIndex = this.SelectedIndex; this.dialog = new PopupList.CancellableDialog(this); this.dialog.TouchEventReceived += new EventHandler <TouchEventArgs>(this.DialogTouchEventReceived); Label label = new Label(); label.X = 10f; label.Y = 0f; label.Text = this.ListTitle; label.HorizontalAlignment = HorizontalAlignment.Center; this.dialog.AddChildLast(label); int num = label.Font.GetTextWidth(this.ListTitle); foreach (string current in this.ListItems) { int textWidth = this.selectedLabel.Font.GetTextWidth(current); if (num < textWidth) { num = textWidth; } } this.dialog.Width = (float)num * 1.5f; if (this.dialog.Width < this.dialogMinWidth) { this.dialog.Width = this.dialogMinWidth; } if (this.dialogMaxWidth < this.dialog.Width) { this.dialog.Width = this.dialogMaxWidth; } this.dialog.Height = 50f * (float)(this.listItems.Count + 1) + 10f; if (this.dialog.Height < this.dialogMinHeight) { this.dialog.Height = this.dialogMinHeight; } if (this.dialogMaxHeight < this.dialog.Height) { this.dialog.Height = this.dialogMaxHeight; } label.Width = this.dialog.Width - 20f; label.Height = 50f; ListSectionCollection sections = new ListSectionCollection { new ListSection("", this.ListItems.Count) }; ListPanel listPanel = new ListPanel(); listPanel.X = label.X; listPanel.Y = label.Y + label.Height; listPanel.Width = label.Width; listPanel.Height = this.dialog.Height - (label.Y + label.Height) - 10f; listPanel.SetListItemCreator(new ListItemCreator(this.ListItemCreator)); listPanel.SetListItemUpdater(new ListItemUpdater(this.ListItemUpdater)); listPanel.ShowSection = false; listPanel.Sections = sections; DragGestureDetector dragGestureDetector = new DragGestureDetector(); dragGestureDetector.DragDetected += new EventHandler <DragEventArgs>(this.dragEventHandler); listPanel.AddGestureDetector(dragGestureDetector); listPanel.PriorityHit = this.PriorityHit; this.dialog.AddChildLast(listPanel); int num2 = (int)(listPanel.Height / 50f); float num3 = (float)(this.listSelectedIndex - num2 / 2); float num4 = -(num3 * 50f); if (num2 % 2 == 0) { num4 -= 25f; } listPanel.Move(num4); FadeInEffect fadeInEffect = new FadeInEffect(); fadeInEffect.Time = 300f; this.dialog.ShowEffect = fadeInEffect; this.dialog.Show(); } }