Beispiel #1
0
 /// <summary>
 /// 値をオブジェクトに反映させる
 /// </summary>
 /// <param name="property">プロパティ</param>
 public void SetValues(SkinPartsPropertry property)
 {
     //値がないなら何もしない
     if (property.objectReferenceValues.Count < RequiredObjectLength)
     {
         return;
     }
     if (!userLogic)
     {
         userLogic = property.objectReferenceValues[LogicIndex] as UserLogic;
         //空か型違いのため処理終了
         if (!userLogic)
         {
             return;
         }
     }
     if (ignoredLogicProperty == null)
     {
         ignoredLogicProperty = new SkinPartsPropertry(property);
         ignoredLogicProperty.objectReferenceValues.Remove(userLogic);
     }
     UserLogicExtension.SetActiveUserLogic(userLogic);
     userLogic.SetValues(ignoredLogicProperty);
     UserLogicExtension.ReleaseActiveUserLogic();
 }
        public override void OnInspectorGUI()
        {
            base.OnInspectorGUI();
            SkinnerEditorUtility.DrawLine();
            EditorGUILayout.LabelField(EditorConst.UserLogicSampleTitle);
            SkinnerEditorUtility.DrawLine();

            UserLogic drawTarget = serializedObject.targetObject as UserLogic;

            ReloadDummyData(drawTarget);

            var scriptableLogic = SkinPartsInspectorAccess.GetSkinInspector(typeof(ScriptableLogic));

            // ダミーデータをマッピングする
            dummyProperty.serializedObject.Update();
            dummyEditorSkinPartsProperty.MapProperties(dummyProperty);

            GUI.enabled = false;

            // ダミーデータを描画
            UserLogicExtension.SetActiveUserLogic(drawTarget);
            scriptableLogic.CleanupFields(dummyEditorSkinPartsProperty);
            scriptableLogic.DrawInspector(dummyEditorSkinPartsProperty);
            UserLogicExtension.ReleaseActiveUserLogic();

            GUI.enabled = true;

            // ダミーデータを更新
            dummyProperty.serializedObject.ApplyModifiedPropertiesWithoutUndo();

            SkinnerEditorUtility.DrawLine();
        }