#Toggle Notifications [0.2.5] - Toggle Notifications On or Off!
1 messages · Page 1 of 1 (latest)
Toggle Notifications [0.2.0] - Toggle Notifications On or Off!
Toggle Notifications [0.2.1] - Toggle Notifications On or Off!
I've been hard at developing a mod for KSP2. In this orbital video you'll see what the mod does.
It disables notifications.
Beyond that, I just think Laythe is epic. I love the craters and small islands it has. Also that jool rise is rad!
Toggle Notifications [0.2.2] - Toggle Notifications On or Off!
Toggle Notifications [0.2.3] - Toggle Notifications On or Off!
https://github.com/cvusmo/Toggle-Notifications/releases/tag/v0.2.3
https://spacedock.info/mod/3377/Toggle20Notifications
[0.2.3 Release Notes]
**SOLAR PANELS INEFFECTIVE MESSAGE DISABLED
**Simplified pathing
**Fully implemented Harmony Transpilers
**Simple GUI accessed by clicking on gear icon. 0.2.4 will add more to the simple GUI
[0.2.3 Release Notes]
**SOLAR PANELS INEFFECTIVE MESSAGE DISABLED
**Simplified pathing
**Fully implemented Harmony Transpilers
**Simple GUI accessed by clicking on gear icon. 0.2.4 will add more to...
[0.2.5 Release Notes]
*added settings page to view status of notifications
**cleaned up code
**fixed pause button not being able to be re-enabled
https://www.youtube.com/watch?v=8Z1CY330iKI
https://spacedock.info/mod/3377/Toggle Notifications#changelog
https://github.com/cvusmo/Toggle-Notifications/releases/tag/v0.2.5
This is the first mod I've ever made. I've learned a lot in the last 3 weeks. I'm excited to share the mod I've made and more #ksp2 content in June!
Full length video covering Toggle Notifications and the state of mods will be out this Friday!
[0.2.5 Release Notes]
**Fixed game pause and it is now able to be re-enabled by the player
**Reorganized, restructured, and optimized backend
**Updated Harmony Transpilers to target only necessary ...
Toggle Notifications [0.2.4] - Toggle Notifications On or Off!
Hey, I just downloaded 0.2.5 from SpaceDock and it's reporting itself as 0.2.2
You might want to check what you posted to SpaceDock.
Also, it would really be nice if when you bundled the zip you did it so the zip has a structure of BepInEx/plugins/ToggleNotifications rather than just ToggleNotifications. This difference may be no big deal for those using CKAN, but for those of us who don't it's a minor hassle as we can just drag the zip file contents to the folder KSP2 is installed in. Instead, I've got to open that folder, then open BepinEx, then drag the mod folder and drop it on plugins. It would be easier if I could just drag a BepInEx folder to my game's folder.
Da heck?
No worries. I just hate the BepInEx/Plugins thing. I'd rather go directly to plugins and see my mods when I install them 😂
I'll look at it tomorrow. Not sure why it says 0.2.2
In game is it showing that?
Weird in github the swinfo is correct
I was like that too until I discovered how freaking easy it is to just drop a BepInEx folder onto my game folder and not need to do all that. No worries, though. If this is the way you prefer to ship it that's ok. The fact that GitHub has the right information is exactly why SpaceWarp shows it as outdated. SpaceWarp is just reading what's in the local swinfo.json and comparing to what's on GitHub.
@drowsy mantle Thanks for pointing that out. It's updated in github, added to spacedock, and pushed to ckan
Hey @jaunty stream , How come I'm getting this
when I press Alt-P?
You trying to confuse ppl?
I have alt-p the hotkey for testing. forgot to remove it
LOL! I thought you were just pranking me...
its supposed to be right alt and p
since yours is left alt and p
i was too lazy to come up with a unique hotkey so was like "well just use right alt"
It is, but I think that may confuse ppl if FP is (left)Alt-P
you cant escape notifcations. even if you toggle them, when you hotkey FP, you get notified about your toggle notifications...

