From d85fe873cf785d4b90dff22ec728e2ca7fc6cbfb Mon Sep 17 00:00:00 2001 From: Evan Debenham Date: Tue, 15 Feb 2022 14:43:18 -0500 Subject: [PATCH] v1.2.0: added functionality for a third binding for each key --- .../java/com/watabou/input/KeyBindings.java | 2 +- .../main/java/com/watabou/noosa/Group.java | 2 +- .../messages/windows/windows.properties | 2 + .../messages/windows/windows_ca.properties | 2 + .../messages/windows/windows_cs.properties | 2 + .../messages/windows/windows_de.properties | 2 + .../messages/windows/windows_el.properties | 2 + .../messages/windows/windows_eo.properties | 2 + .../messages/windows/windows_es.properties | 2 + .../messages/windows/windows_eu.properties | 2 + .../messages/windows/windows_fi.properties | 2 + .../messages/windows/windows_fr.properties | 2 + .../messages/windows/windows_hu.properties | 2 + .../messages/windows/windows_in.properties | 2 + .../messages/windows/windows_it.properties | 2 + .../messages/windows/windows_ja.properties | 2 + .../messages/windows/windows_ko.properties | 2 + .../messages/windows/windows_pl.properties | 2 + .../messages/windows/windows_pt.properties | 2 + .../messages/windows/windows_ru.properties | 2 + .../messages/windows/windows_tr.properties | 2 + .../messages/windows/windows_uk.properties | 2 + .../messages/windows/windows_zh.properties | 2 + .../shatteredpixeldungeon/SPDAction.java | 87 ++++++---- .../windows/WndKeyBindings.java | 150 +++++++++++++----- 25 files changed, 208 insertions(+), 75 deletions(-) diff --git a/SPD-classes/src/main/java/com/watabou/input/KeyBindings.java b/SPD-classes/src/main/java/com/watabou/input/KeyBindings.java index c7e6b18da..0efeb92b6 100644 --- a/SPD-classes/src/main/java/com/watabou/input/KeyBindings.java +++ b/SPD-classes/src/main/java/com/watabou/input/KeyBindings.java @@ -81,7 +81,7 @@ public class KeyBindings { } else if (keyCode == Input.Keys.PLUS){ return "+"; } else if (keyCode == Input.Keys.BACKSPACE) { - return "Backspace"; + return "Backspc"; } else if (keyCode == Input.Keys.FORWARD_DEL) { return "Delete"; } else { diff --git a/SPD-classes/src/main/java/com/watabou/noosa/Group.java b/SPD-classes/src/main/java/com/watabou/noosa/Group.java index 2a6bae06b..7d2636a98 100644 --- a/SPD-classes/src/main/java/com/watabou/noosa/Group.java +++ b/SPD-classes/src/main/java/com/watabou/noosa/Group.java @@ -160,7 +160,7 @@ public class Group extends Gizmo { g.parent.remove( g ); } - if (members.get( 0 ) == null) { + if (!members.isEmpty() && members.get( 0 ) == null) { members.set( 0, g ); g.parent = this; return g; diff --git a/core/src/main/assets/messages/windows/windows.properties b/core/src/main/assets/messages/windows/windows.properties index d9f45b270..433095866 100644 --- a/core/src/main/assets/messages/windows/windows.properties +++ b/core/src/main/assets/messages/windows/windows.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Landmarks windows.wndkeybindings.ttl_action=Action windows.wndkeybindings.ttl_key1=Key 1 windows.wndkeybindings.ttl_key2=Key 2 +windows.wndkeybindings.ttl_key3=Key 3 windows.wndkeybindings.default=Default Bindings windows.wndkeybindings.confirm=Confirm windows.wndkeybindings.cancel=Cancel @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Go SW windows.wndkeybindings.nw=Go NW windows.wndkeybindings$wndchangebinding.desc_first=Press a key to change the first key binding for: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Press a key to change the second key binding for: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Press a key to change the third key binding for: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Current binding: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=New binding: _%s_ windows.wndkeybindings$wndchangebinding.warning=This key will be unbound from _%s_. diff --git a/core/src/main/assets/messages/windows/windows_ca.properties b/core/src/main/assets/messages/windows/windows_ca.properties index fd5d86bc9..bfee8dd28 100644 --- a/core/src/main/assets/messages/windows/windows_ca.properties +++ b/core/src/main/assets/messages/windows/windows_ca.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Marques windows.wndkeybindings.ttl_action=Acció windows.wndkeybindings.ttl_key1=Botó 1 windows.wndkeybindings.ttl_key2=Botó 2 +windows.wndkeybindings.ttl_key3=Botó 3 windows.wndkeybindings.default=Associacions per defecte windows.wndkeybindings.confirm=Confirmar windows.wndkeybindings.cancel=Cancel·lar @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Anar al Sud-oest windows.wndkeybindings.nw=Anar al Nord-oest windows.wndkeybindings$wndchangebinding.desc_first=Pitja un botó per canviar la primera associació per: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Pitja un botó per canviar la segona associació per: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Pitja un botó per canviar la tercera associació per: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Associació actual: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nova associació: _%s_ windows.wndkeybindings$wndchangebinding.warning=Aquest botó es desassociarà de _%s_. diff --git a/core/src/main/assets/messages/windows/windows_cs.properties b/core/src/main/assets/messages/windows/windows_cs.properties index f7162ce47..03d0c4744 100644 --- a/core/src/main/assets/messages/windows/windows_cs.properties +++ b/core/src/main/assets/messages/windows/windows_cs.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Zajímavosti windows.wndkeybindings.ttl_action=Funkce windows.wndkeybindings.ttl_key1=Klávesa 1 windows.wndkeybindings.ttl_key2=Klávesa 2 +windows.wndkeybindings.ttl_key3=Klávesa 3 windows.wndkeybindings.default=Výchozí nastavení windows.wndkeybindings.confirm=Potvrdit windows.wndkeybindings.cancel=Zrušit @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Jít jihozápadně windows.wndkeybindings.nw=Jít severozápadně windows.wndkeybindings$wndchangebinding.desc_first=Stiskni klávesu pro nastavení první klávesy pro funkci: _%s_ windows.wndkeybindings$wndchangebinding.desc_second=Stiskni klávesu pro nastavení druhé klávesy pro funkci: _%s_ +windows.wndkeybindings$wndchangebinding.desc_third=Stiskni klávesu pro nastavení třetí klávesy pro funkci: _%s_ windows.wndkeybindings$wndchangebinding.desc_current=Současná klávesa: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nová klávesa: _%s_ windows.wndkeybindings$wndchangebinding.warning=Klávesa pro funkci _%s_ bude zrušena. diff --git a/core/src/main/assets/messages/windows/windows_de.properties b/core/src/main/assets/messages/windows/windows_de.properties index 118c450cd..416e91b06 100644 --- a/core/src/main/assets/messages/windows/windows_de.properties +++ b/core/src/main/assets/messages/windows/windows_de.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Meilensteine windows.wndkeybindings.ttl_action=Aktion windows.wndkeybindings.ttl_key1=Schlüssel 1 windows.wndkeybindings.ttl_key2=Schlüssel 2 +windows.wndkeybindings.ttl_key3=Schlüssel 3 windows.wndkeybindings.default=Voreinstellung Tastaturbelegung windows.wndkeybindings.confirm=Bestätigen windows.wndkeybindings.cancel=Abbrechen @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Nach SW windows.wndkeybindings.nw=Nach NW windows.wndkeybindings$wndchangebinding.desc_first=Drücke eine Taste, um die erste Taste für: _%s_ zu ändern. windows.wndkeybindings$wndchangebinding.desc_second=Drücke eine Taste, um die zweite Taste für: _%s_ zu ändern. +windows.wndkeybindings$wndchangebinding.desc_third=Drücke eine Taste, um die dritte Taste für: _%s_ zu ändern. windows.wndkeybindings$wndchangebinding.desc_current=Derzeitige Belegung: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Neue Belegung: _%s_ windows.wndkeybindings$wndchangebinding.warning=Die Taste wird nicht mehr mit _%s_ belegt. diff --git a/core/src/main/assets/messages/windows/windows_el.properties b/core/src/main/assets/messages/windows/windows_el.properties index b864747a0..c4cd79520 100644 --- a/core/src/main/assets/messages/windows/windows_el.properties +++ b/core/src/main/assets/messages/windows/windows_el.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Ορόσημα windows.wndkeybindings.ttl_action=Ενέργεια windows.wndkeybindings.ttl_key1=Πλ. 1 windows.wndkeybindings.ttl_key2=Πλ. 2 +windows.wndkeybindings.ttl_key3=Πλ. 3 windows.wndkeybindings.default=Προεπιλεγμένες δεσμεύσεις windows.wndkeybindings.confirm=Επιβεβαίωση windows.wndkeybindings.cancel=Ακύρωση @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Πήγαινε ΝΔ windows.wndkeybindings.nw=Πήγαινε ΒΔ windows.wndkeybindings$wndchangebinding.desc_first=Πάτα ένα πλήκτρο για να αλλάξεις την κύρια δέσμευση στο: _%s._ windows.wndkeybindings$wndchangebinding.desc_second=Πάτα ένα πλήκτρο για να αλλάξεις τη δεύτερη δέσμευση στο: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Πάτα ένα πλήκτρο για να αλλάξεις την τρίτη δέσμευση στο: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Τρέχουσα δέσμευση: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Νέα δέσμευση: _%s_ windows.wndkeybindings$wndchangebinding.warning=Θα αποδεσμευτεί το: _%s._ diff --git a/core/src/main/assets/messages/windows/windows_eo.properties b/core/src/main/assets/messages/windows/windows_eo.properties index cfd88eee2..f55c01a5d 100644 --- a/core/src/main/assets/messages/windows/windows_eo.properties +++ b/core/src/main/assets/messages/windows/windows_eo.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Rekoniloj windows.wndkeybindings.ttl_action=Ago windows.wndkeybindings.ttl_key1=Klavo 1 windows.wndkeybindings.ttl_key2=Klavo 2 +windows.wndkeybindings.ttl_key3=Klavo 3 windows.wndkeybindings.default=Aprioraj klavoj windows.wndkeybindings.confirm=Konfirmi windows.wndkeybindings.cancel=Nuligi @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Iri ↙ windows.wndkeybindings.nw=Iri ↖ windows.wndkeybindings$wndchangebinding.desc_first=Premu klavon por ŝanĝi la unuan klav-asignon por _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Premu klavon por ŝanĝi la duan klav-asignon por _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Premu klavon por ŝanĝi la trian klav-asignon por _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Nuna klav-asigno: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nova klav-asigno: _%s_ windows.wndkeybindings$wndchangebinding.warning=Tiu ĉi klavo estos malasignita el _%s_. diff --git a/core/src/main/assets/messages/windows/windows_es.properties b/core/src/main/assets/messages/windows/windows_es.properties index 0357491d3..1d3f24375 100644 --- a/core/src/main/assets/messages/windows/windows_es.properties +++ b/core/src/main/assets/messages/windows/windows_es.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Puntos de Referencia windows.wndkeybindings.ttl_action=Acción windows.wndkeybindings.ttl_key1=Tecla 1 windows.wndkeybindings.ttl_key2=Tecla 2 +windows.wndkeybindings.ttl_key3=Tecla 3 windows.wndkeybindings.default=Atajos Predeterminados windows.wndkeybindings.confirm=Confirmar windows.wndkeybindings.cancel=Cancelar @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Ir SO windows.wndkeybindings.nw=Ir NO windows.wndkeybindings$wndchangebinding.desc_first=Presione una tecla para cambiar el primer atajo de teclado para: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Presione una tecla para cambiar el segundo atajo de teclado para: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Presione una tecla para cambiar el tercer atajo de teclado para: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Atajo Actual: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nuevo Atajo: _%s_ windows.wndkeybindings$wndchangebinding.warning=Esta tecla se desvinculara de _%s_. diff --git a/core/src/main/assets/messages/windows/windows_eu.properties b/core/src/main/assets/messages/windows/windows_eu.properties index 25d26ddf3..9f1a4368c 100644 --- a/core/src/main/assets/messages/windows/windows_eu.properties +++ b/core/src/main/assets/messages/windows/windows_eu.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Tokiak windows.wndkeybindings.ttl_action=Ekintza windows.wndkeybindings.ttl_key1=1. tekla windows.wndkeybindings.ttl_key2=2. tekla +windows.wndkeybindings.ttl_key3=3. tekla windows.wndkeybindings.default=Lehenetsitako loturak windows.wndkeybindings.confirm=Baieztatu windows.wndkeybindings.cancel=Utzi @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Joan hego-mendebaldera windows.wndkeybindings.nw=Joan ipar-mendebaldera windows.wndkeybindings$wndchangebinding.desc_first=Sakatu tekla bat honako ekintzaren lehen tekla-lotura aldatzeko: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Sakatu tekla bat honako ekintzaren bigarren tekla-lotura aldatzeko: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Sakatu tekla bat honako ekintzaren hirugarren tekla-lotura aldatzeko: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Oraingo lotura: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Lotura berria: _%s_ windows.wndkeybindings$wndchangebinding.warning=Tekla hau _%s_ ekintzatik deslotuko da. diff --git a/core/src/main/assets/messages/windows/windows_fi.properties b/core/src/main/assets/messages/windows/windows_fi.properties index 5e50cd06f..93da0de91 100644 --- a/core/src/main/assets/messages/windows/windows_fi.properties +++ b/core/src/main/assets/messages/windows/windows_fi.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Merkkipaalut windows.wndkeybindings.ttl_action=Toiminto windows.wndkeybindings.ttl_key1=Nappi 1 windows.wndkeybindings.ttl_key2=Nappi 2 +windows.wndkeybindings.ttl_key3=Nappi 3 windows.wndkeybindings.default=Oletusasettelu windows.wndkeybindings.confirm=Hyväksy windows.wndkeybindings.cancel=Peruuta @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Alavasemmalle windows.wndkeybindings.nw=Ylävasemmalle windows.wndkeybindings$wndchangebinding.desc_first=Paina näppäintä vaihtaaksesi ensimmäisen näppäinasetuksen: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Paina näppäintä vaihtaaksesi toisen näppäinasetuksen: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Paina näppäintä vaihtaaksesi kolmas näppäinasetuksen: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Tämänhetkinen asetus: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Uusi asetus: _%s_ windows.wndkeybindings$wndchangebinding.warning=Tämä nappi vaihdetaan pois: _%s_. diff --git a/core/src/main/assets/messages/windows/windows_fr.properties b/core/src/main/assets/messages/windows/windows_fr.properties index 1d67c279d..e45e5ca7a 100644 --- a/core/src/main/assets/messages/windows/windows_fr.properties +++ b/core/src/main/assets/messages/windows/windows_fr.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Points clés windows.wndkeybindings.ttl_action=Action windows.wndkeybindings.ttl_key1=Clé 1 windows.wndkeybindings.ttl_key2=Clé 2 +windows.wndkeybindings.ttl_key3=Clé 3 windows.wndkeybindings.default=Raccourcis par défaut windows.wndkeybindings.confirm=Confirmer windows.wndkeybindings.cancel=Annuler @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Aller vers le Sud-Ouest windows.wndkeybindings.nw=Aller vers le Nord-Ouest windows.wndkeybindings$wndchangebinding.desc_first=Appuyer sur une touche pour changer le premier raccourci clavier pour : _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Appuyer sur une touche pour changer le second raccourci clavier pour : _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Appuyer sur une touche pour changer le troisième raccourci clavier pour : _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Raccourci actuel : _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nouveau raccourci : _%s_ windows.wndkeybindings$wndchangebinding.warning=Cette touche sera déliée de _%s_. diff --git a/core/src/main/assets/messages/windows/windows_hu.properties b/core/src/main/assets/messages/windows/windows_hu.properties index 2f1f37b35..e61bebceb 100644 --- a/core/src/main/assets/messages/windows/windows_hu.properties +++ b/core/src/main/assets/messages/windows/windows_hu.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Helyszínek windows.wndkeybindings.ttl_action=Művelet windows.wndkeybindings.ttl_key1=Billentyű 1 windows.wndkeybindings.ttl_key2=Billentyű 2 +windows.wndkeybindings.ttl_key3=Billentyű 3 windows.wndkeybindings.default=Alapértelmezett összerendelés windows.wndkeybindings.confirm=Jóváhagy windows.wndkeybindings.cancel=Mégsem @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=DNy windows.wndkeybindings.nw=ÉNy windows.wndkeybindings$wndchangebinding.desc_first=Nyomj egy billentyűt, hogy megváltoztasd az elsődleges összerendelést:_%s_. windows.wndkeybindings$wndchangebinding.desc_second=Nyomj egy billentyűt, hogy megváltoztasd a másodlagos összerendelést:_%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Nyomj egy billentyűt, hogy megváltoztasd a harmadlagos összerendelést:_%s_. windows.wndkeybindings$wndchangebinding.desc_current=Aktuális összerendelés:_%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Új összerendelés:_%s_ windows.wndkeybindings$wndchangebinding.warning=Ez a billentyű leválasztásra kerül erről _%s_. diff --git a/core/src/main/assets/messages/windows/windows_in.properties b/core/src/main/assets/messages/windows/windows_in.properties index 41b256cea..5ef97ec89 100644 --- a/core/src/main/assets/messages/windows/windows_in.properties +++ b/core/src/main/assets/messages/windows/windows_in.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Landmark windows.wndkeybindings.ttl_action=Tindakan windows.wndkeybindings.ttl_key1=Tombol 1 windows.wndkeybindings.ttl_key2=Tombol 2 +windows.wndkeybindings.ttl_key3=Tombol 3 windows.wndkeybindings.default=Binding Default windows.wndkeybindings.confirm=Konfirmasi windows.wndkeybindings.cancel=Kembali @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Ke Barat Daya windows.wndkeybindings.nw=Ke Barat Laut windows.wndkeybindings$wndchangebinding.desc_first=Tekan salah satu tombol untuk mengubah tombol terikat pertama untuk: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Tekan salah satu tombol untuk mengubah tombol terikat kedua untuk: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Tekan salah satu tombol untuk mengubah tombol terikat ketiga untuk: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Ikatan saat Ini : _%s_. windows.wndkeybindings$wndchangebinding.changed_bind=Ikatan baru _%s_. windows.wndkeybindings$wndchangebinding.warning=Tombol ini akan diubah dari _%s_. diff --git a/core/src/main/assets/messages/windows/windows_it.properties b/core/src/main/assets/messages/windows/windows_it.properties index c61698b48..e7767c433 100644 --- a/core/src/main/assets/messages/windows/windows_it.properties +++ b/core/src/main/assets/messages/windows/windows_it.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Punti di interesse windows.wndkeybindings.ttl_action=Azione windows.wndkeybindings.ttl_key1=Tasto 1 windows.wndkeybindings.ttl_key2=Tasto 2 +windows.wndkeybindings.ttl_key3=Tasto 3 windows.wndkeybindings.default=Scorciatoie Predefinite windows.wndkeybindings.confirm=Conferma windows.wndkeybindings.cancel=Annulla @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Vai a SO windows.wndkeybindings.nw=Vai a NO windows.wndkeybindings$wndchangebinding.desc_first=Premi un tasto per cambiare la prima scorciatoia da tastiera per: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Premi un tasto per cambiare la seconda scorciatoia da tastiera per: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Premi un tasto per cambiare la terza scorciatoia da tastiera per: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Scorciatoia attuale: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nuova scorciatoia: _%s_ windows.wndkeybindings$wndchangebinding.warning=Questo tasto verrà scollegato da _%s_. diff --git a/core/src/main/assets/messages/windows/windows_ja.properties b/core/src/main/assets/messages/windows/windows_ja.properties index 355746a04..52e3eff3c 100644 --- a/core/src/main/assets/messages/windows/windows_ja.properties +++ b/core/src/main/assets/messages/windows/windows_ja.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=目印 windows.wndkeybindings.ttl_action=Action windows.wndkeybindings.ttl_key1=Key 1 windows.wndkeybindings.ttl_key2=Key 2 +windows.wndkeybindings.ttl_key3=Key 3 windows.wndkeybindings.default=初期設定の割り当て windows.wndkeybindings.confirm=確定 windows.wndkeybindings.cancel=キャンセル @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=南西に行く windows.wndkeybindings.nw=北西に行く windows.wndkeybindings$wndchangebinding.desc_first=キーを押すと、最初のキーの割り当てが変更されます: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=キーを押すと、二番目のキーの割り当てが変更されます: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=キーを押すと、三番目のキーの割り当てが変更されます: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=現在の割り当て: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=新しい割り当て: _%s_ windows.wndkeybindings$wndchangebinding.warning=このキーは、_%s_から割り当て解除されます。 diff --git a/core/src/main/assets/messages/windows/windows_ko.properties b/core/src/main/assets/messages/windows/windows_ko.properties index 090f7c57e..e4d71f7eb 100644 --- a/core/src/main/assets/messages/windows/windows_ko.properties +++ b/core/src/main/assets/messages/windows/windows_ko.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=특수 지형 windows.wndkeybindings.ttl_action=행동 windows.wndkeybindings.ttl_key1=1번째 키 windows.wndkeybindings.ttl_key2=2번째 키 +windows.wndkeybindings.ttl_key3=3번째 키 windows.wndkeybindings.default=기본 조작키 windows.wndkeybindings.confirm=확인 windows.wndkeybindings.cancel=취소 @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=남서쪽 이동 windows.wndkeybindings.nw=북서쪽 이동 windows.wndkeybindings$wndchangebinding.desc_first=다음 명령의 첫번째 조작키를 누르세요: _%s_ windows.wndkeybindings$wndchangebinding.desc_second=다음 명령의 두번째 조작키를 누르세요: _%s_ +windows.wndkeybindings$wndchangebinding.desc_third=다음 명령의 세번째 조작키를 누르세요: _%s_ windows.wndkeybindings$wndchangebinding.desc_current=현재 조작키: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=새 조작키: _%s_ windows.wndkeybindings$wndchangebinding.warning=조작키가 _%s_로부터 해제됩니다. diff --git a/core/src/main/assets/messages/windows/windows_pl.properties b/core/src/main/assets/messages/windows/windows_pl.properties index 7e88a90c5..91d307b91 100644 --- a/core/src/main/assets/messages/windows/windows_pl.properties +++ b/core/src/main/assets/messages/windows/windows_pl.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Punkty orientacyjne windows.wndkeybindings.ttl_action=Akcja windows.wndkeybindings.ttl_key1=Przycisk 1 windows.wndkeybindings.ttl_key2=Przycisk 2 +windows.wndkeybindings.ttl_key3=Przycisk 3 windows.wndkeybindings.default=Domyślne przypisania windows.wndkeybindings.confirm=Potwierdź windows.wndkeybindings.cancel=Anuluj @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Idź na Płd-Zach windows.wndkeybindings.nw=Idź na Płn-Zach windows.wndkeybindings$wndchangebinding.desc_first=Wciśnij przycisk, aby zmienić pierwsze przypisanie dla: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Wciśnij przycisk, aby zmienić drugie przypisanie dla: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Wciśnij przycisk, aby zmienić trzecie przypisanie dla: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Obecne przypisanie: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nowe przypisanie: _%s_ windows.wndkeybindings$wndchangebinding.warning=Przypisanie do _%s_ będzie anulowane. diff --git a/core/src/main/assets/messages/windows/windows_pt.properties b/core/src/main/assets/messages/windows/windows_pt.properties index 1d73331ed..4fd9593f3 100644 --- a/core/src/main/assets/messages/windows/windows_pt.properties +++ b/core/src/main/assets/messages/windows/windows_pt.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Ponto de referência windows.wndkeybindings.ttl_action=Ação windows.wndkeybindings.ttl_key1=Chave 1 windows.wndkeybindings.ttl_key2=Chave 2 +windows.wndkeybindings.ttl_key3=Chave 3 windows.wndkeybindings.default=Ligações Padrão windows.wndkeybindings.confirm=Confirme windows.wndkeybindings.cancel=Cancelar @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Vá para o SO windows.wndkeybindings.nw=Vá para o NO windows.wndkeybindings$wndchangebinding.desc_first=Pressione uma tecla para alterar a primeira ligação de tecla para: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Pressione uma tecla para alterar a segunda ligação de tecla para: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Pressione uma tecla para alterar a terceira ligação de tecla para: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Ligação atual: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Nova ligação: _%s_ windows.wndkeybindings$wndchangebinding.warning=Essa tecla será desvinculada de _%s_. diff --git a/core/src/main/assets/messages/windows/windows_ru.properties b/core/src/main/assets/messages/windows/windows_ru.properties index 5ad85fef2..ccdef87a3 100644 --- a/core/src/main/assets/messages/windows/windows_ru.properties +++ b/core/src/main/assets/messages/windows/windows_ru.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Ориентиры windows.wndkeybindings.ttl_action=Действие windows.wndkeybindings.ttl_key1=Клавиша 1 windows.wndkeybindings.ttl_key2=Клавиша 2 +windows.wndkeybindings.ttl_key3=Клавиша 3 windows.wndkeybindings.default=Привязка клавиш по умолчанию windows.wndkeybindings.confirm=Подтвердить windows.wndkeybindings.cancel=Отмена @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Движение на юго-запад windows.wndkeybindings.nw=Движение на северо-запад windows.wndkeybindings$wndchangebinding.desc_first=Нажмите клавишу, чтобы изменить привязку первой клавиши для: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Нажмите клавишу, чтобы изменить привязку второй клавиши для: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Нажмите клавишу, чтобы изменить привязку третьей клавиши для: _%s_. windows.wndkeybindings$wndchangebinding.desc_current=Текущяя привязка: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Новая привязка: _%s_ windows.wndkeybindings$wndchangebinding.warning=Привязка этой клавиши к _%s_ будет упразднена. diff --git a/core/src/main/assets/messages/windows/windows_tr.properties b/core/src/main/assets/messages/windows/windows_tr.properties index 572792806..0aa467bd9 100644 --- a/core/src/main/assets/messages/windows/windows_tr.properties +++ b/core/src/main/assets/messages/windows/windows_tr.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Yer işaretleri windows.wndkeybindings.ttl_action=Eylem windows.wndkeybindings.ttl_key1=Tuş 1 windows.wndkeybindings.ttl_key2=Tuş 2 +windows.wndkeybindings.ttl_key3=Tuş 3 windows.wndkeybindings.default=Varsayılan Ayarlar windows.wndkeybindings.confirm=Onayla windows.wndkeybindings.cancel=İptal @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Güneybatıya git windows.wndkeybindings.nw=Kuzeybatıya git windows.wndkeybindings$wndchangebinding.desc_first=_%s_'a atanan ilk tuşu değiştirmek için bir tuşa basın. windows.wndkeybindings$wndchangebinding.desc_second=_%s_'a atanan ikinci tuşu değiştirmek için bir tuşa basın. +windows.wndkeybindings$wndchangebinding.desc_third=_%s_'a atanan üçüncü tuşu değiştirmek için bir tuşa basın. windows.wndkeybindings$wndchangebinding.desc_current=Şu anki tuşlama: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Yeni Tuşlama:_%s_ windows.wndkeybindings$wndchangebinding.warning=Bu tuş _%s_ 'dan ayrılacak. diff --git a/core/src/main/assets/messages/windows/windows_uk.properties b/core/src/main/assets/messages/windows/windows_uk.properties index 24248b1ea..7a43ae4a2 100644 --- a/core/src/main/assets/messages/windows/windows_uk.properties +++ b/core/src/main/assets/messages/windows/windows_uk.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=Орієнтири windows.wndkeybindings.ttl_action=Дія windows.wndkeybindings.ttl_key1=Ключ 1 windows.wndkeybindings.ttl_key2=Ключ 2 +windows.wndkeybindings.ttl_key3=Ключ 3 windows.wndkeybindings.default=Стандартні прив'язки windows.wndkeybindings.confirm=Підтвердити windows.wndkeybindings.cancel=Скасувати @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=Ідіть на ПД-ЗХ windows.wndkeybindings.nw=Ідіть на ПН-ЗХ windows.wndkeybindings$wndchangebinding.desc_first=Натисніть клавішу, щоб змінити прив'язку першої клавіші для: _%s_. windows.wndkeybindings$wndchangebinding.desc_second=Натисніть клавішу, щоб змінити прив'язку другої клавіші для: _%s_. +windows.wndkeybindings$wndchangebinding.desc_third=Натисніть клавішу, щоб змінити прив'язку третьої клавіші для: _% s_. windows.wndkeybindings$wndchangebinding.desc_current=Поточна прив'язка: _%s_ windows.wndkeybindings$wndchangebinding.changed_bind=Нова прив'язка:_%s_ windows.wndkeybindings$wndchangebinding.warning=Ця прив'язка буде знята з _%s_. diff --git a/core/src/main/assets/messages/windows/windows_zh.properties b/core/src/main/assets/messages/windows/windows_zh.properties index 319791e75..a2a2a213e 100644 --- a/core/src/main/assets/messages/windows/windows_zh.properties +++ b/core/src/main/assets/messages/windows/windows_zh.properties @@ -90,6 +90,7 @@ windows.wndjournal$notestab.landmarks=特殊地标 windows.wndkeybindings.ttl_action=动作 windows.wndkeybindings.ttl_key1=按键1 windows.wndkeybindings.ttl_key2=按键2 +windows.wndkeybindings.ttl_key3=按键3 windows.wndkeybindings.default=恢复默认键位 windows.wndkeybindings.confirm=确定 windows.wndkeybindings.cancel=取消 @@ -125,6 +126,7 @@ windows.wndkeybindings.sw=左下 windows.wndkeybindings.nw=左上 windows.wndkeybindings$wndchangebinding.desc_first=按下一个按键以替代_%s_的第一键位。 windows.wndkeybindings$wndchangebinding.desc_second=按下一个按键以替代_%s_的第二键位。 +windows.wndkeybindings$wndchangebinding.desc_third=按下一个按键以替代_%s_的第三键位。 windows.wndkeybindings$wndchangebinding.desc_current=当前键位:_%s_ windows.wndkeybindings$wndchangebinding.changed_bind=新的键位:_%s_ windows.wndkeybindings$wndchangebinding.warning=这个按键将不再应用于_%s_。 diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java index e21529e49..a1a307fb3 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/SPDAction.java @@ -144,52 +144,66 @@ public class SPDAction extends GameAction { Bundle firstKeys = b.getBundle("first_keys"); Bundle secondKeys = b.getBundle("second_keys"); + Bundle thirdKeys = b.getBundle("third_keys"); LinkedHashMap defaults = getDefaults(); - LinkedHashMap custom = new LinkedHashMap<>(); + LinkedHashMap merged = new LinkedHashMap<>(); for (GameAction a : allActions()) { if (firstKeys.contains(a.name())) { if (firstKeys.getInt(a.name()) == 0){ - for (int i : defaults.keySet()){ - if (defaults.get(i) == a){ - defaults.remove(i); - break; - } - } + continue; //we have no keys assigned to this action, move to the next one } else { - custom.put(firstKeys.getInt(a.name()), a); - defaults.remove(firstKeys.getInt(a.name())); + merged.put(firstKeys.getInt(a.name()), a); + defaults.remove(firstKeys.getInt(a.name())); //prevent duplicates in other actions + } + } else { + //if we have no custom key here, find the first one from defaults and merge it + for (int i : defaults.keySet()){ + if (defaults.get(i) == a){ + merged.put(i, defaults.remove(i)); + break; + } } } - //we store any custom second keys in defaults for the moment to preserve order - //incase the 2nd key is custom but the first one isn't if (secondKeys.contains(a.name())) { if (secondKeys.getInt(a.name()) == 0){ - int last = 0; - for (int i : defaults.keySet()){ - if (defaults.get(i) == a){ - last = i; - } - } - defaults.remove(last); + continue; //we have no more keys assigned to this action, move to the next one } else { + merged.put(secondKeys.getInt(a.name()), a); defaults.remove(secondKeys.getInt(a.name())); - defaults.put(secondKeys.getInt(a.name()), a); + } + } else { + //if we have no custom key here, find the next one from defaults and merge it + for (int i : defaults.keySet()){ + if (defaults.get(i) == a){ + merged.put(i, defaults.remove(i)); + break; + } + } + } + + if (thirdKeys.contains(a.name())) { + if (thirdKeys.getInt(a.name()) == 0){ + continue; //we have no more keys assigned to this action, move to the next one + } else { + merged.put(thirdKeys.getInt(a.name()), a); + defaults.remove(thirdKeys.getInt(a.name())); + } + } else { + //if we have no custom key here, find the next one from defaults and merge it + for (int i : defaults.keySet()){ + if (defaults.get(i) == a){ + merged.put(i, defaults.remove(i)); + break; + } } } } - //now merge them and store - for( int i : defaults.keySet()){ - if (i != 0) { - custom.put(i, defaults.get(i)); - } - } - - KeyBindings.setAllBindings(custom); + KeyBindings.setAllBindings(merged); } catch (Exception e){ KeyBindings.setAllBindings(getDefaults()); @@ -203,19 +217,24 @@ public class SPDAction extends GameAction { Bundle firstKeys = new Bundle(); Bundle secondKeys = new Bundle(); + Bundle thirdKeys = new Bundle(); for (GameAction a : allActions()){ int firstCur = 0; int secondCur = 0; + int thirdCur = 0; int firstDef = 0; int secondDef = 0; + int thirdDef = 0; for (int i : defaultBindings.keySet()){ if (defaultBindings.get(i) == a){ - if(firstDef == 0){ + if (firstDef == 0) { firstDef = i; - } else { + } else if (secondDef == 0) { secondDef = i; + } else { + thirdDef = i; } } } @@ -223,10 +242,12 @@ public class SPDAction extends GameAction { LinkedHashMap curBindings = KeyBindings.getAllBindings(); for (int i : curBindings.keySet()){ if (curBindings.get(i) == a){ - if(firstCur == 0){ + if (firstCur == 0) { firstCur = i; - } else { + } else if (secondCur == 0) { secondCur = i; + } else { + thirdCur = i; } } } @@ -237,11 +258,15 @@ public class SPDAction extends GameAction { if (secondCur != secondDef){ secondKeys.put(a.name(), secondCur); } + if (thirdCur != thirdDef){ + thirdKeys.put(a.name(), thirdCur); + } } b.put("first_keys", firstKeys); b.put("second_keys", secondKeys); + b.put("third_keys", thirdKeys); try { FileUtils.bundleToFile(BINDINGS_FILE, b); diff --git a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndKeyBindings.java b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndKeyBindings.java index b685bdaf0..ec647d7f8 100644 --- a/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndKeyBindings.java +++ b/core/src/main/java/com/shatteredpixel/shatteredpixeldungeon/windows/WndKeyBindings.java @@ -41,13 +41,14 @@ import java.util.LinkedHashMap; public class WndKeyBindings extends Window { - private static final int WIDTH = 120; + private static final int WIDTH = 135; private static final int BTN_HEIGHT = 16; - private static final int COL1_CENTER = WIDTH/4; - private static final int COL2_CENTER = 5*WIDTH/8; - private static final int COL3_CENTER = 7*WIDTH/8; + private static final int COL1_CENTER = WIDTH/5; + private static final int COL2_CENTER = 5*WIDTH/10; + private static final int COL3_CENTER = 7*WIDTH/10; + private static final int COL4_CENTER = 9*WIDTH/10; private Component bindingsList; private ArrayList listItems = new ArrayList<>(); @@ -63,25 +64,39 @@ public class WndKeyBindings extends Window { add(ttlAction); ColorBlock ttlSep1 = new ColorBlock(1, BTN_HEIGHT, 0xFF222222); - ttlSep1.x = WIDTH/2; + ttlSep1.x = 0.4f*WIDTH - 1; add(ttlSep1); - RenderedTextBlock ttlKey1 = PixelScene.renderTextBlock(Messages.get(this, "ttl_key1"), 9); + RenderedTextBlock ttlKey1 = PixelScene.renderTextBlock(Messages.get(this, "ttl_key1"), 6); + ttlKey1.maxWidth(WIDTH/5); + ttlKey1.align(RenderedTextBlock.CENTER_ALIGN); ttlKey1.setPos(COL2_CENTER - ttlKey1.width()/2, (BTN_HEIGHT - ttlKey1.height())/2); add(ttlKey1); ColorBlock ttlSep2 = new ColorBlock(1, BTN_HEIGHT, 0xFF222222); - ttlSep2.x = 3*WIDTH/4; + ttlSep2.x = 0.6f*WIDTH - 1; add(ttlSep2); - RenderedTextBlock ttlKey2 = PixelScene.renderTextBlock(Messages.get(this, "ttl_key2"), 9); + RenderedTextBlock ttlKey2 = PixelScene.renderTextBlock(Messages.get(this, "ttl_key2"), 6); + ttlKey2.maxWidth(WIDTH/5); + ttlKey2.align(RenderedTextBlock.CENTER_ALIGN); ttlKey2.setPos(COL3_CENTER - ttlKey2.width()/2, (BTN_HEIGHT - ttlKey2.height())/2); add(ttlKey2); - ColorBlock ttlSep3 = new ColorBlock(WIDTH, 1, 0xFF222222); - ttlSep3.y = BTN_HEIGHT; + ColorBlock ttlSep3 = new ColorBlock(1, BTN_HEIGHT, 0xFF222222); + ttlSep3.x = 0.8f*WIDTH - 1; add(ttlSep3); + RenderedTextBlock ttlKey3 = PixelScene.renderTextBlock(Messages.get(this, "ttl_key3"), 6); + ttlKey3.maxWidth(WIDTH/5); + ttlKey3.align(RenderedTextBlock.CENTER_ALIGN); + ttlKey3.setPos(COL4_CENTER - ttlKey2.width()/2, (BTN_HEIGHT - ttlKey2.height())/2); + add(ttlKey3); + + ColorBlock ttlSep4 = new ColorBlock(WIDTH, 1, 0xFF222222); + ttlSep4.y = BTN_HEIGHT; + add(ttlSep4); + bindingsList = new Component(); ScrollPane scrollingList = new ScrollPane(bindingsList){ @@ -104,7 +119,7 @@ public class WndKeyBindings extends Window { BindingItem item = new BindingItem(action); item.setRect(0, y, WIDTH, BindingItem.HEIGHT); - bindingsList.add(item); + bindingsList.addToBack(item); listItems.add(item); y += item.height(); } @@ -119,13 +134,15 @@ public class WndKeyBindings extends Window { for (BindingItem i : listItems){ int key1 = 0; int key2 = 0; + int key3 = 0; for( int k : changedBindings.keySet()){ if (changedBindings.get(k) == i.gameAction){ - if (key1 == 0) key1 = k; - else key2 = k; + if (key1 == 0) key1 = k; + else if (key2 == 0) key2 = k; + else key3 = k; } } - i.updateBindings(key1, key2); + i.updateBindings(key1, key2, key3); } } }; @@ -179,17 +196,21 @@ public class WndKeyBindings extends Window { private GameAction gameAction; private int key1; private int key2; + private int key3; private int origKey1; private int origKey2; + private int origKey3; private RenderedTextBlock actionName; private RenderedTextBlock key1Name; private RenderedTextBlock key2Name; + private RenderedTextBlock key3Name; private ColorBlock sep1; private ColorBlock sep2; private ColorBlock sep3; + private ColorBlock sep4; public BindingItem( GameAction action ){ gameAction = action; @@ -201,6 +222,7 @@ public class WndKeyBindings extends Window { ArrayList keys = KeyBindings.getBoundKeysForAction(action); origKey1 = key1 = keys.isEmpty() ? 0 : keys.remove(0); origKey2 = key2 = keys.isEmpty() ? 0 : keys.remove(0); + origKey3 = key3 = keys.isEmpty() ? 0 : keys.remove(0); key1Name = PixelScene.renderTextBlock( KeyBindings.getKeyName(key1), 6 ); if (key1 == 0) key1Name.hardlight(UNBOUND); @@ -210,6 +232,10 @@ public class WndKeyBindings extends Window { if (key2 == 0) key2Name.hardlight(UNBOUND); add(key2Name); + key3Name = PixelScene.renderTextBlock( KeyBindings.getKeyName(key3), 6 ); + if (key3 == 0) key3Name.hardlight(UNBOUND); + add(key3Name); + sep1 = new ColorBlock(1, 1, 0xFF222222); add(sep1); @@ -218,16 +244,24 @@ public class WndKeyBindings extends Window { sep3 = new ColorBlock(1, 1, 0xFF222222); add(sep3); + + sep4 = new ColorBlock(1, 1, 0xFF222222); + add(sep4); } - public void updateBindings(int first, int second){ - if (first == 0){ - key1 = second; - key2 = first; - } else { - key1 = first; - key2 = second; + public void updateBindings(int first, int second, int third){ + if (second == 0 && third != 0){ + second = third; + third = 0; } + if (first == 0 && second != 0){ + first = second; + second = 0; + } + + key1 = first; + key2 = second; + key3 = third; key1Name.text(KeyBindings.getKeyName(key1)); if (key1 != origKey1) key1Name.hardlight( key1 == 0 ? UNBOUND_CHANGED : CHANGED); @@ -237,6 +271,10 @@ public class WndKeyBindings extends Window { if (key2 != origKey2) key2Name.hardlight( key2 == 0 ? UNBOUND_CHANGED : CHANGED); else key2Name.hardlight( key2 == 0 ? UNBOUND : DEFAULT); + key3Name.text(KeyBindings.getKeyName(key3)); + if (key3 != origKey3) key3Name.hardlight( key3 == 0 ? UNBOUND_CHANGED : CHANGED); + else key3Name.hardlight( key3 == 0 ? UNBOUND : DEFAULT); + layout(); } @@ -244,9 +282,15 @@ public class WndKeyBindings extends Window { protected void layout() { super.layout(); + actionName.maxWidth((int) (2*width/5)); + key1Name.maxWidth((int) (width/5) - 2); + key2Name.maxWidth((int) (width/5)); + key3Name.maxWidth((int) (width/5)); + actionName.setPos( x, y + (height() - actionName.height())/2); - key1Name.setPos(x + width()/2 + 2, y + (height() - key1Name.height())/2); - key2Name.setPos(x + 3*width()/4 + 2, y + (height() - key2Name.height())/2); + key1Name.setPos(x + 2*width()/5 + 1, y + (height() - key1Name.height())/2); + key2Name.setPos(x + 3*width()/5 + 1, y + (height() - key2Name.height())/2); + key3Name.setPos(x + 4*width()/5 + 1, y + (height() - key3Name.height())/2); sep1.size(width, 1); sep1.x = x; @@ -259,17 +303,25 @@ public class WndKeyBindings extends Window { sep3.size(1, height); sep3.x = key2Name.left()-2; sep3.y = y; + + sep4.size(1, height); + sep4.x = key3Name.left()-2; + sep4.y = y; } private boolean onClick( float x, float y ){ if (inside(x, y)){ + //assigning third key + if (x >= this.x + 4*width()/5 && key2 != 0) { + ShatteredPixelDungeon.scene().addToFront( new WndChangeBinding(gameAction, this, 3, key3, key1, key2)); + //assigning second key - if (x >= this.x + 3*width()/4 && key1 != 0) { - ShatteredPixelDungeon.scene().addToFront( new WndChangeBinding(gameAction, this, false, key2, key1)); + } else if (x >= this.x + 3*width()/5 && key1 != 0) { + ShatteredPixelDungeon.scene().addToFront( new WndChangeBinding(gameAction, this, 2, key2, key1, key3)); //assigning first key - } else if (x >= this.x + width()/2){ - ShatteredPixelDungeon.scene().addToFront( new WndChangeBinding(gameAction, this, true, key1, key2)); + } else if (x >= this.x + 2*width()/5){ + ShatteredPixelDungeon.scene().addToFront( new WndChangeBinding(gameAction, this, 1, key1, key2, key3)); } return true; @@ -284,7 +336,8 @@ public class WndKeyBindings extends Window { private class WndChangeBinding extends Window { private int curKeyCode; - private int otherBoundKey; + private int otherBoundKey1; + private int otherBoundKey2; private int changedKeyCode = -1; private BindingItem changedAction; @@ -293,12 +346,17 @@ public class WndKeyBindings extends Window { private RedButton btnConfirm; - public WndChangeBinding(GameAction action, BindingItem listItem, boolean firstKey, int curKeyCode, int otherBoundKey ){ + public WndChangeBinding(GameAction action, BindingItem listItem, int keyAssigning, int curKeyCode, int otherBoundKey1, int otherBoundKey2 ){ this.curKeyCode = curKeyCode; - this.otherBoundKey = otherBoundKey; + this.otherBoundKey1 = otherBoundKey1; + this.otherBoundKey2 = otherBoundKey2; - RenderedTextBlock desc = PixelScene.renderTextBlock( Messages.get(this, firstKey ? "desc_first" : "desc_second", + String descKey = ""; + if (keyAssigning == 1) descKey = "desc_first"; + else if (keyAssigning == 2) descKey = "desc_second"; + else if (keyAssigning == 3) descKey = "desc_third"; + RenderedTextBlock desc = PixelScene.renderTextBlock( Messages.get(this, descKey, Messages.get(WndKeyBindings.class, action.name()), KeyBindings.getKeyName(curKeyCode)), 6 ); desc.maxWidth(WIDTH); @@ -338,24 +396,32 @@ public class WndKeyBindings extends Window { changedBindings.remove(changedKeyCode); changedBindings.remove(listItem.key1); changedBindings.remove(listItem.key2); + changedBindings.remove(listItem.key3); - if (firstKey){ + if (keyAssigning == 1){ if (changedKeyCode != 0) changedBindings.put(changedKeyCode, action); if (listItem.key2 != 0) changedBindings.put(listItem.key2, action); - listItem.updateBindings(changedKeyCode, listItem.key2); - } else { + if (listItem.key3 != 0) changedBindings.put(listItem.key3, action); + listItem.updateBindings(changedKeyCode, listItem.key2, listItem.key3); + } else if (keyAssigning == 2) { if (listItem.key1 != 0) changedBindings.put(listItem.key1, action); if (changedKeyCode != 0) changedBindings.put(changedKeyCode, action); - listItem.updateBindings(listItem.key1, changedKeyCode); + if (listItem.key3 != 0) changedBindings.put(listItem.key3, action); + listItem.updateBindings(listItem.key1, changedKeyCode, listItem.key3); + } else { + if (listItem.key1 != 0) changedBindings.put(listItem.key1, action); + if (listItem.key2 != 0) changedBindings.put(listItem.key2, action); + if (changedKeyCode != 0) changedBindings.put(changedKeyCode, action); + listItem.updateBindings(listItem.key1, listItem.key2, changedKeyCode); } if (changedAction != null){ - if (changedAction.key1 != changedKeyCode){ - changedAction.updateBindings(changedAction.key1, 0); - } else if (changedAction.key2 != changedKeyCode){ - changedAction.updateBindings(changedAction.key2, 0); - } else { - changedAction.updateBindings(0, 0); + if (changedAction.key1 == changedKeyCode){ + changedAction.updateBindings(0, changedAction.key2, changedAction.key3); + } else if (changedAction.key2 == changedKeyCode){ + changedAction.updateBindings(changedAction.key1, 0, changedAction.key3); + } else if (changedAction.key3 == changedKeyCode){ + changedAction.updateBindings(changedAction.key1, changedAction.key2, 0); } } } @@ -390,7 +456,7 @@ public class WndKeyBindings extends Window { changedKeyCode = event.code; changedAction = null; - if (event.code != 0 && (event.code == curKeyCode || event.code == otherBoundKey)){ + if (event.code != 0 && (event.code == curKeyCode || event.code == otherBoundKey1 || event.code == otherBoundKey2)){ warnErr.text(Messages.get(this, "error")); warnErr.hardlight(CharSprite.NEGATIVE); btnConfirm.enable(false);