//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new T_BM_KCXLXXApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intKCXLBHColumnIndex - 1].Visible = chkShowKCXLBH.Checked; gvPrint.Columns[intKCXLMCColumnIndex - 1].Visible = chkShowKCXLMC.Checked; gvPrint.Columns[intKCXLSJBHColumnIndex - 1].Visible = chkShowKCXLSJBH.Checked; gvPrint.Columns[intNLDColumnIndex - 1].Visible = chkShowNLD.Checked; gvPrint.Columns[intKSSColumnIndex - 1].Visible = chkShowKSS.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new DictionaryApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intDMColumnIndex - 1].Visible = chkShowDM.Checked; gvPrint.Columns[intLXColumnIndex - 1].Visible = chkShowLX.Checked; gvPrint.Columns[intMCColumnIndex - 1].Visible = chkShowMC.Checked; gvPrint.Columns[intSJDMColumnIndex - 1].Visible = chkShowSJDM.Checked; gvPrint.Columns[intSMColumnIndex - 1].Visible = chkShowSM.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new FilterReportApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intBGMCColumnIndex - 1].Visible = chkShowBGMC.Checked; gvPrint.Columns[intUserIDColumnIndex - 1].Visible = chkShowUserID.Checked; gvPrint.Columns[intBGLXColumnIndex - 1].Visible = chkShowBGLX.Checked; gvPrint.Columns[intGXBGColumnIndex - 1].Visible = chkShowGXBG.Checked; gvPrint.Columns[intXTBGColumnIndex - 1].Visible = chkShowXTBG.Checked; gvPrint.Columns[intBGCJSJColumnIndex - 1].Visible = chkShowBGCJSJ.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
public void ProcessIsRunning_Is_Running_If_Running() { Assert.IsFalse(FileLibrary.IsProcessRunning(processName)); startProcess(); Assert.IsTrue(FileLibrary.IsProcessRunning(processName)); }
private void Window_Loaded(object sender, RoutedEventArgs e) { if (typers == null) //first load { typers = new FileLibrary <Typer>("typers"); typers.LoadLibrary(); foreach (Typer typer in typers) { lbTypers.Items.Add(typer); } hotKeyManager = new HotKeyManager(this, new WindowInteropHelper(this).Handle); foreach (Typer typer in lbTypers.Items) { if (typer.IsActive) { typer.hotKeyId = hotKeyManager.RegisterFKey(typer.FKey); } } if (ApplicationDeployment.IsNetworkDeployed) { this.Title = this.Title + " " + ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(4); } } }
public void ComponentCopyFileAction_Copies_File_Not_Overwriting_Events_Message() { // Copy First File string fileNameCopied = "ComponentCopyFileAction_Copies_File_Not_Overwriting_With_Message_Event.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false); // Test that file exists and modify file bool fileExists = File.Exists(_pathCopied); Assert.IsTrue(fileExists); using (StreamWriter sw = File.AppendText(_pathCopied)) { sw.WriteLine("Test Text"); } // Set up event listener var wasCalled = false; FileLibrary.Messenger += (e) => wasCalled = true; // Copy second time string expectedPromptText = "File Cannot be Overwritten"; FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false, promptMessage: expectedPromptText); Assert.IsTrue(wasCalled); }
public void ComponentCopyFileAction_Copies_File_Not_Overwriting_With_No_Message() { // Copy First File string fileNameCopied = "ComponentCopyFileAction_Copies_File_Not_Overwriting_With_No_Message.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false); // Test that file exists and modify file bool fileExists = File.Exists(_pathCopied); Assert.IsTrue(fileExists); using (StreamWriter sw = File.AppendText(_pathCopied)) { sw.WriteLine("Test Text"); } // Copy second time, and check that modification is no longer present FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false); string[] readText = File.ReadAllLines(_pathCopied); int expectedNumberOfLines = 1; Assert.AreEqual(expectedNumberOfLines, readText.Length); }
/// <summary> /// 分页获取数据列表(承办单位表) /// </summary> public PeterPages GetSearch(FileLibrary FileLibrary, int PageIndex, int PageSize) { PeterPages fy = null; string sqlwhere = " 1=1 "; if (!string.IsNullOrEmpty(LoginUser.CountyId)) { sqlwhere = "QXDM='" + LoginUser.CountyId + "'"; } if (!string.IsNullOrEmpty(FileLibrary.FileLibraryName)) { sqlwhere = sqlwhere + " and FileLibraryName like '%" + FileLibrary.FileLibraryName + "%' "; } PageInfoNew entity = new PageInfoNew(); entity.Sqlwhere = sqlwhere.Trim(); entity.Tablename = "[FileLibrary]"; //用户表,注意如果是多表可以写成视图进行查询,这里就为视图名称 entity.PageSize = PageSize; entity.Fieldkey = "ID"; //主键 entity.Orderfield = " ID desc"; //排序字段 entity.PageIndex = PageIndex; entity.Fields = "*"; fy = SqlPageList.GetPageLists(entity); return(fy); }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new ShortMessageApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intDXXBTColumnIndex - 1].Visible = chkShowDXXBT.Checked; gvPrint.Columns[intDXXFJColumnIndex - 1].Visible = chkShowDXXFJ.Checked; gvPrint.Columns[intFSSJColumnIndex - 1].Visible = chkShowFSSJ.Checked; gvPrint.Columns[intFSRColumnIndex - 1].Visible = chkShowFSR.Checked; gvPrint.Columns[intFSBMColumnIndex - 1].Visible = chkShowFSBM.Checked; gvPrint.Columns[intSFCKColumnIndex - 1].Visible = chkShowSFCK.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载ExportToFile /// </summary> //===================================================================== protected override void ExportToFile() { appData = new ShortMessageApplicationData(); appData.OPCode = RICH.Common.Base.ApplicationData.ApplicationDataBase.OPType.ID; appData.ObjectID = base.ObjectID; QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; case "pdf": string pageSize = ddlPrintPageSize.SelectedValue; bool boolOrientation = ddlPrintPageOrientation.SelectedValue == "landscape" ? true : false; float marginTop = DataValidateManager.ValidateNumberFormat(txtMarginTop.Text) == true ? Convert.ToSingle(txtMarginTop.Text) : 50; float marginRight = DataValidateManager.ValidateNumberFormat(txtMarginRight.Text) == true ? Convert.ToSingle(txtMarginRight.Text) : 50; float marginBottom = DataValidateManager.ValidateNumberFormat(txtMarginBottom.Text) == true ? Convert.ToSingle(txtMarginBottom.Text) : 50; float marginLeft = DataValidateManager.ValidateNumberFormat(txtMarginLeft.Text) == true ? Convert.ToSingle(txtMarginLeft.Text) : 50; ExportToPDFFile(appData.ResultSet, "Result", pageSize, boolOrientation, marginTop, marginRight, marginBottom, marginLeft); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
/// <summary> /// Extrae el nombre, la base de datos asociada y el tipo de todos los archivos referenciados en el excel /// </summary> /// <returns>Una estructura que contiene los datos del documento en strings</returns> public FileLibrary createExcelLibrary() { Workbook document = new Workbook(); document.LoadFromFile(documentPath); Worksheet hoja = document.Worksheets[0]; FileLibrary fl = new FileLibrary(null, null, null, null); foreach (CellRange l in hoja.Rows) { String db = l.Cells[0].DisplayedText; if (db.Length == 0) { break; } String type = l.Cells[1].DisplayedText; String file = l.Cells[2].DisplayedText; String nuevo = l.Cells[3].DisplayedText; FileLibrary rowLibrary = new FileLibrary(db, type, file, nuevo); fl.addLibrary(rowLibrary); } document.Dispose(); return(fl.getNextInLine()); }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new T_PM_UserGroupInfoApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intUserGroupIDColumnIndex - 1].Visible = chkShowUserGroupID.Checked; gvPrint.Columns[intUserGroupNameColumnIndex - 1].Visible = chkShowUserGroupName.Checked; gvPrint.Columns[intUserGroupContentColumnIndex - 1].Visible = chkShowUserGroupContent.Checked; gvPrint.Columns[intUserGroupRemarkColumnIndex - 1].Visible = chkShowUserGroupRemark.Checked; gvPrint.Columns[intDefaultPageColumnIndex - 1].Visible = chkShowDefaultPage.Checked; gvPrint.Columns[intUpdateDateColumnIndex - 1].Visible = chkShowUpdateDate.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
//===================================================================== // FunctionName : ExportToFile /// <summary> /// 重载导出到文件函数 /// </summary> //===================================================================== protected override void ExportToFile() { CustomColumnIndex(); appData = new T_BG_0602ApplicationData(); QueryRecord(); gvPrint.Visible = true; gvPrint.DataSource = appData.ResultSet; gvPrint.DataBind(); gvPrint.Columns[intLMHColumnIndex - 1].Visible = chkShowLMH.Checked; gvPrint.Columns[intLMMColumnIndex - 1].Visible = chkShowLMM.Checked; gvPrint.Columns[intSJLMHColumnIndex - 1].Visible = chkShowSJLMH.Checked; gvPrint.Columns[intLMNRColumnIndex - 1].Visible = chkShowLMNR.Checked; gvPrint.Columns[intLMLBYSColumnIndex - 1].Visible = chkShowLMLBYS.Checked; gvPrint.Columns[intSFLBLMColumnIndex - 1].Visible = chkShowSFLBLM.Checked; gvPrint.Columns[intSFWBURLColumnIndex - 1].Visible = chkShowSFWBURL.Checked; // 创建信息标题 gvPrint.Caption = GetTableCaption(); gvPrint.CaptionAlign = TableCaptionAlign.Left; switch (ddlExportFileFormat.SelectedValue.ToLower()) { case "xls": FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; case "doc": FileLibrary.ExportToWordFile(gvPrint, "Result"); break; default: FileLibrary.ExportToExcelFile(gvPrint, "Result"); break; } gvPrint.Visible = false; }
// Use this for initialization void Start() { string stages = Resources.Load ("Stage/list").ToString(); string[] names = stages.Split ('\n'); for (int i=0; i<names.Length; i++) { string folderName = names[i]; if(names[i][names[i].Length - 1] == '\r'){ folderName = names[i].Remove (names[i].Length - 1); } PackData p = new FileLibrary().ReadPack (folderName); GameObject t = Instantiate(button) as GameObject; t.transform.SetParent(canvas.transform); t.transform.Find("Text").GetComponent<Text>().text = p.packName; t.GetComponent<Button>().onClick.AddListener(() => {StartGame (p);}); t.transform.position = new Vector3(0, -i * 60, 0); } /* System.IO.DirectoryInfo Info = new System.IO.DirectoryInfo (Application.dataPath + "/Resources/Stage"); int idx = 0; if (Info.Exists) { System.IO.DirectoryInfo[] CInfo = Info.GetDirectories("*",System.IO.SearchOption.AllDirectories); foreach (System.IO.DirectoryInfo info in CInfo) { PackData p = new FileLibrary().ReadPack (info.ToString()); Debug.Log (info.ToString()); GameObject t = Instantiate(button) as GameObject; t.transform.SetParent(canvas.transform); t.transform.Find("Text").GetComponent<Text>().text = p.packName; t.GetComponent<Button>().onClick.AddListener(() => {StartGame (p);}); t.transform.position = new Vector3(0, -idx * 60, 0); idx++; } }*/ }
public long SecureUpload(string accessKey, long siteId, long[] groupIds, long userId, string title, string description, string fileFullPath, string fileContent, string size) { FileLibrary fl = new FileLibrary(); System.IO.Stream fileStream = new System.IO.MemoryStream(Convert.FromBase64String(fileContent)); return(fl.Upload(siteId, groupIds, userId, title, description, fileFullPath, fileStream, false, size)); }
public void ComponentSetAttributeAction_For_NonExisting_File() { string fileNameCopied = "ComponentSetAttributeAction_For_NonExisting_File.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); Assert.DoesNotThrow(() => FileLibrary.ComponentSetAttributeAction(_pathCopied, FileAttributes.ReadOnly)); }
public void CheckFilesExist_SearchForNonexistentFiles_ThrowsException() { //Act TestDelegate td = () => FileLibrary.CheckFilesExist(testFilesDirPath, "SomeFile.txt", 1, 1); //Assert Assert.Throws(typeof(ValidationException), td, "Objects are not equal (actual='0', expected='1')."); }
public void CheckFilesExist_SearchForExistingFiles_DoNotThrowsException() { //Act TestDelegate td = () => FileLibrary.CheckFilesExist(testFilesDirPath, "TextFile*", 5, 1); //Assert Assert.DoesNotThrow(td); }
public void SecureUpdate(string accessKey, long siteId, long fileId, long[] groupIds, string title, string description, string fileFullPath, string fileContent, string size) { FileLibrary fl = new FileLibrary(); System.IO.Stream fileStream = new System.IO.MemoryStream(Convert.FromBase64String(fileContent)); fl.Update(fileId, groupIds, title, description, fileFullPath, fileStream, null, size); }
public void ComponentCopyFileAction_Copies_Blank_Source_Path() { string fileNameCopied = "ComponentCopyFileAction_Copies_Blank_Source_Path.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); FileLibrary.ComponentCopyFileAction("", _pathCopied, overWriteFile: false); Assert.IsFalse(File.Exists(_pathCopied)); }
/// <summary> /// Une una lista al final de la que llame esta función /// </summary> /// <param name="rowLibrary"></param> internal void addLibrary(FileLibrary rowLibrary) { if (next == null) { next = rowLibrary; return; } next.addLibrary(rowLibrary); }
public void DeleteFile_Not_Existing_Returns_True() { string fileNameCopied = "DeleteFile_Not_Existing_Returns_True.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); Assert.IsFalse(File.Exists(_pathCopied)); Assert.IsTrue(FileLibrary.DeleteFile(_pathCopied)); }
public void EndProcess_Ends_Process_If_Present() { Assert.IsFalse(FileLibrary.IsProcessRunning(processName)); startProcess(); Assert.IsTrue(FileLibrary.IsProcessRunning(processName)); FileLibrary.EndProcess(processName); Assert.IsFalse(FileLibrary.IsProcessRunning(processName)); }
public void ComponentCopyFileAction_Copies_New_File_Under_Old_Name_To_New_Directory() { string newDirectory = Path.Combine(_assemblyFolder, "newDirectory"); _pathCopied = Path.Combine(newDirectory, _fileNameOriginal); FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false); Assert.IsTrue(File.Exists(_pathCopied)); }
public void ComponentCopyFileAction_Copies_New_File_Under_New_Name() { string fileNameCopied = "ComponentCopyFileAction_Copies_New_File_Under_New_Name.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); FileLibrary.ComponentCopyFileAction(_pathOriginal, _pathCopied, overWriteFile: false); Assert.IsTrue(File.Exists(_pathCopied)); }
public void IsFileReadOnly_For_Readable_File_Returns_False() { // Set up temporary sample file to alter string fileNameCopied = "IsReadableFileReadOnly.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); File.Copy(_pathOriginal, _pathCopied); Assert.IsFalse(FileLibrary.IsFileReadOnly(_pathCopied)); }
/// <summary> /// Genera los scripts de los archivos mencionados en el documento /// </summary> /// <param name="library">Lista que contiene los datos de archivos mencionados en el documento</param> /// <param name="place">Ubicación en donde se creará los archivos</param> internal void generateScripts(FileLibrary library, String place) { while (library != null) { Wrapper file = this.serverExplorer(library.dbName, library.type, library.fileName); ScriptLocation sl = new ScriptLocation(library.dbName, library.type, library.fileName, file.script(library.newStatus, alter)); PkgCreator.createFile(sl, place); library = library.getNextInLine(); } }
public void ComponentDeleteFileAction_Handles_NonExisting_File() { string fileNameCopied = "ComponentDeleteFileAction_Handles_NonExisting_File.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); Assert.IsFalse(File.Exists(_pathCopied)); FileLibrary.ComponentDeleteFileAction(_pathCopied); Assert.IsFalse(File.Exists(_pathCopied)); }
public void ComponentCopyFileAction_Events_Log_From_Exception() { // Set up event listener var wasCalled = false; FileLibrary.Log += (e) => wasCalled = true; FileLibrary.ComponentCopyFileAction(_pathOriginal, "", overWriteFile: false); Assert.IsTrue(wasCalled); }
public void ComponentSetAttributeAction_For_Existing_File() { // Set up temporary sample file to alter string fileNameCopied = "ComponentSetAttributeAction_For_Existing_File.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); File.Copy(_pathOriginal, _pathCopied); FileLibrary.ComponentSetAttributeAction(_pathCopied, FileAttributes.ReadOnly); Assert.AreEqual(FileAttributes.ReadOnly, (File.GetAttributes(_pathCopied) & FileAttributes.ReadOnly)); }
public void ComponentCopyFileAction_Copies_NonExisting_File() { string nonExistingFilePath = Path.Combine(_assemblyFolder, "NonExistingFile.txt"); string fileNameCopied = "ComponentCopyFileAction_Copies_NonExisting_File.txt"; _pathCopied = Path.Combine(_assemblyFolder, fileNameCopied); FileLibrary.ComponentCopyFileAction(nonExistingFilePath, _pathCopied, overWriteFile: false); Assert.IsFalse(File.Exists(_pathCopied)); }
void GenerateMap() { f = new FileLibrary(); f.ReadFile (GameData.path + "/stage"+GameData.currentStage); deathText.GetComponent<Text>().text = GameData.currentDeath + " / " + GameData.maxDeath + " deaths"; stageText.GetComponent<Text>().text = GameData.currentStage + " / " + GameData.maxStage; title.GetComponent<Text>().text = f.stageData.StageTitle; background.transform.localScale = new Vector3 ((f.stageData.width + 2) * f.stageData.blockSize / 10, 1, (f.stageData.height + 2) * f.stageData.blockSize / 10); startPosition.transform.localScale = new Vector3 (f.stageData.blockSize / 10, 1, f.stageData.blockSize / 10); startPosition.transform.position = new Vector3(f.stageData.startPosition[0]*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,1,-f.stageData.startPosition[1]*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); endPosition.transform.localScale = new Vector3 (f.stageData.blockSize / 10, 1, f.stageData.blockSize / 10); endPosition.transform.position = new Vector3(f.stageData.endPosition[0]*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,1,-f.stageData.endPosition[1]*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); int mCount = f.stageData.graphicSource.Length; ts = new Texture[mCount]; for (int i=0; i<mCount; i++) { ts[i] = new Texture(); ts[i] = Resources.Load ("Stage/"+GameData.path+"/"+f.stageData.graphicSource[i], typeof(Texture)) as Texture; } for (int i=0; i<f.stageData.width; i++) { for (int j=0; j<f.stageData.height; j++) { if(f.stageData.map[i, j] == '1'){ GameObject t = Instantiate(obstacle) as GameObject; t.transform.position = new Vector3(i*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,0,-j*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); t.transform.localScale = new Vector3(f.stageData.blockSize,f.stageData.blockSize,1); t.GetComponent<Renderer>().material.mainTexture = ts[f.stageData.graphic[i, j] - 'a']; oList.Add (t); }else{ GameObject t = Instantiate(movable) as GameObject; t.transform.position = new Vector3(i*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,0,-j*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); t.transform.localScale = new Vector3(f.stageData.blockSize,f.stageData.blockSize,1); t.GetComponent<Renderer>().material.mainTexture = ts[f.stageData.graphic[i, j] - 'a']; mList.Add (t); } } } /* foreach(var locations in f.stageData.locations){ GameObject t = Instantiate(location) as GameObject; t.transform.position = new Vector3(locations.Value[0]*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,0,-locations.Value[1]*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); t.transform.localScale = new Vector3(f.stageData.blockSize,f.stageData.blockSize,1); lList.Add (locations.Key, t); }*/ seeker.transform.position = new Vector3(f.stageData.startPosition[0]*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,0,-f.stageData.startPosition[1]*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); target.transform.position = new Vector3(f.stageData.startPosition[0]*f.stageData.blockSize-(f.stageData.width - 1) * f.stageData.blockSize / 2,0,-f.stageData.startPosition[1]*f.stageData.blockSize+(f.stageData.height - 1) * f.stageData.blockSize / 2); //UnityEditor.NavMeshBuilder.BuildNavMesh (); }