示例#1
0
    void DrawMissionPopup()
    {
        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        selection = EditorGUILayout.Popup(selection, missionNameList, GUILayout.Width(200f));
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();

        GUILayout.Space(5f);

        EditorGUILayout.BeginHorizontal();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("Add Mission", GUILayout.Width(120f)))
        {
            Type             missionType = missionTypeList[selection];
            LevelMissionBase mission     = LevelMissionBaseEditor.CreateMission(missionType);
            missionsProp.AddElementToArray(mission);
        }
        if (GUILayout.Button("Remove Mission", GUILayout.Width(120f)))
        {
            //missionsProp.RemoveElementAtIndex(missionsProp.arraySize - 1);	//TODO it takes 2 click to remove an instance, why?
            missionsProp.ClearArray();
        }
        GUILayout.FlexibleSpace();
        EditorGUILayout.EndHorizontal();
    }