Ejemplo n.º 1
0
        public static void Setup()
        {
            Translating = false;

            // Get the translation key, if we have one:
            // TranslationKey=GetTranslationKey();
            // Setup the foldout:
            // ShowAPIKey=(TranslationKey=="");

            // Setup the PowerUI path:
            PowerUIPath = PowerUIEditor.GetPowerUIPath();

            // Load the target languages:
            LoadAvailableLanguages();
        }
        /// <summary>Sets up the module.</summary>
        private void GetModule()
        {
            // Create a precompileable module:
            Module = new Module("PowerUI");

            // Got source folders?
            if (Module.SourceFolders.Count == 0)
            {
                // Find PowerUI:
                string powerUIPath = PowerUIEditor.GetPowerUIPath();

                // Add the source folder(s) now:
                // (We don't precompile the managers because that would break references).
                Module.SourceFolders.Add(powerUIPath + "/Source");
            }
        }
Ejemplo n.º 3
0
        public static void WorldUI()
        {
            // Use a plane to describe the size/ shape of the WorldUI:
            GameObject plane = GameObject.CreatePrimitive(PrimitiveType.Plane);

            // We'll name it with something distinctive:
            plane.name = "My World UI";

            // Remove collider:
            MeshCollider mc = plane.GetComponent <MeshCollider>();

            if (mc != null)
            {
                GameObject.DestroyImmediate(mc);
            }

            // Set default rotation:
            plane.transform.rotation = Quaternion.Euler(270f, 180f, 0f);

            // Add a WorldUI Helper. It'll instance the WorldUI object when the game starts up
            // and destroy the mesh renderer/ filters.
            // (which is generally used from scripting anyway).
            plane.AddComponent <WorldUIHelper>();

            // Get the path to PowerUI:
            string powerUIPath = PowerUIEditor.GetPowerUIPath();

            if (string.IsNullOrEmpty(powerUIPath))
            {
                NoMaterial();
            }
            else
            {
                // Use the WorldUI Editor material:
                Material mat = AssetDatabase.LoadAssetAtPath(powerUIPath + "/Editor/worldUIMaterial.mat", typeof(Material)) as Material;

                if (mat == null)
                {
                    NoMaterial();
                }
                else
                {
                    // Apply it:
                    plane.GetComponent <MeshRenderer>().material = mat;
                }
            }
        }
        public static void ShowWindow()
        {
            // Show existing window instance. If one doesn't exist, make one.
            TranslateWindow = EditorWindow.GetWindow(typeof(AutoTranslate));

            // Give it a title:
            TranslateWindow.title = "Auto Translate";

            // Get the path to the Languages/UI folder:
            LanguagePath = GetLanguagePath();

            Translating = false;
            FileExists  = false;

            // Get the translation key, if we have one:
            TranslationKey = GetTranslationKey();
            // Setup the foldout:
            ShowAPIKey = (TranslationKey == "");

            // Setup the PowerUI path:
            PowerUIPath = PowerUIEditor.GetPowerUIPath();

            if (LanguagePath != "")
            {
                // Grab the language files:
                string[] files = Directory.GetFiles(LanguagePath);
                // Setup the available source array:
                AvailableSource = new string[files.Length];

                for (int i = 0; i < files.Length; i++)
                {
                    // Get the file name:
                    string[] pieces   = files[i].Replace("\\", "/").Split('/');
                    string   fileName = pieces[pieces.Length - 1];
                    // Drop the type:
                    pieces = fileName.Split('.');
                    // And put it as an available source language:
                    AvailableSource[i] = pieces[0];
                }
            }

            // Load the target languages:
            LoadAvailableLanguages();
        }
Ejemplo n.º 5
0
        private void Precompile()
        {
            if (!Precompiled)
            {
                // Undo the "PowerUI" precompiled module.
                Precompiler.Reverse("PowerUI");

                return;
            }

            List <string> paths = new List <string>();

            // Find PowerUI:
            string powerUIPath = PowerUIEditor.GetPowerUIPath();

            paths.Add(powerUIPath + "/Source");
            paths.Add(powerUIPath + "/Wrench");

            Precompiler.Precompile(
                paths,
                "PowerUI",
                EditorMode
                );
        }