Skip to content

Commit

Permalink
Update to fix hotkeys, and this time it should worko in the case of f…
Browse files Browse the repository at this point in the history
…uture updates.
  • Loading branch information
Cazzar committed Dec 20, 2021
1 parent fde9ede commit 2c207aa
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
54 changes: 36 additions & 18 deletions streamdeck-vtubestudio/VTubeStudioApi/Models/Hotkey.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.Reflection.Metadata.Ecma335;
using Newtonsoft.Json;
using StreamDeckLib;

namespace Cazzar.StreamDeck.VTubeStudio.VTubeStudioApi.Models
{
Expand All @@ -9,29 +10,46 @@ public class Hotkey
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("type")]
public HotkeyAction Type { get; set; }
public string Type { get; set; }
[JsonProperty("file")]
public string File { get; set; }
[JsonProperty("description")]
public string Description { get; set; }
[JsonProperty("hotkeyID")]
public string Id { get; set; }

public string ButtonTitle => Type switch
public string ButtonTitle
{
get
{
HotkeyAction.Unset => "Unset",
HotkeyAction.TriggerAnimation => File.TrimEnd(".motion3.json"),
HotkeyAction.ChangeIdleAnimation => File.TrimEnd(".motion3.json"),
HotkeyAction.ToggleExpression => File.TrimEnd(".exp3.json"),
HotkeyAction.RemoveAllExpressions => "Remove All Expressions",
HotkeyAction.MoveModel => "Move Model",
HotkeyAction.ChangeBackground => File,
HotkeyAction.ReloadMicrophone => "Reload Microphone",
HotkeyAction.ReloadTextures => "Reload Textures",
HotkeyAction.CalibrateCam => "Calibrate Camera",
HotkeyAction.ChangeVTSModel => File.TrimEnd(".vtube.json"),
HotkeyAction.TakeScreenshot => "Take Screenshot",
HotkeyAction.ScreenColorOverlay => "Screen Color Overlay",
HotkeyAction.RemoveAllItems => "Remove All Items",
_ => "Unknown",
};
if (!string.IsNullOrEmpty(Name))
return Name.Trim();

if (!Enum.TryParse(Type, true, out HotkeyAction action))
{
return Description;
}

return action switch
{
HotkeyAction.Unset => "Unset",
HotkeyAction.TriggerAnimation => File.TrimEnd(".motion3.json"),
HotkeyAction.ChangeIdleAnimation => File.TrimEnd(".motion3.json"),
HotkeyAction.ToggleExpression => File.TrimEnd(".exp3.json"),
HotkeyAction.RemoveAllExpressions => "Remove All Expressions",
HotkeyAction.MoveModel => "Move Model",
HotkeyAction.ChangeBackground => File,
HotkeyAction.ReloadMicrophone => "Reload Microphone",
HotkeyAction.ReloadTextures => "Reload Textures",
HotkeyAction.CalibrateCam => "Calibrate Camera",
HotkeyAction.ChangeVTSModel => File.TrimEnd(".vtube.json"),
HotkeyAction.TakeScreenshot => "Take Screenshot",
HotkeyAction.ScreenColorOverlay => "Screen Color Overlay",
HotkeyAction.RemoveAllItems => "Remove All Items",
HotkeyAction.ToggleItemScene => $"Toggle Item Scene {File}",
_ => "Unknown",
};
}
}
}
}
3 changes: 2 additions & 1 deletion streamdeck-vtubestudio/VTubeStudioApi/Models/HotkeyAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ public enum HotkeyAction
CalibrateCam = 8, // Calibrate Camera.
ChangeVTSModel = 9, // Change VTS Model.
TakeScreenshot = 10, // Takes a screenshot with the screenshot settings previously set in the UI.
ScreenColorOverlay = 11, // Activates/Deactivates model screen color overlay.\
ScreenColorOverlay = 11, // Activates/Deactivates model screen color overlay.
RemoveAllItems = 12, // Removes all the items from the scene.
ToggleItemScene = 13, // Toggles an item scene.
}
}

0 comments on commit 2c207aa

Please sign in to comment.