Пример #1
0
        private IEnumerator SpawnRoutine()
        {
            // start at an extremity
            _nextSpawnOffset = _spawnOffset;

            WaitForSeconds wait = new WaitForSeconds(_spawnRate);

            while (true)
            {
                yield return(wait);

                if (_floatingText.Count < 1)
                {
                    continue;
                }

                FloatingTextEntry entry = _floatingText.Dequeue();

                FloatingText floatingText = GameStateManager.Instance.GameUIManager.InstantiateFloatingText(entry.poolName);
                if (null == floatingText)
                {
                    Debug.LogWarning($"Failed to get floating text from pool {entry.poolName}!");
                    continue;
                }

                // offset our starting x (TODO: offset z also ?)
                Vector3 position = entry.position();
                position.x      += _nextSpawnOffset;
                _nextSpawnOffset = -_nextSpawnOffset;

                floatingText.Text.text  = entry.text;
                floatingText.Text.color = entry.color;
                floatingText.Show(position);
            }
        }
Пример #2
0
        public App()
        {
            EmailEntry                     = new FloatingTextEntry();
            EmailEntry.Placeholder         = "Email";
            EmailEntry.AccentColor         = Color.FromHex("#FFC107");
            EmailEntry.InactiveAccentColor = Color.FromHex("#1976D2");
            EmailEntry.TextColor           = Color.Purple;
            EmailEntry.ErrorColor          = Color.Red;
            EmailEntry.ErrorText           = "Bad Email";
            EmailEntry.Validator           = FloatingTextEntry.EmailValidator;
            EmailEntry.Keyboard            = Keyboard.Telephone;

            PassEntry                     = new FloatingTextEntry();
            PassEntry.Placeholder         = "Password";
            PassEntry.AccentColor         = Color.FromHex("#FFC107");
            PassEntry.InactiveAccentColor = Color.FromHex("#1976D2");
            PassEntry.TextColor           = Color.Purple;
            PassEntry.IsPassword          = true;
            PassEntry.ErrorColor          = Color.Red;
            PassEntry.ErrorText           = "Bad Password";
            PassEntry.Validator           = (string input) => {
                return(!string.IsNullOrWhiteSpace(input));
            };

            Button = new StatesButton()
            {
                Text = "Hello",
                //NormalImage = "boton",
                //DisableImage = "boton_disabled",
                //PressedImage = "boton_press",
                BackgroundColor        = Color.Red,
                DisableBackgroundColor = Color.Blue,
                PressedBackgroundColor = Color.Fuchsia,
                TextColor = Color.White
            };

            // The root page of your application
            MainPage = new ContentPage
            {
                Content = new StackLayout
                {
                    VerticalOptions = LayoutOptions.Center,
                    Padding         = new Thickness(20, 0),
                    Children        =
                    {
                        EmailEntry,
                        //PassEntry,
                        //Button
                    }
                }
            };
        }