Esempio n. 1
0
        protected override void OnStart()
        {
            if (mode == Mode.Client)
            {
                RegisterNotification(NetworkNotifications.ConnectedToServer, ConnectedToServerNotification);
                StartDiscovery();
            }
            else if (mode == Mode.Server)
            {
                RegisterNotification(NetworkNotifications.ClientConnected, ClientConnectedNotification);
                RegisterNotification(NetworkNotifications.LocalClientDiscovered, LocalClientDiscoveredNotification);
                StartServer();
            }

            Screen screen = new Screen();
            Button button = new TempButton("Cancel");

            button.id             = (int)ButtonId.Cancel;
            button.buttonDelegate = OnCancelButtonPressed;
            button.alignX         = button.alignY = button.parentAlignX = button.parentAlignY = View.ALIGN_CENTER;
            screen.AddView(button);
            screen.SetCancelButton(button);

            Font     font     = Helper.fontSystem;
            TextView textView = new TextView(font, mode.ToString());

            textView.alignX = View.ALIGN_CENTER;
            textView.x      = 0.5f * screen.width;
            textView.y      = 10;
            screen.AddView(textView);

            StartScreen(screen);
        }