Commit a664bef9 authored by SherryChaos's avatar SherryChaos

lflist in ypk support

parent 6e4db9fa
...@@ -2,10 +2,11 @@ MDPro3 v1.1.3更新: ...@@ -2,10 +2,11 @@ MDPro3 v1.1.3更新:
1.现在能设置决斗开始时是否自动加速了。 1.现在能设置决斗开始时是否自动加速了。
2.现在能显示已知盖卡了,设置中可以关闭。 2.现在能显示已知盖卡了,设置中可以关闭。
3.新增 [超融合] [技能抽取] [无限泡影] [闪电风暴] [效果遮蒙者]特效。 3.新增 [超融合] [技能抽取] [无限泡影] [闪电风暴] [效果遮蒙者]特效。
4.修复SelectSum消息中,可选卡片数量为1时,点击不可选卡片会导致游戏无法继续的错误。 4.支持[Expansions]文件夹下的[lflist.conf]与*.ypk文件根目录下的[lflist.conf]禁限卡表的读取。
5.修复上版本中,更改设置中的[画面质量]导致游戏背景异常的错误。 5.修复SelectSum消息中,可选卡片数量为1时,点击不可选卡片会导致游戏无法继续的错误。
6.修复部分情况下立绘为空白的错误。 6.修复上版本中,更改设置中的[画面质量]导致游戏背景异常的错误。
7.修复弹窗确认卡片时,使用快捷键关闭弹窗时游戏无法继续的错误。 7.修复部分情况下立绘为空白的错误。
8.修复弹窗确认卡片时,使用快捷键关闭弹窗时游戏无法继续的错误。
MDPro3 v1.1.2更新: MDPro3 v1.1.2更新:
1.现在房主能在房间中添加AI进行游戏了。 1.现在房主能在房间中添加AI进行游戏了。
......
This diff is collapsed.
using System.Collections.Generic; using Ionic.Zip;
using System.Collections.Generic;
using System.IO; using System.IO;
namespace MDPro3.YGOSharp namespace MDPro3.YGOSharp
...@@ -7,11 +8,56 @@ namespace MDPro3.YGOSharp ...@@ -7,11 +8,56 @@ namespace MDPro3.YGOSharp
{ {
public static List<Banlist> Banlists { get; private set; } public static List<Banlist> Banlists { get; private set; }
public static void Initialize(string fileName) public static void Initialize()
{ {
Banlists = new List<Banlist>(); Banlists = new List<Banlist>();
StreamReader reader = null;
if (Config.GetBool("Expansions", true))
{
var confPath = Program.expansionsPath + Program.slash + "lflist.conf";
if(File.Exists(confPath))
{
reader = new StreamReader(confPath);
InitializeFromReader(reader);
reader.Close();
}
foreach (var zip in ZipHelper.zips)
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
{
if (file.ToLower().EndsWith("lflist.conf"))
{
var e = zip[file];
if (!Directory.Exists(Program.tempFolder))
Directory.CreateDirectory(Program.tempFolder);
var tempFile = Path.Combine(Path.GetFullPath(Program.tempFolder), file);
e.Extract(Path.GetFullPath(Program.tempFolder), ExtractExistingFileAction.OverwriteSilently);
reader = new StreamReader(tempFile);
InitializeFromReader(reader);
reader.Close();
File.Delete(tempFile);
}
}
}
}
Banlist current = null;
reader = new StreamReader(Program.lflistPath);
InitializeFromReader(reader);
reader.Close();
current = new Banlist();
current.Name ="N/A";
Banlists.Add(current);
Program.I().editDeck.banlist = Banlists[0];
Program.I().editDeck.SetBanlistName(Program.I().editDeck.banlist.Name);
}
public static void InitializeFromReader(StreamReader reader)
{
Banlist current = null; Banlist current = null;
StreamReader reader = new StreamReader(fileName);
while (!reader.EndOfStream) while (!reader.EndOfStream)
{ {
string line = reader.ReadLine(); string line = reader.ReadLine();
...@@ -32,20 +78,17 @@ namespace MDPro3.YGOSharp ...@@ -32,20 +78,17 @@ namespace MDPro3.YGOSharp
continue; continue;
if (current == null) if (current == null)
continue; continue;
string[] data = line.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries); string[] data = line.Split(new char[] { ' ' }, System.StringSplitOptions.RemoveEmptyEntries);
int id = int.Parse(data[0]); int id = int.Parse(data[0]);
int count = int.Parse(data[1]); int count = int.Parse(data[1]);
current.Add(id, count); current.Add(id, count);
} }
catch (System.Exception e) catch (System.Exception e)
{ {
UnityEngine.Debug.Log(line); UnityEngine.Debug.Log(line);
UnityEngine.Debug.Log(e); UnityEngine.Debug.Log(e);
} }
} }
current = new Banlist();
current.Name ="N/A";
Banlists.Add(current);
} }
public static int GetIndex(uint hash) public static int GetIndex(uint hash)
......
...@@ -36,17 +36,19 @@ namespace MDPro3 ...@@ -36,17 +36,19 @@ namespace MDPro3
var language = Config.Get("Language", "zh-CN"); var language = Config.Get("Language", "zh-CN");
var path = Program.localesPath + Program.slash + language + "/strings.conf"; var path = Program.localesPath + Program.slash + language + "/strings.conf";
var text = File.ReadAllText(path); var text = File.ReadAllText(path);
if(Config.Get("Expansions", "1") == "1") if (Config.GetBool("Expansions", true))
{ {
foreach (var conf in Directory.GetFiles("Expansions", "*.conf")) foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
text += "\r\n" + File.ReadAllText(conf); if(!conf.ToLower().EndsWith("lflist.conf"))
text += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipHelper.zips) foreach (var zip in ZipHelper.zips)
{ {
if (zip.Name.ToLower().EndsWith("script.zip")) if (zip.Name.ToLower().EndsWith("script.zip"))
continue; continue;
foreach (var file in zip.EntryFileNames) foreach (var file in zip.EntryFileNames)
{ {
if (file.ToLower().EndsWith(".conf")) if (file.ToLower().EndsWith(".conf")
&& !file.ToLower().EndsWith("lflist.conf"))
{ {
var ms = new MemoryStream(); var ms = new MemoryStream();
var e = zip[file]; var e = zip[file];
......
...@@ -94,7 +94,7 @@ namespace MDPro3 ...@@ -94,7 +94,7 @@ namespace MDPro3
Directory.CreateDirectory(dataPath); Directory.CreateDirectory(dataPath);
Config.Initialize(configPath); Config.Initialize(configPath);
items.Initialize(); items.Initialize();
BanlistManager.Initialize(lflistPath); BanlistManager.Initialize();
InitializeAllManagers(); InitializeAllManagers();
InitializeAllServants(); InitializeAllServants();
} }
...@@ -102,6 +102,7 @@ namespace MDPro3 ...@@ -102,6 +102,7 @@ namespace MDPro3
public void InitializeForDataChange() public void InitializeForDataChange()
{ {
ZipHelper.Initialize(); ZipHelper.Initialize();
BanlistManager.Initialize();
StringHelper.Initialize(); StringHelper.Initialize();
CardsManager.Initialize(); CardsManager.Initialize();
} }
......
...@@ -137,6 +137,13 @@ namespace MDPro3 ...@@ -137,6 +137,13 @@ namespace MDPro3
itemOnList = result.Result; itemOnList = result.Result;
}; };
} }
public void SetBanlistName(string listName)
{
if(manager == null)
manager = GetComponent<ElementObjectManager>();
manager.GetElement<Text>("TextBanlist").text = listName;
}
public override void Show(int preDepth) public override void Show(int preDepth)
{ {
base.Show(preDepth); base.Show(preDepth);
......
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