Example #1
0
    public static void OnGui(MapEditor wind)
    {
        m_deletegroup.Clear();
        LevelMapData data = wind.Level_Data;

        m_scroll = GUILayout.BeginScrollView(m_scroll);
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();
        GUILayout.Label(data.Name, GUILayout.Width(200));
        GUILayout.Label("关卡数:" + data.Configs.Count, GUILayout.Width(300));
        GUILayout.EndHorizontal();


        GUILayout.BeginHorizontal();
        bool isadd = false;

        if (isaddmode)
        {
            string temp = "0";
            isadd = GUILayout.Button("确认");
            GUILayout.Label("关卡ID", GUILayout.Width(50));
            temp = GUILayout.TextField(id.ToString());
            id   = uint.Parse(temp);
            if (GUILayout.Button("取消"))
            {
                isaddmode = false;
            }
        }
        else
        {
            isaddmode = GUILayout.Button("添加关卡", GUILayout.Width(75));
            GUILayout.Label("筛选关卡:", GUILayout.Width(50));
            if (GUILayout.Button("清空", GUILayout.Width(40)))
            {
                wind.selectedLevel = string.Empty;
            }
            wind.selectedLevel = GUILayout.TextField(wind.selectedLevel, GUILayout.Width(50));
            GUILayout.Space(10);
            if (GUILayout.Button("关卡类型", MapEditor.toolbarDropdown, GUILayout.Width(75)))
            {
                GenericMenu menu = new UnityEditor.GenericMenu();
                //menu.AddSeparator("");
                menu.AddItem(new GUIContent("全部"), false, () => { wind.selectedLevel_Type = 0; });
                menu.AddItem(new GUIContent("冒险关卡"), false, () => { wind.selectedLevel_Type = 1; });
                menu.AddItem(new GUIContent("签到关卡"), false, () => { wind.selectedLevel_Type = 2; });
                //menu.DropDown(new Rect(0, 0, 20, 30));
                menu.ShowAsContext();
            }
        }
        if (isadd)
        {
            AddConfig(wind, id);
            isaddmode = false;
        }
        if (GUILayout.Button("编辑工具格子", GUILayout.Width(150)))
        {
            wind.Pagetype = MapEditor.PageType.EditorSub;
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal();
        GUILayout.Label("地图ID", GUILayout.Width(200));
        GUILayout.Label("对应的关卡ID", GUILayout.Width(250));
        GUILayout.Label("规格:", GUILayout.Width(200));
        GUILayout.EndHorizontal();

        foreach (var k in data.Configs)
        {
            ConfigItem.OnGui(k, wind);
        }
        GUILayout.EndVertical();
        GUILayout.EndScrollView();
        if (m_deletegroup.Count > 0)
        {
            wind.Level_Data.DeleteConfig(m_deletegroup);
        }
    }