Пример #1
0
        public void genRouteTagMapTest()
        {
            string _map_name = "42_north_america"; // TODO: 初始化为适当的值
            MapMining target = new MapMining(_map_name); // TODO: 初始化为适当的值
            Point source = new Point(3.528571, 10.0547619); // TODO: 初始化为适当的值
            Point enemybase = new Point (9.6506024, 2.369879) ; // TODO: 初始化为适当的值

            Trajectory actual;
            actual = target.genRouteTagMap(source, enemybase);
            Assert.AreEqual(actual.Count > 0, true);
        }
Пример #2
0
        void load_data(string map_name)
        {
            //string[,] names = new string[5, 4];
            String file = TBConst.trajectoryPath_obsolete + map_name + ".txt";

            if (map_name[map_name.Length - 1] >= '0' && map_name[map_name.Length - 1] <= '9')
                map_name = map_name.Substring(0, map_name.Length - 1);
            img = Image.FromFile(TBConst.tagPath + map_name + ".bmp");

            mapMining = new MapMining(map_name);
            this.vScrollBar1.Minimum = 0;
            this.vScrollBar1.Maximum = mapMining.maxCount();

            //private List<string> _keypoint_items = new List<string>();
            _fireat_items.Clear();
            foreach (Point p in mapMining.firepos)
            {
                _fireat_items.Add(p.x + " " + p.y);
            }
            listBoxFireAt.DataSource = null;
            listBoxFireAt.DataSource = _fireat_items;

            _startingpoint_items.Clear();
            foreach (Point p in mapMining.startPoints)
            {
                double x = (int)(p.x * 100) / 100.0;
                double y = (int)(p.y * 100) / 100.0;
                _startingpoint_items.Add(x + " " + y);
            }

            listBoxStaringPoint.DataSource = null;
            listBoxStaringPoint.DataSource = _startingpoint_items;

            //Debug.Print(text);
        }
Пример #3
0
        /// <summary>
        /// this load should be execute when down counting, i.e. when we know all the information about my location, ally team member, enemy team member; 
        /// because the f*****g algorithm runs slow.... 
        /// </summary>
        private void loadRoute()
        {
            Helper.LogInfo("load route map name: " + mapName);
            Helper.LogInfo("load route myTank.pos: " + myTank.pos);
            if (TBConst.notMoveTank)
            {
                Helper.LogInfo("load route returns as notMoveTank=true");
                return;
            }
            if (this.routeLoaded)
            {
                Helper.LogInfo("load route returns already loaded");
                return;
            }
            this.routeLoaded = true;
            while (this.mapName == "")
                Thread.Sleep(1000);
            while (myTank.pos.x == 6 && myTank.pos.y == 6)
                Thread.Sleep(1000);
            Thread.Sleep(3000);

            this.mapSacle = MapDef.map_size[mapName];

            mapMining = new MapMining(this.mapName);

            this.enemyBase = mapMining.enemyBase(myTank.pos);

            //if (myTank.vInfo.vClass == VehicleClass.HT)
            //always use a fire route
            if (TBConst.cheatSlaveMode && CheatClient.getInstance().cheatMasterOnOtherSide())
                loadRouteToFirePos();
            else if (TBConst.cheatSlaveMode)
                loadRouteToEnemyBase();
            else if (myTank.vInfo.tier <= 3)
                loadRouteToEnemyBase();
            else
                loadRouteToEnemyBase(); // HT choose a more far away route
            //else
            //  loadRouteToEnemyBase();
            this.startPos = myTank.pos;
        }