private void cinematicDeleteButton_Click(object sender, EventArgs e) { if (cinematicListBox.SelectedItem == null) { return; } // Delete objective from local list CoreGlobals.getGameResources().RemoveCinematic(cinematicListBox.SelectedItem.ToString()); // Pause painting cinematicListBox.BeginUpdate(); // Grab objective from list box object deletedCinematic = cinematicListBox.SelectedItem; // Select the next cinematic in the list box if ((cinematicListBox.SelectedIndex + 1) < cinematicListBox.Items.Count) { cinematicListBox.SelectedIndex += 1; } else if (cinematicListBox.Items.Count >= 2) { cinematicListBox.SelectedIndex -= 1; } // Delete the objective from list box cinematicListBox.Items.Remove(deletedCinematic); // Continue painting cinematicListBox.EndUpdate(); SettingsChanged(); }
private void IDTextBox_TextChanged(object sender, EventArgs e) { int id = 0; if (int.TryParse(IDTextBox.Text, out id)) { LocString value; if (CoreGlobals.getGameResources().mStringTable.mStringsByID.TryGetValue(id.ToString(), out value)) { mLocString = value; StringTextLabel.Text = value.mString; if (IDChanged != null) { IDChanged.Invoke(this, mLocString); } StringTextLabel.ForeColor = System.Drawing.Color.Black; return; } else { StringTextLabel.Text = "###ID not found"; StringTextLabel.ForeColor = System.Drawing.Color.Red; } } else { StringTextLabel.Text = "###Please type an id number"; StringTextLabel.ForeColor = System.Drawing.Color.Red; } }
private bool IsStringID(string stringID) { // do a number conversion test bool isStringID = true; try { int locID = int.Parse(stringID); } catch (System.Exception e) { isStringID = false; } if (isStringID) { LocString locString; if (!CoreGlobals.getGameResources().mStringTable.mStringsByID.TryGetValue(stringID, out locString)) { isStringID = false; // this was the final test. } } return(isStringID); }
private bool IsStringID(int stringID) { // do a number conversion test LocString locString; if (!CoreGlobals.getGameResources().mStringTable.mStringsByID.TryGetValue(stringID.ToString(), out locString)) { return(false); // this was the final test. } return(true); }
private string GetLocString(string locID) { string locString = null; LocString locStringObject; if (CoreGlobals.getGameResources().mStringTable.mStringsByID.TryGetValue(locID, out locStringObject)) { locString = locStringObject.mString; } return(locString); }
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 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(); }
private void BindScenarioPlayerData() { //mPlayerPlacementSettingsGrid.SelectedObject = mSimMain.PlayerPlacementData; gridControl1.DataSource = mSimMain.PlayerData.Player; gridControl1.SingleClickEdit = true; AddComboEditor(gridControl1.Columns, "Civ", new string[] { "UNSC", "Covenant" }); AddComboEditor(gridControl1.Columns, "Team", new string[] { "1", "2", "3", "4" }); AddComboEditor(gridControl1.Columns, "Color", new string[] { "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13" }); Dictionary <string, LocString> playerNames = CoreGlobals.getGameResources().mStringTable.mStringsByScenario["PlayerName"]; Dictionary <string, LocString> .Enumerator it = playerNames.GetEnumerator(); List <string> playerLocNames = new List <string>(); while (it.MoveNext()) { if (it.Current.Value.mCategory == "UI") { playerLocNames.Add(it.Current.Key + "," + it.Current.Value.mString); } } AddComboEditor(gridControl1.Columns, "LocalisedDisplayName", playerLocNames.ToArray()); List <string> leaderOptions = new List <string>(); leaderOptions.Add("");//blank choice leaderOptions.AddRange(TriggerSystemMain.mSimResources.mLeaders.mLeaders); AddComboEditor(gridControl1.Columns, "Leader1", leaderOptions.ToArray()); AddComboEditor(gridControl1.Columns, "Leader2", new string[] { "" }); //leaderOptions.ToArray()); AddComboEditor(gridControl1.Columns, "Leader3", new string[] { "" }); //leaderOptions.ToArray()); NumPlayersComboBox.Text = mSimMain.PlayerData.Player.Count.ToString();//.NumberPlayers.ToString(); PlayerPlacementComboBox.Text = mSimMain.PlayerPlacementData.Type.ToString(); PlayerSpacingComboBox.Text = mSimMain.PlayerPlacementData.Spacing.ToString(); //gridControl1.DataRows[1]. }
private void generateFLSToolStripMenuItem_Click(object sender, EventArgs e) { if (LightsetListBox.SelectedItem == null) { return; } EditorLightset ls = CoreGlobals.getGameResources().getLightset(LightsetListBox.SelectedIndex); if (ls.ObjectIDForFLSGen == -1) { MessageBox.Show("You must specify a light probe object before generating an FLS file"); return; } EditorObject eo = SimGlobals.getSimMain().GetEditorObjectByID(ls.ObjectIDForFLSGen); if (eo == null) { MessageBox.Show("The specified light probe object does not exist. Please select a new one."); ls.ObjectPropertyForFLSGen = ""; return; } HelperPositionObject hao = eo as HelperPositionObject; if (hao == null) { MessageBox.Show("Error converting EditorObject to HelperPositionObject"); ls.ObjectPropertyForFLSGen = ""; return; } Vector3 pos = hao.getPosition(); string lightsetFile = CoreGlobals.getWorkPaths().mGameArtDirectory + "\\" + LightsetListBox.SelectedItem.ToString().Split('#')[1]; string flsName = lightsetFile + ".fls"; CoreGlobals.getEditorMain().mIGUI.doQuickView(); System.Threading.Thread.Sleep(8000); XFSInterface.generateFLS(pos.X, pos.Y, pos.Z, flsName); }
private void setFLSGenLocationToolStripMenuItem_Click(object sender, EventArgs e) { if (LightsetListBox.SelectedIndex == -1) { return; } PopupEditor pe = new PopupEditor(); BetterPropertyGrid bpg = new BetterPropertyGrid(); bpg.Height = 40; EditorLightset ls = CoreGlobals.getGameResources().getLightset(LightsetListBox.SelectedIndex); bpg.IgnoreProperties("EditorLightset", new string[] { "ID", "Name" }); bpg.SetTypeEditor("EditorLightset", "ObjectPropertyForFLSGen", typeof(PositionHelperObject)); bpg.SelectedObject = ls; pe.ShowPopup(this, bpg); }
private void talkingHeadDeleteBtn_Click(object sender, EventArgs e) { if (talkingHeadVideos.SelectedItem == null) { return; } //CLM this delete function was flakey.. object selectedItem = talkingHeadVideos.SelectedItem; string seletedItemString = talkingHeadVideos.SelectedItem.ToString(); int selectedIndex = talkingHeadVideos.SelectedIndex; // Delete objective from local list CoreGlobals.getGameResources().RemoveTalkingHeadVideo(seletedItemString); // Pause painting talkingHeadVideos.BeginUpdate(); // Delete the objective from list box talkingHeadVideos.Items.Remove(selectedItem); // Select the next cinematic in the list box if (selectedIndex >= talkingHeadVideos.Items.Count) { talkingHeadVideos.SelectedIndex = talkingHeadVideos.Items.Count - 1; } else { talkingHeadVideos.SelectedIndex = selectedIndex; } // Continue painting talkingHeadVideos.EndUpdate(); SettingsChanged(); }
public LocStringPicker() { InitializeComponent(); ScenarioComboBox.Items.Add("Any"); foreach (string scenario in CoreGlobals.getGameResources().mStringTable.mStringsByScenario.Keys) { ScenarioComboBox.Items.Add(scenario); } if (mLastScenario != "") { ScenarioComboBox.SelectedItem = mLastScenario; } CategoryComboBox.Items.Add("Any"); foreach (string category in CoreGlobals.getGameResources().mStringTable.mStringsByCategory.Keys) { CategoryComboBox.Items.Add(category); } if (mLastCategory != "") { CategoryComboBox.SelectedItem = mLastCategory; } }
private void DeleteLightsetButton_Click(object sender, EventArgs e) { if (LightsetListBox.SelectedItem == null) { return; } // Delete objective from local list string name = LightsetListBox.SelectedItem.ToString().Split('#')[1]; CoreGlobals.getGameResources().RemoveLightset(name); // Pause painting LightsetListBox.BeginUpdate(); // Grab objective from list box object deletedLightset = LightsetListBox.SelectedItem; // Select the next Lightset in the list box if ((LightsetListBox.SelectedIndex + 1) < LightsetListBox.Items.Count) { LightsetListBox.SelectedIndex += 1; } else if (LightsetListBox.Items.Count >= 2) { LightsetListBox.SelectedIndex -= 1; } // Delete the objective from list box LightsetListBox.Items.Remove(deletedLightset); // Continue painting LightsetListBox.EndUpdate(); SettingsChanged(); }
public void Filter() { locStringList.Items.Clear(); Dictionary <string, LocString> stringsToUse = new Dictionary <string, LocString>(); bool anyany = false; bool checkScenarioStrings = false; Dictionary <string, LocString> scenarioStrings = null; if (ScenarioComboBox.SelectedItem != null && ScenarioComboBox.SelectedItem.ToString() != "") { string scenarioName = ScenarioComboBox.SelectedItem.ToString(); if (CoreGlobals.getGameResources().mStringTable.mStringsByScenario.TryGetValue(scenarioName, out scenarioStrings)) { checkScenarioStrings = true; mLastScenario = scenarioName; } if (scenarioName == "Any") { mLastScenario = "Any"; anyany = true; } } bool checkCategoryStrings = false; Dictionary <string, LocString> categoryStrings = null; if (CategoryComboBox.SelectedItem != null && CategoryComboBox.SelectedItem.ToString() != "") { string CategoryName = CategoryComboBox.SelectedItem.ToString(); if (CoreGlobals.getGameResources().mStringTable.mStringsByCategory.TryGetValue(CategoryName, out categoryStrings)) { checkCategoryStrings = true; mLastCategory = CategoryName; //merge(intersection) results with scenario strings if (checkScenarioStrings) { foreach (LocString s in categoryStrings.Values) { if (scenarioStrings.ContainsValue(s) == true) { stringsToUse.Add(s.mLocID.ToString(), s); } } } else { stringsToUse = categoryStrings; } } if (CategoryName == "Any") { mLastCategory = "Any"; } else { anyany = false; } } if (checkScenarioStrings == true && checkCategoryStrings == false) { stringsToUse = scenarioStrings; } if (anyany) { locStringList.Items.Add("You must set at least one filter (category or settings)"); } foreach (LocString s in stringsToUse.Values) { locStringList.Items.Add(s); } }
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; }