public ScorePanel( ICrystallonEntity pEntity, int pPoints ) { InitializeWidget(); ScoreLabel = new Sce.PlayStation.HighLevel.GameEngine2D.Label() { Text = pPoints.ToString() }; var font = new Font("Application/assets/fonts/Bariol_Regular.otf", 25, FontStyle.Regular); var map = new FontMap(font); ScoreLabel.FontMap = map; ScoreLabel.Position = new Vector2(-4.0f, 10.0f); ScoreLabel.Color = Colors.White; ScoreLabel.HeightScale = 1.0f; ScoreLabel.Pivot = new Vector2(0.5f, 0.5f); Sequence sequence = new Sequence(); sequence.Add( new DelayTime( 0.5f ) ); sequence.Add ( new CallFunc( () => { pEntity.getNode().Parent.AddChild(ScoreLabel); } ) ); // ScoreText.Font = FontManager.Instance.Get ("Bariol", 20, "Bold"); // ScoreText.Text = pPoints.ToString(); // ScoreText.Alpha = 0.0f; // _scoreTexture = new Texture2D((int)ScoreText.Width, (int)ScoreText.Height, false, PixelFormat.Rgba); // ScoreText.RenderToTexture(_scoreTexture); // _scoreTextureInfo = new TextureInfo(_scoreTexture); // _scoreSprite = new SpriteUV(_scoreTextureInfo); // _scoreSprite.Pivot = new Vector2(0.5f, 0.5f); // pEntity.getNode().AddChild(_scoreSprite); // _scoreSprite.Position = new Vector2(0.0f, 20.0f); // Vector2 v = ConvertScreenToLocal( pPosition ); // this.SetPosition( v.X - ScoreText.Width/2, Director.Instance.GL.Context.GetViewport().Height - (v.Y + 40) ); // Sequence sequence = new Sequence(); // sequence.Add( new DelayTime( 3.0f ) ); // sequence.Add ( new CallFunc( () => { // ScoreText.Visible = false; // this.Dispose(); // } ) ); Director.Instance.CurrentScene.RunAction(sequence); }
public void RemoveChildEntity( ICrystallonEntity pEntity, bool doCleanup ) { _allEntites.Remove( pEntity ); pEntity.Parent.RemoveChild( pEntity.getNode(), doCleanup ); }
// METHODS ------------------------------------------------------------------------------------------------- /// <summary> /// Adds an entity to the specified layer. 0 = Background. 1 = Gameplay. 2 = Foreground. Defaults to 1. /// </summary> /// <param name='pEntity'> /// entity. /// </param> /// <param name='pLayerIndex'> /// layer index. /// </param> public void AddChildEntity( ICrystallonEntity pEntity, int pLayerIndex=1 ) { if (_allEntites.Contains(pEntity) == false) { _allEntites.Add(pEntity); } Layers[pLayerIndex].AddChild(pEntity.getNode()); }