|
| 1 | +//using Microsoft.Xna.Framework.Graphics; |
| 2 | +//using ReLogic.Content; |
| 3 | +//using Terraria.UI; |
| 4 | + |
| 5 | +//namespace ModReloader.Common.Configs.ConfigElements.PlayerAndWorld; |
| 6 | + |
| 7 | +//public class WorldPreviewElement : UIElement |
| 8 | +//{ |
| 9 | +// private readonly Asset<Texture2D> _BorderTexture; |
| 10 | + |
| 11 | +// private readonly Asset<Texture2D> _BackgroundExpertTexture; |
| 12 | + |
| 13 | +// private readonly Asset<Texture2D> _BackgroundNormalTexture; |
| 14 | + |
| 15 | +// private readonly Asset<Texture2D> _BackgroundMasterTexture; |
| 16 | + |
| 17 | +// private readonly Asset<Texture2D> _BunnyExpertTexture; |
| 18 | + |
| 19 | +// private readonly Asset<Texture2D> _BunnyNormalTexture; |
| 20 | + |
| 21 | +// private readonly Asset<Texture2D> _BunnyCreativeTexture; |
| 22 | + |
| 23 | +// private readonly Asset<Texture2D> _BunnyMasterTexture; |
| 24 | + |
| 25 | +// private readonly Asset<Texture2D> _EvilRandomTexture; |
| 26 | + |
| 27 | +// private readonly Asset<Texture2D> _EvilCorruptionTexture; |
| 28 | + |
| 29 | +// private readonly Asset<Texture2D> _EvilCrimsonTexture; |
| 30 | + |
| 31 | +// private readonly Asset<Texture2D> _SizeSmallTexture; |
| 32 | + |
| 33 | +// private readonly Asset<Texture2D> _SizeMediumTexture; |
| 34 | + |
| 35 | +// private readonly Asset<Texture2D> _SizeLargeTexture; |
| 36 | + |
| 37 | +// private byte _difficulty; |
| 38 | + |
| 39 | +// private byte _evil; |
| 40 | + |
| 41 | +// private byte _size; |
| 42 | + |
| 43 | +// public WorldPreviewElement() |
| 44 | +// { |
| 45 | +// _BorderTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewBorder"); |
| 46 | +// _BackgroundNormalTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyNormal1"); |
| 47 | +// _BackgroundExpertTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyExpert1"); |
| 48 | +// _BackgroundMasterTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyMaster1"); |
| 49 | +// _BunnyNormalTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyNormal2"); |
| 50 | +// _BunnyExpertTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyExpert2"); |
| 51 | +// _BunnyCreativeTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyCreative2"); |
| 52 | +// _BunnyMasterTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewDifficultyMaster2"); |
| 53 | +// _EvilRandomTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewEvilRandom"); |
| 54 | +// _EvilCorruptionTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewEvilCorruption"); |
| 55 | +// _EvilCrimsonTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewEvilCrimson"); |
| 56 | +// _SizeSmallTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewSizeSmall"); |
| 57 | +// _SizeMediumTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewSizeMedium"); |
| 58 | +// _SizeLargeTexture = Main.Assets.Request<Texture2D>("Images/UI/WorldCreation/PreviewSizeLarge"); |
| 59 | +// Width.Set(_BackgroundExpertTexture.Width(), 0f); |
| 60 | +// Height.Set(_BackgroundExpertTexture.Height(), 0f); |
| 61 | +// } |
| 62 | + |
| 63 | +// public void UpdateOption(byte difficulty, byte evil, byte size) |
| 64 | +// { |
| 65 | +// _difficulty = difficulty; |
| 66 | +// _evil = evil; |
| 67 | +// _size = size; |
| 68 | +// } |
| 69 | + |
| 70 | +// protected override void DrawSelf(SpriteBatch spriteBatch) |
| 71 | +// { |
| 72 | +// CalculatedStyle dims = GetDimensions(); |
| 73 | +// Rectangle target = new Rectangle( |
| 74 | +// (int)dims.X, |
| 75 | +// (int)dims.Y, |
| 76 | +// (int)dims.Width, |
| 77 | +// (int)dims.Height |
| 78 | +// ); |
| 79 | + |
| 80 | +// Color color = Color.White; |
| 81 | + |
| 82 | +// // Pick background based on difficulty |
| 83 | +// Texture2D bg = _BackgroundNormalTexture.Value; |
| 84 | +// switch (_difficulty) |
| 85 | +// { |
| 86 | +// case 1: |
| 87 | +// bg = _BackgroundExpertTexture.Value; |
| 88 | +// color = Color.DarkGray; |
| 89 | +// break; |
| 90 | +// case 2: |
| 91 | +// bg = _BackgroundMasterTexture.Value; |
| 92 | +// color = Color.DarkGray; |
| 93 | +// break; |
| 94 | +// case 3: |
| 95 | +// bg = _BackgroundNormalTexture.Value; |
| 96 | +// color = Color.White; |
| 97 | +// break; |
| 98 | +// } |
| 99 | + |
| 100 | +// // Draw each layer scaled into target rectangle |
| 101 | +// spriteBatch.Draw(bg, target, Color.White); |
| 102 | + |
| 103 | +// Texture2D sizeTex = _SizeSmallTexture.Value; |
| 104 | +// if (_size == 1) sizeTex = _SizeMediumTexture.Value; |
| 105 | +// else if (_size == 2) sizeTex = _SizeLargeTexture.Value; |
| 106 | +// spriteBatch.Draw(sizeTex, target, color); |
| 107 | + |
| 108 | +// Texture2D evilTex = _EvilRandomTexture.Value; |
| 109 | +// if (_evil == 1) evilTex = _EvilCorruptionTexture.Value; |
| 110 | +// else if (_evil == 2) evilTex = _EvilCrimsonTexture.Value; |
| 111 | +// spriteBatch.Draw(evilTex, target, color); |
| 112 | + |
| 113 | +// Texture2D bunnyTex = _BunnyNormalTexture.Value; |
| 114 | +// if (_difficulty == 1) bunnyTex = _BunnyExpertTexture.Value; |
| 115 | +// else if (_difficulty == 2) bunnyTex = _BunnyMasterTexture.Value; |
| 116 | +// else if (_difficulty == 3) bunnyTex = _BunnyCreativeTexture.Value; |
| 117 | +// spriteBatch.Draw(bunnyTex, target, color); |
| 118 | + |
| 119 | +// spriteBatch.Draw(_BorderTexture.Value, target, Color.White); |
| 120 | +// } |
| 121 | +//} |
0 commit comments