コード例 #1
0
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        //get the attricbut since it contains the range of the slider
        IndexedItemAttribute indexedItem = attribute as IndexedItemAttribute;

        if (coreData == null)
        {
            foreach (string guid in AssetDatabase.FindAssets("t: CoreData"))//looks at whole project for assets tagged CoreData
            {
                coreData = AssetDatabase.LoadAssetAtPath <CoreData>(AssetDatabase.GUIDToAssetPath(guid));
            }
        }

        switch (indexedItem.type)
        {
        case IndexedItemAttribute.IndexedItemType.SCRIPTS:
            property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetScriptNames(), null);
            break;

        case IndexedItemAttribute.IndexedItemType.STATES:
            property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetStateNames(), null);
            break;

        case IndexedItemAttribute.IndexedItemType.RAW_INPUTS:
            //property.intValue = EditorGUI.Popup(position, property.intValue, coreData.GetRawInputNames(), EditorStyles.miniButtonLeft);
            property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetRawInputNames(), null);
            break;

        case IndexedItemAttribute.IndexedItemType.CHAIN_COMMAND:
            //property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetChainCommandNames(), null);
            break;

        case IndexedItemAttribute.IndexedItemType.COMMAND_STATES:
            property.intValue = EditorGUI.IntPopup(position, property.intValue, coreData.GetCommandStateNames(), null);
            break;
        }
        //base.OnGUI(position, property, label);
    }
コード例 #2
0
    void WindowFunction(int windowID)
    {
        MoveList     currentMoveList           = coreData.moveLists[coreData.currentMovelistIndex];
        CommandState currentCommandStateObject = currentMoveList.commandStates[currentCommandStateIndex];

        if (currentCommandStateIndex >= currentMoveList.commandStates.Count)
        {
            currentCommandStateIndex = 0;
        }
        if (windowID >= currentCommandStateObject.commandSteps.Count)
        {
            return;
        }
        currentCommandStateObject.commandSteps[windowID].myRect.width  = 175;
        currentCommandStateObject.commandSteps[windowID].myRect.height = 50;


        EditorGUI.LabelField(new Rect(6, 7, 35, 20), windowID.ToString());
        currentCommandStateObject.commandSteps[windowID].command.motionCommand =
            EditorGUI.IntPopup(new Rect(25, 5, 50, 20), currentCommandStateObject.commandSteps[windowID].command.motionCommand, coreData.GetMotionCommandNames(), null, EditorStyles.miniButtonLeft);

        currentCommandStateObject.commandSteps[windowID].command.input =
            EditorGUI.IntPopup(new Rect(75, 5, 65, 20), currentCommandStateObject.commandSteps[windowID].command.input, coreData.GetRawInputNames(), null, EditorStyles.miniButtonMid);
        currentCommandStateObject.commandSteps[windowID].command.state =
            EditorGUI.IntPopup(new Rect(40, 26, 70, 20), currentCommandStateObject.commandSteps[windowID].command.state, coreData.GetStateNames(), null, EditorStyles.miniButton);

        currentCommandStateObject.commandSteps[windowID].priority =
            EditorGUI.IntField(new Rect(6, 26, 20, 20), currentCommandStateObject.commandSteps[windowID].priority);


        int nextFollowup = -1;

        nextFollowup = EditorGUI.IntPopup(new Rect(150, 15, 21, 20), nextFollowup, coreData.GetFollowUpNames(currentCommandStateIndex, true), null, EditorStyles.miniButton);

        if (nextFollowup != -1)
        {
            if (currentCommandStateObject.commandSteps.Count > 0)
            {
                if (nextFollowup >= currentCommandStateObject.commandSteps.Count + 1)
                {
                    currentCommandStateObject.RemoveChainCommands(windowID);
                }
                else if (nextFollowup >= currentCommandStateObject.commandSteps.Count)
                {
                    CommandStep nextCommand = currentCommandStateObject.AddCommandStep();
                    nextCommand.myRect.x      = currentCommandStateObject.commandSteps[windowID].myRect.xMax + 40f;
                    nextCommand.myRect.y      = currentCommandStateObject.commandSteps[windowID].myRect.center.y - 15f;
                    nextCommand.command.input = currentCommandStateObject.commandSteps[windowID].command.input;
                    nextCommand.command.state = currentCommandStateObject.commandSteps[windowID].command.state;

                    currentCommandStateObject.commandSteps[windowID].AddFollowUp(nextCommand.idIndex);
                }
                else
                {
                    currentCommandStateObject.commandSteps[windowID].AddFollowUp(nextFollowup);
                }
            }
            else
            {
                currentCommandStateObject.commandSteps[windowID].AddFollowUp(nextFollowup);
            }
            currentCommandStateObject.CleanUpBaseState();
        }

        if ((Event.current.button == 0) && (Event.current.type == EventType.MouseDown))
        {
            currentChainStep = windowID;
        }

        GUI.DragWindow();
    }