-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,56 @@ | ||
using SunCubeStudio.Localization; | ||
using System; | ||
using Localization; | ||
using UnityEngine; | ||
using UnityEngine.UI; | ||
|
||
// For DEMO VIEW | ||
public class LocolizeTest : MonoBehaviour | ||
{ | ||
public Text CurrentText; | ||
public Toggle Localization1; | ||
public Toggle Localization2; | ||
public Toggle Localization3; | ||
|
||
private void Start() | ||
{ | ||
CurrentText.text = string.Format("Current localization - {0}", LocalizationService.Instance.Localization); | ||
Localization1.onValueChanged.AddListener(OnLocalization1Set); | ||
Localization2.onValueChanged.AddListener(OnLocalization2Set); | ||
Localization3.onValueChanged.AddListener(OnLocalization3Set); | ||
|
||
CheckLocalization(); | ||
} | ||
|
||
public void English() | ||
private void CheckLocalization() | ||
{ | ||
LocalizationService.Instance.Localization = "English"; | ||
if (LocalizationService.Instance == null) return; | ||
|
||
switch (LocalizationService.Instance.Localization) | ||
{ | ||
case "Russian": | ||
Localization2.isOn = true; | ||
break; | ||
case "English": | ||
Localization1.isOn = true; | ||
break; | ||
case "French": | ||
Localization3.isOn = true; | ||
break; | ||
} | ||
} | ||
|
||
CurrentText.text = string.Format("Current localization {0}", | ||
LocalizationService.Instance.GetTextByKeyWithLocalize("localization1", "English")); | ||
private void OnLocalization1Set(bool value) | ||
{ | ||
if (!value) return; | ||
LocalizationService.Instance.Localization = "English"; | ||
} | ||
public void Russian() | ||
private void OnLocalization2Set(bool value) | ||
{ | ||
if (!value) return; | ||
LocalizationService.Instance.Localization = "Russian"; | ||
|
||
CurrentText.text = string.Format("Current localization {0}", | ||
LocalizationService.Instance.GetTextByKeyWithLocalize("localization2", "English")); | ||
} | ||
|
||
public void French() | ||
private void OnLocalization3Set(bool value) | ||
{ | ||
if (!value) return; | ||
LocalizationService.Instance.Localization = "French"; | ||
|
||
CurrentText.text = string.Format("Current localization {0}", | ||
LocalizationService.Instance.GetTextByKeyWithLocalize("localization3", "English")); | ||
} | ||
|
||
} |
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Reflection; | ||
|
||
public class TypeHelper | ||
{ | ||
public static Dictionary<string, Type> _fastTypes = new Dictionary<string, Type>(); | ||
|
||
public static Type GetTypeByName(string name, string assemblyName) | ||
{ | ||
if (_fastTypes.ContainsKey(name)) | ||
return _fastTypes[name]; | ||
|
||
foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) | ||
{ | ||
if (!assembly.FullName.Contains(assemblyName)) | ||
continue; | ||
|
||
foreach (Type type in assembly.GetTypes()) | ||
{ | ||
if (type.Name == name) | ||
{ | ||
_fastTypes.Add(name, type); | ||
return type; | ||
} | ||
} | ||
} | ||
|
||
return null; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
Id,English | ||
title,Localization\n Service | ||
text,"This package is designed to show the localization of text in your applications. Simple interface. Text of localization located in the .CSV file format. Works with several possible types of text output in Unity(MeshText and UIText), there is also has the opportunity to get text value of the code." | ||
shorttext,This package is designed to show the localization of text... | ||
Id,English | ||
title,Localization Service | ||
text,"This package is designed to show the localization of text in your applications. Simple interface. Text of localization located in the .CSV file format. Works with several possible types of text output in Unity3d (MeshText and UIText), there is also has the opportunity to get text value of the code." | ||
autors,Sun Cube | ||
localization1,English | ||
localization2,Russian | ||
localization3,French | ||
localization3,French |