Пример #1
0
        /// <summary>
        /// Please call when updating the game class.
        /// </summary>
        public void Update(DFEventArgs e)
        {
            if (current != null)
            {
                current.OnUpdate(this, Game, e);
                if (current.BackgroundColor != null)
                {
                    Game.BackgroundColor = current.BackgroundColor.Value;
                }

                if (current.Title != null)
                {
                    Game.Title = current.Title;
                }
            }
        }
Пример #2
0
 /// <summary>
 /// Called when updating frame of the scene.
 /// </summary>
 public virtual void OnUpdate(Router router, GameBase game, DFEventArgs e)
 {
 }
Пример #3
0
        public override void OnUpdate(Router router, DotFeather.DFEventArgs e)
        {
            bgm.Text = $"BGM: {bgmMap[bgmIndex].Item1}";
            sfx.Text = $"Sfx: {sfxMap[sfxIndex].Item1}";

            bgm.Color = cursor == 0 ? Color.Red : Color.White;
            sfx.Color = cursor == 0 ? Color.White : Color.Red;

            if (Input.Keyboard.Up.IsKeyDown)
            {
                cursor--;
            }
            if (Input.Keyboard.Down.IsKeyDown)
            {
                cursor++;
            }
            if (Input.Keyboard.Left.IsKeyDown)
            {
                if (cursor == 0)
                {
                    bgmIndex--;
                }
                else
                {
                    sfxIndex--;
                }
            }
            if (Input.Keyboard.Right.IsKeyDown)
            {
                if (cursor == 0)
                {
                    bgmIndex++;
                }
                else
                {
                    sfxIndex++;
                }
            }

            if (cursor < 0)
            {
                cursor = 0;
            }
            if (cursor > 1)
            {
                cursor = 1;
            }
            if (bgmIndex < 0)
            {
                bgmIndex = bgmMap.Length - 1;
            }
            if (bgmIndex >= bgmMap.Length)
            {
                bgmIndex = 0;
            }
            if (sfxIndex < 0)
            {
                sfxIndex = sfxMap.Length - 1;
            }
            if (sfxIndex >= sfxMap.Length)
            {
                sfxIndex = 0;
            }

            if (Input.Keyboard.Space.IsKeyDown)
            {
                if (cursor == 0)
                {
                    aud.Play(bgmMap[bgmIndex].Item2);
                }
                else
                {
                    aud.PlayOneShotAsync(sfxMap[sfxIndex].Item2);
                }
            }

            if (Input.Keyboard.BackSpace.IsKeyDown)
            {
                aud.Stop();
            }
        }
Пример #4
0
 protected override void OnUpdate(object sender, DFEventArgs e)
 {
     Update?.Invoke(sender, e);
     // ルーターにアップデートさせる
     router.Update(e);
 }