public void Setup() { m_HoveredBone = -1; m_View = Substitute.For <IBindPoseView>(); m_View.hoveredBone.Returns(x => m_HoveredBone); m_SelectedBones = new List <int>(); m_Selection = Substitute.For <ISelection>(); m_Selection.Count.Returns(x => m_SelectedBones.Count); m_Selection.IsSelected(Arg.Any <int>()).Returns(x => m_SelectedBones.Contains((int)x[0])); m_Selection.GetEnumerator().Returns(x => m_SelectedBones.GetEnumerator()); m_Selection.single.Returns(x => { if (m_SelectedBones.Count == 1) { return(m_SelectedBones[0]); } return(-1); }); m_UndoObject = Substitute.For <IUndoObject>(); m_SpriteMeshData = new SpriteMeshData(); m_SpriteMeshData.frame = new Rect(0f, 0f, 100f, 100f); m_SpriteMeshData.bones = CreateSpriteBoneData(); m_BindPoseController = new BindPoseController(); m_BindPoseController.spriteMeshData = m_SpriteMeshData; m_BindPoseController.bindPoseView = m_View; m_BindPoseController.selection = m_Selection; m_BindPoseController.undoObject = m_UndoObject; }
public void Setup() { m_SelectedVertices = new List <int>(); m_Selection = Substitute.For <ISelection>(); m_Selection.Count.Returns(x => m_SelectedVertices.Count); m_Selection.IsSelected(Arg.Any <int>()).Returns(x => m_SelectedVertices.Contains((int)x[0])); m_Selection.GetEnumerator().Returns(x => m_SelectedVertices.GetEnumerator()); m_Selection.single.Returns(x => { if (m_SelectedVertices.Count == 1) { return(m_SelectedVertices[0]); } return(-1); }); m_SpriteMeshData = new SpriteMeshData(); }
public void Setup() { m_MousePosition = Vector2.zero; m_HoveredVertex = -1; m_HoveredEdge = -1; m_ClosestEdge = -1; m_View = Substitute.For <ISpriteMeshView>(); m_View.mouseWorldPosition.Returns(x => m_MousePosition); m_View.hoveredVertex.Returns(x => m_HoveredVertex); m_View.hoveredEdge.Returns(x => m_HoveredEdge); m_View.closestEdge.Returns(x => m_ClosestEdge); m_View.WorldToScreen(Arg.Any <Vector2>()).Returns(x => ((Vector2)x[0] * 100f)); m_SelectedVertices = new List <int>(); m_Selection = Substitute.For <ISelection>(); m_Selection.Count.Returns(x => m_SelectedVertices.Count); m_Selection.IsSelected(Arg.Any <int>()).Returns(x => m_SelectedVertices.Contains((int)x[0])); m_Selection.GetEnumerator().Returns(x => m_SelectedVertices.GetEnumerator()); m_Selection.single.Returns(x => { if (m_SelectedVertices.Count == 1) { return(m_SelectedVertices[0]); } return(-1); }); m_UndoObject = Substitute.For <IUndoObject>(); m_Triangulator = Substitute.For <ITriangulator>(); m_SpriteMeshData = new SpriteMeshData(); m_SpriteMeshData.frame = new Rect(0f, 0f, 100f, 100f); m_SpriteMeshController = new SpriteMeshController(); m_SpriteMeshController.spriteMeshData = m_SpriteMeshData; m_SpriteMeshController.spriteMeshView = m_View; m_SpriteMeshController.selection = m_Selection; m_SpriteMeshController.undoObject = m_UndoObject; m_SpriteMeshController.triangulator = m_Triangulator; }
public void Select(ISelection aSelection) { if (aSelection == null) return; mSelection = null; IEnumerator<GridEntry> e = aSelection.GetEnumerator(); if (!e.MoveNext()) return; GridEntry entry = e.Current; chkTile.Checked = entry.Tile; chkTunnel.Checked = entry.Tunnel; chkExit.Checked = entry.Exit; rdoNone.Checked = entry.Block == BlockTypeEnum.None; rdoLow.Checked = entry.Block == BlockTypeEnum.Low; rdoHigh.Checked = entry.Block == BlockTypeEnum.High; numAltitude.Value = entry.Altitude; tileColor.PaletteIndex = entry.TilePaletteIndex; tileColor.Invalidate(); blockColor.PaletteIndex = entry.BlockPaletteIndex; blockColor.Invalidate(); blockGraphic1.Tile = entry.Tile; blockGraphic1.Tunnel = entry.Tunnel; blockGraphic1.Block = entry.Block; blockGraphic1.BlockColor = mLevel.Palette[entry.BlockPaletteIndex]; blockGraphic1.TileColor = mLevel.Palette[entry.TilePaletteIndex]; mSelection = aSelection; blockGraphic1.Invalidate(); }