Were Alt-T and Alt-N both taken?
no idea. i just went with right alt p and never looked back
ill fix it and upload 0.3.6 later this week
alt+F4 is new hot key 
@drowsy obsidian This makes me wonder if maybe we should register hot keys with SpaceWarp to help surface possioble conflicts.
could be useful
also someway letting users pick their hotkey is the idea solution
no idea how to do that
currently im looking at colors and trying to figure out what is wrong
or just add BepInEx configs for your mods' shortcuts
I think that's what "allow users to configure": would amount to
I'm pretty sure there's a keybind configuration option in the BepInEx API
you can Config.Bind this
I explored down that road once early on, but my fumblings didn't work so I gave up. It may be time to explore again.
Also, could such a configuration be in the template to help guide mod developers?
I guess
OK, I've read the docs you linked and can honestly say I'm no closer to implementing this than I was before reading them. Well, maybe just I tiny bit closer... I gather it doesn't go in Update(). It seems like it ought to point to something that happens (like a method or => {} or something. Presumably I'd need public KeyboardShortcut(KeyCode mainKey, params KeyCode[] modifiers) somewhere in my class, and I get that for me mainKey = 'P', and modifiers = <some mysterious way to specify left Alt>. But I don't see how this would trigger squat.
private ConfigEntry<KeyboardShortcut> _keybind;
public override void OnInitialized()
{
// ...
_keybind = Config.Bind(
new ConfigDefinition("Section", "Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.LeftControl),
new ConfigDescription("Keybind to open mod window")
);
// ...
}
private void Update()
{
if (_keybind != null && _keybind.Value.IsPressed())
{
// Open my mod window
}
// ...
}
that should be all you need
(with some additional null checks)
since Update also gets called before OnInitialized
there, that should be all
Nice!
However it's a bit tricky...
Pressing the hot key will toggle the mod on an off as fast as it can as long as it's pressed. May want something else in place of .IsPressed()
I think maybe .IsUp() "Check if the main key was just lifted (Input.GetKeyUp), and specified modifier keys are all pressed."
Or perhaps IsDown() "Check if the main key was just pressed (Input.GetKeyDown), and specified modifier keys are all pressed"
Can you have multiple keybinds? Or somehow allow for wither (left)Alt+P and (right)Alt+P? I can imagine users getting confused and compalining "Hot key doesn't work!" and then I have to patiently ask "which Alt key did you press?"
Apparently not, or at least not as I naively attempted it. I tried this:
private ConfigEntry<KeyboardShortcut> _keybind;
private ConfigEntry<KeyboardShortcut> _keybind2;
...
public override void OnInitialized()
...
_keybind = Config.Bind(
new ConfigDefinition("Section", "Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.LeftAlt),
new ConfigDescription("Keybind to open mod window")
);
_keybind2 = Config.Bind(
new ConfigDefinition("Section", "Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.RightAlt),
new ConfigDescription("Keybind to open mod window")
);
...
void Update()
{
//if (Input.GetKey(KeyCode.LeftAlt) && Input.GetKeyDown(KeyCode.P))
if ((_keybind != null && _keybind.Value.IsDown()) || (_keybind2 != null && _keybind.Value.IsUp()))
{```
And that didn't work. I thought it would let me test the effect of IsDown with the LeftAlt and IsUp with the RightAlt, but in fact waht it did was open the mod on IsDown, then close the mod on IsUp, and moreover the BepInEx config only showed the first keybind and not both.
That said, .IsDown() works brilliantly, and my keybind is now user configurable.
well you're trying to set the same config value called "Keybind" twice
you need to change the name if you want two
Ahh! That was my mistake!
I also found KeyCode.AltGr, but curiously changing the code to this made no diff in the mod config screen (it still listed the keybind being LeftAlt)
_keybind = Config.Bind(
new ConfigDefinition("Section", "Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.AltGr),
new ConfigDescription("Keybind to open mod window")
);```
If KeyCode.AltGr could is something that's understood as "press either Alt key", then that's what I'd like. Using the mod config page and trying to set it that way via that interface I failed and got LeftAlt + RightAlt + AltGr
AltGr (also Alt Graph) is a modifier key found on many computer keyboards (rather than a second Alt key found on US keyboards). It is primarily used to type characters that are not widely used in the territory where sold, such as foreign currency symbols, typographic marks and accented letters. On a typical Windows-compatible PC keyboard, the Al...
on most non-US keyboards the key basically means Ctrl+Alt
OK, all set now. This works:
public override void OnInitialized()
...
_keybind = Config.Bind(
new ConfigDefinition("Keybindings", "First Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.LeftAlt),
new ConfigDescription("Keybind to open mod window")
);
_keybind2 = Config.Bind(
new ConfigDefinition("Keybindings", "Second Keybind"),
new KeyboardShortcut(KeyCode.P, KeyCode.RightAlt, KeyCode.AltGr),
new ConfigDescription("Keybind to open mod window")
);
...
void Update()
{
if ((_keybind != null && _keybind.Value.IsDown()) || (_keybind2 != null && _keybind2.Value.IsDown()))
{
ToggleButton(!_interfaceEnabled);
if (_keybind != null && _keybind.Value.IsDown())
Logger.LogDebug($"Update: UI toggled with _keybind, hotkey {_keybind.Value}");
if (_keybind2 != null && _keybind2.Value.IsDown())
Logger.LogDebug($"Update: UI toggled with _keybind2, hotkey {_keybind2.Value}");
}```
Turns out to get this method to work with the RightAlt you must include the .AltGr - at least you must with my keyboard.
I really like this method! It's easy for the user to set it to whatever they want (or clear it to disable), and also easy for them to reset it to the default!
That said, @jaunty stream
You may recall the fate of Count Duku...
IndexOutOfRangeException: Unable to find asset at path "togglenotifications/images/window.png"
at SpaceWarp.API.Assets.AssetManager.GetAsset[T] (System.String path) [0x0004d] in <8c8ff3f07aa1436ead441791e8bacb2f>:0
at ToggleNotifications.TNTools.UI.AssetsLoader.LoadIcon (System.String path) [0x00001] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\TNTools\UI\AssetsLoader.cs:10
at ToggleNotifications.TNTools.UI.TNBaseStyle.BuildFrames () [0x0006f] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\TNTools\UI\TNBaseStyle.cs:135
at ToggleNotifications.TNTools.UI.TNBaseStyle.BuildStyles () [0x0001d] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\TNTools\UI\TNBaseStyle.cs:56
at ToggleNotifications.TNTools.UI.TNBaseStyle.Init () [0x00001] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\TNTools\UI\TNBaseStyle.cs:49
at ToggleNotifications.TNStyles.Init () [0x00011] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\TNStyles.cs:21
at ToggleNotifications.ToggleNotificationsPlugin.OnGUI () [0x00095] in E:\Modding\repos\Toggle-Notifications\Toggle NotificationsProject\ToggleNotificationsPlugin.cs:140
a few errors to fix
I had this one. It was an easy fix. If you go to AssetsLoaders.cs you may find it has a hardcoded name for your mod or some other nonsense. The source of the problem might be about like this
public static Texture2D loadIcon(string path)
{
// TODO : change the hardcoded path com.github.schlosrat.resonant_orbit_calculator
string full_path = $"com.github.schlosrat.resonant_orbit_calculator/images/{path}.png";
var imageTexture = AssetManager.GetAsset<Texture2D>(full_path);
Where what I've got there is an example of a kluge fix
@drowsy obsidian suggested a much better fix for my code days ago but I was tierd and cranky and so didn't do it right then. I'll go back and look in modding chat for it
Just use the MyPluginInfo.PLUGIN_GUID constant
Or if you have it in your project (it comes with the template), YourPluginClass.ModGuid
Instead of hardcoding the plugin ID in the path
Not 100% sure if the constant is ModGuid or ModId, one of those two
So like this (in Resonant Orbit Calculator as an example)
public static Texture2D loadIcon(string path)
{
// Get the path to the file base on the PLUGIN_GUID and the supplied path in the call
string full_path = $"{MyPluginInfo.PLUGIN_GUID}/images/{path}.png";
var imageTexture = AssetManager.GetAsset<Texture2D>(full_path);
Yep, that should be all
Yup I sorted it out. Thanks for sharing! It was an easy fix fortunately!
That's genius
That's Munix
im actually doing that now to TN lol. that way if/when things change, it updates itself
which i dont think it will cause i have zero desire to change the modid again