@@ -71,29 +71,37 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
7171 List < AscensionChallengeInfo > bossChallengeInfos = challengeInfos . FindAll ( x => x . challengeType . GetFullChallenge ( ) . Boss ) ;
7272
7373 // keep track of the number of bosses that are on this page, and account for them when determining how many icons to create
74- int numBosses = challengeInfos . Count ( x => x . challengeType . GetFullChallenge ( ) . Boss ) ;
74+ int numBosses = bossChallengeInfos . Count ;
7575 int numIcons = Mathf . Min ( 14 , challengeObjectsForPages [ 0 ] . Count ) - numBosses ;
7676
7777 // the list index when we begin adding boss icons
7878 int bossStartingIndex = ( 1 + regularChallengeInfos . Count ) / 2 ;
7979 int numBossesAdded = 0 ;
8080
81- //Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count}");
81+ // 14 = regular + boss * 2
82+ //Debug.Log($"NumIcons for Page: {numIcons}: {regularChallengeInfos.Count} {bossChallengeInfos.Count} | {bossStartingIndex}");
8283
8384 for ( int i = 0 ; i < 14 ; i ++ )
8485 {
8586 GameObject objectRef = null ;
8687
87- if ( i % 7 < bossStartingIndex + numBosses && i % 7 >= bossStartingIndex )
88+ int columnIndex = i % 7 ;
89+ //Debug.Log($"{i} ({columnIndex}) | {bossStartingIndex + numBosses} / {bossStartingIndex}");
90+
91+ if ( columnIndex >= bossStartingIndex && columnIndex < bossStartingIndex + numBosses )
8892 {
93+ //Debug.Log($"In boss column {i}");
8994 if ( numBossesAdded < numBosses )
9095 {
96+ //Debug.Log($"Use boss icon");
9197 numBossesAdded ++ ;
9298 objectRef = challengeObjectsForPages [ 0 ] [ 14 ] ;
9399 }
94100 else
95101 {
96- i += numBosses ;
102+ //Debug.Log($"Skip to end");
103+ i += numBosses - 1 ; // account for loop iteration
104+ continue ;
97105 }
98106 }
99107
@@ -117,21 +125,22 @@ public void AddPage(List<AscensionChallengeInfo> challengeInfos)
117125 int infoCount = challengeInfos . Count ;
118126 for ( int i = 0 ; i < newPage . Count ; i ++ )
119127 {
120- //Debug.Log($"Checking icon [{i}] info { infoIdx}") ;
128+ AscensionChallengeInfo info = challengeInfos [ infoIdx ] ;
121129 AscensionIconInteractable interactable = newPage [ i ] . GetComponent < AscensionIconInteractable > ( ) ;
122-
130+ //Debug.Log($"Checking icon [{i}] info at {infoIdx} : {info.title}");
123131 if ( i < infoCount )
124132 {
125133 // if we're assigning boss info to an icon that isn't a boss icon
126- if ( challengeInfos [ infoIdx ] . GetFullChallenge ( ) . Boss && ( interactable . coll2D as BoxCollider2D ) . size . y < 1f )
134+ if ( info . GetFullChallenge ( ) . Boss && ( interactable . coll2D as BoxCollider2D ) . size . y < 1f )
127135 {
136+ //Debug.Log("Boss error: y < 1");
128137 interactable . challengeInfo = missingChallengeInfo ;
129138 newPage [ i ] . AddComponent < NoneChallengeDisplayer > ( ) ;
130139 infoCount ++ ;
131140 }
132141 else
133142 {
134- interactable . challengeInfo = challengeInfos [ infoIdx ] ;
143+ interactable . challengeInfo = info ;
135144 infoIdx ++ ;
136145 }
137146 }
0 commit comments