Exemplo n.º 1
0
        /// <summary>
        /// Prints the digit at each place. ex "123 -> 1, 2, 3"
        /// </summary>
        public static void PlaceDigits()
        {
            Console.WriteLine("Write digit in each place.");
            int n = TextGui.IntegerPrompt("Enter n: ");

            Console.WriteLine(PlaceDigits(n));
        }
        //https://www.hackerrank.com/contests/w28/challenges/the-great-xor
        public static void GreatXOR(String[] args)
        {
            Console.WriteLine("Find all a where x^a > x and a < x");
            int x = TextGui.IntegerPrompt("Enter x");

            GreatXOR_Log(x);
        }
Exemplo n.º 3
0
        public static void Operations()
        {
            Console.WriteLine("Implement *, /, - only using addition");
            int a = TextGui.IntegerPrompt("Enter integer 1: ");
            int b = TextGui.IntegerPrompt("Enter integer 2: ");

            Console.WriteLine("{0} x {1} = {2}", a, b, Multiply(a, b));
            Console.WriteLine("{0} / {1} = {2}", a, b, Divide(a, b));
            Console.WriteLine("{0} - {1} = {2}", a, b, Subtract(a, b));
        }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
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.º 6
0
 public static void DivingBoard()
 {
     Console.WriteLine("Given short and long planks, you must use k plans.");
     Console.WriteLine("Find all possible lengths for the diving board.");
     maxK    = TextGui.IntegerPrompt("Enter k: ");
     shorter = TextGui.IntegerPrompt("Enter shorter: ");
     longer  = TextGui.IntegerPrompt("Enter longer: ");
     BoardPerms(0, 0);
     foreach (var b in boards)
     {
         Console.WriteLine(b);
     }
 }
Exemplo n.º 7
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.º 8
0
        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;
        }
Exemplo n.º 9
0
        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;
        }
Exemplo n.º 10
0
        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;
        }
Exemplo n.º 11
0
        /// <summary>
        /// Question 16.3 in 6th edition
        /// </summary>
        private static void IntersectingLines()
        {
            Console.WriteLine("given 2 line segments, find their intersection, if any");
            int startx1 = TextGui.IntegerPrompt("Enter line 1, start x");
            int starty1 = TextGui.IntegerPrompt("Enter line 1, start y");
            int endx1   = TextGui.IntegerPrompt("Enter line 1, end x");
            int endy1   = TextGui.IntegerPrompt("Enter line 1, end y");

            int startx2 = TextGui.IntegerPrompt("Enter line 2, start x");
            int starty2 = TextGui.IntegerPrompt("Enter line 2, start y");
            int endx2   = TextGui.IntegerPrompt("Enter line 2, end x");
            int endy2   = TextGui.IntegerPrompt("Enter line 2, end y");

            var line1 = new Line(new Point(startx1, starty1), new Point(endx1, endy1));
            var line2 = new Line(new Point(startx2, starty2), new Point(endx2, endy2));

            var intersection = Line.Intersection(line1, line2);

            Console.WriteLine("{0}, {1}", intersection.x, intersection.y);
        }
Exemplo n.º 12
0
        public ToolTipGuiType2()
        {
            var cfg = GuiManager.Setttings.Sections["ToolTip_Type2"];

            _textHorizontalPadding = int.Parse(cfg["TextHorizontalPadding"]);
            _textVerticalPadding   = int.Parse(cfg["TextVerticalPadding"]);
            _background            = new BackgroundColorLayer(null, new Vector2(0, 0), Vector2.Zero, int.Parse(cfg["Width"]), 1, Utils.GetColor(cfg["BackgroundColor"]));
            _text = new TextGui(_background,
                                new Vector2(_textHorizontalPadding, _textVerticalPadding),
                                _background.Width - 2 * _textHorizontalPadding, 0,
                                Globals.FontSize12, 0, 0, "", Color.Black, TextGui.Align.Center);

            _magicNameColor    = cfg["MagicNameColor"];
            _magicLevelColor   = cfg["MagicLevelColor"];
            _magicIntroColor   = cfg["MagicIntroColor"];
            _goodNameColor     = cfg["GoodNameColor"];
            _goodPriceColor    = cfg["GoodPriceColor"];
            _goodUserColor     = cfg["GoodUserColor"];
            _goodPropertyColor = cfg["GoodPropertyColor"];
            _goodIntroColor    = cfg["GoodIntroColor"];
        }
