private s_instance addSettingsToInstance(s_instance _inc) { string line; _inc.enemySettings = new List <s_settings>(); // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(textBox_GamePfade.Text + "\\Enemy\\Enemy.gd"); while ((line = file.ReadLine()) != null) { if (line.Contains("export")) { s_settings set = new s_settings(); set.valueType = line.Substring(line.IndexOf('(') + 1, line.IndexOf(')') - (line.IndexOf('(') + 1)); int varEnd = line.IndexOf("var") + 4; set.settingName = line.Substring(varEnd, (line.IndexOf(' ', varEnd) > 0 ? line.IndexOf(' ', varEnd) : line.Length) - varEnd); _inc.enemySettings.Add(set); } } file.Close(); return(_inc); }
private void button_SaveEffectsSettings_Click(object sender, EventArgs e) { if (listBox_EffectsSettings.SelectedIndex == -1) { return; } s_settings set = instances[listBox_Enemys.SelectedIndex].effects[listBox_Effects.SelectedIndex].effectSettings[listBox_EffectsSettings.SelectedIndex]; instances[listBox_Enemys.SelectedIndex].effects[listBox_Effects.SelectedIndex].effectSettings.Remove(instances[listBox_Enemys.SelectedIndex].effects[listBox_Effects.SelectedIndex].effectSettings[listBox_EffectsSettings.SelectedIndex]); listBox_EffectsSettings.Items.RemoveAt(listBox_EffectsSettings.SelectedIndex); set.value = textBox_EffectsSettingsValue.Text; textBox_EffectsSettingsValue.Text = ""; instances[listBox_Enemys.SelectedIndex].effects[listBox_Effects.SelectedIndex].effectSettings.Add(set); listBox_EffectsSettings.Items.Add(set.settingName + (set.value != "" && set.value != null ? " (" + set.value + ")" : "")); }
private s_effect addSettingsToEffect(s_effect _effect) { string line; _effect.effectSettings = new List <s_settings>(); // Read the file and display it line by line. System.IO.StreamReader file = new System.IO.StreamReader(textBox_GamePfade.Text + "\\effects\\scripts\\StatusEffect.gd"); while ((line = file.ReadLine()) != null) { if (line.Contains("export")) { s_settings set = new s_settings(); set.valueType = line.Substring(line.IndexOf('(') + 1, line.IndexOf(')') - (line.IndexOf('(') + 1)); int varEnd = line.IndexOf("var") + 4; set.settingName = line.Substring(varEnd, (line.IndexOf(' ', varEnd) > 0 ? line.IndexOf(' ', varEnd) : line.Length) - varEnd); _effect.effectSettings.Add(set); } } file.Close(); try { file = new System.IO.StreamReader(textBox_GamePfade.Text + "\\effects\\scripts\\" + _effect.effectName.Substring(0, _effect.effectName.Length - 4) + "gd"); while ((line = file.ReadLine()) != null) { if (line.Contains("export")) { s_settings set = new s_settings(); set.valueType = line.Substring(line.IndexOf('(') + 1, line.IndexOf(')') - (line.IndexOf('(') + 1)); int varEnd = line.IndexOf("var") + 4; set.settingName = line.Substring(varEnd, (line.IndexOf(' ', varEnd) > 0 ? line.IndexOf(' ', varEnd) : line.Length) - varEnd); _effect.effectSettings.Add(set); } } file.Close(); } catch { } return(_effect); }