예제 #1
0
파일: TextGui.cs 프로젝트: wt616/JxqyHD
 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);
 }
예제 #2
0
파일: ListItem.cs 프로젝트: zy1911/JxqyHD
 public ListItem(
     GuiItem parent,
     Vector2 position,
     int width,
     int height,
     Texture baseTexture
     )
     : base(parent, position, width, height, baseTexture)
 {
 }
예제 #3
0
 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;
 }
예제 #4
0
파일: ListView.cs 프로젝트: zy1911/JxqyHD
        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;
        }
예제 #5
0
        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);
                };
            }
        }
예제 #6
0
파일: LineText.cs 프로젝트: zy1911/JxqyHD
 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;
 }
예제 #7
0
파일: ListView.cs 프로젝트: wt616/JxqyHD
        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;
        }
예제 #8
0
파일: ListView.cs 프로젝트: wt616/JxqyHD
 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)
 {
 }
예제 #9
0
파일: TextGui.cs 프로젝트: wt616/JxqyHD
 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()
 }
예제 #10
0
파일: TextGui.cs 프로젝트: wt616/JxqyHD
 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);
 }
예제 #11
0
 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;
 }
예제 #12
0
        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);
                }
            };
        }
예제 #13
0
파일: ColumnView.cs 프로젝트: zy1911/JxqyHD
 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;
 }
예제 #14
0
 public Bmp(GuiItem parent, Vector2 position, string filePath, int drawWidth, int drawHeight)
     : base(parent, position, drawWidth, drawHeight, null)
 {
     IsShow      = true;
     BmpFilePath = filePath;
 }