示例#1
0
文件: HUD.cs 项目: riordanp/panjin
        public void showItemModal(TriggerGiveItem sender)
        {
            Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, "Items", true);
            w.Width = 200;
            w.Height = 120;
//w.DeleteOnClose = true;

            Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(w);
            img.ImageName = "./assets/" + sender.item.iconName;
            img.SetPosition(5, 10);
            img.SetSize(32, 32);

            Gwen.Control.CheckBox check = new Gwen.Control.CheckBox(w);
            check.SetPosition(w.Width - 29, 32 / 2 + 3);
            check.IsChecked = true;

            Gwen.Control.Label itemName = new Gwen.Control.Label(w);
            itemName.Text = sender.item.name;
            itemName.SetPosition(48, 14);

            Gwen.Control.Label itemDescription = new Gwen.Control.Label(w);
            Gwen.Font descFont = defaultFont;
            descFont.Size = 9;
            itemDescription.Width = 200;
            itemDescription.Text = sender.item.description;
            itemDescription.Font = descFont;
            itemDescription.SetPosition(48, 25);

            Gwen.Control.Button takeAll = new Gwen.Control.Button(w);
            takeAll.SetText("Take All");
            takeAll.TextColor = System.Drawing.Color.White;
            takeAll.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255);
            takeAll.Width = 60;
            takeAll.X = 5;
            takeAll.Y = w.Height - takeAll.Height - 40;
            takeAll.Clicked += delegate {
                if (sender._amount > 0)
                {
                    while(sender._amount > 0)
                    {
                        Engine.player.inventory.Add(sender.item);
                        if (Engine.player.activeWeapon.name == null && sender.item.GetType().IsSubclassOf(typeof(Weapon))) 
                        {
                            Engine.player.activeWeapon = (Panjin.Weapon)Engine.player.inventory[Engine.player.inventory.Count -1];
                        }
                        sender._amount--;
                    }
                    w.SetPosition(-99, -99);
                    w.Hide();
                    w.Close();
                }
                else
                {
                    w.SetPosition(-99, -99);
                    w.Hide();
                    w.Close();
                }
            };




            Gwen.Control.Button takeSelected = new Gwen.Control.Button(w);
            takeSelected.SetText("Take Selected");
            takeSelected.Width = 80;
            takeSelected.TextColor = System.Drawing.Color.White;
            takeSelected.TextColorOverride = System.Drawing.Color.FromArgb(236, 236, 255);
            takeSelected.X = w.Width - takeSelected.Width - 17;
            takeSelected.Y = w.Height - takeSelected.Height - 40;
        }
示例#2
0
文件: HUD.cs 项目: riordanp/panjin
            public static void Update()
            {
                healthText.Text = "Health: " + Engine.player.health + "/100";
                positionText.Text = "Position: " + Engine.player.position.X + ", " + Engine.player.position.Y;
                mouseAngleText.Text = "Mouse Angle: " + (int)Engine.player.mouseAngle;
                activeWeaponText.Text = "Active Weapon: " + Engine.player.activeWeapon.name;

                int x = 5, y = 5;
                if (Engine.player.inventory.Count != lastCount)
                {
                    for (int i = 1; i < inventoryGroup.Children.Count; i++)
                    {
                        inventoryGroup.Children[i].Hide();
                        inventoryGroup.Children[i].Dispose();
                    }
                    foreach (Item i in Engine.player.inventory)
                    {
                        Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(inventoryGroup);
                        img.ImageName = "./assets/" + i.iconName;
                        img.SetPosition(x, y);
                        img.SetSize(32, 32);
                        img.SetToolTipText(i.description);
                        img.ToolTip.Enable();

                        x += 5 + 32;
                        if (x > 32 * 9)
                        {
                            y += 10 + 32;
                            x = 5;
                        }
                    }
                    lastCount = Engine.player.inventory.Count;
                }


            }
示例#3
0
文件: HUD.cs 项目: riordanp/panjin
        public void showDialogueModal(NPC sender, string imageName, string text)
        {
            Gwen.Control.WindowControl w = new Gwen.Control.WindowControl(_canvas, sender.name, true);
            w.Width = 320;
            w.Height = 170;
            Align.Center(w);

            Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(w);
            img.ImageName = "./assets/" + imageName;
            img.SetPosition(5, 10);
            img.SetSize(120, 120);

            Gwen.Control.RichLabel label = new Gwen.Control.RichLabel(w);
            String[] textLines = text.Split(new Char[]{'/'});
            for (int i = 0; i < textLines.Length; i++ )
            {
                label.AddText(textLines[i], System.Drawing.Color.Black, HUD.defaultFont);
                label.AddLineBreak();
            }
            label.SetPosition(130, 10);
            label.SetSize(320 - 130, w.Height - 20);
        }
示例#4
0
文件: HUD.cs 项目: riordanp/panjin
            public static void Init()
            {
                Gwen.Control.TabButton button = tabControl.AddPage("Player");
                tabControl.Padding = new Padding(2, 2, 2, 2);
                page = button.Page;
                inventoryGroup = new Gwen.Control.GroupBox(page);
                inventoryGroup.SetPosition(250, 0);
                inventoryGroup.Width = tabControl.Width - 270;
                inventoryGroup.Height = tabControl.Height - 43;
                inventoryGroup.Text = "Inventory";

                    foreach (Item i in Engine.player.inventory)
                    {
                        Gwen.Control.ImagePanel img = new Gwen.Control.ImagePanel(inventoryGroup);
                        img.ImageName = "./assets/" + i.iconName;
                        img.SetPosition(10, 10);
                        img.SetSize(32, 32);
                    }

                    playerinfoGroup = new Gwen.Control.GroupBox(page);
                    playerinfoGroup.Text = Engine.player.name;
                    playerinfoGroup.SetPosition(5, 0);
                    playerinfoGroup.SetSize(235, tabControl.Height - 43);

                    healthText = new Gwen.Control.Label(playerinfoGroup);
                    healthText.SetPosition(5, 0);
                    healthText.Text = "Health: " + Engine.player.health + "/100";

                    positionText = new Gwen.Control.Label(playerinfoGroup);
                    positionText.SetPosition(5, 13);
                    positionText.Text = "Position: " + Engine.player.position.X + ", " + Engine.player.position.Y;

                    mouseAngleText = new Gwen.Control.Label(playerinfoGroup);
                    mouseAngleText.SetPosition(5, 26);
                    mouseAngleText.Text = "Mouse Angle: " + Engine.player.mouseAngle;

                    activeWeaponText = new Gwen.Control.Label(playerinfoGroup);
                    activeWeaponText.SetPosition(5, 39);
                    activeWeaponText.Text = "Active Weapon: " + Engine.player.activeWeapon.name;

            }