Exemplo n.º 1
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (askQuestion && GameStateManager.currentState.Equals("StationState") &&
                game.stateManager.stationState.Station.name.ToLower().Equals(locationName.ToLower()))
            {
                askQuestion = false;

                PopupHandler.DisplaySelectionMenu(question.Text, new List <String>()
                {
                    "Yes", "No"
                },
                                                  new List <System.Action>()
                {
                    delegate
                    {
                        progressObjective = true;
                        mission.MissionHelper.ShowEvent(yesEvent);
                        game.stateManager.stationState.OnEnter();
                    },
                    delegate
                    {
                        mission.MissionHelper.ShowEvent(noEvent);
                        game.stateManager.stationState.OnEnter();
                    }
                });
            }

            else if (GameStateManager.currentState.Equals("OverworldState"))
            {
                askQuestion = true;
            }
        }
Exemplo n.º 2
0
        public override void MissionLogic()
        {
            base.MissionLogic();

            if (ObjectiveIndex > 2 &&
                ObjectiveIndex <= 6 &&
                !Game.player.HyperspeedOn)
            {
                if (Vector2.Distance(Game.player.position, rebelShips[1].position) > 500)
                {
                    PopupHandler.DisplayPortraitMessage(PortraitID.RebelPilot, "Hey! Where are you going? The freighter will be here any minute now.");
                    Game.player.BounceBack();
                }

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip waiting?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }
        }
        public override void OnActivate()
        {
            base.OnActivate();

            if (canvas == EventTextCanvas.BaseState)
            {
                mission.MissionHelper.ShowEvent(responseEventText);
                mission.MissionHelper.ShowResponse(responseEvents.Value);

                if (GameStateManager.currentState.Equals("PlanetState"))
                {
                    game.stateManager.planetState.OnEnter();
                }

                else if (GameStateManager.currentState.Equals("StationState"))
                {
                    game.stateManager.stationState.OnEnter();
                }
            }

            else if (canvas == EventTextCanvas.MessageBox)
            {
                if (mission.MissionHelper.IsTextCleared())
                {
                    List <String>        responses = new List <String>();
                    List <System.Action> a         = new List <System.Action>();

                    foreach (EventText e in responseEvents.Value)
                    {
                        responses.Add(e.Text);
                    }

                    for (int i = 0; i < actions.Keys.Count; i++)
                    {
                        System.Action tempAction;

                        actions.TryGetValue(i, out tempAction);
                        a.Add(tempAction);
                    }


                    PopupHandler.DisplaySelectionMenu(responseEventText.Text, responses, a);
                }

                else
                {
                    delayResponse = true;
                }
            }
        }
Exemplo n.º 4
0
        public override Boolean Activate()
        {
            itemBought = false;

            var responseChoices = new List <String>()
            {
                "Yes", "No"
            };

            PopupHandler.DisplaySelectionMenu(welcomeText, responseChoices, new List <System.Action>()
            {
                delegate
                {
                    if (!ShipInventoryManager.HasAvailableSlot())
                    {
                        PopupHandler.DisplayMessage(inventoryFullText);
                    }

                    else if (StatsManager.Crebits >= price)
                    {
                        PopupHandler.DisplayMessage(itemBoughtText);

                        StatsManager.Crebits -= price;
                        ShipInventoryManager.AddItem(item);
                        if (oneTimeOnly)
                        {
                            IsCleared();
                        }
                        itemBought = true;
                    }

                    else
                    {
                        PopupHandler.DisplayMessage(notEnoughMoneyText);
                    }
                },

                delegate
                {
                    PopupHandler.DisplayMessage(declinePurchaseText);
                }
            });

            return(true);
        }
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (mission.MissionResponse != 0)
            {
                if (mission.MissionResponse <= actions.Count)
                {
                    actions[mission.MissionResponse - 1].Invoke();
                }
            }

            if (delayResponse && mission.MissionHelper.IsTextCleared())
            {
                List <String>        responses = new List <String>();
                List <System.Action> a         = new List <System.Action>();

                foreach (EventText e in responseEvents.Value)
                {
                    responses.Add(e.Text);
                }

                for (int i = 0; i < actions.Keys.Count; i++)
                {
                    System.Action tempAction;

                    actions.TryGetValue(i, out tempAction);
                    a.Add(tempAction);
                }


                PopupHandler.DisplaySelectionMenu(responseEventText.Text, responses, a);

                delayResponse = false;
            }
        }
Exemplo n.º 6
0
        protected override void SetupObjectives()
        {
            objectives.Clear();

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               delegate { SetupAllyShips(allyShips1, destinations[0].position, destinations[1]); },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.OutsideRebelStation1), null, EventTextCanvas.MessageBox, PortraitID.Sair),
                                               delegate { },
                                               delegate { },
                                               delegate { return(GameStateManager.currentState.ToLower().Equals("overworldstate")); },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.AtRebelRendezvous), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader),
                                               delegate
            {
                readyToLeave      = false;
                allyShipRectangle = new Rectangle(
                    (int)allyShips1[0].position.X - AllyShipRectOffset,
                    (int)allyShips1[0].position.Y - AllyShipRectOffset,
                    AllyShipRectWidth, AllyShipRectHeight);

                PopupHandler.DisplayPortraitMessage(PortraitID.Rok, "[Rok] \"Talk to the ships waiting nearby our base when you're ready to leave.\"");
            },
                                               delegate
            {
                if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) &&
                    (ControlManager.CheckPress(RebindableKeys.Action1) ||
                     ControlManager.CheckKeyPress(Keys.Enter)) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("[Rebel Pilot] Ready to go?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate { readyToLeave = true; },
                        delegate { readyToLeave = false; }
                    });
                }
            },
                                               delegate { return(readyToLeave); },
                                               delegate { return(false); }));

            //objectives.Add(new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[0],
            //    200, new EventTextCapsule(GetEvent((int)EventID.AtRebelRendezvous), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader)));

            AutoPilotObjective autoPilotObjective = new AutoPilotObjective(Game, this, ObjectiveDescriptions[0], AutoPilotSpeed,
                                                                           allyShips1, destinations[3].position,
                                                                           new EventTextCapsule(GetEvent((int)EventID.ArriveAtScienceStation),
                                                                                                null,
                                                                                                EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader), false);

            autoPilotObjective.Initialize();
            autoPilotObjective.SetTimedMessages(new Dictionary <string, List <float> >
            {
                { GetEvent((int)EventID.TravelToScienceStation1).Text, new List <float> {
                      5000, 3000
                  } },
                { GetEvent((int)EventID.TravelToScienceStation2).Text, new List <float> {
                      1000, 3000
                  } },
                { GetEvent((int)EventID.TravelToScienceStation3).Text, new List <float> {
                      13000, 3000
                  } }
            }
                                                , new List <List <PortraitID> >()
            {
                new List <PortraitID> {
                    PortraitID.Ai
                },
                new List <PortraitID> {
                    PortraitID.Sair
                },
                new List <PortraitID> {
                    PortraitID.Ai
                }
            }
                                                , new List <List <int> > {
                new List <int> {
                }, new List <int> {
                }, new List <int> {
                }
            });

            objectives.Add(autoPilotObjective);

            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[0],
                                                      "Itnos_1", LevelStartCondition.TextCleared,
                                                      new EventTextCapsule(GetEvent((int)EventID.AfterLevel1),
                                                                           null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader)));

            objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[0],
                                                         new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation1), null, EventTextCanvas.MessageBox, PortraitID.Sair)));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation2), null, EventTextCanvas.MessageBox),
                                               delegate { }, delegate { }, delegate { return(true); }, delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.InsideScienceStation3), null, EventTextCanvas.MessageBox, PortraitID.Ente),
                                               delegate { }, delegate { }, delegate { return(true); }, delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1],
                                               new EventTextCapsule(GetEvent((int)EventID.OutsideScienceStation), null, EventTextCanvas.MessageBox, PortraitID.Sair),
                                               delegate
            {
                RemoveShips();
            }, delegate { },
                                               delegate
            {
                return(GameStateManager.currentState == "OverworldState");
            },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1],
                                               new EventTextCapsule(GetEvent((int)EventID.BreakThroughLevel), null, EventTextCanvas.MessageBox, PortraitID.Sair),
                                               delegate
            {
                hangarAttackTime = StatsManager.PlayTime.GetFutureOverworldTime(2000);
            },
                                               delegate { },
                                               delegate
            {
                return(StatsManager.PlayTime.HasOverworldTimePassed(hangarAttackTime));
            },
                                               delegate { return(false); }));

            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1],
                                                      "Itnos_2", LevelStartCondition.TextCleared,
                                                      new EventTextCapsule(GetEvent((int)EventID.AfterLevel2), null, EventTextCanvas.MessageBox, PortraitID.RebelTroopLeader)));

            objectives.Add(new CloseInOnLocationObjective(Game, this, ObjectiveDescriptions[1], 200,
                                                          new EventTextCapsule(GetEvent((int)EventID.OutsideRebelStation2), null, EventTextCanvas.MessageBox, PortraitID.Ente)));

            objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[1]));
        }
        protected override void SetupObjectives()
        {
            float time = 0;

            objectives.Clear();

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               delegate { SetupAllyShips(allyShips1, fortrunStation.position, newNorrland); },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.OutsideFortrun1), null, EventTextCanvas.MessageBox, PortraitID.Sair),
                                               delegate
            {
                time = StatsManager.PlayTime.GetFutureOverworldTime(500);
            },
                                               delegate { },
                                               delegate { return(StatsManager.PlayTime.HasOverworldTimePassed(time)); },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.OutsideFortrun2), null, EventTextCanvas.MessageBox, PortraitID.Ai),
                                               delegate
            {
                readyToLeave      = false;
                allyShipRectangle = new Rectangle(
                    (int)allyShips1[0].position.X - AllyShipRectOffset,
                    (int)allyShips1[0].position.Y - AllyShipRectOffset,
                    AllyShipRectWidth, AllyShipRectHeight);

                PopupHandler.DisplayPortraitMessage(PortraitID.Ai, "[Ai] \"Talk to the alliance ships waiting outside Fortrun when you're ready to leave.\"#\"Don't forget to stop by the shop and upgrade your equipment if you have not done so already!\"");
            },
                                               delegate
            {
                if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) &&
                    (ControlManager.CheckPress(RebindableKeys.Action1) ||
                     ControlManager.CheckKeyPress(Keys.Enter)) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("[Ai] Ready to go?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate { readyToLeave = true; },
                        delegate { readyToLeave = false; }
                    });
                }
            },
                                               delegate { return(readyToLeave); },
                                               delegate { return(false); }));

            AutoPilotObjective autoPilotObjective1 = new AutoPilotObjective(Game, this, ObjectiveDescriptions[1], AutoPilotSpeed,
                                                                            allyShips1, fortrunStation.position,
                                                                            new EventTextCapsule(GetEvent((int)EventID.OutsideNewNorrland), null, EventTextCanvas.MessageBox, PortraitID.Ai));

            autoPilotObjective1.Initialize();
            autoPilotObjective1.SetTimedMessages(new Dictionary <string, List <float> >
            {
                { GetEvent((int)EventID.ToNewNorrland1).Text, new List <float> {
                      3000, 3000
                  } },
                { GetEvent((int)EventID.ToNewNorrland2).Text, new List <float> {
                      20000, 3000
                  } }
            },
                                                 null, null);

            objectives.Add(autoPilotObjective1);

            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1],
                                                      "DefendColonyBreak", LevelStartCondition.TextCleared));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.FirstLevelCompleted), null, EventTextCanvas.MessageBox, PortraitID.Ai),
                                               delegate
            {
                Game.stateManager.GotoPlanetSubScreen("New Norrland", "Overview");
            },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[1],
                                                      "DefendColonyHold", LevelStartCondition.TextCleared,
                                                      new EventTextCapsule(GetEvent((int)EventID.SecondLevelCompleted), null, EventTextCanvas.MessageBox, PortraitID.Ai)));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[1],
                                               delegate
            {
                RemoveShips(allyShips1);
                SetupAllyShips(allyShips2,
                               new Vector2(newNorrland.position.X + 0, newNorrland.position.Y - 625),
                               fortrunStation);
            },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[2],
                                               new EventTextCapsule(new EventText("[Ai] \"Let's go\""), null, EventTextCanvas.MessageBox, PortraitID.Ai),
                                               delegate
            {
                allyShipRectangle = new Rectangle(
                    (int)allyShips2[0].position.X - AllyShipRectOffset,
                    (int)allyShips2[0].position.Y - AllyShipRectOffset,
                    AllyShipRectWidth, AllyShipRectHeight);
                readyToLeave = false;

                PopupHandler.DisplayPortraitMessage(PortraitID.Ai, "[Ai] \"Talk to the alliance ships waiting outside New Norrland when you're ready to leave.\"");
            },
                                               delegate
            {
                if (CollisionDetection.IsRectInRect(Game.player.Bounds, allyShipRectangle) &&
                    (ControlManager.CheckPress(RebindableKeys.Action1) ||
                     ControlManager.CheckKeyPress(Keys.Enter)) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("[Ai] Ready to head back?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate { readyToLeave = true; },
                        delegate { readyToLeave = false; }
                    });
                }
            },
                                               delegate { return(readyToLeave); },
                                               delegate { return(false); }));

            AutoPilotObjective autoPilotObjective = new AutoPilotObjective(Game, this, ObjectiveDescriptions[3], AutoPilotSpeed2,
                                                                           allyShips2, newNorrland.position, false);

            autoPilotObjective.Initialize();
            autoPilotObjective.SetActivateRealTimeIndex(2);
            autoPilotObjective.SetTimedMessages(
                new Dictionary <string, List <float> >
            {
                { GetEvent((int)EventID.ToFortrun1).Text, new List <float> {
                      7000, 3000
                  } },
                { GetEvent((int)EventID.ToFortrun2).Text, new List <float> {
                      1000, 3000
                  } },
                { GetEvent((int)EventID.ToFortrun3).Text, new List <float> {
                      4000, 3000
                  } },
            },
                new List <List <PortraitID> >()
            {
                new List <PortraitID> {
                    PortraitID.Sair, PortraitID.CommonCitizen
                },
                new List <PortraitID> {
                    PortraitID.Ai
                },
                new List <PortraitID> {
                    PortraitID.Sair
                }
            },
                new List <List <int> > {
                new List <int> {
                    1
                }, new List <int> {
                }, new List <int> {
                }
            });

            objectives.Add(autoPilotObjective);

            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[3],
                                               delegate
            {
                RemoveShips(allyShips2);
                Game.stateManager.GotoStationSubScreen("Fortrun Station", "Mission");
            },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[3]));
        }
