Пример #1
0
        public override void StartScenario()
        {
            hbuilder       = scenario.hexBuilder;
            conditionQuest = new ConditionQuest(
                new SimpleCondition[3] {
                SimpleCondition.GetDummyCondition(null),    // colonists
                SimpleCondition.GetDummyCondition(null),    // energy
                SimpleCondition.GetDummyCondition(null)     // income
            },
                colony,
                false,
                QuestIcon.FoundationRouteIcon
                );
            conditionQuest.steps[0] = localizer.colonistsLabel;
            conditionQuest.steps[1] = localizer.islandStatsLabel;
            conditionQuest.steps[2] = localizer.lowerlandStatsLabel;

            scenario.StartQuest(conditionQuest);
            scenarioQuest.FillText(localizer.GetQuestData(FoundationScenarioStep.Finish));
            //
            conditionWindow = scenarioUI.ShowConditionPanel(0, conditionQuest, null);
            conditionWindow.SetMainIcon(UIController.iconsTexture, UIController.GetIconUVRect(Icons.FoundationRoute));
            //
            UIController.GetCurrent().updateEvent += this.Check;
            scenarioUI.ChangeAnnouncementText(localizer.GetAnnounceTitle(FoundationScenarioStep.Finish, WINDOW_INFO_0));
            scenarioUI.ShowAnnouncePanel();
            //
            colony.populationUpdateEvent += this.CitizensUpdate;
            //
            Check();
        }
Пример #2
0
    public override void EndScenario()
    {
        completed = true;
        GameMaster.SetPause(true);
        GameMaster.realMaster.UnbindScenario(this);

        if (scenarioUI != null)
        {
            scenarioUI.DisableConditionPanel(0);
            scenarioUI.DisableConditionPanel(1);
            scenarioUI.ScenarioEnds(this);
        }
        settleWindow = null;
        if (settleQuest != null)
        {
            settleQuest.MakeQuestCompleted(); settleQuest = null;
            UIController.GetCurrent().updateEvent -= CheckSettlingConditions;
        }
        scenarioQuest?.MakeQuestCompleted(); scenarioQuest = null;
        //hexBuilder.
        //
        FollowingCamera.main.SetObservingPosition(
            hexBuilder.GetHexWorldPosition(new HexPosition(3, Random.Range(0, 18))) + Vector3.up * 5f,
            GameMaster.sceneCenter + Vector3.down * 5f
            );
        //UIController.GetCurrent().ChangeUIMode(UIMode.Endgame, true);
        GameMaster.realMaster.GameOver(GameEndingType.FoundationRoute);
        GameMaster.SetPause(false); // minus one pause request
    }
Пример #3
0
        public override IEnumerable <Mistake> CheckMistake()
        {
            foreach (NPC.NPCDialogue dial in MainWindow.CurrentProject.data.dialogues)
            {
                for (int i = 0; i < dial.Responses.Count; i++)
                {
                    NPC.NPCResponse response = dial.Responses[i];

                    if (response.openQuestId > 0)
                    {
                        ConditionQuest questCondition = null;

                        foreach (Condition condition in response.conditions)
                        {
                            if (condition is ConditionQuest quest)
                            {
                                if (quest.ID == response.openQuestId)
                                {
                                    questCondition = quest;
                                    break;
                                }
                            }
                        }

                        if (questCondition != null && questCondition.Status == NPC.Quest_Status.None) // has quest condition
                        {
                            RewardQuest rewardQuest = null;

                            foreach (Reward reward in response.rewards)
                            {
                                if (reward is RewardQuest rq)
                                {
                                    if (rq.ID == questCondition.ID)
                                    {
                                        rewardQuest = rq;
                                        break;
                                    }
                                }
                            }

                            if (rewardQuest == null)
                            {
                                yield return(new NE_1004(i + 1, dial.ID));
                            }
                        }
                    }
                }
            }
        }
        public override IEnumerable <Mistake> CheckMistake()
        {
            foreach (NPC.NPCDialogue dial in MainWindow.CurrentProject.data.dialogues)
            {
                for (int i = 0; i < dial.Responses.Count; i++)
                {
                    NPC.NPCResponse response = dial.Responses[i];

                    if (response.openQuestId > 0)
                    {
                        ConditionQuest questCondition = null;
                        RewardQuest    questReward    = null;

                        foreach (Condition condition in response.conditions)
                        {
                            if (condition is ConditionQuest quest)
                            {
                                if (quest.ID == response.openQuestId)
                                {
                                    questCondition = quest;
                                    break;
                                }
                            }
                        }

                        foreach (Reward reward in response.rewards)
                        {
                            if (reward is RewardQuest quest)
                            {
                                if (quest.ID == response.openQuestId)
                                {
                                    questReward = quest;
                                    break;
                                }
                            }
                        }

                        if (questCondition == null && questReward == null) // no quest condition yet previewing quest
                        {
                            yield return(new NE_1004(i + 1, dial.ID));
                        }
                    }
                }
            }
        }
