public override void Draw(GameTime gameTime) { //this.GraphicsDevice.Clear(Color.CornflowerBlue); this.spriteBatch.Begin(); if (this.Tileset != null) { this.spriteBatch.Draw( this.Tileset.Texture.Texture, new Vector2(0, -this.scrollBar.Value), Color.White); } Vector2 position = new Vector2(this.selection.Region.X, this.selection.Region.Y) * new Vector2(16, 16); position -= new Vector2(0, scrolling.Value); SelectionUtil.DrawRectangle( this.spriteBatch, Color.Black, new Rectangle( this.selection.Region.X * 16 + 1, this.selection.Region.Y * 16 + 1 - this.scrollBar.Value, this.selection.Region.Width * 16, this.selection.Region.Height * 16)); SelectionUtil.DrawRectangle( this.spriteBatch, Color.White, new Rectangle( this.selection.Region.X * 16, this.selection.Region.Y * 16 - this.scrollBar.Value, this.selection.Region.Width * 16, this.selection.Region.Height * 16)); this.spriteBatch.End(); }
public override void Draw(GameTime gameTime) { if (Texture != null) { //Lazy initializing if (SpriteBatch == null) { SpriteBatch = new SpriteBatch(this.GraphicsDevice); } Matrix DrawMatrix = Matrix.CreateScale(Scale); SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise, null, DrawMatrix); SpriteBatch.Draw(Texture, new Rectangle(-HorizontalSB.Value, -VerticalSB.Value, Texture.Width, Texture.Height), Color.White); for (int i = 0; i < BUFFER_SIZE; i++) { if (Buffer[i].Region != Rectangle.Empty && i != CurrentBufferIndex) { Selection _sel = Buffer[i]; SelectionUtil.DrawRectangle(SpriteBatch, Color.Black * .4f, new Rectangle(_sel.Region.X - HorizontalSB.Value, _sel.Region.Y - VerticalSB.Value, _sel.Region.Width, _sel.Region.Height)); SelectionUtil.FillRectangle(SpriteBatch, Color.White * .2f, new Rectangle(_sel.Region.X + 1 - HorizontalSB.Value, _sel.Region.Y + 1 - VerticalSB.Value, _sel.Region.Width - 1, _sel.Region.Height - 1)); } } Selection sel = Buffer[CurrentBufferIndex]; SelectionUtil.DrawRectangle(SpriteBatch, Color.Black * .7f, new Rectangle(sel.Region.X - HorizontalSB.Value, sel.Region.Y - VerticalSB.Value, sel.Region.Width, sel.Region.Height)); SelectionUtil.FillRectangle(SpriteBatch, Color.White * .4f, new Rectangle(sel.Region.X + 1 - HorizontalSB.Value, sel.Region.Y + 1 - VerticalSB.Value, sel.Region.Width - 1, sel.Region.Height - 1)); SpriteBatch.End(); } }
protected override void RowGUI(RowGUIArgs args) { var item = (TreeViewItem <TreeElementWithData <DependTreeData> >)args.item; DependTreeData assetData = item.data.Data; if (assetData == null) { return; } Rect contentRect = args.rowRect; contentRect.x += GetContentIndent(item); contentRect.width -= GetContentIndent(item); Rect rect = contentRect; rect.width -= 80; if (assetData.IsBundle) { EditorGUI.LabelField(rect, assetData.AssetPath); } else { EditorGUI.LabelField(rect, assetData.AssetPath + $"({assetData.RepeatCount})"); } rect.x += rect.width + 5; rect.width = 70; if (GUI.Button(rect, "selected")) { SelectionUtil.ActiveObject(assetData.AssetPath); } }
public void Draw(GameTime gameTime) { SpriteBatch spriteBatch = EditorEngine.Instance.World.ViewData.SpriteBatch; foreach (MapEntity worldEntity in SelectedEntities) { this.drawOverlay(worldEntity, gameTime); } foreach (MapEntity worldEntity in EntitiesToSelect) { this.drawOverlay(worldEntity, gameTime); } if (this.selectedRegion != Rectangle.Empty) { float scale = EditorEngine.Instance.World.Camera.Scale; Vector2 scroll = EditorEngine.Instance.World.Camera.Location; Rectangle displayRegion = new Rectangle((int)(this.selectedRegion.X * scale), (int)(this.selectedRegion.Y * scale), (int)(selectedRegion.Width * scale), (int)(selectedRegion.Height * scale)).Add(scroll); SelectionUtil.DrawRectangle( spriteBatch, Color.Black, new Rectangle( displayRegion.X + 1, displayRegion.Y + 1, displayRegion.Width, displayRegion.Height)); SelectionUtil.DrawRectangle(spriteBatch, Color.White, displayRegion); } }
private static bool PasteValidate() { if (string.IsNullOrEmpty(GUIUtility.systemCopyBuffer)) { return(false); } return(SelectionUtil.IsSingleFloder()); }
void Start() { position = GetComponent <Transform>().position; velocity = new Vector3(); acceleration = new Vector3(); GameObject go = GameObject.FindGameObjectWithTag("GameController"); selectUtil = go.GetComponent <SelectionController>().selectionUtil; }
private void Start() { selectionUtil = GetComponent <SelectionUtil>(); // 3 is the ground layer layerMask = (1 << 8); // layerMask= ~layerMask; //Debug.Log(layerMask.CompareTo()); startedSelection = false; }
private static void SvnToolLog() { List <string> assetPaths = SelectionUtil.GetSelectionAssetPaths(); if (assetPaths.Count == 0) { return; } // 显示日志,只能对单一资产 string arg = "/command:log /closeonend:0 /path:\""; arg += assetPaths[0]; arg += "\""; SvnCommandRun(arg); }
public override void Draw(GameTime gameTime) { if (SpriteBatch == null) { SpriteBatch = new SpriteBatch(GraphicsDevice); } if (Template != null && Template.Texture != null) { Rectangle dest = Template.Texture.GetSource(0); SpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise); if (Mode == 0) /*Viewer*/ { SpriteBatch.Draw(Template.Texture.Texture, dest, Template.Texture.GetSource(0), Color.White); } else if (Mode == 1) /*Collisions*/ { SpriteBatch.Draw(Template.Texture.Texture, dest, Color.White); Color col = new Color(255, 75, 0, 255); Color col2 = new Color(250, 35, 0, 255); foreach (Rectangle rect in Template.CollisionMap) { Rectangle w1 = new Rectangle(rect.X * 16, rect.Y * 16, rect.Width * 16, rect.Height * 16); Rectangle w2 = new Rectangle(rect.X * 16 + 1, rect.Y * 16 + 1, rect.Width * 16 - 1, rect.Height * 16 - 1); SelectionUtil.DrawRectangle(SpriteBatch, col * .7f, w1); SelectionUtil.FillRectangle(SpriteBatch, col2 * .3f, w2); } Rectangle ww = new Rectangle(selection.Region.X * 16, selection.Region.Y * 16, selection.Region.Width * 16, selection.Region.Height * 16); SelectionUtil.DrawRectangle(SpriteBatch, Color.White, ww); } else if (Mode == 2) { Vector2 pos = new Vector2(0, Template.ShadowOffset); Rectangle src = Template.Texture.GetSource(0); Rectangle target = new Rectangle((int)pos.X, (int)pos.Y, Template.Texture.FrameWidth, (int)(Template.Texture.FrameHeight * 0.6f)); if (Template.ShadowType == ShadowType.Perspective) { SpriteBatch.Draw(Template.Texture.Texture, target, src, new Color(0f, 0f, 0f, 0.3f), 0.0f, Vector2.Zero, SpriteEffects.FlipVertically, 0f); } SpriteBatch.Draw(Template.Texture.Texture, dest, Color.White); SelectionUtil.DrawStraightLine(SpriteBatch, Color.White, 0, Template.ShadowOffset, 1, Width); } SpriteBatch.End(); } }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime) { Vector2 position = new Vector2(this.selection.Region.X, this.selection.Region.Y) * new Vector2(16, 16); SpriteBatch batch = EditorEngine.Instance.World.ViewData.SpriteBatch; if (batch != null && capturedmouse) { Vector2 scroll = EditorEngine.Instance.World.Camera.Location; float scale = EditorEngine.Instance.World.Camera.Scale; Rectangle target = new Rectangle((int)(position.X * scale), (int)(position.Y * scale), (int)(selection.Region.Width * 16 * scale), (int)(selection.Region.Height * 16 * scale)).Add(scroll); SelectionUtil.FillRectangle(batch, Color.Blue * .35f, target); SelectionUtil.DrawRectangle(batch, Color.Black, target.Add(new Vector2(1, 1))); SelectionUtil.DrawRectangle(batch, Color.White, target); } }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime) { SpriteBatch spriteBatch = EditorEngine.Instance.World.ViewData.SpriteBatch; if (selection.Region != Rectangle.Empty) { int xs = (int)EditorEngine.Instance.World.Camera.Location.X; int ys = (int)EditorEngine.Instance.World.Camera.Location.Y; float scale = EditorEngine.Instance.World.Camera.Scale; Vector2 scroll = EditorEngine.Instance.World.Camera.Location; Rectangle target = new Rectangle((int)(selection.Region.X * scale * 16 + scroll.X), (int)(selection.Region.Y * scale * 16 + scroll.Y), (int)(selection.Region.Width * 16 * scale), (int)(selection.Region.Height * 16 * scale)); SelectionUtil.DrawRectangle(spriteBatch, Color.Black, target.Add(new Vector2(1, 1))); SelectionUtil.DrawRectangle(spriteBatch, Color.White, target); } }
public void Draw(Microsoft.Xna.Framework.GameTime gameTime) { SpriteBatch batch = EditorEngine.Instance.World.ViewData.SpriteBatch; if (batch != null) { foreach (LogicPathSquare sq in path) { float scale = EditorEngine.Instance.World.Camera.Scale; Vector2 scroll = EditorEngine.Instance.World.Camera.Location; Rectangle target = new Rectangle((int)(sq.x * 16 * scale), (int)(sq.y * 16 * scale), (int)(16 * scale), (int)(16 * scale)).Add(scroll); SelectionUtil.DrawRectangle(batch, Color.CornflowerBlue * .7f, target); SelectionUtil.DrawRectangle(batch, Color.Black * .8f, target.Add(new Vector2(1, 1))); } } }
public void Draw(GameTime gameTime) { int w = EditorEngine.Instance.CurrentMap.Width; int h = EditorEngine.Instance.CurrentMap.Height; int xs = EditorEngine.Instance.xCam; int ys = EditorEngine.Instance.yCam; //Columns for (int x = 0; x < w; x++) { SelectionUtil.DrawStraightLine(EditorEngine.Instance.World.ViewData.SpriteBatch, Color.Black, 0.6f, (x << 4) + xs, ys, 2, h << 4); } //Rows for (int y = 0; y < h; y++) { SelectionUtil.DrawStraightLine(EditorEngine.Instance.World.ViewData.SpriteBatch, Color.Black, 0.6f, xs, (y << 4) + ys, 1, w << 4); } this.ToolMachine.Draw(gameTime); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { int ypos = vscrollbar.Value; int xpos = hscrollbar.Value; if (Tileset != null) { if (Tileset.Texture != null && Tileset.Texture.Texture != null) { batch.Begin(); batch.Draw(Tileset.Texture.Texture, -new Vector2(xpos, ypos), Color.White); int x = Tileset.Texture.Texture.Width - xpos; int y = Tileset.Texture.Texture.Height - ypos; SelectionUtil.DrawStraightLine(batch, new Color(.9f, .4f, .4f, 1f), 1f, x, -ypos, 2, Tileset.Texture.Texture.Height); //vertical SelectionUtil.DrawStraightLine(batch, new Color(.9f, .4f, .4f, 1f), 1f, -xpos, y, 1, Tileset.Texture.Texture.Width); //horizontal SelectionUtil.DrawRectangle(batch, new Color(.7f, .1f, 0f, .6f), new Rectangle((xt << 4) - xpos, (yt << 4) - ypos, 16, 16)); SelectionUtil.FillRectangle(batch, new Color(.4f, .1f, 0f, .6f), new Rectangle((xt << 4) + 1 - xpos, (yt << 4) + 1 - ypos, 16, 16)); int ry = 0; int rx = 0; foreach (Tile t in Tileset.Tiles) { if (rx + 1 > Tileset.Texture.Texture.Width / 16) { rx = 0; ry++; } batch.Draw(ox.Texture, new Rectangle((rx << 4) - xpos, (ry << 4) - ypos, 16, 16), ox.GetSource(t.DefaultBehavior.BehaviorId == this.Behavior ? 0 : 1), Color.White * 0.8f); rx++; } batch.End(); } } base.Draw(gameTime); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { if (initialized) { this.spriteBatch.Begin(); if (this.sheet != null) { this.spriteBatch.Draw( this.sheet.Texture.Texture, new Vector2(0, -scrollBar.Value), Color.White); } this.spriteBatch.End(); Selection selection = new Selection(); selection.Start(new Vector2(xt << 4, yt << 4)); selection.End(new Vector2(xt << 4, yt << 4)); SelectionUtil.DrawRectangle( this.spriteBatch, Color.Black, new Rectangle( selection.Region.X * 16 + 1, selection.Region.Y * 16 + 1 - this.scrollBar.Value, selection.Region.Width * 16, selection.Region.Height * 16)); SelectionUtil.DrawRectangle( this.spriteBatch, Color.White, new Rectangle( selection.Region.X * 16, selection.Region.Y * 16 - this.scrollBar.Value, selection.Region.Width * 16, selection.Region.Height * 16)); } base.Draw(gameTime); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { base.Draw(gameTime); if (this.initialized) { spriteBatch.Begin(); for (byte i = 0; i < collisions.Count; i++) { Rectangle rect = collisions[i]; TileBehavior b = TileBehavior.GetBehavior(i); spriteBatch.Draw(pixel, rect, b.Color); const int font = 2; FontRenderer.Instance.Draw(spriteBatch, b.Identifier, font, (int)(rect.X + 16 / 2 - Math.Floor(FontRenderer.Instance.Width(b.Identifier, font) / 2f)), rect.Y + 14); if (i == this.SelectedId) { SelectionUtil.DrawRectangle(spriteBatch, Color.Red, new Rectangle(rect.X, rect.Y, rect.Width - 1, rect.Height - 1)); } } spriteBatch.End(); } }
private static void SvnToolRevert() { List <string> assetPaths = SelectionUtil.GetSelectionAssetPaths(); RevertAtPaths(assetPaths); }
private static void SvnToolCommit() { List <string> assetPaths = SelectionUtil.GetSelectionAssetPaths(); CommitAtPaths(assetPaths); }
private static void SvnToolUpdate() { List <string> assetPaths = SelectionUtil.GetSelectionAssetPaths(); UpdateAtPaths(assetPaths); }
public void Draw(Microsoft.Xna.Framework.GameTime time) { if (!Initialized || World == null) { return; } if (CurrentMap == null) { return; } int w = CurrentMap.Width << 4; int h = CurrentMap.Height << 4; GraphicsDevice.Clear(new Color(0x2f, 0x2f, 0x2f)); SpriteBatch batch = World.ViewData.SpriteBatch; batch.Begin(Matrix.CreateScale(1)); SelectionUtil.FillRectangle(World.ViewData.SpriteBatch, Color.White * 0.5f, new Rectangle((int)World.Camera.Location.X, (int)World.Camera.Location.Y, (int)(w * World.Camera.Scale), (int)(h * World.Camera.Scale))); CurrentMap.Draw(time); if (this.World.Camera.Scale <= 0) { this.World.Camera.Scale = 1f; } StateMachine.Draw(time); if (Options.Instance.Grid) { if (CurrentMap != null) { //We could draw a rectangle for every Tiles... //Or we could be smart and draw lines for columns and rows! Color c1 = Color.DeepSkyBlue; Color c2 = Color.Black; float trans_white = Options.Instance.GridOpacity; float trans_black = Options.Instance.GridOpacity; //rows for (int y = 0; y < CurrentMap.Height; y++) { SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c1, trans_white, 0, (y << 4), CurrentMap.Width * 16, 1); SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c2, trans_black, 0, (y << 4) + 1, CurrentMap.Width * 16, 1); } //columns for (int x = 0; x < CurrentMap.Width; x++) { SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c1, trans_white, x << 4, 0, 1, CurrentMap.Height << 4); SelectionUtil.DrawStraightLine(World.ViewData.SpriteBatch, c2, trans_black, (x << 4) + 1, 0, 1, CurrentMap.Height << 4); } } } ScreenInterface.Draw(time); //batch.Begin(SpriteSortMode.Deferred, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullCounterClockwise); //batch.Draw(renderTarget, new Rectangle(xCam, yCam, (int) (renderTarget.Width * Zoom), (int) (renderTarget.Height * Zoom)), Color.White); batch.End(); }
public override void Draw(Microsoft.Xna.Framework.GameTime time) { spriteBatch.Begin(); int x = 0; int y = 0; try { foreach (TileLogicScript logic in TileLogicManager.Instance.logics) { Tileset _s_0 = EditorEngine.Instance.GetTilesetByName(logic.s_0); int _s_1 = logic.s_1; if ((x << 4) + 16 > this.Width) { y++; x = 0; } Rectangle srcRect = _s_0.Texture.GetSource(_s_1); Rectangle targetRect = new Rectangle(x << 4, (y << 4) - scrollbar.Value, 16, 16); spriteBatch.Draw(_s_0.Texture.Texture, targetRect, srcRect, Color.White); x += 1; } this.yMax = y << 4; if (!initializedYMax) { initializedYMax = true; refreshScrollbar(); } } catch (Exception e) { Console.WriteLine("Bullshit occured: " + e); } Selection selection = new Selection(); selection.Start(new Vector2(xt << 4, yt << 4)); selection.End(new Vector2(xt << 4, yt << 4)); SelectionUtil.DrawRectangle( spriteBatch, Color.Black, new Rectangle( selection.Region.X * 16 + 1, selection.Region.Y * 16 + 1 - this.scrollbar.Value, selection.Region.Width * 16, selection.Region.Height * 16)); SelectionUtil.DrawRectangle( spriteBatch, Color.White, new Rectangle( selection.Region.X * 16, selection.Region.Y * 16 - this.scrollbar.Value, selection.Region.Width * 16, selection.Region.Height * 16)); spriteBatch.End(); }
public override void Draw(Microsoft.Xna.Framework.GameTime gameTime) { int xpos = hscrollbar.Value; int ypos = vscrollbar.Value; if (spriteBatch == null) { spriteBatch = new SpriteBatch(GraphicsDevice); } if (Tileset != null) { if (checkerboard) { int i = 0; for (int cy = 0; cy < Tileset.Texture.Rows; cy++) { for (int cx = 0; cx < Tileset.Texture.Columns; cx++) { bool odd = i % 2 != 0; //0xD8DEFF //0xBFC8FF Color col_dark = new Color(0xd8, 0xde, 0xff); Color col_light = new Color(0xbf, 0xc8, 0xff); SelectionUtil.FillRectangle(spriteBatch, odd ? col_light : col_dark, new Rectangle(cx * 16 - xpos, cy * 16 - ypos, 16, 16)); i++; } i++; } } spriteBatch.Begin(); spriteBatch.Draw(Tileset.Texture.Texture, -new Vector2(xpos, ypos), Color.White); spriteBatch.End(); int x = Tileset.Texture.Texture.Width - xpos; int y = Tileset.Texture.Texture.Height - ypos; SelectionUtil.DrawStraightLine(spriteBatch, new Color(.9f, .4f, .4f, 1f), 1f, x, -ypos, 2, Tileset.Texture.Texture.Height); //vertical SelectionUtil.DrawStraightLine(spriteBatch, new Color(.9f, .4f, .4f, 1f), 1f, -xpos, y, 1, Tileset.Texture.Texture.Width); //horizontal List <Vector2> _points = points[currentEntity]; foreach (Vector2 vec2 in _points) { Tuple <int, int, int> bcol = colors[currentEntity]; Color col = new Color(bcol.Item1, bcol.Item2, bcol.Item3); SelectionUtil.FillRectangle(spriteBatch, colorbuffer ? (col * 0.6f) : (Color.Red * 0.6f), new Rectangle((int)vec2.X * 16 - xpos, (int)vec2.Y * 16 - ypos, 16, 16)); } for (int i = 0; i < points.Length; i++) { if (i != currentEntity) { foreach (Vector2 vec2 in points[i]) { SelectionUtil.FillRectangle(spriteBatch, Color.Black * 0.4f, new Rectangle((int)vec2.X * 16 - xpos, (int)vec2.Y * 16 - ypos, 16, 16)); } } } } base.Draw(gameTime); }
private static bool LinkFloderValidate() { return(SelectionUtil.IsSingleFloder()); }