public void Init() { string str = ""; int rowNum = MapPanelEditor.RowNum; int total = MapPanelEditor.PictureTotal; for (int i = 0; i < total; ++i) { if ((i + 1) % rowNum == 0) { str += MapEditor.Bitmapt2HexStr(MapEditor.MapIMG_Block[i]) + " " + "\r\n"; } else { str += MapEditor.Bitmapt2HexStr(MapEditor.MapIMG_Block[i]) + " "; } } labelMapId.Text = str; }
public void GenerateMapCode(MapPanelEditor mapEditor, FolderBrowserDialog folderDialog, bool isMessgeBoxShow) { string GtPath = ""; if (mapEditor.IsFixedPath == 0) { if (folderDialog.ShowDialog() == DialogResult.OK) { GtPath = folderDialog.SelectedPath; } else { return; } } else { GtPath = Application.StartupPath + "\\EC" + "\\Chnchts" + "\\MD"; } FileStream fs = new FileStream(GtPath + MapPanelEditor.GtCodeMapName, FileMode.Create); StreamWriter sw = new StreamWriter(fs); #region 生成的地图代码 int j = 0; sw.WriteLine("[Music]"); for (int i = 0; i <= 50; ++i) { sw.WriteLine("Music" + i.ToString() + "=2BB," + i.ToString("X2")); } sw.WriteLine(""); sw.WriteLine("[MapColor]"); for (int i = 0; i <= 10; ++i) { sw.WriteLine("Color" + i.ToString() + "=2D7," + i.ToString("X2")); } sw.WriteLine(""); //sw.WriteLine("[The Egg P Value]"); //sw.WriteLine("OnChange=2C1,00"); //sw.WriteLine(""); sw.WriteLine("[MapEditor]"); sw.Write("MapEditor=9FC6,"); for (int i = 0; i <= MapPanelEditor.PictureTotal - 1; ++i) { if (i != MapPanelEditor.PictureTotal - 1) { sw.Write(mapEditor.Bitmapt2HexStr(mapEditor.MapIMG_Block[i]) + ",00" + ","); } else { sw.WriteLine(mapEditor.Bitmapt2HexStr(mapEditor.MapIMG_Block[i]) + ",00"); } } sw.Write("Test=9FC6,"); for (int i = 0; i <= MapPanelEditor.PictureTotal - 1; ++i) { if (i != MapPanelEditor.PictureTotal - 1) { if (i % 10 == 0 || i % 10 == 1 || i % 10 == 8 || i % 10 == 9 || i < 80) { sw.Write("09" + ",00" + ","); } else { if (j <= 255) { sw.Write(j.ToString("X2") + ",00" + ","); ++j; } else { sw.Write("09" + ",00" + ","); } } } else { sw.WriteLine("09" + ",00"); } } sw.WriteLine(""); //sw.WriteLine("[Theme]"); //sw.WriteLine("ON=2B5,3"); //sw.WriteLine("Theme1=2B5,01"); //sw.WriteLine("Theme2=2B5,02"); //sw.WriteLine("Theme3=2B5,03"); //sw.WriteLine("Theme4=2B5,04"); //sw.WriteLine("Theme5=2B5,05"); //sw.WriteLine("Theme6=2B5,06"); //sw.WriteLine("Theme7=2B5,07"); //sw.WriteLine("Theme8=2B5,08"); sw.WriteLine(""); sw.WriteLine("[GameInfo]"); sw.WriteLine("Name=DynaBrothers2"); sw.WriteLine("System=MD"); sw.WriteLine("Text=DynaBrothers2"); #endregion #region 关闭文件 sw.Flush(); sw.Close(); fs.Close(); #endregion if (isMessgeBoxShow == true) { MessageBox.Show("生成成功!!"); } ClosingSaveAppInfo(mapEditor); }