Exemplo n.º 8
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            if (autofollow && started)
            {
                if (!escortDataCapsule.ShipToDefend.HasArrived)
                {
                    game.player.Direction.SetDirection(new Vector2(
                                                           escortDataCapsule.ShipToDefend.destination.X - game.player.position.X,
                                                           escortDataCapsule.ShipToDefend.destination.Y - game.player.position.Y));
                }

                game.player.speed = escortDataCapsule.ShipToDefend.speed;

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }

            if (timedMessageCount >= 0 &&
                timedMessageCount < timedMessages.Count &&
                StatsManager.PlayTime.HasOverworldTimePassed(timedMessageTimes[timedMessageCount]))
            {
                if (timedMessagePortraits[timedMessageCount] != PortraitID.None)
                {
                    PopupHandler.DisplayRealtimePortraitMessage(3000, new [] { timedMessagePortraits[timedMessageCount] },
                                                                new List <int>(), timedMessages[timedMessageCount]);
                }
                else
                {
                    PopupHandler.DisplayRealtimeMessage(3000, timedMessages[timedMessageCount]);
                }
                timedMessageCount++;
            }

            // Player talks to freighter to begin escort
            if (!started &&
                GameStateManager.currentState.Equals("OverworldState") &&
                CollisionDetection.IsRectInRect(game.player.Bounds, escortDataCapsule.ShipToDefend.Bounds) &&
                ((ControlManager.CheckPress(RebindableKeys.Action1) || ControlManager.CheckKeyPress(Keys.Enter))))
            {
                if (showInventoryTutorial &&
                    ShipInventoryManager.equippedShield is EmptyShield)
                {
                    PopupHandler.DisplayPortraitMessage(introductionPortrait, "[Alliance Pilot] \"You need to equip a shield before we leave. Go to the shop next to Highfence and I will tell you what to do.");
                    game.tutorialManager.EnableEquipTutorial();
                }

                else
                {
                    if (introductionPortrait != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(introductionPortrait, introductionText);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(introductionText);
                    }

                    ((FreighterShip)escortDataCapsule.ShipToDefend).Start();
                    escortDataCapsule.ShipToDefend.speed = escortDataCapsule.FreighterSpeed;

                    started = true;

                    if (autofollow)
                    {
                        game.player.DisableControls();
                    }

                    this.Description = descriptions[0];

                    enemyAttackStartTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackStartTime);

                    for (int i = 0; i < timedMessages.Count; i++)
                    {
                        timedMessageTimes.Add(StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.TimedMessageTriggers[i]));
                    }
                    timedMessageCount = 0;
                }
            }

            // Escort mission begins
            if (started &&
                GameStateManager.currentState.Equals("OverworldState") &&
                numberOfEnemyShips > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(enemyAttackStartTime))
            {
                // Ready to spawn a new enemy ship
                if (StatsManager.PlayTime.HasOverworldTimePassed(enemyNextWaveTime))
                {
                    int i = startingNumberOfEnemyShips - numberOfEnemyShips;

                    if (descriptions.Count > 0)
                    {
                        if (descriptions.Count > 1)
                        {
                            descriptions.RemoveAt(0);
                        }

                        this.Description = descriptions[0];
                    }

                    if (attackStartPortraits[i] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(attackStartPortraits[i], attackStartText[i]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(attackStartText[i]);
                    }

                    game.stateManager.overworldState.GetSectorX.shipSpawner.AddOverworldShip(
                        enemies[0],
                        escortDataCapsule.ShipToDefend.position +
                        (650 * escortDataCapsule.ShipToDefend.Direction.GetDirectionAsVector()),
                        levels[levelIndex], escortDataCapsule.ShipToDefend);

                    numberOfEnemyShips--;

                    if (numberOfEnemyShips > 0)
                    {
                        enemyNextWaveTime = StatsManager.PlayTime.GetFutureOverworldTime(escortDataCapsule.EnemyAttackFrequency);
                    }
                }
            }

            // Transfers freigter hp between levels
            for (int i = 0; i < levels.Count; i++)
            {
                if (GameStateManager.currentState.Equals("ShooterState") &&
                    game.stateManager.shooterState.CurrentLevel.Identifier.Equals(levels[i]) &&
                    game.stateManager.shooterState.GetLevel(levels[i]).IsObjectiveCompleted)
                {
                    shipToDefendHP = game.stateManager.shooterState.CurrentLevel.GetFreighterHP();

                    levelCompleted      = true;
                    levelCompletedIndex = i;
                    levelIndex          = i + 1;
                }
            }

            if (GameStateManager.currentState.Equals("OverworldState"))
            {
                if (levelCompleted &&
                    levelCompletedIndex > lastLevelCompletedIndex)
                {
                    levelCompleted          = false;
                    lastLevelCompletedIndex = levelCompletedIndex;

                    if (afterAttackPortraits[levelCompletedIndex] != PortraitID.None)
                    {
                        PopupHandler.DisplayPortraitMessage(afterAttackPortraits[levelCompletedIndex],
                                                            afterAttackMessages[levelCompletedIndex]);
                    }
                    else
                    {
                        PopupHandler.DisplayMessage(afterAttackMessages[levelCompletedIndex]);
                    }
                }
                else
                {
                    levelCompleted = false;
                }
            }

            Collision();
        }