Пример #5
0
 public void PrepareSettling()
 {
     if (settleQuest != null)
     {
         return;
     }
     settleQuest = new ConditionQuest(new SimpleCondition[3]
     {
         SimpleCondition.GetDummyCondition(null),
         SimpleCondition.GetDummyCondition(null),
         SimpleCondition.GetResourceCondition(ResourceType.Supplies, COLONISTS_SEND_COST)
     },
                                      colony, false, QuestIcon.PeopleIcon);
     settleQuest.steps[0] = localizer.colonistArrivedLabel;
     settleQuest.steps[1] = localizer.livingSpaceLabel;
     UIController.GetCurrent().updateEvent += CheckSettlingConditions;
     settleWindow = scenarioUI.ShowConditionPanel(1, settleQuest, this.SendColonists);
     settleWindow.SetMainIcon(UIController.iconsTexture, UIController.GetIconUVRect(Icons.Citizen));
     settleWindow.SetButtonText(localizer.sendColonistsLabel);
 }
 public override void OKButton()
 {
     if (stage == 0)
     {
         stage++;
         scenarioUI.CloseAnnouncePanel();
         conditionQuest = new ConditionQuest(
             SimpleCondition.GetStoredEnergyCondition(ANCHOR_LAUNCH_ENERGYCOST),
             colony,
             false,
             ConditionQuest.ConditionQuestIcon.FoundationRouteIcon
             );
         scenario.StartQuest(conditionQuest);
         scenarioQuest.FillText(localizer.GetQuestData(FoundationScenarioStep.AnchorStart));
         scenarioUI.ChangeConditionButtonLabel(Localization.GetWord(LocalizedWord.Anchor_verb));
         scenarioUI.ChangeConditionIcon(UIController.iconsTexture, UIController.GetIconUVRect(Icons.FoundationRoute));
         conditionQuest.BindUIUpdateFunction(scenarioUI.UpdateConditionInfo);
         scenarioUI.ShowConditionPanel(scenarioQuest);
     }
 }
Пример #7
0
        public override void OKButton()
        {
            if (stage == 0)
            {
                stage++;
                scenarioUI.CloseAnnouncePanel();
                conditionQuest = new ConditionQuest(
                    SimpleCondition.GetStoredEnergyCondition(ANCHOR_LAUNCH_ENERGYCOST),
                    colony,
                    false,
                    QuestIcon.FoundationRouteIcon
                    );
                scenario.StartQuest(conditionQuest);
                scenarioQuest.FillText(localizer.GetQuestData(FoundationScenarioStep.AnchorStart));

                conditionWindow = scenarioUI.ShowConditionPanel(0, conditionQuest, this.UIConditionProceedButton);
                conditionWindow.SetButtonText(Localization.GetWord(LocalizedWord.Anchor_verb));
                conditionWindow.SetMainIcon(UIController.iconsTexture, UIController.GetIconUVRect(Icons.PowerPlus));
                conditionQuest.BindUIUpdateFunction(conditionWindow.Refresh);
            }
        }
Пример #8
0
 private void StartQuest(ConditionQuest cq)
 {
     scenarioQuest = cq;
     questUI.SetNewQuest(cq, (byte)QuestSection.Endgame);
 }
