1
1
using Blocktest . Rendering ;
2
+ using Shared . Code . Block_System ;
3
+ namespace Blocktest . Block_System ;
2
4
3
- namespace Blocktest
4
- {
5
- /// <summary>
6
- /// Handles sprites for blocks.
7
- /// </summary>
8
- public class BlockSprites
9
- {
10
- /// <summary> Shared block info </summary>
11
- public BlockShared blockShared ;
5
+ /// <summary>
6
+ /// Handles sprites for blocks.
7
+ /// </summary>
8
+ public sealed class BlockSprites {
9
+ /// <summary> Shared block info </summary>
10
+ public BlockShared BlockShared ;
12
11
13
- /// <summary> The block's sprite. </summary>
14
- public Drawable blockSprite ;
12
+ /// <summary> The block's sprite. </summary>
13
+ public Drawable BlockSprite ;
15
14
16
- /// <summary> The sprite sheet used for smoothing the block. </summary>
17
- public SpriteSheet spriteSheet ;
15
+ /// <summary> The sprite sheet used for smoothing the block. </summary>
16
+ public SpriteSheet SpriteSheet ;
18
17
19
- /* METHODS */
18
+ /* METHODS */
20
19
21
- public BlockSprites ( BlockShared newBlockShared , ContentManager content )
22
- {
23
- blockShared = newBlockShared ;
24
- LoadSprite ( content ) ;
25
- }
20
+ public BlockSprites ( BlockShared newBlockShared , ContentManager content ) {
21
+ BlockShared = newBlockShared ;
22
+ LoadSprite ( content ) ;
23
+ }
26
24
27
- /// <summary>
28
- /// Called when the block is created by the block sprites manager.
29
- /// </summary>
30
- /// <remarks>
31
- /// DO NOT FORGET TO CALL THE BASE METHOD IF YOU OVERRIDE THIS.
32
- /// </remarks>
33
- public virtual void LoadSprite ( ContentManager content )
34
- {
35
- string path = @"Graphics\Blocks\" + blockShared . blockName . ToLower ( ) . Replace ( " " , "" ) ;
36
- try {
37
- blockSprite = new Drawable ( path , new Rectangle ( 1 , 1 , 10 , 10 ) ) ; //this might need to be expanded in the future in case we decide to make use of the full 12x12 tiles on our spritesheets
38
- /*if (!blockShared.blockSmoothing) {
39
- return;
40
- }*/
41
- spriteSheet = new SpriteSheet ( path , 4 , 4 , 1 ) ;
42
- if ( spriteSheet . OrderedSprites . Length <= 1 ) {
43
- Console . WriteLine ( "Block " + this + " is marked as smoothable, but a sprite sheet could not be found at " + path + "!" ) ;
44
- }
45
- }
46
- catch ( ContentLoadException ) {
47
- blockSprite = new Drawable ( @"Graphics\Blocks\error" ) ;
48
- Console . WriteLine ( "Block " + this + " does not have an icon at " + path + "!" ) ;
25
+ /// <summary>
26
+ /// Called when the block is created by the block sprites manager.
27
+ /// </summary>
28
+ /// <remarks>
29
+ /// DO NOT FORGET TO CALL THE BASE METHOD IF YOU OVERRIDE THIS.
30
+ /// </remarks>
31
+ public void LoadSprite ( ContentManager content ) {
32
+ string path = @"Graphics\Blocks\" + BlockShared . BlockName . ToLower ( ) . Replace ( " " , "" ) ;
33
+ try {
34
+ BlockSprite =
35
+ new Drawable ( path ,
36
+ new Rectangle ( 1 , 1 , 10 ,
37
+ 10 ) ) ; //this might need to be expanded in the future in case we decide to make use of the full 12x12 tiles on our spritesheets
38
+ /*if (!blockShared.blockSmoothing) {
39
+ return;
40
+ }*/
41
+ SpriteSheet = new SpriteSheet ( path , 4 , 4 , 1 ) ;
42
+ if ( SpriteSheet . OrderedSprites . Length <= 1 ) {
43
+ Console . WriteLine ( "Block " +
44
+ this +
45
+ " is marked as smoothable, but a sprite sheet could not be found at " +
46
+ path +
47
+ "!" ) ;
49
48
}
50
49
}
50
+ catch ( ContentLoadException ) {
51
+ BlockSprite = new Drawable ( @"Graphics\Blocks\error" ) ;
52
+ Console . WriteLine ( "Block " + this + " does not have an icon at " + path + "!" ) ;
53
+ }
51
54
}
52
- }
55
+ }
0 commit comments