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(); }
protected override void OnStart() { collection = new ObservableCollection<int>(); var scene = new ReactiveScene(); var layer = new ReactiveLayer2D(); var layout = new LinearPanel() { ItemSpan = new Vector2DF(0, 36), }; var selector = new Selector<int, Control>(CreateController(), layout); selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel); selector.Loop = true; font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 255, 255, 255), 0, new Color(0, 0, 0, 255)); CollectionBinderForSelector<int>.Bind(selector, collection, c => new ListItem() { Font = font, Text = $"追加アイテム{c}", }, false); Engine.ChangeScene(scene); scene.AddLayer(layer); layer.AddObject(selector); }
protected override void OnStart() { var scene = new ReactiveScene(); var layer = new ReactiveLayer2D(); var controller = new KeyboardController<int>(); controller.BindKey(Keys.Down, 0); controller.BindKey(Keys.Up, 1); controller.BindKey(Keys.Z, 2); controller.BindKey(Keys.X, 3); var layout = new LinearPanel() { ItemSpan = new Vector2DF(0, 36), Position = new Vector2DF(20, 20), }; layout.SetEasingBehaviorUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); selector = new Selector<int, int>(controller, layout) { Loop = true, CursorOffset = new Vector2DF(-5, -3), }; selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.BindKey(0, 1, 2, 3); selector.SetEasingBehaviorUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 255, 255, 255), 0, new Color(0, 0, 0, 255)); for(int i = 0; i < 8; i++) { var obj = new ListItem() { Text = $"選択肢{i}", Font = font, }; Engine.AddObject2D(obj); selector.AddChoice(i, obj); } var moveSound = Engine.Sound.CreateSoundSource("kachi38.wav", true); var decideSound = Engine.Sound.CreateSoundSource("pi78.wav", true); var cancelSound = Engine.Sound.CreateSoundSource("pi11.wav", true); selector.OnSelectionChanged.Subscribe(i => Engine.Sound.Play(moveSound)); selector.OnDecide.Subscribe(i => { Engine.Sound.Play(decideSound); }); selector.OnCancel.Subscribe(i => { Engine.Sound.Play(cancelSound); }); Engine.ChangeScene(scene); scene.AddLayer(layer); layer.AddObject(selector); }
protected override void OnStart() { Func<Object2D> cursorCreator = () => new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"), Color = new Color(0, 255, 0, 128), }; selector = new ScrollingMultiSelector<int, Control>(CreateController(), cursorCreator) { Position = new asd.Vector2DF(60, 35), CursorOffset = new asd.Vector2DF(-5, 3), LineSpan = 36, LineWidth = 360, BoundLines = 9, ExtraLinesOnStarting = 1, ExtraLinesOnEnding = 0, IsControllerUpdated = true, Loop = true, }; selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel, Control.Sub); selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.SetEasingScrollUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); var 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 < 24; i++) { var obj = new TextObject2D() { Font = font, Text = $"アイテム{i}", Color = new Color(225, 160, 0, 255), }; selector.AddChoice(i, obj); } var moveSound = Engine.Sound.CreateSoundSource("kachi38.wav", true); var decideSound = Engine.Sound.CreateSoundSource("pi78.wav", true); var cancelSound = Engine.Sound.CreateSoundSource("pi11.wav", true); selector.OnSelectionChanged.Subscribe(i => { var handle = Engine.Sound.Play(moveSound); Engine.Sound.SetVolume(handle, 0.3f); }); selector.OnDecide.Subscribe(i => { var handle = Engine.Sound.Play(decideSound); Engine.Sound.SetVolume(handle, 0.3f); }); selector.OnCancel.Subscribe(i => Engine.Sound.Play(cancelSound)); selector.OnAdd.Subscribe(i => Engine.Sound.Play(decideSound)); selector.OnRemove.Subscribe(i => Engine.Sound.Play(cancelSound)); selector.OnDecideForMulti.Subscribe(xs => { foreach(var x in xs.ToList()) { selector.GetItemForChoice(x)?.Dispose(); selector.RemoveChoice(x); } }); //selector.SetDebugCameraUp(); }
protected override void OnStart() { var scene = new ReactiveScene(); var layer = new ReactiveLayer2D(); var layout = new LinearPanel() { ItemSpan = new Vector2DF(0, 36), Position = new Vector2DF(20, 20), }; layout.SetEasingBehaviorUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); Func<Object2D> cursorCreator = () => new TextureObject2D() { Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"), Color = new Color(0, 255, 0, 128), }; selector = new MultiSelector<int, Control>(CreateController(), layout, cursorCreator) { Loop = true, CursorOffset = new Vector2DF(-5, -3), }; selector.Cursor.Texture = Engine.Graphics.CreateTexture2D("ListCursor.png"); selector.BindKey(Control.Down, Control.Up, Control.Decide, Control.Cancel, Control.Sub); selector.SetEasingBehaviorUp(EasingStart.StartRapidly2, EasingEnd.EndSlowly3, 10); font = Engine.Graphics.CreateDynamicFont("", 20, new Color(255, 255, 255, 255), 0, new Color(0, 0, 0, 255)); for(int i = 0; i < 8; i++) { var obj = new ListItem() { Text = $"選択肢{i}", Font = font, }; Engine.AddObject2D(obj); selector.AddChoice(i, obj); } var moveSound = Engine.Sound.CreateSoundSource("kachi38.wav", true); var decideSound = Engine.Sound.CreateSoundSource("pi78.wav", true); var cancelSound = Engine.Sound.CreateSoundSource("pi11.wav", true); selector.OnSelectionChanged.Subscribe(i => Engine.Sound.Play(moveSound)); selector.OnDecide.Subscribe(i => Engine.Sound.Play(decideSound)); selector.OnCancel.Subscribe(i => Engine.Sound.Play(cancelSound)); selector.OnAdd.Subscribe(i => Engine.Sound.Play(decideSound)); selector.OnRemove.Subscribe(i => Engine.Sound.Play(cancelSound)); selector.OnDecideForMulti.Subscribe(xs => { foreach(var x in xs.ToList()) { selector.GetItemForChocie(x)?.Dispose(); selector.RemoveChoice(x); } }); Engine.ChangeScene(scene); scene.AddLayer(layer); layer.AddObject(selector); }