Пример #9
0
        protected void StartSectorBuildingQuest(byte ring, byte index, System.Action clickAction)
        {
            var conditions = new SimpleCondition[3];

            if (ring == 0) // INNER RING
            {
                switch (index)
                {
                case 0:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.metal_K, 4100f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.metal_S, 1600f);
                    conditions[2] = SimpleCondition.GetMoneyCondition(2500f);
                    break;

                case 1:
                    conditions[0] = SimpleCondition.GetGearsCondition(4f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.metal_M, 2500f);
                    conditions[2] = SimpleCondition.GetResourceCondition(ResourceType.metal_E, 1200f);
                    break;

                case 2:
                    conditions[0] = SimpleCondition.GetMoneyCondition(2500f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.metal_P, 500f);
                    conditions[2] = SimpleCondition.GetResourceCondition(ResourceType.mineral_L, 2000f);
                    break;

                case 3:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.metal_S, 1500f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.Concrete, 7530f);
                    conditions[2] = SimpleCondition.GetResourceCondition(ResourceType.Plastics, 7530f);
                    break;

                case 4:
                    conditions[0] = SimpleCondition.GetFreeWorkersCondition(500);
                    conditions[1] = SimpleCondition.GetMoneyCondition(1200f);
                    conditions[2] = SimpleCondition.GetResourceCondition(ResourceType.Food, 40000f);
                    break;

                case 5:
                    conditions[0] = SimpleCondition.GetFreeWorkersCondition(600);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.metal_K, 1200f);
                    conditions[2] = SimpleCondition.GetMoneyCondition(1500f);
                    break;
                }
                conditionQuest = new ConditionQuest(conditions, colony, false, QuestIcon.FoundationRouteIcon);
            }
            else // OUTER RING
            {
                switch (index)
                {
                case 0:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.Plastics, 6800f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.metal_K, 1200f);
                    conditions[2] = SimpleCondition.GetStoredEnergyCondition(6100f);
                    break;

                case 1:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.Fuel, 250f);
                    conditions[1] = SimpleCondition.GetFreeWorkersCondition(700);
                    conditions[2] = SimpleCondition.GetMoneyCondition(1700f);
                    break;

                case 2:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.Concrete, 8000f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.Plastics, 8000f);
                    conditions[2] = SimpleCondition.GetCrewsCondition(2, 3);
                    break;

                case 3:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.metal_M, 5700f);
                    conditions[1] = SimpleCondition.GetShuttlesCondition(10);
                    conditions[2] = SimpleCondition.GetDummyCondition(true);
                    // 4 рейса с оборудованием
                    break;

                case 4:
                    conditions[0] = SimpleCondition.GetResourceCondition(ResourceType.Dirt, 12000f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.mineral_F, 2500f);
                    conditions[2] = SimpleCondition.GetResourceCondition(ResourceType.mineral_L, 1000f);
                    break;

                case 5:
                    conditions[0] = SimpleCondition.GetMoneyCondition(2000f);
                    conditions[1] = SimpleCondition.GetResourceCondition(ResourceType.Dirt, 1200f);
                    conditions[2] = SimpleCondition.GetGearsCondition(5f);
                    break;
                }
                //
                conditionQuest = new ConditionQuest(conditions, colony, false, QuestIcon.FoundationRouteIcon);
            }
            conditionQuest.CheckQuestConditions();
            conditionWindow = scenarioUI.ShowConditionPanel(0, conditionQuest, clickAction);
            conditionQuest.BindUIUpdateFunction(conditionWindow.Refresh);
            conditionQuest.SubscribeToUpdate(questUI);
        }
