/// <summary> /// 设置spr文件名,会自动出现预览界面 /// </summary> /// <param name="strFileName">SPR文件名,包含全路经</param> public void SetFileName(string strFileName, Test3DEngine engine) { if (strFileName.LastIndexOf('.') == -1) { throw (new Exception("传入文件名不合法")); } string strExt = strFileName.Substring(strFileName.LastIndexOf('.') + 1).ToLower(); ft.timer1.Enabled = false; ft.labError.Visible = false; this.strFileName = strFileName; if (!File.Exists(strFileName)) { ft.labError.Visible = true; ft.pb1.Image = new Bitmap(10, 10); return; } SPRItem si; if (strExt == "mdl") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MDL, engine); } else if (strExt == "mtl") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MTL, engine); } else if (strExt == "mesh") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MESH, engine); } else if (strExt == "ani") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.ANI, engine); } else if (strExt == "tani") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.ANI, engine); } else //spr { si = new SPRItem(strFileName); } ft.sio = si; ft.timer1.Enabled = true; }
/// <summary> /// 设置spr文件名,会自动出现预览界面 /// </summary> /// <param name="strFileName">SPR文件名,包含全路经</param> public void SetFileName(string strFileName, Test3DEngine engine) { if (strFileName.LastIndexOf('.') == -1) { throw (new Exception("传入文件名不合法")); } string strExt = strFileName.Substring(strFileName.LastIndexOf('.') + 1).ToLower(); ft.timer1.Enabled = false; ft.labError.Visible = false; this.strFileName = strFileName; if(!File.Exists(strFileName)) { ft.labError.Visible = true; ft.pb1.Image = new Bitmap(10, 10); return; } SPRItem si; if(strExt == "mdl") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MDL, engine); } else if(strExt == "mtl") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MTL, engine); } else if (strExt == "mesh") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.MESH, engine); } else if (strExt == "ani") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.ANI, engine); } else if (strExt == "tani") { si = new SPRItem(strFileName, SPRItem.PIC_TYPE.ANI, engine); } else //spr { si = new SPRItem(strFileName); } ft.sio = si; ft.timer1.Enabled = true; }
/// <summary> /// 设置UITex文件名 /// </summary> /// <param name="strFileName"></param> /// <param name="nFrame">帧数</param> public void SetUtexFileName(string strFileName, int nFrame) { ft.timer1.Enabled = false; ft.labError.Visible = false; this.strFileName = strFileName; SPRItem si; if (!File.Exists(strFileName)) { ft.labError.Visible = true; ft.pb1.Image = new Bitmap(10, 10); return; } si = new SPRItem(strFileName, nFrame); ft.sio = si; ft.timer1.Enabled = true; }