public TextGui(GuiItem parent, Vector2 position, int width, int height, SpriteFont font, string text) { Init(parent, position, width, height, font, 0, 0, text, Color.Black); }
public ListItem( GuiItem parent, Vector2 position, int width, int height, Texture baseTexture ) : base(parent, position, width, height, baseTexture) { }
public BackgroundColorLayer( GuiItem parent, Vector2 position, Vector2 anchor, int width, int height, Color color) : base(parent, position, width, height, null) { BaseTexture = new Texture(new Asf(TextureGenerator.GetColorTexture(color, 1, 1))); Anchor = anchor; }
public ListView(GuiItem parent, Vector2 position, Vector2 scrollBarPosition, int width, int height, Texture baseTexture, int rowCouunts, KeyDataCollection config, int slideBarWidth, int slideBarHeight, string slideButtonImage, bool useTopLeftText = true) : base(parent, position, width, height, baseTexture) { _config = config; InitializeItems(useTopLeftText); var slideTexture = Utils.GetAsf(null, slideButtonImage); var slideBaseTexture = new Texture(slideTexture); var slideClikedTexture = new Texture(slideTexture, 0, 1); var slideButton = new GuiItem(this, Vector2.Zero, slideBaseTexture.Width, slideBaseTexture.Height, slideBaseTexture, null, slideClikedTexture, null, Utils.GetSoundEffect("界-大按钮.wav")); _scrollBar = new ScrollBar(this, slideBarWidth, slideBarHeight, null, ScrollBar.ScrollBarType.Vertical, slideButton, scrollBarPosition, 0, rowCouunts - 1 - 2, 0); _scrollBar.Scrolled += delegate(object arg1, ScrollBar.ScrolledEvent arg2) { if (Scrolled != null) { Scrolled(this, new ListScrollEvent(arg2.Value)); } }; MouseScrollUp += (arg1, arg2) => _scrollBar.Value -= 1; MouseScrollDown += (arg1, arg2) => _scrollBar.Value += 1; }
public ListTextItem( GuiItem parent, Vector2 position, int width, int height, Texture baseTexture, int itemCount, string[] itemText, int extraCharecterSpace, int extraLineSpace, int itemHeight, Color textColor, Color selectedTextColor, SoundEffect itemClickSound ) : base(parent, position, width, height, baseTexture) { _textColor = textColor; _seclectedTextColor = selectedTextColor; _itemClickSound = itemClickSound; //Create items _items = new TextGui[itemCount]; for (var i = 0; i < itemCount; i++) { _items[i] = new TextGui(this, new Vector2(0, i * itemHeight), width, itemHeight, Globals.FontSize12, extraCharecterSpace, extraLineSpace, itemText[i], textColor); int index = i; _items[i].Click += (arg1, arg2) => { //Handle item click event OnItemClick(new ListItemClickEvent(index)); if (_itemClickSound != null) { _itemClickSound.Play(); } SetSelectionIndex(index); }; } }
public LineText(GuiItem parent, Vector2 position, int width, int height, Align textAlign, string text, Color color, SpriteFont font) : base(parent, position, width, height, null) { TextAlign = textAlign; Text = text; DrawColor = color; Font = font; }
public ListView(GuiItem parent, Vector2 position, Vector2 scrollBarPosition, int width, int height, Texture baseTexture, int rowCouunts, Vector2 itemPositionOffset) : base(parent, position, width, height, baseTexture) { _itemPositinOffset = itemPositionOffset; InitializeItems(); var slideTexture = Utils.GetAsf(@"asf\ui\option\", "slidebtn.asf"); var slideBaseTexture = new Texture(slideTexture); var slideClikedTexture = new Texture(slideTexture, 0, 1); var slideButton = new GuiItem(this, Vector2.Zero, slideBaseTexture.Width, slideBaseTexture.Height, slideBaseTexture, null, slideClikedTexture, null, Utils.GetSoundEffect("界-大按钮.wav")); _scrollBar = new ScrollBar(this, 28, 190, null, ScrollBar.ScrollBarType.Vertical, slideButton, scrollBarPosition, 0, rowCouunts - 1 - 2, 0); _scrollBar.Scrolled += delegate(object arg1, ScrollBar.ScrolledEvent arg2) { if (Scrolled != null) { Scrolled(this, new ListScrollEvent(arg2.Value)); } }; MouseScrollUp += (arg1, arg2) => _scrollBar.Value -= 1; MouseScrollDown += (arg1, arg2) => _scrollBar.Value += 1; }
public ListView(GuiItem parent, Vector2 position, Vector2 scrollBarPosition, int width, int height, Texture baseTexture, int rowCouunts) : this(parent, position, scrollBarPosition, width, height, baseTexture, rowCouunts, Vector2.Zero) { }
public void Init(GuiItem parent, Vector2 position, int width, int height, SpriteFont font, int extureCharecterSpace, int extureLineSpace, string text, Color defaultColor) { Parent = parent; Position = position; Width = width; Height = height; Font = font; ExtureCharacterSpace = extureCharecterSpace; ExtureLineSpace = extureLineSpace; DefaultColor = defaultColor; Text = text;// must be the last, because it invoke Caculate() }
public TextGui(GuiItem parent, Vector2 position, int width, int height, SpriteFont font, int extraCharecterSpace, int extraLineSpace, string text, Color defaultColor) { Init(parent, position, width, height, font, extraCharecterSpace, extraLineSpace, text, defaultColor); }
public GuiItem( GuiItem parent, Vector2 position, int width, int height, Texture baseTexture, Texture mouseOverTexture = null, Texture clickedTexture = null, SoundEffect enteredSound = null, SoundEffect clickedSound = null) { Parent = parent; Position = position; Width = width; Height = height; BaseTexture = baseTexture; MouseOverTexture = mouseOverTexture; ClickedTexture = clickedTexture; EnteredSound = enteredSound; ClickedSound = clickedSound; }
public void Init(GuiItem parent, Vector2 position, int width, int height, SpriteFont font, int extureCharecterSpace, int extureLineSpace, string text, Align align, Color defaultColor) { _autoHeight = height <= 0; Parent = parent; Position = position; Width = width; Height = height; Font = font; ExtureCharacterSpace = extureCharecterSpace; ExtureLineSpace = extureLineSpace; DefaultColor = defaultColor; TextAlign = align; Text = text;// must be the last, because it invoke Caculate() MouseMove += (arg1, arg2) => { if (RealScreenRectangle.Contains(new Point((int)arg2.MouseScreenPosition.X, (int)arg2.MouseScreenPosition.Y))) { _inRange = true; MouseEnterText?.Invoke(arg1, arg2); } else if (_inRange && !RealScreenRectangle.Contains(new Point((int)arg2.MouseScreenPosition.X, (int)arg2.MouseScreenPosition.Y))) { _inRange = false; MouseLeaveText?.Invoke(arg1, arg2); } }; }
public ColumnView(GuiItem parent, Vector2 position, int width, int height, Texture baseTexture, float percent = 1f) : base(parent, position, width, height, null) { Percent = percent; BaseTexture = baseTexture; }
public Bmp(GuiItem parent, Vector2 position, string filePath, int drawWidth, int drawHeight) : base(parent, position, drawWidth, drawHeight, null) { IsShow = true; BmpFilePath = filePath; }