示例#1
0
        public void renameObjectCombo(string newName)
        {
            string oldComboName = Title;

            Title = newName;
            bool undefinedToDefined = oldComboName.StartsWith("Undefined Combo (") &&
                                      !newName.StartsWith("Undefined Combo (");

            if (!undefinedToDefined) // simple re-define
            {
                if (objectComboEntry != null)
                {
                    objectComboEntry.Name = newName;
                }
            }
            else
            {
                uint modelAddress = 0;
                if (level.ModelIDs.ContainsKey(ModelID))
                {
                    modelAddress = level.ModelIDs[ModelID].GeoDataSegAddress;
                }
                ObjectComboEntry newOCE = new ObjectComboEntry(newName, ModelID, modelAddress, getBehaviorAddress());
                objectComboEntry = newOCE;
                Globals.objectComboEntries.Add(newOCE);
                level.LevelObjectCombos.Add(newOCE);
            }

            ModelComboFile.writeObjectCombosFile(Globals.getDefaultObjectComboPath());
        }
示例#2
0
        private void Form1_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.P:
                if (Globals.list_selected != -1 && Globals.item_selected != -1)
                {
                    int      listSel = Globals.list_selected;
                    int      objSel  = Globals.item_selected;
                    Object3D obj     = getSelectedObject();
                    if (obj == null)
                    {
                        return;
                    }
                    string newName = Prompts.ShowInputDialog("Type the new combo name", "New combo name");
                    if (newName.Length > 0)
                    {
                        obj.Title = newName;
                        uint segmentAddress = 0;
                        if (level.ModelIDs.ContainsKey(obj.ModelID))
                        {
                            segmentAddress = level.ModelIDs[obj.ModelID].GeoDataSegAddress;
                        }
                        ObjectComboEntry oce = new ObjectComboEntry(newName, obj.ModelID,
                                                                    segmentAddress, obj.getBehaviorAddress());
                        Globals.insertNewEntry(oce);
                        refreshObjectsInList();
                        treeView1.SelectedNode = treeView1.Nodes[listSel].Nodes[objSel];
                        Globals.list_selected  = listSel;
                        Globals.item_selected  = objSel;
                        propertyGrid1.Refresh();
                    }
                    ModelComboFile.writeObjectCombosFile(Globals.getDefaultObjectComboPath());
                    Console.WriteLine("Saved Object Combos!");
                }
                break;

            case Keys.D1:
                trySwitchArea(1);
                break;

            case Keys.D2:
                trySwitchArea(2);
                break;

            case Keys.D3:
                trySwitchArea(3);
                break;

            case Keys.D4:
                trySwitchArea(4);
                break;

            case Keys.D5:
                trySwitchArea(5);
                break;

            case Keys.D6:
                trySwitchArea(6);
                break;

            case Keys.D7:
                trySwitchArea(7);
                break;

            case Keys.D0:
                trySwitchArea(0);
                break;
            }
        }