コード例 #1
0
ファイル: ObjectListEditor.cs プロジェクト: inrg/sa_tools
 private void importButton_Click(object sender, EventArgs e)
 {
     if (Program.IniData.MasterObjectList == null)
     {
         MessageBox.Show(this, "No master object list specified in project file.", Text);
     }
     else
     {
         using (ObjectSearchDialog dlg = new ObjectSearchDialog())
             if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 KeyValuePair <string, MasterObjectListEntry> selobj = dlg.SelectedObject;
                 List <SA1ObjectListEntry> currentList = new List <SA1ObjectListEntry>(CurrentList);
                 SA1ObjectListEntry        obj         = new SA1ObjectListEntry();
                 obj.Arg1       = selobj.Value.Arg1;
                 obj.Arg2       = selobj.Value.Arg2;
                 obj.Flags      = selobj.Value.Flags;
                 obj.Distance   = selobj.Value.Distance;
                 obj.CodeString = selobj.Key;
                 obj.Name       = selobj.Value.Name;
                 currentList.Add(obj);
                 CurrentList = currentList.ToArray();
                 objectList.Items.Add(currentList.Count - 1 + ": ");
                 objectList.SelectedIndex = currentList.Count - 1;
             }
     }
 }
コード例 #2
0
 private void importButton_Click(object sender, EventArgs e)
 {
     if (Program.IniData.MasterObjectList == null)
         MessageBox.Show(this, "No master object list specified in project file.", Text);
     else
         using (ObjectSearchDialog dlg = new ObjectSearchDialog())
             if (dlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
             {
                 KeyValuePair<string, MasterObjectListEntry> selobj = dlg.SelectedObject;
                 List<SA1ObjectListEntry> currentList = new List<SA1ObjectListEntry>(CurrentList);
                 SA1ObjectListEntry obj = new SA1ObjectListEntry();
                 obj.Arg1 = selobj.Value.Arg1;
                 obj.Arg2 = selobj.Value.Arg2;
                 obj.Flags = selobj.Value.Flags;
                 obj.Distance = selobj.Value.Distance;
                 obj.CodeString = selobj.Key;
                 obj.Name = selobj.Value.Name;
                 currentList.Add(obj);
                 CurrentList = currentList.ToArray();
                 objectList.Items.Add(currentList.Count - 1 + ": ");
                 objectList.SelectedIndex = currentList.Count - 1;
             }
 }