private void ExportButton_Click(object sender, EventArgs e) { SaveFileDialog d = new SaveFileDialog(); d.Filter = "Global Lightset (*.gls)|*.gls"; d.FilterIndex = 0; d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory; if (d.ShowDialog() == DialogResult.OK) { saveXML(d.FileName); CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory = Path.GetDirectoryName(d.FileName); } }
private void talkingHeadAddBtn_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mTalkingHeadDirectory; d.Filter = "Bink Files (*.bik)|*.bik"; d.FilterIndex = 0; d.Multiselect = true; if (d.ShowDialog() == DialogResult.OK) { string[] filenames = d.FileNames; for (int i = 0; i < filenames.Length; i++) { //string filename = d.FileName.Replace(CoreGlobals.getWorkPaths().mTalkingHeadDirectory, ""); string filename = filenames[i].Replace(CoreGlobals.getWorkPaths().mTalkingHeadDirectory, ""); // Remove extension filename = filename.Remove(filename.Length - 4); //kill leading \\ filename = filename.TrimStart(new char[] { '\\' }); // Check to see if this is a duplicate if (!CoreGlobals.getGameResources().ContainsTalkingHeadVideo(filename)) { // Add to data CoreGlobals.getGameResources().AddTalkingHeadVideo(filename); // Pause painting talkingHeadVideos.BeginUpdate(); // Add to list box talkingHeadVideos.Items.Add(filename); // Assign list box selection to the new objective talkingHeadVideos.SelectedIndex = talkingHeadVideos.Items.IndexOf(filename); // Resume painting talkingHeadVideos.EndUpdate(); } } } SettingsChanged(); }
private void SaveAsButton_Click(object sender, EventArgs e) { SaveFileDialog d = new SaveFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mClipArt; d.Filter = "ES ClipArt files (*.esd)|*.esd"; d.FilterIndex = 0; if (d.ShowDialog() == DialogResult.OK) { mData.mFileName = d.FileName; Save(); this.DialogResult = DialogResult.OK; this.Close(); } }
private void Import_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.Filter = "Global Lightset (*.gls)|*.gls"; d.FilterIndex = 0; d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory; if (d.ShowDialog() == DialogResult.OK) { loadXML(d.FileName, true); SimGlobals.getSimMain().SetLightsDirty(); CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory = Path.GetDirectoryName(d.FileName); } }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameMinimapDirectory; d.Filter = "ES Texture File (*.ddx)|*.ddx"; d.FilterIndex = 0; if (d.ShowDialog() == DialogResult.OK) { CoreGlobals.ScenarioMinimapTextureFilename = d.FileName.Replace(CoreGlobals.getWorkPaths().mGameArtDirectory, ""); textBox1.Text = CoreGlobals.ScenarioMinimapTextureFilename; } SettingsChanged(); }
private void AddLightsetButton_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameArtDirectory + "\\lightsets"; d.Filter = "ES Lightset File (*.gls)|*.gls"; d.FilterIndex = 0; if (d.ShowDialog() == DialogResult.OK) { string filename = d.FileName.Replace(CoreGlobals.getWorkPaths().mGameArtDirectory, ""); // Remove extension filename = filename.Remove(filename.Length - 4); //kill leading \\ filename = filename.TrimStart(new char[] { '\\' }); // Check to see if this is a duplicate if (!CoreGlobals.getGameResources().ContainsLightset(filename)) { // Add to data EditorLightset set = CoreGlobals.getGameResources().AddLightset(filename); // Pause painting LightsetListBox.BeginUpdate(); // Add to list box LightsetListBox.Items.Add(set.getIDString()); // Assign list box selection to the new objective LightsetListBox.SelectedIndex = LightsetListBox.Items.IndexOf(filename); // Resume painting LightsetListBox.EndUpdate(); } else { MessageBox.Show("The Lightset you have selected is already on the list"); } } SettingsChanged(); }
//-- Add Stage private void button1_Click(object sender, EventArgs e) { if (!bInitialized) { return; } OpenFileDialog d = new OpenFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mParticleEffectDirectory; d.Filter = "TGA Texture (*.tga)|*.tga"; if (d.ShowDialog() == DialogResult.OK) { EditorCore.CoreGlobals.getSaveLoadPaths().mParticleEffectDirectory = Path.GetDirectoryName(d.FileName); TextureStage newTexture = new TextureStage(); String filePath = d.FileName; ResourcePathInfo pathInfo = new ResourcePathInfo(d.FileName); newTexture.file = pathInfo.RelativePath; //-- strip out the stupid art directory - //-- ResourcePathInfo should cooler and do this for you if (mArtFolder.Length > 0) { newTexture.file = newTexture.file.Substring(mArtFolder.Length); } newTexture.weight = 1.0f; data.Textures.Add(newTexture); refreshListBox(false); getModifiedData(); //-- select the new item int selectedItem = listView1.Items.Count - 1; if (selectedItem < 0) { selectedItem = 0; } selectItem(selectedItem); } }
public void apply() { //apply our lightset string glsLightSet = CoreGlobals.getWorkPaths().mGameDirectory + "\\" + mGLSFileToUse; if (File.Exists(glsLightSet)) { SimGlobals.getSimMain().LoadScenarioLights(glsLightSet, false); CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory = Path.GetDirectoryName(glsLightSet); } //apply children nodes for (int i = 0; i < Nodes.Count; i++) { if (Nodes[i] is ActionTreeNode) { ((ActionTreeNode)Nodes[i]).apply(); } } }
private void button1_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameLightsetBaseDirectory; d.Filter = "ES Lightset File (*.gls)|*.gls"; d.FilterIndex = 0; if (d.ShowDialog() == DialogResult.OK) { //remove anything before 'work' if (d.FileName.Contains(CoreGlobals.getWorkPaths().mGameDirectory)) { d.FileName = d.FileName.Remove(0, CoreGlobals.getWorkPaths().mGameDirectory.Length + 1); } glsTextBox.Text = d.FileName; mOwnerNode.mGLSFileToUse = glsTextBox.Text; } }
private void buttonBrowse_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); string filter; filter = mFilterName + " (*" + mFilterExtension + ")|*" + mFilterExtension; d.Filter = filter; d.FilterIndex = 0; d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameDirectory; if ((mFileName != null) && (mFileName.Length > 0)) { if (mReferenceFolder.Length > 0) { d.InitialDirectory += "\\" + mReferenceFolder; } d.InitialDirectory += "\\" + mFileName; if (!Path.HasExtension(d.InitialDirectory)) { // Add extension d.InitialDirectory += mFilterExtension; } } else { // Use last browse folder if it matches the startup folder if ((sLastBrowseDirectory != null) && (sLastBrowseDirectory.Length > 0)) { if (mStartFolder.Length > 0) { if (sLastBrowseDirectory.IndexOf(mStartFolder) != -1) { d.InitialDirectory += "\\" + sLastBrowseDirectory; } else { d.InitialDirectory += "\\" + mStartFolder; } } else { d.InitialDirectory += "\\" + sLastBrowseDirectory; } } else { if (mStartFolder.Length > 0) { d.InitialDirectory += "\\" + mStartFolder; } } } if (d.ShowDialog() == DialogResult.OK) { ResourcePathInfo relativePathName = new ResourcePathInfo(d.FileName); if (relativePathName.IsRelativePath) { string relativeFileName = relativePathName.RelativePath; // Remove ReferenceFolder if non-empty if (mStartFolder.Length > 0) { relativeFileName = relativeFileName.Substring(mReferenceFolder.Length + 1); } // Remove extension relativeFileName = relativeFileName.Remove(relativeFileName.Length - 4); FileName = relativeFileName; // Remember last directory we were in. sLastBrowseDirectory = relativePathName.RelativePath; // call event EventArgs args = new EventArgs(); if (ValueChanged != null) { ValueChanged(this, args); } } else { if (MessageBox.Show("File is not under the correct folder. Nothing changed.", "Warning", MessageBoxButtons.OK) != DialogResult.OK) { return; } } } }
private void AddViaAnimButton_Click(object sender, EventArgs e) { try { string filename = Path.Combine(CoreGlobals.getWorkPaths().mGameDataDirectory, "xobjects.xml"); if (File.GetAttributes(filename) == FileAttributes.ReadOnly) { MessageBox.Show(filename + " is readonly. please check it out"); } if (NodeComboBox.SelectedItem == null) { return; } UnitHolder copyholder = NodeComboBox.SelectedItem as UnitHolder; if (copyholder == null) { return; } OpenFileDialog d = new OpenFileDialog(); d.Filter = "AnimXML (*.xml)|*.xml"; d.FilterIndex = 0; d.InitialDirectory = CoreGlobals.getSaveLoadPaths().mGameArtDirectory; if (d.ShowDialog() == DialogResult.OK) { //Validate xml List <string> models = SimUnitXML.getGrannyFileNames(d.FileName); if (models.Count == 0) { if (MessageBox.Show(String.Format("No models found in {0} add anyway?", d.FileName), "", MessageBoxButtons.YesNo) == DialogResult.Yes) { } else { return; } } string name = Path.GetFileNameWithoutExtension(d.FileName); //check for duplicates foreach (UnitHolder holder in this.NodeComboBox.Items) { if (holder.mName == name) { MessageBox.Show(name + " has already been added to xobjects"); return; } } mHightestID++; int id = mHightestID; string artpath = CoreGlobals.getWorkPaths().mGameArtDirectory + "\\"; string animFileName = d.FileName.Substring(artpath.Length); //BuildNode XmlNode unit = copyholder.mNode.Clone(); XmlAttribute nameAttr = (XmlAttribute)unit.Attributes.GetNamedItem("name"); nameAttr.Value = name; XmlAttribute idAttr = (XmlAttribute)unit.Attributes.GetNamedItem("id"); idAttr.Value = id.ToString(); XmlNode animFile = ((XmlElement)unit).GetElementsByTagName("Visual")[0]; animFile.InnerText = animFileName; //Add to File XmlNode protoNode = doc.GetElementsByTagName("Proto")[0]; protoNode.AppendChild(unit); doc.Save(filename); CoreGlobals.getSaveLoadPaths().mGameArtDirectory = Path.GetDirectoryName(d.FileName); listBox1.Items.Add(String.Format("Added: {0}", name)); this.NodeComboBox.Items.Add(new UnitHolder(name, unit)); foreach (string modelname in models) { listBox1.Items.Add(String.Format(" Model: {0}", modelname)); } } } catch (System.Exception ex) { CoreGlobals.getErrorManager().OnException(ex); } }