コード例 #1
0
    public override void OnInspectorGUI()
    {
        serializedObject.Update();

        EditorGUILayout.PropertyField(targetComponent);

        Localize.TargetComponent target = (Localize.TargetComponent)targetComponent.enumValueIndex;

        switch (target)
        {
        case Localize.TargetComponent.AudioSource:
            EditorGUILayout.PropertyField(audioClips, new GUIContent("AudioClips:"), true);
            ShowArrayProperty(audioClips);
            break;

        case Localize.TargetComponent.Image:
            EditorGUILayout.PropertyField(sprites, new GUIContent("Sprites:"), true);
            ShowArrayProperty(sprites);
            break;

        case Localize.TargetComponent.RTLText:
            EditorGUILayout.PropertyField(localizedString, new GUIContent("Key"), true);
            EditorGUILayout.PropertyField(outline, new GUIContent("Outline"), true);
            EditorGUILayout.PropertyField(fixedFontAsset, new GUIContent("FixedFontAsset?"), true);
            break;

        case Localize.TargetComponent.Font:
            EditorGUILayout.PropertyField(fonts, new GUIContent("Fonts:"), true);
            ShowArrayProperty(fonts);
            break;

        case Localize.TargetComponent.FontAsset:
            EditorGUILayout.PropertyField(fontAssets, new GUIContent("FontAssets:"), true);
            ShowArrayProperty(fontAssets);
            break;

        case Localize.TargetComponent.GridLayoutGroup:
            EditorGUILayout.PropertyField(startCorner, new GUIContent("StartCorner:"), true);
            break;

        case Localize.TargetComponent.Position2D:
            EditorGUILayout.PropertyField(positions, new GUIContent("2D Positions:"), true);
            ShowArrayProperty(positions);
            break;
        }

        foreach (LocalizationManager.LocalizedLanguage language in System.Enum.GetValues(typeof(LocalizationManager.LocalizedLanguage)))
        {
            if (GUILayout.Button(language.ToString()))
            {
                TargetLocalize.ApplyLocalization((int)language, true);
            }
        }

        serializedObject.ApplyModifiedProperties();
    }