using System.Collections.Generic; using Wizard.RoomMatch; namespace Wizard; public class GatheringEntrySetting { public GatheringRule Rule { get; private set; } public List DeckList { get; set; } public GatheringEntrySetting(GatheringRule rule) { Rule = rule; int num = RoomConnectController.RuleSelectDeckCount(rule.BattleParameterInstance.Rule); DeckList = new List(); for (int i = 0; i < num; i++) { DeckData deckData = new DeckData(rule.BattleParameterInstance.DeckFormat); deckData.SetDeckID(i + 1); DeckList.Add(deckData); } } public DeckData GetDeck(int deckId) { return DeckList.Find((DeckData deck) => deck.GetDeckID() == deckId); } public void RemoveDeck(int deckId) { List deckList = DeckList; int count = deckList.Count; Format format = deckList[0].Format; DeckList = new List(); for (int i = 0; i < count; i++) { if (deckList[i].GetDeckID() == deckId) { DeckData deckData = new DeckData(format); deckData.SetDeckID(deckId); DeckList.Add(deckData); } else { DeckList.Add(deckList[i]); } } } public void DeckOrderChange(List order) { List deckList = DeckList; int count = deckList.Count; DeckList = new List(); foreach (int deckId in order) { int index = deckList.FindIndex((DeckData d) => d.GetDeckID() == deckId); DeckList.Add(deckList[index]); deckList.RemoveAt(index); } foreach (DeckData item in deckList) { DeckList.Add(item); } for (int num = 0; num < count; num++) { DeckList[num].SetDeckID(num + 1); } } public bool IsEntryDeckOk() { foreach (DeckData deck in DeckList) { if (deck.IsNoCard()) { return false; } if (!deck.GetDeckIsComplete()) { return false; } } return true; } }