<commit_before>﻿using UnityEngine;
using System.Collections;
using KEngine;
using KEngine.UI;
using UnityEditor;

namespace KSFramework.Editor
{

    public class KSFrameworkEditor
    {
        private const string LastScenePrefKey = "KSFramework.LastSceneOpen";

        [MenuItem("KEngine/KSFramework/Open Last Scene(before main) %&o")]
        public static void OpenLastScene()
        {
            var lastScene = EditorPrefs.GetString(LastScenePrefKey);
            KLogger.Log("Open Last Game Scene!");
            if (!string.IsNullOrEmpty(lastScene))
                EditorApplication.OpenScene(lastScene);
            else
            {
                KLogger.LogWarning("Not found last scene!");
            }
        }

        [MenuItem("KEngine/KSFramework/Open Main Scene %&i")]
        public static void OpenMainScene()
        {
            var mainScene = "Assets/Game.unity";
            if (mainScene != EditorApplication.currentScene)
                EditorPrefs.SetString(LastScenePrefKey, EditorApplication.currentScene);

            KLogger.Log("Open Main Game Scene!");
            EditorApplication.OpenScene(mainScene);
        }

        /// <summary>
        /// 找到所有的LuaUIController被进行Reload
        /// 如果Reload时，UI正在打开，将对其进行关闭，并再次打开，来立刻看到效果
        /// </summary>
        [MenuItem("KEngine/UI(UGUI)/Reload UI Lua %&r")]
        public static void ReloadUI()
        {
            if (!EditorApplication.isPlaying)
            {
                KLogger.LogError("Reload UI only when your editor is playing!");
                return;
            }
            foreach (var kv in UIModule.Instance.UIWindows)
            {
                var luaController = kv.Value.UIWindow as LuaUIController;
                if (luaController) // 只处理LuaUIController
                {
                    var inOpenState = UIModule.Instance.IsOpen(kv.Key);<commit_msg>UI Shortcuts for Reload Lua<commit_after>﻿using UnityEngine;
using System.Collections;
using KEngine;
using KEngine.UI;
using UnityEditor;

namespace KSFramework.Editor
{

    public class KSFrameworkEditor
    {
        private const string LastScenePrefKey = "KSFramework.LastSceneOpen";

        [MenuItem("KEngine/KSFramework/Open Last Scene(before main) %&o")]
        public static void OpenLastScene()
        {
            var lastScene = EditorPrefs.GetString(LastScenePrefKey);
            KLogger.Log("Open Last Game Scene!");
            if (!string.IsNullOrEmpty(lastScene))
                EditorApplication.OpenScene(lastScene);
            else
            {
                KLogger.LogWarning("Not found last scene!");
            }
        }

        [MenuItem("KEngine/KSFramework/Open Main Scene %&i")]
        public static void OpenMainScene()
        {
            var mainScene = "Assets/Game.unity";
            if (mainScene != EditorApplication.currentScene)
                EditorPrefs.SetString(LastScenePrefKey, EditorApplication.currentScene);

            KLogger.Log("Open Main Game Scene!");
            EditorApplication.OpenScene(mainScene);
        }

        [MenuItem("KEngine/UI(UGUI)/Reload UI Lua %&r")]
        public static void ReloadLuaCache()
        {
            if (!EditorApplication.isPlaying)
            {
                KLogger.LogError("Reload UI only when your editor is playing!");
                return;
            }
            foreach (var kv in UIModule.Instance.UIWindows)
            {
                var luaController = kv.Value.UIWindow as LuaUIController;
                if (luaController) // 只处理LuaUIController
                {
                    luaController.ReloadLua();
                    KLogger.LogWarning("Reload Lua - {0}", kv.Key);
                }
            }
        }
        /// <summary>
        /// 找到所有的LuaUIController被进行Reload
        /// 如果Reload时，UI正在打开，将对其进行关闭，并再次打开，来立刻看到效果
        /// </summary>
        [MenuItem("KEngine/UI(UGUI)/Reload Lua + ReOpen UI #%&r")]
        public static void ReloadUI()
        {
            if (!EditorApplication.isPlaying)
            {
                KLogger.LogError("Reload UI only when your editor is playing!");
                return;
            }
            foreach (var kv in UIModule.Instance.UIWindows)
            {
                var luaController = kv.Value.UIWindow as LuaUIController;
                if (luaController) // 只处理LuaUIController
                {
                    var inOpenState = UIModule.Instance.IsOpen(kv.Key);
{'fraction_non_alphanumeric': 0.09405719392314567, 'fraction_numerical': 0.00022341376228775692, 'mean_word_length': 1.806896551724138, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '816468', 'n_tokens_mistral': 1245, 'n_tokens_neox': 1223, 'n_words': 249}