diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index a99eb82..2a34a91 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -9,27 +9,27 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Set up JDK 1.8 - uses: actions/setup-java@v1 - with: - java-version: 1.8 - - name: Setup Android SDK Tools - uses: android-actions/setup-android@v2.0.1 - env: - ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' - - name: build-tools - run: sdkmanager "build-tools;29.0.3" - - name: Add Android SDK to PATH - run: echo "${ANDROID_HOME}/build-tools/29.0.3" >> $GITHUB_PATH + - uses: actions/checkout@v2 + - name: Set up JDK 15 + uses: actions/setup-java@v1 + with: + java-version: 15 + - name: Setup Android SDK Tools + uses: android-actions/setup-android@v2.0.1 + env: + ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true' + - name: build-tools + run: sdkmanager "build-tools;29.0.3" + - name: Add Android SDK to PATH + run: echo "${ANDROID_HOME}/build-tools/29.0.3" >> $GITHUB_PATH - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Build with Gradle - run: ./gradlew buildDex + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Build with Gradle + run: ./gradlew buildDex - - name: Upload build artifact - uses: actions/upload-artifact@v2.2.1 - with: - name: dexed - path: build/libs/dexed-*.jar + - name: Upload a Build Artifact (dexed) + uses: actions/upload-artifact@v2.2.1 + with: + name: dexed + path: build/libs/dexed-*.jar \ No newline at end of file diff --git a/assets/bundles/bundle.properties b/assets/bundles/bundle.properties index fd5696b..f0b2779 100644 --- a/assets/bundles/bundle.properties +++ b/assets/bundles/bundle.properties @@ -1,4 +1,7 @@ shar-stat.health = Health: {0} shar-stat.shield = Shield: {0} shar-stat.payloadCapacity = Payloads: {0} / {1} -shar-stat.itemCapacity = Items: {0} / {1} \ No newline at end of file +shar-stat.itemCapacity = Items: {0} / {1} +shar-stat.ammos = Ammos: {0} / {1} +shar-stat.infinityAmmos = Ammos: Infinity +shar-stat.commandUnits = Commands: {0} / {1} \ No newline at end of file diff --git a/assets/bundles/bundle_ko.properties b/assets/bundles/bundle_ko.properties index 36d269d..5835b3f 100644 --- a/assets/bundles/bundle_ko.properties +++ b/assets/bundles/bundle_ko.properties @@ -1,4 +1,7 @@ shar-stat.health = 체력: {0} shar-stat.shield = 방어막: {0} shar-stat.payloadCapacity = 화물: {0} / {1} -shar-stat.itemCapacity = 아이템: {0} / {1} \ No newline at end of file +shar-stat.itemCapacity = 아이템: {0} / {1} +shar-stat.ammos = 탄약: {0} / {1} +shar-stat.infinityAmmos = 탄약: 무한 +shar-stat.commandUnits = 지휘 유닛: {0} / {1} \ No newline at end of file diff --git a/src/UnitInfo/core/HudUi.java b/src/UnitInfo/core/HudUi.java index ccb9dc7..7e23583 100644 --- a/src/UnitInfo/core/HudUi.java +++ b/src/UnitInfo/core/HudUi.java @@ -15,12 +15,16 @@ import arc.struct.Seq; import arc.util.Log; import arc.util.Nullable; import arc.util.Scaling; +import arc.util.Time; import mindustry.Vars; +import mindustry.ai.types.FormationAI; +import mindustry.content.Items; import mindustry.entities.abilities.ForceFieldAbility; import mindustry.entities.abilities.ShieldRegenFieldAbility; import mindustry.entities.units.WeaponMount; import mindustry.gen.*; import mindustry.graphics.Pal; +import mindustry.type.AmmoTypes; import mindustry.type.UnitType; import mindustry.type.Weapon; import mindustry.ui.Bar; @@ -35,6 +39,9 @@ public class HudUi { Table weapon = new Table(); @Nullable UnitType type; @Nullable Unit unit; + + float heat; + public Unit getUnit(){ Seq units = Groups.unit.intersect(Core.input.mouseWorldX(), Core.input.mouseWorldY(), 4, 4); if(units.size <= 0) return player.unit(); @@ -71,11 +78,6 @@ public class HudUi { } ) ); - if(getUnit() instanceof Payloadc) bars.add(new SBar( - () -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(((Payloadc)getUnit()).payloadUsed()), Mathf.round(getUnit().type().payloadCapacity)), - () -> Pal.items, - () -> Mathf.clamp(((Payloadc)getUnit()).payloadUsed() / getUnit().type().payloadCapacity) - )); bars.add(new Stack(){{ add(new Table(t -> { t.defaults().width(23 * 8f); @@ -95,6 +97,42 @@ public class HudUi { t.pack(); })); }}); + bars.add(new SBar( + () -> Core.bundle.format("shar-stat.commandUnits", Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()), getUnit().type().commandLimit), + () -> Pal.powerBar.cpy().lerp(Pal.surge.cpy().mul(Pal.lighterOrange), Mathf.absin(Time.time, 7f / (1f + Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (getUnit().type().commandLimit * 1f))), 1f)), + () -> Mathf.clamp(Groups.unit.count(u -> u.controller() instanceof FormationAI && ((FormationAI)u.controller()).leader == getUnit()) / (getUnit().type().commandLimit * 1f)) + )); + bars.add(new Stack(){{ + add(new Table(t -> { + t.defaults().width(23 * 8f); + t.defaults().height(4f * 8f); + t.top(); + t.add(new SBar( + () -> Vars.state.rules.unitAmmo ? Core.bundle.format("shar-stat.ammos", getUnit().ammo, getUnit().type.ammoCapacity) : Core.bundle.format("shar-stat.infinityAmmos"), + () -> player.dead() || player.unit() instanceof BlockUnitc ? Pal.ammo : getUnit().type.ammoType.color, + () -> Vars.state.rules.unitAmmo ? getUnit().ammof() : 1f + )).growX().left(); + })); + add(new Table(t -> { + t.left(); + t.add(new Image(){{ + update(() -> { + TextureRegion region = Items.copper.icon(Cicon.small); + if(getUnit().type != null){ + if(getUnit().type.ammoType == AmmoTypes.thorium) region = Items.thorium.icon(Cicon.small); + if(getUnit().type.ammoType == AmmoTypes.power || getUnit().type.ammoType == AmmoTypes.powerLow || getUnit().type.ammoType == AmmoTypes.powerHigh) region = Icon.powerSmall.getRegion(); + } + setDrawable(region); + }); + }}).size(30f).scaling(Scaling.bounded).padBottom(4 * 8f).padRight(6 * 8f); + t.pack(); + })); + }}); + bars.add(new SBar( + () -> Core.bundle.format("shar-stat.payloadCapacity", Mathf.round(((Payloadc)getUnit()).payloadUsed()), Mathf.round(getUnit().type().payloadCapacity)), + () -> Pal.items, + () -> Mathf.clamp(((Payloadc)getUnit()).payloadUsed() / getUnit().type().payloadCapacity) + )); } public void addWeapon(){ @@ -183,16 +221,21 @@ public class HudUi { }); }).padRight(24 * 8f); table.row(); + Unit unittemp = getUnit(); table.update(() -> { - type = getUnit().type; - unit = getUnit(); + heat += Time.delta; + if (heat >= 16 && unittemp != getUnit()) { + heat = 0f; + type = getUnit().type; + unit = getUnit(); - table.removeChild(weapon); - table.removeChild(weapon); - addWeapon(); - table.row(); + table.removeChild(weapon); + table.removeChild(weapon); + addWeapon(); + table.row(); - table.add(weapon); + table.add(weapon); + } }); table.fillParent = true;