Пример #1
0
        //method that starts a new scenario:
        public void ActivateScenario(Scenario scenario)
        {
            if (!scenario || status == ScenarioStatus.success || status == ScenarioStatus.failed) //if there was an active scenario that ended, do not proceed
            {
                return;
            }

            menu.SetActive(false);                                //start by hiding the menu

            if (status == ScenarioStatus.active && this.scenario) //if there was an active scenario already
            {
                CustomEvents.OnScenarioFail(scenario);            //mark scenario as failed

                scenario.GetMission(currMissionID).Disable();     //disable the last active mission in that scenario
            }

            //assign new scenario
            this.scenario = scenario;

            currMissionID = -1;

            menu.SetActive(true);                   //show the scenario menu
            EnableNext();                           //enable the first mission
            status = ScenarioStatus.active;         //this mission scenario is now active

            CustomEvents.OnScenarioStart(scenario); //trigger custom event

            enabled = true;                         //enable this component
        }
Пример #2
0
 public ScenarioInfo(ScenarioData data, List <Item> rewards, List <Behaviour> monsterModifiers,
                     ScenarioStatus status)
 {
     this.Data             = data;
     this.Rewards          = rewards;
     this.MonsterModifiers = monsterModifiers;
     this.Status           = status;
 }
Пример #3
0
        //called when one of the missions has failed
        public void OnFailed()
        {
            status = ScenarioStatus.failed;
            CustomEvents.OnScenarioFail(scenario);        //trigger custom event

            scenario.GetMission(currMissionID).Disable(); //disable the last active mission

            gameMgr.LooseGame();                          //player loses the game
        }
Пример #4
0
 public void StartScenario()
 {
     status = ScenarioStatus.IN_PROGRESS;
     active = true;
     if (type != null && type == ScenarioType.NOTIFICATION)
     {
         // Send scenario to NPC manager for notification popup and execution
         NPCController.Instance.ShowScenarioNotification(this);
     }
     else
     {
         ExecuteScenario();
     }
 }
Пример #5
0
        //called when all of the missions in the scenario are completed
        public void OnSuccess()
        {
            currMissionID--; //so we can see the last mission on the UI menu
            RefreshUI();

            status = ScenarioStatus.success;
            CustomEvents.OnScenarioSuccess(scenario); //trigger custom event

            gameMgr.WinGame();                        //player wins the game

            if (save)                                 //if saving is enabled
            {
                MissionSaveLoad.SaveScenario(scenario.GetCode(), true);
            }
        }
Пример #6
0
 public void SetSuccess(ScenarioStatus status)
 {
     if (status == ScenarioStatus.Success)
     {
         image.color = new Color(0, 1, 0, .2f);
         clickColor  = new Color(0, 1, 0, 1);
     }
     else if (status == ScenarioStatus.Failure)
     {
         image.color = new Color(1, 0, 0, .2f);
         clickColor  = new Color(1, 0, 0, 1);
     }
     else
     {
         image.color = new Color(1, 1, 1, .2f);
         clickColor  = new Color(1, 1, 1, 1);
     }
 }
Пример #7
0
        public static ProfileCampaign ReadFrom(PrimitiveReader reader)
        {
            ProfileCampaign campaign = new ProfileCampaign();

            campaign.Name           = reader.ReadFixedString(nameLength, Utils.TextEncoding);
            campaign.Count1         = reader.ReadUInt32();
            campaign.ScenariosCount = reader.ReadUInt32();
            campaign.Count2         = reader.ReadUInt32();
            campaign.Unknown1       = reader.ReadUInt32();
            campaign.Unknown2       = reader.ReadUInt32();
            ScenarioStatus[] statuses = new ScenarioStatus[(int)campaign.ScenariosCount];
            for (int i = 0; i < statuses.Length; i++)
            {
                statuses[i] = (ScenarioStatus)reader.ReadUInt8();
            }
            campaign.Statuses = statuses;
            return(campaign);
        }
Пример #8
0
        public List <ScenarioStatus> getScenarioStatus(string runName)
        {
            List <ScenarioStatus> scenarioStatuses = new List <ScenarioStatus>();


            string[] queryParams = new string[] { runName };
            string   query       = QueryHelperService.QueryDictionary["GetScenarioStatus"];

            var parsedQuery = string.Format(query, queryParams);

            using (SqlConnection conn = new SqlConnection(_connectionString))
            {
                using (SqlCommand command = new SqlCommand(parsedQuery, conn))
                {
                    conn.Open();
                    using (var reader = command.ExecuteReader())
                    {
                        while (reader.HasRows)
                        {
                            while (reader.Read())
                            {
                                var scenarioStatus = new ScenarioStatus();
                                scenarioStatus.ScenarioName       = reader.GetString(0);
                                scenarioStatus.ModuleName         = reader.GetString(1);
                                scenarioStatus.TimeTakenInMinutes = reader.GetDecimal(2);
                                scenarioStatuses.Add(scenarioStatus);
                            }
                            reader.NextResult();
                        }
                    }
                }
            }


            return(scenarioStatuses);
        }
Пример #9
0
 void SetStatus(ScenarioStatus status)
 {
     Events.Add(new ScenarioEvent(status));
 }
 public bool HasAnyScenarios(ScenarioStatus scenarioStatus)
 {
     return _stories.Any(s => s.HasAnyScenarios(scenarioStatus));
 }
 public List<ScenarioResult> ScenariosByStatus(ScenarioStatus status)
 {
     return Scenarios.Where(s => s.Status == status).ToList();
 }
 public bool HasAnyScenarios(ScenarioStatus scenarioStatus)
 {
     return _scenarios.Any(s => s.Status == scenarioStatus);
 }
 public void AddLine(ScenarioStatus status, string text)
 {
     _lines.Add(new ScenarioLineResult {Status = status, Text = text});
 }
Пример #14
0
 public ScenarioEvent(ScenarioStatus status)
 {
     TimeStamp = DateTime.Now;
     Status = status;
 }
Пример #15
0
 public void Pending_scenario_step()
 {
     ScenarioStatus.Pending();
 }
Пример #16
0
 public void ExecuteScenario()
 {
     executor.execute();
     status = ScenarioStatus.COMPLETE;
     active = false;
 }