Ejemplo n.º 1
0
    private GameStartInfo SelectGame(GameStartInfo[] startInfos)
    {
        var items = new List <string>();

        foreach (var startInfo in startInfos)
        {
            items.Add(string.Format(CultureInfo.CurrentCulture, "{0} {1}", startInfo.Name, startInfo.Version));
        }

        var listBox = new ListBoxControl(this.Interpreter)
        {
            Title  = UserInterface.GameSelectionHeader,
            Width  = GameSelectionListBoxWidth,
            Height = GameSelectionListBoxHeight,
        };

        listBox.SetItems(items.ToArray());

        if (listBox.DoModal())
        {
            return(startInfos[listBox.SelectedItemIndex]);
        }

        return(null);
    }
Ejemplo n.º 2
0
    private void InputTypelessPoll(int key)
    {
        this.State.Variables[Variables.KeyPressed] = (byte)key;
        if (this.State.InputEnabled)
        {
            string[] words = this.ResourceManager.VocabularyResource.GetAllWords();

            var listBox = new ListBoxControl(this.Interpreter)
            {
                Title  = UserInterface.TypelessBox,
                Width  = WordSelectionListBoxWidth,
                Height = WordSelectionListBoxHeight,
            };

            listBox.SetItems(words);

            if (listBox.DoModal())
            {
                string word = words[listBox.SelectedItemIndex];

                foreach (char c in word)
                {
                    this.AddInputCharacter(c);
                }

                this.AddInputCharacter(' ');
            }
        }
    }