42 lines
1.0 KiB
C#
42 lines
1.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UVC.UI.Modal.ColorPicker;
|
|
using UVC.UI.Modal.DatePicker;
|
|
|
|
public class ColorPickerDatePickerSample : MonoBehaviour
|
|
{
|
|
private Renderer r;
|
|
void Start()
|
|
{
|
|
r = GetComponent<Renderer>();
|
|
r.sharedMaterial = r.material;
|
|
}
|
|
public void ChooseColorButtonClick()
|
|
{
|
|
_ = ColorPicker.Create(r.material.color, "Choose the cube's color!", SetColor, ColorFinished, OnCloseColorPicker, true);
|
|
}
|
|
private void SetColor(Color currentColor)
|
|
{
|
|
r.material.color = currentColor;
|
|
}
|
|
|
|
private void ColorFinished(Color finishedColor)
|
|
{
|
|
Debug.Log("You chose the color " + ColorUtility.ToHtmlStringRGBA(finishedColor));
|
|
}
|
|
|
|
private void OnCloseColorPicker()
|
|
{
|
|
|
|
}
|
|
|
|
public void ShowCalendar()
|
|
{
|
|
DatePicker.Show(System.DateTime.Now, (selectedDate) =>
|
|
{
|
|
Debug.Log("Selected date: " + selectedDate.ToString("yyyy-MM-dd"));
|
|
});
|
|
}
|
|
}
|