Exemplo n.º 1
0
 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();
 }
Exemplo n.º 2
0
        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;
                }
            };
        }
Exemplo n.º 3
0
        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();
        }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 public Sign(GuiItem movingObject, AnimationKey[] coming, AnimationKey[] leaving)
     : base("Sign", 0, 0)
 {
     this.coming       = coming;
     this.leaving      = leaving;
     this.movingObject = movingObject;
 }
Exemplo n.º 6
0
        /// <summary>
        /// Sets the card to equal another
        /// </summary>
        /// <param name="item"></param>
        protected override void OnSet(GuiItem item)
        {
            //cast.. could throw an exception if item is not a Card
            Icon icon = (Icon)item;

            status = icon.status;
            iconNo = icon.iconNo;
        }
Exemplo n.º 7
0
        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;
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        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;
        }
        void MakeSection(string SectionName, GuiItem Input, SingleColumnTable Display)
        {
            var header = new Button("header-2")
            {
                DisplayedString = SectionName
            };
            var container = new GuiContainer <Pod>("scenario-builder-parameters-section");

            container.Add(Input);

            Display.Add(header);
            Display.Add(container);
        }
Exemplo n.º 12
0
        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;
        }
Exemplo n.º 13
0
        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();
        }
Exemplo n.º 14
0
        public GuiInventoryBase(InventoryBase inventory, GuiTextures background, int width, int height)
        {
            Inventory = inventory;

            ContentContainer.Background        = background;
            ContentContainer.BackgroundOverlay = null;

            ContentContainer.Width  = ContentContainer.MinWidth = ContentContainer.MaxWidth = width;
            ContentContainer.Height = ContentContainer.MinHeight = ContentContainer.MaxHeight = height;

            SetFixedSize(width, height);

            ContentContainer.AutoSizeMode = AutoSizeMode.None;

            AddChild(
                TextOverlay = new GuiTextElement(true)
            {
                HasShadow    = true,
                Background   = new Color(Color.Black, 0.35f),
                Enabled      = false,
                FontStyle    = FontStyle.DropShadow,
                TextColor    = TextColor.Yellow,
                ClipToBounds = false,
                Anchor       = Alignment.TopLeft
                               //BackgroundOverlay = new Color(Color.Black, 0.35f),
            });

            AddChild(CursorItemRenderer = new GuiItem()
            {
                IsVisible    = false,
                ClipToBounds = false,
                AutoSizeMode = AutoSizeMode.None,
                Height       = 18,
                Width        = 18,
                Anchor       = Alignment.TopLeft
            });

            Inventory.SlotChanged   += InventoryOnSlotChanged;
            Inventory.CursorChanged += InventoryOnCursorChanged;
        }
Exemplo n.º 15
0
 /// <summary>
 /// This method is called when the <see cref="ValueChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="args"> The new value of the <see cref="ProgressBar"/>. </param>
 protected virtual void OnValueChanged(GuiItem sender, Args args)
 {
     data.Value = args.NewValue;
     Refresh();
 }
