Exemplo n.º 1
0
        private void AddRegionNodes(string[] columns, DataRow row, Color treeColor, bool needEdit, TemplateType ttype)
        {
            string ColumnName_MapID;
            string ColumnName_Areas;

            int    nValue_MapID;
            string strValue_Areas;

            foreach (string columnkey in columns)
            {
                ColumnName_MapID = string.Format("{0}_MapId", columnkey);
                ColumnName_Areas = string.Format("{0}_Areas", columnkey);

                if (!needEdit &&
                    (row.IsNull(ColumnName_MapID) || Convert.ToInt32(row[ColumnName_MapID]) == 0)
                    )
                {
                    continue;
                }
                nValue_MapID   = row.IsNull(ColumnName_MapID) ? 0 : Convert.ToInt32(row[ColumnName_MapID]);
                strValue_Areas = row.IsNull(ColumnName_Areas) ? "" : row[ColumnName_Areas].ToString();

                if (nValue_MapID == 0)
                {
                    nValue_MapID = DefaultMapId;
                }

                OneNode nodeTag = new OneNode();
                nodeTag.Init(nValue_MapID, strValue_Areas, ttype, columnkey);
                nodeTag.CanEdit = needEdit;
                SetBrothers(ref nodeTag, columnkey);
                MapConfig config = htMapConfig[nValue_MapID] as MapConfig;
                if (config != null)
                {
                    nodeTag.imageMap = config.TagImage;
                }
                DevComponents.AdvTree.Node newTreenode = new DevComponents.AdvTree.Node();
                newTreenode.Text  = htColumnNameDisplay[columnkey].ToString();
                newTreenode.Tag   = nodeTag;
                newTreenode.Style = new ElementStyle(); newTreenode.Style.TextColor = treeColor;

                nodeRoot.Nodes.Add(newTreenode);
                ArryNodes.Add(nodeTag);
            }
        }
Exemplo n.º 2
0
        private bool GetLogicalCoordinate(int mapid, float scalex, float scaley, ref int logicalx, ref int logicaly)
        {
            int   cfgWidth  = 0;
            int   cfgHeight = 0;
            float cfgScale  = 0.0f;
            float cfgStartx = 0;
            float cfgStarty = 0;

            MapConfig config = htMapConfig[mapid] as MapConfig;

            if (config == null)
            {
                return(false);
            }
            config.GetConfig(ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale);
            logicalx = Convert.ToInt32((cfgWidth * scalex / cfgScale) + cfgStartx);
            logicaly = Convert.ToInt32((cfgHeight * (1 - scaley) / cfgScale) + cfgStarty);
            return(true);
        }
Exemplo n.º 3
0
        private void SetMoreInfo(ref OneNode node)
        {
            int       mapid  = node.MapId;
            MapConfig config = htMapConfig[mapid] as MapConfig;

            if (config == null)
            {
                node.imageMap = null;
                node.fScaleX  = 0.5f;
                node.fScaleY  = 0.5f;
                return;
            }
            int   cfgWidth  = 0;
            int   cfgHeight = 0;
            float cfgScale  = 0.0f;
            float cfgStartx = 0;
            float cfgStarty = 0;

            config.GetConfig(ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale);
            node.fScaleX  = (node.nX - cfgStartx) / (cfgWidth / cfgScale);
            node.fScaleY  = 1 - (node.nY - cfgStarty) / (cfgHeight / cfgScale);
            node.imageMap = config.TagImage;
        }
