public MatchRecordSelectScreen(Vector2f WindowSize, string Path) : base(WindowSize) { if (Directory.Exists(Path)) { foreach (FileInfo file in Directory.EnumerateFiles(Path).Select(i => new FileInfo(i))) { var option = new SelectionOption <FileInfo>("match-record-selection-option") { DisplayedString = file.Name, Value = file }; _MatchRecordSelect.Add(option); } } _MatchRecordSelect.OnChange += HandleSelect; _ScenarioView.Position = new Vector2f(_MatchRecordSelect.Size.X + 16, 0); _StartButton.OnClick += HandleStart; _StartButton.Position = new Vector2f(0, _Display.Size.Y - _StartButton.Size.Y - 32); _Display.Position = .5f * (WindowSize - _Display.Size); _Display.Add(_MatchRecordSelect); _Display.Add(_ScenarioView); _Display.Add(_StartButton); _Items.Add(_Display); }
public EditScreen(Vector2f WindowSize, Map Map, TileRenderer TileRenderer) : base(WindowSize, Map, TileRenderer) { _FileDropDown.Add(new SelectionOption <object>("select-option") { DisplayedString = "File" }); var newOption = new SelectionOption <object>("select-option") { DisplayedString = "New " }; newOption.OnClick += HandleNewClicked; _FileDropDown.Add(newOption); var openOption = new SelectionOption <object>("select-option") { DisplayedString = "Open" }; openOption.OnClick += HandleOpenClicked; _FileDropDown.Add(openOption); var saveOption = new SelectionOption <object>("select-option") { DisplayedString = "Save" }; saveOption.OnClick += HandleSaveClicked; _FileDropDown.Add(saveOption); _Items.Add(_FileDropDown); }
public void AddPage(DeploymentPage Page) { Page.Visible = false; _Pages.Add(Page); Insert(0, Page); var option = new SelectionOption <DeploymentPage>("select-option") { Value = Page, DisplayedString = Page.Deployment.Configuration.UnitGroup.Name }; _DeploymentPageSelect.Add(option); }
/// <summary> /// Plays the sequence of images followed by the answer board /// </summary> /// <returns></returns> IEnumerator RunSequence() { Debug.Log("Client run sequence"); //Remove old quesiton cards List <Transform> childs = new List <Transform>(); childs.AddRange(AnswerBoard.GetComponentsInChildren <Transform>()); childs.Remove(AnswerBoard); while (childs.Count > 0) { Destroy(childs[0].gameObject); childs.RemoveAt(0); } AnswerText.enabled = false; //Help with reading the question before the sequence yield return(new WaitForSeconds(1.5f)); AnswerBoard.gameObject.SetActive(false); ImageBoard.enabled = true; //Play sequence float TimeBetweenImages = 1f; WaitForSeconds WSF = new WaitForSeconds(TimeBetweenImages); foreach (Sprite s in SelectedVariant.Images) { ImageBoard.sprite = s; MemorySequence.Play(); yield return(WSF); } ImageBoard.enabled = false; //Display answer board AnswerBoard.gameObject.SetActive(true); foreach (string s in MySelectedQuestion.AnswerOptions) { SelectionOption newButton = Instantiate(AnswerButtonPrefab, AnswerBoard); newButton.Answertext.text = s; newButton.MyPuzzle = this; } }
public void SetDirectory(string Path) { _Directory = Path; _FileSelect.Clear(); if (!Directory.Exists(Path)) { Directory.CreateDirectory(Path); } foreach (FileInfo f in Directory.EnumerateFiles(Path).Select(i => new FileInfo(i))) { var option = new SelectionOption <FileInfo>("io-select-option") { DisplayedString = f.Name, Value = f }; option.OnClick += (sender, e) => _FileNameInput.Value = ((SelectionOption <FileInfo>)sender).Value.Name; _FileSelect.Add(option); } }
public ScenarioSelectScreen(Vector2f WindowSize, IEnumerable <Scenario> Scenarios) : base(WindowSize) { _Renderer = new UnitConfigurationRenderer( Scenarios.SelectMany(i => i.UnitConfigurations).Distinct(), GameData.UnitRenderDetails, 128, 1024, ClassLibrary.Instance.GetFont("compacta")); _FactionRenderer = new FactionRenderer( Scenarios.SelectMany(i => i.ArmyConfigurations.Select(j => j.Faction)).Distinct(), GameData.FactionRenderDetails, 512, 1024); foreach (Scenario s in Scenarios) { var option = new SelectionOption <Scenario>("scenario-selection-option") { DisplayedString = s.Name, Value = s }; _ScenarioSelect.Add(option); } _ScenarioSelect.OnChange += HandleSelect; _ScenarioView.Position = new Vector2f(_ScenarioSelect.Size.X + 16, 0); _StartButton.OnClick += HandleStart; _StartButton.Position = new Vector2f(0, _Display.Size.Y - _StartButton.Size.Y - 32); _Display.Position = .5f * (WindowSize - _Display.Size); _Display.Add(_ScenarioSelect); _Display.Add(_ScenarioView); _Display.Add(_StartButton); _Items.Add(_Display); }
public SelectPane(string Title, IEnumerable <T> Items) : base("select-pane") { var header = new Button("select-pane-header") { DisplayedString = Title }; Add(header); _UnitSelect.Position = new Vector2f(0, header.Size.Y + 6); foreach (T item in Items) { var option = new SelectionOption <T>("select-option") { Value = item, DisplayedString = ObjectDescriber.Describe(item) }; _UnitSelect.Add(option); } _UnitSelect.OnChange += HandleChange; Add(_UnitSelect); }
internal SelectSyntaxProvider(ActionSyntaxProvider syntaxProvider, dynamic value, SelectionOption mode) { this.syntaxProvider = syntaxProvider; this.value = value; this.mode = mode; }
/// <summary> Creates a new command that moves out from a box into its parent box. </summary> /// <param name="command"> The command enum to be passed to the command to create. </param> /// <param name="requirements"> The requirements determining whether the command can execute. </param> /// <param name="traversalDirection"> The direction in which the caret moves out of the box (true for right, false for left). </param> public static KeyboardCommand CreateOut(SelectionOption command, CanExecuteRequirement requirements, bool traversalDirection) { Func<InputCommandParameter, bool> canExecute = null; if (requirements.HasFlag(CanExecuteRequirement.RequireSingleStep)) canExecute = glyphRun => getAdjacentBox(glyphRun, traversalDirection) == null; return new KeyboardCommand(command, requirements | CanExecuteRequirement.NoRoot, canExecute, caretState => boxOut(caretState, traversalDirection)); }
/// <summary> Creates a new command representing moving from a box to an adjacent box in the same box composition. </summary> /// <param name="command"> The parameters to create the command with. </param> /// <param name="requirements"> The requirements determining whether the command can execute. </param> /// <param name="boxesTraversalDirection"> Indicates whether the traversal from box to adjacent box is from left to right. </param> public static KeyboardCommand CreateAdjacent(SelectionOption command, CanExecuteRequirement requirements, bool boxesTraversalDirection) { return new KeyboardCommand(command, requirements | CanExecuteRequirement.NoRoot, glyphRun => getAdjacentBox(glyphRun, boxesTraversalDirection) != null, glyphRun => Focus(getAdjacentBox(glyphRun, boxesTraversalDirection), boxesTraversalDirection)); }