generated from Sonnicon/mindustry-modtemplate
-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add tool manager and fog remover #84
- Loading branch information
1 parent
a8b4d07
commit 98b51c7
Showing
7 changed files
with
104 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
src/informatis/ui/fragments/sidebar/windows/tools/tools/FogRemover.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package informatis.ui.fragments.sidebar.windows.tools.tools; | ||
|
||
import arc.graphics.Color; | ||
import mindustry.Vars; | ||
|
||
public class FogRemover extends Tool { | ||
Color lastStaticColor, lastDynamicColor; | ||
|
||
public FogRemover() { | ||
super("fogremover"); | ||
} | ||
|
||
@Override | ||
public void setEnabled(boolean value) { | ||
super.setEnabled(value); | ||
if(value) { | ||
lastStaticColor = Vars.state.rules.staticColor; | ||
lastDynamicColor = Vars.state.rules.dynamicColor; | ||
Vars.state.rules.staticColor = Color.clear; | ||
Vars.state.rules.dynamicColor = Color.clear; | ||
} else { | ||
Vars.state.rules.staticColor = lastStaticColor; | ||
Vars.state.rules.dynamicColor = lastDynamicColor; | ||
} | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
src/informatis/ui/fragments/sidebar/windows/tools/tools/Tool.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package informatis.ui.fragments.sidebar.windows.tools.tools; | ||
|
||
import informatis.ui.fragments.sidebar.windows.SettingConfiger; | ||
|
||
public class Tool extends SettingConfiger { | ||
public Tool(String name) { | ||
super(name); | ||
} | ||
|
||
public void onUpdate() {}; | ||
} |
16 changes: 16 additions & 0 deletions
16
src/informatis/ui/fragments/sidebar/windows/tools/tools/ToolManager.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package informatis.ui.fragments.sidebar.windows.tools.tools; | ||
|
||
import arc.Events; | ||
import mindustry.game.EventType; | ||
|
||
public class ToolManager { | ||
public static Tool[] tools = new Tool[] { new FogRemover() }; | ||
|
||
public static void init() { | ||
Events.run(EventType.Trigger.update, () -> { | ||
for (Tool tool : tools) { | ||
tool.onUpdate(); | ||
} | ||
}); | ||
} | ||
} |