From 331291ba9044428047e17a3932a03b03ddc66073 Mon Sep 17 00:00:00 2001 From: Sharlotte Date: Sat, 24 Jul 2021 17:43:19 +0900 Subject: [PATCH] clean up --- assets/bundles/bundle.properties | 28 ++++++++++++++++------------ assets/bundles/bundle_ko.properties | 8 ++++++-- src/UnitInfo/core/BarInfo.java | 7 +------ src/UnitInfo/core/HudUi.java | 15 ++++++++------- src/UnitInfo/core/Main.java | 24 ++++++++++++------------ src/UnitInfo/core/Setting.java | 6 ++++-- 6 files changed, 47 insertions(+), 41 deletions(-) diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index 8c1ee82..8ecf0bf 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -24,27 +24,31 @@ setting.wavesetting.name = Wave UI Setting setting.opacitysetting.name = Opacity Setting setting.pastwave.name = Display Previous Wave -setting.pastwave.description = Shows previous wave on wave info ingame.\nCurrent wave is highlighted with red. +setting.pastwave.description = toggle to shows previous wave on wave info ingame.\nCurrent wave is highlighted with red. setting.emptywave.name = Display Empty Wave -setting.emptywave.description = Shows empty wave on wave info ingame. +setting.emptywave.description = toggle to shows empty wave on wave info ingame. setting.wavemax.name = Wave Amount to Display -setting.wavemax.description = Set displayed wave amount of wave info.\nSelect the pencil and enter a number. +setting.wavemax.description = set displayed wave amount of wave info.\nSelect the pencil and enter a number. setting.selectopacity.name = Select Arrow Opacity -setting.selectopacity.description = Use the slider to set opacity of select arrow. +setting.selectopacity.description = use the slider to set opacity of select arrow. setting.baropacity.name = Health Bar Opacity -setting.baropacity.description = Use the slider to set opacity of unit bar. +setting.baropacity.description = use the slider to set opacity of unit bar. setting.uiopacity.name = UI Background Opacity -setting.uiopacity.description = Use the slider to set opacity of ui background. +setting.uiopacity.description = use the slider to set opacity of ui background. setting.scan.name = Enable Block Scanner -setting.scan.description = Enable scanner that shows nearly turret and wall hp. -setting.rangeNearby.name = Display near range -setting.rangeNearby.description = display range circle when you approached enemy ranges. -setting.rangeRadius.name = Near range margin -setting.rangeRadius.description = set additional distances to show range. +setting.scan.description = toggle to enable scanner that shows nearly turret and wall hp. setting.rangemax.name = Block Scanner Range -setting.rangemax.description = Set scan radius of scanner.\nSelect the pencil and enter a number. +setting.rangemax.description = set scan radius of scanner.\nSelect the pencil and enter a number. +setting.rangeNearby.name = Display Near Range +setting.rangeNearby.description = toggle to display range circle when you approached enemy ranges. +setting.rangeRadius.name = Near Range Margin +setting.rangeRadius.description = set additional distances to show range. +setting.allTeamRange.name = Display Team Range +setting.allTeamRange.description = toggle to display all teams' range. +setting.allTargetRange.name = Display All Range +setting.allTargetRange.description = toggle to display all target range whatever airTarget or groundTarget. setting.infoui.name = Display Info UI setting.weaponui.name = Display Weapon Info UI diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index 93bffbc..b9d7541 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -33,12 +33,16 @@ setting.wavemax.description = 연필 아이콘을 눌러서 인게임 단계 탭 setting.scan.name = 블록 스캐너 활성화 setting.scan.description = 주변 포탑과 벽의 체력을 표시하는 스캐터를 활성화합니다. +setting.rangemax.name = 블록 스캐너 사거리 +setting.rangemax.description = 연필 아이콘을 눌러서 스캐너 사거리를 설정합니다. setting.rangeNearby.name = 주변 사거리 표시 setting.rangeNearby.description = 적 사거리에 접근했을 경우 사거리를 표시합니다. setting.rangeRadius.name = 사거리 접근 거리 setting.rangeRadius.description = 사거리를 표시할 추가 거리를 설정합니다. -setting.rangemax.name = 블록 스캐너 사거리 -setting.rangemax.description = 연필 아이콘을 눌러서 스캐너 사거리를 설정합니다. +setting.allTeamRange.name = 팀 사거리 표시 +setting.allTeamRange.description = 모든 팀의 사거리를 표시합니다. +setting.allTargetRange.name = 모든 사거리 표시 +setting.allTargetRange.description = 지상 공중 상관없이 모든 사거리를 표시합니다. setting.selectopacity.name = 선택 화살표 투명도 diff --git a/src/UnitInfo/core/BarInfo.java b/src/UnitInfo/core/BarInfo.java index 43b0b6d..0a80abc 100644 --- a/src/UnitInfo/core/BarInfo.java +++ b/src/UnitInfo/core/BarInfo.java @@ -50,7 +50,6 @@ public class BarInfo { } - if(target instanceof Healthc) { strings.set(0, Core.bundle.format("shar-stat.health", Strings.fixed(((Healthc)target).health(), 1))); colors.set(0, Pal.health); @@ -58,7 +57,6 @@ public class BarInfo { } - if(target instanceof Turret.TurretBuild){ float value = Mathf.clamp(((Turret.TurretBuild)target).reload / ((Turret)((Turret.TurretBuild)target).block).reloadTime) * 100f; strings.set(1, Core.bundle.format("shar-stat.reload", Strings.fixed(value, (Math.abs((int)value - value) <= 0.001f ? 0 : Math.abs((int)(value * 10) - value * 10) <= 0.001f ? 1 : 2)))); @@ -129,8 +127,7 @@ public class BarInfo { numbers.set(2, ((Unit)target).stack().amount / (((Unit)target).type().itemCapacity * 1f)); } - - + if(target instanceof Turret.TurretBuild){ Turret turret = (Turret)((Turret.TurretBuild)target).block; if(turret.chargeTime > 0f) { @@ -147,7 +144,6 @@ public class BarInfo { } - if(target instanceof Unit && target instanceof Payloadc && ((Unit) target).type != null){ strings.set(4, Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(Mathf.sqrt(((Payloadc)target).payloadUsed())), Mathf.round(Mathf.sqrt(((Unit)target).type().payloadCapacity)))); colors.set(4, Pal.items); @@ -161,7 +157,6 @@ public class BarInfo { } - if(target instanceof Unit && state.rules.unitAmmo && ((Unit) target).type != null){ strings.set(5, Core.bundle.format("shar-stat.ammos", ((Unit)target).ammo(), ((Unit)target).type().ammoCapacity)); colors.set(5, ((Unit)target).type().ammoType.color); diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index d5f3437..17b6d53 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -96,6 +96,7 @@ public class HudUi { }); Events.on(EventType.ResetEvent.class, e -> { if(settings.getBool("allTeam")) coreItems.teams = Team.all; + else coreItems.teams = Team.baseTeams; coreItems.resetUsed(); coreItems.tables.each(Group::clear); }); @@ -193,14 +194,14 @@ public class HudUi { return; } if(getTarget() instanceof Turret.TurretBuild){ - Element imaget = new Element(); + Element image = new Element(); if(getTarget() instanceof ItemTurret.ItemTurretBuild){ ItemTurret.ItemTurretBuild turretBuild = getTarget(); - if(turretBuild.hasAmmo()) imaget = new Image(((ItemTurret)turretBuild.block).ammoTypes.findKey(turretBuild.peekAmmo(), true).uiIcon); + if(turretBuild.hasAmmo()) image = new Image(((ItemTurret)turretBuild.block).ammoTypes.findKey(turretBuild.peekAmmo(), true).uiIcon); else {MultiReqImage itemReq = new MultiReqImage(); for(Item item : ((ItemTurret) turretBuild.block).ammoTypes.keys()) itemReq.add(new ReqImage(item.uiIcon, turretBuild::hasAmmo)); - imaget = itemReq; + image = itemReq; } } else if(getTarget() instanceof LiquidTurret.LiquidTurretBuild){ @@ -208,13 +209,13 @@ public class HudUi { MultiReqImage liquidReq = new MultiReqImage(); for(Liquid liquid : ((LiquidTurret) ((LiquidTurret.LiquidTurretBuild) getTarget()).block).ammoTypes.keys()) liquidReq.add(new ReqImage(liquid.uiIcon, () -> ((LiquidTurret.LiquidTurretBuild) getTarget()).hasAmmo())); - imaget = liquidReq; + image = liquidReq; if(((LiquidTurret.LiquidTurretBuild) getTarget()).hasAmmo()) - imaget = new Image(entity.liquids.current().uiIcon).setScaling(Scaling.fit); + image = new Image(entity.liquids.current().uiIcon).setScaling(Scaling.fit); } else if(getTarget() instanceof PowerTurret.PowerTurretBuild){ - imaget = new Image(Icon.power.getRegion()){ + image = new Image(Icon.power.getRegion()){ @Override public void draw(){ Building entity = getTarget(); @@ -234,7 +235,7 @@ public class HudUi { } clearChildren(); - add(imaget).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f); + add(image).size(iconSmall).padBottom(2 * 8f).padRight(3 * 8f); } }); pack(); diff --git a/src/UnitInfo/core/Main.java b/src/UnitInfo/core/Main.java index 70c3660..5e61c5c 100644 --- a/src/UnitInfo/core/Main.java +++ b/src/UnitInfo/core/Main.java @@ -110,16 +110,18 @@ public class Main extends Mod { Draw.reset(); }); - if(settings.getBool("rangeNearby")) Groups.all.each(entityc -> - (entityc instanceof BaseTurret.BaseTurretBuild || entityc instanceof Unit) - && player != null && player.team() != ((Ranged) entityc).team() && ((Ranged) entityc).team() != Team.derelict, entityc -> { - if(entityc instanceof Turret.TurretBuild - && !(player.unit().isFlying() && ((Turret)((Turret.TurretBuild) entityc).block).targetAir || !(player.unit().isFlying()) && ((Turret)((Turret.TurretBuild) entityc).block).targetGround)) return; - float range = ((Ranged) entityc).range(); - float margin = settings.getInt("rangeRadius") * tilesize; - if(Vars.player.dst((Position) entityc) <= range + margin) - Drawf.dashCircle(((Ranged) entityc).x(), ((Ranged) entityc).y(), range, ((Ranged) entityc).team().color); - }); + if(settings.getBool("rangeNearby")) { + Groups.all.each(entityc -> + (entityc instanceof BaseTurret.BaseTurretBuild || entityc instanceof Unit) && player != null + && (settings.getBool("allTeamRange") || (player.team() != ((Ranged) entityc).team() && ((Ranged) entityc).team() != Team.derelict)), entityc -> { + if(entityc instanceof Turret.TurretBuild + && (settings.getBool("allTargetRange") || !(player.unit().isFlying() && ((Turret)((Turret.TurretBuild) entityc).block).targetAir || !(player.unit().isFlying()) && ((Turret)((Turret.TurretBuild) entityc).block).targetGround))) return; + float range = ((Ranged) entityc).range(); + float margin = settings.getInt("rangeRadius") * tilesize; + if(Vars.player.dst((Position) entityc) <= range + margin) + Drawf.dashCircle(((Ranged) entityc).x(), ((Ranged) entityc).y(), range, ((Ranged) entityc).team().color); + }); + } }); } @@ -127,6 +129,4 @@ public class Main extends Mod { public void loadContent(){ } - - } diff --git a/src/UnitInfo/core/Setting.java b/src/UnitInfo/core/Setting.java index 6ed4fc4..5868131 100644 --- a/src/UnitInfo/core/Setting.java +++ b/src/UnitInfo/core/Setting.java @@ -273,9 +273,11 @@ public class Setting { Seq scanSeq = new Seq<>(); addGraphicCheckSetting("scan", false, scanSeq); - addGraphicCheckSetting("rangeNearby", false, scanSeq); - addGraphicSlideSetting("rangeRadius", 5, 0, 20, 1, s -> s + "tiles", scanSeq); addGraphicTypeSetting("rangemax", 10, "@editrange","@invalid", 100, scanSeq); + addGraphicCheckSetting("rangeNearby", true, scanSeq); + addGraphicCheckSetting("allTeamRange", false, scanSeq); + addGraphicCheckSetting("allTargetRange", false, scanSeq); + addGraphicSlideSetting("rangeRadius", 5, 0, 20, 1, s -> s + "tiles", scanSeq); addGraphicDialogSetting("wavesetting", scanSeq, scanTable); Seq opacitySeq = new Seq<>();