Esempio n. 1
0
        void OnGUI()
        {
            settings = XZEditorUtility.LoadScriptableAsset <Settings>(Settings.AssetName);
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("XZFramework Settings", GUIStyle_Title);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Quality", GUIStyle_SectionTitle);
            settings.FrameRate    = EditorGUILayout.IntSlider("Frame Rate", settings.FrameRate, 30, 120);
            settings.SleepTimeout = (int)(SleepTimeout)EditorGUILayout.EnumPopup("Sleep Timeout", (SleepTimeout)settings.SleepTimeout);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Mode", GUIStyle_SectionTitle);
            settings.DebugMode  = EditorGUILayout.Toggle("Debug Mode", settings.DebugMode);
            settings.UpdateMode = EditorGUILayout.Toggle("Update Mode", settings.UpdateMode);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Network", GUIStyle_SectionTitle);
            EditorGUILayout.PrefixLabel("Server URL");
            settings.ServerUrl = EditorGUILayout.TextField(settings.ServerUrl);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Asset Bundle", GUIStyle_SectionTitle);
            settings.BundleDirName   = EditorGUILayout.TextField("Dir Name", settings.BundleDirName);
            settings.BundleExtension = EditorGUILayout.TextField("Extension", settings.BundleExtension);

            EditorGUILayout.Space();
            EditorGUILayout.LabelField("Lua", GUIStyle_SectionTitle);
            settings.LuaDirName = EditorGUILayout.TextField("Dir Name", settings.LuaDirName);

            if (GUI.changed)
            {
                EditorUtility.SetDirty(settings);
            }
        }
 /// <summary>
 /// 复制所有的Lua文件
 /// </summary>
 protected static void HandleLuaFile()
 {
     if (!Directory.Exists(luaDirPath))
     {
         Directory.CreateDirectory(luaDirPath);
     }
     string[] luaSources =
     {
         Application.dataPath + "/Lua/",
         Application.dataPath + "/ToLua/Lua/",
     };
     for (int i = 0; i < luaSources.Length; i++)
     {
         fileList.Clear();
         DirTraverse(luaSources[i]);
         int n = 0;
         foreach (string filePath in fileList)
         {
             if (filePath.EndsWith(".meta"))
             {
                 continue;
             }
             string newPath = luaDirPath + filePath.Replace(luaSources[i], "");
             string newDir  = Path.GetDirectoryName(newPath);
             if (!Directory.Exists(newDir))
             {
                 Directory.CreateDirectory(newDir);
             }
             if (File.Exists(newPath))
             {
                 File.Delete(newPath);
             }
             File.Copy(filePath, newPath, true);
             XZEditorUtility.ShowProgress(newPath, n++, fileList.Count);
         }
     }
     XZEditorUtility.CloseProgress();
     AssetDatabase.Refresh();
 }