コード例 #1
0
    public void IncludeEvent(TownEvent townEvent)
    {
        for (int i = 0; i < townEvent.Data.Count; i++)
        {
            EventData.AddRange(townEvent.Data);

            switch (townEvent.Data[i].Type)
            {
            case TownEventDataType.ActivityCostChange:
                if (!ActivityCostModifiers.ContainsKey(townEvent.Data[i].StringData))
                {
                    ActivityCostModifiers.Add(townEvent.Data[i].StringData, 0);
                }

                ActivityCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData;
                break;

            case TownEventDataType.ActivityLock:
                if (!ActivityLocks.ContainsKey(townEvent.Data[i].StringData))
                {
                    ActivityLocks.Add(townEvent.Data[i].StringData, true);
                }
                break;

            case TownEventDataType.FreeActivity:
                if (!FreeActivities.ContainsKey(townEvent.Data[i].StringData))
                {
                    FreeActivities.Add(townEvent.Data[i].StringData, true);
                }
                break;

            case TownEventDataType.NoLevelRestriction:
                NoLevelRestrictions = true;
                break;

            case TownEventDataType.ProvisionTypeAmountChange:
                if (!ProvisionAmountModifiers.ContainsKey(townEvent.Data[i].StringData))
                {
                    ProvisionAmountModifiers.Add(townEvent.Data[i].StringData, 0);
                }

                ProvisionAmountModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData;
                break;

            case TownEventDataType.ProvisionTypeCostChange:
                if (!ProvisionCostModifiers.ContainsKey(townEvent.Data[i].StringData))
                {
                    ProvisionCostModifiers.Add(townEvent.Data[i].StringData, 0);
                }

                ProvisionCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData;
                break;

            case TownEventDataType.UpgradeTagDiscount:
                if (!UpgradeTagCostModifiers.ContainsKey(townEvent.Data[i].StringData))
                {
                    UpgradeTagCostModifiers.Add(townEvent.Data[i].StringData, 0);
                }

                UpgradeTagCostModifiers[townEvent.Data[i].StringData] += townEvent.Data[i].NumberData;
                break;

            case TownEventDataType.UpgradeTagFree:
                if (!FreeUpgradeTags.ContainsKey(townEvent.Data[i].StringData))
                {
                    FreeUpgradeTags.Add(townEvent.Data[i].StringData, 0);
                }

                FreeUpgradeTags[townEvent.Data[i].StringData] += (int)townEvent.Data[i].NumberData;
                break;

            case TownEventDataType.BonusRecruit:
                DarkestDungeonManager.Campaign.Estate.RestockBonus(townEvent.Data[i].StringData,
                                                                   (int)townEvent.Data[i].NumberData);
                break;

            case TownEventDataType.DeadRecruit:
                DarkestDungeonManager.Campaign.Estate.RestockFromGrave((int)townEvent.Data[i].NumberData);
                break;

            default:
                break;
            }
        }
    }