Skip to content

Commit

Permalink
add an agent for the map fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
xzxADIxzx committed Feb 26, 2025
1 parent 92a3ec7 commit e987715
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/java/schema/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public void init() {
loadfrag.build(scene.root);

control.setInput(insys.getAgent());
// ui.minimapfrag=mapfrag.getAgent();
ui.minimapfrag=mapfrag.getAgent();
ui.loadfrag = loadfrag.getAgent();

log("=> [green]Running postinit hooks...");
Expand Down
18 changes: 18 additions & 0 deletions src/java/schema/ui/fragments/MapFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import arc.util.*;
import mindustry.gen.*;
import mindustry.graphics.*;
import mindustry.ui.fragments.*;
import schema.ui.*;

import static arc.Core.*;
Expand Down Expand Up @@ -120,4 +121,21 @@ public void draw() {
Draw.reset();
super.draw();
}

// region agent

/** Returns the agent of this fragment. */
public Agent getAgent() { return new Agent(); }

/** Agent that redirects method calls from the original fragment to the new one. */
public class Agent extends MinimapFragment {

@Override
public boolean shown() { return true; } // there is a check in Control#update that should always fail

@Override
public void hide() { shown = false; } // planet dialog calls it
}

// endregion
}

0 comments on commit e987715

Please sign in to comment.