void Start() { Cursor.SetCursor(defaultCursor, defaultCursorHotspot, CursorMode.Auto); currentCursor = CursorType.Default; // Lets make sure we have all the dependencies, even if not set in the inspector :) if (!inputControlTool) { inputControlTool = GetComponent <InputControlTool>(); } if (!inputControlTool) { inputControlTool = GameObject.FindGameObjectWithTag("GameControler").GetComponent <InputControlTool>(); } if (!selectRectangle) { selectRectangle = GetComponent <SelectRectangle>(); } if (!selectRectangle) { selectRectangle = GameObject.FindGameObjectWithTag("GameControler").GetComponent <SelectRectangle>(); } }
public override void LoadContent(ContentManager Content) { managerIsland.LoadContent(Content); managerPlayerUnits.LoadContent(Content); managerPlayerBuildings.LoadContent(Content); managerUI.LoadContent(Content); managerEnemies.LoadContent(Content); SelectRectangle.LoadContent(Content); cursor = Content.Load <Texture2D>("Cursor"); managerMouse.MouseEventHandler += (sender, e) => { if (!start) { start = true; increment = 0.1f; fadeOut = 0; } if (showSummary) { showSummary = false; Battleship.move = false; ManagerBuildings.goldMines.Clear(); Initializer(); LoadContent(Content); } }; }
public void Draw(SpriteBatch spriteBatch) { if (mouseDown) { SelectRectangle.Draw(spriteBatch, selectRectangle); } }
public void Draw(SpriteBatch spriteBatch) { _sprite.Draw(spriteBatch); if (_selected) { SelectRectangle.Draw(spriteBatch, _sprite.Rectangle); } }
public void Draw(SpriteBatch spriteBatch) { if (_mouseDown) { //spriteBatch.Draw(_texture,_selectRectangle, new Color(255,255,255,180)); SelectRectangle.Draw(spriteBatch, _selectRectangle); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); _managerUnits.LoadContent(Content); SelectRectangle.LoadContent(Content); _managerTiles.LoadContent(Content); // TODO: use this.Content to load your game content here }
public virtual void Draw(SpriteBatch spriteBatch) { if (information.HitPoints > 0) { if (selected) { SelectRectangle.Draw(spriteBatch, new Rectangle(rectangle.X, rectangle.Y, width, height)); } if (shoot && animations.currentAnimation == AnimationType.ATTACKING) { if (information.Type == Util.Units.TROLL_AXETHROWER) { spriteBatch.Draw(missileTroll, missilePosition + new Vector2(15, 15), new Rectangle(5, 5, 19, 20), Color.White, angle, new Vector2(9.5f, 10), 1f, SpriteEffects.None, 0); } else if (information.Type == Util.Units.ELVEN_ARCHER) { spriteBatch.Draw(missileElven, missilePosition + new Vector2(15, 15), new Rectangle(19, 4, 3, 30), Color.White, angle, new Vector2(1.5f, 15), 1f, SpriteEffects.None, 0); } } //SelectRectangle.DrawLine(spriteBatch, position, finalGoal); } if (workState != WorkigState.WORKING) { Color color = Color.White; // if (managerUnits.index % 2 == 0) // color = Color.Red; // else if (managerUnits.index % 2 == 1) //color = Color.Blue; //else if (managerUnits.index == 2) // color = Color.Green; //else if (managerUnits.index == 3) //color = Color.Yellow; if (information.HitPoints > 0 && information.HitPoints < information.HitPointsTotal) { progress.Draw(spriteBatch); } if (animations.FlipX()) { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, color, 0, Vector2.Zero, 1, SpriteEffects.FlipHorizontally, 0); } else if (animations.FlipY()) { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, color, 0, Vector2.Zero, 1, SpriteEffects.FlipVertically, 0); } else { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, color); } } }
public static Task SendMessage( [HttpTrigger(AuthorizationLevel.Anonymous, "post")] SelectRectangle message, [SignalR(HubName = "funchub")] IAsyncCollector <SignalRMessage> signalRMessages) { return(signalRMessages.AddAsync( new SignalRMessage { Target = "select", Arguments = new[] { message } })); }
protected override void LoadContent() { spriteBatch = new SpriteBatch(GraphicsDevice); managerMap.LoadContent(Content); managerUnits.LoadContent(Content); managerEnemies.LoadContent(Content); managerBuildings.LoadContent(Content); managerUI.LoadContent(Content); SelectRectangle.LoadContent(Content); }
public override void Draw(SpriteBatch spriteBatch) { base.Draw(spriteBatch); if (selected) { SelectRectangle.Draw(spriteBatch, healthArea, Color.Yellow); } if (index > -1) { SelectRectangle.Draw(spriteBatch, managerUnits.units[index].rectangle, Color.YellowGreen); } }
internal void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (_selRect != null) { List <Selection> sels = _selRect.Select(_presenter.currentBlock); if (sels.Count > 0) { (_presenter.document as Document).selections.Add(sels); } } _selRect = null; } }
/// <summary> /// Handles the MouseMove event of the imgCurrent control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param> private void imgCurrent_MouseMove(object sender, MouseEventArgs e) { if (_isDragging) { var point = e.GetPosition((IInputElement)sender); var width = point.X - _selectRectangleStartPoint.X; var height = point.Y - _selectRectangleStartPoint.Y; if (width == 0 || height == 0) { return; } if (width > 0) { SelectRectangle.Width = width; } else { _selectRectangleStartPoint.X += width; SelectRectangle.SetValue(Canvas.LeftProperty, _selectRectangleStartPoint.X); SelectRectangle.Width -= width; } if (height > 0) { SelectRectangle.Height = height; } else { _selectRectangleStartPoint.Y += height; SelectRectangle.SetValue(Canvas.TopProperty, _selectRectangleStartPoint.Y); SelectRectangle.Height -= height; } return; } if (_isLeftMouseButtonPressed) { var point = e.GetPosition((IInputElement)sender); var xDelta = point.X - _selectRectangleStartPoint.X; var yDelta = point.Y - _selectRectangleStartPoint.Y; ImageTranslateX += xDelta; ImageTranslateY += yDelta; _selectRectangleStartPoint = new Point(point.X, point.Y); } }
public virtual void Draw(SpriteBatch spriteBatch) { if (isBuilding && !isPlaceSelected) { spriteBatch.Draw(texture[textureName], position, new Rectangle(animations.Last().x, animations.Last().y, animations.Last().width, animations.Last().height), Color.White); } else if ((isBuilding && isPlaceSelected && isStartBuilding) || isWorking) { Color color = Color.White; if (managerUnits != null) { // if (managerUnits.index % 2 == 0) // color = Color.Red; // else if (managerUnits.index % 2 == 1) //color = Color.Blue; //else if (managerUnits.index == 2) // color = Color.Green; //else if (managerUnits.index == 3) //color = Color.Yellow; } if (information.HitPoints <= 0) { color = Color.Black; } spriteBatch.Draw(texture[textureName], position, animations.rectangle, color); if ((progress.start && !progress.finish) || (progress.finish && information.HitPoints < information.HitPointsTotal)) { progress.Draw(spriteBatch); } } if (selected) { SelectRectangle.Draw(spriteBatch, rectangle); if (!unselected) { SelectRectangle.DrawTarget(spriteBatch, new Rectangle(unitDestination.X * 32, unitDestination.Y * 32, 32, 32)); } } }
public void Draw(SpriteBatch spriteBatch) { if (isBuilding && !isPlaceSelected) { spriteBatch.Draw(texture, position, new Rectangle(animations.Last().x, animations.Last().y, animations.Last().width, animations.Last().height), Color.White); } else if ((isBuilding && isPlaceSelected && isStartBuilding) || isWorking) { spriteBatch.Draw(texture, position, animations.rectangle, Color.White); } if (selected) { SelectRectangle.Draw(spriteBatch, rectangle); if (!unselected) { SelectRectangle.DrawTarget(spriteBatch, new Rectangle(target.X * 32, target.Y * 32, 32, 32)); } } }
public virtual void Draw(SpriteBatch spriteBatch) { if (information.HitPoints > 0) { if (selected) { SelectRectangle.Draw(spriteBatch, new Rectangle(rectangle.X, rectangle.Y, 32, 32)); } if (shoot && animations.currentAnimation == AnimationType.ATTACKING) { if (information.Type == Util.Units.TROLL_AXETHROWER) { spriteBatch.Draw(missileTroll, missilePosition + new Vector2(15, 15), new Rectangle(5, 5, 19, 20), Color.White, angle, new Vector2(9.5f, 10), 1f, SpriteEffects.None, 0); } else if (information.Type == Util.Units.ELVEN_ARCHER) { spriteBatch.Draw(missileElven, missilePosition + new Vector2(15, 15), new Rectangle(19, 4, 3, 30), Color.White, angle, new Vector2(1.5f, 15), 1f, SpriteEffects.None, 0); } } } if (workState != WorkigState.WORKING) { if (animations.FlipX()) { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, Color.White, 0, Vector2.Zero, 1, SpriteEffects.FlipHorizontally, 0); } else if (animations.FlipY()) { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, Color.White, 0, Vector2.Zero, 1, SpriteEffects.FlipVertically, 0); } else { spriteBatch.Draw(texture[animations.currentAnimation], position, animations.rectangle, Color.White); } } }
private void imgCurrent_MouseMove(object sender, MouseEventArgs e) { if (_isDragging) { var point = e.GetPosition((IInputElement)sender); var width = point.X - _selectRectangleStartPoint.X; var height = point.Y - _selectRectangleStartPoint.Y; if (width == 0 || height == 0) { return; } //width = width == 0 ? 1 : width; //height = height == 0 ? 1 : height; if (width > 0) { SelectRectangle.Width = width; } else { _selectRectangleStartPoint.X += width; SelectRectangle.SetValue(Canvas.LeftProperty, _selectRectangleStartPoint.X); SelectRectangle.Width -= width; } if (height > 0) { SelectRectangle.Height = height; } else { _selectRectangleStartPoint.Y += height; SelectRectangle.SetValue(Canvas.TopProperty, _selectRectangleStartPoint.Y); SelectRectangle.Height -= height; } } }
private void OriginalImageContainer_MouseMove(object sender, System.Windows.Input.MouseEventArgs e) { if (_isDragging) { var x = e.GetPosition(BackPlane).X; var y = e.GetPosition(BackPlane).Y; _currentPointImg.X = e.GetPosition(OriginalImage).X; _currentPointImg.Y = e.GetPosition(OriginalImage).Y; // Debug.WriteLine("Canvas: x = {0} y = {1} X = {2} Y = {3} Width = {4} Height = {5}", x, y, _anchorPoint.X, _anchorPoint.Y, Math.Abs(x - _anchorPoint.X), Math.Abs(y - _anchorPoint.Y)); // Debug.WriteLine("Image: x = {0} y = {1} X = {2} Y = {3} Width = {4} Height = {5}", _currentPointImg.X, _currentPointImg.Y, _anchorPointImg.X, _anchorPointImg.Y, Math.Abs(_currentPointImg.X - _anchorPointImg.X), Math.Abs(_currentPointImg.Y - _anchorPointImg.Y)); SelectRectangle.SetValue(Canvas.LeftProperty, Math.Min(x, _anchorPoint.X)); SelectRectangle.SetValue(Canvas.TopProperty, Math.Min(y, _anchorPoint.Y)); SelectRectangle.Width = Math.Abs(x - _anchorPoint.X); SelectRectangle.Height = Math.Abs(y - _anchorPoint.Y); if (SelectRectangle.Visibility != Visibility.Visible) { SelectRectangle.Visibility = Visibility.Visible; } } }
protected Task Send(SelectRectangle selectRectangle) => _hubConnection.SendAsync("select", selectRectangle);
public void Draw(SpriteBatch spriteBatch) { SelectRectangle.DrawFilled(spriteBatch, rectangle); }
void Start() { selectRectangle = gameObject.GetComponent <SelectRectangle>(); moveCross = gameObject.GetComponentInChildren <TargetMoveAnimation>(); }
internal Commands.Command OnMouseDown(MouseEventArgs e) { _pos.x = e.X; _pos.y = e.Y; Commands.Command cmd = null; switch (_mode) { case Mode.Default: #region { if (e.Button == MouseButtons.Left) { if (_anchorMgr.currentGripPoint == null) { _pickupBox.center = _pos; List <Selection> sels = _pickupBox.Select(_presenter.currentBlock); if (sels.Count > 0) { if (IsShiftKeyDown) { (_presenter.document as Document).selections.Remove(sels); } else { (_presenter.document as Document).selections.Add(sels); } } else { _selRect = new SelectRectangle(_presenter); _selRect.startPoint = _selRect.endPoint = _pos; } } else { Database db = (_presenter.document as Document).database; Entity entity = db.GetObject(_anchorMgr.currentGripEntityId) as Entity; if (entity != null) { LitCAD.Commands.GripPointMoveCmd gripMoveCmd = new Commands.GripPointMoveCmd( entity, _anchorMgr.currentGripPointIndex, _anchorMgr.currentGripPoint); cmd = gripMoveCmd; } //Commands.Command anchorCmd = _anchorMgr.currentAnchorCmd; //if (anchorCmd != null) //{ // cmd = anchorCmd; //} } } } #endregion break; case Mode.Select: #region { if (e.Button == MouseButtons.Left) { _pickupBox.center = _pos; List <Selection> sels = _pickupBox.Select(_presenter.currentBlock); if (sels.Count > 0) { if (IsShiftKeyDown) { (_presenter.document as Document).selections.Remove(sels); } else { (_presenter.document as Document).selections.Add(sels); } } else { _selRect = new SelectRectangle(_presenter); _selRect.startPoint = _selRect.endPoint = _pos; } } } #endregion break; case Mode.Locate: _currSnapPoint = _snapNodesMgr.Snap(_pos); break; case Mode.Drag: break; default: break; } return(cmd); }
// Use this for initialization void Start() { player = transform.root.GetComponent <Player>(); selectRectangle = transform.root.GetComponentInChildren <SelectRectangle>(); CameraTargetPosition = Camera.mainCamera.transform.position; }