123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.UI;
- using Sirenix.OdinInspector;
- namespace KairoEngine.UI
- {
- [System.Serializable]
- public class SlideData
- {
- [FoldoutGroup("@title")] public string title = "New Slide";
- [FoldoutGroup("@title")] public bool skipable = true;
- [FoldoutGroup("@title")] public Image image;
- [FoldoutGroup("@title")] public float delay = 0.5f;
- [FoldoutGroup("@title")] public float duration = 3f;
- [FoldoutGroup("@title")] public UiAnimator uiAnimator;
- private float counter = 0;
- private bool hasDelayed = false;
- public void Show()
- {
- //Debug.Log("Showing slide " + title);
- image.gameObject.SetActive(true);
- counter = 0f;
- hasDelayed = false;
- }
- public void Hide()
- {
- if(uiAnimator) uiAnimator.Disable();
- else image.gameObject.SetActive(false);
- }
- public bool UpdateSlide()
- {
- counter += Time.deltaTime;
- if(!hasDelayed)
- {
- if(counter > delay)
- {
- Show();
- hasDelayed = true;
- }
- }
- else
- {
- if(counter > duration)
- {
- //Debug.Log("Showing slide " + title + " is done");
- return true;
- }
- else return false;
- }
- return false;
- }
- }
- }
|