11using DiskCardGame ;
2- using System ;
32using System . Linq ;
4- using HarmonyLib ;
5- using Mono . Collections . Generic ;
6- using Sirenix . Serialization . Utilities ;
73using UnityEngine ;
8- using System . Diagnostics . CodeAnalysis ;
94using System . Collections . Generic ;
105
116namespace InscryptionAPI . Challenges
@@ -26,16 +21,10 @@ public class AscensionChallengePaginator : MonoBehaviour
2621
2722 public List < List < bool > > pageStates = new ( ) ;
2823
29- public void GeneratePages ( )
24+ private void PageBuilder ( List < AscensionChallengeInfo > challenges , int startIdx )
3025 {
31- // The first page is nice and easy
32- List < AscensionChallengeInfo > pageOne = new List < AscensionChallengeInfo > ( ) ;
33- pageOne . AddRange ( availableChallenges . GetRange ( 0 , 14 ) ) ;
34- pages . Add ( pageOne ) ;
35-
36- // The rest get more challenging
3726 List < AscensionChallengeInfo > curPage = new List < AscensionChallengeInfo > ( ) ;
38- for ( int i = 14 ; i < availableChallenges . Count ; i ++ )
27+ for ( int i = startIdx ; i < challenges . Count ; i ++ )
3928 {
4029 // Check to see if we need a new page
4130 if ( curPage . Count == 14 )
@@ -47,13 +36,31 @@ public void GeneratePages()
4736 // Check to see if we need a blank buffer
4837 // This happens if the next icon is the same as the current, and the
4938 // current icon would be on the bottom row
50- if ( i < availableChallenges . Count - 1 && availableChallenges [ i + 1 ] . challengeType == availableChallenges [ i ] . challengeType && curPage . Count % 2 == 1 )
39+ if ( i < challenges . Count - 1 && challenges [ i + 1 ] . challengeType == challenges [ i ] . challengeType && curPage . Count % 2 == 1 )
5140 curPage . Add ( null ) ;
5241
53- curPage . Add ( availableChallenges [ i ] ) ;
42+ curPage . Add ( challenges [ i ] ) ;
5443 }
55-
5644 pages . Add ( curPage ) ;
45+ }
46+
47+ public void GeneratePages ( )
48+ {
49+ // The first page is nice and easy
50+ List < AscensionChallengeInfo > pageOne = new List < AscensionChallengeInfo > ( ) ;
51+ pageOne . AddRange ( availableChallenges . GetRange ( 0 , 14 ) ) ;
52+ pages . Add ( pageOne ) ;
53+
54+ // Do the challenges first:
55+ List < AscensionChallengeInfo > challenges = availableChallenges . Where ( i => i . pointValue > 0 ) . ToList ( ) ;
56+ List < AscensionChallengeInfo > assists = availableChallenges . Where ( i => i . pointValue < 0 ) . ToList ( ) ;
57+
58+ // Do the challenges
59+ if ( challenges . Count > 14 )
60+ PageBuilder ( challenges , 14 ) ;
61+
62+ if ( assists . Count > 0 )
63+ PageBuilder ( assists , 0 ) ;
5764
5865 while ( pageStates . Count < pages . Count )
5966 {
0 commit comments