DysonSphereMod / QOL

64 stars 36 forks source link

Switch to using UIStatisticsWindow instead of UIProductionStatWindow #119

Closed mattsemar closed 3 years ago

mattsemar commented 3 years ago

Looks like UIProductionStatWindow went away. I took a stab at switching to UIStatisticsWindow. It seems to work on my machine 😄

starfi5h commented 3 years ago

I got error when setting time period to all time. 0.8.20.7996

System.NullReferenceException: Object reference not set to an instance of an object
  at UIStatisticsWindow.EntryPrepareComputeDetail (UIProductEntry entry) [0x0000c] in <2b6b567be8b04c928a9ec5e7af421c2e>:0 
  at UIStatisticsWindow.ComputeDisplayEntriesDetail () [0x00101] in <2b6b567be8b04c928a9ec5e7af421c2e>:0 
  at UIStatisticsWindow._OnUpdate () [0x00344] in <2b6b567be8b04c928a9ec5e7af421c2e>:0 
  at ManualBehaviour._Update () [0x00017] in <2b6b567be8b04c928a9ec5e7af421c2e>:0_ 

Here is the dll and dsv I used.

cgc007 commented 3 years ago

I tested starfi5h's .dll and got the same error. Happened on 'Entire Star Cluster` set. Seems to persist through reloading various saves as well. The only way to be rid of the error I've found thus far is to exit DSP entirely (desktop) and reload it.

NelsonMinar commented 3 years ago

One of the other changes in the patch that broke BetterStats was "Now the entries with both production and consumption of 0 are not displayed in the production statistics panel." I wonder if that might be the cause of the error starfi5h reported. Or cause other problems.

mattsemar commented 3 years ago

I think it's because I was trying to use entry.Free() as a replacement for entry.Destroy(). I'm not really sure what entry.Destroy() actually did, though, so I'll just take it out and see what happens

mattsemar commented 3 years ago

That seems to work, but I would like to know what Destroy() was actually doing. Here's the dll

mattsemar commented 3 years ago

I fixed some display issues, and just made it so the the 'Theoretical max' stuff stays even in all time mode. Link to dll here

starfi5h commented 3 years ago

Thanks, The NullReferenceException bug is fixed now. There're only 2 minor issues left:

  1. The theoretical max of orbital collector isn't correct. In the picture, I had level 8 VU and 180% mining speed. gas the line var collectorsWorkCost = Traverse.Create<PlanetTransport>().Field("collectorsWorkCost").GetValue<double>(); always get 0. Assembly Publicizer can make all fields, methods, etc are public. You can reference the publicize assembly Assembly-CSharp_publicized.dll to directly asscess transport.collectorsWorkCost without using reflection.

  2. The version number should be 1.3.1

mattsemar commented 3 years ago

Ok, the orbital collectors should calculate the max value correctly now. I also changed the version. Thanks for the help debugging @starfi5h

Also updated BetterStats.dll

mattsemar commented 3 years ago

@brokenmass, I think this is all working ok now, can we get it merged and cut a new version?

brokenmass commented 3 years ago

@mattsemar will check and build today, thanks !

brokenmass commented 3 years ago

released 1.3.1