Example #1
0
        /// <summary>
        /// Renders the currently selected step
        /// </summary>
        /// <param name="rStep"></param>
        private bool DrawItemDetailItem(SpellInventoryItem rItem)
        {
            bool lIsDirty = false;

            EditorHelper.DrawSmallTitle(rItem.Name.Length > 0 ? rItem.Name : "Spell Inventory Item");

            if (rItem.SpellPrefab != null && rItem.SpellPrefab.Description.Length > 0)
            {
                EditorHelper.DrawInspectorDescription(rItem.SpellPrefab.Description, MessageType.None);
            }
            else
            {
                EditorGUILayout.LabelField("", GUILayout.Height(1f));
            }

            if (EditorHelper.TextField("Name", "Friendly name of the spell item", rItem._Name, mTarget))
            {
                lIsDirty   = true;
                rItem.Name = EditorHelper.FieldStringValue;
            }

            if (EditorHelper.ObjectField <Spell>("Spell Prefab", "Spell 'template' that defines what the spell is and template-level detail like 'max range'.", rItem.SpellPrefab, mTarget))
            {
                lIsDirty          = true;
                rItem.SpellPrefab = EditorHelper.FieldObjectValue as Spell;
            }

            GUILayout.Space(2f);

            return(lIsDirty);
        }
Example #2
0
        /// <summary>
        /// Allows us to add to a list
        /// </summary>
        /// <param name="rList"></param>
        private void OnItemListItemAdd(ReorderableList rList)
        {
            SpellInventoryItem lItem = new SpellInventoryItem();

            mTarget._Spells.Add(lItem);

            mItemList.index = mTarget._Spells.Count - 1;
            OnItemListItemSelect(rList);

            mIsDirty = true;
        }
Example #3
0
        /// <summary>
        /// Allows us to draw each item in the list
        /// </summary>
        /// <param name="rRect"></param>
        /// <param name="rIndex"></param>
        /// <param name="rIsActive"></param>
        /// <param name="rIsFocused"></param>
        private void DrawItemListItem(Rect rRect, int rIndex, bool rIsActive, bool rIsFocused)
        {
            if (rIndex < mTarget._Spells.Count)
            {
                SpellInventoryItem lItem = mTarget._Spells[rIndex];

                rRect.y += 2;

                Rect lNameRect = new Rect(rRect.x, rRect.y, rRect.width - 60f, EditorGUIUtility.singleLineHeight);
                EditorGUI.LabelField(lNameRect, string.Format("[{0}] {1}", rIndex, lItem.Name));

                Rect lButtonRect = new Rect(lNameRect.x + lNameRect.width + 10f, lNameRect.y, 50f, lNameRect.height);
                if (GUI.Button(lButtonRect, "open", EditorHelper.LinkLabel))
                {
                    int lInstance = lItem.SpellPrefab.GetInstanceID();
                    SpellEditorWindow.OpenSpellEditor(lInstance);
                }
            }
        }