protected override void LoadContent() { //Nacteni pisma spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); //Vytvoreni pozadi background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\Message"), DrawMode.Center); //Vytvoreni labelu pro zpravu message = new Label(spriteFont); message.Text = Session.Message; message.Position = new Vector2(215, 250); Controls.Add(message); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel Button = new LinkLabel(spriteFont); Button.Text = "Ok."; Button.Size = Button.SpriteFont.MeasureString(Button.Text); Button.Position = new Vector2(215, 450); Controls.Add(Button); //Pridani eventu pro vyber Button.Selected += new EventHandler(Button_Selected); base.LoadContent(); }
protected override void LoadContent() { //Nacteni pozadi a fontu background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\startscreen"), DrawMode.Center); SpriteFont spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); //Ziskani vsech ulozenych her ze slozky Saves System.IO.DirectoryInfo dir = new DirectoryInfo(Session.GameRef.Content.RootDirectory + "\\Saves"); FileInfo[] files = dir.GetFiles(); //Nastaveni vsech tlacitek na tlacitka ulozenych her pro nahrani hry for (int i = 0; i < 10; i++) { if (i < files.Length) { LinkLabel linkLabel = new LinkLabel(spriteFont); linkLabel.Text = files[i].Name.Substring(0, files[i].Name.Length - 4); linkLabel.Size = linkLabel.SpriteFont.MeasureString(linkLabel.Text); linkLabel.Position = new Vector2((GameRef.Window.ClientBounds.Width - linkLabel.Size.X) / 2, 250 + i * 25); linkLabel.Selected += new EventHandler(linkLabel_Selected); Controls.Add(linkLabel); } else { LinkLabel linkLabel = new LinkLabel(spriteFont); linkLabel.Text = "null"; linkLabel.Size = linkLabel.SpriteFont.MeasureString(linkLabel.Text); linkLabel.Position = new Vector2((GameRef.Window.ClientBounds.Width - linkLabel.Size.X) / 2, 250 + i * 25); linkLabel.Enabled = false; linkLabel.Selected += new EventHandler(linkLabel_Selected); Controls.Add(linkLabel); } } }
protected override void LoadContent() { //Nacteni pisma spriteFont = Content.Load<SpriteFont>(@"Fonts\editorFont"); //Vytvoreni pozadi background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\theendMessage"), DrawMode.Center); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel Button = new LinkLabel(spriteFont); Button.Text = "Ukoncit a vratit se na hlavni menu."; Button.Size = Button.SpriteFont.MeasureString(Button.Text); Button.Position = new Vector2(240, 450); Controls.Add(Button); //Pridani eventu pro vyber Button.Selected += new EventHandler(Button_Selected); base.LoadContent(); }
protected override void LoadContent() { //Nacteni pisma spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); //Vytvoreni pozadi background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\endMessage"), DrawMode.Center); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel AnoButton = new LinkLabel(spriteFont); AnoButton.Text = "Ano"; AnoButton.Size = AnoButton.SpriteFont.MeasureString(AnoButton.Text); AnoButton.Position = new Vector2(245,450); Controls.Add(AnoButton); //Pridani eventu pro vyber AnoButton.Selected += new EventHandler(OnAno_Selected); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel SaveButton = new LinkLabel(spriteFont); SaveButton.Text = "Ulozit"; SaveButton.Size = SaveButton.SpriteFont.MeasureString(SaveButton.Text); SaveButton.Position = new Vector2(345,450); Controls.Add(SaveButton); //Pridani eventu pro vyber SaveButton.Selected += new EventHandler(OnSave_Selected); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel NeButton = new LinkLabel(spriteFont); NeButton.Text = "Ne"; NeButton.Size = NeButton.SpriteFont.MeasureString(NeButton.Text); NeButton.Position = new Vector2(445,450); Controls.Add(NeButton); //Pridani eventu pro vyber NeButton.Selected += new EventHandler(OnNe_Selected); base.LoadContent(); }
protected override void LoadContent() { ram = new Rectangle(770, 250, 220, 220); //Nacteni fontu, ramecku pro tileset a pozadi font = Content.Load<SpriteFont>(@"Fonts\editorFont"); ramTexture = Content.Load<Texture2D>(@"Pictures\ram"); background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\editorscreen"), DrawMode.Center); #region ovladaci prvky spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); string[] LayermenuItems = { "Back Map", "Back Splatter", "Front Map", "Front Splatter" }; LayerMenu = new MenuComponent(font, LayermenuItems, false); LayerMenu.SetPostion(new Vector2(770, 30)); LayerMenu.SelectedColor = Color.Yellow; LayerMenu.HiliteColor = Color.White; spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); string[] ActionmenuItems = { "Add", "Move", "Pick", "Delete" }; ActionMenu = new MenuComponent(font, ActionmenuItems, false); ActionMenu.SetPostion(new Vector2(900, 30)); ActionMenu.SelectedColor = Color.Yellow; ActionMenu.HiliteColor = Color.White; spriteFont = Content.Load<SpriteFont>(@"Fonts\menuFont"); LinkLabel linkLabel1 = new LinkLabel(spriteFont); linkLabel1.Text = "Save"; linkLabel1.Size = linkLabel1.SpriteFont.MeasureString(linkLabel1.Text); linkLabel1.Position = new Vector2(770,720); linkLabel1.Selected += new EventHandler(linkLabel1_Selected); Controls.Add(linkLabel1); LinkLabel linkLabel2 = new LinkLabel(spriteFont); linkLabel2.Text = "Load"; linkLabel2.Size = linkLabel2.SpriteFont.MeasureString(linkLabel2.Text); linkLabel2.Position = new Vector2(940,720); linkLabel2.Selected += new EventHandler(linkLabel2_Selected); Controls.Add(linkLabel2); Controls.editor = true; label1 = new Label(spriteFont); label1.Position = new Vector2(845, 720); label1.Visible = false; Controls.Add(label1); Session.LoadMapAndTextures("map.xml"); string[] CharacterStrings = new string[Session.baseUnits.Keys.Count]; Session.baseUnits.Keys.CopyTo(CharacterStrings, 0); CharacterMenu = new MenuComponent(font, CharacterStrings, false); CharacterMenu.SetPostion(new Vector2(770, 200)); CharacterMenu.SelectedColor = Color.Yellow; CharacterMenu.HiliteColor = Color.White; int[] KeyInts = new int[Session.baseKeys.Keys.Count]; Session.baseKeys.Keys.CopyTo(KeyInts, 0); string[] KeyStrings = new string[Session.baseKeys.Keys.Count]; for (int i = 0; i < KeyInts.Length; i++) { KeyStrings[i] = KeyInts[i].ToString(); } KeyMenu = new MenuComponent(font, KeyStrings, false); KeyMenu.SetPostion(new Vector2(770, 200)); KeyMenu.SelectedColor = Color.Yellow; KeyMenu.HiliteColor = Color.White; string[] TileSetmenuItems = new string[Session.FrontMap.tilesets.Count + 2]; for (int i = 0; i < Session.FrontMap.tilesets.Count; i++) { TileSetmenuItems[i] = Session.FrontMap.tilesets[i].Texture.Name; //files[i].Name.Substring(0, files[i].Name.Length - 4); } TileSetmenuItems[TileSetmenuItems.Length - 2] = "Characters"; TileSetmenuItems[TileSetmenuItems.Length - 1] = "Keys"; TileSetMenu = new MenuComponent(font, TileSetmenuItems, false); TileSetMenu.SetPostion(new Vector2(770, 100)); TileSetMenu.SelectedColor = Color.Yellow; TileSetMenu.HiliteColor = Color.White; #endregion //Nastaveni prvniho itemu u LayerMenu switch (LayerMenu.clickedIndex) { case 0: CurrentMap = Session.BackMap; CurrentLayer = Session.BackMap.mapLayers[0]; break; case 1: CurrentMap = Session.BackMap; CurrentLayer = Session.BackMap.mapLayers[1]; break; case 2: CurrentMap = Session.FrontMap; CurrentLayer = Session.FrontMap.mapLayers[0]; break; case 3: CurrentMap = Session.FrontMap; CurrentLayer = Session.FrontMap.mapLayers[1]; break; } //Nastaveni bazoveho policka pro akce CurrentTile = new Tile(0, 0, -1, -1); CurrentTileSet = Session.FrontMap.tilesets[CurrentTile.Tileset]; //Nacteni vstupnich ramecku pro obraz TileSetu int tiles = CurrentTileSet.TilesWide * CurrentTileSet.TilesHigh; sourceRectangles = new Rectangle[tiles]; float Scale = (float)ram.Width / (float)Session.FrontMap.tilesets[CurrentTile.Tileset].Texture.Width; int tile = 0; for (int y = 0; y < CurrentTileSet.TilesHigh; y++) for (int x = 0; x < CurrentTileSet.TilesWide; x++) { sourceRectangles[tile] = new Rectangle( (int)(x * CurrentTileSet.TileWidth * Scale), (int)(y * CurrentTileSet.TileWidth * Scale), (int)(CurrentTileSet.TileWidth * Scale), (int)(CurrentTileSet.TileHeight * Scale)); tile++; } base.LoadContent(); }
protected override void LoadContent() { //Vytvoreni pozadi background = new BackgroundComponent(GameRef, Content.Load<Texture2D>(@"Backgrounds\characterscreen"), DrawMode.Center); //Nahrani textur pro sipky a font SpriteFont spriteFont = Content.Load<SpriteFont>(@"Fonts\startFont"); Texture2D leftArrow = Content.Load<Texture2D>(@"Controls\leftarrow"); Texture2D rightArrow = Content.Load<Texture2D>(@"Controls\rightarrow"); //Nacteni obrazkuu pohlavi malePicture = Content.Load<Texture2D>(@"Pictures\male"); femalePicture = Content.Load<Texture2D>(@"Pictures\female"); //Inicializace pictureboxu picture = new PictureBox(malePicture, new Rectangle((GameRef.Window.ClientBounds.Width - 300) / 2, 150, 300, 300)); //Vyvoreni leftrightselectoru pro pohlavi genderSelector = new LeftRightSelector( spriteFont, leftArrow, rightArrow); genderSelector.SetItems(genderItems, 350); genderSelector.Position = new Vector2((GameRef.Window.ClientBounds.Width - genderSelector.Size.X) / 2, 500); genderSelector.HasFocus = true; //genderSelector.Size; Controls.Add(genderSelector); //Vytvoreni tlacitka pro potvrzeni vyberu LinkLabel linkLabel1 = new LinkLabel(spriteFont); linkLabel1.Text = "Vyber"; linkLabel1.Size = linkLabel1.SpriteFont.MeasureString(linkLabel1.Text); linkLabel1.Position = new Vector2((GameRef.Window.ClientBounds.Width - linkLabel1.Size.X) / 2, 650); Controls.Add(linkLabel1); //Pridani eventu pro vyber linkLabel1.Selected += new EventHandler(linkLabel1_Selected); Controls.selectedControl = 0; base.LoadContent(); }