Exemplo n.º 16
0
        private void LoadItems()
        {
            var cfg   = GuiManager.Setttings.Sections["LittleMap_Left_Btn"];
            var sound = Utils.GetSoundEffect(cfg["Sound"]);
            var asf   = Utils.GetAsf(null, cfg["Image"]);

            _leftButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            cfg          = GuiManager.Setttings.Sections["LittleMap_Right_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            sound        = Utils.GetSoundEffect(cfg["Sound"]);
            _rightButton = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            cfg       = GuiManager.Setttings.Sections["LittleMap_Up_Btn"];
            asf       = Utils.GetAsf(null, cfg["Image"]);
            sound     = Utils.GetSoundEffect(cfg["Sound"]);
            _upButton = new GuiItem(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    asf.Width,
                                    asf.Height,
                                    new Texture(asf, 0, 1),
                                    null,
                                    new Texture(asf, 1, 1),
                                    null,
                                    sound);

            cfg         = GuiManager.Setttings.Sections["LittleMap_Down_Btn"];
            asf         = Utils.GetAsf(null, cfg["Image"]);
            sound       = Utils.GetSoundEffect(cfg["Sound"]);
            _downButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            cfg          = GuiManager.Setttings.Sections["LittleMap_Close_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            sound        = Utils.GetSoundEffect(cfg["Sound"]);
            _closeButton = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            cfg      = GuiManager.Setttings.Sections["LittleMap_Map_Name_Line_Text"];
            _mapName = new LineText(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    (LineText.Align) int.Parse(cfg["Align"]),
                                    string.Empty,
                                    Utils.GetColor(cfg["Color"]),
                                    Globals.FontSize12);

            cfg        = GuiManager.Setttings.Sections["LittleMap_Bottom_Tip_Line_Text"];
            _bottomTip = new LineText(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      (LineText.Align) int.Parse(cfg["Align"]),
                                      "点击小地图进行移动",
                                      Utils.GetColor(cfg["Color"]),
                                      Globals.FontSize10);

            cfg         = GuiManager.Setttings.Sections["LittleMap_Message_Tip_Line_Text"];
            _messageTip = new LineText(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       (LineText.Align) int.Parse(cfg["Align"]),
                                       "无法移动到目的地",
                                       Utils.GetColor(cfg["Color"]),
                                       Globals.FontSize10);
            _messageTip.IsShow = false;
        }
Exemplo n.º 17
0
        public BuyGui()
        {
            var cfg         = GuiManager.Setttings.Sections["BuySell"];
            var baseTexture = new Texture(Utils.GetAsf(null, cfg["Image"]));
            var position    = new Vector2(
                Globals.WindowWidth / 2f - baseTexture.Width + 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,
                                     27,
                                     GuiManager.Setttings.Sections["BuySell_List_Items"],
                                     int.Parse(cfg["ScrollBarWidth"]),
                                     int.Parse(cfg["ScrollBarHeight"]),
                                     cfg["ScrollBarButton"]);
            var asf = Utils.GetAsf(null, cfg["CloseImage"]);

            baseTexture  = new Texture(asf, 0, 1);
            _closeButton = new GuiItem(_listView,
                                       new Vector2(int.Parse(cfg["CloseLeft"]), int.Parse(cfg["CloseTop"])),
                                       baseTexture.Width,
                                       baseTexture.Height,
                                       baseTexture,
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       Utils.GetSoundEffect(cfg["CloseSound"]));
            _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].TheGood, false);
                }
            });
            _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))
                {
                    if (_numberValid && _goods[index].Count <= 0)
                    {
                        GuiManager.ShowMessage("该物品已售罄");
                    }
                    else if (_goods[index].TheGood != null)
                    {
                        if (Globals.ThePlayer.BuyGood(_goods[index].TheGood))
                        {
                            if (_numberValid)
                            {
                                _goods[index].Count--;
                                UpdateItems();
                            }
                        }
                    }
                }
            });
            _closeButton.Click += (arg1, arg2) => GuiManager.EndBuyGoods();

            IsShow = false;
        }
Exemplo n.º 18
0
 /// <summary>
 /// This method is called when the <see cref="FontChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new <see cref="SpriteFont"/>. </param>
 protected virtual void OnFontChanged(GuiItem sender, ValueChangedEventArgs<SpriteFont> e)
 {
     font = e.NewValue;
     Refresh();
 }
Exemplo n.º 19
0
 public void AddOverlay(GuiItem Overlay)
 {
     _Overlay.Add(Overlay);
 }
Exemplo n.º 20
0
 /// <summary>
 /// This method is called when the <see cref="SizeModeChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new <see cref="ResizeMode"/> for the foreground. </param>
 protected virtual void OnSizeModeChanged(GuiItem sender, Args e)
 {
     sizeMode = e.NewValue;
 }
Exemplo n.º 21
0
 private void GuiItem_Move(GuiItem sender, ValueChangedEventArgs<Vector2> e)
 {
     if (!UseAbsolutePosition)
     {
         Label tab = tabs.FirstOrDefault(t => t.Value.Contains(sender)).Key;
         sender.Bounds = new Rectangle((int)sender.Position.X, (int)sender.Position.Y + tab.Height, sender.Width, sender.Height);
     }
 }
