protected override void OnMouseUp(MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (bSelectingRect) { bSelectingRect = false; slideTimer.Enabled = false; Capture = false; bSelection = true; Rectangle r = Rectangle.FromLTRB( Math.Min(mtx, mtx1), Math.Min(mty, mty1), Math.Max(mtx, mtx1), Math.Max(mty, mty1)); selection.clear(); selection.setRectangle(r, true); originalSelection = selection.copy(); editLayer = new TileEditLayer(selection); Invalidate(); } if (bDraggingTiles) { slideTimer.Enabled = false; Capture = false; bSelection = true; bDraggingTiles = false; Invalidate(); } } }
public EditLayerRow(EditLayer eLayer) { _eLayer = eLayer; if (_eLayer == null) { return; } DataGridViewTextBoxCell cell = new DataGridViewTextBoxCell(); cell.Value = _eLayer.FeatureLayer.Title; this.Cells.Add(cell); DataGridViewCheckBoxCell c = new DataGridViewCheckBoxCell(); c.Value = Bit.Has(_eLayer.AllowedStatements, EditStatements.INSERT); this.Cells.Add(c); c = new DataGridViewCheckBoxCell(); c.Value = Bit.Has(_eLayer.AllowedStatements, EditStatements.UPDATE); this.Cells.Add(c); c = new DataGridViewCheckBoxCell(); c.Value = Bit.Has(_eLayer.AllowedStatements, EditStatements.DELETE); this.Cells.Add(c); }
protected override void OnMouseMove(MouseEventArgs e) { base.OnMouseMove(e); EditLayer editingLayer = this._editLayers.Find(one => one.Editing); if (editingLayer != null) { editingLayer.CurrentLocation = e.Location; } this.InvalidateLayers(); }
public void RemoveModel(Model model) { EditLayer layer = this.CurrentLayer; this.AddCommand(new Command( () => { layer.RemoveModel(model, true); }, () => { layer.AddModel(model); })); }
public void RemoveObjects(Block[] blocks, Model[] models) { EditLayer layer = this.CurrentLayer; this.AddCommand(new Command( () => { layer.RemoveBlocks(blocks); layer.RemoveModels(models, true); }, () => { layer.AddModels(models); layer.AddBlocks(blocks); })); }
public void AddModel(Vector3 position, int rotation) { EditLayer layer = this.CurrentLayer; var modelShape = ModelShape.Find(this.toolModel); var model = new Model(modelShape, position, rotation); this.AddCommand(new Command( () => { layer.AddModel(model); }, () => { layer.RemoveModel(model, true); })); }
public void PaintBlock(Block block, BlockDirection direction, bool isObject, int textureChip) { EditLayer layer = this.CurrentLayer; int oldTextureChip = block.GetTextureChip(direction, isObject); this.AddCommand(new Command( () => { block.SetTextureChip(direction, isObject, textureChip); layer.SetDirty(); }, () => { block.SetTextureChip(direction, isObject, oldTextureChip); layer.SetDirty(); })); }
public void RemoveBlock(Vector3 position) { EditLayer layer = this.CurrentLayer; Block block = layer.GetBlock(position); if (block == null) { return; } this.AddCommand(new Command( () => { layer.RemoveBlock(block); }, () => { layer.AddBlock(block); })); }
public void SetEnterable(Block block, bool enterable) { EditLayer layer = this.CurrentLayer; bool oldEnterable = block.enterable; this.AddCommand(new Command( () => { block.enterable = enterable; layer.SetDirty(); this.RoutePath.dirtyMesh = true; }, () => { block.enterable = oldEnterable; layer.SetDirty(); this.RoutePath.dirtyMesh = true; })); }
public ActionResult EditLayer(EditLayer layer, int InstanceID) { if (ModelState.IsValid) { var thisLayer = db.Layers.DefaultIfEmpty(null).FirstOrDefault(x => x.LayerID == layer.LayerID && x.InstanceID == layer.InstanceID); if (thisLayer == null) { ModelState.AddModelError("LayerID", "Invalid Layer Selected"); return(Json(new { error = Generic.GetValidationErrors(ModelState) })); } thisLayer.editLayer(layer); db.SaveChanges(); return(Json(new { layer = new JsonLayer(thisLayer) })); } return(Json(new { error = Generic.GetValidationErrors(ModelState) })); }
// 現在のレイヤーを設定 public void SetCurrentLayer(EditLayer layer) { var originalRenderer = layer.GetComponent <MeshRenderer>(); if (originalRenderer == null) { Debug.LogError("Renderer not found in Original Layer."); return; } var captureRenderer = this.captureLayer.GetComponent <MeshRenderer>(); if (captureRenderer == null) { Debug.LogError("Renderer not found in Capture Layer."); return; } captureRenderer.material = originalRenderer.material; }
public void AddObjects(Block[] blocks, Model[] models) { EditLayer layer = this.CurrentLayer; Block[] removedBlocks = null; // 上書きされたブロック Model[] removedModels = null; // 上書きされたモデル this.AddCommand(new Command( () => { removedBlocks = layer.AddBlocks(blocks); removedModels = layer.AddModels(models); }, () => { layer.RemoveModels(models, true); layer.RemoveBlocks(blocks); layer.AddBlocks(removedBlocks); layer.AddModels(removedModels); removedBlocks = null; removedModels = null; })); }
void Awake() { var blockGuideObj = new GameObject(); blockGuideObj.name = "SelectedBlocks"; blockGuideObj.transform.parent = this.transform; this.selectedBlockGuide = blockGuideObj.AddComponent <Guide>(); var modelObj = new GameObject(); modelObj.name = "SelectedModels"; modelObj.transform.parent = this.transform; this.selectedModelGuide = modelObj.AddComponent <Guide>(); var captureObj = new GameObject(); captureObj.name = "Captured"; captureObj.transform.parent = this.transform; this.captureLayer = captureObj.AddComponent <EditLayer>(); this.SetColorMode(ColorMode.Selection); }
public void AddBlock(Vector3 position, BlockDirection direction) { EditLayer layer = this.CurrentLayer; BlockShape shape = BlockShape.Find(this.toolBlock); if (shape == null) { return; } Block block = new Block(position, direction, shape); if (block == null) { return; } this.AddCommand(new Command( () => { layer.AddBlock(block); }, () => { layer.RemoveBlock(block); })); }
public void RemoveLayer(EditLayer layer) { this.Layers.Remove(layer); GameObject.Destroy(layer.gameObject); this.LayerListView.UpdateView(); }
public void MoveObjects(Block[] blocks, Model[] models, Vector3 moveVector, Vector3 centerPosition, int rotation) { EditLayer layer = this.CurrentLayer; Block[] removedBlocks = null; // 上書きされたブロック Model[] removedModels = null; // 上書きされたモデル if (blocks.Length == 0 && models.Length == 0) { return; } this.AddCommand(new Command( () => { // レイヤーから一旦削除 layer.RemoveBlocks(blocks); layer.RemoveModels(models, false); // ブロックを移動回転させる foreach (var block in blocks) { Vector3 offset = block.position - centerPosition; offset = EditUtil.RotatePosition(offset, rotation); block.SetPosition(centerPosition + offset + moveVector); block.SetDirection(EditUtil.RotateDirection(block.direction, rotation)); } // モデルを移動回転させる foreach (var model in models) { Vector3 offset = model.position - centerPosition; offset = EditUtil.RotatePosition(offset, rotation); model.SetPosition(centerPosition + offset + moveVector); model.SetRotation(model.rotation + rotation * 90); } // レイヤーに戻す removedBlocks = layer.AddBlocks(blocks); removedModels = layer.AddModels(models); }, () => { // レイヤーから一旦削除 layer.RemoveBlocks(blocks); layer.RemoveModels(models, false); // 退避したブロックを復活させる layer.AddBlocks(removedBlocks); layer.AddModels(removedModels); removedBlocks = null; removedModels = null; // ブロックを逆方向に移動回転させる foreach (var block in blocks) { Vector3 offset = block.position - centerPosition - moveVector; offset = EditUtil.RotatePosition(offset, -rotation); block.SetPosition(centerPosition + offset); block.SetDirection(EditUtil.RotateDirection(block.direction, -rotation)); } // モデルを逆方向に移動回転させる foreach (var model in models) { Vector3 offset = model.position - centerPosition - moveVector; offset = EditUtil.RotatePosition(offset, -rotation); model.SetPosition(centerPosition + offset); model.SetRotation(model.rotation - rotation * 90); } // レイヤーに戻す layer.AddBlocks(blocks); layer.AddModels(models); })); }
public EditLayer(EditLayer editLayer) { this.LayerId = editLayer.LayerId; this.ClassName = editLayer.ClassName; this.Statements = editLayer.Statements; }
internal void AddEditLayer(EditLayer editLayer) { _editLayers.Add(editLayer); }