Implemented mod name display in content desc

This commit is contained in:
Anuken
2020-01-24 10:23:48 -05:00
parent a4e820f907
commit 63c277f78e
5 changed files with 23 additions and 18 deletions

View File

@@ -1,6 +1,10 @@
buildscript{ buildscript{
ext{ ext{
arcExtVersion = "e287fdce0449a87fb15599c67b5167ac0273bcb6" getArcHash = {
return new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]
}
arcHash = getArcHash()
} }
repositories{ repositories{
@@ -15,8 +19,8 @@ buildscript{
dependencies{ dependencies{
classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.8' classpath 'com.mobidevelop.robovm:robovm-gradle-plugin:2.3.8'
classpath "com.github.anuken:packr:-SNAPSHOT" classpath "com.github.anuken:packr:-SNAPSHOT"
classpath "com.github.Anuken.Arc:packer:$arcExtVersion" classpath "com.github.Anuken.Arc:packer:$arcHash"
classpath "com.github.Anuken.Arc:arc-core:$arcExtVersion" classpath "com.github.Anuken.Arc:arc-core:$arcHash"
} }
} }
@@ -33,7 +37,6 @@ allprojects{
gdxVersion = '1.9.10' gdxVersion = '1.9.10'
roboVMVersion = '2.3.8' roboVMVersion = '2.3.8'
steamworksVersion = '891ed912791e01fe9ee6237a6497e5212b85c256' steamworksVersion = '891ed912791e01fe9ee6237a6497e5212b85c256'
arcHash = null
loadVersionProps = { loadVersionProps = {
return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p } return new Properties().with{p -> p.load(file('../core/assets/version.properties').newReader()); return p }
@@ -47,10 +50,6 @@ allprojects{
return !project.hasProperty("release") && new File(projectDir.parent, '../Arc').exists() return !project.hasProperty("release") && new File(projectDir.parent, '../Arc').exists()
} }
getArcHash = {
return new Properties().with{ p -> p.load(file('gradle.properties').newReader()); return p }["archash"]
}
arcModule = { String name -> arcModule = { String name ->
if(localArc()){ if(localArc()){
return project(":Arc:$name") return project(":Arc:$name")
@@ -303,7 +302,7 @@ project(":tools"){
compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-platform:$gdxVersion:natives-desktop"
compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop" compile "com.badlogicgames.gdx:gdx-freetype-platform:$gdxVersion:natives-desktop"
compile "org.reflections:reflections:0.9.11" compile "org.reflections:reflections:0.9.12"
compile arcModule("backends:backend-sdl") compile arcModule("backends:backend-sdl")
} }
@@ -313,8 +312,8 @@ project(":annotations"){
apply plugin: "java" apply plugin: "java"
dependencies{ dependencies{
compile 'com.squareup:javapoet:1.11.0' compile 'com.squareup:javapoet:1.12.1'
compile "com.github.Anuken.Arc:arc-core:$arcExtVersion" compile "com.github.Anuken.Arc:arc-core:$arcHash"
compile files("${System.getProperty('java.home')}/../lib/tools.jar") compile files("${System.getProperty('java.home')}/../lib/tools.jar")
} }
} }

View File

@@ -104,6 +104,7 @@ mods.none = [LIGHT_GRAY]No mods found!
mods.guide = Modding Guide mods.guide = Modding Guide
mods.report = Report Bug mods.report = Report Bug
mods.openfolder = Open Mod Folder mods.openfolder = Open Mod Folder
mod.display = [gray]Mod:[orange] {0}
mod.enabled = [lightgray]Enabled mod.enabled = [lightgray]Enabled
mod.disabled = [scarlet]Disabled mod.disabled = [scarlet]Disabled
mod.disable = Disable mod.disable = Disable

View File

@@ -1,6 +1,7 @@
package mindustry.ctype; package mindustry.ctype;
import arc.*; import arc.*;
import arc.util.ArcAnnotate.*;
import mindustry.annotations.Annotations.*; import mindustry.annotations.Annotations.*;
import arc.graphics.g2d.*; import arc.graphics.g2d.*;
import arc.scene.ui.layout.*; import arc.scene.ui.layout.*;
@@ -13,7 +14,7 @@ public abstract class UnlockableContent extends MappableContent{
/** Localized, formal name. Never null. Set to block name if not found in bundle. */ /** Localized, formal name. Never null. Set to block name if not found in bundle. */
public String localizedName; public String localizedName;
/** Localized description. May be null. */ /** Localized description. May be null. */
public String description; public @Nullable String description;
/** Icons by Cicon ID.*/ /** Icons by Cicon ID.*/
protected TextureRegion[] cicons = new TextureRegion[mindustry.ui.Cicon.all.length]; protected TextureRegion[] cicons = new TextureRegion[mindustry.ui.Cicon.all.length];
@@ -24,6 +25,10 @@ public abstract class UnlockableContent extends MappableContent{
this.description = Core.bundle.getOrNull(getContentType() + "." + this.name + ".description"); this.description = Core.bundle.getOrNull(getContentType() + "." + this.name + ".description");
} }
public String displayDescription(){
return minfo.mod == null ? description : description + "\n" + Core.bundle.format("mod.display", minfo.mod.meta.displayName());
}
/** Generate any special icons for this content. Called asynchronously.*/ /** Generate any special icons for this content. Called asynchronously.*/
@CallSuper @CallSuper
public void createIcons(MultiPacker packer){ public void createIcons(MultiPacker packer){

View File

@@ -28,7 +28,7 @@ public class ContentDisplay{
table.row(); table.row();
if(block.description != null){ if(block.description != null){
table.add(block.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); table.add(block.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row(); table.row();
table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX(); table.addImage().height(3).color(Color.lightGray).pad(8).padLeft(0).padRight(0).fillX();
@@ -76,7 +76,7 @@ public class ContentDisplay{
table.row(); table.row();
if(item.description != null){ if(item.description != null){
table.add(item.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); table.add(item.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row(); table.row();
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX(); table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
@@ -110,7 +110,7 @@ public class ContentDisplay{
table.row(); table.row();
if(liquid.description != null){ if(liquid.description != null){
table.add(liquid.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); table.add(liquid.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row(); table.row();
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX(); table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
@@ -145,7 +145,7 @@ public class ContentDisplay{
table.row(); table.row();
if(mech.description != null){ if(mech.description != null){
table.add(mech.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); table.add(mech.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row(); table.row();
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX(); table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();
@@ -192,7 +192,7 @@ public class ContentDisplay{
table.row(); table.row();
if(unit.description != null){ if(unit.description != null){
table.add(unit.description).padLeft(5).padRight(5).width(400f).wrap().fillX(); table.add(unit.displayDescription()).padLeft(5).padRight(5).width(400f).wrap().fillX();
table.row(); table.row();
table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX(); table.addImage().height(3).color(Color.lightGray).pad(15).padLeft(0).padRight(0).fillX();

View File

@@ -377,7 +377,7 @@ public class TechTreeDialog extends FloatingDialog{
infoTable.row(); infoTable.row();
if(node.block.description != null){ if(node.block.description != null){
infoTable.table(t -> t.margin(3f).left().labelWrap(node.block.description).color(Color.lightGray).growX()).fillX(); infoTable.table(t -> t.margin(3f).left().labelWrap(node.block.displayDescription()).color(Color.lightGray).growX()).fillX();
} }
addChild(infoTable); addChild(infoTable);