Exemplo n.º 1
0
 /// <summary>
 /// Manages option selection and invocation when specific keys are pressed.
 /// </summary>
 /// <param name="inputManager">The input manager to use when retrieving the key states.</param>
 public virtual void Update(InputManager inputManager)
 {
     if (inputManager.IsNewKeyDown(Keys.A) || inputManager.IsNewKeyDown(Keys.Left))
     {
         if (--_selectedOptionIndex < 0)
         {
             if (Options.Count > 0)
             {
                 _selectedOptionIndex = Options.Count - 1;
             }
             else
             {
                 _selectedOptionIndex = 0;
             }
         }
     }
     else if (inputManager.IsNewKeyDown(Keys.D) || inputManager.IsNewKeyDown(Keys.Right))
     {
         if (++_selectedOptionIndex >= Options.Count)
         {
             _selectedOptionIndex = 0;
         }
     }
     else if (inputManager.IsNewKeyDown(Keys.Enter))
     {
         MenuItemOption selectedOption = SelectedOption;
         if (selectedOption != null)
         {
             SelectedOption.InvokeAction();
         }
     }
 }
Exemplo n.º 2
0
 public async Task ShowSettingsMenu(string chatId, SettingsKeyboardState state,
                                    SelectedOption option = default(SelectedOption), UserSettingsModel model = null, IEnumerable <LabelInfo> labels = null)
 {
     var keyboard = _settingsKeyboardFactory.CreateKeyboard(state, model, labels);
     var message  = SettingsMenuMessageBuilder(state, option, model);
     await _telegramMethods.SendMessage(chatId, message, ParseMode.Html, false, false, null, keyboard);
 }
 private void OptionSelected()
 {
     Options.FirstOrDefault(option => option.IsSelected)?.UnSelect();
     SelectedOption?.Select();
     _storage.Set(Constants.SelectedThemeKey, (int)SelectedOption.Name);
     _theme.Change(SelectedOption.Name);
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initializes a new instance of the OrderDetailAdOns class.
 /// </summary>
 public OrderDetailAdOns(Int64 OrderDetailId, Int16 AdOnId, String AdonName, SelectedOption SelectedAdonOption, Boolean IsDoubleSelected)
 {
     this.OrderDetailId      = OrderDetailId;
     this.AdOnId             = AdOnId;
     this.AdonName           = AdonName;
     this.SelectedAdonOption = SelectedAdonOption;
     this.IsDoubleSelected   = IsDoubleSelected;
 }
Exemplo n.º 5
0
        private void handleInput()
        {
            // Submit.
            if (CheckSubmit)
            {
                SelectedOption.OnSubmit();
                // this.OnSubmit()? Maybe containers shouldn't have submit.
            }

            // Move Down.
            else if (OdgeUIInput.DOWN)
            {
                if (SelectedIndex + 1 >= Options.Count)
                {
                    SelectedIndex = 0;
                }
                else
                {
                    SelectedIndex++;
                }
            }

            // Move Up!
            else if (OdgeUIInput.UP)
            {
                if (SelectedIndex - 1 < 0)
                {
                    SelectedIndex = Options.Count - 1;
                }
                else
                {
                    SelectedIndex--;
                }
            }

            // Jump Down.
            else if (OdgeUIInput.RIGHT)
            {
                SelectedIndex += 8;
            }

            // Jump Up!
            else if (OdgeUIInput.LEFT)
            {
                SelectedIndex -= 8;
            }

            // Cancel.
            else if (CheckCancel)
            {
                OnCancel();
            }
        }
Exemplo n.º 6
0
        private async Task AnimateSelectedIndexChanged()
        {
            if (ItemsSource == null)
            {
                return;
            }

            var options = ItemsSource.ToList();
            var option  = options[SelectedIndex];

            var width = SelectedOption.Width;

            SelectedOption.TranslateTo(SelectedIndex * width, 0, 250, Easing.CubicInOut);

            await SelectedOptionLabel.FadeTo(0, 125);

            SelectedOptionLabel.Text = option.Label;
            await SelectedOptionLabel.FadeTo(1, 125);
        }
Exemplo n.º 7
0
 public void RemoveOption(OptionViewer viewer, int index = 0)
 {
     if (optionsPane.Children.Contains(viewer as UIElement))
     {
         optionsPane.Children.Remove(viewer);
     }
     if (selectedOptions.Contains(viewer))
     {
         selectedOptions.Remove(viewer);
     }
     if (SelectedOption != null && SelectedOption.Equals(viewer))
     {
         SelectedOption = null;
     }
     if (this.OptionRemoved != null)
     {
         this.OptionRemoved(index, new RoutedEventArgs());
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Handles when the selected radio button changes.
        /// </summary>
        /// <param name="sender">The invoker of the event.</param>
        /// <param name="e">The event arguments.</param>
        private void radioGroup_CheckedChanged(object sender, EventArgs e)
        {
            string result = null;

            foreach (Control control in this.selectionBox.Controls)
            {
                if (control is RadioButton)
                {
                    RadioButton radio = control as RadioButton;
                    if (radio.Checked)
                    {
                        result = radio.Text;
                    }
                }
            }

            switch (result)
            {
            case "Delete All Before":
                allAfterTextBox.Visible  = false;
                allBeforeTextBox.Visible = true;
                selectedOption           = SelectedOption.Before;
                break;

            case "Delete All After":
                allBeforeTextBox.Visible = false;
                allAfterTextBox.Visible  = true;
                selectedOption           = SelectedOption.After;
                break;

            case "Delete All Between":
                allBeforeTextBox.Visible = true;
                allAfterTextBox.Visible  = true;
                selectedOption           = SelectedOption.Between;
                break;
            }
        }
Exemplo n.º 9
0
        private string SettingsMenuMessageBuilder(SettingsKeyboardState state, SelectedOption option = default(SelectedOption),
                                                  UserSettingsModel userSettings = null, string editableLableId = null)
        {
            if (userSettings == null && state.EqualsAny(
                    SettingsKeyboardState.LabelsMenu,
                    SettingsKeyboardState.IgnoreMenu,
                    SettingsKeyboardState.WhiteListMenu,
                    SettingsKeyboardState.BlackListMenu))
            {
                throw new InvalidOperationException($"{nameof(userSettings)} must be not null if {nameof(state)} equals {state}.");
            }

            StringBuilder message = new StringBuilder();

            switch (state)
            {
            case SettingsKeyboardState.MainMenu:
                switch (option)
                {
                case SelectedOption.Option9:         //about button
                    message.AppendLine($"<b>{_settings.BotName}</b>");
                    message.AppendLine();
                    message.AppendLine();
                    message.AppendLine($"Bot version: {_settings.BotVersion}");
                    message.AppendLine("Developed by Igor 'CoffeeJelly' Salzhenitsin");
                    message.AppendLine("Contact emails:");
                    message.AppendLine("<code>[email protected]</code>");
                    message.AppendLine("<code>[email protected]</code>");
                    message.AppendLine();
                    message.AppendLine();
                    message.AppendLine("2017");
                    break;

                default:
                    message.Append("<b>Main Settings Menu</b>");
                    break;
                }
                break;

            case SettingsKeyboardState.LabelsMenu:
                switch (option)
                {
                default:
                    message.AppendLine("<b>Labels Menu</b>");
                    message.AppendLine();
                    message.Append(!userSettings.UseWhitelist
                                ? "Choose <b>Whitelist</b> to specify the email labels that will be allowed. "
                                   + "Incoming email without at least one of the selected labels will not be displayed in the Telegram chat."
                                : "Choose <b>Blacklist</b> to specify the email labels that will be blocked."
                                   + "Incoming email with at least one of the selected labels will not be displayed in the Telegram chat.");
                    break;
                }
                break;

            case SettingsKeyboardState.EditLabelsMenu:
                message.AppendLine("<b>User Defined Editable Labels:</b>");
                message.AppendLine();
                break;

            case SettingsKeyboardState.WhiteListMenu:
                message.AppendLine("<b>Whitelist</b>");
                message.AppendLine();
                message.AppendLine(!userSettings.UseWhitelist
                        ? "If you want to use whitelist click \"Use whitelist mode\" button."
                        : "Click the button to add it to (or remove from) the whitelist.");
                break;

            case SettingsKeyboardState.BlackListMenu:
                message.AppendLine("<b>Blacklist</b>");
                message.AppendLine();
                message.AppendLine(userSettings.UseWhitelist
                        ? "If you want to use blacklist click \"Use blacklist mode\" button."
                        : "Click the button to add it to (or remove from) the blacklist.");
                break;

            case SettingsKeyboardState.IgnoreMenu:
                switch (option)
                {
                case SelectedOption.Option1:
                    message.AppendLine(userSettings.IgnoreList?.Count == 0
                                ? "Your ignore list is empty."
                                : $"You have {userSettings.IgnoreList?.Count} email(s) ignored:");
                    userSettings.IgnoreList?.IndexEach((email, i) =>
                    {
                        message.AppendLine($"{i + 1}. {email.Address}");
                    });
                    break;

                default:
                    message.AppendLine("<b>Ignore Control Menu</b>");
                    message.AppendLine();
                    message.AppendLine(
                        "To stop receiving notifications about new emails from a specific email address, " +
                        "add it to the ignore list.");
                    message.AppendLine("To add or remove an email from the ignore list, click the button and type the email address.");
                    message.AppendLine();
                    message.AppendLine($"{Emoji.INFO_SIGN} You can type the displayed sequence number to remove the email from the ignore list.");
                    break;
                }
                break;

            case SettingsKeyboardState.AdditionalMenu:
                message.Append("<b>Main Settings Menu</b>");
                break;

            case SettingsKeyboardState.PermissionsMenu:
                message.AppendLine("<b>Permissions Menu</b>");
                message.AppendLine();
                message.AppendLine("You can change or revoke the bot permissions to your Gmail account here.");
                break;

            case SettingsKeyboardState.LabelActionsMenu:
                message.AppendLine($"<b>Edit label with id {editableLableId}:</b>");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(state), state, null);
            }

            return(message.ToString());
        }
Exemplo n.º 10
0
 public async Task UpdateSettingsMenu(string chatId, int messageId, SettingsKeyboardState state, SelectedOption option = default(SelectedOption),
                                      UserSettingsModel model = null, TempDataModel tempData = null, IEnumerable <LabelInfo> labels = null)
 {
     var keyboard = _settingsKeyboardFactory.CreateKeyboard(state, model, labels);
     var message  = SettingsMenuMessageBuilder(state, option, model, tempData?.LabelId);
     await
     _telegramMethods.EditMessageText(message, chatId, messageId.ToString(), null, ParseMode.Html, null, keyboard);
 }
Exemplo n.º 11
0
 /// <summary>
 /// Returns the currently selected item.
 /// </summary>
 /// <returns></returns>
 public virtual string GetSelectedItem()
 {
     return(SelectedOption.TextHelper().InnerText);
 }
Exemplo n.º 12
0
        private async Task <ObservableCollection <Content> > GetMoreArticleData()
        {
            try
            {
                Views.Busy.SetBusy(true, "Loading...");

                //filter
                var contentFilter = new ContentFilter();
                var query         = contentFilter.GetFilter(SelectedOption);

#if DEBUG
                System.Diagnostics.Debug.WriteLine(string.Format("SELECTED-OPTION-->{0}", SelectedOption.ToString()));
                System.Diagnostics.Debug.WriteLine("~~~~~~~~~~~~~~~~~~~~~~~GETTING DATA~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
#endif
                var s = await _dataService.GetData(query, _isResetRequired);

                Views.Busy.SetBusy(false);

                return(new ObservableCollection <Content>(s.Content));
            }
            catch (Exception)
            {
                //log exception
            }
            finally
            {
                _isResetRequired = false;
            }
            //TODO:test-code,to be commented.
            return(new ObservableCollection <Content>());//test
        }
Exemplo n.º 13
0
        //(float amountOfTime)
        private void ProcessInput()
        {
            float leftRightRot = 0;
            float upDownRot = 0;

            lastKeyboardState = currentKeyboardState;
            currentKeyboardState = Keyboard.GetState();
            MouseState mouseState = Mouse.GetState();

            // OPTIONS MENU ==============================================================================
            switch (currentState)
            {
                case GameState.Options:

                    if (currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))
                    {
                        select.Play();
                        currentState = GameState.Menu;
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Down) && lastKeyboardState.IsKeyUp(Keys.Down))
                    {
                        select.Play();
                        if (currentOption.Equals(null) )
                        {
                            currentOption = SelectedOption.Controller;
                        }
                        else
                        {
                            currentOption++;
                            if (currentOption > SelectedOption.BMx)
                            {
                                currentOption = SelectedOption.Controller;
                            }
                        }
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Up) && lastKeyboardState.IsKeyUp(Keys.Up))
                    {
                        select.Play();
                        if (currentOption.Equals(null))
                        {
                            currentOption = SelectedOption.BMx;
                        }
                        else
                        {
                            currentOption--;
                            if (currentOption < SelectedOption.Controller)
                            {
                                currentOption = SelectedOption.BMx;
                            }
                        }
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Right) && lastKeyboardState.IsKeyUp(Keys.Right))
                    {
                        select.Play();
                        switch (currentOption)
                        {
                            case SelectedOption.Controller:
                            if (currentInput > InputDevice.Keyboard)
                                currentInput = 0;
                            else
                                currentInput++;
                                    break;
                            case SelectedOption.Camera:
                                if (camAvailable)
                                {
                                    currentCameraName = motionDetector.ConnectToFeed();
                                }
                                break;
                            case SelectedOption.RMx:
                                if (motionDetector.getRMax()<255) motionDetector.setRMax(motionDetector.getRMax() + 5);
                                break;
                            case SelectedOption.GMx:
                                if (motionDetector.getGMax() < 255) motionDetector.setGMax(motionDetector.getGMax() + 5);
                                break;
                            case SelectedOption.BMx:
                                if (motionDetector.getBMax() < 255) motionDetector.setBMax(motionDetector.getBMax() + 5);
                                break;
                            case SelectedOption.RMn:
                                if (motionDetector.getRMin() < 255) motionDetector.setRMin(motionDetector.getRMin() + 5);
                                break;
                            case SelectedOption.GMn:
                                if (motionDetector.getGMin() < 255) motionDetector.setGMin(motionDetector.getGMin() + 5);
                                break;
                            case SelectedOption.BMn:
                                if (motionDetector.getBMin() < 255) motionDetector.setBMin(motionDetector.getBMin() + 5);
                                break;
                        }
                        //maxCol = new Color(new Vector3((int)motionDetector.getRMax(), (int)motionDetector.getGMax(), (int)motionDetector.getBMax()));
                        //minCol = new Color(new Vector3(motionDetector.getRMin() * 1f, motionDetector.getGMin() * 1f, motionDetector.getBMin() * 1f));
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Left) && lastKeyboardState.IsKeyUp(Keys.Left))
                    {
                        select.Play();
                        switch (currentOption)
                        {
                            case SelectedOption.Controller:
                                if (currentInput < InputDevice.Keyboard)
                                    currentInput = InputDevice.Motion;
                                else
                                    currentInput--;
                                break;
                            case SelectedOption.Camera:
                                if (camAvailable)
                                {
                                    currentCameraName = motionDetector.ConnectToFeed();
                                }
                                break;
                            case SelectedOption.RMx:
                                if (motionDetector.getRMax() > 0) motionDetector.setRMax(motionDetector.getRMax() - 5);
                                break;
                            case SelectedOption.GMx:
                                if (motionDetector.getGMax() > 0) motionDetector.setGMax(motionDetector.getGMax() - 5);
                                break;
                            case SelectedOption.BMx:
                                if (motionDetector.getBMax() > 0) motionDetector.setBMax(motionDetector.getBMax() - 5);
                                break;
                            case SelectedOption.RMn:
                                if (motionDetector.getRMin() > 0) motionDetector.setRMin(motionDetector.getRMin() - 5);
                                break;
                            case SelectedOption.GMn:
                                if (motionDetector.getGMin() > 0) motionDetector.setGMin(motionDetector.getGMin() - 5);
                                break;
                            case SelectedOption.BMn:
                                if (motionDetector.getBMin() > 0) motionDetector.setBMin(motionDetector.getBMin() - 5);
                                break;
                        }
                        //maxCol = new Color(new Vector3(motionDetector.getRMax(), motionDetector.getGMax(), motionDetector.getBMax()));
                        //minCol= new Color(new Vector3(motionDetector.getRMin(), motionDetector.getGMin(), motionDetector.getBMin()));
                    }

                    break;

                // MAIN MENU ==============================================================================
                case GameState.Menu:

                    if (currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))
                    {
                        //currentState = GameState.Loading;
                        select.Play();
                        NewGame();
                    }
                    if (currentKeyboardState.IsKeyDown(Keys.F1) && lastKeyboardState.IsKeyUp(Keys.F1))
                    {
                        select.Play();
                        currentState = GameState.Help;
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space))
                    {
                        select.Play();
                        currentState = GameState.About;
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.LeftControl) && lastKeyboardState.IsKeyUp(Keys.LeftControl))
                    {
                        select.Play();
                        currentState = GameState.Options;
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Q) && lastKeyboardState.IsKeyUp(Keys.Q))
                    {
                        MediaPlayer.Stop();
                        select.Play();
                        motionDetector.Disconnect();
                        Exit();
                    }
                    break;

                // ABOUT MENU ==============================================================================
                case GameState.About:

                    if (currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))
                    {
                        select.Play();
                        currentState = GameState.Menu;
                    }
                    if (currentKeyboardState.IsKeyDown(Keys.Tab) && lastKeyboardState.IsKeyUp(Keys.Tab))
                    {
                        select.Play();
                        System.Diagnostics.Process.Start("http://www.facebook.com/ProjectITS");
                    }
                    break;

                // HELP MENU ==============================================================================
                case GameState.Help:

                    if (currentKeyboardState.IsKeyDown(Keys.Enter) && lastKeyboardState.IsKeyUp(Keys.Enter))
                    {
                        select.Play();
                        currentState = GameState.Menu;
                    }

                    break;

                // IN GAME ==============================================================================
                case GameState.InGame:

                    if (currentKeyboardState.IsKeyDown(Keys.Tab) && lastKeyboardState.IsKeyUp(Keys.Tab))
                    {
                        select.Play();
                        if (currentInput > InputDevice.Keyboard)
                            currentInput = 0;
                        else
                            currentInput++;
                        if (currentInput == InputDevice.Motion)
                        {
                            drawCamFeed = true;
                            camFeedTimer = new Timer(camTcb, null, 5000, 100);
                        }
                        else
                        {
                            drawCamFeed = false;
                        }

                    }
                    if (currentKeyboardState.IsKeyDown(Keys.Back) && lastKeyboardState.IsKeyUp(Keys.Back))
                    {
                        if (camAvailable)
                        {
                            select.Play();
                            currentCameraName = motionDetector.ConnectToFeed();
                            drawCamFeed = true;
                            //camFeedTimer.Dispose();
                            camFeedTimer = new Timer(camTcb, null, 5000, 100);
                        }
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.OemTilde) && lastKeyboardState.IsKeyUp(Keys.OemTilde))
                    {
                        select.Play();
                        consoleData = !consoleData;
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.PageUp) && lastKeyboardState.IsKeyUp(Keys.PageUp))
                    {
                        if (camAvailable)
                        {
                            select.Play();
                            drawCamFeed = true;
                            camFeedTimer.Dispose();
                            camFeedTimer = new Timer(camTcb, null, 5000, 100);
                        }
                    }

                    if (currentKeyboardState.IsKeyDown(Keys.Q) && lastKeyboardState.IsKeyUp(Keys.Q))
                    {
                        setupMenu();
                    }
                    if (started)
                    {
                        switch (currentInput)
                        {
                            case InputDevice.Mouse:
                                rotateSpd = (screenWidth / 2 - mouseState.X) * 0.00005f;
                                leftRightRot = -rotateSpd * gameSpeed;
                                upDownSpd = (screenHeight / 2 - mouseState.Y) * 0.00005f;
                                upDownRot = upDownSpd * gameSpeed;
                                break;
                            case InputDevice.Keyboard:
                                float turningSpeed = 0.02f;
                                if (currentKeyboardState.IsKeyDown(Keys.Right))
                                    leftRightRot += turningSpeed * gameSpeed;
                                if (currentKeyboardState.IsKeyDown(Keys.Left))
                                    leftRightRot -= turningSpeed * gameSpeed;
                                if (currentKeyboardState.IsKeyDown(Keys.Down))
                                    upDownRot += turningSpeed * gameSpeed;
                                if (currentKeyboardState.IsKeyDown(Keys.Up))
                                    upDownRot -= turningSpeed * gameSpeed;
                                break;
                            case InputDevice.Motion:
                                rotateSpd = (screenWidth / 2 - motionDetector.getX()) * 0.00005f;
                                leftRightRot = -rotateSpd * gameSpeed;
                                upDownSpd = (screenHeight / 2 - motionDetector.getY()) * 0.00005f;
                                upDownRot = upDownSpd * gameSpeed;
                                break;
                        }
                        if (currentKeyboardState.IsKeyDown(Keys.Space) && lastKeyboardState.IsKeyUp(Keys.Space))
                        {
                            gameSpeed = 0.1f;
                            timeSInstance.Play();
                            MediaPlayer.Pause();

                        }
                        if (currentKeyboardState.IsKeyUp(Keys.Space) && lastKeyboardState.IsKeyDown(Keys.Space))
                        {
                            gameSpeed = 1f;
                            timeSInstance.Stop();
                            timeE.Play();
                            MediaPlayer.Resume();
                        }

                        if (mouseState.LeftButton == ButtonState.Pressed)
                        {
                            shoot.Play();
                        }

                        Quaternion additionalRot = Quaternion.CreateFromAxisAngle(new Vector3(0, 0, -1), leftRightRot) * Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), upDownRot);
                        shipRotation *= additionalRot;
                    }
                    break;
            }
        }