Exemplo n.º 22
0
        public SaveLoadGui()
        {
            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\saveload", "panel.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                (Globals.WindowWidth - Width) / 2f,
                (Globals.WindowHeight - Height) / 2f);

            //Save load list
            var itemText = new String[]
            {
                "进度一",
                "进度二",
                "进度三",
                "进度四",
                "进度五",
                "进度六",
                "进度七"
            };

            _list = new ListTextItem(this,
                                     new Vector2(135, 118),
                                     80,
                                     189,
                                     null,
                                     7,
                                     itemText,
                                     3,
                                     0,
                                     25,
                                     new Color(91, 31, 27) * 0.8f,
                                     new Color(102, 73, 212) * 0.8f,
                                     Utils.GetSoundEffect("界-浏览.wav"));

            //Save snapshot
            _saveSnapshot = new Bmp(this,
                                    new Vector2(256, 94),
                                    "",
                                    267,
                                    200);

            //Buttons
            var asf          = Utils.GetAsf(@"asf\ui\saveload", "btnLoad.asf");
            var clickedSound = Utils.GetSoundEffect("界-大按钮.wav");

            _loadButton = new GuiItem(this,
                                      new Vector2(248, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);
            asf         = Utils.GetAsf(@"asf\ui\saveload", "btnSave.asf");
            _saveButton = new GuiItem(this,
                                      new Vector2(366, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);
            asf         = Utils.GetAsf(@"asf\ui\saveload", "btnExit.asf");
            _exitButton = new GuiItem(this,
                                      new Vector2(464, 355),
                                      64,
                                      72,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);

            //Save time
            _saveTime = new TextGui(this,
                                    new Vector2(254, 310),
                                    350,
                                    30,
                                    Globals.FontSize10,
                                    1,
                                    0,
                                    "",
                                    new Color(182, 219, 189) * 0.7f);

            //Message
            _message = new LineText(this,
                                    new Vector2(0, 440),
                                    BaseTexture.Width,
                                    40,
                                    LineText.Align.Center,
                                    string.Empty,
                                    Color.Gold * 0.8f,
                                    Globals.FontSize12);

            RegisterEvent();

            SetSaveLoadIndex(Globals.SaveLoadSelectionIndex);

            IsShow = false;
        }
Exemplo n.º 23
0
        private void DropDown_Click(GuiItem sender, MouseEventArgs e)
        {
            int index = GetHoverIndex(e.State);
            if (index == -1) return;

            Invoke(IndexClick, this, new IndexedClickEventArgs(index));
        }
Exemplo n.º 24
0
 /// <summary>
 /// Sets the card to equal another
 /// </summary>
 /// <param name="item"></param>
 protected override void OnSet(GuiItem item)
 {
     //cast.. could throw an exception if item is not a Card
     bounds.Width  = item.Bounds.Width;
     bounds.Height = item.Bounds.Height;
 }
Exemplo n.º 25
0
        public ToolTipGui()
        {
            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "tipbox.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2((Globals.WindowWidth - Width) / 2f,
                                      27f);
            _image = new GuiItem(this,
                                 new Vector2(132, 47),
                                 60,
                                 75,
                                 null);
            _name = new TextGui(this,
                                new Vector2(67, 191),
                                100,
                                20,
                                Globals.FontSize10,
                                0,
                                0,
                                "",
                                new Color(102, 73, 212) * 0.8f);
            _costOrLevel = new TextGui(this,
                                       new Vector2(160, 191),
                                       88,
                                       20,
                                       Globals.FontSize10,
                                       0,
                                       0,
                                       "",
                                       new Color(91, 31, 27) * 0.8f);
            _goodEffect = new TextGui(this,
                                      new Vector2(67, 215),
                                      188,
                                      20,
                                      Globals.FontSize10,
                                      0,
                                      0,
                                      "",
                                      Color.Blue * 0.8f);
            _magicIntro = new TextGui(this,
                                      new Vector2(67, 210),
                                      196,
                                      120,
                                      Globals.FontSize10,
                                      1,
                                      0,
                                      "",
                                      new Color(52, 21, 14) * 0.8f);
            _goodIntro = new TextGui(this,
                                     new Vector2(67, 245),
                                     196,
                                     100,
                                     Globals.FontSize10,
                                     1,
                                     0,
                                     "",
                                     new Color(52, 21, 14) * 0.8f);
            _items    = new GuiItem[6];
            _items[0] = _image;
            _items[1] = _name;
            _items[2] = _costOrLevel;
            _items[3] = _goodEffect;
            _items[4] = _goodIntro;
            _items[5] = _magicIntro;

            IsShow = false;
        }
