v1.2.0: increased game log length in full UI
This commit is contained in:
parent
dfdd0648de
commit
508d7248f9
|
@ -21,6 +21,7 @@
|
||||||
|
|
||||||
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
package com.shatteredpixel.shatteredpixeldungeon.ui;
|
||||||
|
|
||||||
|
import com.shatteredpixel.shatteredpixeldungeon.SPDSettings;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
import com.shatteredpixel.shatteredpixeldungeon.scenes.PixelScene;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
import com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite;
|
||||||
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
import com.shatteredpixel.shatteredpixeldungeon.utils.GLog;
|
||||||
|
@ -52,6 +53,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void update() {
|
public synchronized void update() {
|
||||||
|
int maxLines = SPDSettings.interfaceSize() > 0 ? 5 : 3;
|
||||||
for (String text : textsToAdd){
|
for (String text : textsToAdd){
|
||||||
if (length != entries.size()){
|
if (length != entries.size()){
|
||||||
clear();
|
clear();
|
||||||
|
@ -81,7 +83,7 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
||||||
color = CharSprite.NEUTRAL;
|
color = CharSprite.NEUTRAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lastEntry != null && color == lastColor && lastEntry.nLines < MAX_LINES) {
|
if (lastEntry != null && color == lastColor && lastEntry.nLines < maxLines) {
|
||||||
|
|
||||||
String lastMessage = lastEntry.text();
|
String lastMessage = lastEntry.text();
|
||||||
lastEntry.text( lastMessage.length() == 0 ? text : lastMessage + " " + text );
|
lastEntry.text( lastMessage.length() == 0 ? text : lastMessage + " " + text );
|
||||||
|
@ -108,14 +110,14 @@ public class GameLog extends Component implements Signal.Listener<String> {
|
||||||
nLines += ((RenderedTextBlock) members.get(i)).nLines;
|
nLines += ((RenderedTextBlock) members.get(i)).nLines;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nLines > MAX_LINES) {
|
if (nLines > maxLines) {
|
||||||
RenderedTextBlock r = ((RenderedTextBlock) members.get(0));
|
RenderedTextBlock r = ((RenderedTextBlock) members.get(0));
|
||||||
remove(r);
|
remove(r);
|
||||||
r.destroy();
|
r.destroy();
|
||||||
|
|
||||||
entries.remove( 0 );
|
entries.remove( 0 );
|
||||||
}
|
}
|
||||||
} while (nLines > MAX_LINES);
|
} while (nLines > maxLines);
|
||||||
if (entries.isEmpty()) {
|
if (entries.isEmpty()) {
|
||||||
lastEntry = null;
|
lastEntry = null;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user