public void AssignTool( ToolKind tool ) { Debug.Log("selected tool: " + selectedTool + " new tool: " + tool); if (selectedTool != ToolKind.none) { ctx.ctrl.AssignSelected(selectedTool, false); } selectedTool = tool; ctx.ctrl.AssignSelected(selectedTool, true); }
IEnumerator PickTool(VillageBody village, PickTool pickTool) { CurrentCommand = pickTool; IsSneaking = false; yield return(WaitWithProgress(1f)); SetToolActive(Tool, false); Tool = pickTool.Tool; ToolLevel = village.ToolLevel(Tool); SetToolActive(Tool, true); CurrentCommand = null; }
public int ToolLevel(ToolKind tool) { switch(tool) { case ToolKind.None: return 0; case ToolKind.Axe: return AxesLevel; case ToolKind.Sword: return SwordsLevel; case ToolKind.Pole: return FishingPolesLevel; default: throw new ArgumentOutOfRangeException(); } }
public void SwitchTool(ToolKind kind) { switch (kind) { case ToolKind.笔工具: this.chkPen_Click(this.chkPen, null); return; case ToolKind.消しゴム工具: this.chkPen_Click(this.chkErase, null); return; case ToolKind.文字工具: this.chkPen_Click(this.chkText, null); return; } }
static ToolInfo ToToolInfo(ToolKind kind) { switch (kind) { case ToolKind.StateInspector: return(new ToolInfo { Kind = kind, Name = "StateInspector", Tooltip = null }); case ToolKind.MessageProperties: return(new ToolInfo { Kind = kind, Name = "Message properties", Tooltip = null }); default: return(new ToolInfo { Kind = kind, Name = "?", Tooltip = "?" }); } }
protected override void OnMouseUp(MouseButtonEventArgs e) { //if (!Keyboard.IsKeyDown(Key.LeftCtrl)) //{ // foreach (var particle in model.Particles) // particle.Fixed = false; //} switch (toolKind) { case ToolKind.MoveSelectedParticles: foreach (var particle in model.Particles) { var drawData = particle.Tag as DrawData; if (drawData.Selected && !drawData.Pinned) { particle.Fixed = false; } } break; case ToolKind.ScrollView: break; case ToolKind.SelectRectangle: var r = new Rect(mouseDownPosition, e.GetPosition(this)); foreach (var particle in model.Particles) { if (r.Contains(transform.ToScreen(particle.Position))) { (particle.Tag as DrawData).Selected = true; } } selectionAdorner.Destroy(); selectionAdorner = null; break; } InvalidateVisual(); toolKind = ToolKind.None; ReleaseMouseCapture(); }
void SetToolActive(ToolKind tool, bool active) { switch (tool) { case ToolKind.Axe: transform.Find("Axe").gameObject.SetActive(active); break; case ToolKind.Sword: transform.Find("Sword").gameObject.SetActive(active); break; case ToolKind.Pole: transform.Find("Pole").gameObject.SetActive(active); break; case ToolKind.None: break; default: throw new ArgumentOutOfRangeException(); } }
public void AssignSelected( ToolKind kind, bool selected ) { switch (kind) { case ToolKind.paint: paintSelectedBg.SetActive(selected); break; case ToolKind.fill: fillSelectedBg.SetActive(selected); break; case ToolKind.erase: eraseSelectedBg.SetActive(selected); break; case ToolKind.pick: pickSelectedBg.SetActive(selected); break; } }
protected override void OnMouseDown(MouseButtonEventArgs e) { switch (e.ChangedButton) { case MouseButton.Left: Point p = e.GetPosition(this); mouseDownPosition = p; var hitParticle = ParticleAtPoint(p); if (Keyboard.IsKeyDown(Key.LeftCtrl)) { if (hitParticle == null) { var newParticle = new Particle(model.Dimension); newParticle.Position = transform.ToWorld(mouseDownPosition); newParticle.FillColor = getRandomColor(); model.AddParticle(newParticle); InvalidateVisual(); } else { model.RemoveParticle(hitParticle); InvalidateVisual(); } } else if (Keyboard.IsKeyDown(Key.LeftShift)) { if (hitParticle != null) { toolKind = ToolKind.None; var drawData = hitParticle.Tag as DrawData; drawData.Selected = !drawData.Selected; InvalidateVisual(); } else { toolKind = ToolKind.SelectRectangle; selectionAdorner = SelectionAdorner.Create(this); selectionAdorner.From = mouseDownPosition; selectionAdorner.To = mouseDownPosition; } } else { if (hitParticle != null) { toolKind = ToolKind.MoveSelectedParticles; var drawData = hitParticle.Tag as DrawData; if (drawData.Selected) { foreach (var particle in model.Particles) { DrawData dd = particle.Tag as DrawData; if (dd.Selected) { particle.Fixed = true; } } } else { foreach (var particle in model.Particles) { (particle.Tag as DrawData).Selected = false; } (hitParticle.Tag as DrawData).Selected = true; hitParticle.Fixed = true; } InvalidateVisual(); } else { toolKind = ToolKind.ScrollView; } } if (toolKind != ToolKind.None) { CaptureMouse(); } break; } }
private void EnterPaintMode() { tool = ToolKind.Paint; canvas.Cursor = Cursors.Pen; canvas.EditingMode = InkCanvasEditingMode.Ink; }
private void EnterSelectMode() { tool = ToolKind.Select; canvas.Cursor = Cursors.Arrow; canvas.EditingMode = InkCanvasEditingMode.None; }