public ScrollBar(GuiItem parent, int width, int height, Texture baseTexture, ScrollBarType type, GuiItem slider, Vector2 positon, int minValue, int maxValue, int value) : base(parent, positon, width, height, baseTexture) { Type = type; Slider = slider; switch (type) { case ScrollBarType.Vertical: Length = height; break; case ScrollBarType.Horizontal: Length = width; break; default: throw new ArgumentOutOfRangeException("type"); } MinValue = minValue; MaxValue = maxValue; Value = value; RegisterEvent(); }
private void InitializeItems() { string[] sectionNames = { "Top_State_Btn", "Top_Equip_Btn", "Top_XiuLian_Btn", "Top_Goods_Btn", "Top_Magic_Btn", "Top_Memo_Btn", "Top_System_Btn", }; for (var i = 0; i < 7; i++) { var cfg = GuiManager.Setttings.Sections[sectionNames[i]]; var asf = Utils.GetAsf(null, cfg["Image"]); var baseTexture = new Texture(asf, 0, 1); var clickedTexture = new Texture(asf, 1, 1); _buttons[i] = new GuiItem(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), baseTexture, null, clickedTexture, null, Utils.GetSoundEffect(cfg["Sound"])); } RegisterClickHandler(); }
public MagicGui() { var baseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel2.asf")); var position = new Vector2( Globals.WindowWidth / 2f, 0f); _listView = new ListView(null, position, new Vector2(294, 108), baseTexture.Width, baseTexture.Height, baseTexture, 12); _listView.Scrolled += delegate { UpdateItems(); }; _listView.RegisterItemDragHandler((arg1, arg2) => { }); _listView.RegisterItemDropHandler(DropHandler); _listView.RegisterItemMouseStayOverHandler(MouseStayOverHandler); _listView.RegisterItemMouseLeaveHandler(MouseLeaveHandler); _listView.RegisterItemMouseRightClickeHandler(MouseRightClickdHandler); IsShow = false; }
public DragDropItem(GuiItem parent, Vector2 position, int width, int height, Texture baseTexture, object data = null) : base(parent, position, width, height, baseTexture) { Data = data; MouseLeftDown += delegate(object arg1, MouseLeftDownEvent arg2) { GuiManager.DragDropSourceItem = this; GuiManager.DragDropSourceTexture = this.BaseTexture; GuiManager.IsDropped = false; IsShow = false; if (Drag != null) { Drag(this, new DragEvent(arg2.MouseScreenPosition)); } }; MouseLeftUp += delegate(object arg1, MouseLeftUpEvent arg2) { if (GuiManager.DragDropSourceItem != null) { if (Drop != null && InRange) { Drop(this, new DropEvent(arg2.MouseScreenPosition, GuiManager.DragDropSourceItem)); } GuiManager.IsDropped = true; } }; }
public override void ShowMagic(Magic magic) { Clear(); IsShow = true; Texture texture = null; var name = "无名称"; var level = "等级: 0"; var intro = "无简介"; if (magic != null) { texture = new Texture(magic.Image); if (!string.IsNullOrEmpty(magic.Name)) { name = magic.Name; } level = "等级: " + magic.CurrentLevel; if (!string.IsNullOrEmpty(magic.Intro)) { intro = magic.Intro; } } _image.BaseTexture = texture; _name.Text = name; _costOrLevel.Text = level; _magicIntro.Text = intro; }
public MouseGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "mouse.asf")); Width = 0; Height = 0; _drapImage = new GuiItem(this, Vector2.Zero, 0, 0, null); }
public MagicGui() { var cfg = GuiManager.Setttings.Sections["Magics"]; var baseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); var position = new Vector2( Globals.WindowWidth / 2f + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); _listView = new ListView(null, position, new Vector2(294, 108), baseTexture.Width, baseTexture.Height, baseTexture, (MagicListManager.StoreIndexEnd - MagicListManager.StoreIndexBegin + 1 + 2) / 3, GuiManager.Setttings.Sections["Magics_List_Items"], int.Parse(cfg["ScrollBarWidth"]), int.Parse(cfg["ScrollBarHeight"]), cfg["ScrollBarButton"]); _listView.Scrolled += delegate { UpdateItems(); }; _listView.RegisterItemDragHandler((arg1, arg2) => { }); _listView.RegisterItemDropHandler(DropHandler); _listView.RegisterItemMouseStayOverHandler(MouseStayOverHandler); _listView.RegisterItemMouseLeaveHandler(MouseLeaveHandler); _listView.RegisterItemMouseRightClickeHandler(MouseRightClickdHandler); IsShow = false; }
private void LoadTexture() { _player = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "主角坐标.asf")); _enemy = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "敌人坐标.asf")); _partner = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "同伴坐标.asf")); _neutral = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "路人坐标.asf")); }
public void SetItem(int index, Texture texture, string topLeftText = "") { if (index >= 0 && index < 8) { _items[index].BaseTexture = texture; _items[index].TopLeftText = topLeftText; } }
public TopGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\top\", "window.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2((Globals.WindowWidth - BaseTexture.Width) / 2f, 0f); InitializeItems(); }
public SystemGui() { BaseTexture = new Texture(Utils.GetAsf( @"asf\ui\common", "panel.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( (Globals.WindowWidth - Width) / 2f, 26); //Button var asf = Utils.GetAsf(@"asf\ui\system", "saveload.asf"); var clickedSound = Utils.GetSoundEffect("界-大按钮.wav"); _saveloadButton = new GuiItem(this, new Vector2(58, 86), 69, 64, new Texture(asf, 0, 1), null, new Texture(asf, 1, 1), null, clickedSound); asf = Utils.GetAsf(@"asf\ui\system", "option.asf"); _opetionButton = new GuiItem(this, new Vector2(58, 150), 69, 54, new Texture(asf, 0, 1), null, new Texture(asf, 1, 1), null, clickedSound); asf = Utils.GetAsf(@"asf\ui\system", "quit.asf"); _exitButton = new GuiItem(this, new Vector2(58, 213), 69, 54, new Texture(asf, 0, 1), null, new Texture(asf, 1, 1), null, clickedSound); asf = Utils.GetAsf(@"asf\ui\system", "return.asf"); _returnButton = new GuiItem(this, new Vector2(58, 276), 69, 54, new Texture(asf, 0, 1), null, new Texture(asf, 1, 1), null, clickedSound); RegisterEvent(); IsShow = false; }
public MouseGui() { var cfg = GuiManager.Setttings.Sections["Mouse"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = 0; Height = 0; _drapImage = new GuiItem(this, Vector2.Zero, 0, 0, null); }
public ColumnGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\column\", "panel9.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2(Globals.WindowWidth / 2f - 320, Globals.WindowHeight - BaseTexture.Height); InitializeItems(); }
public EquipGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel7.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width, 0f); _items[0] = _head = new DragDropItem(this,//Head new Vector2(47, 66), 60, 75, null, new GoodsGui.GoodItemData(201)); _items[1] = _neck = new DragDropItem(this, //Neck new Vector2(193, 66), 60, 75, null, new GoodsGui.GoodItemData(202)); _items[2] = _body = new DragDropItem(this, //Body new Vector2(121, 168), 60, 75, null, new GoodsGui.GoodItemData(203)); _items[3] = _back = new DragDropItem(this, //Back new Vector2(193, 267), 60, 75, null, new GoodsGui.GoodItemData(204)); _items[4] = _hand = new DragDropItem(this, //Hand new Vector2(193, 168), 60, 75, null, new GoodsGui.GoodItemData(205)); _items[5] = _wrist = new DragDropItem(this, //Wrist new Vector2(47, 168), 60, 75, null, new GoodsGui.GoodItemData(206)); _items[6] = _foot = new DragDropItem(this, //Foot new Vector2(47, 267), 60, 75, null, new GoodsGui.GoodItemData(207)); RegisterEventHandler(); IsShow = false; }
public XiuLianGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel6.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f - Width, 0f); _infoItem = new DragDropItem(this, new Vector2(115, 75), 60, 75, null, new MagicGui.MagicItemData(ItemIndex)); _infoItem.Drop += MagicGui.DropHandler; _infoItem.Drop += (arg1, arg2) => _isItemChange = true; _infoItem.MouseStayOver += MagicGui.MouseStayOverHandler; _infoItem.MouseLeave += MagicGui.MouseLeaveHandler; _levelText = new TextGui(this, new Vector2(126, 224), 80, 12, Globals.FontSize7, 0, 0, "", Color.Black * 0.8f); _expText = new TextGui(this, new Vector2(126, 243), 80, 12, Globals.FontSize7, 0, 0, "", Color.Black * 0.8f); _nameText = new TextGui(this, new Vector2(105, 256), 200, 20, Globals.FontSize12, 0, 0, "", new Color(88, 32, 32) * 0.9f); _introText = new TextGui(this, new Vector2(75, 275), 145, 120, Globals.FontSize10, 2, 0, "", new Color(47, 32, 88) * 0.9f); }
public BottomGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\bottom\", "window.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( (Globals.WindowWidth - BaseTexture.Width) / 2f + 102, Globals.WindowHeight - BaseTexture.Height); InitializeItems(); }
public TopGui() { var cfg = GuiManager.Setttings.Sections["Top"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2((Globals.WindowWidth - BaseTexture.Width) / 2f + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); InitializeItems(); }
public MemoGui() { var cfg = GuiManager.Setttings.Sections["Memo"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); cfg = GuiManager.Setttings.Sections["Memo_Text"]; _text = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize10, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); cfg = GuiManager.Setttings.Sections["Memo_Slider"]; var slideTexture = Utils.GetAsf(null, cfg["Image_Btn"]); 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(cfg["Sound_Btn"])); _scrollBar = new ScrollBar(this, int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), null, ScrollBar.ScrollBarType.Vertical, slideButton, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), 0, 1, 0); _scrollBar.Scrolled += (arg1, arg2) => SetTextShow(arg2.Value); MouseScrollUp += (arg1, arg2) => _scrollBar.Value -= 1; MouseScrollDown += (arg1, arg2) => _scrollBar.Value += 1; IsShow = false; }
public BuyGui() { var baseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel8.asf")); var position = new Vector2( Globals.WindowWidth / 2f - baseTexture.Width, 0f); _listView = new ListView(null, position, new Vector2(271, 108), baseTexture.Width, baseTexture.Height, baseTexture, 27, new Vector2(-17, 0)); var asf = Utils.GetAsf(@"asf\ui\buysell\", "CloseBtn.asf"); baseTexture = new Texture(asf, 0, 1); _closeButton = new GuiItem(_listView, new Vector2(117, 354), baseTexture.Width, baseTexture.Height, baseTexture, null, new Texture(asf, 1, 1), null, Utils.GetSoundEffect("界-大按钮.wav")); _listView.Scrolled += (arg1, arg2) => UpdateItems(); _listView.RegisterItemMouseStayOverHandler((arg1, arg2) => { var item = (DragDropItem)arg1; var index = (int)item.Data; if (_goods.ContainsKey(index)) { GuiManager.ToolTipInterface.ShowGood(_goods[index]); } }); _listView.RegisterItemMouseLeaveHandler( (arg1, arg2) => GuiManager.ToolTipInterface.IsShow = false); _listView.RegisterItemMouseRightClickeHandler((arg1, arg2) => { var item = (DragDropItem)arg1; var index = (int)item.Data; if (_goods.ContainsKey(index)) { Globals.ThePlayer.BuyGood(_goods[index]); } }); _closeButton.Click += (arg1, arg2) => GuiManager.EndBuyGoods(); IsShow = false; }
private void UpdateItems() { for (var i = 0; i < 9; i++) { Texture texture = null; var index = _listView.ToListIndex(i); if (_goods.ContainsKey(index) && _goods[index] != null) { texture = new Texture(_goods[index].Image); } _listView.SetListItem(i, texture, index); } }
public MemoGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel4.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( Globals.WindowWidth / 2f, 0f); _text = new TextGui(this, new Vector2(90, 155), 150, 180, Globals.FontSize10, 1, 1, "", new Color(40, 25, 15) * 0.8f); 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, new Vector2(295, 108), 0, 1, 0); _scrollBar.Scrolled += (arg1, arg2) => SetTextShow(arg2.Value); MouseScrollUp += (arg1, arg2) => _scrollBar.Value -= 1; MouseScrollDown += (arg1, arg2) => _scrollBar.Value += 1; IsShow = false; }
public LittleMapGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "panel.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( (Globals.WindowWidth - Width) / 2f, 0f); LoadItems(); RegisterHadler(); LoadNameList(); LoadTexture(); IsShow = false; }
public LittleMapGui() { var cfg = GuiManager.Setttings.Sections["LittleMap"]; BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\littlemap\", "panel.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2( (Globals.WindowWidth - Width) / 2f + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); LoadItems(); RegisterHadler(); LoadNameList(); LoadTexture(); IsShow = false; }
public GoodsGui() { var cfg = GuiManager.Setttings.Sections["Goods"]; var baseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); var position = new Vector2( Globals.WindowWidth / 2f + int.Parse(cfg["LeftAdjust"]), 0f + int.Parse(cfg["TopAdjust"])); _listView = new ListView(null, position, new Vector2(int.Parse(cfg["ScrollBarLeft"]), int.Parse(cfg["ScrollBarRight"])), baseTexture.Width, baseTexture.Height, baseTexture, (GoodsListManager.StoreIndexEnd - GoodsListManager.StoreIndexBegin + 1 + 2) / 3, GuiManager.Setttings.Sections["Goods_List_Items"], int.Parse(cfg["ScrollBarWidth"]), int.Parse(cfg["ScrollBarHeight"]), cfg["ScrollBarButton"], GoodsListManager.Type != GoodsListManager.ListType.TypeByGoodItem); _listView.Scrolled += delegate { UpdateItems(); }; _listView.RegisterItemDragHandler((arg1, arg2) => { }); _listView.RegisterItemDropHandler(DropHandler); _listView.RegisterItemMouseRightClickeHandler(RightClickHandler); _listView.RegisterItemMouseStayOverHandler(MouseStayOverHandler); _listView.RegisterItemMouseLeaveHandler(MouseLeaveHandler); cfg = GuiManager.Setttings.Sections["Goods_Money"]; _money = new TextGui(_listView, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize7, 0, 0, "", Utils.GetColor(cfg["Color"])); IsShow = false; }
private void UpdateItems() { for (var i = 0; i < 9; i++) { Texture texture = null; var countStr = ""; var index = _listView.ToListIndex(i); if (_goods.ContainsKey(index) && _goods[index] != null && _goods[index].TheGood != null) { texture = new Texture(_goods[index].TheGood.Image); countStr = _goods[index].Count.ToString(); } _listView.SetListItem(i, texture, index); _listView.SetItemTopLeftText(i, _numberValid ? countStr : ""); } }
public TimerGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\timer\", "window.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2(Globals.WindowWidth / 2f + 103, 0); _text = new TextGui(this, new Vector2(74, 44), 120, 22, Globals.FontSize12, 1, 0, "", Color.Red * 0.8f); IsShow = false; }
public MessageGui() { BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\message\", "msgbox.asf")); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2((Globals.WindowWidth - Width) / 2 - 10, Globals.WindowHeight - 47 - Height); _message = new TextGui(this, new Vector2(46, 32), 148, 50, Globals.FontSize12, 0, 1, "", new Color(155, 34, 22) * 0.8f); IsShow = false; }
private void InitializeItems() { string[] fileNames = { "BtnState.asf", //0 "BtnEquip.asf", //1 "BtnXiuLian.asf", //2 "BtnGoods.asf", //3 "BtnMagic.asf", //4 "BtnNotes.asf", //5 "BtnOption.asf" //6 }; Vector2[] position = { new Vector2(52, 0), new Vector2(80, 0), new Vector2(107, 0), new Vector2(135, 0), new Vector2(162, 0), new Vector2(189, 0), new Vector2(216, 0) }; var clickedSound = Utils.GetSoundEffect("界-大按钮.wav"); for (var i = 0; i < 7; i++) { var asf = Utils.GetAsf(@"asf\ui\top\", fileNames[i]); var baseTexture = new Texture(asf, 0, 1); var clickedTexture = new Texture(asf, 1, 1); _buttons[i] = new GuiItem(this, position[i], baseTexture.Width, baseTexture.Height, baseTexture, null, clickedTexture, null, clickedSound); } RegisterClickHandler(); }
public TimerGui() { var cfg = GuiManager.Setttings.Sections["Timer"]; BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"])); Width = BaseTexture.Width; Height = BaseTexture.Height; Position = new Vector2(Globals.WindowWidth / 2f + int.Parse(cfg["LeftAdjust"]), 0 + int.Parse(cfg["TopAdjust"])); cfg = GuiManager.Setttings.Sections["Timer_Text"]; _text = new TextGui(this, new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])), int.Parse(cfg["Width"]), int.Parse(cfg["Height"]), Globals.FontSize12, int.Parse(cfg["CharSpace"]), int.Parse(cfg["LineSpace"]), "", Utils.GetColor(cfg["Color"])); IsShow = false; }
public GoodsGui() { var baseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel3.asf")); var position = new Vector2( Globals.WindowWidth / 2f, 0f); _listView = new ListView(null, position, new Vector2(294, 108), baseTexture.Width, baseTexture.Height, baseTexture, 66); _listView.Scrolled += delegate { UpdateItems(); }; _listView.RegisterItemDragHandler((arg1, arg2) => { }); _listView.RegisterItemDropHandler(DropHandler); _listView.RegisterItemMouseRightClickeHandler(RightClickHandler); _listView.RegisterItemMouseStayOverHandler(MouseStayOverHandler); _listView.RegisterItemMouseLeaveHandler(MouseLeaveHandler); _money = new TextGui(_listView, new Vector2(137, 363), 100, 12, Globals.FontSize7, 0, 0, "", Color.White * 0.8f); IsShow = false; }