Example #1
0
 public void SetLineup(Lineup newLineup, bool isCopy = false)
 {
     ResetLineup(isCopy);
     lineup.lineupName = newLineup.lineupName;
     inputField.text   = newLineup.lineupName;
     lineup.boardName  = newLineup.boardName;
     if (isCopy)
     {
         foreach (Tactic tactic in newLineup.tactics)
         {
             if (collectionManager.RemoveCollection(new Collection(tactic)))
             {
                 AddTactic(tactic);
             }
             // can add virtual card like hearthstore
         }
         foreach (KeyValuePair <Location, Collection> pair in newLineup.cardLocations)
         {
             Collection collection = pair.Value;
             if (!collectionManager.RemoveCollection(collection) ||
                 !collectionManager.RemoveCollection(new Collection(collection.name, collection.type))) //find card with the same name
             {
                 Collection standardCollection = Collection.StandardCollection(collection.type);
                 boardInfo.cardLocations[pair.Key] = standardCollection;
                 lineup.cardLocations[pair.Key]    = standardCollection;
             }
             else
             {
                 boardInfo.cardLocations[pair.Key] = newLineup.cardLocations[pair.Key];
                 lineup.cardLocations[pair.Key]    = newLineup.cardLocations[pair.Key];
             }
         }
     }
     else
     {
         foreach (Tactic tactic in newLineup.tactics)
         {
             AddTactic(tactic);
         }
         boardInfo.cardLocations = newLineup.cardLocations;
         lineup.cardLocations    = newLineup.cardLocations;
     }
     boardInfo.SetAttributes(newLineup.boardName, boardInfo.cardLocations);
     SetTexts();
 }