Skip to content
This repository was archived by the owner on Sep 27, 2025. It is now read-only.

Commit 5b219a5

Browse files
committed
Reorder functions
1 parent 9e2fda6 commit 5b219a5

1 file changed

Lines changed: 31 additions & 30 deletions

File tree

NeosLogixCleanupWizard/NeosLogixCleanupWizard.cs

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,6 @@ void AddMenuOption() {
2727
DevCreateNewForm.AddAction("Editor", "LogiX Cleanup Wizard", (x) => LogixCleanupWizard.GetOrCreateWizard(x));
2828
}
2929

30-
public static async Task<int> OptimizeLogiX(Slot targetSlot, bool removeLogixReferences, bool removeLogixInterfaceProxies) {
31-
if (targetSlot == null) {
32-
return 0;
33-
}
34-
await new Updates(10);
35-
List<Component> componentsForRemoval = targetSlot.GetComponentsInChildren((Component targetComponent) => {
36-
//Collect all LogiXReference and LogixInterfaceProxies for deletion
37-
if (removeLogixReferences && targetComponent is LogixReference) {
38-
return true;
39-
}
40-
if (removeLogixInterfaceProxies && targetComponent is LogixInterfaceProxy) {
41-
return true;
42-
}
43-
return false;
44-
});
45-
46-
foreach (Component targetComponent in componentsForRemoval) {
47-
targetComponent.Destroy();
48-
}
49-
return componentsForRemoval.Count;
50-
}
5130
class LogixCleanupWizard {
5231
public static LogixCleanupWizard GetOrCreateWizard(Slot x) {
5332
if (_Wizard != null) {
@@ -134,6 +113,37 @@ void Slot_OnPrepareDestroy(Slot slot) {
134113
_Wizard = null;
135114
}
136115

116+
void CleanupLogix(IButton button, ButtonEventData eventData) {
117+
UpdateStatusText("Cleaning up LogiX");
118+
WizardSlot.World.Coroutines.StartTask(async () => {
119+
int totalRemovedComponents = await OptimizeLogiX(processingRoot.Reference, removeLogixReferences.Value, removeLogixInterfaceProxies.Value);
120+
Msg($"Removed {totalRemovedComponents} components");
121+
UpdateStatusText($"Removed {totalRemovedComponents} components");
122+
});
123+
}
124+
125+
public static async Task<int> OptimizeLogiX(Slot targetSlot, bool removeLogixReferences, bool removeLogixInterfaceProxies) {
126+
if (targetSlot == null) {
127+
return 0;
128+
}
129+
await new Updates(10);
130+
List<Component> componentsForRemoval = targetSlot.GetComponentsInChildren((Component targetComponent) => {
131+
//Collect all LogiXReference and LogixInterfaceProxies for deletion
132+
if (removeLogixReferences && targetComponent is LogixReference) {
133+
return true;
134+
}
135+
if (removeLogixInterfaceProxies && targetComponent is LogixInterfaceProxy) {
136+
return true;
137+
}
138+
return false;
139+
});
140+
141+
foreach (Component targetComponent in componentsForRemoval) {
142+
targetComponent.Destroy();
143+
}
144+
return componentsForRemoval.Count;
145+
}
146+
137147
void DestroyInterfaces(IButton button, ButtonEventData eventData) {
138148
WizardSlot.World.Coroutines.StartTask(async () => {
139149
List<LogixInterface> interfaces = WizardSlot.World.RootSlot.GetComponentsInChildren<LogixInterface>();
@@ -149,15 +159,6 @@ void DestroyInterfaces(IButton button, ButtonEventData eventData) {
149159
});
150160
}
151161

152-
void CleanupLogix(IButton button, ButtonEventData eventData) {
153-
UpdateStatusText("Cleaning up LogiX");
154-
WizardSlot.World.Coroutines.StartTask(async () => {
155-
int totalRemovedComponents = await OptimizeLogiX(processingRoot.Reference, removeLogixReferences.Value, removeLogixInterfaceProxies.Value);
156-
Msg($"Removed {totalRemovedComponents} components");
157-
UpdateStatusText($"Removed {totalRemovedComponents} components");
158-
});
159-
}
160-
161162
void RemoveEmptyRefs(IButton button, ButtonEventData eventData) {
162163
//Search for Slots named Ref with no components and no children
163164
WizardSlot.World.Coroutines.StartTask(async () => {

0 commit comments

Comments
 (0)