コード例 #1
0
    void DisplayPerkAuras()
    {
        EditorGUILayout.LabelField("Assigned Auras", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        // Display the currently-added conditions
        addedAuraScrollPos = EditorGUILayout.BeginScrollView(addedAuraScrollPos, false, false, GUILayout.MinWidth(270), GUILayout.Height(180));
        for (int i = 0; i < perkAuras.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                perkAuras.RemoveAt(i);
                break;
            }
            EditorGUILayout.LabelField(_conditionDatabase.Aura(perkAuras[i]).AuraName + " (ID " + _conditionDatabase.Aura(perkAuras[i]).AuraID + ")");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
        // Search for perks in the perk database
        conditionScrollPos = EditorGUILayout.BeginScrollView(conditionScrollPos, false, false, GUILayout.MinWidth(270), GUILayout.Height(180));
        for (int j = 0; j < _conditionDatabase.Auras.Count; j++)
        {
            int    _id   = _conditionDatabase.Auras[j].AuraID;
            string _name = _conditionDatabase.Auras[j].AuraName;

            if (perkAuras.Contains(_id))
            {
                continue;
            }

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("+", GUILayout.Width(50)))
            {
                conditionID = _id;

                if (AuraRequirementsMet())
                {
                    perkAuras.Add(conditionID);
                    // now sort the list...
                }
            }
            EditorGUILayout.LabelField(_name + " (ID " + _id + ")");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        // Display a box which allows the user to add new conditions by their IDs
        conditionID = EditorGUILayout.IntField("Aura ID: ", conditionID);
        if (GUILayout.Button("Add", GUILayout.Width(350.0f)))
        {
            if (AuraRequirementsMet())
            {
                perkAuras.Add(conditionID);
            }
        }
    }
コード例 #2
0
    void DisplayAuraList(List <int> auraList, Vector2 addedScrollPos, Vector2 availScrollPos, string header)
    {
        EditorGUILayout.LabelField("Assigned " + header + " Auras", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        // Display the currently-added conditions
        addedScrollPos = EditorGUILayout.BeginScrollView(addedScrollPos, false, false, GUILayout.MinWidth(250), GUILayout.Height(180));
        for (int i = 0; i < auraList.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                auraList.RemoveAt(i);
                break;
            }
            EditorGUILayout.LabelField(_auraDatabase.Aura(auraList[i]).AuraName + " (ID " + _auraDatabase.Aura(auraList[i]).AuraID + ")");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
        // Search for perks in the perk database
        availScrollPos = EditorGUILayout.BeginScrollView(availScrollPos, false, false, GUILayout.MinWidth(250), GUILayout.Height(180));
        for (int j = 0; j < _auraDatabase.Auras.Count; j++)
        {
            int    _id   = _auraDatabase.Auras[j].AuraID;
            string _name = _auraDatabase.Auras[j].AuraName;

            if (auraList.Contains(_id))
            {
                continue;
            }

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("+", GUILayout.Width(50)))
            {
                auraID = _id;

                if (AuraRequirementsMet(auraList))
                {
                    auraList.Add(auraID);
                    // now sort the list...
                }
            }
            EditorGUILayout.LabelField(_name + " (ID " + _id + ")");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        // Display a box which allows the user to add new conditions by their IDs
        auraID = EditorGUILayout.IntField("Aura ID: ", auraID, GUILayout.Width(350.0f));
        if (GUILayout.Button("Add", GUILayout.Width(350.0f)))
        {
            if (AuraRequirementsMet(auraList))
            {
                auraList.Add(auraID);
            }
        }
    }
コード例 #3
0
    void DisplayAuras()
    {
        EditorGUILayout.LabelField("Assigned Auras", EditorStyles.boldLabel);
        EditorGUILayout.BeginHorizontal();
        // Display the currently-added conditions
        addedAuraScrollPos = EditorGUILayout.BeginScrollView(addedAuraScrollPos, false, false, GUILayout.Width(260), GUILayout.Height(180));
        for (int i = 0; i < conditions.Count; i++)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("X", GUILayout.Width(50)))
            {
                conditions.RemoveAt(i);
                break;
            }
            EditorGUILayout.LabelField(_conditionDatabase.Aura(conditions[i]).AuraName);
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();

        // Search for perks in the perk database
        conditionScrollPos = EditorGUILayout.BeginScrollView(conditionScrollPos, false, false, GUILayout.Width(260), GUILayout.Height(180));
        for (int j = 0; j < _conditionDatabase.Auras.Count; j++)
        {
            if (conditions.Contains(_conditionDatabase.Auras[j].AuraID))
            {
                continue;
            }

            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("+", GUILayout.Width(50)))
            {
                newAuraID = _conditionDatabase.Auras[j].AuraID;

                if (AuraRequirementsMet())
                {
                    conditions.Add(newAuraID);
                    SortAuraList();
                }
            }
            EditorGUILayout.LabelField(_conditionDatabase.Auras[j].AuraName + " (ID " + _conditionDatabase.Auras[j].AuraID + ")");
            EditorGUILayout.EndHorizontal();
        }
        EditorGUILayout.EndScrollView();
        EditorGUILayout.EndHorizontal();

        EditorGUILayout.Space();

        // Display a box which allows the user to add new conditions by their IDs
        newAuraID = EditorGUILayout.IntField("Aura ID: ", newAuraID, GUILayout.Width(300));
        if (GUILayout.Button("Add New Aura", GUILayout.Width(300)))
        {
            if (AuraRequirementsMet())
            {
                conditions.Add(newAuraID);
                SortAuraList();
            }
        }
    }