Added chat :emoji: support on desktop
This commit is contained in:
@@ -109,6 +109,10 @@ public class GameService{
|
||||
routerLanguage.complete();
|
||||
}
|
||||
|
||||
if(!Planets.serpulo.sectors.contains(s -> !s.isCaptured())){
|
||||
captureAllSectors.complete();
|
||||
}
|
||||
|
||||
Events.on(UnitDestroyEvent.class, e -> {
|
||||
if(campaign()){
|
||||
if(e.unit.team != Vars.player.team()){
|
||||
@@ -477,7 +481,9 @@ public class GameService{
|
||||
allPresetsErekir.complete();
|
||||
}
|
||||
|
||||
SStat.sectorsControlled.set(e.sector.planet.sectors.count(Sector::hasBase));
|
||||
if(e.sector.planet == Planets.serpulo){
|
||||
SStat.sectorsControlled.set(e.sector.planet.sectors.count(Sector::hasBase));
|
||||
}
|
||||
});
|
||||
|
||||
Events.on(PayloadDropEvent.class, e -> {
|
||||
|
||||
@@ -140,6 +140,8 @@ public class Fonts{
|
||||
}
|
||||
}
|
||||
|
||||
stringIcons.put("alphachan", stringIcons.get("alphaaaa"));
|
||||
|
||||
iconTable = new TextureRegion[512];
|
||||
iconTable[0] = Core.atlas.find("error");
|
||||
lastCid = 1;
|
||||
|
||||
@@ -105,6 +105,8 @@ public class ChatFragment extends Table{
|
||||
chatfield.getStyle().fontColor = Color.white;
|
||||
chatfield.setStyle(chatfield.getStyle());
|
||||
|
||||
chatfield.typed(this::handleType);
|
||||
|
||||
bottom().left().marginBottom(offsety).marginLeft(offsetx * 2).add(fieldlabel).padBottom(6f);
|
||||
|
||||
add(chatfield).padBottom(offsety).padLeft(offsetx).growX().padRight(offsetx).height(28);
|
||||
@@ -115,6 +117,22 @@ public class ChatFragment extends Table{
|
||||
}
|
||||
}
|
||||
|
||||
//no mobile support.
|
||||
private void handleType(char c){
|
||||
int cursor = chatfield.getCursorPosition();
|
||||
if(c == ':'){
|
||||
int index = chatfield.getText().lastIndexOf(':', cursor - 2);
|
||||
if(index >= 0 && index < cursor){
|
||||
String text = chatfield.getText().substring(index + 1, cursor - 1);
|
||||
String uni = Fonts.getUnicodeStr(text);
|
||||
if(uni != null && uni.length() > 0){
|
||||
chatfield.setText(chatfield.getText().substring(0, index) + uni + chatfield.getText().substring(cursor));
|
||||
chatfield.setCursorPosition(index + uni.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void rect(float x, float y, float w, float h){
|
||||
//prevents texture bindings; the string lookup is irrelevant as it is only called <10 times per frame, and maps are very fast anyway
|
||||
Draw.rect("whiteui", x + w/2f, y + h/2f, w, h);
|
||||
|
||||
Reference in New Issue
Block a user