Exemplo n.º 14
0
    // Use this for initialization
    private IEnumerator Start()
    {
        m_DialogueOptionsMenu.SetActive(false);

        var onInitialCustomer = true;

        foreach (var customerObject in m_CustomerObjects)
        {
            m_BackgroundImage.sprite = customerObject.backgroundSprite;

            if (m_CharacterAnimator != null)
            {
                Destroy(m_CharacterAnimator.gameObject);
            }

            var characterGameObject = Instantiate(customerObject.characterPrefab);
            characterGameObject.transform.SetParent(transform, false);
            characterGameObject.transform.SetSiblingIndex(m_CharacterTransformIndex);

            m_CharacterAnimator = characterGameObject.GetComponent <Animator>();

            m_DesireToBuy = 0;

            EnableTextBox();

            m_CharacterAnimator.gameObject.SetActive(false);

            if (!onInitialCustomer && m_FadeScript)
            {
                m_DoorOpenSource.Play();

                var fadeIn = m_FadeScript.FadeIn();
                while (fadeIn.MoveNext())
                {
                    yield return(null);
                }
            }

            m_CharacterNameText.text = "You";
            m_TextBox.text           = customerObject.dialogue.openingStatement;

            onInitialCustomer = false;

            yield return(WaitForUser());

            m_CharacterAnimator.gameObject.SetActive(true);

            var earlySale = false;
            foreach (var statement in customerObject.dialogue.statements)
            {
                m_CharacterNameText.text = customerObject.name;
                m_TextBox.text           = statement.text;

                m_CharacterAnimator.CrossFade("Neutral", m_CrossfadeTime);

                EnableDialogueOptions();

                m_Option1.GetComponentInChildren <Text>().text = statement.options[0].text;
                m_Option2.GetComponentInChildren <Text>().text = statement.options[1].text;
                m_Option3.GetComponentInChildren <Text>().text = statement.options[2].text;

                m_SellButton.gameObject.SetActive(!customerObject.hideSellButton);

                m_SelectedOption = SelectedOption.None;
                while (m_SelectedOption == SelectedOption.None)
                {
                    yield return(null);
                }

                yield return(null);

                EnableTextBox();

                switch (m_SelectedOption)
                {
                case SelectedOption.Option1:
                    m_TextBox.text = statement.options[0].response;
                    m_CharacterAnimator.CrossFade(statement.options[0].mood, m_CrossfadeTime);

                    m_DesireToBuy += statement.options[0].value;
                    break;

                case SelectedOption.Option2:
                    m_TextBox.text = statement.options[1].response;
                    m_CharacterAnimator.CrossFade(statement.options[1].mood, m_CrossfadeTime);

                    m_DesireToBuy += statement.options[1].value;
                    break;

                case SelectedOption.Option3:
                    m_TextBox.text = statement.options[2].response;
                    m_CharacterAnimator.CrossFade(statement.options[2].mood, m_CrossfadeTime);

                    m_DesireToBuy += statement.options[2].value;
                    break;

                case SelectedOption.Sell:
                    earlySale = true;
                    yield return(AttemptToSell(customerObject));

                    break;

                default:
                    throw new ArgumentOutOfRangeException();
                }
                if (earlySale)
                {
                    break;
                }

                yield return(WaitForUser());
            }
            if (!earlySale)
            {
                yield return(AttemptToSell(customerObject));
            }

            if (m_FadeScript)
            {
                var fadeOut = m_FadeScript.FadeOut();
                while (fadeOut.MoveNext())
                {
                    yield return(null);
                }

                m_TextBox.text           = string.Empty;
                m_CharacterNameText.text = string.Empty;
            }
        }
    }
