protected override void OnStart() { selector = new ScrollingSelector<int, Control>(CreateController()) { Position = new Vector2DF(320 - 200, 60), LineSpan = 52, LineWidth = 400, BoundLines = 4, IsControllerUpdated = true, Loop = true, }; selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel); selector.Cursor.IsDrawn = false; var scene = new ReactiveScene(); var background = new Layer2D(); background.AddObject(new GeometryObject2D() { Shape = new RectangleShape() { DrawingArea = new RectF(0, 0, 640, 480) }, Color = new Color(255, 255, 255, 255), }); scene.AddLayer(background); scene.AddLayer(selector); Engine.ChangeScene(scene); for(int i = 0; i < 1; i++) { selector.AddChoice(i, new HomeItem(i)); } selector.SetDebugCameraUp(); selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); }
protected override void OnStart() { selector = new ScrollingSelector<int, Control>(CreateController()) { Position = new Vector2DF(60, 32), CursorOffset = new Vector2DF(-5, 3), LineSpan = 36, LineWidth = 360, BoundLines = 8, ExtraLinesOnStarting = 1, ExtraLinesOnEnding = 1, IsControllerUpdated = true, Loop = true, }; selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel); selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); font = Engine.Graphics.CreateFont("MPlusB.aff"); var scene = new ReactiveScene(); var background = new Layer2D(); background.AddObject(new GeometryObject2D() { Shape = new RectangleShape() { DrawingArea = new RectF(0, 0, 640, 480) }, Color = new Color(255, 255, 255, 255), }); background.AddObject(new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("ListWindowLarge.png"), Position = new Vector2DF(30, 30), DrawingPriority = 1, }); scene.AddLayer(background); scene.AddLayer(selector); Engine.ChangeScene(scene); for(int i = 0; i < 15; i++) { var obj = new TextObject2D() { Font = font, Text = $"アイテム{i}", Color = new Color(225, 160, 0, 255), }; selector.AddChoice(i, obj); } selector.SetDebugCameraUp(); }
private async Task RunAsync() { var selector2 = new ScrollingSelector<int, Control>(CreateController()) { BoundLines = 6, LineSpan = 40, LineWidth = 120, IsControllerUpdated = true, }; selector2.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel); selector2.AddChoice(0, new TextureObject2D()); scene.AddLayer(selector2); Console.WriteLine(Thread.CurrentThread.ManagedThreadId); await selector2.OnDecide.FirstAsync().ToTask(); Console.WriteLine(Thread.CurrentThread.ManagedThreadId); selector2.Dispose(); }
protected override void OnStart() { font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 0, 0, 255), 0, new Color(0, 0, 0, 0)); selector = new ScrollingSelector<int, Control>(CreateController()) { IsControllerUpdated = true, Position = new Vector2DF(30, 30), LineSpan = 36, BoundLines = 4, LineWidth = 360, ExtraLinesOnStarting = 1, ExtraLinesOnEnding = 1, }; selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel); selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); collection = new ObservableCollection<int>(); for(int i = 0; i < 5; i++) { collection.Add(i); } CollectionBinderForSelector<int>.Bind(selector, collection, i => new ActivatableItem($"アイテム{i}"), true); for(int i = 5; i < 10; i++) { collection.Add(i); } var scene = new Scene(); scene.AddLayer(selector); Engine.ChangeScene(scene); }