Ejemplo n.º 1
0
        public static LocalisationData Load()
        {
            string           path             = "CoreScript/Localisation";
            LocalisationData localisationData = Resources.Load <LocalisationData>(path + "/LocalisationData");

            if (localisationData != null)
            {
                return(localisationData);
            }
#if UNITY_EDITOR
            string additionalPath = Application.dataPath + "/Resources/" + path;
            localisationData = CreateInstance <LocalisationData>();

            if (!Directory.Exists(additionalPath))
            {
                Directory.CreateDirectory(additionalPath);
            }

            UnityEditor.AssetDatabase.CreateAsset(localisationData, "Assets/Resources/" + path + "/LocalisationData.asset");
            UnityEditor.AssetDatabase.SaveAssets();
            UnityEditor.AssetDatabase.Refresh();
            Debug.LogWarning("Could not find LocalisationData asset. Will use default settings instead.");
            return(localisationData);
#else
            return(null);
#endif
        }
Ejemplo n.º 2
0
        public static void Open(LocalisationData localisationData)
        {
            // Get existing open window or if none, make a new one:
            LocalisationDataEditor window = (LocalisationDataEditor)GetWindow(typeof(LocalisationDataEditor));

            window.LocalisationData = localisationData;
            window.serializedObject = new SerializedObject(localisationData);
            window.Show();
        }
Ejemplo n.º 3
0
        public static bool OpenEditor(int instanceId, int line)
        {
            LocalisationData obj = EditorUtility.InstanceIDToObject(instanceId) as LocalisationData;

            if (obj == null)
            {
                return(false);
            }

            LocalisationDataEditor.Open(obj);
            return(true);
        }