Exemplo n.º 9
0
        private void ButtonActions()
        {
            if (Game.menuBGController.DisplayButtons)
            {
                switch (buttonIndex)
                {
                case 0:
                    if (SaveFile.CheckIfFileExists(Game1.SaveFilePath, "save.ini"))
                    {
                        PopupHandler.DisplaySelectionMenu("If you start a new game, your previously saved game will be lost. Is this okay?",
                                                          new List <string>()
                        {
                            "Yes", "No"
                        },
                                                          new List <System.Action>()
                        {
                            delegate
                            {
                                Game.menuBGController.SetPreferredBackdropPosition(new Vector2(-201, -101), "StartGameState");
                                PlaySelectSound();
                            },
                            delegate { }
                        });
                    }
                    else
                    {
                        Game.menuBGController.SetPreferredBackdropPosition(new Vector2(-201, -101), "StartGameState");

                        PlaySelectSound();
                    }
                    break;

                // LOADGAMELOGIC
                case 1:
                    if (SaveFile.CheckIfFileExists(Game1.SaveFilePath, "save.ini"))
                    {
                        Game.stateManager.StartGame("OverworldState");
                        Game.Load();
                        Game.GameStarted = true;
                        loadedOrNewGame  = LoadedOrNewGame.Loaded;

                        PlaySelectSound();
                    }
                    else
                    {
                        PopupHandler.DisplayMessage("No save-file!");
                    }
                    break;

                case 2:
                    Game.menuBGController.SetPreferredBackdropPosition(new Vector2(-903, -101), "OptionsMenuState");

                    PlaySelectSound();
                    break;

                case 3:
                    //Game.stateManager.ChangeState("MapCreatorState");

                    PlaySelectSound();
                    Game.stateManager.ChangeState("CreditState");
                    break;

                case 4:
                    MediaPlayer.Stop();
                    Game.Exit();
                    break;
                }
            }
        }
        public override void ButtonActions()
        {
            switch (menuOptions[cursorIndex, 0].ToLower())
            {
            // MAC CHANGE - Restart on fullscreen
            case "fullscreen":
                game.graphics.ToggleFullScreen();
                optionsMenuState.SaveSettings();
                UpdateText();

                PlaySelectSound();

                if (game.GameStarted)
                {
                    PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to save your game and restart now?",
                                                      new List <string> {
                        "Save and restart", "Cancel"
                    },
                                                      new List <System.Action>());
                }

                else
                {
                    PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to restart now?",
                                                      new List <string> {
                        "Restart", "Cancel"
                    },
                                                      new List <System.Action>());
                }
                break;
            //

            case "show fps":
                game.ShowFPS = !game.ShowFPS;
                UpdateText();

                PlaySelectSound();
                break;

            case "resolution":
                game.ChangeResolution(Game1.ResolutionOptions[resIndex]);
                optionsMenuState.SaveSettings();
                if (!Game1.ResolutionOptions[resIndex].Equals(new Vector2(
                                                                  game.settingsFile.GetPropertyAsFloat("visual", "resolutionx", 800),
                                                                  game.settingsFile.GetPropertyAsFloat("visual", "resolutiony", 600))))
                {
                    if (game.GameStarted)
                    {
                        PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to save your game and restart now?",
                                                          new List <string> {
                            "Save and restart", "Cancel"
                        },
                                                          new List <System.Action>());
                    }

                    else
                    {
                        PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to restart now?",
                                                          new List <string> {
                            "Restart", "Cancel"
                        },
                                                          new List <System.Action>());
                    }

                    UpdateText();
                }

                PlaySelectSound();
                break;

            case "apply changes":
                if (SettingsHasChanged())
                {
                    game.ChangeResolution(Game1.ResolutionOptions[resIndex]);
                    optionsMenuState.SaveSettings();

                    if (game.GameStarted)
                    {
                        PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to save your game and restart now?",
                                                          new List <string> {
                            "Save and restart", "Cancel"
                        },
                                                          new List <System.Action>());
                    }

                    else
                    {
                        PopupHandler.DisplaySelectionMenu("The game needs to be restarted for this to take effect. Do you want to restart now?",
                                                          new List <string> {
                            "Restart", "Cancel"
                        },
                                                          new List <System.Action>());
                    }

                    UpdateText();
                }

                PlaySelectSound();
                break;

            case "back":
                optionsMenuState.LeaveSubState();
                OnLeave();

                PlayLowPitchSelectSound();
                break;
            }
        }
        protected override void SetupObjectives()
        {
            objectives.Clear();

            // Event: Message from Sair on the way to outpost
            objectives.Add(new TimedMessageObjective(Game, this, ObjectiveDescriptions[0], 3000, 3000, PortraitID.Sair,
                                                     GetEvent((int)EventID.SairMessageToOutpost).Text));

            // Objective: Find the outpost
            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.OutpostFound), null, EventTextCanvas.MessageBox),
                                               delegate { },
                                               delegate { },
                                               delegate { return(rebelOutpost.Activated); },
                                               delegate { return(false); }));

            // Objective: Complete the first level
            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[0], level1, LevelStartCondition.TextCleared,
                                                      new EventTextCapsule(GetEvent((int)EventID.Level1Completed), GetEvent((int)EventID.Level1Failed), EventTextCanvas.MessageBox)));

            // Event: Rebels ask for mercy with bribe
            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               delegate
            {
                PopupHandler.DisplaySelectionMenu(String.Format("Accept the {0} from the rebels?", rebelBribe.Name),
                                                  new List <String> {
                    "Yes", "No"
                },
                                                  new List <System.Action> {
                    delegate { OnAcceptBribe(); },
                    delegate { OnDeclineBribe(); }
                });
            },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            // Branch 1 Event: Rebel message after accepting bribe
            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.BribeAccepted), null, EventTextCanvas.MessageBox)));

            // Branch 1 Event: Message from Sair on the way back after accepting bribe
            objectives.Add(new TimedMessageObjective(Game, this, ObjectiveDescriptions[0], 3000, 3000, PortraitID.Sair,
                                                     GetEvent((int)EventID.SairMessageAfterAccept).Text));

            // Branch 1: Jump to final objective
            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               delegate { ObjectiveIndex = 10; },
                                               delegate { },
                                               delegate { return(true); },
                                               delegate { return(false); }));

            // Branch 2 Event: Rebel message after declining bribe
            objectives.Add(new CustomObjective(Game, this, ObjectiveDescriptions[0],
                                               new EventTextCapsule(GetEvent((int)EventID.BeforeLevel2), null, EventTextCanvas.MessageBox)));

            // Branch 2 Objective: Complete the second level
            objectives.Add(new ShootingLevelObjective(Game, this, ObjectiveDescriptions[0], level2, LevelStartCondition.TextCleared,
                                                      new EventTextCapsule(GetEvent((int)EventID.Level2Completed), GetEvent((int)EventID.Level2Failed), EventTextCanvas.MessageBox)));

            // Branch 2 Event: Message from Sair on the way back after accepting bribe
            objectives.Add(new TimedMessageObjective(Game, this, ObjectiveDescriptions[0], 3000, 3000, PortraitID.Sair,
                                                     GetEvent((int)EventID.SairMessageAfterDecline).Text));

            // Objective: Return to Fortrun
            objectives.Add(new ArriveAtLocationObjective(Game, this, ObjectiveDescriptions[0]));
        }
