效果图
在这里插入图片描述
GUI部分代码展示

  private Vector2 scrollPos=new Vector2 (0,0);
  private bool IsAllOperation = false;
  private void OnGUI()
    {
        GUILayout.BeginHorizontal("HelpBox");
        textStyle.fontSize=17;
        GUILayout.Label("选择需要导入到客户端工程的关卡", textStyle,GUILayout.Width(300));
        GUILayout.FlexibleSpace();
        GUILayout.FlexibleSpace();
        GUILayout.FlexibleSpace();
        if (GUILayout.Button("确定导出", GUILayout.Width(100)))
        {
            foreach(var child in mapDic)
            {
                if(child.Value)
                {
                    Copy(child.Key);
                }
            }
        }
        GUILayout.EndHorizontal();

        GUILayout.BeginHorizontal("PopupCurveSwatchBackground");
        GUILayout.Label("关卡名称", textStyle, GUILayout.Width(200));
        GUILayout.Label("选择", textStyle, GUILayout.Width(100));
        bool tempIsAll = IsAllOperation;
        tempIsAll = GUILayout.Toggle(tempIsAll, "全选",GUILayout.Width(100));
        if(tempIsAll!=IsAllOperation)
        {
            IsAllOperation = tempIsAll;
            foreach(var child in all_map.Split(':'))
            {
                if (mapDic.ContainsKey(child))
                {
                    mapDic[child] = IsAllOperation;
                }
            }
        }
        GUILayout.FlexibleSpace();
        GUILayout.EndHorizontal();


        scrollPos = GUILayout.BeginScrollView(scrollPos);
        textStyle.fontSize = 10;
        foreach (var map in all_map.Split(':'))
        {
            if(mapDic.ContainsKey(map))
            {
                GUILayout.Space(5);
                GUILayout.BeginHorizontal("PopupCurveSwatchBackground");
                GUILayout.Label("  "+map, textStyle, GUILayout.Width(200));
                bool isOperation = mapDic[map];
                isOperation = GUILayout.Toggle(isOperation,"",GUILayout.Width(200));
                mapDic[map] = isOperation;
                GUILayout.EndHorizontal();
            }
        }
        GUILayout.EndScrollView();
}

更多推荐