Пример #1
0
    public void ParseIntent(string intent, dynamic json)
    {
        switch (intent)
        {
        case "GetTime":
            Say(Pluto.GetTime());
            break;

        case "PlaySong":
            pluto.musicSystem.PlayIndex(int.Parse(json.slots.index.ToString()) - 1);
            break;

        case "StopSong":
            pluto.musicSystem.StopSong();
            break;

        case "Volume":
            string state = json.slots.state.ToString();
            if (state == "down")
            {
                pluto.Log("has turned the volume down");
                pluto.musicSystem.ModifyVolume(-0.05f);
            }
            else if (state == "up")
            {
                pluto.Log("has turned the volume up");
                pluto.musicSystem.ModifyVolume(0.05f);
            }
            break;

        case "Shutdown":
            pluto.shouldClose = true;
            break;

        default:
            pluto.Log("failed to catch an intent");
            break;
        }
    }
Пример #2
0
    public override void Update()
    {
        timeText.SetText(DateTime.Now.ToString("MM-dd").Replace("-", "/") + "  |  " + Pluto.GetTime().ToUpper());

        if (Raylib.IsKeyPressed(KeyboardKey.KEY_R))
        {
            GenerateStars();
        }

        if (PaperUtils.RectClick(volumeSlider.GetRectangle()))
        {
            volumeHandle.position = new Vector2(Raylib.GetMouseX(), volumeHandle.position.Y);
            float newVolume = GetRelativePercentage(volumeSlider.literalPosition.X, volumeSlider.literalPosition.X + volumeSlider.size.X, Raylib.GetMouseX());
            // Console.WriteLine(newVolume);
            pluto.musicSystem.SetVolume(newVolume);
        }

        if (PaperUtils.RectClick(brightnessSlider.GetRectangle()))
        {
            brightnessHandle.position = new Vector2(Raylib.GetMouseX(), brightnessHandle.position.Y);
            brightness = GetRelativePercentage(brightnessSlider.literalPosition.X, brightnessSlider.literalPosition.X + brightnessSlider.size.X, Raylib.GetMouseX());

            // Console.WriteLine(brightness);
        }
    }