本文整理汇总了C#中Selector.SetEasingBehaviorUp方法的典型用法代码示例。如果您正苦于以下问题:C# Selector.SetEasingBehaviorUp方法的具体用法?C# Selector.SetEasingBehaviorUp怎么用?C# Selector.SetEasingBehaviorUp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Selector
的用法示例。
在下文中一共展示了Selector.SetEasingBehaviorUp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnStart
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);
}