v0.3.4: expanded the languages window
This commit is contained in:
parent
fff60a7c1d
commit
34f6e8540f
|
@ -20,13 +20,20 @@
|
||||||
*/
|
*/
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
package com.shatteredpixel.shatteredpixeldungeon.windows;
|
||||||
|
|
||||||
|
import android.content.Intent;
|
||||||
|
import android.net.Uri;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
import com.shatteredpixel.shatteredpixeldungeon.ShatteredPixelDungeon;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
import com.shatteredpixel.shatteredpixeldungeon.messages.Messages;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.TitleScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.RedButton;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
import com.shatteredpixel.shatteredpixeldungeon.ui.Window;
|
||||||
|
import com.watabou.input.Touchscreen;
|
||||||
|
import com.watabou.noosa.ColorBlock;
|
||||||
|
import com.watabou.noosa.Game;
|
||||||
import com.watabou.noosa.RenderedText;
|
import com.watabou.noosa.RenderedText;
|
||||||
|
import com.watabou.noosa.RenderedTextMultiline;
|
||||||
|
import com.watabou.noosa.TouchArea;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
@ -34,9 +41,13 @@ import java.util.Locale;
|
||||||
|
|
||||||
public class WndLangs extends Window {
|
public class WndLangs extends Window {
|
||||||
|
|
||||||
private int WIDTH = 60;
|
private int WIDTH = 120;
|
||||||
|
private int BTN_WIDTH = 50;
|
||||||
private int BTN_HEIGHT = 14;
|
private int BTN_HEIGHT = 14;
|
||||||
|
|
||||||
|
private int TEXT_LEFT = 55;
|
||||||
|
private int TEXT_WIDTH = WIDTH - TEXT_LEFT;
|
||||||
|
|
||||||
public WndLangs(){
|
public WndLangs(){
|
||||||
super();
|
super();
|
||||||
|
|
||||||
|
@ -47,6 +58,7 @@ public class WndLangs extends Window {
|
||||||
//move the native language to the top.
|
//move the native language to the top.
|
||||||
langs.add(0, nativeLang);
|
langs.add(0, nativeLang);
|
||||||
|
|
||||||
|
//language buttons layout
|
||||||
int y = 0;
|
int y = 0;
|
||||||
for (int i = 0; i < langs.size(); i++){
|
for (int i = 0; i < langs.size(); i++){
|
||||||
final int langIndex = i;
|
final int langIndex = i;
|
||||||
|
@ -61,7 +73,7 @@ public class WndLangs extends Window {
|
||||||
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
|
ShatteredPixelDungeon.switchNoFade(TitleScene.class);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
if (ShatteredPixelDungeon.language() == langs.get(i)){
|
if (Messages.lang() == langs.get(i)){
|
||||||
btn.textColor(TITLE_COLOR);
|
btn.textColor(TITLE_COLOR);
|
||||||
} else {
|
} else {
|
||||||
switch (langs.get(i).status()) {
|
switch (langs.get(i).status()) {
|
||||||
|
@ -73,12 +85,59 @@ public class WndLangs extends Window {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
btn.setSize(WIDTH, BTN_HEIGHT);
|
btn.setSize(BTN_WIDTH, BTN_HEIGHT);
|
||||||
btn.setPos(0, y);
|
btn.setPos(0, y);
|
||||||
add(btn);
|
add(btn);
|
||||||
y += 16;
|
y += 15;
|
||||||
}
|
}
|
||||||
resize(WIDTH, y-2);
|
y--;
|
||||||
|
resize(WIDTH, y);
|
||||||
|
|
||||||
|
ColorBlock separator = new ColorBlock(1, y, 0xFF000000);
|
||||||
|
separator.x = (BTN_WIDTH + TEXT_LEFT)/2f;
|
||||||
|
add(separator);
|
||||||
|
|
||||||
|
//language info layout.
|
||||||
|
RenderedText title = PixelScene.renderText( Messages.titleCase(Messages.lang().nativeName()) , 9 );
|
||||||
|
title.x = TEXT_LEFT + (TEXT_WIDTH - title.width())/2f;
|
||||||
|
title.y = 0;
|
||||||
|
title.hardlight(TITLE_COLOR);
|
||||||
|
add(title);
|
||||||
|
|
||||||
|
RenderedTextMultiline info = PixelScene.renderMultiline( 6 );
|
||||||
|
switch(Messages.lang().status()){
|
||||||
|
case REVIEWED:
|
||||||
|
info.text(Messages.get(this, "completed"), WIDTH-TEXT_LEFT);
|
||||||
|
break;
|
||||||
|
case UNREVIEWED:
|
||||||
|
info.text(Messages.get(this, "unreviewed"), WIDTH-TEXT_LEFT);
|
||||||
|
break;
|
||||||
|
case INCOMPLETE:
|
||||||
|
info.text(Messages.get(this, "unfinished"), WIDTH-TEXT_LEFT);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
info.setPos(TEXT_LEFT, title.height() + 2);
|
||||||
|
add(info);
|
||||||
|
|
||||||
|
RedButton creditsBtn = new RedButton(Messages.titleCase(Messages.get(this, "credits")));
|
||||||
|
creditsBtn.setSize(creditsBtn.reqWidth()+2, 16);
|
||||||
|
creditsBtn.setPos(TEXT_LEFT + (TEXT_WIDTH - creditsBtn.width())/2f, y - 18);
|
||||||
|
add(creditsBtn);
|
||||||
|
|
||||||
|
RenderedTextMultiline transifex_text = PixelScene.renderMultiline(6);
|
||||||
|
transifex_text.text(Messages.get(this, "transifex"), WIDTH-TEXT_LEFT);
|
||||||
|
transifex_text.setPos(TEXT_LEFT, creditsBtn.top() - 2 - transifex_text.height());
|
||||||
|
add(transifex_text);
|
||||||
|
|
||||||
|
TouchArea transifex_link = new TouchArea(transifex_text.left(), transifex_text.top(),
|
||||||
|
transifex_text.width(), transifex_text.height()){
|
||||||
|
@Override
|
||||||
|
protected void onClick(Touchscreen.Touch touch) {
|
||||||
|
Intent intent = new Intent( Intent.ACTION_VIEW, Uri.parse( "http://www.transifex.com/shattered-pixel/shattered-pixel-dungeon/" ) );
|
||||||
|
Game.instance.startActivity( intent );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
add(transifex_link);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user