|
- using System;
- using System.Collections.Generic;
- using SUISSEngine;
-
- public class FreeBuildingItem : IPackEffect
- {
- public FreeBuildingItem(Dictionary<string, object> props)
- {
- this.BuildingName = (string)props["BuildingName"];
- this.Amount = (int)props["Amount"];
- }
-
- public FreeBuildingItem(string buildingName, int amount)
- {
- this.BuildingName = buildingName;
- this.Amount = amount;
- }
-
- public string BuildingName { get; private set; }
-
- public int Amount { get; private set; }
-
- public void ApplyEffect()
- {
- Singleton<OngoingRewardManager>.Instance.AddReward(new FreeBuildingReward(this.BuildingName, this.Amount));
- }
-
- public static FreeBuildingItem FromStorage(Dictionary<string, object> dict)
- {
- return new FreeBuildingItem((string)dict["BuildingName"], (int)dict["Amount"]);
- }
-
- public Dictionary<string, object> ToStorage()
- {
- return new Dictionary<string, object>
- {
- {
- "BuildingName",
- this.BuildingName
- },
- {
- "Amount",
- this.Amount
- }
- };
- }
-
- private const string BuildingNameKey = "BuildingName";
-
- private const string AmountKey = "Amount";
- }
|