123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- namespace Bitsplash.DatePicker
- {
-
-
-
- public abstract class DatePickerElement : MonoBehaviour
- {
- [SerializeField]
- [HideInInspector]
- private bool isOpen;
- protected virtual void Start()
- {
- SetLinkedElements();
- }
-
-
-
-
- void SetLinkedElements()
- {
- var main = GetComponentInParent<DatePickerSettings>();
- if (main == null)
- Debug.LogError("Date Picker elements must have a parent GameObject with the behviour DatePickerSettings");
- else
- {
- var content = main.Content;
- if (content != null)
- {
- SetMain(main);
- SetContent(content);
- content.SettingsChanged -= OnSettingsChanged;
- content.SettingsChanged += OnSettingsChanged;
- }
- }
- }
- protected virtual void OnSettingsChanged()
- {
- }
- public virtual void OnValidate()
- {
- if(isActiveAndEnabled)
- SetLinkedElements();
- }
-
-
-
-
- protected abstract void SetMain(DatePickerSettings main);
-
-
-
-
- protected abstract void SetContent(DatePickerContent content);
- }
- }
|