Commit 50ea2be5 authored by nanahira's avatar nanahira

expansions replace

parent a019cfc9
......@@ -409,7 +409,7 @@ public class Program : MonoBehaviour
{
if (fileInfos[i].Name.Substring(fileInfos[i].Name.Length - 4, 4) == ".cdb")
{
YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name);
YGOSharp.CardsManager.initialize("expansions/" + fileInfos[i].Name, false, true);
}
}
}
......
......@@ -16,7 +16,7 @@ namespace YGOSharp
public static string nullString = "";
internal static bool initialize(string databaseFullPath, bool test = false)
internal static bool initialize(string databaseFullPath, bool test = false, bool replace = false)
{
if(!test) {
nullName = InterString.Get("未知卡片");
......@@ -41,7 +41,7 @@ namespace YGOSharp
{
while (reader.Read())
{
LoadCard(reader, test);
LoadCard(reader, test, replace);
}
}
}
......@@ -88,11 +88,20 @@ namespace YGOSharp
return returnValue;
}
private static void LoadCard(IDataRecord reader, bool test = false)
private static void LoadCard(IDataRecord reader, bool test = false, bool replace = false)
{
Card card = new Card(reader);
if (!_cards.ContainsKey(card.Id) && !test)
if (test)
{
return;
}
if (!_cards.ContainsKey(card.Id))
{
_cards.Add(card.Id, card);
}
else if (replace)
{
_cards.Remove(card.Id);
_cards.Add(card.Id, card);
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment