示例#1
0
        public ScenarioResult(GameSession session, Scenario scenario)
        {
            Team1TotalReinforcements = session.Team1StartReinforcements;
            Team2TotalReinforcements = session.Team2StartReinforcements;
            Team1RemainingReinforcements = session.Team1Reinforcements;
            Team2RemainingReinforcements = session.Team2Reinforcements;
            Team1ActiveCount = session.Team1ActiveCount;
            Team2ActiveCount = session.Team2ActiveCount;
            Team1DeadCount = session.Team1DeadCount;
            Team2DeadCount = session.Team2DeadCount;
            Team1Win = session.Team1Win;
            Team2Win = session.Team2Win;

            Team1Human = (session.Team1ClientType == GameClientType.Human ? true : false);
            Team2Human = (session.Team2ClientType == GameClientType.Human ? true : false);

            int Team1Percent = (int)((100M / (decimal)Team1TotalReinforcements) * ((decimal)Team1RemainingReinforcements + (decimal)Team1ActiveCount));
            int Team2Percent = (int)((100M / (decimal)Team2TotalReinforcements) * ((decimal)Team2RemainingReinforcements + (decimal)Team2ActiveCount));

            if (Team1Percent >= scenario.BronzeScore) Team1ScoreRewarded = 1;
            if (Team1Percent >= scenario.SilverScore) Team1ScoreRewarded = 2;
            if (Team1Percent >= scenario.GoldScore) Team1ScoreRewarded = 3;

            if (Team2Percent >= scenario.BronzeScore) Team2ScoreRewarded = 1;
            if (Team2Percent >= scenario.SilverScore) Team2ScoreRewarded = 2;
            if (Team2Percent >= scenario.GoldScore) Team2ScoreRewarded = 3;
        }
示例#2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        public GameplayScreen(Scenario scenario)
        {
            gameScenario = scenario;

            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(0.5);

            IsStubbourn = true;

            EnabledGestures = GestureType.Pinch | GestureType.Tap | GestureType.FreeDrag;
        }
示例#3
0
        public ResultPopupScreen(ScenarioResult result, Scenario scenario)
        {
            gameResult = result;
            gameScenario = scenario;

            if (result.Team1Human && !result.Team2Human)
            {
                if (result.Team1Win && !result.Team2Win) resultText = "Victory";
                if (result.Team1Win && result.Team2Win) resultText = "Stalemate";
                if (!result.Team1Win && result.Team2Win) resultText = "Defeat";
                numStars = result.Team1ScoreRewarded;
            }
            if (!result.Team1Human && result.Team2Human)
            {
                if (!result.Team1Win && result.Team2Win) resultText = "Victory";
                if (result.Team1Win && result.Team2Win) resultText = "Stalemate";
                if (result.Team1Win && !result.Team2Win) resultText = "Defeat";
                numStars = result.Team2ScoreRewarded;
            }
            if (result.Team1Human && result.Team2Human)
            {
                if (result.Team1Win && !result.Team2Win) resultText = "Red Wins";
                if (result.Team1Win && result.Team2Win) resultText = "Stalemate";
                if (!result.Team1Win && result.Team2Win) resultText = "Blue Wins";
            }
            if (!result.Team1Human && !result.Team2Human)
            {
                if (result.Team1Win && !result.Team2Win) resultText = "Red Wins";
                if (result.Team1Win && result.Team2Win) resultText = "Stalemate";
                if (!result.Team1Win && result.Team2Win) resultText = "Blue Wins";
            }

            TransitionOnTime = TimeSpan.FromSeconds(1.5);
            TransitionOffTime = TimeSpan.FromSeconds(1.5);
            IsPopup = true;

            EnabledGestures = GestureType.Tap;
        }
