Example #1
0
        private void onSetValue()
        {
            int  outdata;
            bool isInt = int.TryParse(textBoxData.Text, out outdata);

            if (isInt)
            {
                {
                    OldDataPack pack = OldDataPackBook.GetPack("cfg_item");
                    if (pack.data.ContainsKey(outdata))
                    {
                        labelData.Text      = pack.data[outdata][1];
                        labelData.ForeColor = Color.Orange;
                        return;
                    }
                }

                {
                    OldDataPack pack = OldDataPackBook.GetPack("cfg_equip");
                    if (pack.data.ContainsKey(outdata))
                    {
                        labelData.Text      = pack.data[outdata][1];
                        labelData.ForeColor = Color.Orange;
                        return;
                    }
                }
            }
            labelData.Text      = "无";
            labelData.ForeColor = Color.LightGray;
        }
Example #2
0
        private void refreshList(int selid)
        {
            int index = 0;

            listViewIds.Items.Clear();

            IniFile configData = new IniFile(String.Format("config/db/{0}.ini", packName));
            string  firstbind  = configData.IniReadValue("main", "firstbind");
            string  nameindex  = configData.IniReadValue("main", "nameindex");

            if (nameindex != "")
            {
                nameIndex = int.Parse(nameindex);
            }

            foreach (int id in pack.keys.Keys)
            {
                string name = "";
                if (firstbind != "")
                {
                    name = OldDataPackBook.GetPack(firstbind).data[id][nameIndex];
                }
                ListViewItem lvm = new ListViewItem(String.Format("{0}.{1}({2}项)", id, name, pack.keys[id]));
                listViewIds.Items.Add(lvm);
                if ((index == selid && index == 0) || selid == id)
                {
                    lvm.Selected = true;
                    lvm.EnsureVisible();
                }
                index++;
            }
            this.Text = String.Format("{0} (总计{1}条) (缓存时间{2})", packName, pack.keys.Count, pack.cachTime.ToString());
        }
Example #3
0
        private void DataViewForm_Load(object sender, EventArgs e)
        {
            pack = OldDataPackBook.GetPack(packName);

            foreach (String head in pack.header)
            {
                dataGridView1.Columns.Add(head, head);
                int index = pack.GetPackIndexByName(head);
                if (pack.datatype[index] == "int")
                {
                    dataGridView1.Columns[head].Width = 40;
                }
                dataGridView1.Columns[head].HeaderText = pack.comment[index];
            }

            foreach (int key in pack.data.Keys)
            {
                dataGridView1.Rows.Add(pack.data[key].ToArray());
                dataGridView1.Rows[dataGridView1.Rows.Count - 1].HeaderCell.Value = key.ToString();
            }

            this.Text = String.Format("{0} (总计{1}条) (缓存时间{2})", packName, pack.data.Values.Count, pack.cachTime.ToString());

            isLoad = true;
        }
Example #4
0
 private void onSetValue()
 {
     try
     {
         if (textBoxData.Text.Contains(":"))
         {
             string[]    infos = textBoxData.Text.Split(':');
             OldDataPack pack  = OldDataPackBook.GetPack("cfg_task");
             if (pack.data.ContainsKey(int.Parse(infos[0])))
             {
                 labelData.Text      = pack.data[int.Parse(infos[0])][1];
                 labelData.ForeColor = Color.Orange;
                 if (infos[1] == "3")
                 {
                     labelData.Text += "(接受)";
                 }
                 else if (infos[1] == "4")
                 {
                     labelData.Text += "(达成)";
                 }
                 else if (infos[1] == "5")
                 {
                     labelData.Text += "(提交)";
                 }
                 return;
             }
         }
     }
     catch { }
     labelData.Text      = "";
     labelData.ForeColor = Color.LightGray;
 }
Example #5
0
        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            OldDataPack pack = OldDataPackBook.GetPack("cfg_skill_effect");

            if (pack.data.ContainsKey(int.Parse(textBox1.Text)))
            {
                string path = string.Format("{0}/{1}{2}", urlpath, pack.data[int.Parse(textBox1.Text)][1], ext);
                if (File.Exists(path))
                {
                    pictureBox1.Image = Image.FromFile(path);
                    return;
                }
            }
            pictureBox1.Image = null;
        }