Exemplo n.º 4
0
        private void InitHashtable()
        {
            arrSpecialColumn = new string[8] {
                "QuestValue1",
                "QuestValue2",
                "QuestValue3",
                "QuestValue4",
                "QuestValue5",
                "QuestValue6",
                "QuestValue7",
                "QuestValue8",
            };
            arrStartColumn = new string[2]{
                "StartDoodadTemplateID",
                "StartNpcTemplateID"
            };
            arrEndColumn = new string[2] { 
                "EndNpcTemplateID",
                "EndDoodadTemplateID"
            };
            arrCommonNpcColumn = new string[8] {                 

                "KillNpcTemplateID1",
                "KillNpcTemplateID2",
                "KillNpcTemplateID3",
                "KillNpcTemplateID4",


                "DropNpcTemplateID1",
                "DropNpcTemplateID2",
                "DropNpcTemplateID3",
                "DropNpcTemplateID4",

            };
            arrCommonDoodadColumn = new string[4] {   

                "DropDoodadTemplateID1",
                "DropDoodadTemplateID2",
                "DropDoodadTemplateID3",
                "DropDoodadTemplateID4",
            };
          
            //数据库->列显示字符
            htColumnNameDisplay = new Hashtable(ColumnCntCapcity);
            htColumnNameDisplay["Objective"] = "任务目标";
            htColumnNameDisplay["StartDoodadTemplateID"] = "接任务doodad";
            htColumnNameDisplay["StartNpcTemplateID"] = "接任务npc";
            htColumnNameDisplay["EndNpcTemplateID"] = "交任务npc";
            htColumnNameDisplay["EndDoodadTemplateID"] = "交任务doodad";

            htColumnNameDisplay["KillNpcTemplateID1"] = "杀NPC1";
            htColumnNameDisplay["KillNpcTemplateID2"] = "杀NPC2";
            htColumnNameDisplay["KillNpcTemplateID3"] = "杀NPC3";
            htColumnNameDisplay["KillNpcTemplateID4"] = "杀NPC4";
            htColumnNameDisplay["DropDoodadTemplateID1"] = "掉落道具1的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID2"] = "掉落道具2的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID3"] = "掉落道具3的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID4"] = "掉落道具4的DOODAD";
            htColumnNameDisplay["DropNpcTemplateID1"] = "掉落道具1的NPC";
            htColumnNameDisplay["DropNpcTemplateID2"] = "掉落道具2的NPC";
            htColumnNameDisplay["DropNpcTemplateID3"] = "掉落道具3的NPC";
            htColumnNameDisplay["DropNpcTemplateID4"] = "掉落道具4的NPC";
            htColumnNameDisplay["QuestValue1"] = "任务变量1";
            htColumnNameDisplay["QuestValue2"] = "任务变量2";
            htColumnNameDisplay["QuestValue3"] = "任务变量3";
            htColumnNameDisplay["QuestValue4"] = "任务变量4";
            htColumnNameDisplay["QuestValue5"] = "任务变量5";
            htColumnNameDisplay["QuestValue6"] = "任务变量6";
            htColumnNameDisplay["QuestValue7"] = "任务变量7";
            htColumnNameDisplay["QuestValue8"] = "任务变量8";           

 
          

            //mapconfig
            htMapConfig = new Hashtable(MapCntCapcity);
            htRegion = new Hashtable(MapCntCapcity);
            htMapNameID = new Hashtable(MapCntCapcity);
            htMapIDName = new Hashtable(MapCntCapcity);
            string sql = "select [ID], [Name] from MapList where [Name] <> '测试1'";
            DataTable tbl = Helper.GetDataTable(sql, Conn);
            
            string mapname = "";  
            int mapid = 0;
            int cfgWidth = 0;
            int cfgHeight = 0;
            float cfgScale = 0.0f;
            float cfgStartx = 0.0f;
            float cfgStarty = 0.0f;
            string mapTgaFileName = "";
            MapConfig config;

            htMapNameID["无"] = 0;
            combxItemMapId.Items.Add("无");
            foreach (DataRow row in tbl.Rows)
            {
                mapid = Convert.ToInt32(row[0]);
                mapname = row[1].ToString();
                if (LoadConfig(mapname, ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale))
                {
                    config = new MapConfig(cfgWidth, cfgHeight, cfgScale, cfgStartx, cfgStarty, mapid, mapname);
                    mapTgaFileName = string.Format("{0}/data/source/maps/{1}minimap/middlemap.tga", RootDir, mapname);
                    if (File.Exists(mapTgaFileName))
                    {
                        Image imgNew = null;
                        try
                        {
                            imgNew = Paloma.TargaImage.LoadTargaImage(mapTgaFileName);
                        }
                        catch (Exception ex)
                        {         
                            string errMsg = string.Format("{0}LoadTargaImage失败。\r\n\r\n{1}", mapTgaFileName, ex.ToString());
                            //MessageBox.Show(errMsg, "出错啦", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            imgNew = null;
                        }
                        config.TagImage = imgNew;
                    }
                    htMapConfig[mapid] = config;
                    combxItemMapId.Items.Add(mapname);
                    htMapNameID[mapname] = mapid;
                    htMapIDName[mapid] = mapname;
                }

                //QuestDirector2.RegionInfo region = new QuestDirector2.RegionInfo();
                //if (region.Init(RootDir, mapname))
                //{
                //    htRegion[mapid] = region;
                //}
            }

            htMapDoodadReaders = new Hashtable(MapCntCapcity);
            htMapNpcReaders = new Hashtable(MapCntCapcity);

            sql = string.Format("select [Name], [ID] from Npctemplate where [ID] <> 0");
            TableNpcTemplate = Helper.GetDataTable(sql, Conn);
            sql = string.Format("select [Name], [ID] from tbl_doodad where [ID] <> 0");
            TableDoodad = Helper.GetDataTable(sql, Conn);
            return;
        }