示例#4
0
        private void button1_Click(object sender, EventArgs e)
        {
            List<Function> funcs = new List<Function>();
            funcs.Add(new Function("boost", 1000, chkBoost.Checked));
            funcs.Add(new Function("shield", 10000, chkShield.Checked));
            funcs.Add(new Function("pistol", 4000, chkPistol.Checked));
            funcs.Add(new Function("shotgun", 6000, chkShotgun.Checked));
            funcs.Add(new Function("smg", 8000, chkSMG.Checked));
            funcs.Add(new Function("sniper", 30000, chkSniper.Checked));
            funcs.Add(new Function("machinegun", 30000, chkMG.Checked));
            funcs.Add(new Function("mortar", 30000, chkMortar.Checked));
            funcs.Add(new Function("haste", 20, chkSoul.Checked));
            funcs.Add(new Function("meteors", 20, chkSoul.Checked));
            funcs.Add(new Function("elite", 20, chkSoul.Checked));

            Scenario scenario = new Scenario(txtScenarioName.Text, txtMap.Text, funcs,
                                             Convert.ToInt32(txtAIReaction.Text),
                                             Convert.ToInt32(txtT1Re.Text),
                                             Convert.ToInt32(txtT2Re.Text),
                                             Convert.ToInt32(txtT1Spawn.Text),
                                             Convert.ToInt32(txtT2Spawn.Text));

            scenario.GoldScore = Convert.ToInt32(txtGold.Text);
            scenario.SilverScore = Convert.ToInt32(txtSilver.Text);
            scenario.BronzeScore = Convert.ToInt32(txtBronze.Text);

            scenario.CampaignMissionNum = Convert.ToInt32(txtMissionNum.Text);

            StringWriter output = new StringWriter(new StringBuilder());
            XmlSerializer xmls = new XmlSerializer(typeof(Scenario));
            xmls.Serialize(output, scenario);
            string outputstring = output.ToString();
            outputstring = outputstring.Replace("<?xml version=\"1.0\" encoding=\"utf-16\"?>", "<?xml version=\"1.0\" encoding=\"utf-8\" ?><XnaContent><Asset Type=\"System.String\"><![CDATA[");
            outputstring += "]]></Asset></XnaContent>";
            textBox1.Text = outputstring;
        }
示例#5
0
        /// <summary>
        /// Loads graphics content for this screen. The background texture is quite
        /// big, so we use our own local ContentManager to load it. This allows us
        /// to unload before going from the menus into the game itself, wheras if we
        /// used the shared ContentManager provided by the Game class, the content
        /// would remain loaded forever.
        /// </summary>
        public override void LoadContent()
        {
            if (content == null)
                content = new ContentManager(ScreenManager.Game.Services, "Fodder.Content");

            texBG = content.Load<Texture2D>("blank");
            texLogo = content.Load<Texture2D>("logo");

            List<Function> funcs = new List<Function>();
            funcs.Add(new Function("boost", 1000, true));
            funcs.Add(new Function("shield", 10000, true));
            funcs.Add(new Function("pistol", 4000, true));
            funcs.Add(new Function("shotgun", 6000, true));
            funcs.Add(new Function("smg", 8000, true));
            funcs.Add(new Function("sniper", 30000, true));
            funcs.Add(new Function("machinegun", 30000, true));
            funcs.Add(new Function("mortar", 30000, true));
            funcs.Add(new Function("haste", 20, true));
            funcs.Add(new Function("meteors", 20, true));
            funcs.Add(new Function("elite", 20, true));

            Scenario scenario = new Scenario("Attract", "attract", funcs, 3000, 100, 100, 1000, 1000);

            attractSession = new GameSession(GameClientType.AI, GameClientType.AI, scenario, ScreenManager.GraphicsDevice.Viewport, true);
            attractSession.LoadContent(content);
        }
示例#6
0
        public GameSession(GameClientType t1CT, GameClientType t2CT, Scenario scenario, Viewport vp, bool attractmode)
        {
            Instance = this;

            Team1ClientType = t1CT;
            Team2ClientType = t2CT;
            Team1Reinforcements = scenario.T1Reinforcements;
            Team2Reinforcements = scenario.T2Reinforcements;
            Team1StartReinforcements = scenario.T1Reinforcements;
            Team2StartReinforcements = scenario.T2Reinforcements;
            Team1SpawnRate = scenario.T1SpawnRate;
            Team2SpawnRate = scenario.T2SpawnRate;

            Team1DeadCount = 0;
            Team2DeadCount = 0;
            Team1SoulCount = 0;
            Team2SoulCount = 0;

            Team1Win = false;
            Team2Win = false;

            AvailableFunctions = scenario.AvailableFunctions;

            DudeController = new DudeController();
            ButtonController = new ButtonController();
            SoulController = new SoulController();
            ProjectileController = new ProjectileController();
            ParticleController = new ParticleController();
            HUD = new HUD();

            AI1.Initialize(scenario.AIReactionTime);
            AI2.Initialize(scenario.AIReactionTime);

            Viewport = vp;

            IsAttractMode = attractmode;

            ScreenBottom = (IsAttractMode ? 0 : 60);

            StartCountdown = (IsAttractMode ? 0 : 4000);
            prepareTransition = (IsAttractMode ?0f:1f);
            fightTransition = 0f;

            Map = new Map(scenario.MapName);
        }