Example #6
0
        private void panelMap_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left) //摆放怪物
            {
                if (viewStack1.SelectedIndex == 1 && listViewMonster.SelectedItems.Count > 0)
                {
                    String[] data  = listViewMonster.SelectedItems[0].Text.Split('.');
                    int      monid = int.Parse(data[0]);

                    OldDataPack   pack  = OldDataPackBook.GetPack("cfg_map_monster");
                    List <String> datas = new List <string>();
                    datas.Add((++pack.maxid).ToString());
                    datas.Add(selectMapId.ToString());
                    datas.Add(monid.ToString());
                    Point p = TilePixelConvertor.PixelToTile(e.X + baseOffside.X, e.Y + baseOffside.Y);
                    datas.Add(p.X.ToString());
                    datas.Add(p.Y.ToString());
                    pack.AddPackData(pack.maxid, datas);

                    this.installLiveMonster();

                    updateMap();
                }
                else if (viewStack1.SelectedIndex == 2 && listViewPlant.SelectedItems.Count > 0)
                {
                    String[] data = listViewPlant.SelectedItems[0].Text.Split('.');
                    int      pid  = int.Parse(data[0]);

                    OldDataPack   pack  = OldDataPackBook.GetPack("cfg_map_plant");
                    List <String> datas = new List <string>();
                    datas.Add((++pack.maxid).ToString());
                    datas.Add(selectMapId.ToString());
                    datas.Add(pid.ToString());
                    Point p = TilePixelConvertor.PixelToTile(e.X + baseOffside.X, e.Y + baseOffside.Y);
                    datas.Add(p.X.ToString());
                    datas.Add(p.Y.ToString());
                    pack.AddPackData(pack.maxid, datas);

                    this.installLivePlant();

                    updateMap();
                }
            }
        }
Example #7
0
        private void installMonster()
        {
            if (listViewMonster.Items.Count > 0)
            {
                return;
            }

            OldDataPack pack       = OldDataPackBook.GetPack("cfg_monster");
            int         midindex   = pack.GetPackIndexByName("mid");
            int         mnameindex = pack.GetPackIndexByName("name");

            listViewMonster.Items.Clear();
            foreach (List <String> monster in pack.data.Values)
            {
                string id   = monster[midindex];
                string name = monster[mnameindex];

                ListViewItem lvm = new ListViewItem(String.Format("{0}.{1}", id, name));
                listViewMonster.Items.Add(lvm);
            }
        }
Example #8
0
        private void installPlant()
        {
            if (listViewPlant.Items.Count > 0)
            {
                return;
            }

            OldDataPack pack       = OldDataPackBook.GetPack("cfg_plant");
            int         pidindex   = pack.GetPackIndexByName("id");
            int         pnameindex = pack.GetPackIndexByName("name");

            listViewPlant.Items.Clear();
            foreach (List <String> plant in pack.data.Values)
            {
                string id   = plant[pidindex];
                string name = plant[pnameindex];

                ListViewItem lvm = new ListViewItem(String.Format("{0}.{1}", id, name));
                listViewPlant.Items.Add(lvm);
            }
        }
Example #9
0
        private void installLiveMonster()
        {
            OldDataPack pack           = OldDataPackBook.GetPack("cfg_map_monster");
            int         idindex        = pack.GetPackIndexByName("id");
            int         mapidindex     = pack.GetPackIndexByName("mapid");
            int         monsteridindex = pack.GetPackIndexByName("monsterid");

            OldDataPack packM      = OldDataPackBook.GetPack("cfg_monster");
            int         mnameindex = packM.GetPackIndexByName("name");

            listViewLives.Items.Clear();
            foreach (List <String> monster in pack.data.Values)
            {
                string id  = monster[idindex];
                string map = monster[mapidindex];
                int    mid = int.Parse(monster[monsteridindex]);
                if (int.Parse(map) == selectMapId)
                {
                    ListViewItem lvm = new ListViewItem(String.Format("{0}.{1} (id={2})", id, packM.data[mid][mnameindex], mid));
                    listViewLives.Items.Add(lvm);
                }
            }
        }