Exemplo n.º 15
0
 private void OnClickSell()
 {
     m_SelectedOption = SelectedOption.Sell;
 }
Exemplo n.º 16
0
 private void OnClickOption3()
 {
     m_SelectedOption = SelectedOption.Option3;
 }
 //------------------------------------------------------------------------------
 // Function: QuestionBoxEventArgs
 // Author: nholmes
 // Summary: constructor
 //------------------------------------------------------------------------------
 public QuestionBoxEventArgs(SelectedOption selectedOption)
 {
     this.selectedOption = selectedOption;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Constructs a new instance of the <see cref="DataManipulationPanel"/> class.
 /// </summary>
 public DataManipulationPanel()
 {
     InitializeComponent();
     selectedOption = SelectedOption.Before;
 }
Exemplo n.º 19
0
        protected virtual InlineKeyboardButton InitButton(InlineKeyboardType type, string text, string command, SelectedOption option = default(SelectedOption),
                                                          string labelId = "", bool forceCallbackData = true)
        {
            if (!forceCallbackData)
            {
                return(base.InitButton(type, text, command));
            }
            var callbackData = new SettingsCallbackData(GeneralCallbackData)
            {
                Command = command,
                Option  = option,
                LabelId = labelId
            };

            return(base.InitButton(type, text, callbackData));
        }
Exemplo n.º 20
0
        private async Task InvokeSelectedOption(SelectedOption option)
        {
            switch (option)
            {
            case SelectedOption.Quit:
                Environment.Exit(0);
                break;

            case SelectedOption.GetAllRecords:
                var getAllRecordsQuery = new StubGetAllRecords();
                var records            = await getAllRecordsQuery.QueryAsync();

                records.ToList().ForEach((record) => Console.WriteLine($"{record.EngagementName} [{record.Id}]"));
                break;

            case SelectedOption.GetSpecificRecord:
                Console.Write("Please enter the Guid to get: ");
                Guid recordToGet            = Guid.Parse(Console.ReadLine());
                var  getSpecificRecordQuery = new StubGetSpecificRecord();
                var  specificRecord         = await getSpecificRecordQuery.QueryAsync(recordToGet);

                if (specificRecord == null)
                {
                    Console.WriteLine("NO RECORDS FOUND");
                }
                else
                {
                    Console.WriteLine($"{specificRecord.EngagementName} [{specificRecord.Id}]");
                }
                break;

            case SelectedOption.CreateRecord:
                Console.WriteLine("Please fill out the following details:");
                Console.Write("Engagement Name: ");
                string engagementName = Console.ReadLine();
                Console.Write("Firm Guid: ");
                Guid firmGuid     = Guid.Parse(Console.ReadLine());
                var  trialBalance = new TrialBalance()
                {
                    Id             = Guid.NewGuid(), // TODO: Allow CosmosDB to auto-generate the ID.
                    EngagementName = engagementName,
                    FirmGuid       = firmGuid
                };
                var createRecordCommand = new StubCreateRecord();
                await createRecordCommand.ExecuteAsync(trialBalance);

                break;

            case SelectedOption.UpdateSpecificRecord:
                Console.Write("Specify the trial balance id to modify: ");
                Guid trialBalanceId = Guid.Parse(Console.ReadLine());
                Console.Write("What is the new engagement name? : ");
                string newEngagementName   = Console.ReadLine();
                var    updateRecordCommand = new StubUpdateSpecificRecord();
                await updateRecordCommand.ExecuteAsync(new UpdateSpecificRecordArgs()
                {
                    Id = trialBalanceId, EngagementName = newEngagementName
                });

                break;
            }
        }
Exemplo n.º 21
0
 public override IFilter CreateFilter(IFilter input)
 {
     return(SelectedOption != null?SelectedOption.CreateSafeFilter(input) : input);
 }