File tree Expand file tree Collapse file tree 3 files changed +24
-4
lines changed
Assets/ModalWindows/Scripts Expand file tree Collapse file tree 3 files changed +24
-4
lines changed Original file line number Diff line number Diff line change @@ -92,6 +92,8 @@ public virtual T SetHeader(string text)
9292
9393 return Instance ;
9494 }
95+
96+
9597
9698 public virtual T SetBody ( string text )
9799 {
@@ -119,6 +121,23 @@ protected virtual void OnBeforeShow()
119121 }
120122 }
121123
124+ protected virtual void Update ( )
125+ {
126+ CheckIgnorableForClose ( ) ;
127+ }
128+
129+ protected virtual void CheckIgnorableForClose ( )
130+ {
131+ if ( Input . GetKeyDown ( KeyCode . Escape ) )
132+ {
133+ if ( ! ReferenceEquals ( Instance , null ) )
134+ {
135+ if ( Instance . ignorable )
136+ Instance . Close ( ) ;
137+ }
138+ }
139+ }
140+
122141 public virtual T Show ( )
123142 {
124143 OnBeforeShow ( ) ;
Original file line number Diff line number Diff line change @@ -36,12 +36,11 @@ void SubmitInput()
3636 Close ( ) ;
3737 }
3838
39- private void Update ( )
39+ protected override void Update ( )
4040 {
41+ base . Update ( ) ;
4142 if ( inputField . isFocused && inputField . text != "" && Input . GetKeyUp ( KeyCode . Return ) )
42- {
4343 SubmitInput ( ) ;
44- }
4544 }
4645
4746 public void UI_InputFieldOKButton ( )
Original file line number Diff line number Diff line change 1- using System . Collections ;
1+ using System ;
2+ using System . Collections ;
23using System . Collections . Generic ;
34using UnityEngine ;
45
@@ -8,4 +9,5 @@ public class SimpleModalWindow : ModalWindow<SimpleModalWindow>
89 {
910 return ModalWindow < SimpleModalWindow > . Create ( ignorable ) ;
1011 }
12+
1113}
You can’t perform that action at this time.
0 commit comments