示例#1
0
        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);
        }
示例#2
0
        private void numericUpDown_Delay_ValueChanged(object sender, EventArgs e)
        {
            s_instance inc   = instances[listBox_Enemys.SelectedIndex];
            int        index = listBox_Enemys.SelectedIndex;

            instances.RemoveAt(index);
            inc.delay = numericUpDown_Delay.Value;
            instances.Insert(index, inc);
        }
示例#3
0
        private void numericUpDown_POSy_ValueChanged(object sender, EventArgs e)
        {
            s_instance inc   = instances[listBox_Enemys.SelectedIndex];
            int        index = listBox_Enemys.SelectedIndex;

            instances.RemoveAt(index);
            inc.pos = new List <int>();
            inc.pos.Add((int)numericUpDown_POSx.Value);
            inc.pos.Add((int)numericUpDown_POSy.Value);
            instances.Insert(index, inc);
        }
示例#4
0
 private void button_AddEnemy_Click(object sender, EventArgs e)
 {
     if (comboBox_Enemys.SelectedItem != null)
     {
         s_instance inc = new s_instance();
         inc.enemy = comboBox_Enemys.SelectedItem.ToString();
         listBox_Enemys.Items.Add(inc.enemy);
         inc.effects = new List <s_effect>();
         inc         = addSettingsToInstance(inc);
         instances.Add(inc);
     }
 }