Exemplo n.º 26
0
        public SystemGui()
        {
            var cfg = GuiManager.Setttings.Sections["System"];

            BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"]));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                (Globals.WindowWidth - Width) / 2f + int.Parse(cfg["LeftAdjust"]),
                0 + int.Parse(cfg["TopAdjust"]));

            //Button
            cfg = GuiManager.Setttings.Sections["System_SaveLoad_Btn"];
            var asf          = Utils.GetAsf(@"asf\ui\system", "saveload.asf");
            var clickedSound = Utils.GetSoundEffect(cfg["Sound"]);

            _saveloadButton = new GuiItem(this,
                                          new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                          int.Parse(cfg["Width"]),
                                          int.Parse(cfg["Height"]),
                                          new Texture(asf, 0, 1),
                                          null,
                                          new Texture(asf, 1, 1),
                                          null,
                                          clickedSound);

            cfg            = GuiManager.Setttings.Sections["System_Option_Btn"];
            asf            = Utils.GetAsf(@"asf\ui\system", "option.asf");
            clickedSound   = Utils.GetSoundEffect(cfg["Sound"]);
            _opetionButton = new GuiItem(this,
                                         new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                         int.Parse(cfg["Width"]),
                                         int.Parse(cfg["Height"]),
                                         new Texture(asf, 0, 1),
                                         null,
                                         new Texture(asf, 1, 1),
                                         null,
                                         clickedSound);

            cfg          = GuiManager.Setttings.Sections["System_Exit_Btn"];
            asf          = Utils.GetAsf(@"asf\ui\system", "quit.asf");
            clickedSound = Utils.GetSoundEffect(cfg["Sound"]);
            _exitButton  = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       clickedSound);

            cfg           = GuiManager.Setttings.Sections["System_Return_Btn"];
            asf           = Utils.GetAsf(@"asf\ui\system", "return.asf");
            clickedSound  = Utils.GetSoundEffect(cfg["Sound"]);
            _returnButton = new GuiItem(this,
                                        new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                        int.Parse(cfg["Width"]),
                                        int.Parse(cfg["Height"]),
                                        new Texture(asf, 0, 1),
                                        null,
                                        new Texture(asf, 1, 1),
                                        null,
                                        clickedSound);

            RegisterEvent();

            IsShow = false;
        }
Exemplo n.º 27
0
 public void RemoveOverlay(GuiItem Overlay)
 {
     _Overlay.Remove(Overlay);
 }
Exemplo n.º 28
0
        public DialogGui()
        {
            LoadPortrait();
            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\dialog\", "panel.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2((Globals.WindowWidth - BaseTexture.Width) / 2f,
                                      Globals.WindowHeight - 208f);
            _text = new TextGui(this,
                                new Vector2(65, 30),
                                310,
                                70,
                                Globals.FontSize12,
                                -2,
                                0,
                                "",
                                _defaultTextColor);
            _selectA = new TextGui(this,
                                   new Vector2(65, 52),
                                   310,
                                   20,
                                   Globals.FontSize12,
                                   1,
                                   0,
                                   "",
                                   Color.Blue * 0.8f);
            _selectB = new TextGui(this,
                                   new Vector2(65, 74),
                                   310,
                                   20,
                                   Globals.FontSize12,
                                   1,
                                   0,
                                   "",
                                   Color.Blue * 0.8f);
            _portrait = new GuiItem(this,
                                    new Vector2(5, -143),
                                    200,
                                    160,
                                    null);
            _selectA.MouseEnter    += (arg1, arg2) => _selectA.SetDrawColor(Color.Red * 0.8f);
            _selectA.MouseLeave    += (arg1, arg2) => _selectA.SetDrawColor(Color.Blue * 0.8f);
            _selectA.MouseLeftDown += (arg1, arg2) =>
            {
                if (IsInSelecting)
                {
                    IsInSelecting = false;
                    Selection     = 0;
                }
            };
            _selectB.MouseEnter    += (arg1, arg2) => _selectB.SetDrawColor(Color.Red * 0.8f);
            _selectB.MouseLeave    += (arg1, arg2) => _selectB.SetDrawColor(Color.Blue * 0.8f);
            _selectB.MouseLeftDown += (arg1, arg2) =>
            {
                if (IsInSelecting)
                {
                    IsInSelecting = false;
                    Selection     = 1;
                }
            };

            IsShow = false;
        }
