Beispiel #1
0
        public void saveReplay(InfoCollector collector, string currentMap)
        {
            if (!Directory.Exists(@".\rep\"))
            {
                Directory.CreateDirectory(@".\rep\");
            }
            StreamWriter writer = new StreamWriter(@".\rep\" + collector.left.PlayerName + "VS" + collector.right.PlayerName + ".grep", false);

            writer.WriteLine(currentMap);
            writer.WriteLine(AddPlayerInfo(collector.left));
            writer.WriteLine(AddPlayerInfo(collector.right));
            for (int i = 0; i < operates.Count; i++)
            {
                writer.WriteLine(operates[i]);
            }
            writer.Close();
        }
Beispiel #2
0
        public World(int InitFactionNumber, Game game, bool ambientOn, string mapName)
        {
            this.game     = game;
            commonCamera  = new Camera(Vector2.Zero, 1.5f);
            player1Camera = new Camera(Vector2.Zero, 1.5f);
            player2Camera = new Camera(Vector2.Zero, 1.5f);
            cameras.Add(commonCamera);
            cameras.Add(player1Camera);
            cameras.Add(player2Camera);

            currentCamera = commonCamera;

            //by 刘欣 李翔
            collector = new InfoCollector(ships, resources);

            if (InitFactionNumber == 1)
            {
                InitShip(2, Color.Blue, "Player", FactionControllerType.Player);
            }

            if (mapName == null)
            {
                mapName = GameOperators.Random.Next(1, 7).ToString();
            }

            currentMap = mapName;
            LoadMap(currentMap);

            //添加资源点
            //resources.Add(new ResourceArea(1, 196, new Vector2(-384, -384), null, this));
            //islands.Add(new Island(this, "island1", 0.3f, new Vector2(-384, -384), 32f));
            //resources.Add(new ResourceArea(2, 196, new Vector2(-384, 384), null, this));
            //islands.Add(new Island(this, "island2", 0.3f, new Vector2(-384, 384), 32f));
            //resources.Add(new ResourceArea(3, 196, new Vector2(0, 0), null, this));
            //islands.Add(new Island(this, "island0", 0.3f, new Vector2(0, 0), 32f));
            //resources.Add(new ResourceArea(4, 196, new Vector2(384, -384), null, this));
            //islands.Add(new Island(this, "island3", 0.3f, new Vector2(384, -384), 32f));
            //resources.Add(new ResourceArea(5, 196, new Vector2(384, 384), null, this));
            //islands.Add(new Island(this, "island4", 0.3f, new Vector2(384, 384), 32f));

            sea       = new Sea();
            waterWave = new WaterWave();
            for (int i = 0; i < 20; i++)//添加云
            {
                // upperAmbients.Add(AmbientObject.CreateCloud(this,new Vector2(GameOperators.Random.Next(-768,768),GameOperators.Random.Next(-1024,1024)),new Vector2 (10f,2f)));
                upperAmbients.Add(AmbientObject.CreateCloud(this, new Vector2(GameOperators.Random.Next((int)(-MapSize.X / 2 * 1.4f), (int)(MapSize.X / 2 * 1.4f)), GameOperators.Random.Next((int)(-MapSize.Y / 2 * 1.4f), (int)(MapSize.Y / 2 * 1.4f))), new Vector2(10f, 2f)));
            }

            lowerAmbients.Add(new AmbientObject(this, new Vector2(0, 0), "OceanBackground", 2, Color.White, 0));
            lowerAmbients.Add(new AmbientObject(this, new Vector2(0, 0), "OceanBackgroundWord", 0.75f, Color.White, 0));
            for (int i = 0; i < 20; i++)//添加鱼
            {
                // upperAmbients.Add(AmbientObject.CreateCloud(this,new Vector2(GameOperators.Random.Next(-768,768),GameOperators.Random.Next(-1024,1024)),new Vector2 (10f,2f)));
                lowerAmbients.Add(new Fish(this));
            }

            map = new SmallMap(ships, resources, currentCamera);

            corners[0]     = new Vector2(-mapSize.X / 2, -mapSize.Y / 2);
            corners[1]     = new Vector2(mapSize.X / 2, -mapSize.Y / 2);
            corners[2]     = new Vector2(mapSize.X / 2, mapSize.Y / 2);
            corners[3]     = new Vector2(-mapSize.X / 2, mapSize.Y / 2);
            this.ambientOn = ambientOn;
        }
Beispiel #3
0
 public SideInfoLabel(TimeManager timeManager, InfoCollector collector)
 {
     this.timeManager = timeManager;
     this.collector   = collector;
 }