コード例 #1
0
ファイル: SlideEffect.cs プロジェクト: farreltr/OneLastSunset
 /// <summary>
 /// Play the slide effect.
 /// </summary>
 public override IEnumerator Play()
 {
     control = GetComponent<GUIControl>();
     if (control == null) yield break;
     control.visible = false;
     Rect rect = control.scaledRect.GetPixelRect();
     float startTime = DialogueTime.time;
     float endTime = startTime + duration;
     while (DialogueTime.time < endTime) {
         float elapsed = DialogueTime.time - startTime;
         float progress = Mathf.Clamp(elapsed / duration, 0, 1);
         switch (direction) {
         case SlideDirection.FromBottom:
             control.Offset = new Vector2(0, (1 - progress) * (Screen.height - rect.y));
             break;
         case SlideDirection.FromTop:
             control.Offset = new Vector2(0, -(1 - progress) * (rect.y + rect.height));
             break;
         case SlideDirection.FromLeft:
             control.Offset = new Vector2(-(1 - progress) * (rect.x + rect.width), 0);
             break;
         case SlideDirection.FromRight:
             control.Offset = new Vector2((1 - progress) * (Screen.width - rect.x), 0);
             break;
         }
         control.visible = true;
         control.Refresh();
         yield return null;
     }
     control.Offset = Vector2.zero;
     control.visible = true;
     control.Refresh();
 }
コード例 #2
0
 private static void CheckSlideEffect(GUIControl control)
 {
     SlideEffect slideEffect = control.GetComponent<SlideEffect>();
     if (slideEffect != null) {
         if (slideEffect.trigger == GUIEffectTrigger.OnEnable) {
             control.visible = false;
         }
     }
 }
コード例 #3
0
ファイル: FlashEffect.cs プロジェクト: farreltr/OneLastSunset
 /// <summary>
 /// Plays the flash effect.
 /// </summary>
 public override IEnumerator Play()
 {
     control = GetComponent<GUIControl>();
     if (control == null) yield break;
     control.visible = true;
     while (true) {
         yield return new WaitForSeconds(interval);
         control.visible = !control.visible;
     }
 }
コード例 #4
0
 /// <summary>
 /// Sets a Unity GUI control active.
 /// </summary>
 /// <param name='control'>
 /// Control to set.
 /// </param>
 /// <param name='value'>
 /// <c>true</c> for active; <c>false</c> for inactive.
 /// </param>
 public static void SetControlActive(GUIControl control, bool value)
 {
     if (control != null) {
         if ((value == true) && !control.gameObject.activeSelf) {
             control.gameObject.SetActive(true);
             CheckSlideEffect(control);
         } else if ((value == false) && control.gameObject.activeSelf) {
             control.gameObject.SetActive(false);
         }
     }
 }
コード例 #5
0
 public UnityQTEControls(GUIControl[] qteIndicators)
 {
     this.qteIndicators = qteIndicators;
 }
コード例 #6
0
ファイル: Navigation.cs プロジェクト: mentalpop/GrabbyPaws
 private bool IsClickableButton(GUIControl control)
 {
     return((control != null) && control.visible && (control is GUIButton) && (control as GUIButton).clickable);
 }
コード例 #7
0
 public void Awake()
 {
     control = GetComponent<GUIControl>();
     if (control == null) control = gameObject.AddComponent<GUIControl>();
     control.visible = false;
 }
コード例 #8
0
 private float GetChildXMax(GUIControl child)
 {
     return(child.rect.xMax);
 }
コード例 #9
0
ファイル: GUIControl.cs プロジェクト: farreltr/OneLastSunset
 private void UpdateLayoutChild(GUIControl child, Vector2 childWindowSize)
 {
     child.Refresh(childWindowSize);
     child.dRect = clipChildren ? Vector2.zero : new Vector2(rect.x, rect.y);
     child.UpdateLayout();
     //---Was (replaced by dRect above): if (!clipChildren) child.rect = new Rect(child.rect.x + rect.x, child.rect.y + rect.y, child.rect.width, child.rect.height);
 }