Skip to content

Commit

Permalink
MinModCore
Browse files Browse the repository at this point in the history
  • Loading branch information
MinRi2 committed Feb 13, 2024
1 parent bb49c8b commit 9767a01
Show file tree
Hide file tree
Showing 28 changed files with 45 additions and 1,795 deletions.
21 changes: 17 additions & 4 deletions src/MinerTools/MinerVars.java
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
package MinerTools;

import MinRi2.ModCore.io.*;
import MinerTools.input.*;
import MinerTools.io.*;
import MinerTools.ui.*;
import arc.KeyBinds.*;
import arc.files.*;
import arc.util.*;
import mindustry.*;

import static arc.Core.*;
import static mindustry.Vars.maxSchematicSize;
import static mindustry.Vars.*;

public class MinerVars{
public static final String modName = "miner-tools";
public static final String modSymbol = "[yellow][M]";
public static final float worldFontScl = Vars.tilesize / 36f;

public static MSettings settings;
public static MinModSettings settings;
public static MUI ui;

public static boolean desktop;

public static void init(){
settings = new MSettings();
settings = MinModSettings.registerSettings(modName);
ui = new MUI();

desktop = app.isDesktop();
Expand All @@ -35,6 +36,7 @@ public static void init(){
ui.init();

betterSchemeSize();
migrateOldSettings();
}

public static void betterSchemeSize(){
Expand All @@ -53,4 +55,15 @@ public static void initBindings(){
Reflect.invoke(keybinds, "load");
Reflect.invoke(Vars.ui.controls, "setup");
}

private static void migrateOldSettings(){
Fi old = modDirectory.child("MinerTools").child("settings");

if(old.exists()){
old.copyTo(settings.settingsFi);
settings.load();
settings.save();
modDirectory.child("MinerTools").deleteDirectory();
}
}
}
225 changes: 0 additions & 225 deletions src/MinerTools/io/MSettings.java

This file was deleted.

2 changes: 1 addition & 1 deletion src/MinerTools/modules/SpawnerInfo/SpawnerGroup.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package MinerTools.modules.SpawnerInfo;

import MinerTools.utils.math.*;
import MinRi2.ModCore.math.*;
import arc.math.geom.*;
import arc.struct.*;

Expand Down
2 changes: 1 addition & 1 deletion src/MinerTools/modules/SpawnerInfo/SpawnerInfo.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package MinerTools.modules.SpawnerInfo;

import MinRi2.ModCore.utils.*;
import MinerTools.modules.*;
import MinerTools.utils.*;
import arc.*;
import arc.func.*;
import arc.math.geom.*;
Expand Down
17 changes: 1 addition & 16 deletions src/MinerTools/ui/MStyles.java
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,22 @@
import arc.scene.ui.ImageButton.*;
import arc.scene.ui.TextButton.*;
import arc.scene.ui.TextField.*;
import arc.util.*;
import mindustry.graphics.*;

import static MinRi2.ModCore.ui.MinTex.*;
import static mindustry.gen.Tex.*;
import static mindustry.ui.Styles.*;

public class MStyles{
// TODO: 注解处理器生成
public static TextureRegionDrawable accentGrayGran;

public static TextureRegionDrawable whiteuiRegion, transAccent, transRed, clearFlatOver;

public static ImageButtonStyle clearToggleAccentb, logicVarTogglet, chatb, rclearTransi;
public static TextButtonStyle clearPartial2t, clearAccentt, toggleTranst, settingt;
public static TextFieldStyle noneField;

public static void load(){
loadModSprites();

whiteuiRegion = (TextureRegionDrawable)whiteui;
transAccent = getColoredRegion(Pal.accent, 0.55f);
transRed = getColoredRegion(Color.red, 0.55f);
clearFlatOver = getColoredRegion(Color.lightGray, 0.45f);

clearToggleAccentb = new ImageButtonStyle(){{
over = flatOver;
Expand Down Expand Up @@ -89,12 +82,4 @@ public static void loadModSprites(){
private static TextureRegion getSprite(String name){
return Core.atlas.find(MinerVars.modName + "-" + name);
}

public static TextureRegionDrawable getColoredRegion(Color color){
return (TextureRegionDrawable)whiteuiRegion.tint(color);
}

public static TextureRegionDrawable getColoredRegion(Color color, float alpha){
return (TextureRegionDrawable)whiteuiRegion.tint(Tmp.c1.set(color).a(alpha));
}
}
Loading

0 comments on commit 9767a01

Please sign in to comment.