示例#1
0
        private void UpdateInitConditions()
        {
            if (!this.spUseConditionsList.boolValue)
            {
                return;
            }
            if (this.spPrefabConditionsList.objectReferenceValue == null)
            {
                string conditionsName = Guid.NewGuid().ToString("N");
                GameCreatorUtilities.CreateFolderStructure(PATH_CONDITIONS);
                string path = Path.Combine(PATH_CONDITIONS, string.Format(PREFAB_NAME, conditionsName));
                path = AssetDatabase.GenerateUniqueAssetPath(path);

                GameObject sceneInstance = new GameObject(conditionsName);
                sceneInstance.AddComponent <IConditionsList>();

                GameObject prefabInstance = PrefabUtility.SaveAsPrefabAsset(sceneInstance, path);
                DestroyImmediate(sceneInstance);

                IConditionsList prefabConditions = prefabInstance.GetComponent <IConditionsList>();
                this.spPrefabConditionsList.objectReferenceValue = prefabConditions;

                this.serializedObject.ApplyModifiedPropertiesWithoutUndo();
                this.serializedObject.Update();
            }

            if (this.editorConditionsList == null)
            {
                this.editorConditionsList = Editor.CreateEditor(
                    this.spPrefabConditionsList.objectReferenceValue
                    ) as IConditionsListEditor;
            }
        }
示例#2
0
        protected void OnEnableBase()
        {
            this.targetItem = (IDialogueItem)target;

            this.spDialogue = this.serializedObject.FindProperty(PROP_DIALOGUE);
            this.spParent   = this.serializedObject.FindProperty(PROP_PARENT);
            this.spChildren = serializedObject.FindProperty(PROP_CHILDREN);

            this.spConfig         = this.serializedObject.FindProperty(PROP_CONFIG);
            this.spOverrideConfig = this.serializedObject.FindProperty(PROP_OVERR_CONFIG);

            this.spExecuteBehavior = serializedObject.FindProperty(PROP_EXECUTE_BEHAVIOR);

            this.spActionsList = serializedObject.FindProperty(PROP_ACTIONS);
            if (this.spActionsList.objectReferenceValue == null)
            {
                IActionsList actionsList = this.targetItem.gameObject.AddComponent <IActionsList>();
                actionsList.hideFlags = HideFlags.HideInInspector;

                this.spActionsList.objectReferenceValue = actionsList;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            this.spConditionList = serializedObject.FindProperty(PROP_CONDITIONS);
            if (this.spConditionList.objectReferenceValue == null)
            {
                IConditionsList conditionList = this.targetItem.gameObject.AddComponent <IConditionsList>();
                conditionList.hideFlags = HideFlags.HideInInspector;

                this.spConditionList.objectReferenceValue = conditionList;
                serializedObject.ApplyModifiedPropertiesWithoutUndo();
                serializedObject.Update();
            }

            this.spContent       = serializedObject.FindProperty(PROP_CONTENT);
            this.spContentString = this.spContent.FindPropertyRelative(PROP_CONTENT_STR);
            this.spVoice         = this.serializedObject.FindProperty(PROP_VOICE);
            this.spAutoPlay      = this.serializedObject.FindProperty(PROP_AUTOPLAY);
            this.spAutoPlayTime  = this.serializedObject.FindProperty(PROP_AUTOPLAY_TIME);

            this.spActor            = this.serializedObject.FindProperty(PROP_ACTOR);
            this.spActorSpriteIndex = this.serializedObject.FindProperty(PROP_ACTOR_SPRITE);
            this.spActorTransform   = this.serializedObject.FindProperty(PROP_ACTOR_TRANSFORM);

            this.spAfterRun       = this.serializedObject.FindProperty(PROP_AFTERRUN);
            this.spAfterRunJumpTo = this.serializedObject.FindProperty(PROP_AFTERRUN_JUMPTO);
            this.SetupJumpOptions();

            this.target.hideFlags = HideFlags.HideInInspector;
        }
示例#3
0
        public void OnDestroyItem()
        {
            if (this.spActionsOnClick.objectReferenceValue != null)
            {
                IActionsList    list1 = (IActionsList)this.spActionsOnClick.objectReferenceValue;
                IActionsList    list2 = (IActionsList)this.spActionsOnEquip.objectReferenceValue;
                IActionsList    list3 = (IActionsList)this.spActionsOnUnequip.objectReferenceValue;
                IConditionsList cond1 = (IConditionsList)this.spConditionsEquip.objectReferenceValue;

                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(list1.gameObject));
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(list2.gameObject));
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(list3.gameObject));
                AssetDatabase.DeleteAsset(AssetDatabase.GetAssetPath(cond1.gameObject));
                AssetDatabase.SaveAssets();
            }
        }