Exemplo n.º 13
0
        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;
        }
Exemplo n.º 14
0
        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;
        }
Exemplo n.º 15
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.º 16
0
        public XiuLianGui()
        {
            ItemIndex = MagicListManager.XiuLianIndex;
            var cfg = GuiManager.Setttings.Sections["XiuLian"];

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

            cfg       = GuiManager.Setttings.Sections["XiuLian_Magic_Image"];
            _infoItem = new DragDropItem(this,
                                         new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                         int.Parse(cfg["Width"]),
                                         int.Parse(cfg["Height"]),
                                         null,
                                         new MagicGui.MagicItemData(ItemIndex));
            _infoItem.Drop          += MagicGui.DropHandler;
            _infoItem.Drop          += (arg1, arg2) => _isItemChange = true;
            _infoItem.MouseStayOver += MagicGui.MouseStayOverHandler;
            _infoItem.MouseLeave    += MagicGui.MouseLeaveHandler;

            cfg        = GuiManager.Setttings.Sections["XiuLian_Level_Text"];
            _levelText = new TextGui(this,
                                     new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                     int.Parse(cfg["Width"]),
                                     int.Parse(cfg["Height"]),
                                     Globals.FontSize7,
                                     int.Parse(cfg["CharSpace"]),
                                     int.Parse(cfg["LineSpace"]),
                                     "",
                                     Utils.GetColor(cfg["Color"]));
            cfg      = GuiManager.Setttings.Sections["XiuLian_Exp_Text"];
            _expText = new TextGui(this,
                                   new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                   int.Parse(cfg["Width"]),
                                   int.Parse(cfg["Height"]),
                                   Globals.FontSize7,
                                   int.Parse(cfg["CharSpace"]),
                                   int.Parse(cfg["LineSpace"]),
                                   "",
                                   Utils.GetColor(cfg["Color"]));
            cfg       = GuiManager.Setttings.Sections["XiuLian_Name_Text"];
            _nameText = 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"]));
            cfg        = GuiManager.Setttings.Sections["XiuLian_Intro_Text"];
            _introText = 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"]));
        }
Exemplo n.º 17
0
        /// <summary>
        /// Show selections.
        /// </summary>
        /// <param name="selections">String content of selections</param>
        /// <param name="isShows">Info of each selection show or not</param>
        public void Select(string message, List <string> selections, List <bool> isShows)
        {
            if (!isShows.Any(s => s))
            {
                return;
            }
            const int lineHeight = 30;
            const int lineGap    = 5;

            var startY = (Globals.WindowHeight - (selections.Count + 1) * (lineHeight + lineGap)) / 2;

            _messageText = new TextGui(null,
                                       new Vector2(0, startY),
                                       Globals.WindowWidth,
                                       0,
                                       Globals.FontSize12,
                                       0,
                                       lineGap,
                                       message,
                                       new Color(255, 215, 0) * 0.8f,
                                       TextGui.Align.Center);

            startY += _messageText.RealHeight;

            _selectionLineTexts = new List <TextGui>();

            for (var index = 0; index < selections.Count; index++)
            {
                if (isShows[index])
                {
                    var selection = selections[index];
                    var textGui   = new TextGui(null,
                                                new Vector2(0, startY),
                                                Globals.WindowWidth,
                                                0,
                                                Globals.FontSize12,
                                                0,
                                                lineGap,
                                                selection,
                                                _normalColor,
                                                TextGui.Align.Center);

                    textGui.OverrideColor   = _selectionColor;
                    textGui.MouseEnterText += (arg1, arg2) => textGui.UseOverrideColor = true;
                    textGui.MouseLeaveText += (arg1, arg2) => textGui.UseOverrideColor = false;
                    var currentIndex = index;
                    textGui.MouseLeftDownText += (arg1, arg2) =>
                    {
                        IsInSelecting = false;
                        Selection     = currentIndex;
                        IsShow        = false;
                    };

                    _selectionLineTexts.Add(textGui);

                    startY += textGui.RealHeight;
                }
            }

            IsInSelecting = true;
            IsShow        = true;
        }
