Inheritance: XGControl
Esempio n. 1
0
        //private XGListBoxItem liPerlin = new XGListBoxItem("Perlin Noise", NoiseTypes.Perlin);
        //private XGListBoxItem liSimplex = new XGListBoxItem("Simplex Noise", NoiseTypes.Simplex);
        public frmCreatePlayer(AzmythGame game)
            : base(new Rectangle(0, 0, 300, 300), true)
        {
            Game = game;
            m_viewport = game.GraphicsDevice.Viewport;

            Rectangle = new Rectangle(0, 0, m_viewport.Width, m_viewport.Height);

            m_world = new World(new VectorID(1, 1), new Random().Next(500, 9999));

            XnaGUIManager.Controls.Add(this);

            pnlMain             = new XGPanel(        new Rectangle(20, 20, 600, 600));
            pnlTitle            = new XGPanel(        new Rectangle(20, 20, 600, 600));
            lblTitle            = new XGLabel(        new Rectangle(20, 30, 50, 30), "Generate a New Adventure");
            lblPlayerName        = new XGLabel(        new Rectangle(20, 20, 100, 30), "Name:");
            txtPlayerName        = new XGTextBox(      new Rectangle(140, 20, pnlMain.Rectangle.Width- 300 , 30));
            btnRandomName       = new XGButton(       new Rectangle(pnlMain.Rectangle.Width, 20, 125, 30), "Random Name", this.btnRandomName_Clicked);
            btnCreatePlayer     = new XGButton(       new Rectangle(m_viewport.Width - 210, m_viewport.Height - 40, 200, 30), "Create World", this.btnCreatePlayer_Clicked);

            pnlMain.CanFocus = false;
            lblPlayerName.CanFocus = false;

            nameGenerator = new MarkovNameGenerator("Acalia,Aldaire,Aldebron,Vulcan,Earth,Romulus,Andor,Adair,Adara,Adriel,Alaire,Alixandra,Altair,Amara,Anatola,Arcadia,Aurelia,Aurelian,Aurelius,Avalon,Bastian,Breen,Briallan,Brielle,Briseis,Cambria,Caspian,Cassia,Cassiel,Cassiopeia,Cassius,Chaniel,Cora,Corbin,Cyprian,Dagen,Daire,Darius,Destin,Devlin,Devlyn,Drake,Drystan,Eira,Eirian,Eliron,Elysia,Eoin,Evadne,Evanth,Fineas,Finian,Fyodor,Gaerwn,Gareth,Gavriel,Ginerva,Griffin,Guinevere,Hadriel,Hannelore,Hermione,Hesperos,Iagan,Ianthe,Ignacia,Ignatius,Iseult,Isolde,Jessalyn,Kara,Katriel,Kerensa,Korbin,Kyler,Kyra,Kyrielle,Leala,Leila,Leira,Lilith,Liora,Liriene,Liron,Lucien,Lyra,Maia,Marius,Mathieu,Maylea,Meira,Mireille,Mireya,Natania,Neirin,Nerys,Nuriel,Nyfain,Nyssa,Oisin,Oleisa,Oralie,Orinthea,Orion,Orpheus,Ozara,Peregrine,Persephone,Perseus,Petronela,Phelan,Pryderi,Pyralia,Pyralis,Qadira,Quinevere,Quintessa,Raisa,Remus,Renfrew,Rhyan,Rhydderch,Riona,Saira,Saoirse,Sarai,Sarielle,Sebastian,Seraphim,Seraphina,Serian,Sirius,Sorcha,Severin,Tavish,Tearlach,Terra,Thalia,Thaniel,Theia,Torian,Torin,Tressa,Tristana,Ulyssia,Uriela,Urien,Vanora,Vasilis,Vespera,Xanthus,Xara,Xylia,Yadira,Yakira,Yeira,Yeriel,Yestin,Yseult,Zaira,Zaniel,Zarek,Zephyr,Zora,Zorion".Split(','), 3);

            lblTitle.Alignment = GUIAlignment.HCenter | GUIAlignment.VCenter;
            txtPlayerName.Text = Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(nameGenerator.Next());

            Children.Add(pnlMain);
            Children.Add(pnlTitle);
            pnlTitle.Children.Add(lblTitle);
            pnlMain.Children.Add(lblPlayerName);
            pnlMain.Children.Add(txtPlayerName);
            pnlMain.Children.Add(btnRandomName);
            pnlMain.Children.Add(btnCreatePlayer);

            focusControl = pnlMain;

            pnlMain.ActivateFirst();

            XnaGUIManager.ActivateNext();
        }
Esempio n. 2
0
        public XGLabeledSlider(Rectangle rect, int labelWidth, string text, int valueLabelWidth, float value, float min, float max)
            : base(rect, true)
        {
            ValueLabelFormat = "F3";

            Rectangle partRect = rect;
            partRect.X = partRect.Y = 0; // parent relative

            partRect.Width = labelWidth;
            Label = new XGLabel(partRect, text, GUIAlignment.Right | GUIAlignment.VCenter);
            Children.Add(Label);

            partRect.X += partRect.Width + 1;
            partRect.Width = rect.Width - (labelWidth + valueLabelWidth + 2);
            Slider = new XGHSlider(partRect, 0.0f);
            Slider.SetRange(value, min, max);
            Children.Add(Slider);

            partRect.X = Slider.Rectangle.X + Slider.Rectangle.Width + 1;
            partRect.Width = valueLabelWidth;
            ValueLabel = new XGLabel(partRect, "0.000");
            Children.Add(ValueLabel);
        }
Esempio n. 3
0
        public ToolPage(Rectangle rect, SoundHandler handler)
            : base(rect, "Ship Settings")
        {
            this.handler = handler;
            // stupid c# isent letting me pass these by refence so i have to do it lik ethis
            int currenty = 66;

            SheildStrength = new XGHSlider(new Rectangle(130, currenty, 200, 20), 5f, 10f);
            SheildLable = new XGLabel(new Rectangle(0, currenty, 10, 20), "Sheild Strength");
            SpeedLable = new XGLabel(new Rectangle(350, currenty, 10, 20), "Speed");

            Children.Add(SheildStrength);
            Children.Add(SheildLable);
            Children.Add(SpeedLable);

            currenty += Y_INCRMENT;

            FirePowerSlider = new XGHSlider(new Rectangle(130, currenty, 200, 20), 5f, 10f);
            FireSpeed = new XGLabel(new Rectangle(0, currenty, 10, 20), "Fire Speed");
            FirePower = new XGLabel(new Rectangle(350, currenty, 10, 20), "Fire Power");

            Children.Add(FirePowerSlider);
            Children.Add(FireSpeed);
            Children.Add(FirePower);

            currenty += Y_INCRMENT;

            selectSprite = new XGLabel(new Rectangle(0, currenty, 10, 20), "Ship: ");
            Children.Add(selectSprite);

            currenty += 100;
            okButton = new XGButton(new Rectangle(350, currenty, 100, 20), "Ok", this.Ok_Clicked);
            Children.Add(okButton);
        }