public GachaSet(Hashtable data = null) { this.Version = string.Empty; this.Name = string.Empty; this.AttractImages = new List <string>(); this.PossiblePrizes = new List <GachaPossiblePrize>(); this.Boxes = new List <GachaBox>(); if (data != null) { this.Version = EB.Dot.String("version", data, string.Empty); this.Name = EB.Dot.String("name", data, string.Empty); ArrayList attractsList = EB.Dot.Array("attracts", data, null); if (attractsList != null) { foreach (object candidate in attractsList) { if (candidate is string) { this.AttractImages.Add(candidate as string); } } this.AttractImages.Reverse(); } ArrayList possiblePrizesList = EB.Dot.Array("possiblePrizes", data, null); if (possiblePrizesList != null) { foreach (object candidate in possiblePrizesList) { GachaPossiblePrize possiblePrize = new GachaPossiblePrize(candidate as Hashtable); if (possiblePrize.IsValid == true) { this.PossiblePrizes.Add(possiblePrize); } } this.PossiblePrizes.Reverse(); } ArrayList boxesList = EB.Dot.Array("boxes", data, null); if (boxesList != null) { for (int i = 0; i < boxesList.Count; ++i) { GachaBox box = new GachaBox(i, boxesList[i] as Hashtable); if (box.IsValid == true) { this.Boxes.Add(box); } } } } }
public GachaBox(int index, Hashtable data = null) { this.Name = string.Empty; this.Index = index; this.Token = string.Empty; this.Image = string.Empty; this.Multiplier = 0; this.PossiblePrizes = new List <GachaPossiblePrize>(); if (data != null) { this.Name = EB.Dot.String("name", data, string.Empty); this.Token = EB.Dot.String("token", data, string.Empty); this.Image = EB.Dot.String("image", data, string.Empty); this.Multiplier = EB.Dot.Integer("multiplier", data, 0); ArrayList possiblePrizesList = EB.Dot.Array("possiblePrizes", data, null); if (possiblePrizesList != null) { foreach (object candidate in possiblePrizesList) { GachaPossiblePrize possiblePrize = new GachaPossiblePrize(candidate as Hashtable); if (possiblePrize.IsValid == true) { this.PossiblePrizes.Add(possiblePrize); } } } this.SoftCurrency = new GachaBoxSpendInfo(EB.Dot.Object("sc", data, null)); this.HardCurrency = new GachaBoxSpendInfo(EB.Dot.Object("hc", data, null)); this.Tokens = new GachaBoxSpendInfo(EB.Dot.Object("tokenc", data, null)); } else { this.SoftCurrency = new GachaBoxSpendInfo(); this.HardCurrency = new GachaBoxSpendInfo(); this.Tokens = new GachaBoxSpendInfo(); } }