@@ -35,15 +35,6 @@ public class JCS_ButtonSelection
3535 public SelectionDisable selectionDisable = SelectionDisable ;
3636 public SelectionActive selectionActive = SelectionActive ;
3737
38- /// <summary>
39- /// Direction the object link to button.
40- /// </summary>
41- public enum LinkDirection
42- {
43- ButtonToSelection ,
44- SelectionToButton ,
45- } ;
46-
4738
4839 /*******************************************/
4940 /* Private Variables */
@@ -90,14 +81,6 @@ public enum LinkDirection
9081 [ SerializeField ]
9182 private bool mSelfAsButton = true ;
9283
93- [ Tooltip ( "Make skip variable with interactable with the button." ) ]
94- [ SerializeField ]
95- private bool mLinkSkipWithInteractableButton = true ;
96-
97- [ Tooltip ( "Direction the 'skip' variable connect to button's interactable variable." ) ]
98- [ SerializeField ]
99- private LinkDirection mLinkDirection = LinkDirection . ButtonToSelection ;
100-
10184
10285 [ Header ( "- Full Control (JCS_ButtonSelection)" ) ]
10386
@@ -124,8 +107,6 @@ public enum LinkDirection
124107 /*******************************************/
125108 /* setter / getter */
126109 /*******************************************/
127- public LinkDirection linkDirection { get { return this . mLinkDirection ; } set { this . mLinkDirection = value ; } }
128- public bool LinkSkipWithInteractableButton { get { return this . mLinkSkipWithInteractableButton ; } set { this . mLinkSkipWithInteractableButton = value ; } }
129110 public bool DeactiveAtAwake { get { return this . mDeactiveAtAwake ; } set { this . mDeactiveAtAwake = value ; } }
130111 public bool SelfAsButton { get { return this . mSelfAsButton ; } set { this . mSelfAsButton = value ; } }
131112 public JCS_Button Button { get { return this . mButton ; } set { this . mButton = value ; } }
@@ -140,16 +121,7 @@ public bool Active
140121 }
141122 }
142123 public JCS_ButtonSelectionGroup ButtonSelectionGroup { get { return this . mButtonSelectionGroup ; } set { this . mButtonSelectionGroup = value ; } }
143- public bool Skip
144- {
145- get { return this . mSkip ; }
146- set
147- {
148- this . mSkip = value ;
149-
150- SetInteractableButton ( ) ;
151- }
152- }
124+ public bool Skip { get { return this . mSkip ; } }
153125
154126 public JCS_ButtonSelection UpSelection { get { return this . mUpSelection ; } set { this . mUpSelection = value ; } }
155127 public JCS_ButtonSelection DownSelection { get { return this . mDownSelection ; } set { this . mDownSelection = value ; } }
@@ -180,10 +152,9 @@ private void Awake()
180152
181153 private void Start ( )
182154 {
183- SetInteractableButton ( ) ;
155+ SetSkip ( mSkip ) ;
184156 }
185157
186-
187158 /*******************************************/
188159 /* Self-Define */
189160 /*******************************************/
@@ -280,31 +251,15 @@ private void ActiveEffects(bool act)
280251 /// <summary>
281252 /// Make skip variable connect to interactable with button.
282253 /// </summary>
283- private void SetInteractableButton ( )
254+ public void SetSkip ( bool act , bool fromButton = false )
284255 {
285- if ( ! mLinkSkipWithInteractableButton || mButton == null )
256+ if ( mButton == null )
286257 return ;
287258
288- switch ( mLinkDirection )
289- {
290- case LinkDirection . ButtonToSelection :
291- {
292- // change itself, button have more control/power
293- // over selection.
294- mSkip = ! mButton . Interactable ;
295- }
296- return ;
297- case LinkDirection . SelectionToButton :
298- {
299- // vice versa, this have more control/power
300- // over button.
301- mButton . SetInteractable ( ! mSkip ) ;
302- }
303- return ;
304- }
259+ this . mSkip = act ;
305260
306- // this should not happens...
307- JCS_Debug . LogWarning ( "Button selection link failed..." ) ;
261+ if ( ! fromButton )
262+ mButton . SetInteractable ( ! mSkip , true ) ;
308263 }
309264
310265 }
0 commit comments