public override void Build() { var results = BlockCounter.Refresh(); var seg1 = CreateStandardSegment(InsertPosition.ZeroCursor); seg1.AddInterpretter(Button.Quick( "Order by " + (BlockCounter.OrderByCount ? "name instead of by count" : "count instead of by name" ), new ToolTip("Change order"), () => { BlockCounter.OrderByCount = !BlockCounter.OrderByCount; Segments.Clear(); Build(); })); var seg2 = CreateTableSegment(2, results.Length); for (int i = 0; i < results.Length; i++) { var name = new StringDisplay(M.m(results[i].Key.ComponentId.Name), M.m(results[i].Key.GetToolTip())); name.Justify = TextAnchor.MiddleLeft; var count = StringDisplay.Quick(results[i].Value.ToString()); count.Justify = TextAnchor.MiddleRight; seg2.AddInterpretter(name, i, 0); seg2.AddInterpretter(count, i, 1); } }
public void GetColumnsReturn12() { var display = new StringDisplay("Hello World!"); Assert.Equal(12, display.GetColumns()); Assert.NotEqual(11, display.GetColumns()); Assert.NotEqual(13, display.GetColumns()); }
public static void Main(string[] args) { AbstractDisplay d1 = new CharDisplay('H'); AbstractDisplay d2 = new StringDisplay("Hello, world"); d1.display(); d2.display(); }
public void GetRowsTextOneReturnHelloWorld() { var display = new StringDisplay("Hello World!"); Assert.Equal("Hello World!", display.GetRowText(0)); Assert.Null(display.GetRowText(1)); Assert.Null(display.GetRowText(-1)); }
protected override void AddContentToWindow(ConsoleWindow window) { var seg0 = window.Screen.CreateTableSegment(5, changes.Length); seg0.SqueezeTable = true; seg0.SetColumnHeadings( "Version", "Date", "Type", "Component", "Description" ); seg0.BackgroundStyleWhereApplicable = _s.Segments.OptionalSegmentDarkBackground.Style; seg0.eTableOrder = ScreenSegmentTable.TableOrder.Rows; foreach (var c in changes) { var label = seg0.AddInterpretter(StringDisplay.Quick( $"<color=lime>{c.Version}</color>", "The version this change was released in")); label.WrapText = false; label.PrescribedWidth = new FractionalSizing(0.03f, Dimension.Width); label = seg0.AddInterpretter(StringDisplay.Quick( $"<color=yellow>{c.DateOfRelease.ToString("yyyy-MM-dd")}</color>", "Date of release of this version")); label.WrapText = false; label.PrescribedWidth = new FractionalSizing(0.04f, Dimension.Width); label = seg0.AddInterpretter(StringDisplay.Quick( $"<color=cyan>{c.Type}</color>", "Type of the change")); label.WrapText = false; label.PrescribedWidth = new FractionalSizing(0.04f, Dimension.Width); label = seg0.AddInterpretter(StringDisplay.Quick( $"<color=orange>{c.Tag}</color>", "The component which has been changed")); label.WrapText = false; label.PrescribedWidth = new FractionalSizing(0.1f, Dimension.Width); label = seg0.AddInterpretter(StringDisplay.Quick( c.Description.ToString(), "Description of the change")); label.WrapText = true; label.Justify = TextAnchor.MiddleLeft; //.PrescribedWidth = new FractionalSizing(0.4f, Dimension.Width); } window.Screen.CreateSpace(0); var seg1 = window.Screen.CreateStandardHorizontalSegment(); //seg1.SqueezeSides = true; seg1.AddInterpretter(Button.Quick("Continue", new ToolTip("Close this popup"), () => _focus.Do())); }
// Start is called before the first frame update void Start() { AbstractDisplay d1 = new CharDisplay('A'); AbstractDisplay d2 = new StringDisplay("Hello"); AbstractDisplay d3 = new StringDisplay("おはようございます"); d1.display(); d2.display(); d3.display(); }
static void Main(string[] args) { AbstractDisplay d1 = new CharDisplay('H'); AbstractDisplay d2 = new StringDisplay("Hello, Wirld"); AbstractDisplay d3 = new StringDisplay("こんにちは!"); d1.Display(); d2.Display(); d3.Display(); }
public static void TemplateMethodMain() { AbstractDisplay d1 = new CharDisplay('H'); AbstractDisplay d2 = new StringDisplay("Hello, world."); AbstractDisplay d3 = new StringDisplay("こんにちは。"); d1.Display(); d2.Display(); d3.Display(); }
/// <summary> /// テンプレートメソッドパターン実行 /// </summary> public static void Run() { AbstractDisplay d1 = new CharDisplay('あ'); AbstractDisplay d2 = new StringDisplay("Hello!"); AbstractDisplay d3 = new StringDisplay("ウェーイwww"); d1.Display(); d2.Display(); d3.Display(); }
public void GetColumnsReturnOne() { var display = new StringDisplay("Hello World!"); int oneLine = 1; Assert.Equal(oneLine, display.GetRows()); int twoLine = 2; Assert.NotEqual(twoLine, display.GetRows()); }
protected override bool UpdateValueCore(string name, string value, UndoRedoRecorder recorder) { if (name == "Value") { var converter = new StringDisplay(); Value = converter.ConvertBack(value, typeof(string), null, null) as string; return(true); } return(base.UpdateValueCore(name, value, recorder)); }
protected override void AddContentToWindow(ConsoleWindow window) { var seg0 = window.Screen.CreateStandardSegment(); seg0.AddInterpretter(SubjectiveDisplay <bool> .Quick(false, M.m <bool>(x => { if (mods.All(y => y.processed)) { _focus.Do(); } return ("The following mods are required by this construct but are not installed on this instance of FtD.\n" + "This popup will automatically close when all mods are either installed or discarded.\n" + "You have to restart FtD in order to apply the newly installed mods."); }), "")); foreach (var mod in mods) { window.Screen.CreateHeader(mod.name, new ToolTip("Missing mod")) .SetConditionalDisplay(() => !mod.processed); var seg1 = window.Screen.CreateStandardSegment(); seg1.SetConditionalDisplay(() => !mod.processed); seg1.AddInterpretter(StringDisplay.Quick(mod.description, "Description of missing mod")); var seg2 = window.Screen.CreateStandardHorizontalSegment(); seg2.SetConditionalDisplay(() => !mod.processed); if (!string.IsNullOrWhiteSpace(mod.manifest) && Uri.TryCreate(mod.manifest, UriKind.Absolute, out var _)) { seg2.AddInterpretter(Button.Quick("Install mod with FtdModManager", new ToolTip(mod.manifest), () => { mod.processed = true; ModManagerPlugin.Instance.manager.Install(mod.manifest); })); } if (!string.IsNullOrWhiteSpace(mod.manifest) && Uri.TryCreate(mod.link, UriKind.Absolute, out var _)) { seg2.AddInterpretter(Button.Quick("Open mod page", new ToolTip(mod.link), () => { Application.OpenURL(mod.link); })); } seg2.AddInterpretter(Button.Quick("Discard", new ToolTip("Ignore this alert"), () => { mod.processed = true; })); } }
public static void Main(string[] args) { Display d1 = new StringDisplay("Hello, world."); Display d2 = new SideBorder(d1, '#'); Display d3 = new FullBorder(d2); d1.Show(); d2.Show(); d3.Show(); Display d4 = new FullBorder(d3); d4.Show(); }
static void Main(string[] args) { Display b1 = new StringDisplay("Hello, world."); Display b2 = new SideBorder(b1, '#'); Display b3 = new FullBorder(b2); b1.Show(); b2.Show(); b3.Show(); Display b4 = new SideBorder(new FullBorder(new SideBorder(new FullBorder(new StringDisplay("こんにちは。")), '*')), '/'); b4.Show(); }
protected override bool UpdateValueCore(string name, string value) { if (name == "Value") { var converter = new StringDisplay(); this.Value = ((string)converter.ConvertBack(value, typeof(string), null, null)); return(true); // UpdateValueCore handled. } // There's another 'UpdateValueCore' method in 'String' base class, // since they are both bound to the same property, 'StringInput' // should be given a chance to handle the property value change first // before the base class 'String'. return(base.UpdateValueCore(name, value)); }
private void Awake() { for (int i = 0; i < settingsCollection.boolSettings.Count; i++) { BoolToggle newBoolButton = Instantiate(boolToggle, this.transform).GetComponent <BoolToggle>(); newBoolButton.boolValue = settingsCollection.boolSettings[i]; newBoolButton.Initialize(); } for (int i = 0; i < settingsCollection.floatSettings.Count; i++) { FloatSlider newFloatSlider = Instantiate(floatSlider, this.transform).GetComponent <FloatSlider>(); newFloatSlider.floatValue = settingsCollection.floatSettings[i]; newFloatSlider.Initialize(); } for (int i = 0; i < settingsCollection.intSettings.Count; i++) { IntSlider newRoomPartDisplayer = Instantiate(intSlider, this.transform).GetComponent <IntSlider>(); newRoomPartDisplayer.intValue = settingsCollection.intSettings[i]; newRoomPartDisplayer.Initialize(); } for (int i = 0; i < settingsCollection.boolSettingsReadOnly.Count; i++) { BoolToggle newBoolDisplayer = Instantiate(boolDisplayer, this.transform).GetComponent <BoolToggle>(); newBoolDisplayer.boolValue = settingsCollection.boolSettingsReadOnly[i]; newBoolDisplayer.Initialize(); } for (int i = 0; i < settingsCollection.floatSettingsReadOnly.Count; i++) { FloatDisplay newFloatDisplayer = Instantiate(floatDisplayer, this.transform).GetComponent <FloatDisplay>(); newFloatDisplayer.floatValue = settingsCollection.floatSettingsReadOnly[i]; newFloatDisplayer.Initialize(); } for (int i = 0; i < settingsCollection.intSettingsReadOnly.Count; i++) { IntDisplay newIntDisplayer = Instantiate(intDisplayer, this.transform).GetComponent <IntDisplay>(); newIntDisplayer.intValue = settingsCollection.intSettingsReadOnly[i]; newIntDisplayer.Initialize(); } for (int i = 0; i < settingsCollection.stringSettingsReadOnly.Count; i++) { StringDisplay newStringDisplayer = Instantiate(stringDisplayer, this.transform).GetComponent <StringDisplay>(); newStringDisplayer.stringValue = settingsCollection.stringSettingsReadOnly[i]; newStringDisplayer.Initialize(); } }
public SideBorderTest() { _stringDisplay = new StringDisplay("Hello World!"); _sideBorder = new SideBorder(_stringDisplay, '|'); }
public FullBorderTest() { _stringDisplay = new StringDisplay("Hello World!"); _fullBorder = new FullBorder(_stringDisplay); }
public UpdownBorderTest() { _stringDisplay = new StringDisplay("Hello World!"); _updownBorder = new UpdownBorder(_stringDisplay, '='); }