v0.8.1: redid the layout of wndLangs to be more space-efficient
This commit is contained in:
parent
5a946e11c2
commit
a0d45fa48a
|
@ -103,8 +103,8 @@ windows.wndkeybindings$wndchangebinding.confirm=Confirm
|
|||
windows.wndkeybindings$wndchangebinding.cancel=Cancel
|
||||
|
||||
windows.wndlangs.completed=This language has been fully translated and reviewed.
|
||||
windows.wndlangs.unreviewed=This language has not yet been reviewed.\n\nIt may contain errors, but all text has been translated.
|
||||
windows.wndlangs.unfinished=This language has not been fully translated.\n\nLarge amounts of text may still be in English.
|
||||
windows.wndlangs.unreviewed=_This language has not yet been reviewed._ It may contain errors, but all text has been translated.
|
||||
windows.wndlangs.unfinished=_This language has not been fully translated._ Large amounts of text may still be in English.
|
||||
windows.wndlangs.transifex=All translation provided by volunteers through _Transifex._
|
||||
windows.wndlangs.credits=credits
|
||||
windows.wndlangs.reviewers=reviewers
|
||||
|
|
|
@ -27,6 +27,7 @@ import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
|||
import com.shatteredpixel.shatteredpixeldungeon.messages.Languages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RenderedTextBlock;
|
||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||
|
@ -39,17 +40,17 @@ import java.util.Locale;
|
|||
|
||||
public class WndLangs extends Window {
|
||||
|
||||
private int WIDTH_P = 120;
|
||||
private int WIDTH_L = 171;
|
||||
|
||||
private int MIN_HEIGHT = 110;
|
||||
|
||||
private int BTN_WIDTH = 50;
|
||||
private int BTN_WIDTH = PixelScene.landscape() ? 47 : 60;
|
||||
private int BTN_HEIGHT = 12;
|
||||
|
||||
private int WIDTH_P = 2*BTN_WIDTH + 1;
|
||||
private int WIDTH_L = 5*BTN_WIDTH + 4;
|
||||
|
||||
public WndLangs(){
|
||||
super();
|
||||
|
||||
int w = PixelScene.landscape() ? WIDTH_L : WIDTH_P;
|
||||
|
||||
final ArrayList<Languages> langs = new ArrayList<>(Arrays.asList(Languages.values()));
|
||||
|
||||
Languages nativeLang = Languages.matchLocale(Locale.getDefault());
|
||||
|
@ -59,8 +60,35 @@ public class WndLangs extends Window {
|
|||
|
||||
final Languages currLang = Messages.lang();
|
||||
|
||||
//language buttons layout
|
||||
int y = 0;
|
||||
//language description
|
||||
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.titleCase(currLang.nativeName()) , 9 );
|
||||
title.setPos( (w - title.width())/2f, 2 );
|
||||
title.hardlight(TITLE_COLOR);
|
||||
PixelScene.align(title);
|
||||
add(title);
|
||||
|
||||
RenderedTextBlock info = PixelScene.renderTextBlock(6);
|
||||
info.maxWidth(w);
|
||||
if (currLang == Languages.ENGLISH) info.text("This is the source language, written by the developer.");
|
||||
else if (currLang.status() == Languages.Status.REVIEWED) info.text(Messages.get(this, "completed"));
|
||||
else if (currLang.status() == Languages.Status.UNREVIEWED) info.text(Messages.get(this, "unreviewed"));
|
||||
else if (currLang.status() == Languages.Status.INCOMPLETE) info.text(Messages.get(this, "unfinished"));
|
||||
|
||||
if (currLang.status() == Languages.Status.UNREVIEWED) info.setHightlighting(true, CharSprite.WARNING);
|
||||
else if (currLang.status() == Languages.Status.INCOMPLETE) info.setHightlighting(true, CharSprite.NEGATIVE);
|
||||
info.setPos(0, title.bottom() + 4);
|
||||
add(info);
|
||||
|
||||
int y = PixelScene.landscape() ? 26 : 32;
|
||||
y = Math.max(y, (int)Math.ceil(info.bottom()+1));
|
||||
int x = 0;
|
||||
|
||||
ColorBlock separator = new ColorBlock(w, 1, 0xFF000000);
|
||||
separator.y = y;
|
||||
add(separator);
|
||||
y += 2;
|
||||
|
||||
//language buttons
|
||||
for (int i = 0; i < langs.size(); i++){
|
||||
final int langIndex = i;
|
||||
RedButton btn = new RedButton(Messages.titleCase(langs.get(i).nativeName())){
|
||||
|
@ -93,57 +121,30 @@ public class WndLangs extends Window {
|
|||
break;
|
||||
}
|
||||
}
|
||||
btn.setSize(BTN_WIDTH, BTN_HEIGHT);
|
||||
if (PixelScene.landscape() && i % 2 == 1){
|
||||
btn.setPos(BTN_WIDTH+1, y-(BTN_HEIGHT + 1));
|
||||
} else {
|
||||
btn.setPos(0, y);
|
||||
y += BTN_HEIGHT;
|
||||
if (PixelScene.landscape()) y++;
|
||||
btn.setRect(x, y, BTN_WIDTH, BTN_HEIGHT);
|
||||
btn.setPos(x, y);
|
||||
x += BTN_WIDTH+1;
|
||||
if (x + BTN_WIDTH > w){
|
||||
x = 0;
|
||||
y += BTN_HEIGHT+1;
|
||||
}
|
||||
|
||||
add(btn);
|
||||
}
|
||||
y = Math.max(MIN_HEIGHT, y);
|
||||
resize(PixelScene.landscape() ? WIDTH_L : WIDTH_P, y);
|
||||
|
||||
int textLeft = width - 65;
|
||||
int textWidth = width - textLeft;
|
||||
|
||||
ColorBlock separator = new ColorBlock(1, y, 0xFF000000);
|
||||
separator.x = textLeft - 2.5f;
|
||||
add(separator);
|
||||
|
||||
//language info layout.
|
||||
RenderedTextBlock title = PixelScene.renderTextBlock( Messages.titleCase(currLang.nativeName()) , 9 );
|
||||
title.setPos( textLeft + (textWidth - title.width())/2f, 2 );
|
||||
title.hardlight(TITLE_COLOR);
|
||||
PixelScene.align(title);
|
||||
add(title);
|
||||
|
||||
if (currLang == Languages.ENGLISH){
|
||||
|
||||
RenderedTextBlock info = PixelScene.renderTextBlock(6);
|
||||
info.text("This is the source language, written by the developer.", width - textLeft);
|
||||
info.setPos(textLeft, title.bottom() + 4);
|
||||
add(info);
|
||||
|
||||
} else {
|
||||
|
||||
RenderedTextBlock info = PixelScene.renderTextBlock(6);
|
||||
switch (currLang.status()) {
|
||||
case REVIEWED:
|
||||
info.text(Messages.get(this, "completed"), width - textLeft);
|
||||
break;
|
||||
case UNREVIEWED:
|
||||
info.text(Messages.get(this, "unreviewed"), width - textLeft);
|
||||
break;
|
||||
case INCOMPLETE:
|
||||
info.text(Messages.get(this, "unfinished"), width - textLeft);
|
||||
break;
|
||||
if (x > 0){
|
||||
y += BTN_HEIGHT+1;
|
||||
}
|
||||
info.setPos(textLeft, title.bottom() + 4);
|
||||
add(info);
|
||||
|
||||
separator = new ColorBlock(w, 1, 0xFF000000);
|
||||
separator.y = y;
|
||||
add(separator);
|
||||
y += 2;
|
||||
|
||||
//translation info/credits
|
||||
|
||||
RenderedTextBlock transifex_text = PixelScene.renderTextBlock(6);
|
||||
transifex_text.text(Messages.get(this, "transifex"), w);
|
||||
transifex_text.setPos(0, y);
|
||||
add(transifex_text);
|
||||
|
||||
RedButton creditsBtn = new RedButton(Messages.titleCase(Messages.get(this, "credits"))){
|
||||
@Override
|
||||
|
@ -196,7 +197,7 @@ public class WndLangs extends Window {
|
|||
|
||||
Window credits = new Window( 0, 0, 0, Chrome.get(Chrome.Type.TOAST) );
|
||||
|
||||
int w = wide? 135 : 65;
|
||||
int w = wide? 125 : 60;
|
||||
|
||||
RenderedTextBlock title = PixelScene.renderTextBlock(6);
|
||||
title.text(Messages.titleCase(Messages.get(WndLangs.class, "credits")) , w);
|
||||
|
@ -214,7 +215,7 @@ public class WndLangs extends Window {
|
|||
RenderedTextBlock rightColumn = PixelScene.renderTextBlock(5);
|
||||
rightColumn.setHightlighting(false);
|
||||
rightColumn.text(creds2, 65);
|
||||
rightColumn.setPos(70, title.bottom() + 8.5f);
|
||||
rightColumn.setPos(65, title.bottom() + 7.75f);
|
||||
credits.add(rightColumn);
|
||||
}
|
||||
|
||||
|
@ -223,15 +224,10 @@ public class WndLangs extends Window {
|
|||
}
|
||||
};
|
||||
creditsBtn.setSize(creditsBtn.reqWidth() + 2, 16);
|
||||
creditsBtn.setPos(textLeft + (textWidth - creditsBtn.width()) / 2f, y - 18);
|
||||
add(creditsBtn);
|
||||
creditsBtn.setPos((w - creditsBtn.width())/2f, transifex_text.bottom()+2);
|
||||
if (currLang != Languages.ENGLISH) add(creditsBtn);
|
||||
|
||||
RenderedTextBlock transifex_text = PixelScene.renderTextBlock(6);
|
||||
transifex_text.text(Messages.get(this, "transifex"), width - textLeft);
|
||||
transifex_text.setPos(textLeft, creditsBtn.top() - 2 - transifex_text.height());
|
||||
add(transifex_text);
|
||||
|
||||
}
|
||||
resize(PixelScene.landscape() ? WIDTH_L : WIDTH_P, (int)creditsBtn.bottom());
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user