public HighScoresScreen() : base(_menu) { _signPost = _menu.FindName("SignPost") as SignPost; _signPost.SignText = "Naar Home"; (_signPost.FindName("canvasSignpost") as Canvas).MouseLeftButtonDown += SignPost_MouseLeftButtonDown; }
private void ButtonRemoval(BuildingScript buttonRemoved, SignPost signPost) { for (int i = signPost.buildingList.Count - 1; i >= 0; i--) { if(signPost.buildingList[i] == buttonRemoved) { signPost.buildingList.RemoveAt(i); } } }
private void AnimalRemoved(SelectionScript selectionRemove, SignPost signpost) { for (int i = signpost.animalList.Count -1; i >= 0; i--) { if(signpost.animalList[i] == selectionRemove) { signpost.animalList.RemoveAt(i); } } }
public void Build() { Debug.Log($"Let's build the building: {buildingType}!"); // Construct prefab Building createdBuilding = Instantiate(myBuildingPrefab); createdBuilding.Rotation = myRotation; createdBuilding.UpdateRotationSprite(); this.world.AddBuilding(createdBuilding); foreach (BuildingSelectionSquare square in mySquares) { CodeTile curTile = square.TileUnderneath; // Both: curTile.ParentBuilding = createdBuilding; // Buildings: if (square.myType == BuildingSelectionSquare.Type.building) { curTile.UpdateTileType(CodeTile.Type.building); createdBuilding.TilesUnderneath.Add(curTile); } // Entrances: else { createdBuilding.Entrances.Add(curTile); if (createdBuilding.sign == null) { SignPost sign = CreateSignPost(square.TileUnderneath.posX, square.TileUnderneath.posY, myRotation); createdBuilding.sign = sign; //sign.transform.SetParent(createdBuilding.transform); } } } this.world.TileMapUpdate(); // Modify prefab: BuildingSelectionSquare bottomLeft = GetBottomLeftSquare(); createdBuilding.originX = this.originX + bottomLeft.relativeX; createdBuilding.originY = this.originY + bottomLeft.relativeY; // Play sound effect // Notification: world.notificationCanvas.AddNotification(Notification.Type.userAction, $"Successfully constructed {createdBuilding.Name}."); }
public EndScreen() : base(_menu) { txtScore = _menu.FindName("txtTotalPoints") as TextBlock; _highscores = _menu.FindName("imgHighscoresPressed") as Image; _highscores.MouseEnter += ImgMouseEnter; _highscores.MouseLeave += ImgMouseLeave; _highscores.MouseLeftButtonDown += ImgHighscoresClick; _signPost = _menu.FindName("SignPost") as SignPost; _signPost.SignText = "Naar Home"; (_signPost.FindName("canvasSignpost") as Canvas).MouseLeftButtonDown += SignPost_MouseLeftButtonDown; SetLoseScore(500); }
public ChooseSideScreen() : base(_menu) { Canvas npcMe = _menu.FindName("npcME") as Canvas; if (npcMe == null) { throw new NotImplementedException("MEer not implemented"); } ME me = new ME(); me.SetValue(Canvas.TopProperty, 140.0); me.SetValue(Canvas.LeftProperty, 60.0); npcMe.Children.Add(me); npcMe.MouseLeftButtonUp += ButtonMeMouseLeftButtonUp; npcMe.MouseEnter += ButtonMouseEnter; Canvas npcKraker = _menu.FindName("npcKraker") as Canvas; if (npcKraker == null) { throw new NotImplementedException("Kraker not implemented"); } Kraker kraker = new Kraker(); kraker.SetValue(Canvas.TopProperty, 200.0); kraker.SetValue(Canvas.LeftProperty, 100.0); npcKraker.Children.Add(kraker); npcKraker.MouseLeftButtonUp += ButtonKrakerMouseLeftButtonUp; npcKraker.MouseEnter += ButtonMouseEnter; // todo: implement kraker and remove the 3 lines below; kraker.Opacity = 0.5; npcKraker.Cursor = Cursors.Wait; ToolTipService.SetToolTip(npcKraker, "Kraker is momenteel in de huidige versie niet beschikbaar."); _signPost = _menu.FindName("SignPost") as SignPost; _signPost.SignText = "Naar Home"; (_signPost.FindName("canvasSignpost") as Canvas).MouseLeftButtonDown += SignPost_MouseLeftButtonDown; }
public SignPost CreateSignPost(int tileX, int tileY, Rotation rot) { SignPost prefab = this.world.decorationGenerator.signPostPrefab; SignPost sign = Instantiate(prefab); float adjustAmount = 0.25f; float baseX = tileX + 0.5f; float baseY = tileY + 0.5f; switch (rot) { case Rotation.none: sign.SetFacingDirection(SignPost.Facing.up); sign.SetPosition(new Vector2(baseX, baseY + adjustAmount)); break; case Rotation.oneClock: sign.SetFacingDirection(SignPost.Facing.left); sign.SetPosition(new Vector2(baseX - adjustAmount, baseY)); break; case Rotation.twoClock: sign.SetFacingDirection(SignPost.Facing.down); sign.SetPosition(new Vector2(baseX, baseY - adjustAmount)); break; case Rotation.threeClock: sign.SetFacingDirection(SignPost.Facing.right); sign.SetPosition(new Vector2(baseX + adjustAmount, baseY)); break; default: sign.SetFacingDirection(SignPost.Facing.up); sign.SetPosition(new Vector2(baseX, baseY)); break; } return(sign); }
public HelpScreen() : base(_menu) { Controls.Add(new HelpControlHolder { Name = "Q", Key = Key.Q, KeyName = "Shuffle Weapon Down", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/q.png", GridCol = 0, GridRow = 0 }); Controls.Add(new HelpControlHolder { Name = "W", Key = Key.W, KeyName = "Jump", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/w.png", GridCol = 1, GridRow = 0 }); Controls.Add(new HelpControlHolder { Name = "E", Key = Key.E, KeyName = "Shuffle Weapon Up", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/e.png", GridCol = 2, GridRow = 0 }); Controls.Add(new HelpControlHolder { Name = "A", Key = Key.A, KeyName = "Move to Left", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/a.png", GridCol = 0, GridRow = 1 }); Controls.Add(new HelpControlHolder { Name = "D", Key = Key.D, KeyName = "Move to Right", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/d.png", GridCol = 2, GridRow = 1 }); Controls.Add(new HelpControlHolder { Name = "Left", Key = Key.Left, KeyName = "Aim Weapon to Left", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/left.png", GridCol = 0, GridRow = 3 }); Controls.Add(new HelpControlHolder { Name = "Up", Key = Key.Up, KeyName = "Shuffle Weapon Up", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/up.png", GridCol = 1, GridRow = 2 }); Controls.Add(new HelpControlHolder { Name = "Right", Key = Key.Right, KeyName = "Aim Weapon to Right", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/right.png", GridCol = 2, GridRow = 3 }); Controls.Add(new HelpControlHolder { Name = "Down", Key = Key.Down, KeyName = "Shuffle Weapon Down", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/down.png", GridCol = 1, GridRow = 3 }); Controls.Add(new HelpControlHolder { Name = "Control", Key = Key.Ctrl, KeyName = "Jump", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/control.png", GridCol = 0, GridRow = 4 }); Controls.Add(new HelpControlHolder { Name = "Space", Key = Key.Space, KeyName = "Shoot Weapon", ImgString = @"/ResourceFramework;component/Images/Buttons/Control/space.png", GridCol = 1, GridRow = 4, Width = 350, Height = 100, GridColWidth = 3 }); _bulletEngine = new BulletEngine(new Canvas()); _meer = new ME { Name = "testMEer", Position = new Point(800, 650) }; _meer.WeaponEngine.SetBulletEngine(_bulletEngine); _btnResource = _menu.Resources.MergedDictionaries[0]; _cnvsMe = _menu.FindName("cnvsMe") as Canvas; if (_cnvsMe == null) { throw new NotImplementedException("ME not implemented"); } _cnvsMe.Children.Add(_bulletEngine.Container); _cnvsMe.Children.Add(_meer); _txtKeyName = _menu.FindName("txtKeyName") as TextBlock; if (_txtKeyName == null) { throw new NotImplementedException("txtKeyName not implemented"); } _btnGrid = _menu.FindName("btnGrid") as Grid; if (_btnGrid == null) { throw new NotImplementedException("btnGrid not implemented"); } CreateButtons(); _signPost = _menu.FindName("SignPost") as SignPost; if (_signPost == null) { throw new NotImplementedException("SignPost not implemented"); } _signPost.SignText = "Naar Home"; (_signPost.FindName("canvasSignpost") as Canvas).MouseLeftButtonDown += SignPostMouseLeftButtonDown; Updated += HelpScreenUpdated; Shown += HelpScreenShown; }