예제 #1
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;
             }
     }
 }
예제 #2
0
 private void pasteButton_Click(object sender, EventArgs e)
 {
     if (Clipboard.ContainsData(ClipboardFormat))
     {
         CurrentItem = (SA1ObjectListEntry)Clipboard.GetData(ClipboardFormat);
         ReloadObjectData();
     }
 }
예제 #3
0
        private void btnAddObj_Click(object sender, EventArgs e)
        {
            saved = false;
            ObjectListEntry newObj;

            if (isSA2)
            {
                newObj = new SA2ObjectListEntry();
            }
            else
            {
                newObj = new SA1ObjectListEntry();
            }

            ObjectData newObjDef = new ObjectData();

            SimpleInputForm dlg = new SimpleInputForm("Name", "New Object");

            dlg.ShowDialog();

            if (dlg.useOK)
            {
                newObj.Name = dlg.outputText;
            }
            else
            {
                newObj.Name = "Object " + (objList.Count + 1).ToString();
            }
            newObj.Code = 0;

            newObjDef.Name    = newObj.Name;
            newObjDef.RotType = "XYZ";
            newObjDef.SclType = "None";

            objList.Add(newObj);
            objDefinitions.Add(newObj.Name, newObjDef);

            lstObjects.Items.Add(newObj.Name);
            lstObjects.SelectedIndex = (lstObjects.Items.Count - 1);
        }
예제 #4
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;
             }
 }