Exemplo n.º 12
0
        public override void Update(PlayTime playTime)
        {
            base.Update(playTime);

            // Updates player direction and speed
            if (!HasAnyShipArrived())
            {
                game.player.Direction.SetDirection(new Vector2(
                                                       Destination.position.X - game.player.position.X,
                                                       Destination.position.Y - game.player.position.Y));

                if (ControlManager.CheckPress(RebindableKeys.Pause) &&
                    GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("Do you want to skip travel?",
                                                      new List <string>()
                    {
                        "Yes", "No"
                    },
                                                      new List <System.Action>()
                    {
                        delegate
                        {
                            SkipForward();
                        },
                        delegate {}
                    });
                }
            }
            game.player.speed = speed;

            // Displays timed messages
            if (timedMessages.Keys.Count > 0 &&
                StatsManager.PlayTime.HasOverworldTimePassed(nextMessageTime))
            {
                if (portraits.Count > 0)
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimePortraitMessage(GetNextMessageDuration(), portraits[0].ToArray(),
                                                                    portraitTriggers[0], timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayPortraitMessage(portraits[0], portraitTriggers[0], timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }

                    portraits.RemoveAt(0);
                    portraitTriggers.RemoveAt(0);
                }
                else
                {
                    if (realTime)
                    {
                        PopupHandler.DisplayRealtimeMessage(GetNextMessageDuration(), timedMessages.Keys.First());
                    }
                    else
                    {
                        realTimeSwitchIndex++;
                        PopupHandler.DisplayMessage(timedMessages.Keys.First());
                        if (useRealTimeSwitch &&
                            realTimeSwitchIndex >= activateRealTimeSwitchIndex)
                        {
                            realTime = true;
                        }
                    }
                }

                timedMessages.Remove(timedMessages.Keys.First());

                if (timedMessages.Keys.Count > 0)
                {
                    nextMessageTime = GetNextMessageStartTime();
                }
            }
        }
