Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2013 Koki Ibukuro
Copyright (c) 2021 Koki Ibukuro

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
76 changes: 75 additions & 1 deletion unity/NativeDialogPlugin/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,78 @@ Temp
*.sln
*.pidb
*.userprefs
*.unityproj
*.unityproj### https://raw.github.com/github/gitignore/cdd9e946da421758c6f42c427c7bc65c8326155d/Unity.gitignore

# This .gitignore file should be placed at the root of your Unity project directory
#
# Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
#
/[Ll]ibrary/
/[Tt]emp/
/[Oo]bj/
/[Bb]uild/
/[Bb]uilds/
/[Ll]ogs/
/[Uu]ser[Ss]ettings/

# MemoryCaptures can get excessive in size.
# They also could contain extremely sensitive data
/[Mm]emoryCaptures/

# Asset meta data should only be ignored when the corresponding asset is also ignored
!/[Aa]ssets/**/*.meta

# Uncomment this line if you wish to ignore the asset store tools plugin
# /[Aa]ssets/AssetStoreTools*

# Autogenerated Jetbrains Rider plugin
/[Aa]ssets/Plugins/Editor/JetBrains*

# Visual Studio cache directory
.vs/

# Gradle cache directory
.gradle/

# Autogenerated VS/MD/Consulo solution and project files
ExportedObj/
.consulo/
*.csproj
*.unityproj
*.sln
*.suo
*.tmp
*.user
*.userprefs
*.pidb
*.booproj
*.svd
*.pdb
*.mdb
*.opendb
*.VC.db

# Unity3D generated meta files
*.pidb.meta
*.pdb.meta
*.mdb.meta

# Unity3D generated file on crash reports
sysinfo.txt

# Builds
*.apk
*.aab
*.unitypackage

# Crashlytics generated file
crashlytics-build.properties

# Packed Addressables
/[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*

# Temporary auto-generated Android Assets
/[Aa]ssets/[Ss]treamingAssets/aa.meta
/[Aa]ssets/[Ss]treamingAssets/aa/*


73 changes: 73 additions & 0 deletions unity/NativeDialogPlugin/Assets/NativeDialogSample.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
using UnityEngine;
using System.Collections;
using NativeDialog;

public class NativeDialogSample : MonoBehaviour
{
[SerializeField] private string decideLabel = "Decide";
[SerializeField] private string cancelLabel = "Cancel";
[SerializeField] private string closeLabel = "Close";

private void Start()
{
DialogManager.Instance.SetLabel(decideLabel, cancelLabel, closeLabel);
}

#region Invoked from Unity GUI

public void ShowSelectDialog()
{
const string message = "A simple select dialog";
DialogManager.Instance.ShowSelectDialog(message, (bool result) =>
{
Debug.Log($"{result}: {message}");
});
}

public void ShowSelectDialogWithTitle()
{
const string title = "A title";
const string message = "A message for select dialog";
DialogManager.Instance.ShowSelectDialog(title, message, (bool result) =>
{
Debug.Log($"{result}: {title} / {message}");
});
}

public void ShowSubmitDialog()
{
const string message = "A simple submit dialog";
DialogManager.Instance.ShowSubmitDialog(message, (bool result) =>
{
Debug.Log($"{result}: {message}");
});
}

public void ShowSubmitDialogWithTitle()
{
const string title = "A title";
const string message = "A message for submit dialog";
DialogManager.Instance.ShowSubmitDialog(title, message, (bool result) =>
{
Debug.Log($"{result}: {title} / {message}");
});
}

public void ShowDialogWithAutoDissmiss()
{
const string message = "A dialog with auto dismiss";
int id = DialogManager.Instance.ShowSelectDialog(message, (bool result) =>
{
Debug.Log($"{result}: {message}");
});
StartCoroutine(Dissmiss(id, 3f));
}

#endregion // Invoked from Unity GUI

private IEnumerator Dissmiss(int id, float time)
{
yield return new WaitForSeconds(time);
DialogManager.Instance.DissmissDialog(id);
}
}
Loading