@@ -9,7 +9,7 @@ namespace CustomShipLogModes;
99// Heavily based on ShipLogMapMode
1010public class ShipLogItemList : MonoBehaviour
1111{
12- private static GameObject _prefab ;
12+ private static GameObject _prefab ; // This is reset on scene load
1313 private static Transform _commonParent ;
1414
1515 private const int TotalUIItems = 14 ;
@@ -27,6 +27,7 @@ public class ShipLogItemList : MonoBehaviour
2727 public GameObject markOnHUDPromptRoot ;
2828 public ScreenPromptList markHUDPromptList ;
2929
30+ // TODO: Fix this, it isn't working??????!
3031 public UiSizeSetterRectTransform descriptionFieldSizeSetter ;
3132
3233 public int selectedIndex ;
@@ -42,15 +43,15 @@ public static void CreatePrefab(ShipLogMapMode mapMode)
4243 CustomShipLogModes . Instance . ModHelper . Events . Unity . FireOnNextUpdate ( ( ) =>
4344 {
4445 GameObject prefab = Instantiate ( mapMode . gameObject ) ; // TODO: Keep each loop? What about DescriptionField?
45- prefab . name = "ItemsList " ;
46+ prefab . name = "ItemList " ;
4647 ShipLogItemList itemList = prefab . AddComponent < ShipLogItemList > ( ) ;
4748 itemList . oneShotSource = mapMode . _oneShotSource ; // Not serialized, so no in mapModeCopy, and doesn't belong to map mode
4849
4950 // Copy serialized fields from MapMode TODO: Just store map mode?
5051 ShipLogMapMode mapModeCopy = prefab . GetComponent < ShipLogMapMode > ( ) ;
5152 itemList . mapModeAnimator = mapModeCopy . _mapModeAnimator ;
5253 itemList . entryMenuAnimator = mapModeCopy . _entryMenuAnimator ;
53- itemList . photo = mapModeCopy . _photo ;
54+ itemList . photo = mapModeCopy . _photo ; // For now, we would switch to the "mask" bellow
5455 itemList . questionMark = mapModeCopy . _questionMark ;
5556 itemList . entrySelectArrow = mapModeCopy . _entrySelectArrow ;
5657 itemList . nameField = mapModeCopy . _nameField ;
@@ -60,17 +61,30 @@ public static void CreatePrefab(ShipLogMapMode mapMode)
6061
6162 itemList . descriptionFieldSizeSetter = itemList . descriptionField . GetComponent < UiSizeSetterRectTransform > ( ) ;
6263
63- try
64- {
65- itemList . photo . transform . parent . GetComponent < WorldSpaceMask > ( ) . showMaskGraphic = false ;
66- }
67- catch ( Exception e )
64+ // Destroy UI size setters, set to regular before TODO: Changeable?
65+ // This is also IMPORTANT to fix the issue of the vertical expand (without desc field) not working
66+ foreach ( BaseUiSizeSetter sizeSetter in mapModeCopy . GetComponentsInChildren < BaseUiSizeSetter > ( ) )
6867 {
69- // Just in case this is removed in next hotfix (but it will probably disable the graphic like here):
70- // https://discord.com/channels/929708786027999262/929787137895854100/1156019963778314291 (Jeff)
71- CustomShipLogModes . Instance . ModHelper . Console . WriteLine ( "Couldn't disable mask image, ignoring: " + e , MessageType . Error ) ;
68+ if ( ! sizeSetter . _requiresExternalInitialization )
69+ {
70+ // For UiSizeSetterShipLogEntry this would need an entry (for sub entry check0,
71+ // hopefully the already set values are the desired (also for mark on HUD prompt)
72+ sizeSetter . DoResizeAction ( UITextSize . SMALL ) ;
73+ }
74+ Destroy ( sizeSetter ) ;
7275 }
7376
77+ // Photo correction for OW Patch 14
78+ Transform photoMask = itemList . photo . transform . parent ;
79+ RectTransform photoRoot = photoMask . parent as RectTransform ;
80+ RectTransform entryMenu = photoRoot ! . parent as RectTransform ;
81+ photoRoot . sizeDelta = new Vector2 ( entryMenu ! . sizeDelta . y , 0 ) ; // It was 320 instead of 315, not square!!! Important to do after the resizing!
82+ Destroy ( photoMask . GetComponent < WorldSpaceMask > ( ) ) ; // Important to get rid of NRE
83+ photoMask . name = itemList . photo . name ;
84+ Destroy ( itemList . photo . gameObject ) ;
85+ itemList . photo = photoMask . GetComponent < Image > ( ) ;
86+ // We have (-3, -3) sizeDelta, idk, maybe for the border? I see some gaps, but if I disable, looks uglu in reels...
87+
7488 // By default disabled
7589 itemList . questionMark . gameObject . SetActive ( false ) ;
7690 itemList . photo . gameObject . SetActive ( false ) ; // TODO: Get parent?
@@ -105,25 +119,13 @@ public static void CreatePrefab(ShipLogMapMode mapMode)
105119 Destroy ( mapModeCopy . _scaleRoot . gameObject ) ;
106120 Destroy ( mapModeCopy . _reticleAnimator . gameObject ) ;
107121 Destroy ( mapModeCopy ) ;
108-
109- // Destroy UI size setters, set to regular before TODO: Changeable?
110- // This is also IMPORTANT to fix the issue of the vertical expand (without desc field) not working
111- foreach ( BaseUiSizeSetter sizeSetter in mapModeCopy . GetComponentsInChildren < BaseUiSizeSetter > ( ) )
112- {
113- if ( ! sizeSetter . _requiresExternalInitialization )
114- {
115- // For UiSizeSetterShipLogEntry this would need an entry (for sub entry check0,
116- // hopefully the already set values are the desired (also for mark on HUD prompt)
117- sizeSetter . DoResizeAction ( UITextSize . SMALL ) ;
118- }
119- Destroy ( sizeSetter ) ;
120- }
121122
122123 // Parent object for all item lists
123- GameObject commonParentGo = new GameObject ( "ItemsListsParent " , typeof ( RectTransform ) ) ;
124+ GameObject commonParentGo = new GameObject ( "ItemListsParent " , typeof ( RectTransform ) ) ;
124125 _commonParent = commonParentGo . transform ;
125126 _commonParent . parent = mapMode . transform . parent ;
126127 _commonParent . localScale = Vector3 . one ;
128+ // TODO: Improve this, group of item lists after vanilla modes
127129 // We want to see the prompts on top of the modes! Don't use the upper right one here, since it's the one for Map Mode
128130 mapMode . _centerPromptList . transform . parent . SetAsLastSibling ( ) ;
129131
0 commit comments