Example #10
0
        private void toolStripMenuItemRemove2_Click(object sender, EventArgs e)
        {
            if (listViewVegas.SelectedItems.Count <= 0)
            {
                return;
            }

            int sel = listViewVegas.SelectedIndices[0] - 1;

            if (sel < 0)
            {
                sel = 0;
            }

            OldDataPack pack = OldDataPackBook.GetPack("cfg_map_plant");

            foreach (ListViewItem lvm in listViewVegas.SelectedItems)
            {
                String[] data = lvm.Text.Split('.');
                int      pid  = int.Parse(data[0]);

                pack.RemovePackData(pid);
            }

            this.installLivePlant();
            foreach (ListViewItem lvm in listViewVegas.Items)
            {
                if (lvm.Index == sel)
                {
                    lvm.Selected = true;
                    lvm.EnsureVisible();
                }
            }

            updateMap();
        }
Example #11
0
        private void installLivePlant()
        {
            OldDataPack pack         = OldDataPackBook.GetPack("cfg_map_plant");
            int         idindex      = pack.GetPackIndexByName("id");
            int         mapidindex   = pack.GetPackIndexByName("mapid");
            int         plantidindex = pack.GetPackIndexByName("plantid");

            OldDataPack packM      = OldDataPackBook.GetPack("cfg_plant");
            int         pnameindex = packM.GetPackIndexByName("name");

            listViewVegas.Items.Clear();
            foreach (List <String> plant in pack.data.Values)
            {
                string id  = plant[idindex];
                string map = plant[mapidindex];
                int    pid = int.Parse(plant[plantidindex]);

                if (int.Parse(map) == selectMapId)
                {
                    ListViewItem lvm = new ListViewItem(String.Format("{0}.{1} (id={2})", id, packM.data[pid][pnameindex], pid));
                    listViewVegas.Items.Add(lvm);
                }
            }
        }
