]> Pileus Git - ~andy/spades/commitdiff
Show turn in title bar
authorAndy Spencer <andy753421@gmail.com>
Fri, 6 Nov 2015 23:07:32 +0000 (23:07 +0000)
committerAndy Spencer <andy753421@gmail.com>
Fri, 6 Nov 2015 23:07:32 +0000 (23:07 +0000)
src/Cards.java
src/Main.java
src/Spades.java

index 8506e212a36c708722e90acdc30a3d0351ee0ffe..0d5686a3f8325c8612a32ba0d6b9107094c0437f 100644 (file)
@@ -129,6 +129,8 @@ public class Cards extends GLSurfaceView implements GLSurfaceView.Renderer
        public Spades        game;        // the spades game
        public String[]      hand;        // cards to display
        public String[]      pile;        // played cards to display
        public Spades        game;        // the spades game
        public String[]      hand;        // cards to display
        public String[]      pile;        // played cards to display
+       public String        turn;        // whos turn it is
+       public String        state;       // state of the game (turn, bid, etc)
 
        /* GLSurfaceView Methods */
        public Cards(Context context)
 
        /* GLSurfaceView Methods */
        public Cards(Context context)
@@ -148,6 +150,7 @@ public class Cards extends GLSurfaceView implements GLSurfaceView.Renderer
 
                this.hand  = "As Ks Qs Js 10s 9s 8s 7s 6s 5s 4s 3s 2s".split(" ");
                this.pile  = "Ah Ac Ad".split(" ");
 
                this.hand  = "As Ks Qs Js 10s 9s 8s 7s 6s 5s 4s 3s 2s".split(" ");
                this.pile  = "Ah Ac Ad".split(" ");
+               this.turn  = "";
 
                this.index = new HashMap<String,Integer>(52);
                for (int i = 0; i < 52; i++)
 
                this.index = new HashMap<String,Integer>(52);
                for (int i = 0; i < 52; i++)
index 0b29dbad516662d39776170ef7b9409865c8786d..362af122c04e825127d2bfc822f61e36609b0f42 100644 (file)
@@ -195,6 +195,12 @@ public class Main extends Activity
                                break;
                }
                this.lscroll.smoothScrollTo(0, this.log.getBottom());
                                break;
                }
                this.lscroll.smoothScrollTo(0, this.log.getBottom());
+
+               // Update title
+               if (this.cards.turn  != null && this.cards.turn  != "" &&
+                   this.cards.state != null && this.cards.state != "") {
+                       this.setTitle("Spades - " + this.cards.turn + "'s " + this.cards.state);
+               }
        }
 
        private void onNotify(String text)
        }
 
        private void onNotify(String text)
index 31878442460291f6564af9b8164b72e94dc39ec0..b1d9d74979b9137ef435787588b8a6f8ab08863b 100644 (file)
@@ -50,6 +50,15 @@ public class Spades
                        this.cards.pile = Spades.getCards(txt, ".*turn! \\((.*)\\)");
                        this.cards.requestRender();
                }
                        this.cards.pile = Spades.getCards(txt, ".*turn! \\((.*)\\)");
                        this.cards.requestRender();
                }
+               if (txt.startsWith("It is")) {
+                       this.cards.turn  = txt.replaceAll("It is (\\w+)'s (\\w+)!.*", "$1");
+                       this.cards.state = txt.replaceAll("It is (\\w+)'s (\\w+)!.*", "$2");
+                       this.cards.requestRender();
+               }
+               if (txt.startsWith("^it is your")) {
+                       this.cards.turn = msg.to;
+                       this.cards.requestRender();
+               }
        }
 
        /* UI Callbacks */
        }
 
        /* UI Callbacks */