EdenAutoMorpher_ProfileSaver_Editor 디컴파일 소스 추가
This commit is contained in:
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: f4b157cb0292d6a43b5b593c5d80b658
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -0,0 +1,196 @@
|
|||||||
|
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
||||||
|
// for ex. property getter/setter access. To get optimal decompilation results, please manually add the missing references to the list of loaded assemblies.
|
||||||
|
// EdenAutoMorpher_ProfileSaver_Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
|
// EdenAutoMorpher_ProfileSaverEditor
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Eden.AutoMorpher;
|
||||||
|
using Eden.AutoMorpher.profile;
|
||||||
|
using UnityEditor;
|
||||||
|
using UnityEngine;
|
||||||
|
|
||||||
|
[CustomEditor(typeof(EdenAutoMorpher_ProfileSaver))]
|
||||||
|
public class EdenAutoMorpher_ProfileSaverEditor : Editor
|
||||||
|
{
|
||||||
|
private EdenAutoMorpher_ProfileSaver saver;
|
||||||
|
|
||||||
|
private ProfileUtils profileUtils;
|
||||||
|
|
||||||
|
private string errorMessage;
|
||||||
|
|
||||||
|
private bool hasError;
|
||||||
|
|
||||||
|
private void OnEnable()
|
||||||
|
{
|
||||||
|
saver = (EdenAutoMorpher_ProfileSaver)base.target;
|
||||||
|
profileUtils = new ProfileUtils();
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void OnInspectorGUI()
|
||||||
|
{
|
||||||
|
base.serializedObject.Update();
|
||||||
|
DrawProfileVersion();
|
||||||
|
EditorGUILayout.Space(8f);
|
||||||
|
DrawGuideMessage();
|
||||||
|
EditorGUILayout.Space(10f);
|
||||||
|
DrawRequiredInputFields();
|
||||||
|
EditorGUILayout.Space(10f);
|
||||||
|
DrawSavePath();
|
||||||
|
EditorGUILayout.Space(8f);
|
||||||
|
ValidateInputs();
|
||||||
|
DrawErrorMessage();
|
||||||
|
EditorGUILayout.Space(12f);
|
||||||
|
DrawSaveButton();
|
||||||
|
base.serializedObject.ApplyModifiedProperties();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawProfileVersion()
|
||||||
|
{
|
||||||
|
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
|
||||||
|
int profileVersion = profileUtils.GetProfileVersion();
|
||||||
|
EditorGUILayout.BeginHorizontal();
|
||||||
|
EditorGUILayout.LabelField("EDEN Auto Morpher - Profile Saver", EditorStyles.boldLabel);
|
||||||
|
GUILayout.FlexibleSpace();
|
||||||
|
Language currentLanguage = LanguageManager.CurrentLanguage;
|
||||||
|
Language val = currentLanguage;
|
||||||
|
val = (Language)(object)EditorGUILayout.EnumPopup((Enum)(object)currentLanguage, GUILayout.Width(80f));
|
||||||
|
if (val != currentLanguage)
|
||||||
|
{
|
||||||
|
LanguageManager.SetLanguage(val);
|
||||||
|
GUI.FocusControl(null);
|
||||||
|
}
|
||||||
|
EditorGUILayout.EndHorizontal();
|
||||||
|
EditorGUILayout.LabelField($"Profile Version : {profileVersion}", EditorStyles.boldLabel);
|
||||||
|
EditorGUILayout.Space(6f);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawGuideMessage()
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox("\n" + LanguageManager.Get("UI.ProfileSaver.Guide") + "\n", MessageType.Info);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawRequiredInputFields()
|
||||||
|
{
|
||||||
|
EditorGUILayout.LabelField("Required Input Fields", EditorStyles.boldLabel);
|
||||||
|
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
|
||||||
|
{
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
EditorGUILayout.Space(4f);
|
||||||
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("profileName"), new GUIContent("Profile Name", LanguageManager.Get("UI.ProfileSaver.ProfileName.Tooltip")));
|
||||||
|
EditorGUILayout.Space(6f);
|
||||||
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceAvatar"), new GUIContent("Source Avatar", LanguageManager.Get("UI.ProfileSaver.SourceAvatar.Tooltip")));
|
||||||
|
EditorGUILayout.Space(6f);
|
||||||
|
EditorGUI.indentLevel++;
|
||||||
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceBodyMeshes"), new GUIContent("Source Body Meshes", LanguageManager.Get("UI.ProfileSaver.SourceBodyMeshes.Tooltip")), true);
|
||||||
|
EditorGUILayout.Space(4f);
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
EditorGUI.indentLevel--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawSavePath()
|
||||||
|
{
|
||||||
|
EditorGUILayout.LabelField("Save Path", EditorStyles.boldLabel);
|
||||||
|
string text = Path.Combine(profileUtils.GetProfileBasePath(), saver.profileName ?? string.Empty);
|
||||||
|
using (new EditorGUI.DisabledScope(disabled: true))
|
||||||
|
{
|
||||||
|
EditorGUILayout.TextField(text);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void ValidateInputs()
|
||||||
|
{
|
||||||
|
errorMessage = "\n";
|
||||||
|
hasError = false;
|
||||||
|
if (string.IsNullOrEmpty(saver.profileName))
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.ProfileNameEmpty") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
if (saver.sourceAvatar == null)
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarNull") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
else if (saver.sourceAvatar.GetComponent<Animator>() == null)
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarAnimatorMissing") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
if (saver.sourceBodyMeshes == null || saver.sourceBodyMeshes.Count == 0)
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesEmpty") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (IsBodyMeshesContainNull())
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesContainNull") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
if (saver.sourceAvatar != null && IsBodyMeshNotChildOfAvatar())
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BodyMeshNotChildOfAvatar") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!saver.IsExistBaseData())
|
||||||
|
{
|
||||||
|
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BaseDataMissing") + "\n";
|
||||||
|
hasError = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsBodyMeshesContainNull()
|
||||||
|
{
|
||||||
|
foreach (SkinnedMeshRenderer sourceBodyMesh in saver.sourceBodyMeshes)
|
||||||
|
{
|
||||||
|
if (sourceBodyMesh == null)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsBodyMeshNotChildOfAvatar()
|
||||||
|
{
|
||||||
|
foreach (SkinnedMeshRenderer sourceBodyMesh in saver.sourceBodyMeshes)
|
||||||
|
{
|
||||||
|
if (sourceBodyMesh != null && !sourceBodyMesh.transform.IsChildOf(saver.sourceAvatar.transform))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawErrorMessage()
|
||||||
|
{
|
||||||
|
if (hasError)
|
||||||
|
{
|
||||||
|
EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void DrawSaveButton()
|
||||||
|
{
|
||||||
|
using (new EditorGUI.DisabledScope(hasError))
|
||||||
|
{
|
||||||
|
if (GUILayout.Button("Save Profile", GUILayout.Height(34f)))
|
||||||
|
{
|
||||||
|
saver.SaveProfile();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 06e603c0e6910f74e8ae69f4b1025e99
|
||||||
Reference in New Issue
Block a user