@@ -20,7 +20,11 @@ public class SplitStackWindowButtonEvent : UnityEvent<SplitStackWindow> { }
2020 private Appearances . ObjectInstance _objectInstance = null ;
2121 private int _objectAmount = 0 ;
2222 private int _selectedAmount = 0 ;
23-
23+
24+ private int _screenWidth = 0 ;
25+ private int _screenHeight = 0 ;
26+ private Vector2 _screenZoom ;
27+
2428 private RenderTexture _renderTexture = null ;
2529
2630 public SplitStackWindowButtonEvent onOk ;
@@ -85,6 +89,16 @@ protected override void Start() {
8589 onOk = new SplitStackWindowButtonEvent ( ) ;
8690 }
8791
92+ protected void Update ( ) {
93+ if ( Screen . width != _screenWidth || Screen . height != _screenHeight ) {
94+ _screenWidth = Screen . width ;
95+ _screenHeight = Screen . height ;
96+ _screenZoom = new Vector2 ( Screen . width / ( float ) Constants . FieldSize , Screen . height / ( float ) Constants . FieldSize ) ;
97+ if ( ! ! _objectInstance )
98+ _objectInstance . InvalidateTRS ( ) ;
99+ }
100+ }
101+
88102 protected void TriggerOk ( ) {
89103 onOk . Invoke ( this ) ;
90104 Hide ( ) ;
@@ -123,8 +137,8 @@ protected void OnGUI() {
123137 if ( _objectInstance == null || _objectInstance . Id != _objectType . Id )
124138 _objectInstance = OpenTibiaUnity . AppearanceStorage . CreateObjectInstance ( _objectType . Id , _objectAmount ) ;
125139
126- var zoom = new Vector2 ( Screen . width / ( float ) _renderTexture . width , Screen . height / ( float ) _renderTexture . height ) ;
127- _objectInstance . Draw ( commandBuffer , Vector2Int . zero , zoom , 0 , 0 , 0 ) ;
140+
141+ _objectInstance . Draw ( commandBuffer , Vector2Int . zero , _screenZoom , 0 , 0 , 0 ) ;
128142 }
129143
130144 Graphics . ExecuteCommandBuffer ( commandBuffer ) ;
0 commit comments