plantilla base para movimiento básico
This commit is contained in:
Robii Aragon
2026-02-05 05:07:55 -08:00
parent 195b696771
commit 779f2c8b20
14443 changed files with 23840465 additions and 452 deletions

View File

@@ -0,0 +1,318 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class UIElementsLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: a064d1d85fe75364fb2d32cb19643f7e
timeCreated: 1639564973
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/UIElementsLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(UIElementsLocalizationManager))]
public class UIElementsLocalizationManagerEditor : Editor
{
UIElementsLocalizationManager manager;
void OnEnable ()
{
manager = (UIElementsLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect ();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 298513fe0d0b95c4a95fed0178aad3df
timeCreated: 1639835326
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/UIElementsLocalizationManagerEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,293 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using GKC.Localization;
public class gameLanguageSelector : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public bool languageSelectionEnabled = true;
public List<string> languageNameList = new List<string> ();
[Space]
[Header ("Language Settings")]
[Space]
public string currentLanguage = "English";
public bool updateElementsOnLanguageChange = true;
public bool checkLanguageActive = true;
private static bool checkLanguageActiveValue;
[Space]
public bool checkUpdateCurrentLanguageByPlayerPrefsOnStart;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
public bool languageUpdatedBySettings;
[Space]
[Header ("Events Settings")]
[Space]
public bool checkSystemLanguageOnStart;
public eventParameters.eventToCallWithString eventOnLanguageCheckAtStart;
public bool updateUIDropDownOnLanguageOnStart;
public Dropdown languageDropDown;
public const string mainManagerName = "Main Game Language Selector";
public static string getMainManagerName ()
{
return mainManagerName;
}
private static gameLanguageSelector _gameLanguageSelectorInstance;
public static gameLanguageSelector Instance { get { return _gameLanguageSelectorInstance; } }
bool instanceInitialized;
public void updateCurrentLanguageByPlayerPrefs ()
{
if (PlayerPrefs.HasKey ("Current Language")) {
string currentLanguagePlayerPrefsValue = PlayerPrefs.GetString ("Current Language");
if (currentLanguagePlayerPrefsValue != "") {
setGameLanguage (currentLanguagePlayerPrefsValue);
}
}
}
public void setCurrentLanguagePlayerPrefsValue ()
{
if (currentLanguage != "") {
PlayerPrefs.SetString ("Current Language", currentLanguage);
}
}
public void getComponentInstance ()
{
if (instanceInitialized) {
return;
}
if (_gameLanguageSelectorInstance != null && _gameLanguageSelectorInstance != this) {
Destroy (this.gameObject);
return;
}
_gameLanguageSelectorInstance = this;
instanceInitialized = true;
}
void Awake ()
{
getComponentInstance ();
checkLanguageActiveValue = checkLanguageActive;
}
void Start ()
{
if (checkSystemLanguageOnStart) {
StartCoroutine (checkInitialSystemLanguage ());
}
if (checkUpdateCurrentLanguageByPlayerPrefsOnStart) {
updateCurrentLanguageByPlayerPrefs ();
}
}
IEnumerator checkInitialSystemLanguage ()
{
yield return new WaitForSeconds (0.4f);
if (!languageUpdatedBySettings) {
string currentSystemLanguage = Application.systemLanguage.ToString ();
if (currentLanguage != currentSystemLanguage) {
if (updateUIDropDownOnLanguageOnStart) {
if (showDebugPrint) {
print ("setting default language " + currentSystemLanguage);
}
int languageIndex = languageNameList.IndexOf (currentSystemLanguage);
if (languageIndex != -1) {
if (showDebugPrint) {
print ("language found on list, setting " + currentSystemLanguage);
}
languageDropDown.value = languageIndex;
}
}
eventOnLanguageCheckAtStart.Invoke (currentSystemLanguage);
}
}
}
public void setGameLanguageByIndex (int languageIndex)
{
if (languageIndex < languageNameList.Count) {
setGameLanguage (languageNameList [languageIndex]);
}
}
public void setGameLanguage (string languageSelected)
{
if (!languageSelectionEnabled) {
return;
}
if (languageSelected != "") {
GKC_Utils.setCurrentLanguage (languageSelected);
languageUpdatedBySettings = true;
updateLocalizationFile ();
setCurrentLanguagePlayerPrefsValue ();
}
}
void updateLocalizationFile ()
{
if (showDebugPrint) {
print ("UPDATE LOCALIZATION " + currentLanguage);
}
languageLocalizationManager [] languageLocalizationManagerList = FindObjectsOfType<languageLocalizationManager> ();
foreach (languageLocalizationManager currentLanguageLocalizationManager in languageLocalizationManagerList) {
currentLanguageLocalizationManager.updateLocalizationFileExternally ();
}
updateAllLanguageElementCheckerOnScene ();
}
public void updateAllLanguageElementCheckerOnScene ()
{
if (GKC_Utils.isUpdateElementsOnLanguageChangeActive ()) {
string currentLanguage = GKC_Utils.getCurrentLanguage ();
List<languageElementChecker> languageElementCheckerList = GKC_Utils.FindObjectsOfTypeAll<languageElementChecker> ();
if (languageElementCheckerList != null) {
for (var i = 0; i < languageElementCheckerList.Count; i++) {
languageElementCheckerList [i].updateLanguageOnElement (currentLanguage);
}
}
}
}
public void addLanguage (string newName)
{
if (!languageNameList.Contains (newName)) {
languageNameList.Add (newName);
}
}
public void removeLanguage (string newName)
{
if (languageNameList.Contains (newName)) {
languageNameList.Remove (newName);
}
}
public void setNewLanguageList (List<string> newNameList)
{
languageNameList.Clear ();
languageNameList.AddRange (newNameList);
}
public void updateLanguageDropDown ()
{
if (languageDropDown != null) {
//languageDropDown.ClearOptions ();
int languageDropDownOptionsCount = languageDropDown.options.Count;
for (var i = 0; i < languageDropDownOptionsCount; i++) {
string currentLanguageElement = UIElementsLocalizationManager.GetLocalizedValue (languageNameList [i]);
languageDropDown.options [i].text = currentLanguageElement;
}
languageDropDown.RefreshShownValue ();
//languageDropDown.AddOptions (translatedLanguageNameList);
}
}
public void assignNewLanguageDropDown (Dropdown newDropDown)
{
languageDropDown = newDropDown;
}
public void checkIfLanguageDropDownAssignedAndUpdate (Dropdown newDropDown)
{
if (languageDropDown == null) {
assignNewLanguageDropDown (newDropDown);
}
updateLanguageDropDown ();
}
public List<string> getCurrentLanguageList ()
{
return languageNameList;
}
public void setCurrentLanguage (string newLanguage)
{
currentLanguage = newLanguage;
}
public string getCurrentLanguage ()
{
return currentLanguage;
}
public void setCurrentLanguageFromEditor (string newLanguage)
{
setCurrentLanguage (newLanguage);
updateComponent ();
}
public static bool isCheckLanguageActive ()
{
return checkLanguageActiveValue;
}
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Game Language Selector " + gameObject.name, gameObject);
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 5487f5f7d5e0b1548ade2576f244818e
timeCreated: 1639464053
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/gameLanguageSelector.cs
uploadId: 814740

View File

@@ -0,0 +1,322 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class interactionObjectsLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
usingDevicesSystem[] usingDevicesSystemList = FindObjectsOfType<usingDevicesSystem> ();
foreach (usingDevicesSystem currentUsingDevicesSystem in usingDevicesSystemList) {
currentUsingDevicesSystem.updateUIInfo ();
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 060da37e0f721474a99e0add72c2881e
timeCreated: 1644984627
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/interactionObjectsLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(interactionObjectsLocalizationManager))]
public class interactionObjectsLocalizationManagerEditor : Editor
{
interactionObjectsLocalizationManager manager;
void OnEnable ()
{
manager = (interactionObjectsLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 3fe661b01f0e3264daf5814503594c43
timeCreated: 1644984862
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/interactionObjectsLocalizationManagerEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,328 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class inventoryLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
inventoryManager[] inventoryManagerList = FindObjectsOfType<inventoryManager> ();
foreach (inventoryManager currentInventoryManager in inventoryManagerList) {
currentInventoryManager.updateFullInventorySlots ();
}
vendorUISystem[] vendorUISystemList = FindObjectsOfType<vendorUISystem> ();
foreach (vendorUISystem currentVendorUISystem in vendorUISystemList) {
currentVendorUISystem.updateAllInventoryVendorUI ();
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 2c147ce2c7a14ef4d9030943b7c2a10b
timeCreated: 1639563546
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/inventoryLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(inventoryLocalizationManager))]
public class inventoryLocalizationManagerEditor : Editor
{
inventoryLocalizationManager manager;
void OnEnable ()
{
manager = (inventoryLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 3d843854195c7b347a017bdc78d1b94e
timeCreated: 1639835534
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/inventoryLocalizationManagerEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,157 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class languageCheckerUIElement : languageElementChecker
{
[Header ("Custom Settings")]
[Space]
public Text mainText;
[Space]
public bool useDropDown;
public Dropdown mainDropDown;
[Space]
public bool useUIElementsLocalizationManager = true;
public bool useInteractionObjectsLocalizationManager;
[Space]
[Header ("Text Settings")]
[Space]
public bool useLanguageLocalizationManager = true;
public string localizationKey;
public bool checkEmptyKey = true;
public bool setFullTextWithCapsEnabled;
[Space]
public List<string> dropDownLocalizationKey = new List<string> ();
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
bool localizationKeyAssigned;
public override void updateLanguageOnElement (string currentLanguage)
{
if (checkEmptyKey) {
if (!localizationKeyAssigned) {
if (useDropDown) {
if (mainDropDown == null) {
mainDropDown = GetComponentInChildren<Dropdown> ();
}
if (dropDownLocalizationKey.Count == 0) {
int dropDownOptionsCount = mainDropDown.options.Count;
for (var i = 0; i < dropDownOptionsCount; i++) {
dropDownLocalizationKey.Add (mainDropDown.options [i].text.ToString ());
}
}
} else {
if (localizationKey == "" || localizationKey == null) {
if (mainText == null) {
mainText = GetComponentInChildren<Text> ();
}
localizationKey = mainText.text;
}
}
localizationKeyAssigned = true;
}
if (showDebugPrint) {
print ("language to set " + currentLanguage + " " + localizationKeyAssigned);
if (useDropDown) {
print ("drop down value adjusted");
} else {
print (localizationKey + " " + mainText.text);
}
}
}
if (useLanguageLocalizationManager) {
if (useDropDown) {
if (mainDropDown != null) {
int dropDownOptionsCount = mainDropDown.options.Count;
for (var i = 0; i < dropDownOptionsCount; i++) {
string newText = "";
if (useUIElementsLocalizationManager) {
newText = UIElementsLocalizationManager.GetLocalizedValue (dropDownLocalizationKey [i]);
} else if (useInteractionObjectsLocalizationManager) {
newText = interactionObjectsLocalizationManager.GetLocalizedValue (dropDownLocalizationKey [i]);
}
if (setFullTextWithCapsEnabled) {
newText = newText.ToUpper ();
}
mainDropDown.options [i].text = newText;
}
mainDropDown.RefreshShownValue ();
}
} else {
string newText = "";
if (useUIElementsLocalizationManager) {
newText = UIElementsLocalizationManager.GetLocalizedValue (localizationKey);
} else if (useInteractionObjectsLocalizationManager) {
newText = interactionObjectsLocalizationManager.GetLocalizedValue (localizationKey);
}
if (setFullTextWithCapsEnabled) {
newText = newText.ToUpper ();
}
mainText.text = newText;
}
if (showDebugPrint) {
if (useDropDown) {
int dropDownOptionsCount = mainDropDown.options.Count;
print ("drop down elements " + dropDownOptionsCount);
for (var i = 0; i < dropDownOptionsCount; i++) {
print (mainDropDown.options [i].text.ToString ());
}
} else {
print (localizationKey + " " + mainText.text);
}
}
} else {
for (int i = 0; i < UIElementLanguageInfoList.Count; i++) {
if (UIElementLanguageInfoList [i].language.Equals (currentLanguage)) {
mainText.text = UIElementLanguageInfoList [i].textContent;
if (showDebugPrint) {
print (currentLanguage + " " + mainText.text);
}
return;
}
}
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 7b7921c1dd9055847a276e80b14dcc07
timeCreated: 1639466717
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/languageCheckerUIElement.cs
uploadId: 814740

View File

@@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class languageElementChecker : MonoBehaviour
{
[Space]
[Header ("Language Settings")]
[Space]
public List<UIElementLanguageInfo> UIElementLanguageInfoList = new List<UIElementLanguageInfo> ();
public virtual void updateLanguageOnElement ()
{
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateLanguageOnElement (currentLanguage);
}
public virtual void updateLanguageOnElement (string currentLanguage)
{
}
[System.Serializable]
public class UIElementLanguageInfo
{
public string language;
[TextArea (3, 5)] public string textContent;
[TextArea (3, 5)] public string extraTextContent;
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 23ca164a6a0733544bc41d27fb3b15b0
timeCreated: 1639468530
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/languageElementChecker.cs
uploadId: 814740

View File

@@ -0,0 +1,24 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class languageElementDeviceChecker : languageElementChecker
{
[Header ("Custom Settings")]
[Space]
public deviceStringAction mainDeviceStringAction;
public override void updateLanguageOnElement (string currentLanguage)
{
for (int i = 0; i < UIElementLanguageInfoList.Count; i++) {
if (UIElementLanguageInfoList [i].language.Equals (currentLanguage)) {
mainDeviceStringAction.setNewDeviceName (UIElementLanguageInfoList [i].textContent);
mainDeviceStringAction.setDeviceAction (UIElementLanguageInfoList [i].extraTextContent);
return;
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: b5c62bf72b4511241aa35a487664f9af
timeCreated: 1639469414
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/languageElementDeviceChecker.cs
uploadId: 814740

View File

@@ -0,0 +1,194 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using System.IO;
using System;
namespace GKC.Localization
{
public class languageLocalizationManager : MonoBehaviour
{
[Space]
[Header ("Language Tool Settings")]
[Space]
public string currentLanguageToEdit = "English";
public string filePath = "Assets/Game Kit Controller/Scripts/Editor/Resources/";
public string filePathBuild = "./Localization/";
public string fileFormat = ".csv";
public string fileName;
[Space]
[Header ("Other Settings")]
[Space]
public bool useLocalFilePath;
public bool useResourcesPath;
public bool localizationEnabled = true;
[Space]
[Header ("Debug")]
[Space]
public bool showDebugPrint;
[Space]
[Header ("Event Settings")]
[Space]
public bool useEventsOnLanguageChange;
public UnityEvent eventOnLanguageChange;
//Virtual functions
public virtual void updateFileName ()
{
}
public virtual void updateLocalizationFileExternally ()
{
}
public virtual void checkEventsOnLanguageChange ()
{
if (useEventsOnLanguageChange) {
eventOnLanguageChange.Invoke ();
}
}
public virtual Dictionary<string, string> getDictionaryForEditor ()
{
return null;
}
public virtual void updateLocalizationFileFromEditor ()
{
}
public virtual string GetLocalizedValueFromEditor (string key)
{
return "";
}
public virtual void addKey (string key, string value)
{
}
public virtual void removeKey (string key)
{
}
public virtual void addLanguage (string languageName)
{
}
public virtual void addLanguageListToNewLocalizationFile ()
{
}
//Main functions
public string getCurrentFilePath ()
{
if (Application.isEditor && !useLocalFilePath) {
return filePath;
} else {
return filePathBuild;
}
}
public bool isUseResourcesPathActive ()
{
if (useResourcesPath) {
return true;
}
if (touchJoystick.checkTouchPlatform ()) {
return true;
}
return false;
}
public void checkIfLanguageFileExists ()
{
string currentFiletPath = getCurrentFilePath ();
string newFilePath = currentFiletPath + fileName + fileFormat;
if (showDebugPrint) {
print ("Checking if " + fileName + " exists on path: " + newFilePath);
}
if (isUseResourcesPathActive ()) {
TextAsset textFile = Resources.Load (fileName) as TextAsset;
if (textFile == null) {
string m_path = Application.dataPath + "/Resources/" + fileName + ".csv";
print (m_path);
FileStream file = File.Open (newFilePath, FileMode.OpenOrCreate);
file.Close ();
}
} else {
if (System.IO.File.Exists (newFilePath)) {
if (showDebugPrint) {
print ("File Located");
}
} else {
if (showDebugPrint) {
print (newFilePath + " doesn't exist");
}
FileStream file = File.Open (newFilePath, FileMode.OpenOrCreate);
file.Close ();
}
}
}
public static bool languageFileExists (string newFilePath, bool useResourcesPathValue, string fileNameValue)
{
if (useResourcesPathValue) {
TextAsset textFile = Resources.Load (fileNameValue) as TextAsset;
if (textFile != null) {
return true;
}
}
if (System.IO.File.Exists (newFilePath)) {
return true;
}
return false;
}
//EDITOF FUNCTIONS
public void updateComponent ()
{
GKC_Utils.updateComponent (this);
GKC_Utils.updateDirtyScene ("Update Localization " + gameObject.name, gameObject);
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: cbbe15ecfc284c243a0307e9ab07f62e
timeCreated: 1639563650
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/languageLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,371 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Linq;
using System.Text.RegularExpressions;
using System.IO;
using System;
using System.Text;
namespace GKC.Localization
{
public class localizationFileLoader
{
public StreamReader mainFile;
public StringBuilder mainFileText;
private char lineSeparator = '\n';
private char surround = '"';
private string[] fieldSeparator = { "\",\"" };
private string fileContent;
public void loadFile (string filePath, bool useResourcesPath)
{
if (useResourcesPath) {
TextAsset textFile = Resources.Load (filePath) as TextAsset;
if (textFile != null) {
fileContent = textFile.ToString ();
}
} else {
mainFile = new StreamReader (filePath);
}
mainFileText = new StringBuilder ();
if (useResourcesPath) {
mainFileText.Append (fileContent);
} else {
mainFileText.Append (mainFile.ReadToEnd ());
mainFile.Close ();
}
}
public Dictionary<string, string> GetDictionaryValues (string attributeID)
{
Dictionary<string, string> dictionary = new Dictionary<string, string> ();
if (mainFileText == null) {
Debug.Log ("WARNING: Dictionary not found when updating file, make sure to create a localization file before");
return null;
}
string[] lines = mainFileText.ToString ().Split (lineSeparator);
int attributeIndex = -1;
string[] headers = lines [0].Split (fieldSeparator, StringSplitOptions.None);
for (int i = 0; i < headers.Length; i++) {
if (headers [i].Contains (attributeID)) {
attributeIndex = i;
break;
}
}
if (attributeIndex > -1) {
Regex textTileParser = new Regex (",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");
for (int i = 1; i < lines.Length; i++) {
string line = lines [i];
string[] fields = textTileParser.Split (line);
for (int j = 0; j < fields.Length; j++) {
fields [j] = fields [j].TrimStart (' ', surround);
fields [j] = fields [j].TrimEnd ('\r', surround);
}
if (fields.Length > attributeIndex) {
var key = fields [0];
//check here for a full key instead of a contains
//var myKey = types.FirstOrDefault(x => x.Value == "one").Key;
if (dictionary.ContainsKey (key)) {
continue;
}
var value = fields [attributeIndex];
dictionary.Add (key, value);
}
}
return dictionary;
}
return null;
}
public void addKey (string filePath, string key, string value, string languageName)
{
#if UNITY_EDITOR
string[] lines = mainFileText.ToString ().Split (lineSeparator);
int languageIndex = -1;
string[] headers = lines [0].Split (fieldSeparator, StringSplitOptions.None);
for (int i = 0; i < headers.Length; i++) {
if (headers [i].Contains (languageName)) {
languageIndex = i;
break;
}
}
if (languageIndex > -1) {
string[] keys = new string [lines.Length];
for (int i = 0; i < lines.Length; i++) {
string line = lines [i];
keys [i] = line.Split (fieldSeparator, StringSplitOptions.None) [0];
}
int keyIndex = -1;
for (int i = 0; i < keys.Length; i++) {
if (keys [i].Contains (key)) {
keyIndex = i;
break;
}
}
if (keyIndex > -1) {
Debug.Log ("Adding new value to existing key " + languageIndex + " " + headers.Length);
string line = lines [keyIndex];
Debug.Log (line);
Regex textTileParser = new Regex (",(?=(?:[^\"]*\"[^\"]*\")*(?![^\"]*\"))");
string[] fields = textTileParser.Split (line);
string newLine = "";
for (int j = 0; j < fields.Length; j++) {
fields [j] = fields [j].TrimStart (' ', surround);
fields [j] = fields [j].TrimEnd ('\r', surround);
Debug.Log (fields [j]);
if (languageIndex == j) {
newLine += string.Format ("\"{0}\"", value);
} else {
newLine += string.Format ("\"{0}\"", fields [j]);
}
if (j < fields.Length - 1) {
newLine += ",";
}
}
Debug.Log (newLine);
string newContent = mainFileText.ToString ().Replace (line, newLine);
Debug.Log (newContent);
File.WriteAllText (filePath, newContent);
GKC_Utils.refreshAssetDatabase ();
} else {
Debug.Log ("Adding new key " + key + " with index " + languageIndex + " for language " + languageName
+ " with an amount of languages of " + headers.Length);
string appended = string.Format ("\n\"{0}\"", key);
int numberOfLanguages = headers.Length;
for (int i = 1; i < numberOfLanguages; i++) {
appended += ",";
if (languageIndex == i) {
appended += string.Format ("\"{0}\"", value);
} else {
appended += string.Format ("\"{0}\"", "");
}
}
File.AppendAllText (filePath, appended);
GKC_Utils.refreshAssetDatabase ();
}
}
#endif
}
public void removeKey (string fileName, string filePath, string key, bool useResourcesPath)
{
#if UNITY_EDITOR
if (useResourcesPath) {
TextAsset textFile = Resources.Load (filePath) as TextAsset;
if (textFile != null) {
fileContent = textFile.ToString ();
}
} else {
mainFile = new StreamReader (filePath);
}
mainFileText = new StringBuilder ();
if (useResourcesPath) {
mainFileText.Append (fileContent);
} else {
mainFileText.Append (mainFile.ReadToEnd ());
mainFile.Close ();
}
string[] lines = mainFileText.ToString ().Split (lineSeparator);
string[] keys = new string [lines.Length];
for (int i = 0; i < lines.Length; i++) {
string line = lines [i];
keys [i] = line.Split (fieldSeparator, StringSplitOptions.None) [0];
}
int index = -1;
for (int i = 0; i < keys.Length; i++) {
if (keys [i].Contains (key)) {
index = i;
break;
}
}
if (index > -1) {
string[] newLines;
newLines = lines.Where (w => w != lines [index]).ToArray ();
string replaced = string.Join (lineSeparator.ToString (), newLines);
File.WriteAllText (filePath, replaced);
GKC_Utils.refreshAssetDatabase ();
}
#endif
}
public void addLanguage (string filePath, string languageName)
{
#if UNITY_EDITOR
string[] lines = mainFileText.ToString ().Split (lineSeparator);
int languageIndex = -1;
string[] headers = lines [0].Split (fieldSeparator, StringSplitOptions.None);
for (int i = 0; i < headers.Length; i++) {
if (headers [i].Contains (languageName)) {
languageIndex = i;
break;
}
}
if (languageIndex > -1) {
Debug.Log ("Language already added");
} else {
Debug.Log ("Adding new language: " + languageName);
string newFileContent = "";
string newLanguage = "," + string.Format ("\"{0}\"", languageName);
string line = lines [0];
line = line.Replace ("\r", "").Replace ("\n", "");
string newLine = line + newLanguage;
newLine = newLine.Replace ("\r", "").Replace ("\n", "");
newFileContent += newLine;
newFileContent += "\n";
for (int i = 1; i < lines.Length; i++) {
lines [i] = lines [i].Replace ("\r", "").Replace ("\n", "");
string currentNewLine = lines [i];
string separation = ",";
currentNewLine += separation + "\"" + "\"";
currentNewLine = currentNewLine.Replace ("\r", "").Replace ("\n", "");
currentNewLine += "\n";
newFileContent += currentNewLine;
}
File.WriteAllText (filePath, newFileContent);
GKC_Utils.refreshAssetDatabase ();
GKC_Utils.addLanguage (languageName);
}
#endif
}
public void addLanguageListToNewLocalizationFile (string filePath)
{
#if UNITY_EDITOR
if (mainFileText == null) {
Debug.Log ("Main File Text Not Found");
return;
}
string fileContent = mainFileText.ToString ();
if (fileContent.Length == 0) {
List<string> languageNameList = GKC_Utils.getCurrentLanguageList ();
fileContent += string.Format ("\"{0}\"", "key");
for (int i = 0; i < languageNameList.Count; i++) {
fileContent += ",";
fileContent += string.Format ("\"{0}\"", languageNameList [i]);
}
File.AppendAllText (filePath, fileContent);
GKC_Utils.refreshAssetDatabase ();
Debug.Log ("Adding language list to new file created");
}
#endif
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: aa4ddabf542fecf46a595c876a79a56e
timeCreated: 1639560948
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/localizationFileLoader.cs
uploadId: 814740

View File

@@ -0,0 +1,244 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
public class searcherLocalizationToolEditor: EditorWindow
{
public static void Open (languageLocalizationManager newLanguageLocalizationManager)
{
var window = (searcherLocalizationToolEditor)ScriptableObject.CreateInstance (typeof(searcherLocalizationToolEditor));
window.titleContent = new GUIContent ("Search Language Keys Window");
Vector2 mouse = GUIUtility.GUIToScreenPoint (Event.current.mousePosition);
Rect r = new Rect (mouse.x - 350, mouse.y + 10, 10, 10);
window.ShowAsDropDown (r, new Vector2 (1000, 400));
window.currentLanguageLocalizationManager = newLanguageLocalizationManager;
}
public string value;
public Vector2 scroll;
public Dictionary<string, string> dictionary;
public languageLocalizationManager currentLanguageLocalizationManager;
public bool dictionaryAssigned = false;
void OnDisabled ()
{
dictionaryAssigned = false;
}
public void OnGUI ()
{
EditorGUILayout.BeginHorizontal ("Box");
EditorGUILayout.LabelField ("Search: ", EditorStyles.boldLabel);
value = EditorGUILayout.TextField (value);
EditorGUILayout.EndHorizontal ();
getSearchResults ();
}
private void getSearchResults ()
{
if (value == null) {
value = "";
}
if (!dictionaryAssigned) {
dictionary = currentLanguageLocalizationManager.getDictionaryForEditor ();
if (dictionary != null) {
dictionaryAssigned = true;
} else {
Debug.Log ("Language " + currentLanguageLocalizationManager.currentLanguageToEdit + " not found, " +
"close the window and write a proper language name");
}
}
if (dictionaryAssigned) {
EditorGUILayout.BeginVertical ();
scroll = EditorGUILayout.BeginScrollView (scroll);
foreach (KeyValuePair<string, string> element in dictionary) {
if (element.Key.ToLower ().Contains (value.ToLower ()) || element.Value.ToLower ().Contains (value.ToLower ())) {
EditorGUILayout.BeginHorizontal ("box");
EditorGUILayout.BeginVertical (GUILayout.MaxWidth (30));
Texture closeIcon = (Texture)Resources.Load ("Delete Icon");
GUIContent content = new GUIContent (closeIcon, "Remove Key");
if (GUILayout.Button (content, GUILayout.MaxWidth (20), GUILayout.MaxHeight (20))) {
if (EditorUtility.DisplayDialog ("Remove Key " + element.Key + "?", "This will remove the element from localization, are you sure?", "Do it")) {
currentLanguageLocalizationManager.removeKey (element.Key);
GKC_Utils.refreshAssetDatabase ();
currentLanguageLocalizationManager.updateLocalizationFileFromEditor ();
dictionary = currentLanguageLocalizationManager.getDictionaryForEditor ();
}
}
Texture addIcon = (Texture)Resources.Load ("Store Icon");
GUIContent addContent = new GUIContent (addIcon, "Add Key");
if (GUILayout.Button (addContent, GUILayout.MaxWidth (20), GUILayout.MaxHeight (20))) {
addKeyLocalizationToolEditor.Open (currentLanguageLocalizationManager, element.Key, element.Value);
this.Close ();
}
EditorGUILayout.EndVertical ();
EditorGUILayout.TextField (element.Key, EditorStyles.textArea, GUILayout.MaxHeight (50), GUILayout.Width (250));
EditorGUILayout.LabelField (element.Value, EditorStyles.textArea);
EditorGUILayout.EndHorizontal ();
}
}
EditorGUILayout.EndScrollView ();
EditorGUILayout.EndVertical ();
}
}
}
public class addKeyLocalizationToolEditor : EditorWindow
{
public static void Open (languageLocalizationManager newLanguageLocalizationManager, string mainKey = "", string mainValue = "")
{
var window = (addKeyLocalizationToolEditor)ScriptableObject.CreateInstance (typeof(addKeyLocalizationToolEditor));
window.titleContent = new GUIContent ("Add Language Key Window");
window.ShowUtility ();
window.currentLanguageLocalizationManager = newLanguageLocalizationManager;
window.currentLanguageLocalizationManager.updateLocalizationFileFromEditor ();
Vector2 mouse = GUIUtility.GUIToScreenPoint (Event.current.mousePosition);
Rect r = new Rect (mouse.x - 350, mouse.y + 10, 10, 10);
if (mainKey != "") {
window.key = mainKey;
}
if (mainValue != "") {
window.value = mainValue;
}
window.ShowAsDropDown (r, new Vector2 (460, 180));
}
public string key;
public string value;
public languageLocalizationManager currentLanguageLocalizationManager;
public void OnGUI ()
{
key = EditorGUILayout.TextField ("Key: ", key);
EditorGUILayout.Space ();
EditorGUILayout.BeginHorizontal ();
EditorGUILayout.LabelField ("Value: ", GUILayout.MaxWidth (50));
EditorStyles.textArea.wordWrap = true;
value = EditorGUILayout.TextArea (value, EditorStyles.textArea, GUILayout.Height (100), GUILayout.Width (400));
EditorGUILayout.EndHorizontal ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
if (GUILayout.Button ("Add")) {
if (key != "" && value != "" && key != null && value != null) {
string currentKey = currentLanguageLocalizationManager.GetLocalizedValueFromEditor (key);
Debug.Log ("Key obtained:" + currentKey);
currentLanguageLocalizationManager.addKey (key, value);
Debug.Log ("Checking key: " + key.ToString () + " with value: " + value.ToString ());
GKC_Utils.refreshAssetDatabase ();
currentLanguageLocalizationManager.updateLocalizationFileFromEditor ();
this.Close ();
}
}
minSize = new Vector2 (460, 180);
maxSize = minSize;
}
}
public class addLanguageLocalizationToolEditor : EditorWindow
{
public static void Open (languageLocalizationManager newLanguageLocalizationManager)
{
var window = (addLanguageLocalizationToolEditor)ScriptableObject.CreateInstance (typeof(addLanguageLocalizationToolEditor));
window.titleContent = new GUIContent ("Add Language Editor Window");
window.ShowUtility ();
window.currentLanguageLocalizationManager = newLanguageLocalizationManager;
window.currentLanguageLocalizationManager.updateLocalizationFileFromEditor ();
Vector2 mouse = GUIUtility.GUIToScreenPoint (Event.current.mousePosition);
Rect r = new Rect (mouse.x - 350, mouse.y + 10, 10, 10);
window.ShowAsDropDown (r, new Vector2 (400, 190));
}
public string key;
public languageLocalizationManager currentLanguageLocalizationManager;
public void OnGUI ()
{
key = EditorGUILayout.TextField ("Language: ", key);
EditorGUILayout.Space ();
EditorGUILayout.Space ();
if (GUILayout.Button ("Add")) {
if (key != "" && key != null) {
Debug.Log ("Checking to add Language key: " + key.ToString ());
currentLanguageLocalizationManager.addLanguage (key);
GKC_Utils.refreshAssetDatabase ();
currentLanguageLocalizationManager.updateLocalizationFileFromEditor ();
}
}
minSize = new Vector2 (400, 190);
maxSize = minSize;
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 060a284c506e7094d96ed025aa59cc55
timeCreated: 1639687886
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/localizationToolEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,322 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class missionLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
objectiveLogSystem[] objectiveLogSystemList = FindObjectsOfType<objectiveLogSystem> ();
foreach (objectiveLogSystem currentObjectiveLogSystem in objectiveLogSystemList) {
currentObjectiveLogSystem.updateUIElements ();
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 0c4c18c12c557f64f859e58aa24de139
timeCreated: 1639939355
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/missionLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(missionLocalizationManager))]
public class missionLocalizationManagerEditor : Editor
{
missionLocalizationManager manager;
void OnEnable ()
{
manager = (missionLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: bb4328b14b637734e88f9f65e420daa0
timeCreated: 1639939775
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/missionLocalizationManagerEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,318 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class pointAndClickLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 0164845b756e5a3469bfc39e6e6c2436
timeCreated: 1658943077
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/pointAndClickLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(pointAndClickLocalizationManager))]
public class pointAndClickLocalizationManagerEditor : Editor
{
pointAndClickLocalizationManager manager;
void OnEnable ()
{
manager = (pointAndClickLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 689a17f798c7a1a4f9fb18fbbcb09991
timeCreated: 1658943919
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/pointAndClickLocalizationManagerEditor.cs
uploadId: 814740

View File

@@ -0,0 +1,89 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Events;
public class simpleGameLanguageSelector : MonoBehaviour
{
[Header ("Main Settings")]
[Space]
public gameLanguageSelector mainGameLanguageSelector;
[Space]
[Header ("Debug")]
[Space]
public bool gameLanguageSelectorLocated;
[Space]
[Header ("Event Settings")]
[Space]
public bool useEventOnLanguageChange;
public UnityEvent eventOnLanguageChange;
[Space]
[Header ("Components")]
[Space]
public Dropdown languageDropDown;
public void setGameLanguageByIndex (int languageIndex)
{
checkSetGameLanguage (false, "", languageIndex);
}
public void setGameLanguage (string languageSelected)
{
checkSetGameLanguage (true, languageSelected, 0);
}
void checkSetGameLanguage (bool languageSelectedByName, string languageSelected, int languageIndex)
{
checkGetMainGameLanguageSelector ();
if (gameLanguageSelectorLocated) {
if (languageSelectedByName) {
mainGameLanguageSelector.setGameLanguage (languageSelected);
} else {
mainGameLanguageSelector.setGameLanguageByIndex (languageIndex);
}
mainGameLanguageSelector.checkIfLanguageDropDownAssignedAndUpdate (languageDropDown);
if (useEventOnLanguageChange) {
eventOnLanguageChange.Invoke ();
}
}
}
void checkGetMainGameLanguageSelector ()
{
if (!gameLanguageSelectorLocated) {
gameLanguageSelectorLocated = mainGameLanguageSelector != null;
if (!gameLanguageSelectorLocated) {
mainGameLanguageSelector = gameLanguageSelector.Instance;
gameLanguageSelectorLocated = mainGameLanguageSelector != null;
}
if (!gameLanguageSelectorLocated) {
GKC_Utils.instantiateMainManagerOnSceneWithTypeOnApplicationPlaying (gameLanguageSelector.getMainManagerName (), typeof (gameLanguageSelector), true);
mainGameLanguageSelector = gameLanguageSelector.Instance;
gameLanguageSelectorLocated = (mainGameLanguageSelector != null);
}
if (!gameLanguageSelectorLocated) {
mainGameLanguageSelector = FindObjectOfType<gameLanguageSelector> ();
gameLanguageSelectorLocated = mainGameLanguageSelector != null;
}
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 01480e78c833f65499794b235cf4c295
timeCreated: 1702118646
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/simpleGameLanguageSelector.cs
uploadId: 814740

View File

@@ -0,0 +1,318 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace GKC.Localization
{
public class skillsLocalizationManager : languageLocalizationManager
{
//static fields
public static Dictionary<string, string> currentLocalization;
public static bool localizationInitialized;
public static localizationFileLoader newLocalizationFileLoader;
public static bool languageLocated;
public static string fileNameValue;
public static string fileFormatValue;
public static string currentFilePathValue;
public static bool localizationEnabledValue;
public static bool useResourcesPathValue;
public static bool languageFileNotFound;
void Awake ()
{
localizationInitialized = false;
localizationEnabledValue = false;
useResourcesPathValue = false;
languageFileNotFound = false;
checkFilePathValues ();
}
public void checkFilePathValues ()
{
fileNameValue = fileName;
fileFormatValue = fileFormat;
localizationEnabledValue = localizationEnabled;
useResourcesPathValue = isUseResourcesPathActive ();
currentFilePathValue = getCurrentFilePath ();
}
public override void updateFileName ()
{
checkFilePathValues ();
checkIfLanguageFileExists ();
addLanguageListToNewLocalizationFile ();
}
public static void updateLocalizationFile ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
newLocalizationFileLoader.loadFile (newFilePath, useResourcesPathValue);
string currentLanguage = GKC_Utils.getCurrentLanguage ();
updateDictionary (currentLanguage);
localizationInitialized = true;
}
public static void updateDictionary (string currentLanguage)
{
currentLocalization = newLocalizationFileLoader.GetDictionaryValues (currentLanguage);
languageLocated = currentLocalization != null;
}
public static string GetLocalizedValue (string key)
{
if (!localizationEnabledValue) {
return key;
}
if (languageFileNotFound) {
return key;
}
if (!localizationInitialized) {
string newFilePath = "";
if (useResourcesPathValue) {
newFilePath = fileNameValue;
} else {
newFilePath = currentFilePathValue + fileNameValue + fileFormatValue;
}
languageFileNotFound = !languageFileExists (newFilePath, useResourcesPathValue, fileNameValue);
if (languageFileNotFound) {
return key;
} else {
updateLocalizationFile ();
}
}
if (!languageLocated) {
return key;
}
string value = key;
currentLocalization.TryGetValue (key, out value);
if (value == null) {
value = key;
}
return value;
}
//Editor Functions
public override Dictionary<string, string> getDictionaryForEditor ()
{
updateLocalizationFileFromEditor ();
return currentLocalization;
}
public override void updateLocalizationFileFromEditor ()
{
newLocalizationFileLoader = new localizationFileLoader ();
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
if (currentLocalization == null) {
updateFileName ();
}
}
public override string GetLocalizedValueFromEditor (string key)
{
updateLocalizationFileFromEditor ();
string value = key;
currentLocalization.TryGetValue (key, out value);
return value;
}
public override void addKey (string key, string value)
{
if (value == null || value == "") {
return;
}
if (value.Contains ("\"")) {
value.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addKey (newFilePath, key, value, currentLanguageToEdit);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void removeKey (string key)
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = getCurrentFilePath () + fileName + fileFormat;
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.removeKey (newFilePath, newFilePath, key, isUseResourcesPathActive ());
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguage (string languageName)
{
if (languageName == null || languageName == "") {
return;
}
if (languageName.Contains ("\"")) {
languageName.Replace ('"', '\"');
}
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguage (newFilePath, languageName);
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
updateDictionary (currentLanguageToEdit);
}
public override void addLanguageListToNewLocalizationFile ()
{
if (newLocalizationFileLoader == null) {
newLocalizationFileLoader = new localizationFileLoader ();
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
newLocalizationFileLoader.loadFile (newFilePath, isUseResourcesPathActive ());
newLocalizationFileLoader.addLanguageListToNewLocalizationFile (newFilePath);
}
public override void updateLocalizationFileExternally ()
{
if (!localizationEnabled) {
return;
}
string newFilePath = "";
if (isUseResourcesPathActive ()) {
newFilePath = fileName;
} else {
newFilePath = getCurrentFilePath () + fileName + fileFormat;
}
bool languageFileNotFoundResult = !languageFileExists (newFilePath, isUseResourcesPathActive (), fileName);
if (languageFileNotFoundResult) {
if (showDebugPrint) {
print ("localization file not found, cancelling action");
}
return;
}
updateLocalizationFile ();
updateSystemElements ();
checkEventsOnLanguageChange ();
}
void updateSystemElements ()
{
}
}
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 4e0507dd475e79e4e801927798b235e7
timeCreated: 1658376213
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/skillsLocalizationManager.cs
uploadId: 814740

View File

@@ -0,0 +1,101 @@
using UnityEngine;
using System.Collections;
namespace GKC.Localization
{
#if UNITY_EDITOR
using UnityEditor;
[CustomEditor (typeof(skillsLocalizationManager))]
public class skillsLocalizationManagerEditor : Editor
{
skillsLocalizationManager manager;
void OnEnable ()
{
manager = (skillsLocalizationManager)target;
}
public override void OnInspectorGUI ()
{
DrawDefaultInspector ();
EditorGUILayout.Space ();
GUILayout.Label ("EDITOR BUTTONS", EditorStyles.boldLabel);
EditorGUILayout.Space ();
Rect lastRect = GUILayoutUtility.GetLastRect();
EditorGUILayout.BeginVertical ();
Texture buttonIcon = (Texture)Resources.Load ("Search Icon");
GUIContent buttonContent = new GUIContent (buttonIcon, "Search Key");
Rect position = new Rect (lastRect.x + 50, lastRect.y + 10, 30, 30);
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
searcherLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Store Icon");
buttonContent = new GUIContent (buttonIcon, "Add Key");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addKeyLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Language Icon");
buttonContent = new GUIContent (buttonIcon, "Add Language");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
addLanguageLocalizationToolEditor.Open (manager);
}
EditorGUILayout.Space ();
buttonIcon = (Texture)Resources.Load ("Reload Icon");
buttonContent = new GUIContent (buttonIcon, "Update Language Name");
position.x += 50;
if (GUI.Button (position, buttonContent)) {
manager.updateFileName ();
manager.updateComponent ();
Debug.Log ("Language File Updated");
}
EditorGUILayout.EndVertical ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
EditorGUILayout.Space ();
}
}
#endif
}

View File

@@ -0,0 +1,19 @@
fileFormatVersion: 2
guid: 47eca7c3b5a21834cb7737c1ce4a8692
timeCreated: 1658376564
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
AssetOrigin:
serializedVersion: 1
productId: 40995
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
packageVersion: 3.77g
assetPath: Assets/Game Kit Controller/Scripts/Localization System/skillsLocalizationManagerEditor.cs
uploadId: 814740