public BoundingBox2 AppendTextBlock(TextBlock monBlock) { MonitorOption opt; SpriteBuilder mk = new SpriteBuilder(Surface, Cursor, Scale, FrameCount) { Color = Color, BGColor = BGColor }; BoxStyle style = new BoxStyle(); if (monBlock.Options.TryGetValue("scale", out opt)) { mk.Scale = opt.FloatValue; } if (monBlock.Options.TryGetValue("padding", out opt)) { style.Padding = opt.FloatValue; } if (monBlock.Options.TryGetValue("color", out opt)) { mk.Color = opt.ColorValue; } if (monBlock.Options.TryGetValue("bgcolor", out opt)) { mk.BGColor = opt.ColorValue; } mk.TextBox(style, monBlock.Text); Sprites.AddRange(mk.Sprites); Cursor.Y += mk.Box.Height; return(mk.Box); }
internal pChannelTabCollection(SpriteManager spriteManager, int tabsWide, Vector2 bottomLeft, float baseDepth, bool skinnable, Color colour) : base(spriteManager, tabsWide, bottomLeft, baseDepth, skinnable, colour) { Vector2 position = new Vector2(bottomLeft.X + (Tabs.Count % MaxTabsWide) * 74 + (Tabs.Count / MaxTabsWide) * 10, bottomLeft.Y + 6 - (14 * (1 + Tabs.Count / MaxTabsWide))); pTabAdd = new pTabAdd(position, 1, false, false); pTabAdd.OnClick += pTabAdd_OnClick; Sprites.AddRange(pTabAdd.SpriteCollection); spriteManager.Add(pTabAdd.SpriteCollection); Tabs.Insert(0, pTabAdd); }
// ---- public BoundingBox2 AppendBlockIcon(SpriteBuilder maker, BoxStyle style, IMonitorBlock monitorBlock, MonitorInfo info) { BoundingBox2 box = new BoundingBox2(Cursor, Cursor); SpriteBuilder sb = new SpriteBuilder(maker); InfoItem item; if (info.TryGetValue("block", out item)) { CommonInfo commonInfo = item as CommonInfo; string icon = ""; if (commonInfo.IsBeingHacked) { if ((FrameCount % 1.0f) < 0.5f) { icon = SpriteId.Danger; } else { icon = SpriteId.Cross; } } else if (!commonInfo.IsFunctional) { icon = SpriteId.Cross; } //else if (!info.BlockInfo.IsEnabled) // icon = SpriteId.Construction; else if (!commonInfo.IsWorking) { icon = SpriteId.Danger; } if (icon != "") { sb.SpriteBox(style, icon); //box = maker.SpriteBox(Sprites, style, icon); } else { SpriteDataBuilder sdb; if (IconRes.TryGetValue(commonInfo.Icon, out sdb)) { sb.SpriteDataBox(style, sdb); } //box = maker.SpriteDataBox(Sprites, style, sdb); } } Cursor.X += sb.Box.Width; //Cursor.X += box.Width; Sprites.AddRange(sb.Sprites); return(sb.Box); }
protected override void initializeSprites() { Transformation fadeInTrack = new TransformationF(TransformationType.Fade, 0, 1, StartTime - DifficultyManager.PreEmpt, StartTime - DifficultyManager.PreEmpt + DifficultyManager.FadeIn); Transformation fadeOut = new TransformationF(TransformationType.Fade, 1, 0, EndTime, EndTime + DifficultyManager.HitWindow50); activeOverlay = new pSprite(TextureManager.Load(OsuTexture.holdactive), FieldTypes.GamefieldSprites, OriginTypes.Centre, ClockTypes.Audio, Position, SpriteManager.drawOrderBwd(EndTime - 18), false, Color.White); spriteCollectionStart.Add(activeOverlay); inactiveOverlay = new pSprite(TextureManager.Load(OsuTexture.holdinactive), FieldTypes.GamefieldSprites, OriginTypes.Centre, ClockTypes.Audio, Position, SpriteManager.drawOrderBwd(EndTime - 19), false, Color.White); inactiveOverlay.Transform(new NullTransform(StartTime, EndTime)); spriteCollectionStart.Add(inactiveOverlay); border = new pSprite(TextureManager.Load(OsuTexture.holdoverlay), FieldTypes.GamefieldSprites, OriginTypes.Centre, ClockTypes.Audio, Position, SpriteManager.drawOrderBwd(EndTime - 20), false, Color.White); border.Transform(fadeInTrack); border.Transform(fadeOut); Sprites.Add(border); spriteCollectionStart.ForEach(s => s.Transform(fadeInTrack)); spriteCollectionStart.ForEach(s => s.Transform(fadeOut)); circularProgress = new CircularProgress(position, 4, false, 0, Color.White); circularProgress.Clocking = ClockTypes.Audio; circularProgress.Field = FieldTypes.GamefieldExact; circularProgress.Additive = true; circularProgress.Transform(new NullTransform(StartTime, EndTime)); spriteCollectionStart.Add(circularProgress); Sprites.AddRange(spriteCollectionStart); activeOverlay.Transform(new TransformationC(hold_colour, Color4.White, StartTime, EndTime)); circularProgress.Transform(new TransformationC(new Color4(hold_colour.R, hold_colour.G, hold_colour.B, 0.8f), ColourHelper.Lighten(new Color4(hold_colour.R, hold_colour.G, hold_colour.B, 0.8f), 0.5f), StartTime, EndTime)); border.TagNumeric = HitObject.DIMMABLE_TAG; inactiveOverlay.TagNumeric = HitObject.DIMMABLE_TAG; }
public virtual void AddSpriteRange(ICollection <Sprite> sprites) { Sprites.AddRange(sprites); }
public CompositeSprite(params SpriteBase[] sprites) { Sprites.AddRange(sprites); }
public MakeMapScreen(GraphicsDevice graphics, ContentManager content) : base(graphics, content) { this.graphics = graphics; this.content = content; pixel = new Texture2D(graphics, 1, 1); pixel.SetData(new Color[] { Color.White }); Eraser = new Button(Content.Load <Texture2D>("Eraser"), new Vector2((graphics.Viewport.Width + 2000) * Main.ScreenScale * Main.SpriteScales["Eraser"], 120 * Main.ScreenScale * Main.SpriteScales["Eraser"]), Color.White, new Vector2(Main.ScreenScale * Main.SpriteScales["Eraser"]), null); Texture2D backgroundBoxTexture = Content.Load <Texture2D>("BackgroundBox"); var saveButtonTexture = Content.Load <Texture2D>("SaveButton"); saveButton = new Button(saveButtonTexture, new Vector2(1200 * Main.SpriteScales["SaveButton"] * Main.ScreenScale, (saveButtonTexture.Width * Main.SpriteScales["SaveButton"]) / 2), Color.White, new Vector2(Main.SpriteScales["SaveButton"] * Main.ScreenScale), null); font = Content.Load <SpriteFont>("TextFont"); savedLabel = new TextLabel(new Vector2(saveButton.X + saveButton.ScaledWidth, saveButton.Y), Color.Black, "Saved!", font); savedLabel.IsVisible = false; Texture2D backButtonTexture = Content.Load <Texture2D>("BackButton"); backButton = new Button(backButtonTexture, new Vector2(backButtonTexture.Width / 2 * Main.SpriteScales["BackButton"] * Main.ScreenScale, graphics.Viewport.Height - backButtonTexture.Height / 2 * Main.SpriteScales["BackButton"] * Main.ScreenScale), Color.White, new Vector2(Main.SpriteScales["BackButton"] * Main.ScreenScale), null); //Don't need these could just add these directly into the TileButtons list var topRightRoadPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/RightUpArcPiece"), new Vector2(0 + backgroundBoxTexture.Width / 2 * Main.SpriteScales["BackgroundBox"], 200) * Main.ScreenScale); var topLeftRoadPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/LeftUpArcPiece"), new Vector2(topRightRoadPiece.Position.X, topRightRoadPiece.Position.Y + topRightRoadPiece.ScaledHeight)); var bottomRightRoadPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/RightDownArcPiece"), new Vector2(topLeftRoadPiece.Position.X, topLeftRoadPiece.Position.Y + topLeftRoadPiece.ScaledHeight)); var bottomLeftRoadPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/LeftDownArcPiece"), new Vector2(bottomRightRoadPiece.Position.X, bottomRightRoadPiece.Position.Y + bottomRightRoadPiece.ScaledHeight)); var straightHorizontalPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/StraightHorizontalPiece"), new Vector2(bottomLeftRoadPiece.Position.X, bottomLeftRoadPiece.Position.Y + bottomLeftRoadPiece.ScaledHeight)); var straightVerticalPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/StraightVerticalPiece"), new Vector2(straightHorizontalPiece.Position.X, straightHorizontalPiece.Position.Y + straightHorizontalPiece.ScaledHeight)); var fourSideCrossPiece = Main.CreateButton(graphics, backgroundBoxTexture, Content.Load <Texture2D>("RoadPieces/4SideCrossPiece"), new Vector2(straightVerticalPiece.Position.X, straightVerticalPiece.Position.Y + straightVerticalPiece.ScaledHeight)); MarkStartTile = new Button(Content.Load <Texture2D>("MarkStartTile"), new Vector2(topRightRoadPiece.X, topRightRoadPiece.Y - topRightRoadPiece.ScaledHeight), Color.White, new Vector2(Main.SpriteScales["MarkStartTile"] * Main.ScreenScale), null); MarkEndTile = new Button(Content.Load <Texture2D>("MarkEndTile"), new Vector2(topRightRoadPiece.X, fourSideCrossPiece.Y + fourSideCrossPiece.ScaledHeight), Color.White, new Vector2(Main.SpriteScales["MarkEndTile"] * Main.ScreenScale), null); topRightRoadPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/RightUpArcPiece"), ConnectionTypes.Right, ConnectionTypes.Bottom); topLeftRoadPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/LeftUpArcPiece"), ConnectionTypes.Left, ConnectionTypes.Bottom); bottomRightRoadPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/RightDownArcPiece"), ConnectionTypes.Right, ConnectionTypes.Top); bottomLeftRoadPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/LeftDownArcPiece"), ConnectionTypes.Left, ConnectionTypes.Top); straightHorizontalPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/StraightHorizontalPiece"), ConnectionTypes.Right, ConnectionTypes.Left); straightVerticalPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/StraightVerticalPiece"), ConnectionTypes.Bottom, ConnectionTypes.Top); fourSideCrossPiece.Tag = new TileCreateInfo(Content.Load <Texture2D>("RoadPieces/4SideCrossPiece"), ConnectionTypes.Top, ConnectionTypes.Bottom, ConnectionTypes.Right, ConnectionTypes.Left); newestTileToCreate = new Tile(new TileInfo("RoadPieces/RightUpArcPiece", new Vector2(-10, -10), null), content, "RoadPieces/RightUpArcPiece"); //int nonDrawableTileMapMargin = 2; //TilesArray = new Tile[(int)(graphics.Viewport.Width / newestTileToCreate.HitBox.Width) - nonDrawableTileMapMargin * 2, (int)(graphics.Viewport.Height / newestTileToCreate.HitBox.Height) - nonDrawableTileMapMargin * 2]; TilesArray = new Tile[15, 5]; grid = new Grid(75, 15, newestTileToCreate.HitBox.Width, newestTileToCreate.HitBox.Height, pixel); TileButtons.Add(topRightRoadPiece); TileButtons.Add(topLeftRoadPiece); TileButtons.Add(bottomRightRoadPiece); TileButtons.Add(bottomLeftRoadPiece); TileButtons.Add(straightHorizontalPiece); TileButtons.Add(straightVerticalPiece); TileButtons.Add(fourSideCrossPiece); Sprites.AddRange(TileButtons); Sprites.Add(saveButton); Sprites.Add(savedLabel); Sprites.Add(MarkStartTile); Sprites.Add(MarkEndTile); Sprites.Add(backButton); Sprites.Add(Eraser); }
public BoundingBox2 AppendMonitorContents(IMonitorBlock monb, MonitorInfo info) { BoundingBox2 box = new BoundingBox2(Cursor, Cursor); BoundingBox2 box2 = new BoundingBox2(Cursor, Cursor); bool debug = monb.Options.ContainsKey("debug"); Vector2 preCursor = Cursor; SpriteBuilder mk; BoxStyle style; MonitorOption opt; float padding = Padding; mk = new SpriteBuilder(Surface, Cursor, Scale, FrameCount) { Color = Color, BGColor = BGColor }; if (monb.Options.TryGetValue("scale", out opt)) { mk.Scale = opt.FloatValue; } if (monb.Options.TryGetValue("padding", out opt)) { padding = opt.FloatValue; } if (monb.Options.TryGetValue("color", out opt)) { mk.Color = opt.ColorValue; } if (monb.Options.TryGetValue("bgcolor", out opt)) { mk.BGColor = opt.ColorValue; } if (monb.Options.ContainsKey("sicon")) { style = new BoxStyle(28, 28, 2); box2 = AppendBlockIcon(mk, style, monb, info); } else if (monb.Options.ContainsKey("icon")) { style = new BoxStyle(56, 56, 4); box2 = AppendBlockIcon(mk, style, monb, info); } mk = new SpriteBuilder(Surface, Cursor, Scale, FrameCount) { Color = Color, BGColor = BGColor }; if (monb.Options.TryGetValue("scale", out opt)) { mk.Scale = opt.FloatValue; } if (monb.Options.TryGetValue("padding", out opt)) { padding = opt.FloatValue; } if (monb.Options.TryGetValue("color", out opt)) { mk.Color = opt.ColorValue; } if (monb.Options.TryGetValue("bgcolor", out opt)) { mk.BGColor = opt.ColorValue; } if (monb.Options.ContainsKey("stscolor")) { mk.Color = GetStatusColor(info, mk.Color); } Vector2 cursor = mk.Cursor; SpriteBuilder sb; foreach (List <MonitorContent> contentList in monb.Contents) { sb = new SpriteBuilder(mk, cursor); foreach (MonitorContent content in contentList) { if (content.Width == null) { style = new BoxStyle(content.Align, padding); } else { style = new BoxStyle(new Vector2((float)content.Width, 29), content.Align, padding); } if (!CRProvider.TryRender(sb, style, content, info)) { sb.EmptyBox(style); } } cursor.Y += sb.Box.Height; //mk.Cursor.X = cursor.X; //mk.Cursor.Y = Cursor.Y + box.Height; Sprites.AddRange(sb.Sprites); box = Merge(box, sb.Box); } box = Merge(box, box2); if (debug) { MySprite rect = MySprite.CreateSprite(SpriteId.SquareHollow, box.Center, box.Size); int index = 0; InfoItem item; if (info.TryGetValue("block", out item)) { index = (item as CommonInfo).Index; } if (index % 2 == 0) { rect.Color = new Color(255, 0, 0, 64); } else { rect.Color = new Color(255, 255, 0, 64); } Sprites.Add(rect); } Cursor.X = preCursor.X + box.Width; return(box); }