コード例 #1
0
ファイル: MapEditor.cs プロジェクト: wuhuolong/MaxBooks
    private static void OnTopTool(MapEditor wind)
    {
        Init(wind);
        ToolMapArray config = wind.Level_Data.Tools;

        GUILayout.BeginHorizontal();
        if (isEdit)
        {
            isEdit = !GUILayout.Button("确认", GUILayout.Width(50));
            GenGrid(config);
        }
        else
        {
            isEdit = GUILayout.Button("编辑", GUILayout.Width(50));
        }
        if (isEdit)
        {
            int owidth  = config.WidthMap[m_StrSelect];
            int oheight = config.FillTypeMap[m_StrSelect].Length / owidth;

            GUILayout.Label("宽度:", GUILayout.Width(50));
            string tempx  = GUILayout.TextField(owidth.ToString(), GUILayout.Width(50));
            int    fwidth = int.Parse(tempx);
            config.WidthMap[m_StrSelect] = fwidth;
            GUILayout.Space(10f);

            GUILayout.Label("高度:", GUILayout.Width(50));
            tempx = GUILayout.TextField(oheight.ToString(), GUILayout.Width(50));
            int fheight = int.Parse(tempx);
            GUILayout.Space(10f);

            config.FitArray(owidth, oheight, fwidth, fheight, m_StrSelect);

            GUILayout.Label("格子大小:", GUILayout.Width(50));
            tempx    = GUILayout.TextField(CellSize.ToString(), GUILayout.Width(50));
            CellSize = int.Parse(tempx);
            GUILayout.Label("间距:", GUILayout.Width(50));
            tempx      = GUILayout.TextField(CellOffset.ToString(), GUILayout.Width(50));
            CellOffset = int.Parse(tempx);
        }
        else
        {
            int width  = config.WidthMap[m_StrSelect];
            int height = config.FillTypeMap[m_StrSelect].Length / width;
            GUILayout.Label("宽度:", GUILayout.Width(50));
            GUILayout.Label("" + width, GUILayout.Width(50));
            GUILayout.Space(10f);
            GUILayout.Label("高度:", GUILayout.Width(50));
            GUILayout.Label("" + height, GUILayout.Width(50));
        }



        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("生成"))
        {
            GenGrid(config);
        }
        if (GUILayout.Button("读取底图"))
        {
            MapEditor.BgTexture = EditorTool.LoadTexture();
        }
        if (GUILayout.Button("保存"))
        {
            wind.SaveEdit();
        }
        if (GUILayout.Button("返回总览"))
        {
            IsInit        = false;
            wind.Pagetype = MapEditor.PageType.Total;
            return;
        }
        if (!isShowbg && GUILayout.Button("显示底图"))
        {
            isShowbg = true;
        }
        if (isShowbg && GUILayout.Button("显示网格"))
        {
            isShowbg = false;
        }
        GUILayout.EndHorizontal();
    }
コード例 #2
0
ファイル: MapEditor.cs プロジェクト: wuhuolong/MaxBooks
    public static void OnGui(MapEditor wind)
    {
        Init(wind);
        isDo = false;
        LevelMapArray config = wind.Level_Config;

        GUILayout.BeginHorizontal();
        if (isEdit)
        {
            isEdit = !GUILayout.Button("确认", GUILayout.Width(50));
        }
        else
        {
            isEdit = GUILayout.Button("编辑", GUILayout.Width(50));
        }
        if (isEdit)
        {
            int owidth  = config.MapWidth;
            int oheight = config.MapHeight;
            GUILayout.Label("宽度:", GUILayout.Width(50));
            string tempx = GUILayout.TextField(config.MapWidth.ToString(), GUILayout.Width(50));
            config.MapWidth = int.Parse(tempx);
            GUILayout.Space(10f);
            GUILayout.Label("高度:", GUILayout.Width(50));
            tempx            = GUILayout.TextField(config.MapHeight.ToString(), GUILayout.Width(50));
            config.MapHeight = int.Parse(tempx);
            config.FitArray(owidth, oheight);

            //string tempxx = config.ConfigID.ToString();
            GUILayout.Label("地图ID:", GUILayout.Width(100));
            tempx = GUILayout.TextField(config.Id.ToString(), GUILayout.Width(50));
            //if (GUILayout.Button("确认", GUILayout.Width(50)))
            uint temp = uint.Parse(tempx);
            wind.curLevelId = temp;
            config.Id       = temp;

            tempx = config.ConfigID.ToString();
            GUILayout.Label("对应配置表ID:", GUILayout.Width(100));
            tempx           = GUILayout.TextField(tempx, GUILayout.Width(50));
            config.ConfigID = uint.Parse(tempx);

            config.FitArray(owidth, oheight);
            GUILayout.Label("格子大小:", GUILayout.Width(50));
            tempx    = GUILayout.TextField(CellSize.ToString(), GUILayout.Width(50));
            CellSize = int.Parse(tempx);
            config.FitArray(owidth, oheight);
            GUILayout.Label("间距:", GUILayout.Width(50));
            tempx      = GUILayout.TextField(CellOffset.ToString(), GUILayout.Width(50));
            CellOffset = int.Parse(tempx);
        }
        else
        {
            GUILayout.Label("宽度:", GUILayout.Width(50));
            GUILayout.Label("" + config.MapWidth, GUILayout.Width(50));
            GUILayout.Space(10f);
            GUILayout.Label("高度:", GUILayout.Width(50));
            GUILayout.Label("" + config.MapHeight, GUILayout.Width(50));
        }



        GUILayout.EndHorizontal();
        GUILayout.BeginHorizontal();
        if (GUILayout.Button("生成"))
        {
            GenGrid(config);
        }
        if (GUILayout.Button("读取底图"))
        {
            MapEditor.BgTexture = EditorTool.LoadTexture();
        }
        if (GUILayout.Button("保存"))
        {
            wind.SaveEdit();
        }
        if (GUILayout.Button("返回总览"))
        {
            IsInit        = false;
            wind.Pagetype = MapEditor.PageType.Total;
            return;
        }
        if (!isShowbg && GUILayout.Button("显示底图"))
        {
            isShowbg = true;
        }
        if (isShowbg && GUILayout.Button("显示网格"))
        {
            isShowbg = false;
        }
        GUILayout.EndHorizontal();
        ShowBg(wind);
        if (!isEdit && !isShowbg)
        {
            ShowGrid(wind);
        }
        if (isDo)
        {
            //wind.SaveEdit();
        }
    }