Exemplo n.º 18
0
        public StateGui()
        {
            var cfg = GuiManager.Setttings.Sections["State"];

            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel5.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                Globals.WindowWidth / 2f - Width + int.Parse(cfg["LeftAdjust"]),
                0f + int.Parse(cfg["TopAdjust"]));
            _items = new TextGui[9];

            cfg       = GuiManager.Setttings.Sections["State_Level"];
            _items[0] = new TextGui(this, //Level
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Exp"];
            _items[1] = new TextGui(this, //Exp
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_LevelUp"];
            _items[2] = new TextGui(this, //LevelUp
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Life"];
            _items[3] = new TextGui(this, //Life
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Thew"];
            _items[4] = new TextGui(this, //Thew
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Mana"];
            _items[5] = new TextGui(this, //Mana
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Attack"];
            _items[6] = new TextGui(this, //Attack
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Defend"];
            _items[7] = new TextGui(this, //Defend
                                    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"]));
            cfg       = GuiManager.Setttings.Sections["State_Evade"];
            _items[8] = new TextGui(this, // Evade
                                    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"]));
        }
Exemplo n.º 19
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.º 20
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.º 21
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.º 22
0
        public StateGui()
        {
            BaseTexture = new Texture(Utils.GetAsf(@"asf\ui\common\", "panel5.asf"));
            Width       = BaseTexture.Width;
            Height      = BaseTexture.Height;
            Position    = new Vector2(
                Globals.WindowWidth / 2f - Width,
                0f);
            _items = new TextGui[9];
            const int Left       = 144;
            const int ItemWidth  = 100;
            const int ItemHeight = 12;
            var       color      = Color.Black * 0.7f;

            _items[0] = new TextGui(this, //Level
                                    new Vector2(Left, 219),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[1] = new TextGui(this, //Exp
                                    new Vector2(Left, 234),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[2] = new TextGui(this, //LevelUp
                                    new Vector2(Left, 249),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[3] = new TextGui(this, //Life
                                    new Vector2(Left, 264),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[4] = new TextGui(this, //Thew
                                    new Vector2(Left, 279),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[5] = new TextGui(this, //Mana
                                    new Vector2(Left, 294),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[6] = new TextGui(this, //Attack
                                    new Vector2(Left, 309),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[7] = new TextGui(this, //Defend
                                    new Vector2(Left, 324),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
            _items[8] = new TextGui(this, // Evade
                                    new Vector2(Left, 339),
                                    ItemWidth,
                                    ItemHeight,
                                    Globals.FontSize7,
                                    0,
                                    0,
                                    "",
                                    color);
        }
Exemplo n.º 23
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.º 24
0
        public DialogGui()
        {
            LoadPortrait();

            var cfg = GuiManager.Setttings.Sections["Dialog"];

            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"]),
                                      Globals.WindowHeight + int.Parse(cfg["TopAdjust"]));

            cfg   = GuiManager.Setttings.Sections["Dialog_Txt"];
            _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"]));

            cfg      = GuiManager.Setttings.Sections["Dialog_SelA"];
            _selectA = 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"]));

            cfg      = GuiManager.Setttings.Sections["Dialog_SelB"];
            _selectB = 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"]));

            cfg       = GuiManager.Setttings.Sections["Dialog_Portrait"];
            _portrait = new GuiItem(this,
                                    new Vector2(int.Parse(cfg["Left"]), int.Parse(cfg["Top"])),
                                    int.Parse(cfg["Width"]),
                                    int.Parse(cfg["Height"]),
                                    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;
        }