// INITIALIZERS: --------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            this.instance = (StatsAsset)target;

            this.spStats            = serializedObject.FindProperty("stats");
            this.editorSortableList = new EditorSortableList();

            this.UpdateSubEditors(this.instance.stats);
        }
        // INITIALIZERS: --------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }
            this.instance = (AttrsAsset)target;

            this.spAttribute        = serializedObject.FindProperty("attributes");
            this.editorSortableList = new EditorSortableList();

            this.UpdateSubEditors(this.instance.attributes);
        }
        // INITIALIZE: -------------------------------------------------------------------------------------------------

        private void OnEnable()
        {
            if (target == null || serializedObject == null)
            {
                return;
            }

            SerializedProperty spInventoryCatalogue = serializedObject.FindProperty(PROP_INVENTORY_CATALOGUE);

            this.spItems     = spInventoryCatalogue.FindPropertyRelative(PROP_INVENTORY_CATALOGUE_ITEMS);
            this.spRecipes   = spInventoryCatalogue.FindPropertyRelative(PROP_INVENTORY_CATALOGUE_RECIPE);
            this.spItemTypes = spInventoryCatalogue.FindPropertyRelative(PROP_INVENTORY_CATALOGUE_TYPES);

            SerializedProperty spInventorySettings = serializedObject.FindProperty(PROP_INVENTORY_SETTINGS);

            this.spMerchantUIPrefab   = spInventorySettings.FindPropertyRelative(PROP_MERCHANT_UI_PREFAB);
            this.spContainerUIPrefab  = spInventorySettings.FindPropertyRelative(PROP_CONTAINER_UI_PREFAB);
            this.spInventoryUIPrefab  = spInventorySettings.FindPropertyRelative(PROP_INVENTORY_UI_PREFAB);
            this.spItemOnDragGrabItem = spInventorySettings.FindPropertyRelative(PROP_INVENTORY_ONDRAG_GRABITEM);
            this.spItemCursorDrag     = spInventorySettings.FindPropertyRelative(PROP_ITEM_CURSOR_DRAG);
            this.spSaveInventory      = spInventorySettings.FindPropertyRelative(PROP_SAVE_INVENTORY);

            this.spItemCursorDragHotspot = spInventorySettings.FindPropertyRelative(PROP_ITEM_CURSOR_DRAG_HS);

            this.spItemDragToCombine = spInventorySettings.FindPropertyRelative(PROP_ITEM_DRAG_TO_COMBINE);
            this.spInventoryStopTime = spInventorySettings.FindPropertyRelative(PROP_STOPTIME_ONOPEN);
            this.spCanDropItems      = spInventorySettings.FindPropertyRelative(PROP_DROP_ITEM_OUTSIDE);
            this.spDropMaxDistance   = spInventorySettings.FindPropertyRelative(PROP_DROP_MAX_DISTANCE);

            this.spLimitWeight = spInventorySettings.FindPropertyRelative(PROP_LIMIT_WEIGHT);
            this.spMaxWeight   = spInventorySettings.FindPropertyRelative(PROP_MAX_WEIGHT);

            int itemsSize = this.spItems.arraySize;

            this.itemsData = new List <ItemsData>();
            for (int i = 0; i < itemsSize; ++i)
            {
                this.itemsData.Add(new ItemsData(this.spItems.GetArrayElementAtIndex(i)));
            }

            int recipesSize = this.spRecipes.arraySize;

            this.recipesData = new List <RecipeData>();
            for (int i = 0; i < recipesSize; ++i)
            {
                this.recipesData.Add(new RecipeData(this.spRecipes.GetArrayElementAtIndex(i)));
            }

            this.editorSortableListItems   = new EditorSortableList();
            this.editorSortableListRecipes = new EditorSortableList();
        }
        private void PaintInspector(bool usingSearch)
        {
            if (this.enableEditor)
            {
                this.enableEditor = false;
                this.spReferences = serializedObject.FindProperty("references");

                this.UpdateSubEditors(this.GetReferences());
                this.editorSortableList = new EditorSortableList();
                this.InitializeStyles();
            }

            serializedObject.Update();
            this.UpdateSubEditors(this.GetReferences());

            this.PaintCreateVariable(usingSearch);
            this.PaintVariablesList(usingSearch);

            serializedObject.ApplyModifiedProperties();
        }
Esempio n. 5
0
        // INITIALIZE: -------------------------------------------------------------------------------------------------

        private void OnEnable()
        {
            SerializedProperty spInventoryCatalogue = serializedObject.FindProperty(PROP_INVENTORY_CATALOGUE);

            this.spItems   = spInventoryCatalogue.FindPropertyRelative(PROP_INVENTORY_CATALOGUE_ITEMS);
            this.spRecipes = spInventoryCatalogue.FindPropertyRelative(PROP_INVENTORY_CATALOGUE_RECIPE);

            SerializedProperty spInventorySettings = serializedObject.FindProperty(PROP_INVENTORY_SETTINGS);

            this.spInventoryUIPrefab     = spInventorySettings.FindPropertyRelative(PROP_INVENTORY_UI_PREFAB);
            this.spItemOnDragGrabItem    = spInventorySettings.FindPropertyRelative(PROP_INVENTORY_ONDRAG_GRABITEM);
            this.spItemCursorDrag        = spInventorySettings.FindPropertyRelative(PROP_ITEM_CURSOR_DRAG);
            this.spItemCursorDragHotspot = spInventorySettings.FindPropertyRelative(PROP_ITEM_CURSOR_DRAG_HS);

            this.spItemDragToCombine = spInventorySettings.FindPropertyRelative(PROP_ITEM_DRAG_TO_COMBINE);
            this.spInventoryStopTime = spInventorySettings.FindPropertyRelative(PROP_STOPTIME_ONOPEN);
            this.spCanDropItems      = spInventorySettings.FindPropertyRelative(PROP_DROP_ITEM_OUTSIDE);
            this.spDropMaxDistance   = spInventorySettings.FindPropertyRelative(PROP_DROP_MAX_DISTANCE);

            int itemsSize = this.spItems.arraySize;

            this.itemsData = new List <ItemsData>();
            for (int i = 0; i < itemsSize; ++i)
            {
                this.itemsData.Add(new ItemsData(this.spItems.GetArrayElementAtIndex(i)));
            }

            int recipesSize = this.spRecipes.arraySize;

            this.recipesData = new List <RecipeData>();
            for (int i = 0; i < recipesSize; ++i)
            {
                this.recipesData.Add(new RecipeData(this.spRecipes.GetArrayElementAtIndex(i)));
            }

            this.editorSortableListItems   = new EditorSortableList();
            this.editorSortableListRecipes = new EditorSortableList();
        }
 private void OnDisable()
 {
     this.editorSortableList = null;
     this.CleanSubEditors();
 }