PlantList
This commit is contained in:
1 parent
ba49ef5015
commit
7c207ef5b9
44 files changed
+2795
-1147
No files matched your search
@@ -0,0 +1,31 @@
|
||||
using UnityEngine;
|
||||
using System.Collections;
|
||||
|
||||
public class SelectedDate {
|
||||
public static System.DateTime date = System.DateTime.Now;
|
||||
}
|
||||
public class DateCallback : AndroidJavaProxy
|
||||
{
|
||||
public DateCallback() : base("android.app.DatePickerDialog$OnDateSetListener") { }
|
||||
|
||||
public void onDateSet(AndroidJavaObject view, int year, int monthOfYear, int dayOfMonth) {
|
||||
SelectedDate.date = new System.DateTime(year, monthOfYear + 1, dayOfMonth);
|
||||
}
|
||||
}
|
||||
public class ExampleClass : MonoBehaviour
|
||||
{
|
||||
private AndroidJavaObject activity;
|
||||
|
||||
void PickDate(){
|
||||
new AndroidJavaObject("android.app.DatePickerDialog", activity, new DateCallback(), SelectedDate.date.Year, SelectedDate.date.Month - 1, SelectedDate.date.Day).Call("show");
|
||||
}
|
||||
|
||||
void OnGUI()
|
||||
{
|
||||
if (GUI.Button(new Rect(10, 10, 450, 100), System.String.Format("{0:yyyy-MM-dd}", SelectedDate.date)))
|
||||
{
|
||||
activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity");
|
||||
activity.Call("runOnUiThread", new AndroidJavaRunnable(PickDate));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dcb51e6febb24b66870aad7e44df62e0
|
||||
timeCreated: 1772468482
|
||||
Reference in new issue
Block a user