public Button(GameClass game, string text) : base(game) { init(); label = new Label(game, text); Rect = new Rectangle(label.Rect.X, label.Rect.Y, label.Rect.Width, label.Rect.Height); }
public MainMenu(GameClass game) : base(game) { Background = new Image(game, @"Images\Screen_MainMenu"); title = new Label(game, "Keepers of Otherness", "Cambria_72pt_b", Color.White); title.Rect = new Rectangle(Globals.ScreenCenterX - title.Rect.Width / 2, 100, title.Rect.Width, title.Rect.Height); Add(title); subtitle = new Label(game, "Book 1: DARKNESS WITHIN", "Cambria_30pt", Color.White); subtitle.Rect = new Rectangle(Globals.ScreenCenterX - subtitle.Rect.Width / 2, 100 + title.Rect.Height + 10, subtitle.Rect.Width, subtitle.Rect.Height); Add(subtitle); newGame = new Button(game, "New Game", "Cambria_18pt", Globals.ScreenCenterX - 90, Globals.ScreenHeight - 250, 180, 40); newGame.OnMouseClick = delegate(object sender, EventArgs e) { game.Screen_NewGame = new NewGame(game); game.currentScreen = GameScreen.NEW_GAME; }; Add(newGame); loadGame = new Button(game, "Load Game", "Cambria_18pt", Globals.ScreenCenterX - 90, Globals.ScreenHeight - 250 + 10 + newGame.Rect.Height, 180, 40); Add(loadGame); settings = new Button(game, "Settings", "Cambria_18pt", Globals.ScreenCenterX - 90, Globals.ScreenHeight - 250 + 10 + newGame.Rect.Height + 10 + loadGame.Rect.Height, 180, 40); Add(settings); quit = new Button(game, "Exit", "Cambria_18pt", Globals.ScreenCenterX - 90, Globals.ScreenHeight - 250 + 10 + newGame.Rect.Height + 10 + loadGame.Rect.Height + 10 + settings.Rect.Height, 180, 40); quit.OnMouseClick = delegate(object sender, EventArgs e) { game.Exit(); }; Add(quit); }
public Button(GameClass game, string text, string fontFileTitle) : base(game) { init(); _state = States.DEFAULT; label = new Label(game, text, fontFileTitle, Color.White); Rect = new Rectangle(label.Rect.X, label.Rect.Y, label.Rect.Width, label.Rect.Height); }
public Button(GameClass game, string text, string fontFileTitle, int x, int y, int width = 0, int height = 0) : base(game) { init(); if (width == 0) // absolute coordinates for the label { label = new Label(game, text, fontFileTitle, Color.White, x, y); Rect = new Rectangle(x, y, label.Rect.Width, label.Rect.Height); } else // relative coordinates for the label (in respect to the Button's Rect) { label = new Label(game, text, fontFileTitle, Color.White); Rect = new Rectangle(x, y, width, height); } }
public TextBox(GameClass game) : base(game) { init(); label = new Label(game); }
public NewGame(GameClass game) : base(game) { #region Background Background = new Image(game, @"Images\Screen_NewGame"); #endregion #region Title title = new Label(game, "Create a New Character", @"Pericles_30pt", Color.White, 40, 30); Add(title); #region TitleLine line = new Primitive(game); line.Rect = new Rectangle(40, 90, 900, 90); Add(line); #endregion #endregion #region TabbedPanel tabbedPanel = new TabbedPanel(game); tabbedPanel.Rect = new Rectangle(20, 120, Globals .ScreenWidth - 20 * 2, Globals.ScreenHeight - 20 * 2 - 120); #region SeparatorLine Primitive separator = new Primitive(game); separator.Rect = new Rectangle(260, 120, 260, 560); Add(separator); #endregion #region CircumstancesPanel Panel circumstancesPanel = new Panel(game); circumstancesPanel.MarginX = 30; tabbedPanel.AddTab("Circumstances", circumstancesPanel); circumstancesPanel.LayoutManager = new FlowLayout(FlowLayout.Mode.HORIZONTAL); OptionPanel circumstancesPanel_optionPanel = new OptionPanel(game, new Rectangle(0, 0, 650, 240)); circumstancesPanel.Add(circumstancesPanel_optionPanel); circumstancesPanel_optionPanel.LayoutManager = new FlowLayout(); humanCommonerToggle = new Toggle(game, "Human Commoner", 0, 0, 220, 40); circumstancesPanel_optionPanel.Add(humanCommonerToggle); humanNobleToggle = new Toggle(game, "Human Noble", 0, 0, 220, 40); circumstancesPanel_optionPanel.Add(humanNobleToggle); humanBanditToggle = new Toggle(game, "Human Bandit", 0, 0, 220, 40); circumstancesPanel_optionPanel.Add(humanBanditToggle); elvenCommonerToggle = new Toggle(game, "Elven Commoner", 0, 0, 220, 40); elvenCommonerToggle.CorePictureFileTitle = @"Interface\Toggle2"; circumstancesPanel_optionPanel.Add(elvenCommonerToggle); elvenInitiateToggle = new Toggle(game, "Elven Initiate", 0, 0, 220, 40); elvenInitiateToggle.CorePictureFileTitle = @"Interface\Toggle2"; circumstancesPanel_optionPanel.Add(elvenInitiateToggle); elvenOutcastToggle = new Toggle(game, "Elven Outcast", 0, 0, 220, 40); elvenOutcastToggle.CorePictureFileTitle = @"Interface\Toggle2"; circumstancesPanel_optionPanel.Add(elvenOutcastToggle); gnomeCommonerToggle = new Toggle(game, "Gnome Commoner", 0, 0, 220, 40); gnomeCommonerToggle.CorePictureFileTitle = @"Interface\Toggle3"; circumstancesPanel_optionPanel.Add(gnomeCommonerToggle); gnomeInventorToggle = new Toggle(game, "Gnome Inventor", 0, 0, 220, 40); gnomeInventorToggle.CorePictureFileTitle = @"Interface\Toggle3"; circumstancesPanel_optionPanel.Add(gnomeInventorToggle); gnomeThiefToggle = new Toggle(game, "Gnome Thief", 0, 0, 220, 40); gnomeThiefToggle.CorePictureFileTitle = @"Interface\Toggle3"; circumstancesPanel_optionPanel.Add(gnomeThiefToggle); Panel circumstancesPanelRight = new Panel(game); circumstancesPanelRight.Rect = new Rectangle(0, 0, 320, 300); circumstancesPanel.Add(circumstancesPanelRight); circumstancesPanelRight.LayoutManager = new FlowLayout(); circumstancesInfo = new LabelArea(game); circumstancesInfo.Rect = new Rectangle(0, 0, 320, 440); circumstancesPanelRight.Add(circumstancesInfo); circumstancesInfo.FontCoreFileName = @"Fonts\Cambria"; circumstancesInfo.FontSize = "16"; circumstancesInfo.Text = ""; circumstancesInfo.Background = new Image(game, @"Interface\LabelArea"); circumstancesInfo.MarginX = 10; circumstancesInfo.MarginY = 5; EventHandler circumstancesToggle1Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Human Commoner</b><n><n></color>Born in the secluded village on the outskirts of the <i>Dayen Forest</i>, you have been brought up in the traditions of the local people. Your parents are working the village mill and are of reasonable standing. <color=green>Fayna</color>, your little sister is you only other living relative.<n><n><b>Class: </b>No restrictions."; warriorToggle.Enabled = true; mageToggle.Enabled = true; rogueToggle.Enabled = true; rangerToggle.Enabled = true; warriorToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; humanCommonerToggle.OnMouseClick += circumstancesToggle1Click; humanCommonerToggle.OnMouseMove += circumstancesToggle1Click; EventHandler circumstancesToggle2Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Human Noble</b><n><n></color>The <i>House of Morren</i> has always been well respected in the royal court of <i>Sidris Fey</i>. As the only child of <color=green>Daeya</color> and <color=green>Sumac Morren</color>, you've been given every privilage a young person can wish for.<n><n><b>Class: </b><color=blue>Warrior</color> or <color=blue>Mage</color>."; warriorToggle.Enabled = true; mageToggle.Enabled = true; rogueToggle.Enabled = false; rangerToggle.Enabled = false; warriorToggle.Set(); lastNameText.Text = "Morren"; lastNameText.Enabled = false; bGenerateLastName.Enabled = false; }; humanNobleToggle.OnMouseClick += circumstancesToggle2Click; humanNobleToggle.OnMouseMove += circumstancesToggle2Click; EventHandler circumstancesToggle3Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Human Bandit</b><n><n></color>Orphaned at a young age, you've been surviving on the streets of <i>Als Ondir</i> by luck, more than anything. A while ago your fellow beggars got you connected to a bandit group known as <i>The Foresters</i>. Bandit leader <color=green>Jake</color> has taken a liking to you, so your life quality has improved greatly.<n><n><b>Class: </b><color=blue>Rogue</color>, <color=blue>Mage</color> or <color=blue>Ranger</color>."; warriorToggle.Enabled = false; mageToggle.Enabled = true; rogueToggle.Enabled = true; rangerToggle.Enabled = true; mageToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; humanBanditToggle.OnMouseClick += circumstancesToggle3Click; humanBanditToggle.OnMouseMove += circumstancesToggle3Click; EventHandler circumstancesToggle4Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Elven Commoner</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Mage</color> or <color=blue>Ranger</color>."; warriorToggle.Enabled = false; mageToggle.Enabled = true; rogueToggle.Enabled = false; rangerToggle.Enabled = true; mageToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; elvenCommonerToggle.OnMouseClick += circumstancesToggle4Click; elvenCommonerToggle.OnMouseMove += circumstancesToggle4Click; EventHandler circumstancesToggle5Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Elven Initiate</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Mage</color>."; warriorToggle.Enabled = false; mageToggle.Enabled = true; rogueToggle.Enabled = false; rangerToggle.Enabled = false; mageToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; elvenInitiateToggle.OnMouseClick += circumstancesToggle5Click; elvenInitiateToggle.OnMouseMove += circumstancesToggle5Click; EventHandler circumstancesToggle6Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Elven Outcast</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Warrior</color>, <color=blue>Rogue</color> or <color=blue>Ranger</color>."; warriorToggle.Enabled = true; mageToggle.Enabled = false; rogueToggle.Enabled = true; rangerToggle.Enabled = true; warriorToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; elvenOutcastToggle.OnMouseClick += circumstancesToggle6Click; elvenOutcastToggle.OnMouseMove += circumstancesToggle6Click; EventHandler circumstancesToggle7Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Gnome Commoner</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Warrior</color> or <color=blue>Rogue</color>."; warriorToggle.Enabled = true; mageToggle.Enabled = false; rogueToggle.Enabled = true; rangerToggle.Enabled = false; warriorToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; gnomeCommonerToggle.OnMouseClick += circumstancesToggle7Click; gnomeCommonerToggle.OnMouseMove += circumstancesToggle7Click; EventHandler circumstancesToggle8Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Gnome Inventor</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Warrior</color> or <color=blue>Ranger</color>."; warriorToggle.Enabled = true; mageToggle.Enabled = false; rogueToggle.Enabled = false; rangerToggle.Enabled = true; warriorToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; gnomeInventorToggle.OnMouseClick += circumstancesToggle8Click; gnomeInventorToggle.OnMouseMove += circumstancesToggle8Click; EventHandler circumstancesToggle9Click = delegate(object sender, EventArgs e) { circumstancesInfo.Text = "<color=yellow><b>Gnome Thief</b><n><n></color>asd<n><n><b>Class: </b><color=blue>Rogue</color>."; warriorToggle.Enabled = false; mageToggle.Enabled = false; rogueToggle.Enabled = true; rangerToggle.Enabled = false; rogueToggle.Set(); lastNameText.Enabled = true; if (lastNameText.Text == "Morren") lastNameText.Text = ""; bGenerateLastName.Enabled = true; }; gnomeThiefToggle.OnMouseClick += circumstancesToggle9Click; gnomeThiefToggle.OnMouseMove += circumstancesToggle9Click; #endregion #region ClassPanel Panel classPanel = new Panel(game); classPanel.MarginX = 30; tabbedPanel.AddTab("Class", classPanel); classPanel.LayoutManager = new FlowLayout(FlowLayout.Mode.HORIZONTAL); OptionPanel classPanel_optionPanel = new OptionPanel(game, new Rectangle(0, 0, 650, 240)); classPanel.Add(classPanel_optionPanel); classPanel_optionPanel.LayoutManager = new FlowLayout(); warriorToggle = new Toggle(game, "Warrior", 0, 0, 220, 40); classPanel_optionPanel.Add(warriorToggle); mageToggle = new Toggle(game, "Mage", 0, 0, 220, 40); classPanel_optionPanel.Add(mageToggle); rogueToggle = new Toggle(game, "Rogue", 0, 0, 220, 40); classPanel_optionPanel.Add(rogueToggle); rangerToggle = new Toggle(game, "Ranger", 0, 0, 220, 40); classPanel_optionPanel.Add(rangerToggle); Panel classPanelRight = new Panel(game); classPanelRight.Rect = new Rectangle(0, 0, 320, 300); classPanel.Add(classPanelRight); classPanelRight.LayoutManager = new FlowLayout(); classInfo = new LabelArea(game); classInfo.Rect = new Rectangle(0, 0, 320, 440); classPanelRight.Add(classInfo); classInfo.FontCoreFileName = @"Fonts\Cambria"; classInfo.FontSize = "16"; classInfo.Text = ""; classInfo.Background = new Image(game, @"Interface\LabelArea"); classInfo.MarginX = 10; classInfo.MarginY = 5; EventHandler classToggle1Click = delegate(object sender, EventArgs e) { classInfo.Text = "<color=yellow><b>Warrior</b><n><n></color>Proficient with melee weapons (swords, axes, clubs, maces, etc.) and capable of wearing heavy armor. Warriors solve most situations with brute force.<n><n><b>Evolves to: </b><n><color=blue>Swordmaster</color> or <color=blue>Duelist</color>."; }; warriorToggle.OnMouseClick += classToggle1Click; warriorToggle.OnMouseMove += classToggle1Click; EventHandler classToggle2Click = delegate(object sender, EventArgs e) { classInfo.Text = "<color=yellow><b>Mage</b><n><n></color>Born with the <i>Gift</i>, mages can use psionic power at will handling tasks ranging from lock-picking to healing to dealing damage. Can use staves and rods for spell focussing or fighting.<n><n><b>Evolves to: </b><n><color=blue>Generalist</color> or <color=blue>Scholar</color>."; }; mageToggle.OnMouseClick += classToggle2Click; mageToggle.OnMouseMove += classToggle2Click; EventHandler classToggle3Click = delegate(object sender, EventArgs e) { classInfo.Text = "<color=yellow><b>Rogue</b><n><n></color>Adept at poison and trap making and detection, sneaking, pick-pocketing, lock-picking and similar skills, rogues are excellent thieves and assassins. Weapon proficiency limited to daggers and short swords.<n><n><b>Evolves to: </b><n><color=blue>Shade</color> or <color=blue>Assassin</color>."; }; rogueToggle.OnMouseClick += classToggle3Click; rogueToggle.OnMouseMove += classToggle3Click; EventHandler classToggle4Click = delegate(object sender, EventArgs e) { classInfo.Text = "<color=yellow><b>Ranger</b><n><n></color>Rangers use bows and crossbows as their weapons of choice. They are capable of making various potions and poultices using herbs.<n><n><b>Evolves to: </b><n><color=blue>Warden</color> or <color=blue>Bowmaster</color>."; }; rangerToggle.OnMouseClick += classToggle4Click; rangerToggle.OnMouseMove += classToggle4Click; #endregion #region GenderPanel Panel genderPanel = new Panel(game); genderPanel.MarginX = 30; tabbedPanel.AddTab("Gender", genderPanel); genderPanel.LayoutManager = new FlowLayout(FlowLayout.Mode.HORIZONTAL); OptionPanel genderPanel_optionPanel = new OptionPanel(game, new Rectangle(0, 0, 650, 240)); genderPanel.Add(genderPanel_optionPanel); genderPanel_optionPanel.LayoutManager = new FlowLayout(); maleToggle = new Toggle(game, "Male", 0, 0, 220, 40); genderPanel_optionPanel.Add(maleToggle); femaleToggle = new Toggle(game, "Female", 0, 0, 220, 40); genderPanel_optionPanel.Add(femaleToggle); Panel genderPanelRight = new Panel(game); genderPanelRight.Rect = new Rectangle(0, 0, 320, 300); genderPanel.Add(genderPanelRight); genderPanelRight.LayoutManager = new FlowLayout(); LabelArea genderInfo = new LabelArea(game); genderInfo.Rect = new Rectangle(0, 0, 320, 440); genderPanelRight.Add(genderInfo); genderInfo.FontCoreFileName = @"Fonts\Cambria"; genderInfo.FontSize = "16"; genderInfo.Text = ""; genderInfo.Background = new Image(game, @"Interface\LabelArea"); genderInfo.MarginX = 10; genderInfo.MarginY = 5; EventHandler maleToggleClick = delegate(object sender, EventArgs e) { genderInfo.Text = "<color=yellow><b>Male</b><n><n></color>While both genders are balanced in terms of skills, people may behave differently if the player character is male."; }; maleToggle.OnMouseClick += maleToggleClick; maleToggle.OnMouseMove += maleToggleClick; EventHandler femaleToggleClick = delegate(object sender, EventArgs e) { genderInfo.Text = "<color=yellow><b>Female</b><n><n></color>While both genders are balanced in terms of skills, people may behave differently if the player character is female."; }; femaleToggle.OnMouseClick += femaleToggleClick; femaleToggle.OnMouseMove += femaleToggleClick; #endregion #region AppearancePanel Panel appearancePanel = new Panel(game); appearancePanel.MarginX = 30; tabbedPanel.AddTab("Appearance", appearancePanel); appearancePanel.LayoutManager = new FlowLayout(FlowLayout.Mode.HORIZONTAL); int lastGender = -1, lastCircumstances = -1; EventHandler eh = delegate(object sender, EventArgs e) { if (genderPanel_optionPanel.SelectedIndex == lastGender && circumstancesPanel_optionPanel.SelectedIndex == lastCircumstances) return; lastGender = genderPanel_optionPanel.SelectedIndex; lastCircumstances = circumstancesPanel_optionPanel.SelectedIndex; appearancePanel.Clear(); portraitsPanel = new OptionPanel(game, new Rectangle(0, 0, 650, 240)); appearancePanel.Add(portraitsPanel); portraitsPanel.LayoutManager = new BoxLayout(5, 3); portraits = new Toggle[15]; for (int i = 0; i < 5; ++i) { portraits[i] = new Toggle(game, "", 0, 0, 120, 160); portraits[i].CorePictureFileTitle = @"Portraits\Human" + (genderPanel_optionPanel.SelectedIndex == 0 ? "Male" : "Female") + (i + 1); portraitsPanel.Add(portraits[i]); if (!(humanCommonerToggle.Pressed() || humanNobleToggle.Pressed() || humanBanditToggle.Pressed())) portraits[i].Enabled = false; else portraits[0].Set(); } for (int i = 5; i < 10; ++i) { portraits[i] = new Toggle(game, "", 0, 0, 120, 160); portraits[i].CorePictureFileTitle = @"Portraits\Elf" + (genderPanel_optionPanel.SelectedIndex == 0 ? "Male" : "Female") + (i - 4); portraitsPanel.Add(portraits[i]); if (!(elvenCommonerToggle.Pressed() || elvenInitiateToggle.Pressed() || elvenOutcastToggle.Pressed())) portraits[i].Enabled = false; else portraits[5].Set(); } for (int i = 10; i < 15; ++i) { portraits[i] = new Toggle(game, "", 0, 0, 120, 160); portraits[i].CorePictureFileTitle = @"Portraits\Gnome" + (genderPanel_optionPanel.SelectedIndex == 0 ? "Male" : "Female") + (i - 9); portraitsPanel.Add(portraits[i]); if (!(gnomeCommonerToggle.Pressed() || gnomeInventorToggle.Pressed() || gnomeThiefToggle.Pressed())) portraits[i].Enabled = false; else portraits[10].Set(); } Panel portraitPreviewPanel = new Panel(game, new Rectangle(0, 0, 340, 400)); appearancePanel.Add(portraitPreviewPanel); portraitPreview = new Image(game); portraitPreviewPanel.Add(portraitPreview); for (int i = 0; i < 15; ++i) { int y = i; portraits[i].OnMouseClick += delegate(object sender2, EventArgs e2) { int x = y; portraitPreview.Texture = Res.Get<Texture2D>(portraits[x].CorePictureFileTitle); portraitPreview.Rect = new Rectangle(portraitPreview.Rect.X, portraitPreview.Rect.Y, portraitPreview.Texture.Bounds.Width + 20, portraitPreview.Texture.Bounds.Height + 20); }; } }; eh(this, null); tabbedPanel.SetOpenTabAction(3, eh); #endregion #region FinalPanel Panel finalPanel = new Panel(game); finalPanel.MarginX = 30; tabbedPanel.AddTab("Finalize!", finalPanel); Panel namePanel = new Panel(game, new Rectangle(0, 0, 650, 40)); finalPanel.Add(namePanel); Label firstNameLabel = new Label(game, "First Name: ", "Cambria_12pt", Color.White); namePanel.Add(firstNameLabel); firstNameText = new TextBox(game); firstNameText.Rect = new Rectangle(firstNameLabel.Rect.Width + 10, -6, 300, 36); firstNameText.EnableSpace = false; firstNameText.BoundedTextWidth = true; namePanel.Add(firstNameText); Button bGenerateFirstName = new Button(game, "Generate", firstNameText.Rect.Width + firstNameLabel.Rect.Width + 20, -2, 218, 30); bGenerateFirstName.OnMouseClick = delegate(object sender, EventArgs e) { firstNameText.Text = generateFirstName(); }; namePanel.Add(bGenerateFirstName); Label lastNameLabel = new Label(game, "Last Name: ", "Cambria_12pt", Color.White); lastNameLabel.Rect = new Rectangle(0, firstNameLabel.Rect.Height + 10, 0, 0); namePanel.Add(lastNameLabel); lastNameText = new TextBox(game); lastNameText.Rect = new Rectangle(firstNameLabel.Rect.Width + 10, firstNameLabel.Rect.Height + 10 - 6, 300, 36); lastNameText.EnableSpace = false; lastNameText.BoundedTextWidth = true; namePanel.Add(lastNameText); bGenerateLastName = new Button(game, "Generate", firstNameText.Rect.Width + firstNameLabel.Rect.Width + 20, firstNameLabel.Rect.Height + 8, 218, 30); bGenerateLastName.OnMouseClick = delegate(object sender, EventArgs e) { lastNameText.Text = generateLastName(); }; namePanel.Add(bGenerateLastName); #region Recap Panel recapPanel = new Panel(game); EventHandler recap = delegate(object sender, EventArgs e) { recapPanel.Clear(); Image recapBackground = new Image(game, @"Interface\LabelArea"); recapBackground.Rect = new Rectangle(0, 70, 620, 320); recapPanel.Add(recapBackground); Image recapPortrait = new Image(game); eh(this, null); // update portraits (if circumstances or gender changed) recapPortrait.Texture = Res.Get<Texture2D>(portraits[portraitsPanel.SelectedIndex].CorePictureFileTitle); recapPortrait.Rect = new Rectangle(15, 80, 225, 300); recapPanel.Add(recapPortrait); Label recapCircumstances = new Label(game, getSelectedCircumstances(), 250, 80); recapCircumstances.Font = Res.Get<SpriteFont>(@"Fonts\Cambria_16pt_b"); recapCircumstances.FontColor = Color.White; recapPanel.Add(recapCircumstances); Label recapClass = new Label(game, "Level 1 " + getSelectedClass(), 250, 100); recapClass.Font = Res.Get<SpriteFont>(@"Fonts\Cambria_12pt_b"); recapClass.FontColor = Color.Yellow; recapPanel.Add(recapClass); string circText = ""; if (circumstancesInfo.Text != null && circumstancesInfo.Text != string.Empty) { int firstNewLine = circumstancesInfo.Text.IndexOf("<n>"); circText = circumstancesInfo.Text.Substring(firstNewLine).Substring(3, circumstancesInfo.Text.LastIndexOf("<n>") - firstNewLine); } string classText = ""; if (classInfo.Text != null && classInfo.Text != string.Empty) { int firstNewLine = classInfo.Text.IndexOf("<n>"); int lastNewLine = classInfo.Text.LastIndexOf("<n>"); classText = classInfo.Text.Substring(firstNewLine).Substring(6, lastNewLine - firstNewLine); classText = classText.Substring(0, classText.LastIndexOf("<n><n>")); } LabelArea recapCircumstancesInfo = new LabelArea(game, circText + classText, new Rectangle(250, 110, 370, 240)); recapPanel.Add(recapCircumstancesInfo); }; recap(this, null); finalPanel.Add(recapPanel); tabbedPanel.SetOpenTabAction(4, recap); #endregion Button bConfirm = new Button(game, "Confirm", 400, 400, 220, 40); finalPanel.Add(bConfirm); bConfirm.OnMouseClick = delegate(object sender, EventArgs e) { if (firstNameText.Text == null || firstNameText.Text.Trim() == string.Empty || lastNameText.Text == null || lastNameText.Text.Trim() == string.Empty) { if (firstNameText.Text == null || firstNameText.Text.Trim() == string.Empty) firstNameText.Text = generateFirstName(); if (lastNameText.Text == null || lastNameText.Text.Trim() == string.Empty) lastNameText.Text = generateLastName(); return; } game.MainCharacter = new Character(firstNameText.Text, lastNameText.Text, portraits[portraitsPanel.SelectedIndex].CorePictureFileTitle, getSelectedClass(), getSelectedCircumstances()); game.MainCharacter.Level = 1; game.Screen_InGame = new InGame(game); game.Screen_InGame.Process(); game.currentScreen = GameScreen.IN_GAME; }; #endregion Add(tabbedPanel); #endregion #region BackToMenu Button Button bCancel = new Button(game, "Back to Menu", 20, 520, 220, 40); bCancel.OnMouseClick = delegate(object sender, EventArgs e) { game.currentScreen = GameScreen.MAIN_MENU; }; Add(bCancel); #endregion }
public InGame(GameClass game) : base(game) { Background = new Image(game, @"Images\Screen_InGame"); #region PartyPanel partyPanel = new Panel(game, new Rectangle(0, 0, 100, 720)); Add(partyPanel); MainPortrait = new Image(game, game.MainCharacter.PortraitFileTitle); MainPortrait.Rect = new Rectangle(10, 10, 90, 120); partyPanel.Add(MainPortrait); #endregion #region AreaPanel areaPanel = new Panel(game, new Rectangle(110, 10, 512, 288)); Add(areaPanel); AreaImage = new Image(game); areaPanel.Add(AreaImage); AreaDesc = new LabelArea(game, string.Empty, new Rectangle(522, 0, 532, 288)); areaPanel.Add(AreaDesc); #endregion #region StoryPanel storyPanel = new Panel(game, new Rectangle(110, 308, 512, 288)); Add(storyPanel); Story = new LabelArea(game, string.Empty, new Rectangle(0, 0, 502, 288)); storyPanel.Add(Story); #endregion #region ActionPanel ActionPanel = new Panel(game, new Rectangle(110, 500, 512, 300)); Add(ActionPanel); Actions = new List<ActionLabel>(); bActionPanelPrevious = new Button(game, "< Previous", 110, 640, 130, 30); bActionPanelPrevious.Enabled = false; bActionPanelPrevious.OnMouseClick = delegate(object sender, EventArgs e) { if (ActionSetIndex > 0) --ActionSetIndex; else return; bActionPanelNext.Enabled = true; ActionPanel.Clear(); for (int i = 0; i < 6; ++i) { Actions[i + 6 * ActionSetIndex].Rect = new Rectangle(0, i % 6 * 22, Actions[i + 6 * ActionSetIndex].Rect.Width, Actions[i + 6 * ActionSetIndex].Rect.Height); ActionPanel.Add(Actions[i + 6 * ActionSetIndex]); } if (ActionSetIndex == 0) bActionPanelPrevious.Enabled = false; bActionPanelPage.Text = (ActionSetIndex + 1) + "/" + Math.Ceiling(Actions.Count / 6f); }; Add(bActionPanelPrevious); bActionPanelPage = new Button(game, "1/1", 239, 640, 60, 30); Add(bActionPanelPage); bActionPanelNext = new Button(game, "Next >", 299, 640, 130, 30); bActionPanelNext.OnMouseClick = delegate(object sender, EventArgs e) { if (ActionSetIndex < (int)Math.Ceiling(Actions.Count / 6f) - 1) ++ActionSetIndex; else return; bActionPanelPrevious.Enabled = true; ActionPanel.Clear(); for (int i = 0; i < (Actions.Count - Actions.Count % 6 <= 6 * ActionSetIndex ? Actions.Count % 6 : 6); ++i) { Actions[i + 6 * ActionSetIndex].Rect = new Rectangle(0, i % 6 * 22, Actions[i + 6 * ActionSetIndex].Rect.Width, Actions[i + 6 * ActionSetIndex].Rect.Height); ActionPanel.Add(Actions[i + 6 * ActionSetIndex]); } if (ActionSetIndex + 1 >= Math.Ceiling(Actions.Count / 6f)) bActionPanelNext.Enabled = false; bActionPanelPage.Text = (ActionSetIndex + 1) + "/" + Math.Ceiling(Actions.Count / 6f); }; Add(bActionPanelNext); #endregion #region ControlPanel controlPanel = new Panel(game, new Rectangle(632, 308, 522, 332)); controlPanel.Background = new Image(game, @"Interface\LabelArea"); Add(controlPanel); MapImage = new Image(game); MapImage.Rect = new Rectangle(5, 20, 512, 288); controlPanel.Add(MapImage); controls = new TabbedPanel(game); controls.Rect = new Rectangle(632, 308, 532, 332); controls.DefaultTabs = false; #region CharacterPanel Panel controlsCharacter = new Panel(game, new Rectangle(632, 308, 522, 332)); controls.AddTab("Character", controlsCharacter); Image characterPortrait = new Image(game); characterPortrait.Texture = MainPortrait.Texture; characterPortrait.Rect = new Rectangle(10, 10, 180, 230); controlsCharacter.Add(characterPortrait); Label characterName = new Label(game, game.MainCharacter.FirstName + " " + game.MainCharacter.LastName, 200, 10); characterName.Font = Res.Get<SpriteFont>(@"Fonts\Cambria_14pt_b"); characterName.FontColor = Color.Wheat; controlsCharacter.Add(characterName); Label characterRaceClassLevel = new Label(game, Presenter.GetRace(game.MainCharacter.Race) + " " + Presenter.GetClass(game.MainCharacter.Class) + " Level " + game.MainCharacter.Level, 200, 34); characterRaceClassLevel.Font = Res.Get<SpriteFont>(@"Fonts\Cambria_12pt_b"); characterRaceClassLevel.FontColor = Color.White; controlsCharacter.Add(characterRaceClassLevel); Label characterStrengthLabel = new Label(game, "Strength:", 200, 70); characterStrengthLabel.FontColor = Color.White; controlsCharacter.Add(characterStrengthLabel); Label characterStrength = new Label(game, game.MainCharacter.Strength.ToString(), 320, 70); characterStrength.FontColor = Color.White; controlsCharacter.Add(characterStrength); Label characterDexterityLabel = new Label(game, "Dexterity:", 200, 90); characterDexterityLabel.FontColor = Color.White; controlsCharacter.Add(characterDexterityLabel); Label characterDexterity = new Label(game, game.MainCharacter.Dexterity.ToString(), 320, 90); characterDexterity.FontColor = Color.White; controlsCharacter.Add(characterDexterity); Label characterConstitutionLabel = new Label(game, "Constitution:", 200, 110); characterConstitutionLabel.FontColor = Color.White; controlsCharacter.Add(characterConstitutionLabel); Label characterConstitution = new Label(game, game.MainCharacter.Constitution.ToString(), 320, 110); characterConstitution.FontColor = Color.White; controlsCharacter.Add(characterConstitution); Label characterIntelligenceLabel = new Label(game, "Intelligence:", 200, 130); characterIntelligenceLabel.FontColor = Color.White; controlsCharacter.Add(characterIntelligenceLabel); Label characterIntelligence = new Label(game, game.MainCharacter.Intelligence.ToString(), 320, 130); characterIntelligence.FontColor = Color.White; controlsCharacter.Add(characterIntelligence); Label characterHealthLabel = new Label(game, "Health:", 200, 170); characterHealthLabel.FontColor = Color.LightGray; controlsCharacter.Add(characterHealthLabel); Label characterHealth = new Label(game, game.MainCharacter.GetHealthString() + " (" + game.MainCharacter.Health + "/" + game.MainCharacter.MaxHealth + ")", 320, 170); characterHealth.FontColor = Color.LightGray; controlsCharacter.Add(characterHealth); Label characterFatigueLabel = new Label(game, "Fatigue:", 200, 190); characterFatigueLabel.FontColor = Color.LightGray; controlsCharacter.Add(characterFatigueLabel); Label characterFatigue = new Label(game, game.MainCharacter.GetFatigueString() + " (" + game.MainCharacter.Fatigue + "/" + game.MainCharacter.MaxFatigue + ")", 320, 190); characterFatigue.FontColor = Color.LightGray; controlsCharacter.Add(characterFatigue); #endregion #region SkillsPanel Panel controlsSkills = new Panel(game, new Rectangle(632, 308, 522, 332)); controls.AddTab("Skills", controlsSkills); #endregion #region InventoryPanel Panel controlsInventory = new Panel(game, new Rectangle(632, 308, 522, 332)); controls.AddTab("Inventory", controlsInventory); #endregion #region QuestsPanel Panel controlsQuests = new Panel(game, new Rectangle(632, 308, 522, 332)); controls.AddTab("Quests", controlsQuests); #endregion // position the tab buttons int j = 0; foreach (Tuple<TabbedPanel.TabbedPanelButton, Panel> element in controls.Elements) { element.Item1.Rect = new Rectangle(632 + j * 130, 640, 130, 30); ++j; } Add(controls); #endregion }