@@ -10,6 +10,8 @@ internal class DressCodeControl : MonoBehaviour {
1010 private static readonly Vector2 ScopeListSize = new ( 144 , 925 ) ;
1111 private static readonly Vector2 MaidListSize = new ( 502 , 925 ) ;
1212
13+ private static SelectionState _selectionState ;
14+
1315 private SceneList _sceneList ;
1416 private ScopeList _scopeList ;
1517 private MaidSelectPanel _maidSelectPanel ;
@@ -18,7 +20,6 @@ internal class DressCodeControl : MonoBehaviour {
1820 private DressCodeManager m_mgr ;
1921 private GameObject m_goPanel ;
2022
21-
2223 public CostumeScene SelectedScene {
2324 get => _sceneList . SelectedValue ;
2425 set => _sceneList . SelectValue ( value ) ;
@@ -86,10 +87,20 @@ public void Init(DressCodeManager manager, CanvasComponent panel) {
8687 }
8788
8889 public void CreateSelector ( ) {
89- SelectedScope = ProfileScope . Scene ;
90+ var previousSelection = _selectionState ;
9091 _maidSelectPanel . Initialize ( ) ;
92+ if ( previousSelection != null ) {
93+ SelectedScene = previousSelection . Scene ;
94+ SelectedScope = previousSelection . Scope ;
95+ SelectedMaid = previousSelection . Maid ;
96+ } else {
97+ SelectedScope = ProfileScope . Scene ;
98+ _sceneList . SelectFirstAvailable ( ) ;
99+ }
91100 }
92101
102+ internal void ResetSelections ( ) => _selectionState = null ;
103+
93104 private void SetSceneMode ( ) {
94105 _maidSelectPanel . SetActive ( false ) ;
95106 _profilePanel . SetSceneMode ( ) ;
@@ -114,11 +125,16 @@ private void UpdateScopeSelection() {
114125
115126 private void UpdateMaidSelection ( ) {
116127 _sceneList . SetNpcMode ( SelectedScope == ProfileScope . Maid && SelectedMaid . status . heroineType is not ( MaidStatus . HeroineType . Original or MaidStatus . HeroineType . Transfer ) ) ;
117- _sceneList . SelectFirstAvailable ( ) ;
128+ _sceneList . SelectFirstAvailable ( SelectedScene ) ;
118129 UpdateProfileSelection ( ) ;
119130 }
120131
121132 private void UpdateProfileSelection ( ) {
133+ _selectionState = new ( ) {
134+ Scene = SelectedScene ,
135+ Scope = SelectedScope ,
136+ Maid = SelectedMaid ,
137+ } ;
122138 var profile = SelectedScope switch {
123139 ProfileScope . Scene => DressCode . GetPreferredProfile ( SelectedScene ) ,
124140 ProfileScope . Maid => DressCode . GetPreferredProfile ( SelectedMaid , SelectedScene ) ,
@@ -148,4 +164,10 @@ private void OnProfileChanged(object sender, ProfilePanel.ProfileSelectedEventAr
148164 }
149165 }
150166 }
167+
168+ class SelectionState {
169+ public CostumeScene Scene { get ; set ; }
170+ public ProfileScope Scope { get ; set ; }
171+ public Maid Maid { get ; set ; }
172+ }
151173}
0 commit comments