public override void Draw() { //Get the asset size so the lights can be spaced nicely Vector2 assetSize = UnlitLight.WidthHeightToVector2(); //Go through all the lights for (int i = 0; i < ActionCmd.MaxLights; i++) { Vector2 newpos = StartPos; float baseScale = .5f; float newScale = baseScale; //Check if the last light should be big and enlarge it and offset it if so if (LastLightBig == true && i == (ActionCmd.MaxLights - 1)) { newpos += new Vector2(assetSize.X * (baseScale / 2f), -assetSize.Y * (baseScale / 2f)); newScale = 1f; } newpos += new Vector2((i * (baseScale * assetSize.X)) + (i * (DistBetweenLights * baseScale)), 0); CroppedTexture2D light = (i >= ActionCmd.LightsFilled) ? UnlitLight : LitLight; SpriteRenderer.Instance.DrawUI(light.Tex, newpos, light.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), newScale, false, false, .7f); } }
public void DrawLights(Vector2 startPos, float distBetweenLights, bool lastLightBig) { //Make sure this distance is always positive distBetweenLights = Math.Abs(distBetweenLights); //Get the asset size so the lights can be spaced nicely Vector2 assetSize = UnlitLight.WidthHeightToVector2(); //Go through all the lights for (int i = 0; i < MaxLights; i++) { Vector2 newpos = startPos; float baseScale = .5f; float newScale = baseScale; //Check if the last light should be big and enlarge it and offset it if so if (lastLightBig == true && i == (MaxLights - 1)) { newpos += new Vector2(assetSize.X * (baseScale / 2f), -assetSize.Y * (baseScale / 2f)); newScale = 1f; } newpos += new Vector2((i * (baseScale * assetSize.X)) + (i * (distBetweenLights * baseScale)), 0); CroppedTexture2D light = (i >= LightsFilled) ? UnlitLight : LitLight; SpriteRenderer.Instance.DrawUI(light.Tex, newpos, light.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), newScale, false, false, .7f); } }
public BombSquadActionCommandUI(BombSquadCommand bombSquadCommand) : base(bombSquadCommand) { Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.UIRoot}/Battle/BattleGFX.png"); CroppedTexture2D croppedTex2D = new CroppedTexture2D(battleGFX, new Rectangle(14, 273, 46, 46)); Cursor = new UIFourPiecedTex(croppedTex2D, croppedTex2D.WidthHeightToVector2(), .5f, Color.White); }
private void Initialize() { //Add all existing entities BManager.GetAllBattleEntities(NoHPEntities, null); CheckShowEntityHP(); Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"); HPBar = new CroppedTexture2D(battleGFX, new Rectangle(513, 275, 38, 13)); HPBarFill = new CroppedTexture2D(battleGFX, new Rectangle(516, 292, 1, 8)); HPTextOffset = HPBar.WidthHeightToVector2(); }
public PowerLiftActionCommandUI(PowerLiftCommand powerLiftCommand) : base(powerLiftCommand) { Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.UIRoot}/Battle/BattleGFX.png"); BigCursor = new CroppedTexture2D(battleGFX, new Rectangle(14, 273, 46, 46)); SmallCursor = new CroppedTexture2D(battleGFX, new Rectangle(10, 330, 13, 12)); ArrowIcon = new CroppedTexture2D(battleGFX, new Rectangle(5, 353, 50, 61)); BarEdge = new CroppedTexture2D(battleGFX, new Rectangle(514, 245, 7, 28)); Bar = new CroppedTexture2D(battleGFX, new Rectangle(530, 245, 1, 28)); BarFill = new CroppedTexture2D(battleGFX, new Rectangle(541, 255, 1, 1)); Cursor = new UIFourPiecedTex(BigCursor, BigCursor.WidthHeightToVector2(), .6f, CursorColor); SetUpGrid(); InitIconGraphics(); }
public override void StartInput(params object[] values) { base.StartInput(values); StartPosition = Camera.Instance.SpriteToUIPos((Vector2)values[0]); NumBombsThrown = 0; ElapsedTime = 0d; LastBombThrowTime = ElapsedTime + AutomaticThrowTime; CursorAngle = MinCursorAngle; Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.UIRoot}/Battle/BattleGFX.png"); CroppedTexture2D croppedTex2D = new CroppedTexture2D(battleGFX, new Rectangle(14, 273, 46, 46)); Cursor = new UIFourPiecedTex(croppedTex2D, croppedTex2D.WidthHeightToVector2(), .5f, Color.White); Cursor.Position = UtilityGlobals.GetPointAroundCircle(new Circle(StartPosition, CircleRadius), CursorAngle, true); }
private void Initialize() { //Define the UI to display Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"); CroppedTexture2D croppedTex2D = new CroppedTexture2D(battleGFX, new Rectangle(14, 273, 46, 46)); Cursor = new UIFourPiecedTex(croppedTex2D, croppedTex2D.WidthHeightToVector2(), .5f, Color.White); MarioHPIcon = new UICroppedTexture2D(new CroppedTexture2D(AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.UIRoot}/Battle/BattleHUD.png"), new Rectangle(2, 38, 45, 41))); FPIcon = new UICroppedTexture2D(new CroppedTexture2D(battleGFX, new Rectangle(179, 416, 40, 39))); MarioHPText = new UIText("0", Color.White); FPText = new UIText("0", Color.Black); //Set UI properties MarioHPIcon.Position = MarioHPText.Position = ActionCmd.StartPosition + new Vector2(-10, -45); FPIcon.Position = FPText.Position = ActionCmd.StartPosition + new Vector2(-45, -95); MarioHPText.Position += new Vector2(0f, 10f); FPText.Position += new Vector2(0f, 10f); if (ShowPartnerInfo == true) { PartnerHPIcon = new UICroppedTexture2D(new CroppedTexture2D(battleGFX, new Rectangle(324, 407, 61, 58))); PartnerHPText = new UIText("0", Color.White); PartnerHPIcon.Position = PartnerHPText.Position = ActionCmd.StartPosition + new Vector2(-80, -45); PartnerHPText.Position += new Vector2(0f, 10f); PartnerHPIcon.Origin = PartnerHPText.Origin = new Vector2(.5f, .5f); PartnerHPIcon.Depth = .6f; PartnerHPText.Depth = .61f; } MarioHPIcon.Depth = FPIcon.Depth = .6f; MarioHPText.Depth = FPText.Depth = .61f; MarioHPIcon.Origin = FPIcon.Origin = MarioHPText.Origin = FPText.Origin = new Vector2(.5f, .5f); //Set cursor position Cursor.Position = UtilityGlobals.GetPointAroundCircle(new Circle(ActionCmd.StartPosition, ActionCmd.CircleRadius), ActionCmd.CursorAngle, true); }
public ShellBreakAnimObj(Vector2 position, double animDuration, float maxRotationVal, double rotationTime) { Position = position; AnimDuration = animDuration; MaxRotation = maxRotationVal; RotationTime = rotationTime; //Load the halves Texture2D shellSheet = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.SpriteRoot}/Neutral/ShellShieldShell.png"); ShellLeftHalf = new CroppedTexture2D(shellSheet, new Rectangle(7, 298, 108, 129)); ShellRightHalf = new CroppedTexture2D(shellSheet, new Rectangle(117, 298, 94, 128)); //Calculate the position offsets for the shell halves //They're not the same size, with the left half being larger than the right half Vector2 leftHalfSize = ShellLeftHalf.WidthHeightToVector2(); LeftHalfPosOffset = new Vector2(0f, leftHalfSize.Y / 2); RightHalfPosOffset = new Vector2(leftHalfSize.X - (Math.Abs(ShellRightHalf.SourceRect.Value.Width - leftHalfSize.X)), LeftHalfPosOffset.Y); }
private void SetUpGrid() { //Create the grid PowerLiftGrid = new UIGrid(ActionCmd.NumColumns, ActionCmd.NumRows, ActionCmd.LiftGridCellSize); //Populate the grid based on how many columns and rows it has int totalSize = PowerLiftGrid.MaxElementsInGrid; for (int i = 0; i < totalSize; i++) { //Small cursors are on the grid PowerLiftGrid.AddGridElement(new UIFourPiecedTex(SmallCursor.Copy(), SmallCursor.WidthHeightToVector2(), .5f, Color.White)); } //Although the grid is drawn on the UI layer, we center it using the sprite layer's (0, 0) position for ease PowerLiftGrid.Position = Camera.Instance.SpriteToUIPos(Vector2.Zero); PowerLiftGrid.ChangeGridPivot(UIGrid.GridPivots.Center); Vector2 paddingSize = ActionCmd.LiftGridCellSize / 2; PowerLiftGrid.ChangeGridPadding(0, (int)paddingSize.X, 0, (int)paddingSize.Y); PowerLiftGrid.Spacing = ActionCmd.LiftGridSpacing; }
protected override void OnDraw() { base.OnDraw(); string text = "NO!"; Color color = Color.Red; if (AllLightsFilled) { text = "OKAY!"; color = Color.Green; } SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, text, new Vector2(300, 100), color, .7f); Vector2 startPos = new Vector2(250, 180); Vector2 barStartPos = startPos + new Vector2(-30, 0f); Vector2 barScale = new Vector2(130, 1f); //Draw the bar SpriteRenderer.Instance.DrawUI(LightBarEnd.Tex, barStartPos, LightBarEnd.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), Vector2.One, false, false, .69f); SpriteRenderer.Instance.DrawUI(LightBarMiddle.Tex, barStartPos + new Vector2((int)(LightBarEnd.WidthHeightToVector2().X / 2), 0f), LightBarMiddle.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), barScale, false, false, .69f); SpriteRenderer.Instance.DrawUI(LightBarEnd.Tex, barStartPos + new Vector2(barScale.X + (int)(LightBarEnd.WidthHeightToVector2().X - 1), 0f), LightBarEnd.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), Vector2.One, true, false, .69f); //Draw the lights DrawLights(startPos, 0, true); }
public override void StartInput(params object[] values) { base.StartInput(values); ElapsedTime = 0d; PrevThrow = 0d; StartPosition = Camera.Instance.SpriteToUIPos((Vector2)values[0]); //Count how many BattleEntities are affected //If there's only one, then don't add any of the Partner information int entitiesAffected = (int)values[1]; CursorAngle = MinCursorAngle; //Define the UI to display Texture2D battleGFX = AssetManager.Instance.LoadRawTexture2D($"{ContentGlobals.BattleGFX}.png"); CroppedTexture2D croppedTex2D = new CroppedTexture2D(battleGFX, new Rectangle(14, 273, 46, 46)); Cursor = new UIFourPiecedTex(croppedTex2D, croppedTex2D.WidthHeightToVector2(), .5f, Color.White); MarioHPIcon = new UICroppedTexture2D(new CroppedTexture2D(battleGFX, new Rectangle(324, 407, 61, 58))); FPIcon = new UICroppedTexture2D(new CroppedTexture2D(battleGFX, new Rectangle(179, 416, 40, 39))); MarioHPText = new UIText("0", Color.Black); FPText = new UIText("0", Color.Black); //Set UI properties MarioHPIcon.Position = MarioHPText.Position = StartPosition + new Vector2(-10, -45); FPIcon.Position = FPText.Position = StartPosition + new Vector2(-45, -95); MarioHPText.Position += new Vector2(0f, 10f); FPText.Position += new Vector2(0f, 10f); if (entitiesAffected > 1) { PartnerHPIcon = new UICroppedTexture2D(new CroppedTexture2D(battleGFX, new Rectangle(324, 407, 61, 58))); PartnerHPText = new UIText("0", Color.Black); PartnerHPIcon.Position = PartnerHPText.Position = StartPosition + new Vector2(-80, -45); PartnerHPText.Position += new Vector2(0f, 10f); PartnerHPIcon.Origin = PartnerHPText.Origin = new Vector2(.5f, .5f); PartnerHPIcon.Depth = .6f; PartnerHPText.Depth = .61f; } MarioHPIcon.Depth = FPIcon.Depth = .6f; MarioHPText.Depth = FPText.Depth = .61f; MarioHPIcon.Origin = FPIcon.Origin = MarioHPText.Origin = FPText.Origin = new Vector2(.5f, .5f); //Set cursor position Cursor.Position = UtilityGlobals.GetPointAroundCircle(new Circle(StartPosition, CircleRadius), CursorAngle, true); //Define the spawner Vector2 startPos = new Vector2(500, 15); Vector2 endPos = new Vector2(startPos.X, BattleManager.Instance.PartnerPos.Y + 350f); RestoreTypes[] restoreTypes = null; int[] restoreTypeCounts = null; if (entitiesAffected <= 1) { restoreTypes = new RestoreTypes[] { RestoreTypes.MarioHP, RestoreTypes.FP, RestoreTypes.PoisonMushroom }; restoreTypeCounts = new int[] { 14, 6, 2 }; } else { restoreTypes = new RestoreTypes[] { RestoreTypes.MarioHP, RestoreTypes.PartnerHP, RestoreTypes.FP, RestoreTypes.PoisonMushroom }; restoreTypeCounts = new int[] { 7, 7, 6, 2 }; } IconSpawner = new SweetTreatElementSpawner(4, 40f, 5000d, 750d, startPos, endPos, restoreTypes, restoreTypeCounts); //Add the cursor and other UI elements BattleUIManager.Instance.AddUIElement(Cursor); BattleUIManager.Instance.AddUIElement(MarioHPIcon); BattleUIManager.Instance.AddUIElement(FPIcon); BattleUIManager.Instance.AddUIElement(MarioHPText); BattleUIManager.Instance.AddUIElement(FPText); if (entitiesAffected > 1) { BattleUIManager.Instance.AddUIElement(PartnerHPIcon); BattleUIManager.Instance.AddUIElement(PartnerHPText); } HealingResponse = default(SweetTreatResponse); }
public override void Draw() { if (ActionCmd.AcceptingInput == false) { return; } string text = "NO!"; Color color = Color.Red; if (ActionCmd.AllLightsFilled == true) { text = "OKAY!"; color = Color.Green; } SpriteRenderer.Instance.DrawUIText(AssetManager.Instance.TTYDFont, text, new Vector2(300, 150), color, .7f); Vector2 startPos = new Vector2(250, 230); Vector2 barStartPos = startPos + new Vector2(-30, 0f); Vector2 barScale = new Vector2(130, 1f); //Draw the bar SpriteRenderer.Instance.DrawUI(LightBarEnd.Tex, barStartPos, LightBarEnd.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), Vector2.One, false, false, .69f); SpriteRenderer.Instance.DrawUI(LightBarMiddle.Tex, barStartPos + new Vector2((int)(LightBarEnd.WidthHeightToVector2().X / 2), 0f), LightBarMiddle.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), barScale, false, false, .69f); SpriteRenderer.Instance.DrawUI(LightBarEnd.Tex, barStartPos + new Vector2(barScale.X + (int)(LightBarEnd.WidthHeightToVector2().X - 1), 0f), LightBarEnd.SourceRect, Color.White, 0f, new Vector2(.5f, .5f), Vector2.One, true, false, .69f); base.Draw(); }