Exemple #1
0
    void DisplayListArea()
    {
        EditorGUILayout.BeginVertical(GUILayout.Width(250));
        EditorGUILayout.Space();

        _scrollPos = EditorGUILayout.BeginScrollView(_scrollPos, "box", GUILayout.ExpandHeight(true));

        for (int cnt = 0; cnt < weapons.COUNT; cnt++)
        {
            EditorGUILayout.BeginHorizontal();
            if (GUILayout.Button("-", GUILayout.Width(25)))
            {
                weapons.RemoveAt(cnt);
                weapons.SortAlphabeticallyAtoZ();
                EditorUtility.SetDirty(weapons);
                state = State.BLANK;
                return;
            }

            if (GUILayout.Button(weapons.Weapon(cnt).weaponName, "box", GUILayout.ExpandWidth(true)))
            {
                selectedWeapon = cnt;
                state          = State.EDIT;
            }

            EditorGUILayout.EndHorizontal();
        }

        EditorGUILayout.EndScrollView();

        EditorGUILayout.BeginHorizontal(GUILayout.ExpandWidth(true));
        EditorGUILayout.LabelField("Weapons: " + weapons.COUNT, GUILayout.Width(100));

        if (GUILayout.Button("New Weapon"))
        {
            state = State.ADD;
        }

        EditorGUILayout.EndHorizontal();
        EditorGUILayout.Space();
        EditorGUILayout.EndVertical();
    }