private void createShape(System.Windows.Forms.DragEventArgs e) { _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e); _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e); _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e); Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length); if (_assetPaths.Length == 0) { return; } if (_assetTypes[0] == "Model") { EntityShape entity = new EntityShape(_assetNames[0]); entity.EntityClass = "VisBaseEntity_cl"; entity.ModelFile = _assetPaths[0]; _dummyShape = entity; } else if (_assetTypes[0] == "StaticMesh") { StaticMeshShape staticMesh = new StaticMeshShape(_assetNames[0]); staticMesh.MeshFileName = _assetPaths[0]; _dummyShape = staticMesh; } else if (_assetTypes[0] == "Prefab") { PrefabShape prefabShape = new PrefabShape(_assetNames[0]); prefabShape.Filename = _assetPaths[0]; _dummyShape = prefabShape; } }
/// <summary> /// This method generates a new set of player /// controlled tiles at the top of the grid /// </summary> public void GenerateNewPlayerTiles() { PrefabShape tempShape = Instantiate(GameManager.Instance.GetShapeToGenerate()).GetComponent <PrefabShape>(); if (playerTiles != null) { playerTiles.Clear(); } playerTiles = tempShape.shapeInfo; canRotate = tempShape.enableRotate; currentRotation = tempShape.rotateState; foreach (Coordinate c in playerTiles) { if (c.isCenter) { c.row = outputStream.GenerateRow; c.col = outputStream.boardWidth / 2; } else { c.row = outputStream.GenerateRow + c.row; c.col = (outputStream.boardWidth / 2) + c.col; } grid[c.row][c.col].GainTile(c.tile); } }
void EditorManager_ProcessExternalFileDrop(object sender, ExternalFileDropArgs e) { if (!e.Data.GetDataPresent(DataFormats.FileDrop)) { return; } if (EditorManager.Scene == null) { return; } string filename = ((string[])e.Data.GetData(DataFormats.FileDrop))[0]; if (!EditorManager.Project.CheckRelative(filename)) { EditorManager.ShowMessageBox("Cannot drop file \n\n" + filename + "\n\n because it is not project relative", "Cannot drop object", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } filename = EditorManager.Project.MakeRelative(filename); string extension = Path.GetExtension(filename); string name = Path.GetFileNameWithoutExtension(filename); if (string.Compare(extension, ".model", true) == 0) { EntityShape shape = new EntityShape(name); shape.ModelFile = filename; EditorManager.ActiveView.DropObject(shape, e); } else if (string.Compare(extension, ".vmesh", true) == 0) { StaticMeshShape shape = new StaticMeshShape(name); shape.MeshFileName = filename; EditorManager.ActiveView.DropObject(shape, e); } else if (string.Compare(extension, ".prefab", true) == 0) { PrefabShape shape = new PrefabShape(name); shape.Filename = filename; EditorManager.ActiveView.DropObject(shape, e); } }
private void createShape(System.Windows.Forms.DragEventArgs e) { _assetPaths = CSharpFramework.Contexts.IDropContext.GetAssetPaths(e); _assetTypes = CSharpFramework.Contexts.IDropContext.GetAssetTypes(e); _assetNames = CSharpFramework.Contexts.IDropContext.GetAssetNames(e); Debug.Assert(_assetPaths.Length == _assetTypes.Length && _assetPaths.Length == _assetNames.Length); if (_assetPaths.Length == 0) return; if (_assetTypes[0] == "Model") { EntityShape entity = new EntityShape(_assetNames[0]); entity.EntityClass = "VisBaseEntity_cl"; entity.ModelFile = _assetPaths[0]; _dummyShape = entity; } else if (_assetTypes[0] == "StaticMesh") { StaticMeshShape staticMesh = new StaticMeshShape(_assetNames[0]); staticMesh.MeshFileName = _assetPaths[0]; _dummyShape = staticMesh; } else if (_assetTypes[0] == "Prefab") { PrefabShape prefabShape = new PrefabShape(_assetNames[0]); prefabShape.Filename = _assetPaths[0]; _dummyShape = prefabShape; } }
void EditorManager_ProcessExternalFileDrop(object sender, ExternalFileDropArgs e) { if (!e.Data.GetDataPresent(DataFormats.FileDrop)) return; if (EditorManager.Scene == null) return; string filename = ((string[])e.Data.GetData(DataFormats.FileDrop))[0]; if (!EditorManager.Project.CheckRelative(filename)) { EditorManager.ShowMessageBox("Cannot drop file \n\n" + filename + "\n\n because it is not project relative", "Cannot drop object", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } filename = EditorManager.Project.MakeRelative(filename); string extension = Path.GetExtension(filename); string name = Path.GetFileNameWithoutExtension(filename); if (string.Compare(extension, ".model", true) == 0) { EntityShape shape = new EntityShape(name); shape.ModelFile = filename; EditorManager.ActiveView.DropObject(shape, e); } else if (string.Compare(extension, ".vmesh", true) == 0) { StaticMeshShape shape = new StaticMeshShape(name); shape.MeshFileName = filename; EditorManager.ActiveView.DropObject(shape, e); } else if (string.Compare(extension, ".prefab", true) == 0) { PrefabShape shape = new PrefabShape(name); shape.Filename = filename; EditorManager.ActiveView.DropObject(shape, e); } }