private void UpdatePlayers(GameStateView gameStateView) { List <string> updatedPlayers = new List <string>(); foreach (Player player in gameStateView.Players) { if (!playerPictureBoxes.TryGetValue(player.PlayerId, out PictureBox pictureBox)) { pictureBox = CreatePlayerPictureBox(); InitializeDrawing(pictureBox); playerPictureBoxes.Add(player.PlayerId, pictureBox); } // Update labels for playing player if (player.PlayerId == this.Pid) { ScoreLabel.SetPropertyThreadSafe(() => ScoreLabel.Text, String.Format("Player {0} Score: {1}", Pid, player.Score.ToString())); if (!player.Alive) { GameStatusLabel.SetPropertyThreadSafe(() => GameStatusLabel.Text, "You are dead"); } } if (player.Alive) { if (pictureBox.Tag == null || ((Direction)pictureBox.Tag) != player.Direction) { Direction direction = pictureBox.Tag == null ? Direction.RIGHT : player.Direction; Bitmap updatedBitmap = DirectionToResource(direction); if (updatedBitmap != null) { pictureBox.Image = updatedBitmap; pictureBox.Tag = direction; } } pictureBox.Location = new Point(player.X, player.Y); } else { pictureBox.Visible = false; } updatedPlayers.Add(player.PlayerId); } // Remove removed players foreach (string playerId in playerPictureBoxes.Keys.Except(updatedPlayers).ToList()) { if (playerPictureBoxes.TryGetValue(playerId, out PictureBox pictureBox)) { this.Controls.Remove(pictureBox); playerPictureBoxes.Remove(playerId); } } }
void EnablePlayerInput() { LeftButton.SetActive(true); RightButton.SetActive(true); JumpButton.SetActive(true); ScoreLabel.SetActive(true); }
void DisablePlayerInput() { LeftButton.SetActive(false); RightButton.SetActive(false); JumpButton.SetActive(false); ScoreLabel.SetActive(false); }
/// <summary> /// Adds the score. /// </summary> /// <param name="_score">Score.</param> private void AddScore(int _score) { this.score += _score; ScoreLabel scr = PoolManager.Instance.GetAScoreLabel(); Vector2 vector = new Vector2(0, 3); scr.ShowAt(vector, _score); UpdateScoreLabel(); }
protected override void OnAppearing() { base.OnAppearing(); ScoreLabel.FadeTo(1, 500, Easing.CubicOut); CommentLabel.FadeTo(1, 500, Easing.CubicOut); ScoreLabel.TranslateTo(0, 0, 500, Easing.SpringOut); CommentLabel.TranslateTo(0, 0, 500, Easing.SpringOut); }
public void IncrementScore(ScoreLabel label, int incrementBy) { int difference = IncrementScore(incrementBy) - incrementBy; if (difference > 0) { label.UpdateText(incrementBy.ToString() + '+' + difference); } else { label.UpdateText(incrementBy.ToString()); } }
internal void UpdateScore(GameStateView gameStateView) { foreach (Player p in gameStateView.Players) { if (p.PlayerId == this.Pid) { this.score = p.Score; ScoreLabel.SetPropertyThreadSafe(() => ScoreLabel.Text, "Score: " + score.ToString()); //ScoreLabel.Text = "Player " + this.Pid + " Score: " + score.ToString(); } } }
/* * Animate the next path. NOTE: This method should not be run in a synchronous event handler; it is * meant to be called within a concurrent thread. */ private void VisualizePath() { // If there are no more paths to display if (NextPathIdx == AllPaths.Count) { PopupDialog popup = new PopupDialog( "No more words!", "You have entered all the words we've found on the grid.", this.Location, false); popup.ShowDialog(); return; } WordamentPath nextPath = AllPaths[NextPathIdx++]; WordLabel.Invoke(new EventHandler(delegate { WordLabel.Text = nextPath.Word; })); ScoreLabel.Invoke(new EventHandler(delegate { ScoreLabel.Text = nextPath.TotalScore.ToString(); })); CounterLabel.Invoke(new EventHandler(delegate { CounterLabel.Text = $"{NextPathIdx}/{AllPaths.Count}"; })); if (nextPath.Locations.Count == 1) { // If the path is one tile long, just put a stop image on it GridCell startingPt = nextPath.Locations[0]; PictureBox pic = TilePics[startingPt]; pic.Invoke(new EventHandler(delegate { pic.Image = TileImageTable.GetImage(ImageType.Stop); })); } else { // Select the starting tile image GridCell startingPt = nextPath.Locations[0]; PictureBox startPic = TilePics[startingPt]; startPic.Invoke(new EventHandler(delegate { startPic.Image = GetStartImage(startingPt, nextPath.Locations[1]); })); Thread.Sleep(ANIMATION_DELAY_MS); // Select each of the inner tile images for (int i = 1; i < nextPath.Locations.Count - 1; i++) { GridCell currentPt = nextPath.Locations[i]; PictureBox pic = TilePics[currentPt]; pic.Invoke(new EventHandler(delegate { pic.Image = GetPathImage(currentPt, nextPath.Locations[i + 1]); })); Thread.Sleep(ANIMATION_DELAY_MS); } // Put a stop image on the final tile GridCell lastPt = nextPath.Locations[nextPath.Locations.Count - 1]; PictureBox lastPic = TilePics[lastPt]; lastPic.Invoke(new EventHandler(delegate { lastPic.Image = TileImageTable.GetImage(ImageType.Stop); })); } }
// ACTIONS // private void GameClock_Tick(object sender, EventArgs e) { // Checks to see if player is in contact with an obstacle if (physics.inContact(player, ob, TopBar)) { GameOver(); return; } // Calculates new time score += (int)Math.Round(GameClock.Interval / 10.0); // Adds a new obstacle if necessary if (obstacleCounter == nextObstacle) { ob.Add(physics.addObstacle()); obstacleCounter = 0; RestartNextObstacle(); } // Moves the player int[] newPositions = physics.movePlayer(player); //int[] newPositions = Physics.move(player); player.Left = newPositions[0]; player.Top = newPositions[1]; // Clear vertical acceleration applied physics.AccelApplied[1] = 0; // Displays velocities and time ScoreLabel.Text = string.Format("Score: {0}", score.ToString("D8")); // Moves the obstacles across bottom of screen for (int i = ob.Count - 1; i > -1; i--) { if (ob[i].Right <= ClientRectangle.Left) { this.Controls.Remove(ob[i]); ob.RemoveAt(i); } else { ob[i].Left -= 5;// (5 + ((int)score / 1000)); } } obstacleCounter++; ScoreLabel.SendToBack(); HighScoreLabel.SendToBack(); }
void OnCollisionEnter(Collision col) { if (col.gameObject.tag != "Player") { return; } if (broken) { return; } broken = true; BreakUp(transform); ScoreLabel.AddScore(); }
public CrosswordView() { InitializeComponent(); ResetVariables(); NavigationPage.SetHasNavigationBar(this, false); // Grid Crossword mainGrid.Children.Add(GenerateCrosswordGrid(CrosswordViewModel.Instance().DisplayBoard), 1, 1); // Definition List _defList = GenerateDefinitionList(CrosswordViewModel.Instance().Definitions); definitionGrid.Children.Add(_defList, 0, 1); ScoreLabel.BindingContext = _score; ScoreLabel.SetBinding(Label.TextProperty, new Binding("Value", BindingMode.OneWay, new StringToIntConverter())); SizeChanged += OnSizeChanged; }
private void BindingInitialize() { Binding DifficultyBinding = new Binding("Difficulty") { Source = Host }; DifficultyLabel.SetBinding(Label.ContentProperty, DifficultyBinding); Binding LevelBinding = new Binding("Level") { Source = Host }; LevelLabel.SetBinding(Label.ContentProperty, LevelBinding); Binding ScoreBinding = new Binding("Score") { Source = Host }; ScoreLabel.SetBinding(Label.ContentProperty, ScoreBinding); ResultScore.SetBinding(Label.ContentProperty, ScoreBinding); Binding LevelupProgressBinding = new Binding("LevelupProgress") { Source = Host }; Binding LevelupMaximumBinding = new Binding("LevelupMaximum") { Source = Host }; LevelupProgressBar.SetBinding(ProgressBar.ValueProperty, LevelupProgressBinding); LevelupProgressBar.SetBinding(ProgressBar.MaximumProperty, LevelupMaximumBinding); Binding TotalClearRowsBinding = new Binding("TotalClearRows") { Source = Host }; ResultClearRows.SetBinding(Label.ContentProperty, TotalClearRowsBinding); }
void OnCollisionEnter(Collision col) { if (!col.gameObject.CompareTag("Player")) { return; } if (broken) { return; } broken = true; Destroy(gameObject); foreach (GameObject p in parts) { GameObject g = Instantiate(p, transform.position, transform.rotation, null); Destroy(g, Random.Range(5f, 15f)); } ScoreLabel.AddScore(); }
void ReleaseDesignerOutlets() { if (Monkey != null) { Monkey.Dispose(); Monkey = null; } if (ScoreLabel != null) { ScoreLabel.Dispose(); ScoreLabel = null; } if (TimerLabel != null) { TimerLabel.Dispose(); TimerLabel = null; } }
void ReleaseDesignerOutlets() { if (liveCameraStream != null) { liveCameraStream.Dispose(); liveCameraStream = null; } if (ProgressBar != null) { ProgressBar.Dispose(); ProgressBar = null; } if (SampleFace != null) { SampleFace.Dispose(); SampleFace = null; } if (ScoreLabel != null) { ScoreLabel.Dispose(); ScoreLabel = null; } if (SwitchCameraButton != null) { SwitchCameraButton.Dispose(); SwitchCameraButton = null; } if (TakePhotoButton != null) { TakePhotoButton.Dispose(); TakePhotoButton = null; } }
void ReleaseDesignerOutlets() { if (AnswerButton != null) { AnswerButton.Dispose(); AnswerButton = null; } if (CommentTextView != null) { CommentTextView.Dispose(); CommentTextView = null; } if (QuestionTextView != null) { QuestionTextView.Dispose(); QuestionTextView = null; } if (RoundLabel != null) { RoundLabel.Dispose(); RoundLabel = null; } if (ScoreLabel != null) { ScoreLabel.Dispose(); ScoreLabel = null; } if (StartNewGameButton != null) { StartNewGameButton.Dispose(); StartNewGameButton = null; } }
private static void DrawScreen() { //lock (ScreenManager.LockSection) //{ TitleLabel.draw(); BorderLine.draw(); ScoreLabel.draw(); NoRoomLabel.draw(); ExperienceLabel.draw(); GameLevelLabel.draw(); HealthLevelLabel.draw(); //Second Column HealthPotionLabel.draw(); RoomLabel.draw(); TotalGoldLabel.draw(); TotalSilverLabel.draw(); WeaponLabel.draw(); ArmourLabel.draw(); DrawLogo(); //} }
/// <summary> /// Gets AS core label. /// </summary> /// <returns>The AS core label.</returns> public ScoreLabel GetAScoreLabel() { ScoreLabel ret = null; for (int i = 0; i < this.scoreObjects.Count; i++) { PoolObject scoreLabelObject = this.scoreObjects[i]; if (!scoreLabelObject.IsUsed && scoreLabelObject.Type == PoolObject.ObjectType.ScoreLabel) { ret = (ScoreLabel)scoreLabelObject; break; } } if (ret == null) { PoolObject newObject = Instantiate(this.scoreLabelPrefab); newObject.Type = PoolObject.ObjectType.ScoreLabel; this.scoreObjects.Add(newObject); ret = (ScoreLabel)newObject; } ret.IsUsed = true; return(ret); }
protected override void LoadContent() { Texture2D spriteSheet = Game.Content.Load <Texture2D>(@"Images\player_placeholder"); Dictionary <AnimationKey, Animation> animations = new Dictionary <AnimationKey, Animation>(); Animation animation = new Animation(4, 32, 48, 0, 0); animations.Add(AnimationKey.Down, animation); animation = new Animation(4, 32, 48, 0, 48); animations.Add(AnimationKey.Left, animation); animation = new Animation(4, 32, 48, 0, 96); animations.Add(AnimationKey.Right, animation); animation = new Animation(4, 32, 48, 0, 144); animations.Add(AnimationKey.Up, animation); _sprite = new AnimatedSprite(spriteSheet, animations); base.LoadContent(); _scoreLabel = new ScoreLabel(); _scoreLabel.Position = new Vector2(780, 10); _scoreLabel.Text = "Score: 0"; _hud.LoadContent(this.GraphicsDevice); ControlManager.Add(_scoreLabel); if (Difficulty == 0) { Texture2D tilesetTexture = Game.Content.Load <Texture2D>(@"Tiles\tileset1"); _tileSet = new TileSet(tilesetTexture, 8, 8, 32, 32); MapLayer layer = new MapLayer(40, 40); for (int y = 0; y < layer.Height; y++) { for (int x = 0; x < layer.Width; x++) { Tile tile = new Tile(0, 0); layer.SetTile(x, y, tile); } } _map = new TileMap(_tileSet, layer); MapLayer splatter = new MapLayer(40, 40); Random random = new Random(); for (int i = 0; i < 80; i++) { int x = random.Next(0, 40); int y = random.Next(0, 40); int index = random.Next(2, 14); Tile tile = new Tile(index, 0); splatter.SetTile(x, y, tile); } _map.AddLayer(splatter); } else { Texture2D tilesetTexture = Game.Content.Load <Texture2D>(@"Tiles\scorchedtiles"); _tileSet = new TileSet(tilesetTexture, 1, 1, 32, 32); MapLayer layer = new MapLayer(40, 40); for (int y = 0; y < layer.Height; y++) { for (int x = 0; x < layer.Width; x++) { Tile tile = new Tile(0, 0); layer.SetTile(x, y, tile); } } _map = new TileMap(_tileSet, layer); } }
IEnumerator Animate(bool IsBestScore, int StarsToActivate) { MasterAudio.PlaySound("GameOver"); //Debug.LogError("Animate coroutine"); BG.DOFade(0.85f, 1); yield return(new WaitForSeconds(0.75f)); ADManager.Instance.TryShowInterstitial(); StarsBG.DOFade(1, 0.15f); StartCoroutine(AnimateStars(StarsToActivate)); GameOverText.DOFade(1, 0.5f); GameOverText.transform.DOPunchScale(new Vector3(0.85f, 0.85f, 0.85f), 0.85f); yield return(new WaitForSeconds(0.5f)); // public TextMeshProUGUI BestScoreTxt, ScoreTxt, SavedAliensTxt, StolenBriefcasesTxt, GameOverText; AlienIcon.DOFade(1, 0.35f); BriefcaseIcon.DOFade(1, 0.35f); yield return(new WaitForSeconds(0.15f)); SavedAliensTxt.DOFade(1, 0.35f); StolenBriefcasesTxt.DOFade(1, 0.35f); yield return(new WaitForSeconds(0.15f)); BestScoreLabel.DOFade(1, 0.25f); yield return(new WaitForSeconds(0.1f)); ScoreLabel.DOFade(1, 0.35f); yield return(new WaitForSeconds(0.1f)); BestScoreTxt.DOFade(1, 0.35f); yield return(new WaitForSeconds(0.1f)); ScoreTxt.DOFade(1, 0.35f); if (IsBestScore) { MasterAudio.PlaySound("NewBestScore"); NewBestScoreLabel.DOFade(1, 0.5f); NewBestScoreLabel.transform.DOPunchScale(new Vector3(0.85f, 0.85f, 0.85f), 0.85f); } List <int> LockedSkinsAfter = new List <int>(); LockedSkinsAfter.AddRange(SkinManager.Instance.SkinPrefabs.Where(s => GameUtils.IsSkinLocked(s)).Select(s => s.ID)); if (LockedSkinsAfter.Count < GameSceneManager.Instance.LockedSkinsBefore.Count) { CharsUnlockedTxt.DOFade(1, 0.35f); } yield return(new WaitForSeconds(0.3f)); PlayAgainBtn.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.InBounce); yield return(new WaitForSeconds(0.2f)); SettingsBtn.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.InBounce); yield return(new WaitForSeconds(0.2f)); MainMenuBtn.transform.DOScale(Vector3.one, 0.2f).SetEase(Ease.InBounce); yield return(new WaitForSeconds(0.2f)); foreach (Image b in HorizontalBars) { b.DOFade(0.5f, 1f); } }
protected override void OnRenderFrame(FrameEventArgs E) { base.OnRenderFrame(E); var Modelview = Matrix4.LookAt(Vector3.Zero, Vector3.UnitZ, Vector3.UnitY); GL.MatrixMode(MatrixMode.Modelview); GL.LoadMatrix(ref Modelview); RenderBackground(); var PipeMarginY = (ProjectionHeight - MapHeight * SolidSize) / 2f; var PipeMarginX = (NominalHeight - MapHeight * SolidSize) / 2f; var Overwidth = ProjectionWidth - ProjectionHeight * (float)NominalWidth / NominalHeight; if (Overwidth > 0) { GL.Translate(Math.Min(Overwidth, (ProjectionWidth - MapWidth * SolidSize) / 2f), PipeMarginY, 0); } else { GL.Translate(PipeMarginX, PipeMarginY, 0); } RenderPipe(); for (var X = 0; X < MapWidth; X++) { for (var Y = 0; Y < MapHeight; Y++) { if (Map[X, Y] >= 0) { RenderSolid(X, Y + ImpactFallOffset[X, Y], Map[X, Y]); } } } if (GameStateEnum.Fall == GameState) { for (var i = 0; i < StickLength; i++) { if (StickColors[i] >= 0) { RenderSolid(StickPosition.X + i, StickPosition.Y, StickColors[i]); } } } GL.Translate(MapWidth * SolidSize + PipeMarginX, 0, 0); NextStickLabel.Render(); GL.Translate(0, NextStickLabel.Height, 0); RenderNextStick(); GL.Translate(0, -NextStickLabel.Height, 0); GL.Translate(0, MapHeight * SolidSize / 4f, 0); if (GameStateEnum.GameOver == GameState) { GameOverLabel.Render(); GL.Translate(0, GameOverLabel.Height, 0); GameOverHint.Render(); GL.Translate(0, -GameOverLabel.Height, 0); } else if (Paused) { PauseLabel.Render(); GL.Translate(0, PauseLabel.Height, 0); UnpauseHint.Render(); GL.Translate(0, -PauseLabel.Height, 0); } else { PlayingGameLabel.Render(); GL.Translate(0, PlayingGameLabel.Height, 0); PauseHint.Render(); GL.Translate(0, -PlayingGameLabel.Height, 0); } GL.Translate(0, MapHeight * SolidSize / 4f, 0); ScoreLabel.Render(); GL.Translate(0, ScoreLabel.Height, 0); ScoreRenderer.Label = Score.ToString(); ScoreRenderer.Render(); GL.Translate(0, -ScoreLabel.Height, 0); GL.Translate(0, MapHeight * SolidSize / 4f, 0); HighScoreLabel.Render(); GL.Translate(0, HighScoreLabel.Height, 0); HighScoreRenderer.Label = HighScore.ToString(); HighScoreRenderer.Render(); SwapBuffers(); }
public static void UpdateScore(int val) { ScoreLableVal = val; ScoreLabel.textItem = ScoreLabelStr + ScoreLableVal; ScoreLabel.draw(); }
private void Awake() { _instance = this; }
void ReleaseDesignerOutlets() { if (ActiveItems_Label != null) { ActiveItems_Label.Dispose(); ActiveItems_Label = null; } if (CandyButton != null) { CandyButton.Dispose(); CandyButton = null; } if (Collected_Label != null) { Collected_Label.Dispose(); Collected_Label = null; } if (HelpLabel != null) { HelpLabel.Dispose(); HelpLabel = null; } if (HighScoreLabel != null) { HighScoreLabel.Dispose(); HighScoreLabel = null; } if (InfoButton != null) { InfoButton.Dispose(); InfoButton = null; } if (LevelLabel != null) { LevelLabel.Dispose(); LevelLabel = null; } if (LevelUpLabel != null) { LevelUpLabel.Dispose(); LevelUpLabel = null; } if (MainView != null) { MainView.Dispose(); MainView = null; } if (RestartButton != null) { RestartButton.Dispose(); RestartButton = null; } if (ScoreLabel != null) { ScoreLabel.Dispose(); ScoreLabel = null; } if (SettingsButton != null) { SettingsButton.Dispose(); SettingsButton = null; } }
private void Start() { sc = this; }