Example #12
0
        private void panelMap_Paint(object sender, PaintEventArgs e)
        {
            if (selectMapId == 0 || selectMapSize.Width == 0 || selectMapSize.Height == 0)
            {
                return;
            }

            if (showSkin)
            {
                for (int i = baseOffside.X / 192; i < (baseOffside.X + panelMap.Width) / 192 + 1; i++)
                {
                    for (int j = baseOffside.Y / 192; j < (baseOffside.Y + panelMap.Height) / 192 + 1; j++)
                    {
                        string imagepath = string.Format("res/map/{0}/{1}_{2}.jpg", selectFolder, j, i);
                        //if (File.Exists(imagepath))
                        {
                            Image image = MapPainter.GetNetImage(imagepath);
                            e.Graphics.DrawImage(image, i * 192 - baseOffside.X, j * 192 - baseOffside.Y);
                            image.Dispose();
                        }
                    }
                }
            }

            if (showBarrier) //是否显示阻挡
            {
                int col = (int)Math.Floor((double)selectMapSize.Width / 48);

                int xoff = baseOffside.X % 48;
                int yoff = baseOffside.Y % 34;
                for (int x = -xoff; x < panelMap.Width + xoff; x += 48)
                {
                    for (int y = -yoff; y < panelMap.Width + yoff; y += 34)
                    {
                        Point tile = TilePixelConvertor.PixelToTile(x + baseOffside.X, y + baseOffside.Y);
                        int   val  = 1;
                        if (tile.Y >= 0 && tile.X >= 0)
                        {
                            if (tile.Y * col + tile.X >= blockInfos.Count)
                            {
                                val = 0;
                            }
                            else
                            {
                                val = blockInfos[tile.Y * col + tile.X];
                            }
                        }
                        MapPainter.DrawRectTile(e.Graphics, x, y, val);

/*                        tile = TilePixelConvertor.PixelToTile(i + 32, j + 16);
 *                      val = 1;
 *                      if (tile.Y >= 0 && tile.X >= 0)
 *                      {
 *                          if (tile.Y * col + tile.X >= blockInfos.Count)
 *                              val = 2;
 *                          else
 *                              val = blockInfos[tile.Y * col + tile.X];
 *                      }
 *                      MapPainter.DrawRectTile(e.Graphics, i - baseOffside.X + 32, j - baseOffside.Y + 16, val);*/
                    }
                }
            }

            if (false && showGridLine)
            { //show region
                int col = (int)Math.Round((double)selectMapSize.Width / 64);

                OldDataPack pack         = OldDataPackBook.GetPack("cfg_map_region");
                int         mapidindex   = pack.GetPackIndexByName("mapid");
                int         mapminxindex = pack.GetPackIndexByName("min_x");
                int         mapminyindex = pack.GetPackIndexByName("min_y");
                int         mapmaxxindex = pack.GetPackIndexByName("max_x");
                int         mapmaxyindex = pack.GetPackIndexByName("max_y");
                int         typeindex    = pack.GetPackIndexByName("type");

                List <List <String> > regions = new List <List <string> >();
                foreach (List <String> rect in pack.data.Values)
                {
                    if (int.Parse(rect[mapidindex]) == selectMapId)
                    {
                        regions.Add(rect);
                    }
                }

                Dictionary <int, bool> showname = new Dictionary <int, bool>();
                for (int i = baseOffside.X / 64 * 64; i < baseOffside.X + panelMap.Width; i += 64)
                {
                    for (int j = baseOffside.Y / 32 * 32; j < baseOffside.Y + panelMap.Height; j += 32)
                    {
                        foreach (List <String> region in regions)
                        {
                            Point tile = TilePixelConvertor.PixelToTile(i, j);
                            if (TilePixelConvertor.InRegion(int.Parse(region[mapminxindex]), int.Parse(region[mapminyindex]), int.Parse(region[mapmaxxindex]), int.Parse(region[mapmaxyindex]), tile.X, tile.Y))
                            {
                                MapPainter.DrawCircleRegion(e.Graphics, i - baseOffside.X, j - baseOffside.Y, int.Parse(region[typeindex]));

                                if (tile.X >= (int.Parse(region[mapminxindex]) + int.Parse(region[mapmaxxindex])) / 2 && tile.Y >= (int.Parse(region[mapminyindex]) + int.Parse(region[mapmaxyindex])) / 2)
                                {
                                    if (!showname.ContainsKey(int.Parse(region[0])))
                                    {
                                        Font fontSong = new Font("宋体", 14, FontStyle.Bold);
                                        e.Graphics.DrawString(region[1], fontSong, Brushes.Black, i - baseOffside.X - 10, j - baseOffside.Y - 4);
                                        fontSong.Dispose();
                                        showname.Add(int.Parse(region[0]), true);
                                    }
                                }
                            }

                            tile = TilePixelConvertor.PixelToTile(i + 32, j + 16);
                            if (TilePixelConvertor.InRegion(int.Parse(region[mapminxindex]), int.Parse(region[mapminyindex]), int.Parse(region[mapmaxxindex]), int.Parse(region[mapmaxyindex]), tile.X, tile.Y))
                            {
                                MapPainter.DrawCircleRegion(e.Graphics, i - baseOffside.X + 32, j - baseOffside.Y + 16, int.Parse(region[typeindex]));
                            }
                        }
                    }
                }
            }

            if (showGridLine) //是否显示网格
            {
                int xoff = baseOffside.X % 48;
                int yoff = baseOffside.Y % 34;
                for (int i = 1; i * 48 - xoff < panelMap.Width; ++i)
                {
                    e.Graphics.DrawLine(Pens.DarkGray, i * 48 - xoff, 0, i * 48 - xoff, panelMap.Height);
                }
                for (int i = 1; i * 34 - yoff < panelMap.Height; ++i)
                {
                    e.Graphics.DrawLine(Pens.DarkGray, 0, i * 34 - yoff, panelMap.Width, i * 34 - yoff);
                }
            }

            if (false)
            {//传送点
                OldDataPack pack         = OldDataPackBook.GetPack("cfg_map_rect");
                int         frommapindex = pack.GetPackIndexByName("from_map");
                int         fromxindex   = pack.GetPackIndexByName("from_x");
                int         fromyindex   = pack.GetPackIndexByName("from_y");
                int         tomapindex   = pack.GetPackIndexByName("to_map");

                Font fontSong = new Font("宋体", 11, FontStyle.Bold);

                foreach (List <String> rect in pack.data.Values)
                {
                    int frommap = int.Parse(rect[frommapindex]);
                    int fromx   = int.Parse(rect[fromxindex]);
                    int fromy   = int.Parse(rect[fromyindex]);
                    int tomap   = int.Parse(rect[tomapindex]);

                    Rectangle dest = new Rectangle(baseOffside.X, baseOffside.Y, panelMap.Width, panelMap.Height);
                    Point     mpos = TilePixelConvertor.TileToPixel(fromx, fromy);

                    if (selectMapId == frommap && dest.Contains(mpos))
                    {
                        Image body = Image.FromFile("icons/rect.png");
                        e.Graphics.DrawImage(body, mpos.X - baseOffside.X - body.Width / 2, mpos.Y - baseOffside.Y - body.Height / 2, body.Width, body.Height);
                        body.Dispose();

                        DataPack packm     = DataPackBook.GetPack("map");
                        int      nameindex = packm.GetPackIndexByName("name");
                        String   name      = packm.data[tomap][nameindex];
                        e.Graphics.DrawString(name, fontSong, Brushes.Black, mpos.X - baseOffside.X - 10, mpos.Y - baseOffside.Y - 4);
                        e.Graphics.DrawString(name, fontSong, Brushes.Lime, mpos.X - baseOffside.X - 11, mpos.Y - baseOffside.Y - 5);
                    }
                }

                fontSong.Dispose();
            }

            if (false && showPlant) //显示植物
            {
                OldDataPack pack         = OldDataPackBook.GetPack("cfg_map_plant");
                int         idindex      = pack.GetPackIndexByName("id");
                int         mapidindex   = pack.GetPackIndexByName("mapid");
                int         plantidindex = pack.GetPackIndexByName("plantid");
                int         xindex       = pack.GetPackIndexByName("x");
                int         yindex       = pack.GetPackIndexByName("y");

                OldDataPack mpack     = OldDataPackBook.GetPack("cfg_plant");
                int         bodyindex = mpack.GetPackIndexByName("body");

                Font fontSong = new Font("宋体", 11, FontStyle.Bold);
                foreach (List <String> plant in pack.data.Values)
                {
                    int id      = int.Parse(plant[idindex]);
                    int map     = int.Parse(plant[mapidindex]);
                    int x       = int.Parse(plant[xindex]);
                    int y       = int.Parse(plant[yindex]);
                    int plantid = int.Parse(plant[plantidindex]);

                    Rectangle dest = new Rectangle(baseOffside.X, baseOffside.Y, panelMap.Width, panelMap.Height);

                    Point mpos = TilePixelConvertor.TileToPixel(x, y);
                    if (map == selectMapId && dest.Contains(mpos))
                    {
                        string bodyurl   = mpack.data[plantid][bodyindex];
                        String imagepath = String.Format("res/entity/units/plant/{0}.png", bodyurl);
                        //Image body = MapPainter.GetNetImage(imagepath);
                        // string imagepath = string.Format("res/map/{0}/{1}_{2}.jpg", selectFolder, j, i);
                        // if (File.Exists(imagepath))
                        {
                            Image image = MapPainter.GetNetImage(imagepath); //new Bitmap(imagepath);
                            e.Graphics.DrawImage(image, mpos.X - baseOffside.X - image.Width / 2, mpos.Y - baseOffside.Y - image.Height, image.Width, image.Height);
                            //body.Dispose();
                            image.Dispose();
                        }

                        e.Graphics.DrawString(id.ToString(), fontSong, Brushes.Black, mpos.X - baseOffside.X - 10, mpos.Y - baseOffside.Y - 4);
                        e.Graphics.DrawString(id.ToString(), fontSong, Brushes.White, mpos.X - baseOffside.X - 11, mpos.Y - baseOffside.Y - 5);
                    }
                }

                fontSong.Dispose();
            }

            if (showMonster) //是否绘制怪物
            {
                int monnum = 0;

                DataPack pack                = DataPackBook.GetPack("map_monster");
                int      idindex             = pack.GetPackIndexByName("id");
                int      mapidindex          = pack.GetPackIndexByName("map_id");
                int      monstergroupidindex = pack.GetPackIndexByName("monster_group_id");
                int      xindex              = pack.GetPackIndexByName("x");
                int      yindex              = pack.GetPackIndexByName("y");

                DataPack mpack            = DataPackBook.GetPack("monster");
                int      groupindex       = mpack.GetPackIndexByName("group_id");
                int      monsterbodyindex = mpack.GetPackIndexByName("monster_body");
                int      avatarbodyindex  = mpack.GetPackIndexByName("avatar_body");

                Font fontSong = new Font("宋体", 11, FontStyle.Bold);
                foreach (List <String> mapmonster in pack.data.Values)
                {
                    int id             = int.Parse(mapmonster[idindex]);
                    int map            = int.Parse(mapmonster[mapidindex]);
                    int x              = int.Parse(mapmonster[xindex]);
                    int y              = int.Parse(mapmonster[yindex]);
                    int monstergroupid = int.Parse(mapmonster[monstergroupidindex]);

                    Rectangle dest = new Rectangle(baseOffside.X, baseOffside.Y, panelMap.Width, panelMap.Height);

                    Point mpos = TilePixelConvertor.TileToPixel(x, y);
                    if (map == selectMapId && dest.Contains(mpos))
                    {
                        foreach (List <String> monster in mpack.data.Values)
                        {
                            int groupid = int.Parse(monster[groupindex]);
                            if (groupid == monstergroupid)
                            {
                                string monsterbodyurl = monster[monsterbodyindex];
                                string avatarbodyurl  = monster[avatarbodyindex];
                                string bodyurl        = "";
                                if (monsterbodyurl.Length > 0)
                                {
                                    bodyurl = monsterbodyurl;
                                }
                                else
                                {
                                    bodyurl = avatarbodyurl;
                                }
                                String imagepath = String.Format("res/entity/monster/{0}.png", bodyurl);
                                Image  body      = MapPainter.GetNetImage(imagepath); //new Bitmap(imagepath);//
                                //if (File.Exists(imagepath))
                                {
                                    e.Graphics.DrawImage(body, mpos.X - baseOffside.X - body.Width / 2, mpos.Y - baseOffside.Y - body.Height, body.Width, body.Height);
                                    body.Dispose();
                                }
                                //body.Dispose();

                                e.Graphics.DrawString(id.ToString(), fontSong, Brushes.Black, mpos.X - baseOffside.X - 10, mpos.Y - baseOffside.Y - 4);
                                e.Graphics.DrawString(id.ToString(), fontSong, Brushes.White, mpos.X - baseOffside.X - 11, mpos.Y - baseOffside.Y - 5);

                                monnum++;
                                break;
                            }
                        }
                    }
                }

                String moncount = String.Format("当前屏怪物数:{0}", monnum);
                e.Graphics.DrawString(moncount, fontSong, Brushes.Black, 4, panelMap.Height - 19);
                e.Graphics.DrawString(moncount, fontSong, Brushes.White, 3, panelMap.Height - 20);

                fontSong.Dispose();
            }

            if (showNpc)
            {
                DataPack pack       = DataPackBook.GetPack("npc");
                int      idindex    = pack.GetPackIndexByName("id");
                int      mapidindex = pack.GetPackIndexByName("mapid");
                int      xindex     = pack.GetPackIndexByName("x");
                int      yindex     = pack.GetPackIndexByName("y");
                int      nameindex  = pack.GetPackIndexByName("name");
                int      bodyindex  = pack.GetPackIndexByName("body");

                Font fontSong = new Font("宋体", 11, FontStyle.Bold);
                foreach (List <String> npc in pack.data.Values)
                {
                    int    id      = int.Parse(npc[idindex]);
                    string map     = npc[mapidindex];
                    int    x       = int.Parse(npc[xindex]);
                    int    y       = int.Parse(npc[yindex]);
                    string bodyurl = npc[bodyindex];
                    string name    = npc[nameindex];

                    Rectangle dest = new Rectangle(baseOffside.X, baseOffside.Y, panelMap.Width, panelMap.Height);

                    Point mpos = TilePixelConvertor.TileToPixel(x, y);
                    if (map.Contains(selectMapId.ToString()) && dest.Contains(mpos))
                    {
                        String imagepath = String.Format("res/entity/npc/{0}.png", bodyurl);
                        Image  body      = MapPainter.GetNetImage(imagepath);
                        //if (File.Exists(imagepath))
                        {
                            //   Image body =new Bitmap(imagepath);
                            e.Graphics.DrawImage(body, mpos.X - baseOffside.X - body.Width / 2, mpos.Y - baseOffside.Y - body.Height, body.Width, body.Height);
                            body.Dispose();
                        }

                        e.Graphics.DrawString(id + "." + name, fontSong, Brushes.Black, mpos.X - baseOffside.X - 10, mpos.Y - baseOffside.Y - 4);
                        e.Graphics.DrawString(id + "." + name, fontSong, Brushes.White, mpos.X - baseOffside.X - 11, mpos.Y - baseOffside.Y - 5);
                    }
                }

                fontSong.Dispose();
            }

            e.Graphics.FillRectangle(Brushes.Gray, 0, 0, 4, panelMap.Height);
            e.Graphics.FillRectangle(Brushes.Gray, 0, panelMap.Height - 4, panelMap.Width, 4);
            e.Graphics.FillRectangle(Brushes.Orange, 0, baseOffside.Y * panelMap.Height / selectMapSize.Height, 4, panelMap.Height * panelMap.Height / selectMapSize.Height);
            e.Graphics.FillRectangle(Brushes.Orange, baseOffside.X * panelMap.Width / selectMapSize.Width, panelMap.Height - 4, panelMap.Width * panelMap.Width / selectMapSize.Width, 4);
        }