Пример #10
0
        private Condition[] ParseConditions(string prefix, string postfix = "Condition_")
        {
            Condition[] c = new Condition[asset.ReadByte(prefix + "Conditions")];

            int    num = 0;
            string text;

            while (true)
            {
                if (num >= c.Length)
                {
                    return(c);
                }

                text = $"{prefix}{postfix}{num}_Type";
                if (!asset.Has(text))
                {
                    break;
                }

                Condition_Type type        = asset.ReadEnum(text, Condition_Type.None);
                string         desc        = local?.ReadString($"{prefix}{postfix}{num}");
                bool           needToReset = asset.Has($"{prefix}{postfix}{num}_Reset");
                Logic_Type     logic       = asset.ReadEnum($"{prefix}{postfix}{num}_Logic", Logic_Type.Equal);
                string         tp          = $"{prefix}{postfix}{num}_";
                switch (type)
                {
                case Condition_Type.Kills_Tree:
                    c[num] = new ConditionKillsTree()
                    {
                        ID    = asset.ReadUInt16(tp + "ID"),
                        Tree  = asset.ReadString(tp + "Tree"),
                        Value = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Currency:
                    c[num] = new ConditionCurrency()
                    {
                        GUID  = asset.ReadString(tp + "GUID"),
                        Logic = logic,
                        Value = asset.ReadUInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Experience:
                    c[num] = new ConditionExperience()
                    {
                        Logic = logic,
                        Value = asset.ReadUInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Reputation:
                    c[num] = new ConditionReputation()
                    {
                        Logic = logic,
                        Value = asset.ReadInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Flag_Bool:
                    c[num] = new ConditionFlagBool()
                    {
                        Logic       = logic,
                        Allow_Unset = asset.Has(tp + "Allow_Unset"),
                        ID          = asset.ReadUInt16(tp + "ID"),
                        Value       = asset.ReadBoolean(tp + "Value")
                    };
                    break;

                case Condition_Type.Flag_Short:
                    c[num] = new ConditionFlagShort()
                    {
                        Logic       = logic,
                        Allow_Unset = asset.Has(tp + "Allow_Unset"),
                        ID          = asset.ReadUInt16(tp + "ID"),
                        Value       = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Quest:
                    c[num] = new ConditionQuest()
                    {
                        Logic      = logic,
                        ID         = asset.ReadUInt16(tp + "ID"),
                        Status     = asset.ReadEnum <Quest_Status>(tp + "Status"),
                        Ignore_NPC = asset.Has(tp + "Ignore_NPC")
                    };
                    break;

                case Condition_Type.Skillset:
                    c[num] = new ConditionSkillset()
                    {
                        Logic = logic,
                        Value = asset.ReadEnum <ESkillset>(tp + "Value")
                    };
                    break;

                case Condition_Type.Item:
                    c[num] = new ConditionItem()
                    {
                        ID     = asset.ReadUInt16(tp + "ID"),
                        Amount = asset.ReadUInt16(tp + "Amount")
                    };
                    break;

                case Condition_Type.Kills_Zombie:
                    c[num] = new ConditionKillsZombie()
                    {
                        ID             = asset.ReadUInt16(tp + "ID"),
                        Nav            = asset.ReadByte(tp + "Nav"),
                        Spawn          = asset.Has(tp + "Spawn"),
                        Spawn_Quantity = asset.Has(tp + "Spawn_Quantity") ? asset.ReadInt32(tp + "Spawn_Quantity") : 1,
                        Value          = asset.ReadInt16(tp + "Value"),
                        Radius         = asset.ReadSingle(tp + "Radius", 512f),
                        Zombie         = asset.ReadEnum <Zombie_Type>(tp + "Zombie")
                    };
                    break;

                case Condition_Type.Kills_Horde:
                    c[num] = new ConditionKillsHorde()
                    {
                        ID    = asset.ReadUInt16(tp + "ID"),
                        Nav   = asset.ReadByte(tp + "Nav"),
                        Value = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Kills_Animal:
                    c[num] = new ConditionKillsAnimal()
                    {
                        Animal = asset.ReadUInt16(tp + "Animal"),
                        ID     = asset.ReadUInt16(tp + "ID"),
                        Value  = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Compare_Flags:
                    c[num] = new ConditionCompareFlags()
                    {
                        Allow_A_Unset = asset.Has(tp + "Allow_A_Unset"),
                        Allow_B_Unset = asset.Has(tp + "Allow_B_Unset"),
                        A_ID          = asset.ReadUInt16(tp + "A_ID"),
                        B_ID          = asset.ReadUInt16(tp + "B_ID"),
                        Logic         = logic
                    };
                    break;

                case Condition_Type.Time_Of_Day:
                    c[num] = new ConditionTimeOfDay()
                    {
                        Logic  = logic,
                        Second = asset.ReadInt32(tp + "Second")
                    };
                    break;

                case Condition_Type.Player_Life_Health:
                    c[num] = new ConditionPlayerLifeHealth()
                    {
                        Logic = logic,
                        Value = asset.ReadInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Player_Life_Food:
                    c[num] = new ConditionPlayerLifeFood()
                    {
                        Logic = logic,
                        Value = asset.ReadInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Player_Life_Water:
                    c[num] = new ConditionPlayerLifeWater()
                    {
                        Logic = logic,
                        Value = asset.ReadInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Player_Life_Virus:
                    c[num] = new ConditionPlayerLifeVirus()
                    {
                        Logic = logic,
                        Value = asset.ReadInt32(tp + "Value")
                    };
                    break;

                case Condition_Type.Holiday:
                    c[num] = new ConditionHoliday()
                    {
                        Value = asset.ReadEnum <ENPCHoliday>(tp + "Value")
                    };
                    break;

                case Condition_Type.Kills_Player:
                    c[num] = new ConditionKillsPlayer()
                    {
                        ID    = asset.ReadUInt16(tp + "ID"),
                        Value = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Kills_Object:
                    c[num] = new ConditionKillsObject()
                    {
                        ID     = asset.ReadUInt16(tp + "ID"),
                        Nav    = asset.ReadByte(tp + "Nav"),
                        Object = asset.ReadString(tp + "Object") ?? "",
                        Value  = asset.ReadInt16(tp + "Value")
                    };
                    break;

                case Condition_Type.Weather_Blend_Alpha:
                    c[num] = new ConditionWeatherBlendAlpha()
                    {
                        GUID  = asset.ReadString(tp + "GUID"),
                        Value = asset.ReadSingle(tp + "Value")
                    };
                    break;

                case Condition_Type.Weather_Status:
                    c[num] = new ConditionWeatherStatus()
                    {
                        GUID  = asset.ReadString(tp + "GUID"),
                        Value = asset.ReadEnum(tp + "Value", ENPCWeatherStatus.Active)
                    };
                    break;
                }
                c[num].Localization = desc ?? "";
                c[num].Reset        = needToReset;
                num++;
            }
            return(c);
        }