Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use SerializableUIOptionBase for all options. #1510

Closed
kianzarrin opened this issue Apr 4, 2022 · 3 comments · Fixed by #1512 or #1531
Closed

use SerializableUIOptionBase for all options. #1510

kianzarrin opened this issue Apr 4, 2022 · 3 comments · Fixed by #1512 or #1531
Labels
code cleanup Refactor code, remove old code, improve maintainability Settings Road config, mod options, config xml
Milestone

Comments

@kianzarrin
Copy link
Collaborator

there are still some UI options that are not using the SerializableUIOptionBase . Specially drop downs that use Enums.
For more flexibility all options should use SerializableUIOptionBase .

@kianzarrin kianzarrin added feature A new distinct feature triage Awaiting issue categorisation labels Apr 4, 2022
@kianzarrin kianzarrin added duplicate Duplicate of existing issue and removed feature A new distinct feature triage Awaiting issue categorisation labels Apr 4, 2022
@kianzarrin kianzarrin reopened this Apr 4, 2022
@kianzarrin kianzarrin added Settings Road config, mod options, config xml enhancement Improve existing feature code cleanup Refactor code, remove old code, improve maintainability and removed duplicate Duplicate of existing issue enhancement Improve existing feature labels Apr 4, 2022
@originalfoo originalfoo added this to the 11.6.5.2 milestone Apr 4, 2022
@kianzarrin
Copy link
Collaborator Author

@aubergine10 Also noticed 2 drop-downs not yet converted in GeneralTab_LocalisationGroup.cs:

  • language
  • road sign theme

I did some investigation on how to do this in https://github.com/CitiesSkylinesMods/TMPE/tree/DropDownOption2
But I realised that its not worth doing it because:

  • it is not help Allow main menu to set options for new games #363
  • drop down items use different translator than label
  • global options have no need of the ILegacySerializableOption.Load()/Save() stuff
  • The code in GeneralTab_LocalisationGroup does not get simplified at all.

@krzychu124
Copy link
Member

Hot-reload stopped working... (this._ui is null)

image

Stacktrace

NullReferenceException: Object reference not set to an instance of an object
  at TrafficManager.UI.Helpers.DropDownOption`1[TrafficManager.API.Traffic.Enums.SimulationAccuracy].set_Value (SimulationAccuracy value) [0x00000] in <filename unknown>:0 
  at TrafficManager.UI.Helpers.DropDownOption`1[TrafficManager.API.Traffic.Enums.SimulationAccuracy].Load (Byte data) [0x00000] in <filename unknown>:0 
  at TrafficManager.Manager.Impl.OptionsManager.ToDropDown[SimulationAccuracy] (System.Byte[] data, UInt32 idx, ILegacySerializableOption opt, SimulationAccuracy defaultVal) [0x00000] in <filename unknown>:0 
  at TrafficManager.Manager.Impl.OptionsManager.LoadData (System.Byte[] data) [0x00000] in <filename unknown>:0 
UnityEngine.DebugLogHandler:Internal_LogException(Exception, Object)
UnityEngine.DebugLogHandler:LogException(Exception, Object)
UnityEngine.Logger:LogException(Exception, Object)
UnityEngine.Debug:LogException(Exception)
TrafficManager.Util.Shortcuts:LogException(Exception, Boolean)
TrafficManager.Manager.Impl.OptionsManager:LoadData(Byte[])
TrafficManager.Lifecycle.SerializableDataExtension:Load()
TrafficManager.Lifecycle.TMPELifecycle:Awake()
UnityEngine.GameObject:Internal_AddComponentWithType(Type)
UnityEngine.GameObject:AddComponent(Type)
UnityEngine.GameObject:.ctor(String, Type[])
TrafficManager.Lifecycle.TMPELifecycle:StartMod()
TrafficManager.Lifecycle.TrafficManagerMod:OnEnabled()
System.Reflection.MonoMethod:InternalInvoke(Object, Object[], Exception&)
System.Reflection.MonoMethod:Invoke(Object, BindingFlags, Binder, Object[], CultureInfo)
System.Reflection.MethodBase:Invoke(Object, Object[])
ColossalFramework.Plugins.PluginManager:AddPlugins(Dictionary`2)
ColossalFramework.Plugins.PluginManager:LoadPluginAtPath(String, Boolean, PublishedFileId)
ColossalFramework.Plugins.PluginManager:OnPluginAdded(String)
ColossalFramework.Plugins.<>c__DisplayClass20:<OnFileWatcherEventChanged>b__1a()
ColossalFramework.Threading.<>c__DisplayClass4:<CreateSafeAction>b__3()
ColossalFramework.Threading.<>c__DisplayClassa:<.ctor>b__8(Task)
ColossalFramework.Threading.Task`1:Execute()
ColossalFramework.Threading.Task:InternalExecute()
ColossalFramework.Threading.Dispatcher:RunTask(Task)
ColossalFramework.Threading.Dispatcher:ProcessSingleTask(Task)
ColossalFramework.Threading.Dispatcher:InternalProcessTasks()
ColossalFramework.Threading.Dispatcher:ProcessTasks()

@kianzarrin
Copy link
Collaborator Author

ill put a guard

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code cleanup Refactor code, remove old code, improve maintainability Settings Road config, mod options, config xml
Projects
None yet
3 participants