DFU Will Not Make A New Button
-
- Posts: 75
- Joined: Sat Jul 25, 2020 5:53 pm
DFU Will Not Make A New Button
Hello! Some of you may be aware that I'm the maintainer and updater of Races Framework Redone after Races Framework stopped being supported by its original creator. Some of you may also know that RFR stopped working in 0.14.5. I've been trying in 0.15.2 to get it working again and I believe I've narrowed down the problem as to why the "More" button which allows the selection of extra races will not show up - namely, I don't think DFU is making the button properly. The button is hard coded and drawn onto the screen, and by commenting out various sections I think I can confirm that basically this button is never being drawn. But I'm not sure where to go from here or how to fix this. Here's the relevant section of code relating to the creation of the button:
Even if the two "skip" sections are commented out, the button still won't be drawn. I'll admit I've reached the limit of my (very basic) coding knowledge here and any advice would be appreciated. Is there an easier way to do this?
Spoiler!
- DunnyOfPenwick
- Posts: 275
- Joined: Wed Apr 14, 2021 1:58 am
- Location: Southeast US
Re: DFU Will Not Make A New Button
In the context of DFU, a 'button' is an invisible rectangle on the screen that records mouse clicks.
If you want the button to be visible you will have to create the graphic separately, usually by manually editing the window graphic.
If you want the button to be visible you will have to create the graphic separately, usually by manually editing the window graphic.
-
- Posts: 75
- Joined: Sat Jul 25, 2020 5:53 pm
Re: DFU Will Not Make A New Button
Forgive me if I'm mistaken, but I believe that's what setting the background color and text does in this code; this code worked in previous versions of DFU and showed a rectangular "button" graphic with (IIRC) a reddish-brown background that simply said "More", as long as there was a properly formatted race file mod also present in the mod list; it is no longer doing this in the new version. It's using Unity's tools to draw an image on screen with the listed dimensions at the listed vector, or at least, that's what it used to do and what it should be doing. (I think I'm using the correct terms; my programming knowledge is limited and I'm using taking over this mod as well as creating my own mods as a way to learn more)
So if what I'm hearing from you is correct, this code no longer works that way and does not place the graphic on screen when th button is created. On the other hand, clicking in the area the button used to be in previous versions also doesn't open the list dialog that it used to in previous versions of DFU, so I still believe the button isn't being created for some reason.
So if what I'm hearing from you is correct, this code no longer works that way and does not place the graphic on screen when th button is created. On the other hand, clicking in the area the button used to be in previous versions also doesn't open the list dialog that it used to in previous versions of DFU, so I still believe the button isn't being created for some reason.
- DunnyOfPenwick
- Posts: 275
- Joined: Wed Apr 14, 2021 1:58 am
- Location: Southeast US
Re: DFU Will Not Make A New Button
Most windows in DFU use pre-drawn buttons in the graphic that have invisible buttons layered on top of them.
I assumed that's what the original post was referencing.
I assumed that's what the original post was referencing.
-
- Posts: 75
- Joined: Sat Jul 25, 2020 5:53 pm
Re: DFU Will Not Make A New Button
No, the mod is creating a brand new button with the specified appearance. You can see what it looked like in a previous version (0.14.4) in this screenshot:
Clicking the "More" button shown opens a list as shown here:
Neither of these things happens in 0.14.5 and later versions despite the code throwing no errors. It's infuriating xD
Clicking the "More" button shown opens a list as shown here:
Neither of these things happens in 0.14.5 and later versions despite the code throwing no errors. It's infuriating xD
- MrFlibble
- Posts: 410
- Joined: Sat Jan 27, 2018 10:43 am
Re: DFU Will Not Make A New Button
Oh, and I was wondering why I couldn't get the extra races when I installed these mods with 0.14.5.
- pango
- Posts: 3347
- Joined: Wed Jul 18, 2018 6:14 pm
- Location: France
- Contact:
Re: DFU Will Not Make A New Button
According to this bug report on Nexus,
https://www.nexusmods.com/daggerfalluni ... 6?tab=bugs
Mod stopped working because it can't find a method
Looking at DFU diff, that method got added a new optional parameter between 0.14.4 and 0.14.5, that's probably what broke the mod:
https://www.nexusmods.com/daggerfalluni ... 6?tab=bugs
Mod stopped working because it can't find a method
Code: Select all
MissingMethodException: object DaggerfallWorkshop.Game.Serialization.SaveLoadManager.Deserialize(System.Type,string)
Code: Select all
➭ git diff v0.14.4-beta..v0.14.5-beta Assets/Scripts/Game/Serialization/SaveLoadManager.cs
diff --git a/Assets/Scripts/Game/Serialization/SaveLoadManager.cs b/Assets/Scripts/Game/Serialization/SaveLoadManager.cs
index d7af2129a..d88da95b4 100644
--- a/Assets/Scripts/Game/Serialization/SaveLoadManager.cs
+++ b/Assets/Scripts/Game/Serialization/SaveLoadManager.cs
@@ -615,14 +615,17 @@ namespace DaggerfallWorkshop.Game.Serialization
return (pretty) ? fsJsonPrinter.PrettyJson(data) : fsJsonPrinter.CompressedJson(data);
}
- public static object Deserialize(Type type, string serializedState)
+ public static object Deserialize(Type type, string serializedState, bool assertSuccess = false)
{
// Step 1: Parse the JSON data
fsData data = fsJsonParser.Parse(serializedState);
// Step 2: Deserialize the data
object deserialized = null;
- _serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
+ if (assertSuccess)
+ _serializer.TryDeserialize(data, type, ref deserialized).AssertSuccess();
+ else
+ _serializer.TryDeserialize(data, type, ref deserialized).AssertSuccessWithoutWarnings();
return deserialized;
}
@@ -1374,7 +1377,7 @@ namespace DaggerfallWorkshop.Game.Serialization
// Restore quest machine state
if (!string.IsNullOrEmpty(questDataJson))
{
- QuestMachine.QuestMachineData_v1 questData = Deserialize(typeof(QuestMachine.QuestMachineData_v1), questDataJson) as QuestMachine.QuestMachineData_v1;
+ QuestMachine.QuestMachineData_v1 questData = Deserialize(typeof(QuestMachine.QuestMachineData_v1), questDataJson, assertSuccess:true) as QuestMachine.QuestMachineData_v1;
QuestMachine.Instance.RestoreSaveData(questData);
}
Mastodon: @pango@fosstodon.org
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
When a measure becomes a target, it ceases to be a good measure.
-- Charles Goodhart
-
- Posts: 75
- Joined: Sat Jul 25, 2020 5:53 pm
Re: DFU Will Not Make A New Button
Oh my god, Pango, that is such a lifesaver. So I need to fix the method call syntax to allow it to deserialize the json files properly! I need to look up how to do that, thank you so much.
-
- Posts: 75
- Joined: Sat Jul 25, 2020 5:53 pm
Re: DFU Will Not Make A New Button
With Pango's help, I have finally fixed the mod. Thank you all for your help and support~!