Pulsar4xDevs / Pulsar4x

A Fan work recreation of Aurora4x in C#
Other
160 stars 67 forks source link

Rewrite the JsonDataEditor #71

Open se5a opened 9 years ago

se5a commented 9 years ago

Intercross Created an Editor to help with the Tech files, this would be good if it were expanded to cover other json data files, and have it show links between requirements etc.

intercross21 commented 9 years ago

kk

se5a commented 9 years ago

I've added a few smaller generic controls which will be the same across the different datafiles. They're not fully working yet, most of them get the info they require already, but none of them export it or however that's handled. They're all in the installation window, though the arrangement/layout needs some love.

se5a commented 9 years ago

ok so the installation window seems to display all the info it needs to, load installation, mineral and tech files, open the installation window and double click an installation in the left panel. but:
1: If you open the installations window, then load all the datafiles nothing shows. you have to load the datafiles before opening the window. don't know why this is... this is because I wasn't giving the listbox a new datasource when the binding list was recreated. if you replace the bindinglist with a new bindinglist you have to listbox1.datasource = bindinglist again.

2: it will crash if you don't load all the files. (looking for guid that are not loaded)
3: nothing in the way of saving data yet. saves new but doesn't update.
4: This is an odd one which has me stumped. the TechRequrementsUC works fine in the installation panel, but if you try add this control to another the winforms designer throws up some errors about serialisation. I don't know whats up with this since it's working fine in the installation panel. fixed this by doing this: http://stackoverflow.com/questions/4973506/failed-to-create-component-type-is-not-marked-as-serializable I still don't fully understand what the problem is/was/why the other controls don't have a problem with it, but it's fixed.

se5a commented 9 years ago

5: Abilities and mineral cost UCs are editable, but the edit doesnt stick. this should be fixed now, datagrids are the most horrible thing to work with ever. avoid if at all possible. seriously why is a 2d data view so godamn hard? I had to jump through hoops to get the dictionary into the datagridvew and then edited data back into the dictionary.

se5a commented 9 years ago

I'm a little unsure about the file path in this.

each SD type has a DataHandlerAndEvents of it's own. ie:

public static DataHolderAndEvents<TechSD> TechData = new DataHolderAndEvents<TechSD>("Techs");
public static DataHolderAndEvents<InstallationSD> InstallationData = new DataHolderAndEvents<InstallationSD>("Installations");
public static DataHolderAndEvents<MineralSD> MineralData = new DataHolderAndEvents<MineralSD>("Minerals"); 

each of these have a

private List<string> _loadedFiles = new List<string>();

However, the way that strings are added to teh above list, it's adding it to each of the DataHolderAndEvents. so:

Data.InstallationData.GetLoadedFiles()

returns a list with InstallationData.Json, TechData.Json, and Minerals.Json.

se5a commented 9 years ago

hey look over there! some progress!

component window is just about done. nothing is done saving side there though. installation window needs checking as far as that goes.

6: need to check saving new. 7: need to check updating old. 8: need to check clearing data and creating from scratch. 9: need to add mineral costs to component window, and more importantly the component ability SD. it'll need to be a list of dictionaries. or a dictionary of lists... that's going to be a pain to display in the propertygrid. 10: need to look at the Data class. I think we might/should be able to use the ecslib datastore to do more of the work for us here. like, loading all the files.

se5a commented 9 years ago

Right, so I've gutted the Data class here compleatly, it now works off the ecslib StaticDataManager, which will ensure that stuff is saved as per how the StaticDataManager wants it. I've lost some functionality, there's some events that are no longer there... and the components window is the only one showing anything now. it also exports and imports per directory. the directory form in winforms is horrible though.

but it builds. and runs. if someone else wants to help out getting this whole thing back up and working here...

se5a commented 9 years ago

Wonder if we should put this on hold till we've nailed down the StaticData a bit more. I've just changed the TechSD, as well as compleatly re-written the componentSD stuff. so we've gone backwards with this.

Auranis commented 8 years ago

Gearing up to start refactoring the old JsonDataEditor over to the new, MVVM-format JsonDataEditor2.

se5a commented 8 years ago

Take a look at how I've done the colony screen if you get stuck with the binding or layout. On 9 Oct 2015 8:32 am, "Auranis" notifications@github.com wrote:

Gearing up to start refactoring the old JsonDataEditor over to the new, MVVM-format JsonDataEditor2.

— Reply to this email directly or view it on GitHub.

se5a commented 4 years ago

Ouch, this one is way out of date, and no longer exists in the current UI. needs to be re-written for the current ui. Unless we keep the old one as a completely separate tool, using the old ui.