public EditLocationsGuiSet(Game _game, UserInput _keyboard, EditorLevel _editor) : base(_game, _keyboard, _editor) { exitButton = NewButton("Back", 0, Exit); label = NewLabel("Add:", 8); addBoxButton = NewButton("Box", 7, () => AddBox("box"+(locationCount++))); addPointButton = NewButton("Point", 6, () => AddPoint("point"+(locationCount++))); setEndLocationButton = NewButton("End zone", 10, () => AddBox(endzone)); setStartLocationButton = NewButton("StartPoint", 11, () => AddPoint(startpoint)); deleteButton = NewButton("Delete", 4, Delete); locationLabel = NewTextBox("Location label", "", 2); BoxDescription endzoneDesc = m_editor.Map.locationData.end; if (endzoneDesc != null && endzoneDesc.box != null) { makeBox(endzoneDesc.name, endzoneDesc.box); } PointDescription startpointDesc = m_editor.Map.locationData.start; if (startpointDesc != null && startpointDesc.point != null) { makePoint(startpointDesc.name, startpointDesc.point); } boxes2boxes.Clear(); foreach (BoxDescription box in m_editor.Map.locationData.boxes) { var rBox = makeBox(box.name, box.box); boxes2boxes.Add(rBox, box); } points2points.Clear(); foreach (PointDescription point in m_editor.Map.locationData.points) { var mPoint = makePoint(point.name, point.point); points2points.Add(mPoint, point); } }
public override Event MakeReal(Screen level) { Text gText = new Text(textAndPos.text); gText.Position = textAndPos.pos; if (hud) gText.SetHUD(level.Game.Camera); return new TextEvent(trigger.MakeReal(level), gText, level.House); }
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message) { base.Setup(_game, _keyboard, _message); Sprite title = new Sprite(new Bitmap("pictures/title.png")); title.Position = new Vector2f(); title.Size = new Vector2f(Game.Width, Game.Height); m_house.AddDrawable(title); Text text = new Text("[Click] or Press [Space] to Start"); text.CentreOn(new Vector2f(Game.Width/2, Game.Height/5)); m_house.AddDrawable(text); fx_buffer = new Effect( new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.Width, Game.Height)) { CaptureLayer = Layer.Normal, Layer = Layer.FX, Priority = Priority.Front }; fx_buffer.SetHUD(_game.Camera); fx_buffer.SetFading(0.5f, new Colour(0,0,0,1), new Colour(0,0,0,0)); m_house.AddDrawable(fx_buffer); m_house.AddUpdateable(fx_buffer); }
public TextBox(UserInput input, Vector2f size, Camera camera) : base(input, size, camera) { Contents = new Text(""); if (camera != null) Contents.SetHUD(camera); m_keyboard.KeyDown += AddLetter; }
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message) { base.Setup(_game, _keyboard, _message); TileMap tilemap = new TileMap("pictures/targetlevel.png"); m_house = new ObjectHouse(tilemap); StarryBackground bg = new StarryBackground(tilemap.Size); m_house.AddDrawable(bg); gangsterNo1 = new Hero(m_keyboard, m_house); gangsterNo1.Position = new Vector2f(1f, 10f); gangsterNo1.PlaceInWorld(tilemap); m_house.AddDrawable(gangsterNo1); m_house.AddUpdateable(gangsterNo1); m_game.SetCameraSubject(gangsterNo1); tilemap.Create(m_house, _game); Text score = new Text("Left: 00"); score.updateAction = (_d) => { score.Contents = "Left: " + m_house.GetAllDrawable<Target>().Count().ToString("00"); }; score.SetHUD(_game.Camera); score.TopRight(); m_house.AddUpdateable(score); m_house.AddDrawable(score); Text time = new Text("Time: 00:00"); time.SetHUD(_game.Camera); time.TopLeft(); timePassed = 0; time.updateAction = (_d) => { timePassed += _d; time.Contents = "Time: " + timePassed.ToString("00.00").Replace(".",":"); }; m_house.AddUpdateable(time); m_house.AddDrawable(time); }
public TextEvent(Trigger trigger, Text text, ObjectHouse house) : base(trigger) { m_text = text; m_house = house; }
public void SetLabel(string text) { label = new Text(text); label.PointSize = (int)Text.PointSizes.Sixteen; label.Position = Position.Clone(); label.Position.Y += Size.Y; }
public void SetLabel(Text label) { m_label = label; }
public override void Setup(Game _game, UserInput _keyboard, ScreenMessage _message) { base.Setup(_game, _keyboard, _message); deathTimer = 0; startTimer = 0; winTimer = 0; m_tilemap = new TileMap(levelFile); m_size = new Vector2i(m_tilemap.Width, m_tilemap.Height); Bounds.Right = m_size.X; Bounds.Top = m_size.Y; m_house = new ObjectHouse(m_tilemap); StarryBackground bg = new StarryBackground(m_tilemap.Size); bg.Layer = Layer.Pixelly; m_house.AddDrawable(bg); gangsterNo1 = new Hero(m_keyboard, m_house); gangsterNo1.Position = m_tilemap.locationData.start.point; gangsterNo1.PlaceInWorld(m_tilemap); m_house.AddDrawable(gangsterNo1); m_house.AddUpdateable(gangsterNo1); m_house.Add<IShootable>(gangsterNo1); m_game.SetCameraSubject(gangsterNo1); m_tilemap.Create(m_house, _game); m_house.AddDrawable(m_tilemap); m_tilemap.Priority = Priority.Middle; endzone = m_tilemap.locationData.end.box; // fx // pixelly pixellyEffect = new Effect( new Vector2i(Game.SmallScreenWidth/2, Game.SmallScreenHeight/2), new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.Width, Game.Height)){ CaptureLayer = Layer.Pixelly, Layer = Layer.FX, Priority = Priority.Back, Scaling = Sprite.ScaleType.Pixelly }; pixellyEffect.SetHUD(_game.Camera); m_house.AddDrawable(pixellyEffect); m_house.AddUpdateable(pixellyEffect); m_house.Add<IGrabing>(pixellyEffect); // fading fadingEffect = new Effect( new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.ScreenWidth, Game.ScreenHeight), new Vector2i(Game.Width, Game.Height)){ CaptureLayer = Layer.Blurry | Layer.Pixelly | Layer.Normal | Layer.FX, Layer = Layer.Fade, Priority = Priority.Front }; fadingEffect.SetHUD(_game.Camera); fadingEffect.SetFading(1f, new Colour(0,0,0,1), new Colour(0,0,0,0)); fadingEffect.SetBackground(new Colour(0,0,0,1f)); m_house.AddDrawable(fadingEffect); m_house.AddUpdateable(fadingEffect); m_house.Add<IGrabing>(fadingEffect); // messages welcome_message = new Text("Welcome to the Magnum House..."); welcome_message.SetHUD(m_game.Camera); welcome_message.CentreOn(Game.Size.ToF()/2); welcome_message.Priority = Priority.Front; welcome_message.Layer = Layer.Normal; welcome_message.Transparency = 0f; m_house.AddDrawable(welcome_message); }
protected TextBox NewTextBox(string label, string text, int pos) { Text textLabel = new Text(label); textLabel.SetHUD(m_game.Camera); textLabel.Position = new Vector2f(1, pos*2+3); textItems.Add(textLabel); TextBox textBox = new TextBox(m_keyboard, new Vector2f(10, 2), m_game.Camera); textBox.Position = new Vector2f(1, pos*2+1); textBox.Pressed += () => {buttonClicked = true;}; textBox.SetLabel(textLabel); textBox.Text = text; items.Add(textBox); return textBox; }
protected Text NewLabel(string text, int pos) { Text label = new Text(text); label.SetHUD(m_game.Camera); label.Position = new Vector2f(1, pos*2+1); textItems.Add(label); return label; }