Exemplo n.º 29
0
 /// <summary>
 /// This method is called when the <see cref="GuiItem.ForeColorChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new <see cref="Color"/> for the foreground. </param>
 protected override void OnForeColorChanged(GuiItem sender, ValueChangedEventArgs<Color> e)
 {
     base.OnForeColorChanged(sender, e);
     if (font != null) Refresh();
 }
Exemplo n.º 30
0
 private void TextBox_Click(GuiItem sender, MouseEventArgs e)
 {
     if (AutoFocus)
     {
         for (int i = 0; i < tabs.Length; i++)
         {
             GuiItemCollection controlls = tabs[i].Value;
             for (int j = 0; j < controlls.Count; j++)
             {
                 TextBox txt;
                 if ((txt = controlls[j] as TextBox) != null)
                 {
                     txt.Focused = txt.Name == sender.Name;
                     txt.Refresh();
                 }
             }
         }
     }
 }
Exemplo n.º 31
0
 /// <summary>
 /// This method is called when the <see cref="GuiItem.Move"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new position for the <see cref="Label"/>. </param>
 protected override void OnMove(GuiItem sender, ValueChangedEventArgs<Vector2> e)
 {
     base.OnMove(sender, e);
     foregroundRectangle.X = (int)e.NewValue.X;
     foregroundRectangle.Y = (int)e.NewValue.Y;
 }
Exemplo n.º 32
0
 public void AddTicked(Ticked Ticked, GuiItem View)
 {
     _TickManager.Add(Ticked);
     _MapItems.Add(Ticked, View);
     _WorldView.AddOverlay(View);
 }
Exemplo n.º 33
0
 /// <summary>
 /// This method gets called when the <see cref="Label.TextChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new text for the sender. </param>
 protected override void OnTextChanged(GuiItem sender, ValueChangedEventArgs<string> e)
 {
     inputHandler.keyboadString = e.NewValue;
     base.OnTextChanged(sender, e);
 }
