コード例 #1
0
 public RoomReqListener(Loading page)
 {
     System.Diagnostics.Debug.WriteLine("listener from loading");
     
     _page = page;
     
 }
コード例 #2
0
 public ZoneRequestListener(Loading mainPage)
 {
     // TODO: Complete member initialization
     this.mainPage = mainPage;
 }
コード例 #3
0
 public NotificationListener(Loading page)
 {
     System.Diagnostics.Debug.WriteLine("notif listener from loading");
     
     _page = page;
 }
コード例 #4
0
        public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary<string, object> properties, Dictionary<string, string> lockedPropertiesTable)
        {
            
            var result = Global.p.All(x => properties.Any(y => x.Value == y.Value));
            if(!Convert.ToBoolean(result))
            {
                string text1 = String.Join(":", Global.p.Select(x => String.Format("{0}", x.Value)).ToArray());
                string text2 = String.Join(":", properties.Select(x => String.Format("{0}", x.Value)).ToArray());

                System.Diagnostics.Debug.WriteLine("property change detected\n"+ text1 +"\n" + text2);
                
            }
            Global.p = properties;
            if (_page != null)
            {
                if (_page3 != null) { _page3 = null; }
                if (_page2 != null) { _page2 = null; }

                if (Convert.ToInt16(properties["availUsers"]) == 2)
                {
                    _page.timeout = -100;
                }

                if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both are ready");
        
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        //_page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername;
                        _page.but.Visibility = Visibility.Visible;
                        _page.prog.Visibility = Visibility.Collapsed;
                    });

                }
            }
            
            if (_page2 != null)
            {
                if (_page != null) { _page = null; }
                if (_page3 != null) { _page3 = null; }
                if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both ready for next question");
        
                    Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]);
                    Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]);

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.p1.Value = Global.p1Score;
                        _page2.p2.Value = Global.p2Score;
                       // System.Threading.Thread.Sleep(1000);
                    });
                    System.Diagnostics.Debug.WriteLine("score updated on UI");
        
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {                       
                        _page2.milk();
                        System.Diagnostics.Debug.WriteLine("milk called");
        
                    });


                }

                if (Convert.ToBoolean(properties["endgame0"]) && Convert.ToBoolean(properties["endgame1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both have ended");
        
                    Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]);
                    Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]);

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.p1.Value = Global.p1Score;
                        _page2.p2.Value = Global.p2Score;
                        
                    });
                    _page2.flag = 0;
                    System.Diagnostics.Debug.WriteLine("score ui updated at end");
        
                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.navigateR();
                    });
                    System.Diagnostics.Debug.WriteLine("navigating to results");
        

                }

            }

            if(_page3 != null)
            {
                if (_page2 != null) { _page2 = null; }
                if (_page != null) { _page = null; }

              // sup
                
            }

        }
コード例 #5
0
 public ConnectionListener(Loading result)
 {
     _page = result;
 }
コード例 #6
0
        public NotificationListener(Loading page)
        {
            System.Diagnostics.Debug.WriteLine("notif listener from loading");

            _page = page;
        }
コード例 #7
0
        public void onUserChangeRoomProperty(RoomData roomData, string sender, Dictionary <string, object> properties, Dictionary <string, string> lockedPropertiesTable)
        {
            var result = Global.p.All(x => properties.Any(y => x.Value == y.Value));

            if (!Convert.ToBoolean(result))
            {
                string text1 = String.Join(":", Global.p.Select(x => String.Format("{0}", x.Value)).ToArray());
                string text2 = String.Join(":", properties.Select(x => String.Format("{0}", x.Value)).ToArray());

                System.Diagnostics.Debug.WriteLine("property change detected\n" + text1 + "\n" + text2);
            }
            Global.p = properties;
            if (_page != null)
            {
                if (_page3 != null)
                {
                    _page3 = null;
                }
                if (_page2 != null)
                {
                    _page2 = null;
                }

                if (Convert.ToInt16(properties["availUsers"]) == 2)
                {
                    _page.timeout = -100;
                }

                if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both are ready");

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        //_page.ready.Text = Global.localUsername + " \nvs\n" + Global.opponentUsername;
                        _page.but.Visibility  = Visibility.Visible;
                        _page.prog.Visibility = Visibility.Collapsed;
                    });
                }
            }

            if (_page2 != null)
            {
                if (_page != null)
                {
                    _page = null;
                }
                if (_page3 != null)
                {
                    _page3 = null;
                }
                if (Convert.ToBoolean(properties["ready0"]) && Convert.ToBoolean(properties["ready1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both ready for next question");

                    Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]);
                    Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]);

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.p1.Value = Global.p1Score;
                        _page2.p2.Value = Global.p2Score;
                        // System.Threading.Thread.Sleep(1000);
                    });
                    System.Diagnostics.Debug.WriteLine("score updated on UI");

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.milk();
                        System.Diagnostics.Debug.WriteLine("milk called");
                    });
                }

                if (Convert.ToBoolean(properties["endgame0"]) && Convert.ToBoolean(properties["endgame1"]))
                {
                    System.Diagnostics.Debug.WriteLine("both have ended");

                    Global.p1Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 0 : 1)]);
                    Global.p2Score = Convert.ToInt16(properties["score" + (Global.PlayerIsFirst ? 1 : 0)]);

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.p1.Value = Global.p1Score;
                        _page2.p2.Value = Global.p2Score;
                    });
                    _page2.flag = 0;
                    System.Diagnostics.Debug.WriteLine("score ui updated at end");

                    Deployment.Current.Dispatcher.BeginInvoke(() =>
                    {
                        _page2.navigateR();
                    });
                    System.Diagnostics.Debug.WriteLine("navigating to results");
                }
            }

            if (_page3 != null)
            {
                if (_page2 != null)
                {
                    _page2 = null;
                }
                if (_page != null)
                {
                    _page = null;
                }

                // sup
            }
        }
コード例 #8
0
 public ZoneRequestListener(Loading mainPage)
 {
     // TODO: Complete member initialization
     this.mainPage = mainPage;
 }