1- using System ;
2- using System . Linq ;
3- using AET . ModVerify . Reporting ;
1+ using AET . ModVerify . Reporting ;
42using PG . StarWarsGame . Engine . CommandBar ;
5- using PG . StarWarsGame . Engine . CommandBar . Components ;
3+ using System . Linq ;
4+ using System . Threading ;
65
76namespace AET . ModVerify . Verifiers . CommandBar ;
87
98partial class CommandBarVerifier
109{
11- private void VerifyCommandBarComponents ( )
10+ private void VerifyCommandBarComponents ( CancellationToken token , double startProgress )
1211 {
1312 var occupiedComponentIds = SupportedCommandBarComponentData
1413 . GetComponentIdsForEngine ( Repository . EngineType ) . Keys
1514 . ToDictionary ( value => value , _ => false ) ;
1615
16+ var counter = 0 ;
17+ var numEntities = GameEngine . CommandBar . Components . Count ;
18+ var num = 1 - startProgress ;
19+
1720 foreach ( var component in GameEngine . CommandBar . Components )
1821 {
22+ var progress = num + ( ++ counter / ( double ) numEntities ) * startProgress ;
23+ OnProgress ( progress , $ "CommandBarComponent - '{ component . Name } '") ;
24+
1925 if ( ! occupiedComponentIds . TryGetValue ( component . Id , out var alreadyOccupied ) )
2026 {
2127 AddError ( VerificationError . Create (
@@ -39,49 +45,7 @@ private void VerifyCommandBarComponents()
3945 component . Name ) ) ;
4046 }
4147
42- VerifySingleComponent ( component ) ;
43- }
44- }
45-
46- private void VerifySingleComponent ( CommandBarBaseComponent component )
47- {
48- VerifyCommandBarModel ( component ) ;
49- VerifyComponentBone ( component ) ;
50- }
51-
52- private void VerifyCommandBarModel ( CommandBarBaseComponent component )
53- {
54- if ( component is not CommandBarShellComponent shellComponent )
55- return ;
56-
57- if ( shellComponent . ModelPath is null )
58- {
59- AddError ( VerificationError . Create ( this ,
60- CommandBarShellNoModel , $ "The CommandBarShellComponent '{ component . Name } ' has no model specified.",
61- VerificationSeverity . Error , shellComponent . Name ) ) ;
62- return ;
63- }
64-
65- var model = GameEngine . PGRender . LoadModelAndAnimations ( shellComponent . ModelPath . AsSpan ( ) , null ) ;
66- if ( model is null )
67- {
68- AddError ( VerificationError . Create ( this ,
69- CommandBarShellNoModel , $ "Could not find model '{ shellComponent . ModelPath } ' for CommandBarShellComponent '{ component . Name } '.",
70- VerificationSeverity . Error , [ shellComponent . Name ] , shellComponent . ModelPath ) ) ;
71- return ;
72- }
73- }
74-
75- private void VerifyComponentBone ( CommandBarBaseComponent component )
76- {
77- if ( component is CommandBarShellComponent )
78- return ;
79-
80- if ( component . Bone == - 1 )
81- {
82- AddError ( VerificationError . Create ( this ,
83- CommandBarShellNoModel , $ "The CommandBar component '{ component . Name } ' is not connected to a shell component.",
84- VerificationSeverity . Warning , component . Name ) ) ;
48+ VerifySingleComponent ( component , token ) ;
8549 }
8650 }
8751}
0 commit comments