Exemplo n.º 34
0
        public TitleGui()
        {
            using (var fs = File.Open(@"asf\ui\title\title.jpg", FileMode.Open))
            {
                BaseTexture = new Texture(new Asf(
                                              Texture2D.FromStream(Globals.TheGame.GraphicsDevice, fs)));
            }

            Width    = BaseTexture.Width;
            Height   = BaseTexture.Height;
            Position = new Vector2(
                (Globals.WindowWidth - Width) / 2f,
                (Globals.WindowHeight - Height) / 2f);
            var asf   = Utils.GetAsf(@"asf\ui\title\", "InitBtn.asf");
            var sound = Utils.GetSoundEffect("界-主菜单.wav");

            _initButton = new GuiItem(this,
                                      new Vector2(327, 112),
                                      81,
                                      66,
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            asf         = Utils.GetAsf(@"asf\ui\title\", "LoadBtn.asf");
            _loadButton = new GuiItem(this,
                                      new Vector2(327, 177),
                                      81,
                                      66,
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            asf         = Utils.GetAsf(@"asf\ui\title\", "TeamBtn.asf");
            _teamButton = new GuiItem(this,
                                      new Vector2(327, 240),
                                      81,
                                      66,
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            asf         = Utils.GetAsf(@"asf\ui\title\", "ExitBtn.asf");
            _exitButton = new GuiItem(this,
                                      new Vector2(327, 303),
                                      81,
                                      66,
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            _guiItems = new[]
            {
                _initButton,
                _loadButton,
                _teamButton,
                _exitButton
            };
            RegisterEvent();

            IsShow = false;
        }
Exemplo n.º 35
0
 /// <summary>
 /// This method gets called when the <see cref="TextBox.FocusChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new focus value for the sender. </param>
 protected virtual void OnFocusChanged(GuiItem sender, Args e)
 {
     focus = e.NewValue;
     if (!focus)
     {
         CreateForegroundTextures();
         showLine = false;
     }
 }
Exemplo n.º 36
0
        public ToolTipGuiType1()
        {
            var cfg = GuiManager.Setttings.Sections["ToolTip_Type1"];

            BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"]));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2((Globals.WindowWidth - Width) / 2f + int.Parse(cfg["LeftAdjust"]),
                                      0 + int.Parse(cfg["TopAdjust"]));

            cfg    = GuiManager.Setttings.Sections["ToolTip_Type1_Item_Image"];
            _image = new GuiItem(this,
                                 new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                 int.Parse(cfg["Width"]),
                                 int.Parse(cfg["Height"]),
                                 null);
            cfg   = GuiManager.Setttings.Sections["ToolTip_Type1_Item_Name"];
            _name = 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["ToolTip_Type1_Item_PriceOrLevel"];
            _costOrLevel = 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["ToolTip_Type1_Item_Effect"];
            _goodEffect = 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["ToolTip_Type1_Item_Magic_Intro"];
            _magicIntro = 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["ToolTip_Type1_Item_Good_Intro"];
            _goodIntro = 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"]));
            _items    = new GuiItem[6];
            _items[0] = _image;
            _items[1] = _name;
            _items[2] = _costOrLevel;
            _items[3] = _goodEffect;
            _items[4] = _goodIntro;
            _items[5] = _magicIntro;

            IsShow = false;
        }
Exemplo n.º 37
0
        private void LoadItems()
        {
            var sound = Utils.GetSoundEffect("界-浏览.wav");
            var asf   = Utils.GetAsf(@"asf\ui\littlemap\", "btnleft.asf");

            _leftButton = new GuiItem(this,
                                      new Vector2(437, 379),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            asf          = Utils.GetAsf(@"asf\ui\littlemap\", "btnright.asf");
            _rightButton = new GuiItem(this,
                                       new Vector2(464, 379),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            asf       = Utils.GetAsf(@"asf\ui\littlemap\", "btnup.asf");
            _upButton = new GuiItem(this,
                                    new Vector2(448, 368),
                                    asf.Width,
                                    asf.Height,
                                    new Texture(asf, 0, 1),
                                    null,
                                    new Texture(asf, 1, 1),
                                    null,
                                    sound);

            asf         = Utils.GetAsf(@"asf\ui\littlemap\", "btndown.asf");
            _downButton = new GuiItem(this,
                                      new Vector2(448, 395),
                                      asf.Width,
                                      asf.Height,
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);

            asf          = Utils.GetAsf(@"asf\ui\littlemap\", "btnclose.asf");
            _closeButton = new GuiItem(this,
                                       new Vector2(448, 379),
                                       asf.Width,
                                       asf.Height,
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       sound);

            _mapName = new LineText(this,
                                    new Vector2(210, 92),
                                    220,
                                    30,
                                    LineText.Align.Center,
                                    string.Empty,
                                    new Color(76, 56, 48) * 0.8f,
                                    Globals.FontSize12);
            _bottomTip = new LineText(this,
                                      new Vector2(160, 370),
                                      260,
                                      30,
                                      LineText.Align.Left,
                                      "点击小地图进行移动",
                                      new Color(76, 56, 48) * 0.8f,
                                      Globals.FontSize10);
            _messageTip = new LineText(this,
                                       new Vector2(160, 370),
                                       260,
                                       30,
                                       LineText.Align.Right,
                                       "无法移动到目的地",
                                       new Color(200, 0, 0) * 0.8f,
                                       Globals.FontSize10);
            _messageTip.IsShow = false;
        }
Exemplo n.º 38
0
 /// <summary>
 /// Sets the card to equal another
 /// </summary>
 /// <param name="item"></param>
 protected override void OnSet(GuiItem item)
 {
     //cast.. could throw an exception if item is not a Card
 }
Exemplo n.º 39
0
        public TitleGui()
        {
            using (var fs = File.Open(GuiManager.Setttings.Sections["Title"]["BackgroundImage"], FileMode.Open))
            {
                BaseTexture = new Texture(new Asf(
                                              Texture2D.FromStream(Globals.TheGame.GraphicsDevice, fs)));
            }

            Width    = BaseTexture.Width;
            Height   = BaseTexture.Height;
            Position = new Vector2(
                (Globals.WindowWidth - Width) / 2f,
                (Globals.WindowHeight - Height) / 2f);
            var cfg   = GuiManager.Setttings.Sections["Title_Btn_Begin"];
            var asf   = Utils.GetAsf(null, cfg["Image"]);
            var sound = Utils.GetSoundEffect(cfg["Sound"]);

            _initButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            cfg         = GuiManager.Setttings.Sections["Title_Btn_Load"];
            asf         = Utils.GetAsf(null, cfg["Image"]);
            sound       = Utils.GetSoundEffect(cfg["Sound"]);
            _loadButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            cfg         = GuiManager.Setttings.Sections["Title_Btn_Team"];
            asf         = Utils.GetAsf(null, cfg["Image"]);
            sound       = Utils.GetSoundEffect(cfg["Sound"]);
            _teamButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            cfg         = GuiManager.Setttings.Sections["Title_Btn_Exit"];
            asf         = Utils.GetAsf(null, cfg["Image"]);
            sound       = Utils.GetSoundEffect(cfg["Sound"]);
            _exitButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      new Texture(asf, 1, 1),
                                      null,
                                      sound);
            _guiItems = new[]
            {
                _initButton,
                _loadButton,
                _teamButton,
                _exitButton
            };
            RegisterEvent();

            IsShow = false;
        }
Exemplo n.º 40
0
        public SaveLoadGui()
        {
            var cfg = GuiManager.Setttings.Sections["SaveLoad"];

            BaseTexture = new Texture(Utils.GetAsf(null, cfg["Image"]));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                (Globals.WindowWidth - Width) / 2f + int.Parse(cfg["LeftAdjust"]),
                (Globals.WindowHeight - Height) / 2f + int.Parse(cfg["TopAdjust"]));

            cfg = GuiManager.Setttings.Sections["SaveLoad_Text_List"];
            //Save load list
            var itemText = cfg["Text"].Split('/');

            _list = new ListTextItem(this,
                                     new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                     int.Parse(cfg["Width"]),
                                     int.Parse(cfg["Height"]),
                                     null,
                                     itemText.Length,
                                     itemText,
                                     int.Parse(cfg["CharSpace"]),
                                     int.Parse(cfg["LineSpace"]),
                                     int.Parse(cfg["ItemHeight"]),
                                     Utils.GetColor(cfg["Color"]),
                                     Utils.GetColor(cfg["SelectedColor"]),
                                     Utils.GetSoundEffect(cfg["Sound"]));

            //Save snapshot
            cfg           = GuiManager.Setttings.Sections["Save_Snapshot"];
            _saveSnapshot = new Bmp(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    "",
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]));

            //Buttons
            cfg = GuiManager.Setttings.Sections["SaveLoad_Load_Btn"];
            var asf          = Utils.GetAsf(null, cfg["Image"]);
            var clickedSound = Utils.GetSoundEffect(cfg["Sound"]);

            _loadButton = new GuiItem(this,
                                      new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                      int.Parse(cfg["Width"]),
                                      int.Parse(cfg["Height"]),
                                      new Texture(asf, 0, 1),
                                      null,
                                      new Texture(asf, 1, 1),
                                      null,
                                      clickedSound);

            cfg          = GuiManager.Setttings.Sections["SaveLoad_Save_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            clickedSound = Utils.GetSoundEffect(cfg["Sound"]);
            _saveButton  = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       clickedSound);

            cfg          = GuiManager.Setttings.Sections["SaveLoad_Exit_Btn"];
            asf          = Utils.GetAsf(null, cfg["Image"]);
            clickedSound = Utils.GetSoundEffect(cfg["Sound"]);
            _exitButton  = new GuiItem(this,
                                       new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                       int.Parse(cfg["Width"]),
                                       int.Parse(cfg["Height"]),
                                       new Texture(asf, 0, 1),
                                       null,
                                       new Texture(asf, 1, 1),
                                       null,
                                       clickedSound);

            //Save time
            cfg       = GuiManager.Setttings.Sections["SaveLoad_Save_Time_Text"];
            _saveTime = 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"]));

            //Message
            cfg      = GuiManager.Setttings.Sections["SaveLoad_Message_Line_Text"];
            _message = new LineText(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    (LineText.Align) int.Parse(cfg["Align"]),
                                    string.Empty,
                                    Utils.GetColor(cfg["Color"]),
                                    Globals.FontSize12);

            RegisterEvent();

            SetSaveLoadIndex(Globals.SaveLoadSelectionIndex);

            IsShow = false;
        }
Exemplo n.º 41
0
 /// <summary>
 /// This method is called when the <see cref="TextChanged"/> event is raised.
 /// </summary>
 /// <param name="sender"> The <see cref="GuiItem"/> that raised the event. </param>
 /// <param name="e"> The new text of the <see cref="Label"/>. </param>
 protected virtual void OnTextChanged(GuiItem sender, ValueChangedEventArgs<string> e)
 {
     text = e.NewValue;
     Refresh();
 }