Esempio n. 1
0
        /// <summary>
        /// 获取任务全部数据
        /// </summary>
        /// <param name="mapId"></param>
        /// <param name="targetId"></param>
        /// <returns></returns>
        public static List <MhxyRouterRec> GetRouterAll(int mapId, int targetId)
        {
            List <MhxyMapExit>   exlist  = MhxyMapExit.GetAll();
            List <MhxyNPC>       npcList = MhxyNPC.GetAll();
            List <MhxyRouterRec> ret     = new List <MhxyRouterRec>();

            string           sql  = "select * from mhxy_router_rec where map_id=" + mapId.ToString() + " and target_id=" + targetId.ToString() + " order by sort asc";
            SQLiteConnection conn = SQLiteUtil.GetConn();

            conn.Open();
            DataSet ds = SQLiteHelper.ExecuteDataSet(conn, sql, null);

            conn.Close();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                MhxyRouterRec mt = new MhxyRouterRec();
                mt.id        = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString());
                mt.map_id    = Convert.ToInt32(ds.Tables[0].Rows[i]["map_id"].ToString());
                mt.exit_id   = Convert.ToInt32(ds.Tables[0].Rows[i]["exit_id"].ToString());
                mt.sort      = Convert.ToInt32(ds.Tables[0].Rows[i]["sort"].ToString());
                mt.is_type   = Convert.ToInt32(ds.Tables[0].Rows[i]["is_type"].ToString());
                mt.target_id = Convert.ToInt32(ds.Tables[0].Rows[i]["target_id"].ToString());
                mt.remarks   = ds.Tables[0].Rows[i]["remarks"].ToString();
                //装载出口信息
                for (int k = 0; k < exlist.Count; k++)
                {
                    if (mt.exit_id == exlist[k].id)
                    {
                        mt.mapExit = exlist[k];
                    }
                }
                //装载NPC
                if (mt.is_type == 0)
                {
                    for (int k = 0; k < npcList.Count; k++)
                    {
                        if (mt.target_id == npcList[k].npc_id)
                        {
                            mt.npc = npcList[k];
                        }
                    }
                }
                ret.Add(mt);
            }

            return(ret);
        }
Esempio n. 2
0
        /// <summary>
        /// 获取全部数据
        /// </summary>
        /// <returns></returns>
        public static List <MhxyMapExit> GetAll()
        {
            List <MhxyMap>     maps = MhxyMap.GetAll();
            List <MhxyMapExit> ret  = new List <MhxyMapExit>();

            string           sql  = "select * from mhxy_map_exit";
            SQLiteConnection conn = SQLiteUtil.GetConn();

            conn.Open();
            DataSet ds = SQLiteHelper.ExecuteDataSet(conn, sql, null);

            conn.Close();

            for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
            {
                MhxyMapExit mt = new MhxyMapExit();
                mt.id              = Convert.ToInt32(ds.Tables[0].Rows[i]["id"].ToString());
                mt.map_id          = Convert.ToInt32(ds.Tables[0].Rows[i]["map_id"].ToString());
                mt.to_map_id       = Convert.ToInt32(ds.Tables[0].Rows[i]["to_map_id"].ToString());
                mt.x               = Convert.ToInt32(ds.Tables[0].Rows[i]["x"].ToString());
                mt.y               = Convert.ToInt32(ds.Tables[0].Rows[i]["y"].ToString());
                mt.wait_x          = Convert.ToInt32(ds.Tables[0].Rows[i]["wait_x"].ToString());
                mt.wait_y          = Convert.ToInt32(ds.Tables[0].Rows[i]["wait_y"].ToString());
                mt.remarks         = ds.Tables[0].Rows[i]["remarks"].ToString();
                mt.npc_id          = Convert.ToInt32(ds.Tables[0].Rows[i]["npc_id"].ToString());
                mt.call_npc_option = Convert.ToInt32(ds.Tables[0].Rows[i]["call_npc_option"].ToString());
                for (int j = 0; j < maps.Count; j++)
                {
                    if (mt.map_id == maps[j].id)
                    {
                        mt.myMap = maps[j];
                    }
                    if (mt.to_map_id == maps[j].id)
                    {
                        mt.toMap = maps[j];
                    }
                }
                ret.Add(mt);
            }

            return(ret);
        }