File tree Expand file tree Collapse file tree 3 files changed +89
-0
lines changed
Expand file tree Collapse file tree 3 files changed +89
-0
lines changed Original file line number Diff line number Diff line change 1+ using System . Collections ;
2+
3+ namespace ModuleManager
4+ {
5+ class Fix16 : LoadingSystem
6+ {
7+ private void Awake ( )
8+ {
9+ if ( Instance != null )
10+ {
11+ DestroyImmediate ( this ) ;
12+ return ;
13+ }
14+
15+ Instance = this ;
16+ DontDestroyOnLoad ( gameObject ) ;
17+ }
18+
19+ private static Fix16 Instance { get ; set ; }
20+
21+ private bool ready ;
22+
23+ private int count ;
24+
25+ private int current ;
26+
27+ private const int yieldStep = 20 ;
28+
29+ public override bool IsReady ( )
30+ {
31+ return ready ;
32+ }
33+
34+ public override string ProgressTitle ( )
35+ {
36+ return "Fix 1.6.0 " + current + "/" + count ;
37+ }
38+
39+ public override float ProgressFraction ( )
40+ {
41+ return ( float ) current / count ;
42+ }
43+
44+ public override void StartLoad ( )
45+ {
46+ ready = false ;
47+
48+ count = PartLoader . LoadedPartsList . Count ;
49+
50+ StartCoroutine ( DoFix ( ) ) ;
51+ }
52+
53+ private IEnumerator DoFix ( )
54+ {
55+ int yieldCounter = 0 ;
56+ for ( current = 0 ; current < count ; current ++ )
57+ {
58+ AvailablePart avp = PartLoader . LoadedPartsList [ current ] ;
59+ if ( avp . partPrefab . dragModel == Part . DragModel . CUBE && ! avp . partPrefab . DragCubes . Procedural &&
60+ ! avp . partPrefab . DragCubes . None && avp . partPrefab . DragCubes . Cubes . Count == 0 )
61+ {
62+ DragCubeSystem . Instance . LoadDragCubes ( avp . partPrefab ) ;
63+ }
64+
65+ if ( yieldCounter ++ >= yieldStep )
66+ {
67+ yieldCounter = 0 ;
68+ yield return null ;
69+ }
70+ }
71+
72+ ready = true ;
73+ yield return null ;
74+ }
75+
76+ public override float LoadWeight ( )
77+ {
78+ return 0.1f ;
79+ }
80+ }
81+ }
Original file line number Diff line number Diff line change @@ -118,6 +118,13 @@ internal void Awake()
118118
119119 int gameDatabaseIndex = list . FindIndex ( s => s is GameDatabase ) ;
120120 list . Insert ( gameDatabaseIndex + 1 , loader ) ;
121+
122+ // Workaround for 1.6.0 Editor bug after a PartDatabase rebuild.
123+ if ( Versioning . version_major == 1 && Versioning . version_minor == 6 && Versioning . Revision == 0 )
124+ {
125+ Fix16 fix16 = aGameObject . AddComponent < Fix16 > ( ) ;
126+ list . Add ( fix16 ) ;
127+ }
121128 }
122129
123130 bool foolsDay = ( DateTime . Now . Month == 4 && DateTime . Now . Day == 1 ) ;
Original file line number Diff line number Diff line change 3232 <ConsolePause >False</ConsolePause >
3333 </PropertyGroup >
3434 <ItemGroup >
35+ <Compile Include =" Fix16.cs" />
3536 <Compile Include =" Cats\CatAnimator.cs" />
3637 <Compile Include =" Cats\CatManager.cs" />
3738 <Compile Include =" Cats\CatMover.cs" />
You can’t perform that action at this time.
0 commit comments