void OnEnable()
        {
            helper = (TextLocalizedHelper)target;
            keys   = new List <string>();

            var  assemblies = AppDomain.CurrentDomain.GetAssemblies();
            Type keysType   = null;

            foreach (var ass in assemblies)
            {
                if (ass.GetName().Name == "Assembly-CSharp")
                {
                    keysType = ass.GetType("LString");
                    break;
                }
            }
            if (keysType == null)
            {
                _error = "没有找到自动生成的常量Key类 LString";
                Debug.LogError(_error);
                return;
            }
            var fields = keysType.GetFields(BindingFlags.Static | BindingFlags.Public);

            foreach (var fieldInfo in fields)
            {
                keys.Add(fieldInfo.Name);
            }

            keyProperty = serializedObject.FindProperty("Key");
        }
Exemplo n.º 2
0
        void OnEnable()
        {
            helper = (TextLocalizedHelper)target;
            keys   = new List <string>();

            var keysType = typeof(TextLocalizedHelper).Assembly.GetType("LString");

            if (keysType == null)
            {
                _error = "没有找到自动生成的常量Key类 LString";
                Debug.LogError(_error);
                return;
            }
            var fields = keysType.GetFields(BindingFlags.Static | BindingFlags.Public);

            foreach (var fieldInfo in fields)
            {
                keys.Add(fieldInfo.Name);
            }

            keyProperty = serializedObject.FindProperty("Key");
        }