Ejemplo n.º 1
0
        private void InitializeWelcomePopup()
        {
            welcomePopup = UILibrary.InstantiateElement <ModalElement>("WelcomePopup");
            welcomePopup.SetPanelZIndex(1);

            // FIXME: UI asset should support multiline text
            var welcomeText = welcomePopup.FindVisualChildOfType <TextBlock>("welcomeText");

            welcomeText.Text = "Welcome to stride UI sample.\nPlease name your character";

            var cancelButton = welcomePopup.FindVisualChildOfType <Button>("cancelButton");

            cancelButton.Click += delegate
            {
                nameTextBlock.Text = DefaultName;
                CloseWelcomePopup();
            };

            var nameEditText = welcomePopup.FindVisualChildOfType <EditText>("nameEditText");

            nameEditText.Text = DefaultName;
            var validateButton = welcomePopup.FindVisualChildOfType <Button>("validateButton");

            validateButton.Click += delegate
            {
                nameTextBlock.Text = nameEditText.Text.Trim();
                CloseWelcomePopup();
            };
        }
Ejemplo n.º 2
0
        private void InitializeLoginGrid()
        {
            m_LoginGrid = UILibrary.InstantiateElement <ModalElement>("LoginPopup");
            Button enter = m_LoginGrid.FindVisualChildOfType <Button>("Enter");

            enter.Click += delegate
            {
                Log.Info("Mouse button clicked");
                EditText name = m_LoginGrid.FindVisualChildOfType <EditText>("Name");
                m_SceneController.SubmitForm(name.Text);

                CloseLoginGrid();
            };
        }
Ejemplo n.º 3
0
        private void InitializeShipSelectionPopup()
        {
            shipSelectPopup = UILibrary.InstantiateElement <ModalElement>("ShipSelectPopup");
            shipSelectPopup.SetPanelZIndex(1);

            // Layout elements in vertical StackPanel
            var contentStackpanel = shipSelectPopup.FindVisualChildOfType <StackPanel>("contentStackPanel");

            // Create and Add SpaceShip to the stack layout
            foreach (var ship in shipList)
            {
                contentStackpanel.Children.Add(CreateShipSelectionItem(ship));
            }

            // Uncomment those lines to have an example of stack panel item virtualization
            //var shipInitialCount = shipList.Count;
            //contentStackpanel.ItemVirtualizationEnabled = true;
            //for (var i = 0; i < 200; i++)
            //{
            //    shipList.Add(new SpaceShip { Name = shipList[i % shipInitialCount].Name });
            //    contentStackpanel.Children.Add(CreateShipSelectionItem(shipList[shipList.Count - 1]));
            //}

            UpdateShipStatus();
            CloseShipSelectPopup();
        }
Ejemplo n.º 4
0
        public void ShowLoginGrid(string destination)
        {
            TextBlock dest = m_LoginGrid.FindVisualChildOfType <TextBlock>("Destination");

            dest.Text = string.Format("Destination: {0}", destination);
            m_LoginGrid.Visibility = Visibility.Visible;
        }