Exemplo n.º 13
0
        protected virtual void DefaultOnPressActions()
        {
            Popup.delayTimer = PressDelay;

            switch (menuOptions[cursorIndex])
            {
            case "Help":
                game.stateManager.ChangeState("HelpScreenState");
                DisplayMenuOnReturn(0);
                Hide();
                break;

            case "Ship Inventory":
                game.stateManager.ChangeState("ShipManagerState");
                DisplayMenuOnReturn(1);
                Hide();
                break;

            case "Mission Screen":
                game.stateManager.ChangeState("MissionScreenState");
                DisplayMenuOnReturn(2);
                Hide();
                break;

            case "Options":
                game.stateManager.ChangeState("OptionsMenuState");
                game.menuBGController.SetBackdropPosition(new Vector2(-903, -101));
                DisplayMenuOnReturn(3);
                Hide();
                break;

            case "Save":
                game.Save();
                PopupHandler.DisplayMessage("The game has been saved!");
                break;

            case "Exit Game":
                if (GameStateManager.currentState.Equals("OverworldState"))
                {
                    PopupHandler.DisplaySelectionMenu("What do you want to do?",
                                                      new List <string> {
                        "Save and exit to menu", "Save and exit to desktop", "Cancel"
                    },
                                                      new List <System.Action>());
                }

                else if (GameStateManager.currentState.Equals("ShooterState"))
                {
                    PopupHandler.DisplaySelectionMenu("What do you want to do? You cannot save during combat.",
                                                      new List <string> {
                        "Exit to menu without saving", "Exit to desktop without saving", "Cancel"
                    },
                                                      new List <System.Action>());
                }
                break;

            case "Return To Game":
                Hide();
                break;

            // Shooter state only
            case "Restart Level":
                game.stateManager.shooterState.CurrentLevel.ResetLevel();
                game.stateManager.shooterState.Initialize();
                game.stateManager.shooterState.CurrentLevel.Initialize();
                Hide();
                break;

            case "Give Up Level":
                game.stateManager.shooterState.CurrentLevel.GiveUpLevel();
                Hide();
                break;

            case "Exit Level":
                game.stateManager.shooterState.CurrentLevel.LeaveLevel();
                Hide();
                break;
            }
        }