Posted on

Native UI – Cross Platform Native Plugins: Essential Kit

Download

Documentation: https://assetstore.essentialkit.voxelbusters.com/

0:00 Welcome to Native UI CPNP2
0:22 Overview
0:56 Setup
1:09 Usage

Native UIs can be used to show special messages in your game with native Android or iOS windows.

IG_NativeUI.cs

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using VoxelBusters.EssentialKit;
using System;

public class IG_NativeUI : MonoBehaviour
{
    public static IG_NativeUI instance;

    public DateTime currentDateTime; //IG_NativeUI.instance.currentDateTime;
   
    // Start is called before the first frame update
    void Start()
    {
        instance = this;
    }

    //IG_NativeUI.instance.ShowAlertDialog("Are you sure?", "Would you like to proceed with this action?");
    public void ShowAlertDialog(string title, string message)
    {
        AlertDialog dialog = AlertDialog.CreateInstance();
        dialog.Title = title;
        dialog.Message = message;
        dialog.AddButton("Yes", () =>
        {
            Debug.Log("Yes button clicked");
        });
        dialog.AddCancelButton("No", () =>
        {
            Debug.Log("Cancel button clicked");
        });
        dialog.Show(); //Show the dialog
    }

    //IG_NativeUI.instance.ShowDatePicker();
    public void ShowDatePicker()
    { 
        DatePicker datePicker = DatePicker.CreateInstance(DatePickerMode.Date);
        datePicker.SetOnValueChange((date) =>
        {
            Debug.Log("Date Time change : " + date);
            currentDateTime = (DateTime)date;
        });
        datePicker.SetOnCloseCallback((result) =>
        {
            Debug.Log("Dismissed the picker with selected date : " + result.SelectedDate);
            currentDateTime = (DateTime)result.SelectedDate;
        });
        datePicker.Show();
    }

   
}