Exemplo n.º 1
0
        public string createNewCampaign(string playerid, string campaignname, clsSektorKoordinaten fielddim, int anzUnitsPerPlayer)
        {
            Player player = getPlayer(playerid);
            if (player == null)
                return "";

            // Datenbank
            ICampaignDatabase database = (ICampaignDatabase)getCampaignDbOrNew("");

            // Spielfeld
            Field field = new Field(fielddim);

            // Engine
            CampaignEngine engine = new CampaignEngine(field);
            engine.CampaignName = campaignname;
            engine.FieldField.Id = 123;
            engine.addPlayer(player);

            CampaignController controller = new CampaignController();
            controller.CampaignDataBase = database;
            controller.campaignEngine = engine;
            controller.CampaignKey = database.CampaignKey;
            controller.saveCurrentGameState();

            m_dictLoadedController[controller.CampaignKey] = controller;
            return database.CampaignKey;
        }
Exemplo n.º 2
0
        public string createNewCampaign(string playerid, string fielddimension)
        {
            Player player = getPlayer(playerid);
            if (player == null)
                return "";

            // Datenbank
            ICampaignDatabase database = (ICampaignDatabase)getCampaignDbOrNew("");

            // Spielfeld
            Field field = new Field(3, 3);

            // Engine
            CampaignEngine engine = new CampaignEngine(field);
            engine.FieldField.Id = 123;
            engine.addPlayer(player);
            engine.addUnit(player, new clsUnit(new Random().Next(1000, 9999).ToString(), 0), field.getSektorList()[0]);

            CampaignController controller = new CampaignController();
            controller.CampaignDataBase = database;
            controller.campaignEngine = engine;
            controller.CampaignKey = database.CampaignKey;
            controller.saveCurrentGameState();

            m_dictLoadedController[controller.CampaignKey] = controller;
            return database.CampaignKey;
        }