internal VerticalScalingButton(string texName1, string texName2, string texName3) { StartSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName1))); MiddleSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName2))); EndSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName3))); StartSprite.AnchorPoint = CCPoint.AnchorLowerLeft; MiddleSprite.AnchorPoint = CCPoint.AnchorLowerLeft; EndSprite.AnchorPoint = CCPoint.AnchorLowerLeft; UpdateSpritePlacement(); AddChild(StartSprite); AddChild(MiddleSprite); AddChild(EndSprite); AnchorPoint = CCPoint.AnchorMiddle; }
internal HorizontalScalingButton(string texName1, string texName2, string texName3) { StartSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName1))); MiddleSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName2))); EndSprite = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals(texName3))); StartSprite.AnchorPoint = CCPoint.AnchorLowerLeft; MiddleSprite.AnchorPoint = CCPoint.AnchorLowerLeft; EndSprite.AnchorPoint = CCPoint.AnchorLowerLeft; StartSprite.Scale = 1f; MiddleSprite.Scale = 1f; EndSprite.Scale = 1f; UpdateSpritePlacement(); AddChild(StartSprite); AddChild(MiddleSprite); AddChild(EndSprite); AnchorPoint = CCPoint.AnchorMiddle; Scale = Constants.STANDARD_SCALE; }
internal WreckageHint(string hint, bool arrowUp) { CCLabel label = new CCLabel(hint, "EarlyGameBoy", 12, CCLabelFormat.SpriteFont); GameObjectSprite arrow = new GameObjectSprite(UIElement.spriteSheet.Frames.Find(_ => _.TextureFilename.Equals("arrow.png"))); label.AnchorPoint = CCPoint.AnchorLowerLeft; label.IsAntialiased = false; label.Scale = 1f; arrow.AnchorPoint = CCPoint.AnchorMiddle; arrow.Scale = 2f; AddChild(label); AddChild(arrow); const float BORDER = 16f; float width = Math.Max(label.ScaledContentSize.Width, arrow.ScaledContentSize.Width); if (arrowUp) // up { arrow.MyRotation = -90f; arrow.Position = new CCPoint(width / 2, arrow.ScaledContentSize.Height / 2); label.Position = new CCPoint(0, arrow.ScaledContentSize.Height + BORDER); ContentSize = new CCSize(width, label.BoundingBoxTransformedToParent.MaxY); /* * label.Position = CCPoint.Zero; * arrow.Position = new CCPoint(label.ScaledContentSize.Width / 2, arrow.ScaledContentSize.Height / 2 + label.ScaledContentSize.Height + BORDER); * ContentSize = new CCSize(width, arrow.BoundingBoxTransformedToParent.MaxY); */ } else // down { arrow.MyRotation = 90f; arrow.Position = new CCPoint(width / 2, arrow.ScaledContentSize.Height / 2 + label.ScaledContentSize.Height + BORDER); label.Position = CCPoint.Zero; ContentSize = new CCSize(width, arrow.BoundingBoxTransformedToParent.MaxY); /* * label.Position = new CCPoint(0, arrow.ScaledContentSize.Height + BORDER); * arrow.Position = new CCPoint(label.ScaledContentSize.Width / 2, arrow.ScaledContentSize.Height / 2); * ContentSize = new CCSize(width, label.BoundingBoxTransformedToParent.MaxY); */ } }