From cb7e25b728841fecc7b60c41395625384f0bb4c3 Mon Sep 17 00:00:00 2001 From: chrisgregan Date: Thu, 9 Apr 2015 16:00:48 +0100 Subject: [PATCH] Added Set Language command --- .../Narrative/Scripts/Commands/SetLanguage.cs | 35 +++++++++++++++++++ .../Scripts/Commands/SetLanguage.cs.meta | 12 +++++++ 2 files changed, 47 insertions(+) create mode 100644 Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs create mode 100644 Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs.meta diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs new file mode 100644 index 00000000..57be8053 --- /dev/null +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs @@ -0,0 +1,35 @@ +using UnityEngine; +using System.Collections; + +namespace Fungus +{ + [CommandInfo("Narrative", + "Set Language", + "Set the active language for the scene. A Localization object with a localization file must be present in the scene.")] + [AddComponentMenu("")] + public class SetLanguage : Command + { + public string languageCode; + + public override void OnEnter() + { + Localization localization = GameObject.FindObjectOfType(); + if (localization != null) + { + localization.SetActiveLanguage(languageCode); + } + + Continue(); + } + + public override string GetSummary() + { + return languageCode; + } + + public override Color GetButtonColor() + { + return new Color32(184, 210, 235, 255); + } + } +} \ No newline at end of file diff --git a/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs.meta b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs.meta new file mode 100644 index 00000000..712a8ab6 --- /dev/null +++ b/Assets/Fungus/Narrative/Scripts/Commands/SetLanguage.cs.meta @@ -0,0 +1,12 @@ +fileFormatVersion: 2 +guid: 3fc625e237d6048bf86f34835d8266d9 +timeCreated: 1428591017 +licenseType: Free +MonoImporter: + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: