포매팅
This commit is contained in:
@@ -1,196 +1,195 @@
|
|||||||
// Warning: Some assembly references could not be resolved automatically. This might lead to incorrect decompilation of some parts,
|
// 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.
|
// 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_ProfileSaver_Editor, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
|
||||||
// EdenAutoMorpher_ProfileSaverEditor
|
// EdenAutoMorpher_ProfileSaverEditor
|
||||||
|
using Eden.AutoMorpher;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using Eden.AutoMorpher;
|
|
||||||
using Eden.AutoMorpher.profile;
|
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
|
|
||||||
[CustomEditor(typeof(EdenAutoMorpher_ProfileSaver))]
|
[CustomEditor(typeof(EdenAutoMorpher_ProfileSaver))]
|
||||||
public class EdenAutoMorpher_ProfileSaverEditor : Editor
|
public class EdenAutoMorpher_ProfileSaverEditor : Editor
|
||||||
{
|
{
|
||||||
private EdenAutoMorpher_ProfileSaver saver;
|
private EdenAutoMorpher_ProfileSaver saver;
|
||||||
|
|
||||||
private ProfileUtils profileUtils;
|
private ProfileUtils profileUtils;
|
||||||
|
|
||||||
private string errorMessage;
|
private string errorMessage;
|
||||||
|
|
||||||
private bool hasError;
|
private bool hasError;
|
||||||
|
|
||||||
private void OnEnable()
|
private void OnEnable()
|
||||||
{
|
{
|
||||||
saver = (EdenAutoMorpher_ProfileSaver)base.target;
|
this.saver = (EdenAutoMorpher_ProfileSaver)base.target;
|
||||||
profileUtils = new ProfileUtils();
|
this.profileUtils = new ProfileUtils();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void OnInspectorGUI()
|
public override void OnInspectorGUI()
|
||||||
{
|
{
|
||||||
base.serializedObject.Update();
|
base.serializedObject.Update();
|
||||||
DrawProfileVersion();
|
this.DrawProfileVersion();
|
||||||
EditorGUILayout.Space(8f);
|
EditorGUILayout.Space(8f);
|
||||||
DrawGuideMessage();
|
this.DrawGuideMessage();
|
||||||
EditorGUILayout.Space(10f);
|
EditorGUILayout.Space(10f);
|
||||||
DrawRequiredInputFields();
|
this.DrawRequiredInputFields();
|
||||||
EditorGUILayout.Space(10f);
|
EditorGUILayout.Space(10f);
|
||||||
DrawSavePath();
|
this.DrawSavePath();
|
||||||
EditorGUILayout.Space(8f);
|
EditorGUILayout.Space(8f);
|
||||||
ValidateInputs();
|
this.ValidateInputs();
|
||||||
DrawErrorMessage();
|
this.DrawErrorMessage();
|
||||||
EditorGUILayout.Space(12f);
|
EditorGUILayout.Space(12f);
|
||||||
DrawSaveButton();
|
this.DrawSaveButton();
|
||||||
base.serializedObject.ApplyModifiedProperties();
|
base.serializedObject.ApplyModifiedProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawProfileVersion()
|
private void DrawProfileVersion()
|
||||||
{
|
{
|
||||||
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
|
//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_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_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_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_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_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_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_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_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)
|
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
|
||||||
int profileVersion = profileUtils.GetProfileVersion();
|
int profileVersion = this.profileUtils.GetProfileVersion();
|
||||||
EditorGUILayout.BeginHorizontal();
|
EditorGUILayout.BeginHorizontal();
|
||||||
EditorGUILayout.LabelField("EDEN Auto Morpher - Profile Saver", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("EDEN Auto Morpher - Profile Saver", EditorStyles.boldLabel);
|
||||||
GUILayout.FlexibleSpace();
|
GUILayout.FlexibleSpace();
|
||||||
Language currentLanguage = LanguageManager.CurrentLanguage;
|
Language currentLanguage = LanguageManager.CurrentLanguage;
|
||||||
Language val = currentLanguage;
|
Language val = currentLanguage;
|
||||||
val = (Language)(object)EditorGUILayout.EnumPopup((Enum)(object)currentLanguage, GUILayout.Width(80f));
|
val = (Language)(object)EditorGUILayout.EnumPopup((Enum)(object)currentLanguage, GUILayout.Width(80f));
|
||||||
if (val != currentLanguage)
|
if (val != currentLanguage)
|
||||||
{
|
{
|
||||||
LanguageManager.SetLanguage(val);
|
LanguageManager.SetLanguage(val);
|
||||||
GUI.FocusControl(null);
|
GUI.FocusControl(null);
|
||||||
}
|
}
|
||||||
EditorGUILayout.EndHorizontal();
|
EditorGUILayout.EndHorizontal();
|
||||||
EditorGUILayout.LabelField($"Profile Version : {profileVersion}", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField($"Profile Version : {profileVersion}", EditorStyles.boldLabel);
|
||||||
EditorGUILayout.Space(6f);
|
EditorGUILayout.Space(6f);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawGuideMessage()
|
private void DrawGuideMessage()
|
||||||
{
|
{
|
||||||
EditorGUILayout.HelpBox("\n" + LanguageManager.Get("UI.ProfileSaver.Guide") + "\n", MessageType.Info);
|
EditorGUILayout.HelpBox("\n" + LanguageManager.Get("UI.ProfileSaver.Guide") + "\n", MessageType.Info);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawRequiredInputFields()
|
private void DrawRequiredInputFields()
|
||||||
{
|
{
|
||||||
EditorGUILayout.LabelField("Required Input Fields", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Required Input Fields", EditorStyles.boldLabel);
|
||||||
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
|
using (new EditorGUILayout.VerticalScope(EditorStyles.helpBox))
|
||||||
{
|
{
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
EditorGUILayout.Space(4f);
|
EditorGUILayout.Space(4f);
|
||||||
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("profileName"), new GUIContent("Profile Name", LanguageManager.Get("UI.ProfileSaver.ProfileName.Tooltip")));
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("profileName"), new GUIContent("Profile Name", LanguageManager.Get("UI.ProfileSaver.ProfileName.Tooltip")));
|
||||||
EditorGUILayout.Space(6f);
|
EditorGUILayout.Space(6f);
|
||||||
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceAvatar"), new GUIContent("Source Avatar", LanguageManager.Get("UI.ProfileSaver.SourceAvatar.Tooltip")));
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceAvatar"), new GUIContent("Source Avatar", LanguageManager.Get("UI.ProfileSaver.SourceAvatar.Tooltip")));
|
||||||
EditorGUILayout.Space(6f);
|
EditorGUILayout.Space(6f);
|
||||||
EditorGUI.indentLevel++;
|
EditorGUI.indentLevel++;
|
||||||
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceBodyMeshes"), new GUIContent("Source Body Meshes", LanguageManager.Get("UI.ProfileSaver.SourceBodyMeshes.Tooltip")), true);
|
EditorGUILayout.PropertyField(base.serializedObject.FindProperty("sourceBodyMeshes"), new GUIContent("Source Body Meshes", LanguageManager.Get("UI.ProfileSaver.SourceBodyMeshes.Tooltip")), true);
|
||||||
EditorGUILayout.Space(4f);
|
EditorGUILayout.Space(4f);
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
EditorGUI.indentLevel--;
|
EditorGUI.indentLevel--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSavePath()
|
private void DrawSavePath()
|
||||||
{
|
{
|
||||||
EditorGUILayout.LabelField("Save Path", EditorStyles.boldLabel);
|
EditorGUILayout.LabelField("Save Path", EditorStyles.boldLabel);
|
||||||
string text = Path.Combine(profileUtils.GetProfileBasePath(), saver.profileName ?? string.Empty);
|
string text = Path.Combine(this.profileUtils.GetProfileBasePath(), this.saver.profileName ?? string.Empty);
|
||||||
using (new EditorGUI.DisabledScope(disabled: true))
|
using (new EditorGUI.DisabledScope(disabled: true))
|
||||||
{
|
{
|
||||||
EditorGUILayout.TextField(text);
|
EditorGUILayout.TextField(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ValidateInputs()
|
private void ValidateInputs()
|
||||||
{
|
{
|
||||||
errorMessage = "\n";
|
this.errorMessage = "\n";
|
||||||
hasError = false;
|
this.hasError = false;
|
||||||
if (string.IsNullOrEmpty(saver.profileName))
|
if (string.IsNullOrEmpty(this.saver.profileName))
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.ProfileNameEmpty") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.ProfileNameEmpty") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
if (saver.sourceAvatar == null)
|
if (this.saver.sourceAvatar == null)
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarNull") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarNull") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else if (saver.sourceAvatar.GetComponent<Animator>() == null)
|
else if (this.saver.sourceAvatar.GetComponent<Animator>() == null)
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarAnimatorMissing") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceAvatarAnimatorMissing") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
if (saver.sourceBodyMeshes == null || saver.sourceBodyMeshes.Count == 0)
|
if (this.saver.sourceBodyMeshes == null || this.saver.sourceBodyMeshes.Count == 0)
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesEmpty") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesEmpty") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (IsBodyMeshesContainNull())
|
if (this.IsBodyMeshesContainNull())
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesContainNull") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.SourceBodyMeshesContainNull") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
if (saver.sourceAvatar != null && IsBodyMeshNotChildOfAvatar())
|
if (this.saver.sourceAvatar != null && this.IsBodyMeshNotChildOfAvatar())
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BodyMeshNotChildOfAvatar") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BodyMeshNotChildOfAvatar") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!saver.IsExistBaseData())
|
if (!this.saver.IsExistBaseData())
|
||||||
{
|
{
|
||||||
errorMessage = errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BaseDataMissing") + "\n";
|
this.errorMessage = this.errorMessage + LanguageManager.Get("UI.ProfileSaver.Error.BaseDataMissing") + "\n";
|
||||||
hasError = true;
|
this.hasError = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsBodyMeshesContainNull()
|
private bool IsBodyMeshesContainNull()
|
||||||
{
|
{
|
||||||
foreach (SkinnedMeshRenderer sourceBodyMesh in saver.sourceBodyMeshes)
|
foreach (SkinnedMeshRenderer sourceBodyMesh in this.saver.sourceBodyMeshes)
|
||||||
{
|
{
|
||||||
if (sourceBodyMesh == null)
|
if (sourceBodyMesh == null)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool IsBodyMeshNotChildOfAvatar()
|
private bool IsBodyMeshNotChildOfAvatar()
|
||||||
{
|
{
|
||||||
foreach (SkinnedMeshRenderer sourceBodyMesh in saver.sourceBodyMeshes)
|
foreach (SkinnedMeshRenderer sourceBodyMesh in this.saver.sourceBodyMeshes)
|
||||||
{
|
{
|
||||||
if (sourceBodyMesh != null && !sourceBodyMesh.transform.IsChildOf(saver.sourceAvatar.transform))
|
if (sourceBodyMesh != null && !sourceBodyMesh.transform.IsChildOf(this.saver.sourceAvatar.transform))
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawErrorMessage()
|
private void DrawErrorMessage()
|
||||||
{
|
{
|
||||||
if (hasError)
|
if (this.hasError)
|
||||||
{
|
{
|
||||||
EditorGUILayout.HelpBox(errorMessage, MessageType.Error);
|
EditorGUILayout.HelpBox(this.errorMessage, MessageType.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DrawSaveButton()
|
private void DrawSaveButton()
|
||||||
{
|
{
|
||||||
using (new EditorGUI.DisabledScope(hasError))
|
using (new EditorGUI.DisabledScope(this.hasError))
|
||||||
{
|
{
|
||||||
if (GUILayout.Button("Save Profile", GUILayout.Height(34f)))
|
if (GUILayout.Button("Save Profile", GUILayout.Height(34f)))
|
||||||
{
|
{
|
||||||
saver.SaveProfile();
|
this.saver.SaveProfile();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user