Example #13
0
        private void DataEditForm_Load(object sender, EventArgs e)
        {
            pack = OldDataPackBook.GetPack("cfg_movie");

            refreshList(0);
        }
Example #14
0
        private void DataEditForm_Load(object sender, EventArgs e)
        {
            pack = OldDataPackBook.GetPack(packName);
            IniFile configData = new IniFile(String.Format("config/db/{0}.ini", packName));

            string nameindex = configData.IniReadValue("main", "nameindex");

            if (nameindex != "")
            {
                nameIndex = int.Parse(nameindex);
            }

            Label lbc = new Label();

            lbc.Location = new Point(0, 0);
            lbc.Text     = "";
            lbc.Name     = "lbltop";
            panelEditZone.Controls.Add(lbc);

            int   index    = 0;
            int   row      = 0;
            int   col      = 0;
            int   wid      = panelEditZone.Width / 2;
            Point offside  = new Point(8, 20);
            Font  fontsong = new Font("宋体", 10, FontStyle.Regular);

            foreach (String head in pack.header)
            {
                #region 构建控件
                Label lbl = new Label();
                lbl.Location = new Point(col * wid + offside.X, row * 30 + offside.Y);
                lbl.Text     = head;
                lbl.AutoSize = true;
                lbl.Font     = fontsong;
                lbl.Name     = "lbl" + head;
                panelEditZone.Controls.Add(lbl);

                Label lbl2 = new Label();
                lbl2.ForeColor   = Color.DarkBlue;
                lbl2.Location    = new Point(lbl.Location.X + lbl.Width + 5, row * 30 + 3 + offside.Y);
                lbl2.Text        = pack.comment[index];
                lbl2.Tag         = pack.comment[index];
                lbl2.MouseHover += new EventHandler(lbl2_MouseHover);
                int wordscap = (165 - lbl.Width) / 16;
                if (lbl2.Text.Length > wordscap)
                {
                    if (wordscap <= 0)
                    {
                        lbl2.Text = "";
                    }
                    else
                    {
                        lbl2.Text = String.Format("{0}...", lbl2.Text.Substring(0, wordscap - 1));
                    }
                }
                lbl2.AutoSize = true;
                panelEditZone.Controls.Add(lbl2);

                string urlpath      = configData.IniReadValue(head, "path");
                string urlsize      = configData.IniReadValue(head, "size");
                string enums        = configData.IniReadValue(head, "enums");
                string ext          = configData.IniReadValue(head, "ext");
                string bind         = configData.IniReadValue(head, "bind");
                string checktxt     = configData.IniReadValue(head, "checktxt");
                string dialogcheck  = configData.IniReadValue(head, "dialogcheck");
                string attrcheck    = configData.IniReadValue(head, "attrcheck");
                string taskcond     = configData.IniReadValue(head, "taskcond");
                string icon         = configData.IniReadValue(head, "icon");
                string icondes      = configData.IniReadValue(head, "icondes");
                string unixtime     = configData.IniReadValue(head, "unixtime");
                string itemlist     = configData.IniReadValue(head, "itemlist");
                string rectgraph    = configData.IniReadValue(head, "rectgraph");
                string movie        = configData.IniReadValue(head, "movie");
                string timehour     = configData.IniReadValue(head, "timehour");
                string wisebox      = configData.IniReadValue(head, "wisebox");
                string wiseguidebox = configData.IniReadValue(head, "wiseguidebox");
                string colorwords   = configData.IniReadValue(head, "colorwords");
                string effectpath   = configData.IniReadValue(head, "effpath");

                Control c;
                if (urlpath != "") //图片combox
                {
                    c = new UCPictureComboBox();
                    (c as UCPictureComboBox).PictureSize = urlsize;
                    (c as UCPictureComboBox).SetPath(urlpath, ext);
                }
                else if (effectpath != "")
                {
                    c = new UCEffectBox();
                    (c as UCEffectBox).SetPath(effectpath, ext);
                }
                else if (enums != "") //combox
                {
                    c = new UCComboBox();
                    (c as UCComboBox).Info = enums;
                }
                else if (bind != "") //boxlabel
                {
                    c = new UCBoxLabel();
                    (c as UCBoxLabel).TableName = bind;
                }
                else if (checktxt != "")
                {
                    c = new UCCheckBoxGroup();
                    (c as UCCheckBoxGroup).Info = checktxt;
                }
                else if (dialogcheck != "")
                {
                    c = new UCDialogBox();
                }
                else if (attrcheck != "")
                {
                    c = new UCAttrBox();
                }
                else if (rectgraph != "")
                {
                    c = new UCRectGraph();
                    string[] info = rectgraph.Split('|');
                    (panelEditZone.Controls[info[0]] as UCTextBox).TextChanged  += rectTextChanged;
                    (panelEditZone.Controls[info[1]] as UCTextBox).TextChanged  += rectTextChanged;
                    (panelEditZone.Controls[info[2]] as UCTextBox).TextChanged  += rectTextChanged;
                    (panelEditZone.Controls[info[3]] as UCTextBox).TextChanged  += rectTextChanged;
                    (panelEditZone.Controls[info[4]] as UCBoxLabel).TextChanged += rectTextChanged;
                    (panelEditZone.Controls[info[5]] as UCBoxLabel).TextChanged += rectTextChanged;

                    (panelEditZone.Controls[info[0]] as UCTextBox).Tag  = "x1";
                    (panelEditZone.Controls[info[1]] as UCTextBox).Tag  = "y1";
                    (panelEditZone.Controls[info[2]] as UCTextBox).Tag  = "x2";
                    (panelEditZone.Controls[info[3]] as UCTextBox).Tag  = "y2";
                    (panelEditZone.Controls[info[4]] as UCBoxLabel).Tag = "m1";
                    (panelEditZone.Controls[info[5]] as UCBoxLabel).Tag = "m2";
                }
                else if (taskcond != "")
                {
                    c = new UCTaskRequest();
                    panelEditZone.Controls[taskcond].Tag = head;
                    (panelEditZone.Controls[taskcond] as UCComboBox).SelectedIndexChanged += comboBoxChanged;
                }
                else if (movie != "")
                {
                    c = new UCMovieData();
                    panelEditZone.Controls[movie].Tag = head;
                    (panelEditZone.Controls[movie] as UCComboBox).SelectedIndexChanged += comboBoxChanged;
                }
                else if (icon != "")
                {
                    c = new UCBoxIcon();
                    (c as UCBoxIcon).Icon = icon;
                    (c as UCBoxIcon).Des  = icondes;
                }
                else if (unixtime != "")
                {
                    c = new UCUnixTimeLabel();
                }
                else if (itemlist != "")
                {
                    c = new UCItemList();
                }
                else if (timehour != "")
                {
                    c = new UCTimeHour();
                }
                else if (wisebox != "")
                {
                    c = new UCWiseBoxLabel();
                }
                else if (wiseguidebox != "")
                {
                    c = new UCWiseGuideBoxLabel();
                }
                else if (colorwords != "")
                {
                    c = new UCColorWordsBox();
                }
                else //textbox
                {
                    c = new UCTextBox();
                    if (pack.datatype[index] == "char")
                    {
                        (c as UCTextBox).TextSize = pack.datasize[index];
                    }
                }
                c.Enabled  = (index > 0);
                c.Name     = head;
                c.Location = new Point(col * wid + 170 + offside.X, row * 30 + offside.Y);
                if (c.Height > 30)
                {
                    row += c.Height / 30;
                    col  = 0;
                }
                panelEditZone.Controls.Add(c);
                #endregion

                index++;
                if (col == 0 && row == 0)
                {
                    row++;
                }
                else if (index < pack.datatype.Count && (pack.comment[index].Contains("[NL]") || pack.comment[index - 1].Contains("[NL]"))) //特殊标签
                {
                    row++;
                    col = 0;
                }
                else if (c.Height <= 30 && index < pack.datatype.Count && col == 0 && (pack.datatype[index] != "char" || pack.datasize[index] <= 8) && (pack.datatype[index - 1] != "char" || pack.datasize[index - 1] <= 8))
                {
                    col++;
                }
                else
                {
                    row++;
                    col = 0;
                }
            }
            fontsong.Dispose();
            panelEditZone.Height = (row + 2) * 30;

            refreshList(0);

            isInit = true;
        }