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

        if (rItem == null)
        {
            EditorGUILayout.LabelField("NULL");
            return(false);
        }

        if (rItem.Name.Length > 0)
        {
            EditorHelper.DrawSmallTitle(rItem.Name.Length > 0 ? rItem.Name : "Actor Core State");
        }
        else
        {
            string lName = BaseNameAttribute.GetName(rItem.GetType());
            EditorHelper.DrawSmallTitle(lName.Length > 0 ? lName : "Actor Core State");
        }

        // Render out the State specific inspectors
        bool lIsStateDirty = rItem.OnInspectorGUI(mTarget);

        if (lIsStateDirty)
        {
            lIsDirty = true;
        }

        if (lIsDirty)
        {
            mTarget.InstantiateStates();
        }

        return(lIsDirty);
    }
Example #2
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 DrawStateListItem(Rect rRect, int rIndex, bool rIsActive, bool rIsFocused)
    {
        if (rIndex < mTarget._States.Count)
        {
            ActorCoreState lItem = mTarget._States[rIndex];
            if (lItem == null)
            {
                EditorGUI.LabelField(rRect, "NULL");
                return;
            }

            rRect.y += 2;

            //string lName = lItem.Name;
            //if (lName.Length == 0) { lName = BaseNameAttribute.GetName(lItem.GetType()); }

            //Rect lNameRect = new Rect(rRect.x, rRect.y, rRect.width, EditorGUIUtility.singleLineHeight);
            //EditorGUI.LabelField(lNameRect, lName);



            bool  lIsDirty    = false;
            float lHSpace     = 5f;
            float lFixedWidth = lHSpace + 70f;

            //string lType = BaseNameAttribute.GetName(lItem.GetType());

            EditorGUILayout.BeginHorizontal();

            //Rect lTypeRect = new Rect(rRect.x, rRect.y, lFlexVSpace / 2f, EditorGUIUtility.singleLineHeight);
            //EditorGUI.LabelField(lTypeRect, lType);

            Rect lNameRect = new Rect(rRect.x, rRect.y, rRect.width - lFixedWidth, EditorGUIUtility.singleLineHeight);
            EditorGUI.LabelField(lNameRect, lItem.Name);

            Rect lValueRect = new Rect(lNameRect.x + lNameRect.width + lHSpace, lNameRect.y, 70f, EditorGUIUtility.singleLineHeight);
            int  lNewValue  = EditorGUI.IntField(lValueRect, lItem.Value);
            if (lNewValue != lItem.Value)
            {
                lIsDirty    = true;
                lItem.Value = lNewValue;
            }

            EditorGUILayout.EndHorizontal();

            // Update the item if there's a change
            if (lIsDirty)
            {
                mIsDirty = true;
            }
        }
    }
Example #3
0
    /// <summary>
    /// Allows us to add to a list
    /// </summary>
    /// <param name="rList"></param>
    private void OnStateListItemAdd(ReorderableList rList)
    {
        //if (mStateIndex >= mStateTypes.Count) { return; }

        //ActorCoreState lItem = Activator.CreateInstance(mStateTypes[mStateIndex]) as ActorCoreState;
        ActorCoreState lItem = new ActorCoreState();

        //lItem.ActorCore = mTarget;

        mTarget._States.Add(lItem);
        mTarget.InstantiateStates();

        mStateList.index = mTarget._States.Count - 1;
        OnStateListItemSelect(rList);

        mIsDirty = true;
    }