/// <summary> /// Allows you to populate the current product property object using a ProductPropertyDTO instance /// </summary> /// <param name="dto">An instance of the ProductProperty from the REST API</param> public void FromDto(ProductPropertyDTO dto) { if (dto == null) { return; } Choices.Clear(); if (dto.Choices != null) { foreach (var c in dto.Choices) { var pc = new ProductPropertyChoice(); pc.FromDto(c); Choices.Add(pc); } } CultureCode = dto.CultureCode; DefaultValue = dto.DefaultValue; DisplayName = dto.DisplayName; DisplayOnSite = dto.DisplayOnSite; DisplayToDropShipper = dto.DisplayToDropShipper; Id = dto.Id; PropertyName = dto.PropertyName; StoreId = dto.StoreId; TypeCode = (ProductPropertyType)(int)dto.TypeCode; LastUpdatedUtc = dto.LastUpdatedUtc; }
public void RecalculateChoices() { Choices.Clear(); CurrentNode.Neighbours.ToList().ForEach(z => { var P = CalculateChoice(z.Value); Choices.Add(new Tuple <double, Node>(P, z.Key)); }); }
protected void SetChoices(IChoosable[] choices) { Choices.Clear(); for (int ii = 0; ii < choices.Length; ii++) { Choices.Add(choices[ii]); choices[ii].Bounds = Rect.FromPoints(Bounds.Start + new Loc(GraphicsManager.MenuBG.TileWidth + 16 - 5, GraphicsManager.MenuBG.TileHeight + ContentOffset + VERT_SPACE * ii - 1), new Loc(Bounds.End.X - GraphicsManager.MenuBG.TileWidth - 4, Bounds.Y + GraphicsManager.MenuBG.TileHeight + ContentOffset + VERT_SPACE * (ii + 1) - 3)); } }
/// <summary> /// Clears the choices. /// </summary> public void ClearChoices() { Choices.Clear(); Consequences.Clear(); if (OnClear != null) { OnClear(ClearType.CHOICES); } }
/// <summary> /// Clears the state. /// </summary> public void Clear() { Dialog.Clear(); Choices.Clear(); Consequences.Clear(); if (OnClear != null) { OnClear(ClearType.ALL); } }
public override void SetState(VoteState state) { base.SetState(state); _currentBallot = state.Ballot; RaisePropertyChanged(() => Title); RaisePropertyChanged(() => Description); SelectedChoice = null; Choices.Clear(); _currentBallot.Choices.ForEach(c => Choices.Add(c)); }
public override bool Check() { Choices = Reason.Controller.Field.Filter(card => card.CheckDestroyByCost(Reason) && Condition(card)); if (Choices.Count >= Number) { return(true); } else { Choices.Clear(); return(false); } }
public override bool Check() { Choices = Reason.Controller.Hand.Filter(card => Condition(card)); if (Choices.Count >= Number) { return(true); } else { Choices.Clear(); return(false); } }
public override bool Check() { Choices = Reason.Controller.Field.Filter(card => !card.IsHorizontal && Condition(card) && card != Owner); if (Choices.Count >= Number) { return(true); } else { Choices.Clear(); return(false); } }
public override bool Check() { Choices = Reason.Controller.GetReversableBonds(Reason).FindAll(card => Condition(card)); if (Choices.Count >= Number) { return(true); } else { Choices.Clear(); return(false); } }
/// <summary> /// Show choices available and wait for selection /// </summary> /// <param name="suppressHUD"></param> public static void DisplayChoices(bool suppressHUD = false) { LinkedListNode <Choice> SelectedChoice = Choices.First; ConsoleKey pressedKey; DisplayParagraph(false); foreach (var choice in Choices) { choice.Row = Console.CursorTop; Console.WriteLine(choice.DisplayText); } Console.CursorTop = SelectedChoice.Value.Row; Console.WriteLine("> " + SelectedChoice.Value.DisplayText); do { pressedKey = Console.ReadKey(true).Key; if (pressedKey == ConsoleKey.UpArrow && SelectedChoice != Choices.First) { Console.CursorTop = SelectedChoice.Value.Row; Console.WriteLine($"{SelectedChoice.Value.DisplayText} "); SelectedChoice = SelectedChoice.Previous; } else if (pressedKey == ConsoleKey.DownArrow && SelectedChoice != Choices.Last) { Console.CursorTop = SelectedChoice.Value.Row; Console.WriteLine($"{SelectedChoice.Value.DisplayText} "); SelectedChoice = SelectedChoice.Next; } Console.CursorTop = SelectedChoice.Value.Row; Console.WriteLine("> " + SelectedChoice.Value.DisplayText); } while (pressedKey != ConsoleKey.Enter); Paragraph.Clear(); Choices.Clear(); Console.Clear(); if (!suppressHUD) { RefreshHUD(); } SelectedChoice.Value.Method.Invoke(); }
protected override void ViewIsDisappearing(object sender, EventArgs e) { base.ViewIsDisappearing(sender, e); Choices.Clear(); }
public override void DrawWindow() { base.DrawWindow(); Event e = Event.current; EditorGUILayout.LabelField("Prompt:"); Prompt = EditorGUILayout.TextArea(Prompt); NumChoices = EditorGUILayout.IntField("Number of Choices", NumChoices); if (NumChoices < 0) { NumChoices = 0; } EditorGUILayout.LabelField("Choices:"); EditorGUILayout.Space(); int difference = Mathf.Abs(NumChoices - Choices.Count); if (Choices.Count < NumChoices) { for (int i = 0; i < difference; i++) { Choices.Add(""); ChoiceRects.Add(new Rect()); } } else if (Choices.Count > NumChoices) { if (NumChoices != 0) { Choices.RemoveRange(NumChoices - 1, difference); ChoiceRects.RemoveRange(NumChoices - 1, difference); for (int i = NumChoices; i < difference; i++) { if (ChoiceNodePair.ContainsKey(i)) { ChoiceNodePair.Remove(i); dialogueType.choiceDialogueKeys.Remove(i); dialogueType.choiceDialogueValues.RemoveAt(i); } } } else { Choices.Clear(); ChoiceRects.Clear(); ChoiceNodePair.Clear(); dialogueType.choiceDialogueKeys.Clear(); dialogueType.choiceDialogueValues.Clear(); } } for (int i = 0; i < inputRects.Count; i++) { if (e.type == EventType.Repaint) { inputRects[i] = GUILayoutUtility.GetLastRect(); } } for (int i = 0; i < outputRects.Count; i++) { if (e.type == EventType.Repaint) { outputRects[i] = GUILayoutUtility.GetLastRect(); } } scrollPos = EditorGUILayout.BeginScrollView(scrollPos, false, false); for (int i = 0; i < Choices.Count; i++) { EditorGUILayout.LabelField("Option " + (i + 1)); Choices[i] = EditorGUILayout.TextArea(Choices[i], GUILayout.Height(30)); } EditorGUILayout.EndScrollView(); // Location of TextAreas AddChoiceRects(); dialogueType.windowRect = windowRect; dialogueType.index = index; dialogueType.question = Prompt; dialogueType.choices = Choices; dialogueType.choiceNum = NumChoices; dialogueType.inputCount = inputs.Count; dialogueType.inputRects = inputRects; dialogueType.outputCount = outputs.Count; dialogueType.outputRects = outputRects; dialogueType.choiceRects = ChoiceRects; if (GUILayout.Button("Clear All", GUILayout.Height(20))) { NumChoices = 0; inputRects.Clear(); inputs.Clear(); outputs.Clear(); outputRects.Clear(); ChoiceNodePair.Clear(); } }