Christopher
8 years ago
292 changed files with 14 additions and 276 deletions
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 623a31d1ed64f48c18a2941fb2e6bb4b |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: c464247e0cb064d63ba47e22509fc0b0 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3e8003ca74cfb4a99983b0084a826c72 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 5a4fe51b67cee49b28f6a0231dae2352 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3dd9a7f66888345859cf2db40ceee354 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: d4ee6befb080e414984229c6b24358ae |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 3d2b8d81dbfb54c02a92a0966802a55a |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: e3391e010f66a4399adbe2bd0de43a83 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 42741b4e7e5d44f8b8268e93d23ee33e |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 927b2ce96300f4cb093db15b56750d0c |
||||
folderAsset: yes |
||||
timeCreated: 1459937186 |
||||
licenseType: Free |
||||
DefaultImporter: |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -1,101 +0,0 @@
|
||||
// This code is part of the Fungus library (http://fungusgames.com) maintained by Chris Gregan (http://twitter.com/gofungus). |
||||
// It is released for free under the MIT open source license (https://github.com/snozbot/fungus/blob/master/LICENSE) |
||||
|
||||
using UnityEngine; |
||||
using UnityEngine.UI; |
||||
using System.Collections; |
||||
using Fungus; |
||||
using MoonSharp.Interpreter; |
||||
|
||||
namespace Fungus |
||||
{ |
||||
|
||||
public static class LuaExtensions |
||||
{ |
||||
|
||||
/// <summary> |
||||
/// Extension for MenuDialog that allows AddOption to call a Lua function when an option is selected. |
||||
/// </summary> |
||||
public static bool AddOption(this MenuDialog menuDialog, string text, bool interactable, ILuaEnvironment luaEnv, Closure callBack) |
||||
{ |
||||
if (!menuDialog.gameObject.activeSelf) |
||||
{ |
||||
menuDialog.gameObject.SetActive(true); |
||||
} |
||||
|
||||
bool addedOption = false; |
||||
foreach (Button button in menuDialog.CachedButtons) |
||||
{ |
||||
if (!button.gameObject.activeSelf) |
||||
{ |
||||
button.gameObject.SetActive(true); |
||||
|
||||
button.interactable = interactable; |
||||
|
||||
Text textComponent = button.GetComponentInChildren<Text>(); |
||||
if (textComponent != null) |
||||
{ |
||||
textComponent.text = text; |
||||
} |
||||
|
||||
button.onClick.AddListener(delegate { |
||||
|
||||
menuDialog.StopAllCoroutines(); // Stop timeout |
||||
menuDialog.Clear(); |
||||
menuDialog.HideSayDialog(); |
||||
|
||||
if (callBack != null) |
||||
{ |
||||
luaEnv.RunLuaFunction(callBack, true); |
||||
} |
||||
}); |
||||
|
||||
addedOption = true; |
||||
break; |
||||
} |
||||
} |
||||
|
||||
return addedOption; |
||||
} |
||||
|
||||
/// <summary> |
||||
/// Extension for MenuDialog that allows ShowTimer to call a Lua function when the timer expires. |
||||
/// </summary> |
||||
public static IEnumerator ShowTimer(this MenuDialog menuDialog, float duration, ILuaEnvironment luaEnv, Closure callBack) |
||||
{ |
||||
if (menuDialog.CachedSlider == null || |
||||
duration <= 0f) |
||||
{ |
||||
yield break; |
||||
} |
||||
|
||||
menuDialog.CachedSlider.gameObject.SetActive(true); |
||||
menuDialog.StopAllCoroutines(); |
||||
|
||||
float elapsedTime = 0; |
||||
Slider timeoutSlider = menuDialog.GetComponentInChildren<Slider>(); |
||||
|
||||
while (elapsedTime < duration) |
||||
{ |
||||
if (timeoutSlider != null) |
||||
{ |
||||
float t = 1f - elapsedTime / duration; |
||||
timeoutSlider.value = t; |
||||
} |
||||
|
||||
elapsedTime += Time.deltaTime; |
||||
|
||||
yield return null; |
||||
} |
||||
|
||||
menuDialog.Clear(); |
||||
menuDialog.gameObject.SetActive(false); |
||||
menuDialog.HideSayDialog(); |
||||
|
||||
if (callBack != null) |
||||
{ |
||||
luaEnv.RunLuaFunction(callBack, true); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -1,12 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 998f811805a17465ba6720248632ec01 |
||||
timeCreated: 1459502744 |
||||
licenseType: Free |
||||
MonoImporter: |
||||
serializedVersion: 2 |
||||
defaultReferences: [] |
||||
executionOrder: 0 |
||||
icon: {instanceID: 0} |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 805471f08101f4ad8a705fc863435758 |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 04b9ccf7cc1a64058ad9340ed03b4a8b |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,5 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 0bb03bbaacb014e7399075a2d6ecad3f |
||||
folderAsset: yes |
||||
DefaultImporter: |
||||
userData: |
@ -1,9 +0,0 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 84aaac902c28b47f89fefe8205397661 |
||||
folderAsset: yes |
||||
timeCreated: 1473756719 |
||||
licenseType: Free |
||||
DefaultImporter: |
||||
userData: |
||||
assetBundleName: |
||||
assetBundleVariant: |
@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 26c5ee956235e48f18c9a7d6ad86a3eb |
||||
guid: fa184a0dd8f1c46cbb12b7fcf9b1b06a |
||||
folderAsset: yes |
||||
timeCreated: 1435851000 |
||||
timeCreated: 1473770354 |
||||
licenseType: Free |
||||
DefaultImporter: |
||||
userData: |
@ -1,7 +1,7 @@
|
||||
fileFormatVersion: 2 |
||||
guid: 70f0d2a285cfc4e5594117997814560d |
||||
guid: d957a50af081d49998801a81811881fe |
||||
folderAsset: yes |
||||
timeCreated: 1459523691 |
||||
timeCreated: 1473770383 |
||||
licenseType: Free |
||||
DefaultImporter: |
||||
userData: |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue