private void Signal_UpdateKeyPlatformEdited(int idx) { var optionButton = MainEditingArea.GetChild(0).GetNode <OptionButton>("Platform/OptionButton"); var str = optionButton.GetItemText(idx); var updateKey = updateKeys[activeUpdateKey]; activeUpdateKey.SetText(0, $"{str}:{updateKey.Id}"); updateKey.Platform = str; }
private void ClearMainEditingArea() { for (int i = 0; i < MainEditingArea.GetChildCount(); ++i) { var child = MainEditingArea.GetChild(i); if (child.HasMeta(Meta.CorrespondingController)) { var controller = ContentPackController.GetControllerForMod((string)child.GetMeta(Meta.CorrespondingController)); var data = ModProject.Mods.Find(md => md.ContentPackFor == controller.ModUniqueId); controller.OnEditingAreaChanged(this, data, child); } child.QueueFree(); } }
private void Signal_TreeCellActivated() { var sel = ProjectTree.GetSelected(); Node newArea = null; if (sel == ProjectRoot) { var editor = ProjectEditor.Instance(); var lineEdit = editor.GetNode <LineEdit>("Name/LineEdit"); lineEdit.Text = ModProject.Name; lineEdit.Connect("text_changed", this, nameof(Signal_ProjectNameEdited)); lineEdit = editor.GetNode <LineEdit>("Description/LineEdit"); lineEdit.Text = ModProject.Description; lineEdit.Connect("text_changed", this, nameof(Signal_ProjectDescriptionEdited)); lineEdit = editor.GetNode <LineEdit>("UniqueId/LineEdit"); lineEdit.Text = ModProject.UniqueId; lineEdit.Connect("text_changed", this, nameof(Signal_ProjectUniqueIdEdited)); lineEdit = editor.GetNode <LineEdit>("Version/LineEdit"); lineEdit.Text = ModProject.Version; lineEdit.Connect("text_changed", this, nameof(Signal_ProjectVersionEdited)); lineEdit = editor.GetNode <LineEdit>("Author/LineEdit"); lineEdit.Text = ModProject.Author; lineEdit.Connect("text_changed", this, nameof(Signal_ProjectAuthorEdited)); newArea = editor; } else if (sel.GetParent() == depsRoot) { activeDep = sel; var dep = deps[sel]; var editor = DependencyEditor.Instance(); var lineEdit = editor.GetNode <LineEdit>("Id/LineEdit"); lineEdit.Text = dep.UniqueID; lineEdit.Connect("text_changed", this, nameof(Signal_DependencyIdEdited)); var checkBox = editor.GetNode <CheckBox>("Required/CheckBox"); checkBox.Pressed = dep.IsRequired; checkBox.Connect("toggled", this, nameof(Signal_DependencyRequiredToggled)); lineEdit = editor.GetNode <LineEdit>("MinimumVersion/LineEdit"); lineEdit.Text = dep.MinimumVersion; lineEdit.Connect("text_changed", this, nameof(Signal_DependencyMinimumVersionEdited)); newArea = editor; } else if (sel.GetParent() == updateKeysRoot) { activeUpdateKey = sel; var updateKey = updateKeys[sel]; var editor = UpdateKeyEditor.Instance(); var optionButton = editor.GetNode <OptionButton>("Platform/OptionButton"); int selInd = 0; for (int i = 0; i < optionButton.GetItemCount(); ++i) { if (optionButton.GetItemText(i) == updateKey.Platform) { selInd = i; break; } } optionButton.Selected = selInd; optionButton.Connect("item_selected", this, nameof(Signal_UpdateKeyPlatformEdited)); var lineEdit = editor.GetNode <LineEdit>("Id/LineEdit"); lineEdit.Text = updateKey.Id; lineEdit.Connect("text_changed", this, nameof(Signal_UpdateKeyIdEdited)); newArea = editor; } else if (sel.HasMeta(Meta.CorrespondingController)) { var controller = ContentPackController.GetControllerForMod((string)sel.GetMeta(Meta.CorrespondingController)); var data = ModProject.Mods.Find(md => md.ContentPackFor == controller.ModUniqueId); newArea = controller.CreateMainEditingArea(this, data, sel); } if (newArea != null) { ClearMainEditingArea(); MainEditingArea.AddChild(newArea); } }