public bool CheckCommandPermission() { //Todo: make this not scenario specific. return(CoreGlobals.getEditorMain().mPhoenixScenarioEditor.CheckTopicPermission(mSettings.TopicName)); }
static int Main(string[] args) { #if !DEBUG try #endif { long g_version_number = 2; bool bQuiet = false; bool bCivs = false; bool bOutputTree = false; bool bOutputImage = false; bool bFileSizes = false; bool bOutputUnitList = false; string logFileName = null; string logErrorFileName = null; List <string> m_filesToLoad = new List <string>(); // Process command line arguments // int argc = args.GetLength(0); for (int i = 0; i < argc; i++) { string argument = args[i]; if (argument.StartsWith("-")) { switch (argument.ToLower()) { case "-quiet": bQuiet = true; break; case "-civs": bCivs = true; break; case "-outputtree": bOutputTree = true; break; case "-outputunitlist": bOutputUnitList = true; break; case "-outputimage": bOutputImage = true; break; case "-filesize": bFileSizes = true; break; case "-logfile": i++; logFileName = args[i]; break; case "-errorlogfile": i++; logErrorFileName = args[i]; break; default: ConsoleOut.Write(ConsoleOut.MsgType.Error, "Invalid parameter: {0}.\n", argument); printHelp(g_version_number); return(1); } } else { string filename = null; if (Path.IsPathRooted(argument)) { if (argument.StartsWith(CoreGlobals.getWorkPaths().mGameDirectory, true, System.Globalization.CultureInfo.CurrentCulture)) { filename = argument.Substring(CoreGlobals.getWorkPaths().mGameDirectory.Length + 1); } else { ConsoleOut.Write(ConsoleOut.MsgType.Error, "Invalid file \"{0}\". File must reside in the within the Game directory: \"{1}\".\n", argument, CoreGlobals.getWorkPaths().mGameDirectory); } } else { filename = argument; } if (!String.IsNullOrEmpty(filename)) { m_filesToLoad.Add(filename); } } } if ((!bCivs) && (m_filesToLoad.Count == 0)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "No files specified to process!\n"); printHelp(g_version_number); return(1); } ConsoleOut.init(bQuiet, logFileName, logErrorFileName); // process civs // if (bCivs) { // Read database Database.init(); ConsoleOut.Write(ConsoleOut.MsgType.Info, "Archiving Civs...\n"); int civCount = Database.getCivCount(); for (int i = 0; i < civCount; i++) { string civName = Database.getCivName(i); // Get the list of vis files needed for this civ // List <string> dependenciesList = new List <string>(); Database.processCiv(i, dependenciesList, bOutputUnitList); if (!bOutputUnitList) { // Now compute all dependencies for each vis file DependencyTree dependencyTree = new DependencyTree(dependenciesList); dependencyTree.process(); string outputFilename; if (bOutputTree) { // Write .xml file outputFilename = civName.ToLower() + ".xml"; dependencyTree.writeFileXML(outputFilename, false); } else { // Write .txt file outputFilename = civName.ToLower() + ".txt"; dependencyTree.writeFileTxt(outputFilename); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "Wrote File \"{0}\".\n", outputFilename); if (bOutputImage) { // Write tree hierarchy image string outputTreeFilename = civName.ToLower() + ".png"; dependencyTree.writeGraphPNG(outputTreeFilename); ConsoleOut.Write(ConsoleOut.MsgType.Info, "Wrote Tree Image File \"{0}\".\n", outputTreeFilename); } } else { dependenciesList.Sort(); string outputFilename = civName.ToLower() + ".txt"; using (StreamWriter sw = File.CreateText(outputFilename)) { foreach (string name in dependenciesList) { sw.WriteLine(name); } sw.Close(); } } } } // process all files // foreach (string filename in m_filesToLoad) { // must initialize database for scenario or cin files if (!Database.isInitialized()) { if ((String.Compare(Path.GetExtension(filename), ".scn", true) == 0) || (String.Compare(Path.GetExtension(filename), ".cin", true) == 0)) { Database.init(); } } List <string> fileList = new List <string>(); fileList.Add(filename); DependencyTree dependencyTree = new DependencyTree(fileList); dependencyTree.process(); string outputFilename; if (bOutputTree) { // Write .xml file outputFilename = Path.ChangeExtension(Path.GetFileName(filename), ".xml"); dependencyTree.writeFileXML(outputFilename, bFileSizes); } else { // Write .txt file outputFilename = Path.ChangeExtension(Path.GetFileName(filename), ".txt"); dependencyTree.writeFileTxt(outputFilename); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "\n"); ConsoleOut.Write(ConsoleOut.MsgType.Info, "Writing File \"{0}\".\n", outputFilename); if (bOutputImage) { // Write tree hierarchy image string outputTreeFilename = Path.ChangeExtension(Path.GetFileName(filename), ".png"); ConsoleOut.Write(ConsoleOut.MsgType.Info, "Writing Tree Image File \"{0}\".\n", outputTreeFilename); dependencyTree.writeGraphPNG(outputTreeFilename); } if (bOutputUnitList) { // Write unit list string outputUnitListFilename = Path.ChangeExtension(Path.GetFileName(filename), ".unitlist"); ConsoleOut.Write(ConsoleOut.MsgType.Info, "Writing Unit List File \"{0}\".\n", outputUnitListFilename); dependencyTree.writeUnitListTxt(outputUnitListFilename); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "\n"); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "Done.\n"); ConsoleOut.deinit(); } #if !DEBUG catch (System.Exception ex) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "Unhandled exception!\n"); if (System.Diagnostics.Debugger.IsAttached) { throw ex; } return(1); } #endif return(0); }
public void postTEDLoad(bool selectdIndexChanged) { try { if (selectdIndexChanged) { if (comboBox1.SelectedIndex != 0) { comboBox1.SelectedIndex = 0; redrawPreviewList(0); } if (TerrainGlobals.getEditor().getMode() == BTerrainEditor.eEditorMode.cModeTexEdit) { SelectButton((TerrainTextureButton)flowLayoutPanel1.Controls[firstSplatIndex() + TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex]); } else if (TerrainGlobals.getEditor().getMode() == BTerrainEditor.eEditorMode.cModeDecalEdit) { SelectButton((TerrainTextureButton)flowLayoutPanel1.Controls[firstDecalIndex() + TerrainGlobals.getTerrainFrontEnd().SelectedDecalIndex]); } } else { if (redrawList != null) { this.Invoke(redrawList); } } } catch (System.Exception ex) { if (mbPostTEDLoadRecovery) { CoreGlobals.getErrorManager().LogErrorToNetwork(ex.ToString()); try { if (TerrainGlobals.getEditor().getMode() == BTerrainEditor.eEditorMode.cModeTexEdit) { CoreGlobals.getErrorManager().LogErrorToNetwork(TerrainGlobals.getEditor().getMode().ToString() + " firstSplatIndex=" + firstSplatIndex().ToString() + " flowLayoutPanel1.Controls=" + flowLayoutPanel1.Controls.ToString() + " SelectedTextureIndex=" + TerrainGlobals.getTerrainFrontEnd().SelectedTextureIndex); } } catch (System.Exception ex2) { CoreGlobals.getErrorManager().OnException(ex2); } if (MessageBox.Show("Error building texture picker (error saved to network)", "Error", MessageBoxButtons.RetryCancel) == DialogResult.Retry) { postTEDLoad(selectdIndexChanged); } else { mbPostTEDLoadRecovery = false; } } } }
bool IDependencyInterface.getDependencyList(string filename, List <FileInfo> dependencies, List <string> dependentUnits) { List <string> dependenciesFile = new List <string>(); // check extension String ext = Path.GetExtension(filename).ToLower(); if (!mExtensions.Contains(ext)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" is not a Physics file. The extensions must be \"{1}\".\n", filename, mExtensions); return(false); } string fileNameAbsolute = CoreGlobals.getWorkPaths().mGameDirectory + "\\" + filename; // check if file exists if (!File.Exists(fileNameAbsolute)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" not found.\n", filename); return(false); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "Processing File: \"{0}\"\n", filename); XmlDocument physicsDoc = new XmlDocument(); CoreGlobals.XmlDocumentLoadHelper(physicsDoc, fileNameAbsolute); // Read dependent files // // Terrain effects // XmlNodeList dependentTerrainEffectNodes = physicsDoc.SelectNodes("//TerrainEffects"); foreach (XmlNode dependentTerrainEffectNode in dependentTerrainEffectNodes) { if (dependentTerrainEffectNode.FirstChild == null) { continue; } string dependentTerrainEffectName = dependentTerrainEffectNode.FirstChild.Value; dependentTerrainEffectName = String.Concat("art\\", dependentTerrainEffectName, ".tfx"); if (!dependenciesFile.Contains(dependentTerrainEffectName)) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentTerrainEffectName); if (!fileExists) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "Physics File \"{0}\" is referring to tfx file \"{1}\" which does not exist.\n", filename, dependentTerrainEffectName); } dependenciesFile.Add(dependentTerrainEffectName); dependencies.Add(new FileInfo(dependentTerrainEffectName, fileExists)); } } return(true); }
public void TestLOS() { //CoreGlobals.getEditorMain(). //CoreGlobals.getEditorMain(). Vector3 cameraPos = CoreGlobals.getEditorMain().mITerrainShared.getCameraTarget(); int X = (int)(cameraPos.X / mTileScale); //Math.Pow(2, 6)); int Z = (int)(cameraPos.Z / mTileScale); //Math.Pow(2, 6)); int index = 0; for (int k = 0; k < mWidth * mHeight; k++) { mColors[k] = 0; } for (int k = 0; k < mWidth * mHeight; k++) { //TileInfo t = mTileLOS[X * mWidth + Z]; TileInfo t = mTileLOS[k]; if (t == null) { continue; } if (t.mbHasUnit == true) { for (int i = 0; i < mWidth * mHeight; i++) { if (t.mLowLOSVis.isSet(i)) { mColors[i] = 0x4400FF00; } //else //{ // mColors[i] = 0; //} } } } for (int k = 0; k < mWidth * mHeight; k++) { TileInfo t = mTileLOS[k]; if (t == null) { continue; } if (t.mbHasUnit == true) { mColors[k] = 0x44FF0000; } } //mColors[X * mWidth + Z] = 0x44FF0000; recalculateVisuals(); //for (int x = 0; x < mWidth - 1; x++) //{ // for (int z = 0; z < mHeight - 1; z++) // { // } //} }
private void FilterComboBox_SelectedIndexChanged(object sender, EventArgs e) { PopulateListBox(); CoreGlobals.getEditorMain().mIGUI.SetClientFocus(); }
public void LoadTreeDataFileCentric(TreeView treeView) { TreeNode root = new TreeNode("All"); TreeNode noAnimFile = new TreeNode("No Anim File"); root.Nodes.Add(noAnimFile); //mImageList.ImageSize = new System.Drawing.Size(32, 32); //mImageList.Images.Add(new Bitmap(32,32)) ; string artpath = CoreGlobals.getWorkPaths().mGameArtDirectory; foreach (SimUnitXML unit in SimGlobals.getSimMain().mSimFileData.mProtoObjectsXML.mUnits) { TreeNode n = new TreeNode(); n.Text = unit.mName; n.Tag = unit; //Image i = unit.getImage(); //if(i != null) //{ // n.ImageIndex = mImageList.Images.Count; // n.SelectedImageIndex = mImageList.Images.Count; // mImageList.Images.Add(i); //} if (unit.mAnimFile != null && unit.mAnimFile.Length > 0) { string folder = Path.GetDirectoryName(unit.mAnimFile); string[] folders = folder.Split('\\'); string fullpath = artpath; TreeNode parentNode = root; for (int i = 0; i < folders.Length; i++) { string folderName = folders[i]; fullpath = Path.Combine(fullpath, folderName); if (folderName == "falcon_01") { } int index = parentNode.Nodes.IndexOfKey(folderName); if (index >= 0) { parentNode = parentNode.Nodes[index]; } else { TreeNode oldparent = parentNode; parentNode = new TreeNode(folderName); parentNode.Name = folderName; if (Directory.Exists(fullpath) == false) { parentNode.ForeColor = Color.Red; } oldparent.Nodes.Add(parentNode); } } if (File.Exists(Path.Combine(artpath, unit.mAnimFile)) == false) { n.ForeColor = Color.Red; } parentNode.Nodes.Add(n); } else { n.ForeColor = Color.Red; noAnimFile.Nodes.Add(n); } } //treeView.ImageList = mImageList; treeView.Nodes.Add(root); treeView.Sort(); root.Expand(); }
public void isActive() { isLoading = true; minXBounds.Setup(0, TerrainGlobals.getTerrain().getNumXVerts(), false); maxXBounds.Setup(0, TerrainGlobals.getTerrain().getNumXVerts(), false); minZBounds.Setup(0, TerrainGlobals.getTerrain().getNumXVerts(), false); maxZBounds.Setup(0, TerrainGlobals.getTerrain().getNumXVerts(), false); minXBounds.NumericValue = CoreGlobals.mPlayableBoundsMinX; maxXBounds.NumericValue = CoreGlobals.mPlayableBoundsMaxX; minZBounds.NumericValue = CoreGlobals.mPlayableBoundsMinZ; maxZBounds.NumericValue = CoreGlobals.mPlayableBoundsMaxZ; textBox1.Text = CoreGlobals.ScenarioMinimapTextureFilename; string[] temp = new string[CoreGlobals.ScenarioSoundbankFilenames.Count]; for (int i = 0; i < CoreGlobals.ScenarioSoundbankFilenames.Count; i++) { temp[i] = CoreGlobals.ScenarioSoundbankFilenames[i]; } soundBankBox.Lines = temp; //-- DJB: Yeah this is ugly, but we're at the end of the project, and it's not gonna change. worldComboBox.Items.Clear(); worldComboBox.Items.Add(""); worldComboBox.Items.Add("Harvest"); worldComboBox.Items.Add("Arcadia"); worldComboBox.Items.Add("SWI"); worldComboBox.Items.Add("SWE"); worldComboBox.Text = CoreGlobals.ScenarioWorld; cinematicListBox.Items.Clear(); talkingHeadVideos.Items.Clear(); int count = CoreGlobals.getGameResources().getNumCinematics(); for (int i = 0; i < count; i++) { EditorCinematic ecin = CoreGlobals.getGameResources().getCinematic(i); cinematicListBox.Items.Add(ecin.Name); } count = CoreGlobals.getGameResources().getNumTalkingHeadVideos(); for (int i = 0; i < count; i++) { EditorCinematic ecin = CoreGlobals.getGameResources().getTalkingHeadVideo(i); talkingHeadVideos.Items.Add(ecin.Name); } count = CoreGlobals.getGameResources().getNumLightsets(); LightsetListBox.Items.Clear(); for (int i = 0; i < count; i++) { EditorLightset ecin = CoreGlobals.getGameResources().getLightset(i); LightsetListBox.Items.Add(ecin.getIDString()); } comboBox1.Items.Clear(); comboBox2.Items.Clear(); int numSplatTex = TerrainGlobals.getTexturing().getActiveTextureCount(); for (int i = 0; i < numSplatTex; i++) { if (TerrainGlobals.getTexturing().getActiveTexture(i) == null) { if (mbThisErrorOnce1 == false) { mbThisErrorOnce1 = true; CoreGlobals.ShowMessage("Please report this error to Andrew and Colt: invalid index in isActive "); } continue; } comboBox1.Items.Add(Path.GetFileName(TerrainGlobals.getTexturing().getActiveTexture(i).mFilename)); comboBox2.Items.Add(Path.GetFileName(TerrainGlobals.getTexturing().getActiveTexture(i).mFilename)); } if (CoreGlobals.ScenarioBuildingTextureIndexUNSC >= comboBox1.Items.Count) { CoreGlobals.ScenarioBuildingTextureIndexUNSC = 0; } comboBox1.SelectedIndex = CoreGlobals.ScenarioBuildingTextureIndexUNSC; if (CoreGlobals.ScenarioBuildingTextureIndexCOVN >= comboBox1.Items.Count) { CoreGlobals.ScenarioBuildingTextureIndexCOVN = 0; } comboBox2.SelectedIndex = CoreGlobals.ScenarioBuildingTextureIndexCOVN; VeterancyCheck.Checked = CoreGlobals.mbAllowVeterancy; LoadVisRepBox.Checked = CoreGlobals.mbLoadTerrainVisRep; GlobalExcludeUnitsOptionChooser.Enabled = true; GlobalExcludeUnitsOptionChooser.SetOptions(TriggerSystemMain.mSimResources.mObjectTypeData.mObjectTypeList); GlobalExcludeUnitsOptionChooser.BoundSelectionList = SimGlobals.getSimMain().GlobalExcludeObjects; GlobalExcludeUnitsOptionChooser.AllowRepeats = false; GlobalExcludeUnitsOptionChooser.AutoSort = true; isLoading = false; }
bool IDependencyInterface.getDependencyList(string filename, List <FileInfo> dependencies, List <string> dependentUnits) { List <string> dependenciesFile = new List <string>(); // check extension String ext = Path.GetExtension(filename).ToLower(); if (!mExtensions.Contains(ext)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" is not a TerrainEffect file. The extensions must be \"{1}\".\n", filename, mExtensions); return(false); } string fileNameAbsolute = CoreGlobals.getWorkPaths().mGameDirectory + "\\" + filename; // check if file exists if (!File.Exists(fileNameAbsolute)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" not found.\n", filename); return(false); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "Processing File: \"{0}\"\n", filename); XmlDocument tfxDoc = new XmlDocument(); CoreGlobals.XmlDocumentLoadHelper(tfxDoc, fileNameAbsolute); // Read dependent files // // Particle effects // XmlNodeList dependentParticleNodes = tfxDoc.SelectNodes("//particlefile"); foreach (XmlNode dependentParticleNode in dependentParticleNodes) { if (dependentParticleNode.FirstChild == null) { continue; } string dependentParticleName = dependentParticleNode.FirstChild.Value; dependentParticleName = String.Concat("art\\", dependentParticleName, ".pfx"); if (!dependenciesFile.Contains(dependentParticleName)) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentParticleName); if (!fileExists) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "TerrainEffect File \"{0}\" is referring to pfx file \"{1}\" which does not exist.\n", filename, dependentParticleName); } dependenciesFile.Add(dependentParticleName); dependencies.Add(new FileInfo(dependentParticleName, fileExists)); } } // Vis files // XmlNodeList dependentVisNodes = tfxDoc.SelectNodes("//vis"); foreach (XmlNode dependentVisNode in dependentVisNodes) { if (dependentVisNode.FirstChild == null) { continue; } string dependentVisName = dependentVisNode.FirstChild.Value; dependentVisName = String.Concat("art\\", dependentVisName, ".vis"); if (!dependenciesFile.Contains(dependentVisName)) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentVisName); if (!fileExists) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "TerrainEffect File \"{0}\" is referring to vis file \"{1}\" which does not exist.\n", filename, dependentVisName); } dependenciesFile.Add(dependentVisName); dependencies.Add(new FileInfo(dependentVisName, fileExists)); } } // Lights // XmlNodeList dependentLightNodes = tfxDoc.SelectNodes("//light"); foreach (XmlNode dependentLightNode in dependentLightNodes) { if (dependentLightNode.FirstChild == null) { continue; } string dependentLightName = dependentLightNode.FirstChild.Value; dependentLightName = String.Concat("art\\", dependentLightName, ".lgt"); if (!dependenciesFile.Contains(dependentLightName)) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentLightName); if (!fileExists) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "TerrainEffect File \"{0}\" is referring to light file \"{1}\" which does not exist.\n", filename, dependentLightName); } dependenciesFile.Add(dependentLightName); dependencies.Add(new FileInfo(dependentLightName, fileExists)); } } // Impact decal effects // XmlNodeList dependentImpactDecalNodes = tfxDoc.SelectNodes("//impactdecal"); foreach (XmlNode dependentImpactDecalNode in dependentImpactDecalNodes) { if (dependentImpactDecalNode.FirstChild == null) { continue; } string dependentImpactDecalRootName = dependentImpactDecalNode.FirstChild.Value; dependentImpactDecalRootName = String.Concat("art\\", dependentImpactDecalRootName); string[] dependentImpactDecalName = new string[3]; dependentImpactDecalName[0] = String.Concat(dependentImpactDecalRootName, "_df.ddx"); dependentImpactDecalName[1] = String.Concat(dependentImpactDecalRootName, "_nm.ddx"); dependentImpactDecalName[2] = String.Concat(dependentImpactDecalRootName, "_op.ddx"); long textureChannelFoundCount = 0; for (long channel = 0; channel < 3; channel++) { if (!dependenciesFile.Contains(dependentImpactDecalName[channel])) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentImpactDecalName[channel]); if (fileExists) { dependenciesFile.Add(dependentImpactDecalName[channel]); dependencies.Add(new FileInfo(dependentImpactDecalName[channel], fileExists)); textureChannelFoundCount += 1; } } else { textureChannelFoundCount += 1; } } if (textureChannelFoundCount == 0) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "TerrainEffect File \"{0}\" is referring to impactdecal \"{1}\" which does not exist.\n", filename, dependentImpactDecalRootName); } } // Trail effects // XmlNodeList dependentTrailDecalNodes = tfxDoc.SelectNodes("//trail"); foreach (XmlNode dependentTrailDecalNode in dependentTrailDecalNodes) { if (dependentTrailDecalNode.FirstChild == null) { continue; } string dependentTrailDecalRootName = dependentTrailDecalNode.FirstChild.Value; dependentTrailDecalRootName = String.Concat("art\\", dependentTrailDecalRootName); string[] dependentImpactDecalName = new string[3]; dependentImpactDecalName[0] = String.Concat(dependentTrailDecalRootName, "_df.ddx"); dependentImpactDecalName[1] = String.Concat(dependentTrailDecalRootName, "_nm.ddx"); dependentImpactDecalName[2] = String.Concat(dependentTrailDecalRootName, "_op.ddx"); long textureChannelFoundCount = 0; for (long channel = 0; channel < 3; channel++) { if (!dependenciesFile.Contains(dependentImpactDecalName[channel])) { // Check file existance bool fileExists = File.Exists(CoreGlobals.getWorkPaths().mGameDirectory + "\\" + dependentImpactDecalName[channel]); if (fileExists) { dependenciesFile.Add(dependentImpactDecalName[channel]); dependencies.Add(new FileInfo(dependentImpactDecalName[channel], fileExists)); textureChannelFoundCount += 1; } } else { textureChannelFoundCount += 1; } } if (textureChannelFoundCount == 0) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "TerrainEffect File \"{0}\" is referring to trail decal \"{1}\" which does not exist.\n", filename, dependentTrailDecalRootName); } } return(true); }
private void UpdateUIStatus() { int numInPerforce = 0; int numCheckedoutByOther = 0; int numCheckedOutByUser = 0; int numCheckedOutByBoth = 0; mStatus.Clear(); if (mFiles.Count == 0) { return; } foreach (string file in mFiles) { SimpleFileStatus s = CoreGlobals.getPerforce().GetFileStatusSimple(file); mStatus.Add(s); if (s.InPerforce) { numInPerforce++; } if (s.State == eFileState.CheckedOutByUserAndOther) { numCheckedOutByBoth++; } else if (s.State == eFileState.CheckedOutByOther) { numCheckedoutByOther++; } else if (s.State == eFileState.CheckedOutByUser) { numCheckedOutByUser++; } } FileListGridControl.DataSource = mStatus; EnumViewer <eFileState> item = new EnumViewer <eFileState>(); item.mImageList = imageList1; CellViewerManager manager = new CellViewerManager(item, "Value"); FileListGridControl.Columns["State"].CellViewerManager = manager; if (numInPerforce < mFiles.Count && numInPerforce > 0) { mMode = ePerforcePageMode.SomeFilesInPerforce; AddOptions(); } else if (numInPerforce == 0) { mMode = ePerforcePageMode.NoFilesInPerforce; AddOptions(); } else if (numCheckedoutByOther > 0) { mMode = ePerforcePageMode.SomeCheckedOutByOther; CheckedOutByOtherOptions(); } else if (numCheckedoutByOther == mFiles.Count) { mMode = ePerforcePageMode.AllCheckedOutByOther; CheckedOutByOtherOptions(); } else if (numCheckedOutByUser == mFiles.Count) { mMode = ePerforcePageMode.AllCheckedOutByUser; CheckedOutByUserOptions(); } else if ((numInPerforce == mFiles.Count) && (numCheckedOutByUser > 0) && (numCheckedoutByOther == 0)) { mMode = ePerforcePageMode.SomeCheckedOutByUser; AllCheckedInOptions(); } else if ((numInPerforce == mFiles.Count) && (numCheckedoutByOther == 0)) { mMode = ePerforcePageMode.AllCheckedIn; AllCheckedInOptions(); } else { mMode = ePerforcePageMode.OtherState; //Not set up to handle this situation ResetUI(); } }
public SearchPanel() { InitializeComponent(); SearchButton.Image = SharedResources.GetImage(Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "Search.bmp")); }
static void loadShader() { mFoliageGPUShader = BRenderDevice.getShaderManager().getShader(CoreGlobals.getWorkPaths().mEditorShaderDirectory + "\\gpuTerrainFoliage.fx", mainShaderParams); mainShaderParams(null); }
private void numericUpDown1_ValueChanged(object sender, EventArgs e) { CoreGlobals.getSettingsFile().AutoSaveTimeInMinutes = (int)numericUpDown1.Value; CoreGlobals.getSettingsFile().Save(); }
private void checkBox1_CheckedChanged(object sender, EventArgs e) { CoreGlobals.getSettingsFile().AutoSaveEnabled = checkBox1.Checked; groupBox1.Enabled = checkBox1.Checked; CoreGlobals.getSettingsFile().Save(); }
void topicControl_StateChanged(object sender, EventArgs e) { //UpdateUI(); CoreGlobals.getScenarioWorkTopicManager().NotifyTopicsUpdated(); }
// public Control BuildUIFromCondition(TriggerCondition condition, Dictionary <int, TriggerValue> values) { FunctorEditor f = new FunctorEditor(); f.LayoutStyle = FunctorEditor.eLayoutStyle.VerticleList; f.Dock = DockStyle.Fill; f.Tag = condition; //f.FunctionName = condition.Type; UpdateComponentVisuals(condition, f); f.LogicalHost = this; f.FunctionNameClicked += new EventHandler(f_FunctionNameClicked); f.FunctionNameRightClick += new EventHandler(f_FunctionNameRightClick); f.FunctionNameHover += new EventHandler(f_HotSelect); List <Control> inputList = new List <Control>(); List <Control> outputList = new List <Control>(); bool bErrors = false; bool bWatchForChange = TriggerSystemMain.mTriggerDefinitions.IsDynamicComponent(condition.Type); foreach (TriggerVariable v in condition.Parameter) { try { if (v is TriggersInputVariable) { inputList.Add(BuildUIFromConditionVariable(condition, v, values[v.ID], bWatchForChange)); } else if (v is TriggersOutputVariable) { outputList.Add(BuildUIFromConditionVariable(condition, v, values[v.ID], bWatchForChange)); } } catch (System.Exception ex) { bErrors = true; CoreGlobals.getErrorManager().SendToErrorWarningViewer("Missing value: " + v.ID); } } f.SetupParameters(inputList, outputList); //Debug info if (condition.HasErrors == true || bErrors) { f.SetErrorText(); } else if (condition.HasWarnings == true) { f.SetWarningText(); } else if (condition.JustUpgraded == true) { f.SetUpdatedText(); } UpdateComponentVisuals(condition, f); return(f); }
private void CheckInAllButton_Click(object sender, EventArgs e) { CoreGlobals.getScenarioWorkTopicManager().mChangeList.Submitchanges(); }
//---------------------------- private void exportFileList() { String batchExportLog = outputLog; if (batchExportLog == null) { batchExportLog = Path.Combine(CoreGlobals.getWorkPaths().mLogsDirectory, "batchExportLog." + System.DateTime.Now.ToFileTimeUtc() + ".txt"); } mExportLogStream = new StreamWriter(batchExportLog, true); listBox1.Items.Clear(); DateTime start = DateTime.Now; SimTerrainType.loadTerrainTypes(); Exportbutton.Enabled = false; progressBar1.Value = 0; progressBar1.Maximum = mScenarioFilesToExport.Count;// ToExportListBox.SelectedItems.Count; //export settings Export360.ExportSettings settings = null; if (mUseCustomExportSettings == -1) { settings = null; } else if (mUseCustomExportSettings == 0) { ExportDialog mExportDialog = new ExportDialog(); mExportDialog.mExportSettings = new Export360.ExportSettings(); mExportDialog.mExportSettings.SettingsQuick(); mExportDialog.mIsQuickExport = true; if (mExportDialog.ShowDialog() == DialogResult.OK) { settings = mExportDialog.mExportSettings; } } else if (mUseCustomExportSettings == 1) { settings = new Export360.ExportSettings(); settings.SettingsQuick(); } else if (mUseCustomExportSettings == 2) { settings = new Export360.ExportSettings(); settings.SettingsFinal(); } bool createOwnDevice = BRenderDevice.getDevice() == null; if (createOwnDevice) { BRenderDevice.createDevice(this, 640, 480, false); } GrannyManager2.init(); saveCheckOptions(); for (int fileCount = 0; fileCount < mScenarioFilesToExport.Count; fileCount++)// (string file in ToExportListBox.SelectedItems) { string scenarioName = mScenarioFilesToExport[fileCount].mFilename; string terrainName = mTerrainFilesToExport[mScenarioFilesToExport[fileCount].mTerrainFileIndex].mFilename; bool terrainAlreadyExported = hasBeenExported(fileCount); //if our owner terrain has already been exported, and we're not generating XSD files, bail. if (terrainAlreadyExported && !doXSD.Checked) { continue; } bool canEdit = mIgnorePerforce ? true : P4CanEdit(scenarioName, terrainName, mCheckoutFromPerforce); if (canEdit) { //toggle our check boxes for already exported terrain files doXTD.Checked &= !terrainAlreadyExported; doXTT.Checked &= !terrainAlreadyExported; doXTH.Checked &= !terrainAlreadyExported; bool okExported = TEDIO.TEDto360(terrainName, scenarioName, outputDir, settings, doXTD.Checked, doXTT.Checked, doXTH.Checked, doXSD.Checked, doLRP.Checked, doDEP.Checked, doTAG.Checked, doXMB.Checked); if (okExported) { outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": EXPORT SUCCEEDED!--------------------"); } else { mStatusResult = 2; outputMessage(Path.GetFileNameWithoutExtension(scenarioName) + ": ABORTED! There was a problem exporting the files"); P4RevertAllNeededFiles(scenarioName, terrainName); } } progressBar1.Invoke(updateProgress); restoreCheckOptions(); markScenarioExported(fileCount); } if (createOwnDevice) { BRenderDevice.destroyDevice(); } if (!mIgnorePerforce && mCheckinWhenFinished) { outputMessage("Checking in files"); P4SubmitChangelist(); } Exportbutton.Enabled = true; TimeSpan ts = DateTime.Now - start; outputMessage("====Time : " + ts.TotalMinutes + " Minutes"); outputMessage("====Export Finished===="); // GrannyManager2.deinit(); mExportLogStream.Close(); if (mStatusResult == 0) { File.Delete(batchExportLog); } clearList(); }
public void LoadSquadTreeData(TreeView treeView) { if (SimGlobals.getSimMain().mSimFileData.mProtoSquadsXML == null) { return; } TreeNode root = new TreeNode("All"); //TreeNode noAnimFile = new TreeNode("No Anim File"); //root.Nodes.Add(noAnimFile); string artpath = CoreGlobals.getWorkPaths().mGameArtDirectory; foreach (ProtoSquadXml squad in SimGlobals.getSimMain().mSimFileData.mProtoSquadsXML.mSquads) { string[] namePaths = squad.Name.Split('_'); TreeNode parentNode = root; int bonus = 0; int extension; if (int.TryParse(namePaths[namePaths.Length - 1], out extension)) { bonus++; } string shortName = namePaths[namePaths.Length - (1 + bonus)]; for (int i = bonus - 1; i >= 0; i--) { shortName += "_" + namePaths[namePaths.Length - (1 + i)]; } TreeNode n = new TreeNode(); n.Text = shortName; n.Tag = squad; for (int i = 0; i < namePaths.Length - (1 + bonus); i++) { string folderName = namePaths[i]; int index = parentNode.Nodes.IndexOfKey(folderName); if (index >= 0) { parentNode = parentNode.Nodes[index]; } else { TreeNode oldparent = parentNode; parentNode = new TreeNode(folderName); parentNode.Name = folderName; oldparent.Nodes.Add(parentNode); } } //if (unit.mAnimFile == null || unit.mAnimFile.Length == 0) //{ // n.ForeColor = Color.Red; //} //else if (File.Exists(Path.Combine(artpath, unit.mAnimFile)) == false) //{ // n.ForeColor = Color.Red; //} //else //{ // // n.ToolTipText = Path.Combine(artpath, unit.mAnimFile); //} parentNode.Nodes.Add(n); } //treeView.ImageList = mImageList; treeView.Nodes.Add(root); treeView.Sort(); root.Expand(); }
//----------------------------------------------------------------------------- public void CameraMovement() { //camera controls float incAmt = 2 * SmartSpeedupCamera(); Dir = mEye - mLookAt; mRight = Vector3.Cross(Dir, mUp); mRight = BMathLib.Normalize(mRight); Vector3 ndir = -Dir; ndir.Y = 0; ndir = BMathLib.Normalize(ndir); Vector3 kDir = BMathLib.Normalize(Dir); Vector3 inc; Matrix matRotation; int mouseDeltaX = 0; int mouseDeltaY = 0; Point currPos = Point.Empty; UIManager.GetCursorPos(ref currPos); if (mbFirstMouseIntput) { mLastMousePosX = currPos.X; mLastMousePosY = currPos.Y; mbFirstMouseIntput = false; } else { mouseDeltaX = mLastMousePosX - currPos.X; mouseDeltaY = mLastMousePosY - currPos.Y; mLastMousePosX = currPos.X; mLastMousePosY = currPos.Y; } switch (mCamMode) { case eCamModes.cCamMode_Free: case eCamModes.cCamMode_RTS: if (mCamMode == eCamModes.cCamMode_RTS) //EDGE PUSH MODE { const int edgeAmt = 20; Point size = new Point(); BRenderDevice.getParentWindowSize(ref size); Point cursorPos = Point.Empty; UIManager.GetCursorPos(ref cursorPos); if (cursorPos.Y < edgeAmt) { CheckAssignMovement(out inc, mLookAt, ndir * incAmt); mEye += inc; mLookAt += inc; } else if (cursorPos.Y > size.Y - edgeAmt) { CheckAssignMovement(out inc, mLookAt, -ndir * incAmt); mEye += inc; mLookAt += inc; } else if (cursorPos.X < edgeAmt) { CheckAssignMovement(out inc, mLookAt, -mRight * incAmt); mEye += inc; mLookAt += inc; } else if (cursorPos.X > size.X - edgeAmt) { CheckAssignMovement(out inc, mLookAt, mRight * incAmt); mEye += inc; mLookAt += inc; } } if (SimGlobals.getSimMain().isUsingDesignerControls()) { if (UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle) && (UIManager.GetAsyncKeyStateB(Key.LeftAlt) || UIManager.GetAsyncKeyStateB(Key.RightAlt))) { //Rotation! if (mouseDeltaX != 0 || mouseDeltaY != 0) { matRotation = Matrix.RotationAxis(mRight, Geometry.DegreeToRadian((float)-mouseDeltaY / 5.0f)); Dir.TransformCoordinate(matRotation); Vector3 t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } matRotation = Matrix.RotationY(Geometry.DegreeToRadian((float)-mouseDeltaX / 5.0f)); Dir.TransformCoordinate(matRotation); t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } } mTranslationPressed = false; } else if (UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle)) { if (mTranslationPressed) { float yE = mEye.Y; float yL = mLookAt.Y; Vector3 r0 = TerrainGlobals.getEditor().getRayPosFromMouseCoords(false); Vector3 rD = TerrainGlobals.getEditor().getRayPosFromMouseCoords(true) - r0; rD.Normalize(); Vector3 iPt = new Vector3(); BTerrainQuadNode node = null; TerrainGlobals.getTerrain().rayIntersects(ref r0, ref rD, ref iPt, ref node, true); Vector3 diff = mTranlationInterception - iPt; Vector3 eyeDiff = mLookAt - mEye; mLookAt += diff; mEye += diff; mLookAt.Y = yL; mEye.Y = yE; } else { mTranslationPressed = true; Vector3 r0 = TerrainGlobals.getEditor().getRayPosFromMouseCoords(false); Vector3 rD = TerrainGlobals.getEditor().getRayPosFromMouseCoords(true) - r0; rD.Normalize(); BTerrainQuadNode node = null; TerrainGlobals.getTerrain().rayIntersects(ref r0, ref rD, ref mTranlationInterception, ref node, true); } /* * //TRANSLATION * float lSq = Eye.Y * 0.3f; * float forwardInc = (float)mouseDeltaY / -20.0f; * float rightInc = (float)mouseDeltaX / 20.0f; * * Vector3 k = ndir * forwardInc + Right * rightInc; * * CheckAssignMovement(out inc, LookAt, k); * Eye += inc; * LookAt += inc; * */ } else { mTranslationPressed = false; } if ((UIManager.WheelDelta != 0) && (UIManager.GetAsyncKeyStateB(Key.LeftAlt) || UIManager.GetAsyncKeyStateB(Key.RightAlt))) { //ZOOM int sign = UIManager.WheelDelta > 0 ? -1 : 1; float heightDiff = (float)Math.Log(mEye.Y); float lSq = mEye.Y * 0.3f; Zoom = Math.Abs(lSq * (float)(UIManager.WheelDelta / 120f)); kDir.Scale(Zoom * sign); mEye += kDir; } //allow WASD || Arrow keys to translate us... if (UIManager.GetAsyncKeyStateB(Key.W) || UIManager.GetAsyncKeyStateB(Key.UpArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad8)) { if (UIManager.GetAsyncKeyStateB(Key.LeftAlt) || UIManager.GetAsyncKeyStateB(Key.RightAlt)) { //ZOOM int sign = UIManager.WheelDelta > 0 ? -1 : 1; Zoom = 2 * (float)(UIManager.WheelDelta / 120f); kDir.Scale(Zoom * sign); mEye -= kDir; } else { CheckAssignMovement(out inc, mLookAt, ndir * incAmt); mEye += inc; mLookAt += inc; } } if (UIManager.GetAsyncKeyStateB(Key.S) || UIManager.GetAsyncKeyStateB(Key.DownArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad2)) { if (UIManager.GetAsyncKeyStateB(Key.LeftAlt) || UIManager.GetAsyncKeyStateB(Key.RightAlt)) { //ZOOM int sign = UIManager.WheelDelta > 0 ? -1 : 1; Zoom = 2 * (float)(UIManager.WheelDelta / 120f); kDir.Scale(Zoom * sign); mEye += kDir; } else { CheckAssignMovement(out inc, mLookAt, -ndir * incAmt); mEye += inc; mLookAt += inc; } } if (UIManager.GetAsyncKeyStateB(Key.A) || UIManager.GetAsyncKeyStateB(Key.LeftArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad4)) { CheckAssignMovement(out inc, mLookAt, -mRight * incAmt); mEye += inc; mLookAt += inc; } if (UIManager.GetAsyncKeyStateB(Key.D) || UIManager.GetAsyncKeyStateB(Key.RightArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad6)) { CheckAssignMovement(out inc, mLookAt, mRight * incAmt); mEye += inc; mLookAt += inc; } } else //artist camera controls { Dir.Scale(Zoom); Zoom = 1; if ((UIManager.GetAsyncKeyStateB(Key.LeftShift)) || (UIManager.GetAsyncKeyStateB(Key.RightShift)) || (CoreGlobals.getSettingsFile().ArtistModePan == false && UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle))) { if (UIManager.GetAsyncKeyStateB(Key.LeftControl) || UIManager.GetAsyncKeyStateB(Key.RightControl)) { if (mbInvertZoom == true) { mouseDeltaY = -1 * mouseDeltaY; } Zoom = 1 + mouseDeltaY / 100f; mEye = mLookAt + Dir; } else if (!UIManager.GetMouseButtonDown(UIManager.eMouseButton.cLeft)) { //Rotation! if (mouseDeltaX != 0 || mouseDeltaY != 0) { matRotation = Matrix.RotationAxis(mRight, Geometry.DegreeToRadian((float)-mouseDeltaY / 5.0f)); Dir.TransformCoordinate(matRotation); Vector3 t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } matRotation = Matrix.RotationY(Geometry.DegreeToRadian((float)-mouseDeltaX / 5.0f)); Dir.TransformCoordinate(matRotation); t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } } } // Do nothing if control key is pressed if (UIManager.GetAsyncKeyStateB(Key.LeftControl) || UIManager.GetAsyncKeyStateB(Key.RightControl)) { return; } } else if (UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle)) { if (mTranslationPressed) { float yE = mEye.Y; float yL = mLookAt.Y; Vector3 r0 = TerrainGlobals.getEditor().getRayPosFromMouseCoords(false); Vector3 rD = TerrainGlobals.getEditor().getRayPosFromMouseCoords(true) - r0; rD.Normalize(); Vector3 iPt = new Vector3(); BTerrainQuadNode node = null; TerrainGlobals.getTerrain().rayIntersects(ref r0, ref rD, ref iPt, ref node, true); Vector3 diff = mTranlationInterception - iPt; Vector3 eyeDiff = mLookAt - mEye; mLookAt += diff; mEye += diff; mLookAt.Y = yL; mEye.Y = yE; } else { mTranslationPressed = true; Vector3 r0 = TerrainGlobals.getEditor().getRayPosFromMouseCoords(false); Vector3 rD = TerrainGlobals.getEditor().getRayPosFromMouseCoords(true) - r0; rD.Normalize(); BTerrainQuadNode node = null; TerrainGlobals.getTerrain().rayIntersects(ref r0, ref rD, ref mTranlationInterception, ref node, true); } } else { mTranslationPressed = false; if (UIManager.GetAsyncKeyStateB(Key.W) || UIManager.GetAsyncKeyStateB(Key.UpArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad8)) { CheckAssignMovement(out inc, mLookAt, ndir * incAmt); mEye += inc; mLookAt += inc; } if (UIManager.GetAsyncKeyStateB(Key.S) || UIManager.GetAsyncKeyStateB(Key.DownArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad2)) { CheckAssignMovement(out inc, mLookAt, -ndir * incAmt); mEye += inc; mLookAt += inc; } if (UIManager.GetAsyncKeyStateB(Key.A) || UIManager.GetAsyncKeyStateB(Key.LeftArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad4)) { CheckAssignMovement(out inc, mLookAt, -mRight * incAmt); mEye += inc; mLookAt += inc; } if (UIManager.GetAsyncKeyStateB(Key.D) || UIManager.GetAsyncKeyStateB(Key.RightArrow) || UIManager.GetAsyncKeyStateB(Key.NumPad6)) { CheckAssignMovement(out inc, mLookAt, mRight * incAmt); mEye += inc; mLookAt += inc; } } } if (UIManager.GetAsyncKeyStateB(Key.Space) && (UIManager.GetAsyncKeyStateB(Key.LeftShift) || UIManager.GetAsyncKeyStateB(Key.RightShift))) { SimGlobals.getSimMain().LookAtSelectedObject(); } else if (UIManager.GetAsyncKeyStateB(Key.Space)) { snapCamera(eCamSnaps.cCamSnap_RTS); } break; case eCamModes.cCamMode_ModelView: { if (UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle) && (UIManager.GetAsyncKeyStateB(Key.LeftAlt) || UIManager.GetAsyncKeyStateB(Key.RightAlt))) { // Orbit camera if (mouseDeltaX != 0 || mouseDeltaY != 0) { matRotation = Matrix.RotationAxis(mRight, Geometry.DegreeToRadian((float)-mouseDeltaY / 5.0f)); Dir.TransformCoordinate(matRotation); Vector3 t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } matRotation = Matrix.RotationY(Geometry.DegreeToRadian((float)-mouseDeltaX / 5.0f)); Dir.TransformCoordinate(matRotation); t = Vector3.Normalize(Dir); if (Vector3.Dot(t, mUp) < mCamDotLimit && Vector3.Dot(t, mUp) > -mCamDotLimit) { mEye = mLookAt + Dir; } } } else if (UIManager.GetMouseButtonDown(UIManager.eMouseButton.cMiddle)) { // Translate (pan) float distFromModel = Vector3.Length(mEye - mModelBoundingBox.getCenter()); float translationFactor = distFromModel / 1400.0f; float upInc = (float)mouseDeltaY * translationFactor; float rightInc = (float)mouseDeltaX * translationFactor; Vector3 up = Vector3.Cross(Dir, mRight); up = BMathLib.Normalize(up); Vector3 tranlation = up * upInc + mRight * rightInc; mEye += tranlation; mLookAt += tranlation; } if (UIManager.WheelDelta != 0) { // Zoom float distFromModel = Vector3.Length(mEye - mModelBoundingBox.getCenter()); float translationFactor = -distFromModel / 10.0f; mEye += kDir * (translationFactor * (UIManager.WheelDelta / 120f)); } if (UIManager.GetAsyncKeyStateB(Key.Space)) { snapCamera(eCamSnaps.cCamSnap_ModelView); } } break; } }
string[] giveValidRoadTextures() { return(Directory.GetFiles(CoreGlobals.getWorkPaths().mRoadsPath, "*_df.ddx")); }
public void CreateNewEffectVisFile(string newAnimFile, string gr2file) { XmlDocument animTemplateDoc = new XmlDocument(); animTemplateDoc.Load(CoreGlobals.getWorkPaths().mGameArtDirectory + "\\template\\effect" + CoreGlobals.getWorkPaths().mUnitDataExtension); XmlNodeList nodes = animTemplateDoc.SelectNodes("//asset[@type='Particle']/file"); if (nodes.Count > 0) { nodes[0].InnerText = gr2file.Replace(".pfx", "");; } string newFullFileName = Path.Combine(CoreGlobals.getWorkPaths().mGameArtDirectory, newAnimFile); animTemplateDoc.Save(newFullFileName); XMBProcessor.CreateXMB(newFullFileName, false); }
bool IDependencyInterface.getDependencyList(string filename, List <FileInfo> dependencies, List <string> dependentUnits) { // check extension String ext = Path.GetExtension(filename).ToLower(); if (!mExtensions.Contains(ext)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" is not a cinematic file. The extension must be \"{1}\".\n", filename, mExtensions); return(false); } string fileNameAbsolute = CoreGlobals.getWorkPaths().mGameDirectory + "\\" + filename; // check if file exists if (!File.Exists(fileNameAbsolute)) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" not found.\n", filename); return(false); } ConsoleOut.Write(ConsoleOut.MsgType.Info, "Processing File: \"{0}\".\n", filename); // Only camera files are needed here, since the cinematics are prerendered. The camera is still needed though to // be able to access shot times. The shot times are required for playing the chats. // // Load it Stream st = File.OpenRead(fileNameAbsolute); cinematic cinFile = null; try { cinFile = (cinematic)mXmlSerializerCIN.Deserialize(st); } catch (System.Exception ex) { ConsoleOut.Write(ConsoleOut.MsgType.Error, "File \"{0}\" is not a valid xml cinematic (.cin) file.\n", filename); ConsoleOut.Write(ConsoleOut.MsgType.Error, "{0}\n", ex.ToString()); st.Close(); return(false); } st.Close(); List <string> dependencyFile = new List <string>(); TechTree tree = new TechTree(Database.m_protoTechs); /* * if (cinFile.head != null) * { * foreach (cinematicModel model in cinFile.head) * { * ModelType type = ModelType.gr2; * * if (!String.IsNullOrEmpty(model.type)) * { * if (String.Compare(model.type, "gr2", true) == 0) * type = ModelType.gr2; * else if (String.Compare(model.type, "proto", true) == 0) * type = ModelType.proto; * } * * * switch (type) * { * case ModelType.gr2: * // Add model * if (!String.IsNullOrEmpty(model.modelfile)) * { * string modelFileName = "art\\" + model.modelfile; * modelFileName = String.Concat(modelFileName, ".ugx"); * * if (!dependencyFile.Contains(modelFileName)) * dependencyFile.Add(modelFileName); * } * break; * * case ModelType.proto: * { * long unitID; * if (Database.m_objectTypes.TryGetValue(model.modelfile.ToLower(), out unitID)) * { * tree.buildUnit(unitID); * //tree.applyProtoObjectEffect(unitID); * } * else * { * ConsoleOut.Write(ConsoleOut.MsgType.Warn, "Cinematic \"{0}\" is referring to proto unit \"{1}\" which does not exist in objects.xml.\n", filename, model.modelfile); * } * } * break; * } * } * } */ if (cinFile.body != null) { foreach (cinematicShot shot in cinFile.body) { // Add camera if (!String.IsNullOrEmpty(shot.camera)) { string cameraFileName = "art\\" + shot.camera; cameraFileName = String.Concat(cameraFileName, ".lgt"); if (!dependencyFile.Contains(cameraFileName)) { dependencyFile.Add(cameraFileName); } } if (shot.tag != null) { foreach (cinematicShotTag tag in shot.tag) { // Add talking head if (!String.IsNullOrEmpty(tag.talkinghead)) { string talkingHeadFileName = "video\\talkingheads\\" + tag.talkinghead; talkingHeadFileName = String.Concat(talkingHeadFileName, ".bik"); if (!dependencyFile.Contains(talkingHeadFileName)) { string absoluteTalkingHeadFileName = CoreGlobals.getWorkPaths().mGameDirectory + "\\" + talkingHeadFileName; // check if file exists if (File.Exists(absoluteTalkingHeadFileName)) { dependencyFile.Add(talkingHeadFileName); } else { //ConsoleOut.Write(ConsoleOut.MsgType.Warn, "Cinematic \"{0}\" refers to has Talking Head video \"{1}\" which does not exist.\n", filename, talkingHeadFileName); } } } } } /* * if (shot.animatedmodel != null) * { * foreach (cinematicShotAnimatedmodel animModel in shot.animatedmodel) * { * // Add animation * if (!String.IsNullOrEmpty(animModel.animationfile)) * { * string animationFileName = "art\\" + animModel.animationfile; * animationFileName = String.Concat(animationFileName, ".uax"); * * if(!dependencyFile.Contains(animationFileName)) * dependencyFile.Add(animationFileName); * } * } * } */ } } // Process /* * tree.process(); */ tree.getDependencyList(dependencyFile, false); foreach (string file in dependencyFile) { bool fileExists = checkFileExistance(file); if (!fileExists) { ConsoleOut.Write(ConsoleOut.MsgType.Warn, "Cinematic File \"{0}\" is referring to file \"{1}\" which does not exist.\n", filename, file); } dependencies.Add(new FileInfo(file, fileExists)); } return(true); }
public void exportRoads(ref ExportResults results) { DateTime n = DateTime.Now; //for each road, for (int roadIndex = 0; roadIndex < RoadManager.giveNumRoads(); roadIndex++) { List <RoadTriangle> triList = new List <RoadTriangle>(); Road rd = RoadManager.giveRoad(roadIndex); if (rd.getNumControlPoints() == 0) //don't export roads w/o points on the map { continue; } //Step 1, generate polygon lists//////////////////////////////////////////////////// for (int rcpIndex = 0; rcpIndex < rd.getNumControlPoints(); rcpIndex++) { roadControlPoint rcp = rd.getPoint(rcpIndex); int numTris = (int)(rcp.mVerts.Count / 3); for (int triIndex = 0; triIndex < numTris; triIndex++) { RoadTriangle rt = new RoadTriangle(); rt.mVerts[0] = new RoadVert(); rt.mVerts[0].mPos = new Vector3(rcp.mVerts[triIndex * 3 + 0].x, rcp.mVerts[triIndex * 3 + 0].y, rcp.mVerts[triIndex * 3 + 0].z); rt.mVerts[0].mUv0 = new Vector2(rcp.mVerts[triIndex * 3 + 0].u0, rcp.mVerts[triIndex * 3 + 0].v0); rt.mVerts[1] = new RoadVert(); rt.mVerts[1].mPos = new Vector3(rcp.mVerts[triIndex * 3 + 1].x, rcp.mVerts[triIndex * 3 + 1].y, rcp.mVerts[triIndex * 3 + 1].z); rt.mVerts[1].mUv0 = new Vector2(rcp.mVerts[triIndex * 3 + 1].u0, rcp.mVerts[triIndex * 3 + 1].v0); rt.mVerts[2] = new RoadVert(); rt.mVerts[2].mPos = new Vector3(rcp.mVerts[triIndex * 3 + 2].x, rcp.mVerts[triIndex * 3 + 2].y, rcp.mVerts[triIndex * 3 + 2].z); rt.mVerts[2].mUv0 = new Vector2(rcp.mVerts[triIndex * 3 + 2].u0, rcp.mVerts[triIndex * 3 + 2].v0); triList.Add(rt); } } //now add our triStrip segments (into triLists) for (int segIndex = 0; segIndex < rd.getNumRoadSegments(); segIndex++) { roadSegment rs = rd.getRoadSegment(segIndex); int numTris = rs.mNumVerts - 2; int vertIndex = rs.mStartVertInParentSegment + 2; for (int i = 0; i < numTris; i++) { RoadTriangle rt = new RoadTriangle(); rt.mVerts[0] = new RoadVert(); rt.mVerts[0].mPos = new Vector3(rd.mVerts[vertIndex - 2].x, rd.mVerts[vertIndex - 2].y, rd.mVerts[vertIndex - 2].z); rt.mVerts[0].mUv0 = new Vector2(rd.mVerts[vertIndex - 2].u0, rd.mVerts[vertIndex - 2].v0); rt.mVerts[1] = new RoadVert(); rt.mVerts[1].mPos = new Vector3(rd.mVerts[vertIndex - 1].x, rd.mVerts[vertIndex - 1].y, rd.mVerts[vertIndex - 1].z); rt.mVerts[1].mUv0 = new Vector2(rd.mVerts[vertIndex - 1].u0, rd.mVerts[vertIndex - 1].v0); rt.mVerts[2] = new RoadVert(); rt.mVerts[2].mPos = new Vector3(rd.mVerts[vertIndex].x, rd.mVerts[vertIndex].y, rd.mVerts[vertIndex].z); rt.mVerts[2].mUv0 = new Vector2(rd.mVerts[vertIndex].u0, rd.mVerts[vertIndex].v0); triList.Add(rt); vertIndex++; } } //Step 2, split Polygons//////////////////////////////////////////////////// int width = (int)(BTerrainQuadNode.cMaxWidth); int numPlanes = (int)(TerrainGlobals.getTerrain().getNumXVerts() / width); //Split along XPlane for (int planeIndex = 0; planeIndex < numPlanes; planeIndex++) { Plane pl = Plane.FromPointNormal(new Vector3(planeIndex * width * TerrainGlobals.getTerrain().getTileScale(), 0, 0), BMathLib.unitX); splitPolyListAgainstPlane(pl, triList); } //split along ZPlane for (int planeIndex = 0; planeIndex < numPlanes; planeIndex++) { Plane pl = Plane.FromPointNormal(new Vector3(0, 0, planeIndex * width * TerrainGlobals.getTerrain().getTileScale()), BMathLib.unitZ); splitPolyListAgainstPlane(pl, triList); } //Step 3, add polies to qn.///////////////////////////////////////////////// List <RoadQN> roadQNs = new List <RoadQN>(); int numQNs = (int)(TerrainGlobals.getTerrain().getNumXVerts() / width); int qnWidth = (int)(width * TerrainGlobals.getTerrain().getTileScale()); for (int qnX = 0; qnX < numQNs; qnX++) { for (int qnZ = 0; qnZ < numQNs; qnZ++) { float x = qnX * qnWidth; float z = qnZ * qnWidth; RoadQN rqn = new RoadQN(); for (int triIndex = 0; triIndex < triList.Count; triIndex++) { if (triContainedInBox(triList[triIndex], x, z, x + qnWidth, z + qnWidth)) { triList[triIndex].ensureWinding(); rqn.mTris.Add(triList[triIndex]); rqn.mOwnerQNIndex = qnX * numQNs + qnZ; } } if (rqn.mTris.Count != 0) { roadQNs.Add(rqn); } } } //Step 4, write road chunk to disk.///////////////////////////////////////////// ECF.ECFChunkHolder chunkHolder = new ECF.ECFChunkHolder(); chunkHolder.mDataMemStream = new MemoryStream(); BinaryWriter binWriter = new BinaryWriter(chunkHolder.mDataMemStream); //Filename string fName = CoreGlobals.getWorkPaths().mRoadsPath + "\\" + rd.getRoadTextureName(); fName = fName.Remove(0, CoreGlobals.getWorkPaths().mGameArtDirectory.Length + 1); char[] filename = new char[32]; fName.CopyTo(0, filename, 0, fName.Length); binWriter.Write(filename); ExportTo360.addTextureChannelDependencies(CoreGlobals.getWorkPaths().mRoadsPath + "\\" + rd.getRoadTextureName()); float zero = 0; int totalMemory = 0; //write our chunks binWriter.Write(Xbox_EndianSwap.endSwapI32(roadQNs.Count)); for (int qnI = 0; qnI < roadQNs.Count; qnI++) { binWriter.Write(Xbox_EndianSwap.endSwapI32(roadQNs[qnI].mOwnerQNIndex)); binWriter.Write(Xbox_EndianSwap.endSwapI32(roadQNs[qnI].mTris.Count)); int memSize = roadQNs[qnI].mTris.Count * (3 * (sizeof(short) * 6)); binWriter.Write(Xbox_EndianSwap.endSwapI32(memSize)); List <float> vList = new List <float>(); for (int c = 0; c < roadQNs[qnI].mTris.Count; c++) { for (int i = 0; i < 3; i++) { vList.Add(roadQNs[qnI].mTris[c].mVerts[i].mPos.X); vList.Add(roadQNs[qnI].mTris[c].mVerts[i].mPos.Y); vList.Add(roadQNs[qnI].mTris[c].mVerts[i].mPos.Z); vList.Add(zero); //padd; vList.Add(roadQNs[qnI].mTris[c].mVerts[i].mUv0.X); vList.Add(roadQNs[qnI].mTris[c].mVerts[i].mUv0.Y); } } float16[] sList = BMathLib.Float32To16Array(vList.ToArray()); for (int c = 0; c < vList.Count; c++) { ushort s = ((ushort)sList[c].getInternalDat()); binWriter.Write(Xbox_EndianSwap.endSwapI16(s)); } totalMemory += memSize; } ExportTo360.mECF.addChunk((int)eXTT_ChunkID.cXTT_RoadsChunk, chunkHolder, binWriter.BaseStream.Length); binWriter.Close(); binWriter = null; chunkHolder.Close(); chunkHolder = null; roadQNs.Clear(); triList.Clear(); TimeSpan ts = DateTime.Now - n; results.terrainRoadTime = ts.TotalMinutes; results.terrainRoadMemory = totalMemory; } }
override public bool computeOutput(ConnectionPoint connPoint, OutputGenerationParams parms) { if (!verifyInputConnections()) { return(false); } if (SelectedMaskName == null || SelectedMaskName == "") { return(false); } gatherInputAndParameters(parms); ArrayBasedMask terrMask = null; IMask msk = CoreGlobals.getEditorMain().mIMaskPickerUI.GetMask(SelectedMaskName); if (msk == null) { return(false); } if (msk is ArrayBasedMask) { terrMask = msk as ArrayBasedMask; } else if (msk is GraphBasedMask) { //we have to generate this mask... if (((GraphBasedMask)msk).loadAndExecute()) { terrMask = ((GraphBasedMask)msk).getOutputMask(); } } int numXVerts = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts(); int numZVerts = CoreGlobals.getEditorMain().mITerrainShared.getNumXVerts(); float[] fk = new float[numXVerts * numZVerts]; for (int x = 0; x < numXVerts; x++) { for (int y = 0; y < numZVerts; y++) { fk[x + numXVerts * y] = terrMask.GetValue(x * numXVerts + y); } } if (numXVerts != parms.Width || numZVerts != parms.Height) { float[] resizedHeights = ImageManipulation.resizeF32Img(fk, numXVerts, numZVerts, parms.Width, parms.Height, ImageManipulation.eFilterType.cFilter_Linear); fk = (float[])resizedHeights.Clone(); } MaskParam mp = ((MaskParam)(connPoint.ParamType)); mp.Value = new DAGMask(parms.Width, parms.Height); for (int x = 0; x < parms.Width; x++) { for (int y = 0; y < parms.Height; y++) { float k = fk[x + parms.Width * y]; mp.Value[x, y] = k; } } terrMask = null; msk = null; return(true); }
public TriggerTemplatePage() { InitializeComponent(); TriggerSystemMain.Init(); triggerHostArea1.ViewChanged += new EventHandler(triggerHostArea1_ViewChanged); previewNavWindow1.BorderStyle = BorderStyle.FixedSingle; TemplateAttributesPropertyGrid.IgnoreProperties("TriggerTemplateMapping", new string[] { "InputMappings", "OutputMappings", "TriggerInputs", "TriggerOutputs", "GroupID", "ID", "X", "Y", "Name", "CommentOut" }); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "SizeX", "Min", 30); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "SizeX", "Max", 800); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "SizeY", "Min", 30); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "SizeY", "Max", 500); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "Image", "FileFilter", "Images (*.bmp)|*.bmp"); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "Image", "RootDirectory", CoreGlobals.getWorkPaths().mBaseDirectory); TemplateAttributesPropertyGrid.AddMetaDataForProp("TriggerTemplateMapping", "Image", "StartingDirectory", Path.Combine(CoreGlobals.getWorkPaths().mAppIconDir, "TriggerEditor")); TemplateAttributesPropertyGrid.SetTypeEditor("TriggerTemplateMapping", "Image", typeof(FileNameProperty)); TemplateAttributesPropertyGrid.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(onAnyPropertyChanged); InputVarsBasicTypedSuperList.UseLabels = false; OutputVarsBasicTypedSuperList.UseLabels = false; InputTriggersBasicTypedSuperList.UseLabels = false; OutputTriggersBasicTypedSuperList.UseLabels = false; InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "Type", "ReadOnly", true); InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "ID", "Ignore", true); //InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "Optional", "Ignore", true); InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "SigID", "Ignore", true); InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "BindID", "TriggerNamespace", mMainTriggerSystem.MainNamespace); InputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputVariable", "BindID", "UpdateEvent", true); InputVarsBasicTypedSuperList.SetTypeEditor("TriggersTemplateInputVariable", "BindID", typeof(VariableIDProperty)); InputVarsBasicTypedSuperList.mListDataObjectType = typeof(TriggersTemplateInputVariable); InputVarsBasicTypedSuperList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(basicTypedSuperList1_SelectedObjectPropertyChanged); InputVarsBasicTypedSuperList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(onAnyPropertyChanged); InputVarsBasicTypedSuperList.NeedsResize += new EventHandler(BasicTypedSuperList_Changed); OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "Type", "ReadOnly", true); OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "ID", "Ignore", true); //OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "Optional", "Ignore", true); OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "SigID", "Ignore", true); OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "BindID", "TriggerNamespace", mMainTriggerSystem.MainNamespace); OutputVarsBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputVariable", "BindID", "UpdateEvent", true); OutputVarsBasicTypedSuperList.SetTypeEditor("TriggersTemplateOutputVariable", "BindID", typeof(VariableIDProperty)); OutputVarsBasicTypedSuperList.mListDataObjectType = typeof(TriggersTemplateOutputVariable); OutputVarsBasicTypedSuperList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(basicTypedSuperList1_SelectedObjectPropertyChanged); OutputVarsBasicTypedSuperList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(onAnyPropertyChanged); OutputVarsBasicTypedSuperList.NeedsResize += new EventHandler(BasicTypedSuperList_Changed); InputTriggersBasicTypedSuperList.IgnoreProperties("TriggersTemplateInputActionBinder", new string[] { "Color", "TargetIDs", "_TargetID", "BindID" }); InputTriggersBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateInputActionBinder", "_BindID", "ReadOnly", true); InputTriggersBasicTypedSuperList.SetTypeEditor("TriggersTemplateInputActionBinder", "_BindID", typeof(TriggerBindIDProperty)); InputTriggersBasicTypedSuperList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(InputTriggersBasicTypedSuperList_SelectedObjectPropertyChanged); InputTriggersBasicTypedSuperList.mListDataObjectType = typeof(TriggersTemplateInputActionBinder); InputTriggersBasicTypedSuperList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(onAnyPropertyChanged); InputTriggersBasicTypedSuperList.NeedsResize += new EventHandler(BasicTypedSuperList_Changed); OutputTriggersBasicTypedSuperList.IgnoreProperties("TriggersTemplateOutputActionBinder", new string[] { "Color", "TargetIDs", "_TargetID", "BindID" }); OutputTriggersBasicTypedSuperList.AddMetaDataForProp("TriggersTemplateOutputActionBinder", "_BindID", "ReadOnly", true); OutputTriggersBasicTypedSuperList.SetTypeEditor("TriggersTemplateOutputActionBinder", "_BindID", typeof(TriggerBindIDProperty)); OutputTriggersBasicTypedSuperList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(OutputTriggersBasicTypedSuperList_SelectedObjectPropertyChanged); OutputTriggersBasicTypedSuperList.mListDataObjectType = typeof(TriggersTemplateOutputActionBinder); OutputTriggersBasicTypedSuperList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(onAnyPropertyChanged); OutputTriggersBasicTypedSuperList.NeedsResize += new EventHandler(BasicTypedSuperList_Changed); TriggerRoot trigroot = new TriggerRoot(); mFakeTriggerSystem.TriggerData = trigroot; triggerHostArea2.CurrentTriggerNamespace = mFakeTriggerSystem.MainNamespace; TemplateDefinition = new TriggerTemplateDefinition(); }
public void redrawPreviewList(int paletteIndex) { //try //{ flowLayoutPanel1.Controls.Clear(); flowLayoutPanel1.Controls.Add(new TerrainTitleButton("SplatTextures", this)); string setName = ""; if (paletteIndex == 0) { List <TerrainTextureDef> activeTexDefs = SimTerrainType.getDefsOfActiveSet(); if (activeTexDefs.Count == 0) { MessageBox.Show("An error has occured with the active texture defnitions. Please send this scenario to the editor people."); return; } for (int i = 0; i < activeTexDefs.Count; i++) { flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(activeTexDefs[i].TypeName, SimTerrainType.getWorkingTexName(activeTexDefs[i]), TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(activeTexDefs[i]), mThumbnailSize), this)); } //visually identify our base texture flowLayoutPanel1.Controls[firstSplatIndex()].BackColor = Color.FromArgb(96, 0, 0, 0); } else if (paletteIndex <= mNumThemes) { setName = comboBox1.Items[paletteIndex].ToString(); setName = setName.Remove(setName.LastIndexOf("_FULL")); List <TerrainTextureDef> tList = SimTerrainType.getFilteredDefs(setName); setName = comboBox1.Items[paletteIndex].ToString(); for (int i = 0; i < tList.Count; i++) { flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(tList[i].TypeName, SimTerrainType.getWorkingTexName(tList[i]), TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(tList[i]), mThumbnailSize), this)); } } else { setName = comboBox1.Items[paletteIndex].ToString(); string fname = CoreGlobals.getWorkPaths().mTerrainTexturesPath + @"\" + setName + SimTerrainType.mTextureSetExtention; List <TerrainSetTexture> texSet = SimTerrainType.loadTerrainPalette(fname); for (int i = 0; i < texSet.Count; i++) { TerrainSetTexture obj = texSet[i]; { TerrainTextureDef def = SimTerrainType.getFromTypeName(obj.mTypeName); if (def == null) { def = new TerrainTextureDef(); def.ObstructLand = false; def.TextureName = EditorCore.CoreGlobals.getWorkPaths().mBlankTextureName; } flowLayoutPanel1.Controls.Add(new TerrainTextureSplatButton(obj.mTypeName, SimTerrainType.getWorkingTexName(def), TextureManager.loadTextureToThumbnail(SimTerrainType.getWorkingTexName(def), mThumbnailSize), this)); } } } flowLayoutPanel1.Controls.Add(new TerrainTitleButton("DecalTextures", this)); int decalIndex = firstDecalIndex(); //now add our decals if (paletteIndex == 0) { for (int i = 0; i < TerrainGlobals.getTexturing().getActiveDecalCount(); i++) { string displName = Path.GetFileNameWithoutExtension(TerrainGlobals.getTexturing().getActiveDecal(i).mFilename); displName = displName.Remove(displName.LastIndexOf("_")); flowLayoutPanel1.Controls.Add(new TerrainTextureDecalButton(displName, TerrainGlobals.getTexturing().getActiveDecal(i).mFilename, TextureManager.loadTextureToThumbnail(TerrainGlobals.getTexturing().getActiveDecal(i).mFilename, mThumbnailSize), this)); } } else if (paletteIndex <= mNumThemes) { setName = comboBox1.Items[paletteIndex].ToString(); setName = setName.Remove(setName.LastIndexOf("_FULL")); string[] textureNames = Directory.GetFiles(CoreGlobals.getWorkPaths().mTerrainTexturesPath + "\\" + setName, "*_dcl_*.ddx", SearchOption.AllDirectories); for (int i = 0; i < textureNames.Length; i++) { if (!textureNames[i].Contains("_df")) { continue; } String ext = Path.GetExtension(textureNames[i]); if (!File.Exists(textureNames[i].Substring(0, textureNames[i].LastIndexOf("_df")) + "_op" + ext)) { continue; } string displName = Path.GetFileNameWithoutExtension(textureNames[i]); displName = displName.Remove(displName.LastIndexOf("_")); flowLayoutPanel1.Controls.Add(new TerrainTextureDecalButton(displName, Path.ChangeExtension(textureNames[i], ".tga"), TextureManager.loadTextureToThumbnail(Path.ChangeExtension(textureNames[i], ".tga"), mThumbnailSize), this)); } } else { //not supported yet... } //} //catch (System.Exception ex) //{ // if (mbPostTEDLoadRecovery) // { // CoreGlobals.getErrorManager().OnException(ex); // } //} }
private void AllowOverwriteCheckBox_CheckedChanged(object sender, EventArgs e) { CoreGlobals.getScenarioWorkTopicManager().sAllowOverwrite = AllowOverwriteCheckBox.Checked; this.UpdateUI(); }
public TriggerDataDefinitionPage() { InitializeComponent(); TriggerSystemMain.Init(); mTriggerDefinitionFilename = CoreGlobals.getWorkPaths().mEditorSettings + "\\triggerDescription.xml"; mTriggerDefinitionDBIDs = CoreGlobals.getWorkPaths().mEditorSettings + "\\triggerDBIDs.xml"; ConditionsListBox.SelectedIndexChanged += new EventHandler(EffectsConditionsListBox_SelectedIndexChanged); EffectsListBox.SelectedIndexChanged += new EventHandler(EffectsListBox_SelectedIndexChanged); VersionListBox.SelectedIndexChanged += new EventHandler(VersionListBox_SelectedIndexChanged); ItemPropertyGrid.AddMetaDataForProp("ConditionDefinition", "Documentation", "Multiline", true); ItemPropertyGrid.AddMetaDataForProp("EffectDefinition", "Documentation", "Multiline", true); ItemPropertyGrid.IgnoreProperties("ConditionDefinition", new string[] { "Type", "InParameterDefinitions", "OutParameterDefinitions", "ParameterConversionOverrides" }); ItemPropertyGrid.IgnoreProperties("EffectDefinition", new string[] { "Type", "InParameterDefinitions", "OutParameterDefinitions", "ParameterConversionOverrides" }); ItemPropertyGrid.AddMetaDataForProps("ConditionDefinition", new string[] { "Version", "DBID", "MaxVarID" }, "ReadOnly", true); ItemPropertyGrid.AddMetaDataForProps("EffectDefinition", new string[] { "Version", "DBID", "MaxVarID" }, "ReadOnly", true); ItemPropertyGrid.AnyPropertyChanged += new ObjectEditorControl.PropertyChanged(On_AnyPropertyChanged); InVariblesList.AddMetaDataForProp("InParameterDefintion", "Type", "SimpleEnumeration", TriggerSystemMain.mTriggerDefinitions.GetTypeNames()); InVariblesList.SetTypeEditor("InParameterDefintion", "Type", typeof(EnumeratedProperty)); InVariblesList.AddMetaDataForProp("InParameterDefintion", "SigID", "ReadOnly", true); InVariblesList.AddMetaDataForProp("InParameterDefintion", "Type", "UpdateEvent", true); InVariblesList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(InVariblesList_SelectedObjectPropertyChanged); InVariblesList.NewObjectAdded += new BasicTypedSuperList.ObjectChanged(InVariblesList_NewObjectAdded); InVariblesList.mListDataObjectType = typeof(InParameterDefintion); InVariblesList.AutoScroll = true; InVariblesList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(On_AnyPropertyChanged); OutVariablesList.AddMetaDataForProp("OutParameterDefition", "Type", "SimpleEnumeration", TriggerSystemMain.mTriggerDefinitions.GetTypeNames()); OutVariablesList.SetTypeEditor("OutParameterDefition", "Type", typeof(EnumeratedProperty)); OutVariablesList.AddMetaDataForProp("OutParameterDefition", "SigID", "ReadOnly", true); OutVariablesList.AddMetaDataForProp("OutParameterDefition", "Type", "UpdateEvent", true); OutVariablesList.SelectedObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(OutVariablesList_SelectedObjectPropertyChanged); OutVariablesList.NewObjectAdded += new BasicTypedSuperList.ObjectChanged(OutVariablesList_NewObjectAdded); OutVariablesList.mListDataObjectType = typeof(OutParameterDefition); OutVariablesList.AutoScroll = true; OutVariablesList.AnyObjectPropertyChanged += new BasicTypedSuperList.PropertyChanged(On_AnyPropertyChanged); ConversionList.AutoScroll = true; ConversionList.AddMetaDataForProp("ParameterConversionOverride", "OldParameter", "StringIntEnumeration", new Pair <List <int>, List <string> >()); ConversionList.AddMetaDataForProp("ParameterConversionOverride", "NewParameter", "StringIntEnumeration", new Pair <List <int>, List <string> >()); ConversionList.SetTypeEditor("ParameterConversionOverride", "OldParameter", typeof(EnumeratedProperty)); ConversionList.SetTypeEditor("ParameterConversionOverride", "NewParameter", typeof(EnumeratedProperty)); ConversionList.mListDataObjectType = typeof(ParameterConversionOverride); LoadData(); LoadUI(); UpdateVersionsButton.Visible = false; SaveToNewVersionButton.Enabled = false; SaveToSelectedButton.Enabled = false; this.SaveButton.Visible = false; this.SaveNewNameButton.Click += new EventHandler(SaveNewNameButton_Click); NameTextBox.TextChanged += new EventHandler(NameTextBox_TextChanged); SaveNewNameButton.Enabled = false; //add in the template editor //TemplateVersionControl tvc = new TemplateVersionControl(); //tabPage2.Controls.Add(tvc); //tvc.Dock = DockStyle.Fill; }
public ScenarioDataPage() { InitializeComponent(); // lookup for the scenario file basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "File", "FileFilter", "Scenario (*.scn)|*.scn"); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "File", "RootDirectory", CoreGlobals.getWorkPaths().mGameScenarioDirectory); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "File", "StartingDirectory", CoreGlobals.getWorkPaths().mGameScenarioDirectory); basicTypedSuperList1.SetTypeEditor("ScenarioInfoXml", "File", typeof(FileNameProperty)); // lookup for the loading screen basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "LoadingScreen", "FileFilter", "Flash (*.swf)|*.swf"); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "LoadingScreen", "RootDirectory", CoreGlobals.getWorkPaths().mGameDirectory); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "LoadingScreen", "StartingDirectory", CoreGlobals.getWorkPaths().mGameFlashUIDirectory); basicTypedSuperList1.SetTypeEditor("ScenarioInfoXml", "LoadingScreen", typeof(FileNameProperty)); // lookup for the map image basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "MapName", "FileFilter", "ddx (*.ddx)|*.ddx"); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "MapName", "RootDirectory", CoreGlobals.getWorkPaths().mGameDirectory); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "MapName", "StartingDirectory", CoreGlobals.getWorkPaths().mGameLoadmapDirectory); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "MapName", "FilePrefix", "img://"); basicTypedSuperList1.SetTypeEditor("ScenarioInfoXml", "MapName", typeof(FileNameProperty)); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "Type", "SimpleEnumeration", new string[] { "Playtest", "Development", "Test", "Campaign", "Alpha" }); basicTypedSuperList1.SetTypeEditor("ScenarioInfoXml", "Type", typeof(EnumeratedProperty)); basicTypedSuperList1.AddMetaDataForProp("ScenarioInfoXml", "MaxPlayers", "SimpleEnumeration", new string[] { "2", "4", "6" }); basicTypedSuperList1.SetTypeEditor("ScenarioInfoXml", "MaxPlayers", typeof(EnumeratedProperty)); mDescriptionFilename = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, "scenariodescriptions.xml"); if (CoreGlobals.UsingPerforce == false) { CheckoutButton.Enabled = false; CheckInButton.Enabled = false; SaveButton.Enabled = false; return; } else { CheckoutButton.Enabled = false; CheckInButton.Enabled = false; //no perfore support yet... SaveButton.Enabled = true; basicTypedSuperList1.Enabled = true; } basicTypedSuperList1.AutoScroll = true; Load(); }