Exemplo n.º 5
0
        private void InitHashtable()
        {
            arrSpecialColumn = new string[8] {
                "QuestValue1",
                "QuestValue2",
                "QuestValue3",
                "QuestValue4",
                "QuestValue5",
                "QuestValue6",
                "QuestValue7",
                "QuestValue8",
            };
            arrStartColumn = new string[2] {
                "StartDoodadTemplateID",
                "StartNpcTemplateID"
            };
            arrEndColumn = new string[2] {
                "EndNpcTemplateID",
                "EndDoodadTemplateID"
            };
            arrCommonNpcColumn = new string[8] {
                "KillNpcTemplateID1",
                "KillNpcTemplateID2",
                "KillNpcTemplateID3",
                "KillNpcTemplateID4",


                "DropNpcTemplateID1",
                "DropNpcTemplateID2",
                "DropNpcTemplateID3",
                "DropNpcTemplateID4",
            };
            arrCommonDoodadColumn = new string[4] {
                "DropDoodadTemplateID1",
                "DropDoodadTemplateID2",
                "DropDoodadTemplateID3",
                "DropDoodadTemplateID4",
            };

            //数据库->列显示字符
            htColumnNameDisplay = new Hashtable(ColumnCntCapcity);
            htColumnNameDisplay["Objective"]             = "任务目标";
            htColumnNameDisplay["StartDoodadTemplateID"] = "接任务doodad";
            htColumnNameDisplay["StartNpcTemplateID"]    = "接任务npc";
            htColumnNameDisplay["EndNpcTemplateID"]      = "交任务npc";
            htColumnNameDisplay["EndDoodadTemplateID"]   = "交任务doodad";

            htColumnNameDisplay["KillNpcTemplateID1"]    = "杀NPC1";
            htColumnNameDisplay["KillNpcTemplateID2"]    = "杀NPC2";
            htColumnNameDisplay["KillNpcTemplateID3"]    = "杀NPC3";
            htColumnNameDisplay["KillNpcTemplateID4"]    = "杀NPC4";
            htColumnNameDisplay["DropDoodadTemplateID1"] = "掉落道具1的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID2"] = "掉落道具2的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID3"] = "掉落道具3的DOODAD";
            htColumnNameDisplay["DropDoodadTemplateID4"] = "掉落道具4的DOODAD";
            htColumnNameDisplay["DropNpcTemplateID1"]    = "掉落道具1的NPC";
            htColumnNameDisplay["DropNpcTemplateID2"]    = "掉落道具2的NPC";
            htColumnNameDisplay["DropNpcTemplateID3"]    = "掉落道具3的NPC";
            htColumnNameDisplay["DropNpcTemplateID4"]    = "掉落道具4的NPC";
            htColumnNameDisplay["QuestValue1"]           = "任务变量1";
            htColumnNameDisplay["QuestValue2"]           = "任务变量2";
            htColumnNameDisplay["QuestValue3"]           = "任务变量3";
            htColumnNameDisplay["QuestValue4"]           = "任务变量4";
            htColumnNameDisplay["QuestValue5"]           = "任务变量5";
            htColumnNameDisplay["QuestValue6"]           = "任务变量6";
            htColumnNameDisplay["QuestValue7"]           = "任务变量7";
            htColumnNameDisplay["QuestValue8"]           = "任务变量8";



            //mapconfig
            htMapConfig = new Hashtable(MapCntCapcity);
            htRegion    = new Hashtable(MapCntCapcity);
            htMapNameID = new Hashtable(MapCntCapcity);
            htMapIDName = new Hashtable(MapCntCapcity);
            string    sql = "select [ID], [Name] from MapList where [Name] <> '测试1'";
            DataTable tbl = Helper.GetDataTable(sql, Conn);

            string    mapname        = "";
            int       mapid          = 0;
            int       cfgWidth       = 0;
            int       cfgHeight      = 0;
            float     cfgScale       = 0.0f;
            float     cfgStartx      = 0.0f;
            float     cfgStarty      = 0.0f;
            string    mapTgaFileName = "";
            MapConfig config;

            htMapNameID["无"] = 0;
            combxItemMapId.Items.Add("无");
            foreach (DataRow row in tbl.Rows)
            {
                mapid   = Convert.ToInt32(row[0]);
                mapname = row[1].ToString();
                if (LoadConfig(mapname, ref cfgWidth, ref cfgHeight, ref cfgStartx, ref cfgStarty, ref cfgScale))
                {
                    config         = new MapConfig(cfgWidth, cfgHeight, cfgScale, cfgStartx, cfgStarty, mapid, mapname);
                    mapTgaFileName = string.Format("{0}/data/source/maps/{1}minimap/middlemap.tga", RootDir, mapname);
                    if (File.Exists(mapTgaFileName))
                    {
                        Image imgNew = null;
                        try
                        {
                            imgNew = Paloma.TargaImage.LoadTargaImage(mapTgaFileName);
                        }
                        catch (Exception ex)
                        {
                            string errMsg = string.Format("{0}LoadTargaImage失败。\r\n\r\n{1}", mapTgaFileName, ex.ToString());
                            //MessageBox.Show(errMsg, "出错啦", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            imgNew = null;
                        }
                        config.TagImage = imgNew;
                    }
                    htMapConfig[mapid] = config;
                    combxItemMapId.Items.Add(mapname);
                    htMapNameID[mapname] = mapid;
                    htMapIDName[mapid]   = mapname;
                }

                //QuestDirector2.RegionInfo region = new QuestDirector2.RegionInfo();
                //if (region.Init(RootDir, mapname))
                //{
                //    htRegion[mapid] = region;
                //}
            }

            htMapDoodadReaders = new Hashtable(MapCntCapcity);
            htMapNpcReaders    = new Hashtable(MapCntCapcity);

            sql = string.Format("select [Name], [ID] from Npctemplate where [ID] <> 0");
            TableNpcTemplate = Helper.GetDataTable(sql, Conn);
            sql         = string.Format("select [Name], [ID] from tbl_doodad where [ID] <> 0");
            TableDoodad = Helper.GetDataTable(sql, Conn);
            return;
        }