-
-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
69 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
using Dalamud.Game.Gui.Dtr; | ||
using Dalamud.Plugin.Services; | ||
using ECommons.DalamudServices; | ||
using Splatoon.SplatoonScripting; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace SplatoonScriptsOfficial.Generic; | ||
public class StatusbarFpsSwitcher : SplatoonScript | ||
{ | ||
public override HashSet<uint>? ValidTerritories { get; } = null; | ||
|
||
IDtrBarEntry Entry; | ||
|
||
public override void OnEnable() | ||
{ | ||
Entry = Svc.DtrBar.Get("Splatoon.FpsSwitcher", ""); | ||
Entry.Shown = true; | ||
Entry.OnClick = () => | ||
{ | ||
Toggle(); | ||
}; | ||
Update(); | ||
} | ||
|
||
void Update() | ||
{ | ||
Entry = Svc.DtrBar.Get("Splatoon.FpsSwitcher", ""); | ||
var cfg = Svc.GameConfig.System.GetUInt("Fps"); | ||
if(cfg == 0) | ||
{ | ||
Entry.Text = $"FPS: U"; | ||
} | ||
else if(cfg == 1) | ||
{ | ||
Entry.Text = $"FPS: D"; | ||
} | ||
else if(cfg == 2) | ||
{ | ||
Entry.Text = $"FPS: 60"; | ||
} | ||
else if(cfg == 3) | ||
{ | ||
Entry.Text = $"FPS: 30"; | ||
} | ||
} | ||
|
||
void Toggle() | ||
{ | ||
var cfg = Svc.GameConfig.System.GetUInt("Fps"); | ||
Svc.GameConfig.System.Set("Fps", cfg == 3 ? 2u : 3u); | ||
Update(); | ||
} | ||
|
||
public override void OnDisable() | ||
{ | ||
Entry = Svc.DtrBar.Get("Splatoon.FpsSwitcher", ""); | ||
Entry.Remove(); | ||
} | ||
} |