示例#1
0
    /// <summary>
    ///
    /// </summary>
    protected virtual void DrawInternalUnitBank(Rect pos, SerializedProperty prop)
    {
        vp_PropertyDrawerUtility.AddObjectBoxBG(pos, pos.width - 50);

        //int NOVALUE = -1;		// uncomment to hide ID field
        pos.width -= 22;
        pos.x     += 6;
        pos.y     += 2;
        vp_ItemType item = (vp_ItemType)prop.objectReferenceValue;
        string      name = item.ToString();

        //if(prop.serializedObject.targetObject.GetType() == typeof(vp_ItemPickup))		// this can be done to identify the type of host component

        if (vp_PropertyDrawerUtility.ItemCard(pos,
                                              ((item == null) ? null : item.Icon),
                                              name,
                                              ((item == null) ? null : item),
                                              ref vp_ItemAmountDrawer.ItemAmountValue,
                                              "Units",
                                              null,
                                              ref vp_ItemIDDrawer.ItemIDValue, // set to 'NOVALUE' to hide ID field
                                              "ID",                            // set to "" to hide ID field
                                              null,
                                              delegate()
        {
            prop.objectReferenceValue = null;
            vp_ItemAmountDrawer.ItemAmountValue = 0;
            vp_ItemIDDrawer.ItemIDValue = 0;
        }, 0))
        {
            vp_ItemAmountDrawer.ItemAmountTargetObject = prop.serializedObject;
        }
    }
示例#2
0
    /// <summary>
    ///
    /// </summary>
    protected virtual void DrawUnitBank(Rect pos, SerializedProperty prop)
    {
        vp_PropertyDrawerUtility.AddObjectBoxBG(pos, pos.width - 50);

        pos.width -= 22;
        pos.x     += 6;
        pos.y     += 2;
        vp_ItemType item = (vp_UnitBankType)prop.objectReferenceValue;
        string      name = item.ToString();

        if (vp_PropertyDrawerUtility.ItemCard(pos,
                                              ((item == null) ? null : item.Icon),
                                              name,
                                              ((item == null) ? null : item),
                                              ref vp_ItemAmountDrawer.ItemAmountValue,
                                              "Units",
                                              null,
                                              ref vp_ItemIDDrawer.ItemIDValue,
                                              "ID",
                                              null,
                                              delegate()
        {
            prop.objectReferenceValue = null;
            vp_ItemAmountDrawer.ItemAmountValue = 0;
            vp_ItemIDDrawer.ItemIDValue = 0;
        }, 0))
        {
            vp_ItemAmountDrawer.ItemAmountTargetObject = prop.serializedObject;
            vp_ItemIDDrawer.ItemIDTargetObject         = prop.serializedObject;
        }
    }