Commit 30b37364 authored by SherryChaos's avatar SherryChaos

new functions & bug fixing

parent b8c1fcc7
...@@ -48,6 +48,7 @@ CardGenerated/ ...@@ -48,6 +48,7 @@ CardGenerated/
[Rr]eplay/ [Rr]eplay/
StandaloneWindows64/ StandaloneWindows64/
Tools/ Tools/
TempFolder/
Assets/Addressables/ Assets/Addressables/
Assets/Fonts/ Assets/Fonts/
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -88,11 +88,11 @@ namespace MDPro3 ...@@ -88,11 +88,11 @@ namespace MDPro3
} }
void LoadNames() void LoadNames()
{ {
LoadData(0, "Data/locales/" + language + "/IDS_ITEM.bytes"); LoadData(0, Program.localesPath + Program.slash + language + "/IDS_ITEM.bytes");
} }
void LoadDescriptions() void LoadDescriptions()
{ {
LoadData(1, "Data/locales/" + language + "/IDS_ITEMDESC.bytes"); LoadData(1, Program.localesPath + Program.slash + language + "/IDS_ITEMDESC.bytes");
} }
void LoadData(int type, string path) void LoadData(int type, string path)
{ {
...@@ -170,15 +170,49 @@ namespace MDPro3 ...@@ -170,15 +170,49 @@ namespace MDPro3
} }
return returnValue; return returnValue;
} }
public string CodeToPath(string code) public string CodeToPath(string code, ItemType type)
{ {
string returnValue = ""; string returnValue = "";
foreach (var kind in kinds) foreach (var kind in kinds)
foreach (var item in kind) foreach (var item in kind)
if (item.id.ToString() == code) if (item.id.ToString() == code)
return item.path; return item.path;
switch (type)
{
case ItemType.Wallpaper:
return wallpapers[0].path;
case ItemType.Face:
return faces[0].path;
case ItemType.Frame:
return frames[0].path;
case ItemType.Protector:
return protectors[0].path;
case ItemType.Mat:
return mats[0].path;
case ItemType.Grave:
return graves[0].path;
case ItemType.Stand:
return stands[0].path;
case ItemType.Mate:
return mates[0].path;
case ItemType.Case:
return cases[0].path;
default:
return mats[0].path;
}
}
return returnValue; public enum ItemType
{
Wallpaper,
Face,
Frame,
Protector,
Mat,
Grave,
Stand,
Mate,
Case
} }
} }
} }
...@@ -62,20 +62,20 @@ namespace MDPro3 ...@@ -62,20 +62,20 @@ namespace MDPro3
if (totalNum == 0) if (totalNum == 0)
text.text = title + dots; text.text = title + dots;
else else
text.text = title + "(" + nowNum + "/" + totalNum + ")"; text.text = title + "(" + nowNum + Program.slash + totalNum + ")";
} }
bool InitializeLanguage() bool InitializeLanguage()
{ {
if (!Directory.Exists("Data")) if (!Directory.Exists(Program.dataPath))
{ {
Directory.CreateDirectory("Data"); Directory.CreateDirectory(Program.dataPath);
Config.Initialize("Data/config.conf"); Config.Initialize(Program.configPath);
return true; return true;
} }
else else
{ {
Config.Initialize("Data/config.conf"); Config.Initialize(Program.configPath);
if(Config.Get("Version", "Version") == "Version") if(Config.Get("Version", "Version") == "Version")
return true; return true;
InterString.Initialize(); InterString.Initialize();
...@@ -109,7 +109,7 @@ namespace MDPro3 ...@@ -109,7 +109,7 @@ namespace MDPro3
nowNum = 0; nowNum = 0;
totalNum = 0; totalNum = 0;
string filePath = Application.streamingAssetsPath + "/" + type + ".zip"; string filePath = Application.streamingAssetsPath + Program.slash + type + ".zip";
var www = new WWW(filePath); var www = new WWW(filePath);
while (!www.isDone) while (!www.isDone)
{ {
...@@ -134,7 +134,7 @@ namespace MDPro3 ...@@ -134,7 +134,7 @@ namespace MDPro3
IEnumerator LoadMainSceneAsync() IEnumerator LoadMainSceneAsync()
{ {
Config.Initialize("Data/config.conf"); Config.Initialize(Program.configPath);
Config.Set("Version", Application.version.Substring(0, 5)); Config.Set("Version", Application.version.Substring(0, 5));
Config.Save(); Config.Save();
var ini = Addressables.InitializeAsync(); var ini = Addressables.InitializeAsync();
...@@ -223,7 +223,7 @@ namespace MDPro3 ...@@ -223,7 +223,7 @@ namespace MDPro3
if(installVersion.Length > 5 || !installVersion.EndsWith("0")) if(installVersion.Length > 5 || !installVersion.EndsWith("0"))
{ {
title = "不能直接安装更新包。Can not install update apk directly."; title = "不能直接安装更新包。Can not install update apk directly.";
Directory.Delete("Data"); Directory.Delete(Program.dataPath);
return false; return false;
} }
else else
......
...@@ -40,6 +40,8 @@ namespace MDPro3 ...@@ -40,6 +40,8 @@ namespace MDPro3
public Font atkDef; public Font atkDef;
public RenderTexture renderTexture; public RenderTexture renderTexture;
static readonly string bigSlash = "/";
public void SwitchLanguage() public void SwitchLanguage()
{ {
//cardDescription //cardDescription
...@@ -256,7 +258,7 @@ namespace MDPro3 ...@@ -256,7 +258,7 @@ namespace MDPro3
cardArtPendulum.texture = art; cardArtPendulum.texture = art;
} }
var pendulumDescription = CardDescription.GetCardDescriptionSplit(data.Desc); var pendulumDescription = CardDescription.GetCardDescriptionSplit(data.Desc);
cardDescription.text = StringHelper.GetType(data).Replace("/", "/") + "\r\n" + TextForRender(pendulumDescription[1]); cardDescription.text = StringHelper.GetType(data).Replace(Program.slash, bigSlash) + "\r\n" + TextForRender(pendulumDescription[1]);
cardDescriptionPendulum.text = TextForRender(pendulumDescription[0]); cardDescriptionPendulum.text = TextForRender(pendulumDescription[0]);
lScale.text = data.LScale.ToString(); lScale.text = data.LScale.ToString();
rScale.text = data.RScale.ToString(); rScale.text = data.RScale.ToString();
...@@ -279,7 +281,7 @@ namespace MDPro3 ...@@ -279,7 +281,7 @@ namespace MDPro3
cardArt.texture = art; cardArt.texture = art;
var description = ""; var description = "";
if ((data.Type & (uint)CardType.Monster) > 0) if ((data.Type & (uint)CardType.Monster) > 0)
description = StringHelper.GetType(data).Replace("/", "/") + "\r\n"; description = StringHelper.GetType(data).Replace(Program.slash, bigSlash) + "\r\n";
description += TextForRender(data.Desc); description += TextForRender(data.Desc);
cardDescription.text = description; cardDescription.text = description;
...@@ -519,7 +521,7 @@ namespace MDPro3 ...@@ -519,7 +521,7 @@ namespace MDPro3
.Replace("\n⑨", "⑨"); .Replace("\n⑨", "⑨");
} }
description = description.Replace("/", "/"); description = description.Replace(Program.slash, bigSlash);
if (language != "en-US" && language != "es-ES") if (language != "en-US" && language != "es-ES")
description = description.Replace(" ", "\u00A0"); description = description.Replace(" ", "\u00A0");
......
...@@ -151,18 +151,16 @@ namespace MDPro3 ...@@ -151,18 +151,16 @@ namespace MDPro3
manager.GetElement<Image>("Limit").sprite = TextureManager.container.banned; manager.GetElement<Image>("Limit").sprite = TextureManager.container.banned;
} }
readonly string savePath = "CardGenerated";
public void GenerateCard() public void GenerateCard()
{ {
if (!Directory.Exists(savePath)) if (!Directory.Exists(Program.cardPicPath))
Directory.CreateDirectory(savePath); Directory.CreateDirectory(Program.cardPicPath);
Texture2D texture = (Texture2D)manager.GetElement<RawImage>("Card").material.mainTexture;
var picture = texture.EncodeToPNG();
var fullPath = savePath + "/" + code + ".png";
try try
{ {
File.WriteAllBytes(savePath + "/" + code + ".png", picture); Texture2D texture = (Texture2D)manager.GetElement<RawImage>("Card").texture;
var picture = texture.EncodeToPNG();
var fullPath = Program.cardPicPath + Program.slash + code + ".png";
File.WriteAllBytes(Program.cardPicPath + Program.slash + code + ".png", picture);
MessageManager.Cast(InterString.Get("卡图已保存于:[?]", fullPath)); MessageManager.Cast(InterString.Get("卡图已保存于:[?]", fullPath));
} }
catch catch
......
...@@ -341,11 +341,17 @@ namespace MDPro3 ...@@ -341,11 +341,17 @@ namespace MDPro3
StartCoroutine(SetFace()); StartCoroutine(SetFace());
RefreshLabel(); RefreshLabel();
} }
if(d.Id > 0)
if ((p.location & (uint)CardLocation.Extra) > 0)
if ((p.position & (uint)CardPosition.FaceUp) > 0)
if (p.sequence == Program.I().ocgcore.GetLocationCardCount(CardLocation.Extra, p.controller) - 1)
StartCoroutine(Program.I().ocgcore.UpdateDeckTop(p.controller, this));
} }
public void SetCode(int code) public void SetCode(int code)
{ {
if (code > 0) if (code > 0)
{
if (data.Id != code) if (data.Id != code)
{ {
SetData(CardsManager.Get(code)); SetData(CardsManager.Get(code));
...@@ -355,6 +361,7 @@ namespace MDPro3 ...@@ -355,6 +361,7 @@ namespace MDPro3
if (!Program.I().ocgcore.sideReference.Main.Contains(code)) if (!Program.I().ocgcore.sideReference.Main.Contains(code))
Program.I().ocgcore.sideReference.Main.Add(code); Program.I().ocgcore.sideReference.Main.Add(code);
} }
}
} }
public void RefreshData() public void RefreshData()
...@@ -1018,6 +1025,9 @@ namespace MDPro3 ...@@ -1018,6 +1025,9 @@ namespace MDPro3
main.startColor = Color.red; main.startColor = Color.red;
} }
if((p.location & (uint)CardLocation.Extra) > 0
&& (p.location & (uint)CardLocation.Overlay) == 0)
Program.I().ocgcore.SetDeckTop(this);
Destroy(model); Destroy(model);
Destroy(fx, 2); Destroy(fx, 2);
OcgCore.messagePass = true; OcgCore.messagePass = true;
...@@ -1144,7 +1154,13 @@ namespace MDPro3 ...@@ -1144,7 +1154,13 @@ namespace MDPro3
var turn = manager.GetElement<Transform>("Turn"); var turn = manager.GetElement<Transform>("Turn");
//翋极痄雄 //翋极痄雄
sequence.Append(model.transform.DOLocalMove(position, moveTime)); sequence.Append(model.transform.DOLocalMove(position, moveTime).OnStart(() =>
{
if ((cacheP.location & (uint)CardLocation.Extra) > 0
&& (p.location & (uint)CardLocation.Extra) == 0
&& cacheP.sequence == Program.I().ocgcore.GetLocationCardCount(CardLocation.Extra, cacheP.controller) - 1)
StartCoroutine(Program.I().ocgcore.UpdateDeckTop(cacheP.controller));
}));
sequence.Join(pivot.DOScale(GetCardScale(p), moveTime * 0.95f)); sequence.Join(pivot.DOScale(GetCardScale(p), moveTime * 0.95f));
//Turn //Turn
if ((p.location & (uint)CardLocation.Removed) > 0 if ((p.location & (uint)CardLocation.Removed) > 0
...@@ -1218,6 +1234,9 @@ namespace MDPro3 ...@@ -1218,6 +1234,9 @@ namespace MDPro3
inAnimation = false; inAnimation = false;
if ((p.location & ((uint)CardLocation.Grave + (uint)CardLocation.Removed)) == 0) if ((p.location & ((uint)CardLocation.Grave + (uint)CardLocation.Removed)) == 0)
OcgCore.messagePass = true; OcgCore.messagePass = true;
if((p.location & (uint)CardLocation.Extra) > 0
&& (cacheP.location & (uint)CardLocation.Extra) == 0)
Program.I().ocgcore.SetDeckTop(this);
}); });
SummonPass: SummonPass:
...@@ -1266,7 +1285,13 @@ namespace MDPro3 ...@@ -1266,7 +1285,13 @@ namespace MDPro3
void SequenceStrongSummon(Sequence sequence, Vector3 position, Vector3 angle, float interval, float timeBefore = 0) void SequenceStrongSummon(Sequence sequence, Vector3 position, Vector3 angle, float interval, float timeBefore = 0)
{ {
sequence.AppendInterval(interval); sequence.AppendInterval(interval);
sequence.Append(manager.transform.DOMove(position, 0.2f)); sequence.Append(manager.transform.DOMove(position, 0.2f).OnStart(() =>
{
if ((cacheP.location & (uint)CardLocation.Extra) > 0
&& (p.location & (uint)CardLocation.Extra) == 0
&& cacheP.sequence == Program.I().ocgcore.GetLocationCardCount(CardLocation.Extra, cacheP.controller))
StartCoroutine(Program.I().ocgcore.UpdateDeckTop(cacheP.controller));
}));
sequence.Join(manager.transform.DOLocalRotate(Vector3.zero, 0.1f)); sequence.Join(manager.transform.DOLocalRotate(Vector3.zero, 0.1f));
sequence.Join(manager.GetElement<Transform>("CardPlane").DOLocalRotate(new Vector3(0, (angle.y == 0) || (angle.y == 270) ? 0 : 180, 0), 0.2f)); sequence.Join(manager.GetElement<Transform>("CardPlane").DOLocalRotate(new Vector3(0, (angle.y == 0) || (angle.y == 270) ? 0 : 180, 0), 0.2f));
sequence.Join(manager.GetElement<Transform>("Turn").DOLocalRotate(new Vector3(0, (angle.y == 0) || (angle.y == 180) ? 0 : 270, angle.z), 0.2f)); sequence.Join(manager.GetElement<Transform>("Turn").DOLocalRotate(new Vector3(0, (angle.y == 0) || (angle.y == 180) ? 0 : 270, angle.z), 0.2f));
......
...@@ -25,14 +25,14 @@ namespace MDPro3.YGOSharp ...@@ -25,14 +25,14 @@ namespace MDPro3.YGOSharp
nullString = string.Empty; nullString = string.Empty;
; ;
string language = Config.Get("Language", "zh-CN"); string language = Config.Get("Language", "zh-CN");
string databaseFullPath = "data/locales/" + language + "/cards.cdb"; string databaseFullPath = Program.localesPath + Program.slash + language + "/cards.cdb";
if (!File.Exists(databaseFullPath)) if (!File.Exists(databaseFullPath))
databaseFullPath = "data/locales/zh-CN/cards.cdb"; databaseFullPath = Program.localesPath + Program.slash + "zh-CN/cards.cdb";
_cards.Clear(); _cards.Clear();
LoadCDB(databaseFullPath); LoadCDB(databaseFullPath);
foreach(var cdb in Directory.GetFiles("Expansions", "*.cdb")) foreach(var cdb in Directory.GetFiles("Expansions", "*.cdb"))
LoadCDB(cdb); LoadCDB(cdb);
foreach(var zip in ZipManager.zips) foreach(var zip in ZipHelper.zips)
{ {
if (zip.Name.ToLower().EndsWith("script.zip")) if (zip.Name.ToLower().EndsWith("script.zip"))
continue; continue;
...@@ -41,8 +41,10 @@ namespace MDPro3.YGOSharp ...@@ -41,8 +41,10 @@ namespace MDPro3.YGOSharp
if (file.ToLower().EndsWith(".cdb")) if (file.ToLower().EndsWith(".cdb"))
{ {
var e = zip[file]; var e = zip[file];
var tempFile = Path.Combine(Path.GetTempPath(), file); if (!Directory.Exists(Program.tempFolder))
e.Extract(Path.GetTempPath(), ExtractExistingFileAction.OverwriteSilently); Directory.CreateDirectory(Program.tempFolder);
var tempFile = Path.Combine(Path.GetFullPath(Program.tempFolder), file);
e.Extract(Path.GetFullPath(Program.tempFolder), ExtractExistingFileAction.OverwriteSilently);
LoadCDB(tempFile); LoadCDB(tempFile);
File.Delete(tempFile); File.Delete(tempFile);
} }
...@@ -1949,7 +1951,7 @@ namespace MDPro3.YGOSharp ...@@ -1949,7 +1951,7 @@ namespace MDPro3.YGOSharp
static Dictionary<string, string> pacDic = new Dictionary<string, string>(); static Dictionary<string, string> pacDic = new Dictionary<string, string>();
static string path = "data/pack"; static string path = "Data/pack";
internal static void Initialize() internal static void Initialize()
{ {
...@@ -1958,7 +1960,7 @@ namespace MDPro3.YGOSharp ...@@ -1958,7 +1960,7 @@ namespace MDPro3.YGOSharp
var fileInfos = new DirectoryInfo(path).GetFiles(); var fileInfos = new DirectoryInfo(path).GetFiles();
foreach (var file in fileInfos) foreach (var file in fileInfos)
if (file.Name.ToLower().EndsWith(".db")) if (file.Name.ToLower().EndsWith(".db"))
LoadDataBase(path + "/" + file.Name); LoadDataBase(path + Program.slash + file.Name);
InitializeSec(); InitializeSec();
} }
} }
......
...@@ -71,7 +71,7 @@ namespace MDPro3 ...@@ -71,7 +71,7 @@ namespace MDPro3
} }
else else
{ {
foreach (var zip in ZipManager.zips) foreach (var zip in ZipHelper.zips)
if (zip.ContainsEntry(fileName2)) if (zip.ContainsEntry(fileName2))
{ {
var ms = new MemoryStream(); var ms = new MemoryStream();
......
...@@ -15,7 +15,7 @@ namespace MDPro3 ...@@ -15,7 +15,7 @@ namespace MDPro3
{ {
public static TcpClient tcpClient; public static TcpClient tcpClient;
private static NetworkStream networkStream; private static NetworkStream networkStream;
private static bool canJoin = true; public static bool canJoin = true;
public static bool onDisConnected; public static bool onDisConnected;
private static readonly List<byte[]> datas = new List<byte[]>(); private static readonly List<byte[]> datas = new List<byte[]>();
private static readonly object locker = new object(); private static readonly object locker = new object();
......
fileFormatVersion: 2
guid: a588901f0fbed654f89ebcb7ecdb5471
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:
...@@ -195,9 +195,9 @@ namespace MDPro3 ...@@ -195,9 +195,9 @@ namespace MDPro3
while (loadingPMat) while (loadingPMat)
yield return null; yield return null;
loadingPMat = true; loadingPMat = true;
if (File.Exists(Program.root + "Protector/" + code + "/" + code)) if (File.Exists(Program.root + "Protector/" + code + Program.slash + code))
{ {
var abr = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/" + code); var abr = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + Program.slash + code);
while (!abr.isDone) while (!abr.isDone)
yield return null; yield return null;
var abmr = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/PMat"); var abmr = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/PMat");
...@@ -212,20 +212,20 @@ namespace MDPro3 ...@@ -212,20 +212,20 @@ namespace MDPro3
} }
else else
{ {
var ab1r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/" + code + "_1"); var ab1r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + Program.slash + code + "_1");
while (!ab1r.isDone) while (!ab1r.isDone)
yield return null; yield return null;
var ab1 = ab1r.assetBundle; var ab1 = ab1r.assetBundle;
var ab2r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/" + code + "_2"); var ab2r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + Program.slash + code + "_2");
while (!ab2r.isDone) while (!ab2r.isDone)
yield return null; yield return null;
var ab2 = ab2r.assetBundle; var ab2 = ab2r.assetBundle;
AssetBundle ab3 = null; AssetBundle ab3 = null;
if (File.Exists(Program.root + "Protector/" + code + "/" + code + "_3")) if (File.Exists(Program.root + "Protector/" + code + Program.slash + code + "_3"))
{ {
var ab3r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + "/" + code + "_3"); var ab3r = AssetBundle.LoadFromFileAsync(Program.root + "Protector/" + code + Program.slash + code + "_3");
while (!ab3r.isDone) while (!ab3r.isDone)
yield return null; yield return null;
ab3 = ab3r.assetBundle; ab3 = ab3r.assetBundle;
...@@ -274,7 +274,7 @@ namespace MDPro3 ...@@ -274,7 +274,7 @@ namespace MDPro3
} }
} }
Mate.MateType type = Mate.MateType.MasterDuel; Mate.MateType type = Mate.MateType.MasterDuel;
if (item.id == 0) if (item.id == 0 && File.Exists(Program.root + "CrossDuel/" + code + ".bundle"))
type = Mate.MateType.CrossDuel; type = Mate.MateType.CrossDuel;
Mate returnValue = null; Mate returnValue = null;
if (type == Mate.MateType.CrossDuel) if (type == Mate.MateType.CrossDuel)
...@@ -326,7 +326,7 @@ namespace MDPro3 ...@@ -326,7 +326,7 @@ namespace MDPro3
} }
else else
{ {
var ie = LoadFromFileAsync(Program.items.CodeToPath(code.ToString())); var ie = LoadFromFileAsync(Program.items.CodeToPath(code.ToString(), Items.ItemType.Mate));
while (ie.MoveNext()) while (ie.MoveNext())
yield return null; yield return null;
var mateGo = ie.Current; var mateGo = ie.Current;
......
...@@ -13,7 +13,7 @@ namespace MDPro3 ...@@ -13,7 +13,7 @@ namespace MDPro3
public static void Initialize() public static void Initialize()
{ {
string language = Config.Get("Language", "zh-CN"); string language = Config.Get("Language", "zh-CN");
path = "data/locales/" + language + "/translation.conf"; path = Program.localesPath + Program.slash + language + "/translation.conf";
if (!File.Exists(path)) if (!File.Exists(path))
File.Create(path).Close(); File.Create(path).Close();
......
using System.Collections.Generic;
using System.IO;
using System.Linq;
using SFB;
namespace MDPro3
{
public class PortHelper
{
public static void ImportFiles()
{
#if UNITY_ANDROID && !UNITY_EDITOR
NativeFilePicker.PickMultipleFiles(MoveFilesToGame, null);
#else
ChooseFiles();
#endif
}
public static void ExportAllDecks()
{
if(!Directory.Exists(Program.deckPath))
Directory.CreateDirectory(Program.deckPath);
var filePaths = Directory.GetFiles(Program.deckPath);
Export(filePaths);
}
public static void ExportAllReplays()
{
if (!Directory.Exists(Program.replayPath))
Directory.CreateDirectory(Program.replayPath);
var filePaths = Directory.GetFiles(Program.replayPath);
Export(filePaths);
}
public static void ExportAllPictures()
{
if (!Directory.Exists(Program.cardPicPath))
Directory.CreateDirectory(Program.cardPicPath);
var filePaths = Directory.GetFiles(Program.cardPicPath);
Export(filePaths);
}
static void Export(string[] filePaths)
{
#if UNITY_ANDROID && !UNITY_EDITOR
NativeFilePicker.ExportMultipleFiles(filePaths, ExportResult);
#else
StandaloneFileBrowser.OpenFolderPanelAsync("请选择导出目录", "", false, (string[] paths) =>
{
ExportFiles(paths, filePaths);
});
//var config = new FolderDialogConfiguration
//{
// Title = InterString.Get("请选择导出目录"),
//};
//var result = FileBrowser.FileBrowserService.OpenFolderDialog(config);
//ExportFiles(result, filePaths);
#endif
}
private static void ExportFiles(string[] result, string[] filePaths)
{
try
{
foreach(var file in filePaths)
File.Copy(file, Path.Combine(result.FirstOrDefault(), Path.GetFileName(file)));
ExportResult(true);
}
catch
{
ExportResult(false);
}
}
static void ChooseFiles()
{
//var config = new FileDialogConfiguration
//{
// Title = InterString.Get("请选择需要导入的文件"),
// FileDialogType = FileBrowser.FileDialogType.Open,
// Multiselect = true,
// ExtensionFilters = new[]
// {
// new ExtensionFilter(InterString.Get("所有文件"), "*"),
// new ExtensionFilter(InterString.Get("卡组码文件"), "ydk"),
// new ExtensionFilter(InterString.Get("回放文件"), "yrp", "yrp3d"),
// new ExtensionFilter(InterString.Get("扩展卡文件"), "ypk"),
// new ExtensionFilter(InterString.Get("数据库文件"), "cdb"),
// new ExtensionFilter(InterString.Get("字段文件"), "conf"),
// new ExtensionFilter(InterString.Get("图片文件"), "png", "jpg")
// }
//};
//var result = FileBrowser.FileBrowserService.OpenFileDialog(config);
//CopyFilesToGame(result);
var extensions = new[]
{
new ExtensionFilter(InterString.Get("所有文件"), "*"),
new ExtensionFilter(InterString.Get("卡组码文件"), "ydk"),
new ExtensionFilter(InterString.Get("回放文件"), "yrp", "yrp3d"),
new ExtensionFilter(InterString.Get("扩展卡文件"), "ypk"),
new ExtensionFilter(InterString.Get("数据库文件"), "cdb"),
new ExtensionFilter(InterString.Get("字段文件"), "conf"),
new ExtensionFilter(InterString.Get("图片文件"), "png", "jpg")
};
StandaloneFileBrowser.OpenFilePanelAsync(InterString.Get("请选择需要导入的文件"), "", extensions, true, (string[] paths) =>
{
CopyFilesToGame(paths);
});
}
static void CopyFilesToGame(IEnumerable<string> files)
{
bool newDataAdded = false;
foreach (string path in files)
{
try
{
if (path.ToLower().EndsWith(".ydk"))
File.Copy(path, Program.deckPath + Program.slash + Path.GetFileName(path), true);
if (path.ToLower().EndsWith(".yrp") || path.ToLower().EndsWith(".yrp3d"))
File.Copy(path, Program.replayPath + Program.slash + Path.GetFileName(path), true);
if (path.ToLower().EndsWith(".ypk") || path.ToLower().EndsWith(".zip") || path.ToLower().EndsWith(".cdb") || path.ToLower().EndsWith(".conf"))
{
File.Copy(path, Program.expansionsPath + Program.slash + Path.GetFileName(path), true);
newDataAdded = true;
}
if (path.ToLower().EndsWith(".png") || path.ToLower().EndsWith(".jpg") || path.ToLower().EndsWith(".jpeg"))
File.Copy(path, Program.altArtPath + Program.slash + Path.GetFileName(path), true);
}
catch { }
}
if (newDataAdded)
Program.I().InitializeForDataChange();
}
static void MoveFilesToGame(string[] files)
{
bool newDataAdded = false;
foreach (string path in files)
{
try
{
if (path.ToLower().EndsWith(".ydk"))
File.Move(path, Program.deckPath + Program.slash + Path.GetFileName(path));
if (path.ToLower().EndsWith(".yrp") || path.ToLower().EndsWith(".yrp3d"))
File.Move(path, Program.replayPath + Program.slash + Path.GetFileName(path));
if (path.ToLower().EndsWith(".ypk") || path.ToLower().EndsWith(".zip") || path.ToLower().EndsWith(".cdb") || path.ToLower().EndsWith(".conf"))
{
File.Move(path, Program.expansionsPath + Program.slash + Path.GetFileName(path));
newDataAdded = true;
}
if (path.ToLower().EndsWith(".png") || path.ToLower().EndsWith(".jpg") || path.ToLower().EndsWith(".jpeg"))
File.Move(path, Program.altArtPath + Program.slash + Path.GetFileName(path));
}
catch { }
}
if (newDataAdded)
Program.I().InitializeForDataChange();
}
static void ExportResult(bool sucess)
{
if (sucess)
MessageManager.Cast(InterString.Get("导出成功。"));
else
MessageManager.Cast(InterString.Get("导出失败。"));
}
}
}
fileFormatVersion: 2
guid: b99a6acfea0bb444a825a5dec29a2b12
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -34,11 +34,11 @@ namespace MDPro3 ...@@ -34,11 +34,11 @@ namespace MDPro3
public static void Initialize() public static void Initialize()
{ {
var language = Config.Get("Language", "zh-CN"); var language = Config.Get("Language", "zh-CN");
var path = "data/locales/" + language + "/strings.conf"; var path = Program.localesPath + Program.slash + language + "/strings.conf";
var text = File.ReadAllText(path); var text = File.ReadAllText(path);
foreach (var conf in Directory.GetFiles("Expansions", "*.conf")) foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
text += "\r\n" + File.ReadAllText(conf); text += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipManager.zips) foreach (var zip in ZipHelper.zips)
{ {
if (zip.Name.ToLower().EndsWith("script.zip")) if (zip.Name.ToLower().EndsWith("script.zip"))
continue; continue;
...@@ -179,7 +179,7 @@ namespace MDPro3 ...@@ -179,7 +179,7 @@ namespace MDPro3
for (int i = 0; i < 7; i++) for (int i = 0; i < 7; i++)
if ((attribute & (1u << i)) > 0) if ((attribute & (1u << i)) > 0)
{ {
if (passFirst) r += "/"; if (passFirst) r += Program.slash;
r += GetUnsafe(1010 + i); r += GetUnsafe(1010 + i);
passFirst = true; passFirst = true;
} }
...@@ -192,7 +192,7 @@ namespace MDPro3 ...@@ -192,7 +192,7 @@ namespace MDPro3
for (var i = 0; i < 26; i++) for (var i = 0; i < 26; i++)
if ((race & (1 << i)) > 0) if ((race & (1 << i)) > 0)
{ {
if (passFirst) r += "/"; if (passFirst) r += Program.slash;
r += GetUnsafe(1020 + i); r += GetUnsafe(1020 + i);
passFirst = true; passFirst = true;
} }
...@@ -261,7 +261,7 @@ namespace MDPro3 ...@@ -261,7 +261,7 @@ namespace MDPro3
for (var i = 0; i < 3; i++) for (var i = 0; i < 3; i++)
if ((a & (1 << i)) > 0) if ((a & (1 << i)) > 0)
{ {
if (passFirst) r += "/"; if (passFirst) r += Program.slash;
r += GetUnsafe(1050 + i); r += GetUnsafe(1050 + i);
passFirst = true; passFirst = true;
} }
...@@ -277,14 +277,14 @@ namespace MDPro3 ...@@ -277,14 +277,14 @@ namespace MDPro3
for (var i = 4; i < 27; i++) for (var i = 4; i < 27; i++)
if (((a & 0x68020C0) & (1 << i)) > 0) if (((a & 0x68020C0) & (1 << i)) > 0)
{ {
start += "/" + GetUnsafe(1050 + i); start += Program.slash + GetUnsafe(1050 + i);
break; break;
} }
a -= a & 0x68020C0; a -= a & 0x68020C0;
} }
if ((a & (long)CardType.Pendulum) > 0) if ((a & (long)CardType.Pendulum) > 0)
{ {
start += "/" + GetUnsafe(1074); start += Program.slash + GetUnsafe(1074);
a -= (long)CardType.Pendulum; a -= (long)CardType.Pendulum;
} }
if ((a & 0x30) > 0) if ((a & 0x30) > 0)
...@@ -292,14 +292,14 @@ namespace MDPro3 ...@@ -292,14 +292,14 @@ namespace MDPro3
for (var i = 4; i < 6; i++) for (var i = 4; i < 6; i++)
if ((a & (1 << i)) > 0) if ((a & (1 << i)) > 0)
{ {
end += "/" + GetUnsafe(1050 + i); end += Program.slash + GetUnsafe(1050 + i);
break; break;
} }
a -= a & 0x30; a -= a & 0x30;
} }
for (var i = 4; i < 27; i++) for (var i = 4; i < 27; i++)
if ((a & (1 << i)) > 0) if ((a & (1 << i)) > 0)
start += "/" + GetUnsafe(1050 + i); start += Program.slash + GetUnsafe(1050 + i);
var returnValue = start + end; var returnValue = start + end;
if (returnValue == "") if (returnValue == "")
returnValue = GetUnsafe(1054); returnValue = GetUnsafe(1054);
...@@ -320,9 +320,9 @@ namespace MDPro3 ...@@ -320,9 +320,9 @@ namespace MDPro3
if (CardDescription.WhetherCardIsMonster(data)) if (CardDescription.WhetherCardIsMonster(data))
{ {
if (data.Race != origin.Race) if (data.Race != origin.Race)
re = "" + "<color=#FD3E08>" + InterString.Get("[?]", Race(data.Race)) + "</color>" + "/" + SecondType(data.Type) + ""; re = "" + "<color=#FD3E08>" + InterString.Get("[?]", Race(data.Race)) + "</color>" + Program.slash + SecondType(data.Type) + "";
else else
re = "" + InterString.Get("[?]", Race(data.Race)) + "/" + SecondType(data.Type) + ""; re = "" + InterString.Get("[?]", Race(data.Race)) + Program.slash + SecondType(data.Type) + "";
} }
else else
re = "" + MainType(data.Type) + ""; re = "" + MainType(data.Type) + "";
......
...@@ -4,13 +4,14 @@ using Ionic.Zip; ...@@ -4,13 +4,14 @@ using Ionic.Zip;
namespace MDPro3 namespace MDPro3
{ {
public class ZipManager public class ZipHelper
{ {
public static List<ZipFile> zips = new List<ZipFile>(); public static List<ZipFile> zips = new List<ZipFile>();
public static void Initialize() public static void Initialize()
{ {
zips.Add(new ZipFile("data/script.zip")); zips.Clear();
zips.Add(new ZipFile("Data/script.zip"));
if (!Directory.Exists("Expansions")) if (!Directory.Exists("Expansions"))
Directory.CreateDirectory("Expansions"); Directory.CreateDirectory("Expansions");
...@@ -19,5 +20,10 @@ namespace MDPro3 ...@@ -19,5 +20,10 @@ namespace MDPro3
foreach (var zip in Directory.GetFiles("Expansions", "*.zip")) foreach (var zip in Directory.GetFiles("Expansions", "*.zip"))
zips.Add(new ZipFile(zip)); zips.Add(new ZipFile(zip));
} }
public static void Dispose()
{
foreach (var zip in zips)
zip.Dispose();
}
} }
} }
fileFormatVersion: 2
guid: 7812e1008e088e74a9dc80bee6ff57a6
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -133,9 +133,9 @@ namespace MDPro3 ...@@ -133,9 +133,9 @@ namespace MDPro3
} }
string fullPath; string fullPath;
#if !UNITY_EDITOR && UNITY_ANDROID #if !UNITY_EDITOR && UNITY_ANDROID
fullPath = "file://" + Application.persistentDataPath + "/" + path; fullPath = "file://" + Application.persistentDataPath + Program.slash + path;
#else #else
fullPath = System.Environment.CurrentDirectory + "/" + path; fullPath = System.Environment.CurrentDirectory + Program.slash + path;
#endif #endif
UnityWebRequest request = UnityWebRequestTexture.GetTexture(fullPath); UnityWebRequest request = UnityWebRequestTexture.GetTexture(fullPath);
request.SendWebRequest(); request.SendWebRequest();
...@@ -156,20 +156,20 @@ namespace MDPro3 ...@@ -156,20 +156,20 @@ namespace MDPro3
//while(loadingArt) //while(loadingArt)
// yield return null; // yield return null;
//loadingArt = true; //loadingArt = true;
if (!Directory.Exists("Art")) if (!Directory.Exists(Program.artPath))
Directory.CreateDirectory("Art"); Directory.CreateDirectory(Program.artPath);
if (!Directory.Exists("Art2")) if (!Directory.Exists(Program.altArtPath))
Directory.CreateDirectory("Art2"); Directory.CreateDirectory(Program.altArtPath);
var path = "Art2/" + code; var path = Program.altArtPath + Program.slash + code;
if (File.Exists(path + ".jpg")) if (File.Exists(path + ".jpg"))
path += ".jpg"; path += ".jpg";
else if (File.Exists(path + ".png")) else if (File.Exists(path + ".png"))
path += ".png"; path += ".png";
else if (File.Exists("Art/" + code.ToString() + ".jpg")) else if (File.Exists(Program.artPath + Program.slash + code.ToString() + ".jpg"))
path = "Art/" + code.ToString() + ".jpg"; path = Program.artPath + Program.slash + code.ToString() + ".jpg";
else else
{ {
foreach (var zip in ZipManager.zips) foreach (var zip in ZipHelper.zips)
{ {
if (zip.Name.ToLower().EndsWith("script.zip")) if (zip.Name.ToLower().EndsWith("script.zip"))
continue; continue;
...@@ -191,7 +191,7 @@ namespace MDPro3 ...@@ -191,7 +191,7 @@ namespace MDPro3
} }
if(returenValue == null) if(returenValue == null)
{ {
foreach (var zip in ZipManager.zips) foreach (var zip in ZipHelper.zips)
{ {
if (zip.Name.ToLower().EndsWith("script.zip")) if (zip.Name.ToLower().EndsWith("script.zip"))
continue; continue;
......
fileFormatVersion: 2
guid: d97e4be8227079543b43f212dcb2c75e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
...@@ -3,14 +3,10 @@ using System.Collections; ...@@ -3,14 +3,10 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using UnityEngine; using UnityEngine;
using UnityEngine.UI;
using MDPro3.YGOSharp; using MDPro3.YGOSharp;
using Ionic.Zip;
using UnityEngine.EventSystems; using UnityEngine.EventSystems;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;
using MDPro3.Net; using MDPro3.Net;
using System.Threading;
using System.Runtime.InteropServices;
namespace MDPro3 namespace MDPro3
{ {
...@@ -55,6 +51,19 @@ namespace MDPro3 ...@@ -55,6 +51,19 @@ namespace MDPro3
#region State #region State
public static bool Running = true; public static bool Running = true;
public static readonly string artPath = "Art";
public static readonly string altArtPath = "Art2";
public static readonly string cardPicPath = "CardGenerated";
public static readonly string dataPath = "Data";
public static readonly string localesPath = "Data/locales";
public static readonly string configPath = "Data/config.conf";
public static readonly string lflistPath = "Data/lflist.conf";
public static readonly string deckPath = "Deck";
public static readonly string expansionsPath = "Expansions";
public static readonly string puzzlePath = "Puzzle";
public static readonly string replayPath = "Replay";
public static readonly string diyPath = "DIY";
public static readonly string slash = "/";
#endregion #endregion
public static Program I() public static Program I()
...@@ -79,18 +88,21 @@ namespace MDPro3 ...@@ -79,18 +88,21 @@ namespace MDPro3
void InitializeRest() void InitializeRest()
{ {
ZipManager.Initialize(); ZipHelper.Initialize();
if (!Directory.Exists("Data")) if (!Directory.Exists(dataPath))
Directory.CreateDirectory("Data"); Directory.CreateDirectory(dataPath);
Config.Initialize("Data/config.conf"); Config.Initialize(configPath);
items.Initialize(); items.Initialize();
BanlistManager.Initialize("data/lflist.conf"); BanlistManager.Initialize(lflistPath);
InitializeAllManagers(); InitializeAllManagers();
InitializeAllServants(); InitializeAllServants();
}
public void InitializeForDataChange()
//new Thread(Server.Main).Start(); {
//new Thread(Client.Main).Start(); ZipHelper.Initialize();
StringHelper.Initialize();
CardsManager.Initialize();
} }
private void InitializeAllManagers() private void InitializeAllManagers()
...@@ -129,6 +141,7 @@ namespace MDPro3 ...@@ -129,6 +141,7 @@ namespace MDPro3
#region MonoBehaviors #region MonoBehaviors
public static string tempFolder = "TempFolder";
public static string root = "StandaloneWindows64/"; public static string root = "StandaloneWindows64/";
void Awake() void Awake()
{ {
...@@ -284,7 +297,20 @@ namespace MDPro3 ...@@ -284,7 +297,20 @@ namespace MDPro3
if (currentSubServant != null) if (currentSubServant != null)
currentSubServant.OnReturn(); currentSubServant.OnReturn();
else else
{
if(currentServant == null)
{
foreach(var servant in servants)
if (servant.isShowed)
{
currentServant = servant;
break;
}
}
if (currentServant == null)
currentServant = cutin;
currentServant.OnReturn(); currentServant.OnReturn();
}
} }
public void ExitDuel() public void ExitDuel()
...@@ -298,8 +324,34 @@ namespace MDPro3 ...@@ -298,8 +324,34 @@ namespace MDPro3
private void OnApplicationQuit() private void OnApplicationQuit()
{ {
Running = false; Running = false;
TcpHelper.tcpClient?.Close(); ClearCache();
TcpHelper.tcpClient = null;
YgoServer.StopServer(); YgoServer.StopServer();
} }
void ClearCache()
{
#if UNITY_ANDROID && !UNITY_EDITOR
AndroidJavaClass unityPlayer = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject currentActivity = unityPlayer.GetStatic<AndroidJavaObject>("currentActivity");
AndroidJavaObject cacheDir = currentActivity.Call<AndroidJavaObject>("getCacheDir");
string cachePath = cacheDir.Call<string>("getAbsolutePath");
ClearDirectoryRecursively(new DirectoryInfo(cachePath));
#else
if (Directory.Exists(tempFolder))
Directory.Delete(tempFolder, true);
#endif
}
void ClearDirectoryRecursively(DirectoryInfo directory)
{
foreach(var file in directory.GetFiles())
file.Delete();
foreach(var subDir in directory.GetDirectories())
{
ClearDirectoryRecursively(subDir);
subDir.Delete();
}
}
} }
} }
...@@ -83,9 +83,9 @@ namespace MDPro3 ...@@ -83,9 +83,9 @@ namespace MDPro3
Deck history; Deck history;
public Deck shine; public Deck shine;
public Deck royal; public Deck royal;
readonly string bookPath = "data/book.ydk"; readonly string bookPath = "Data/book.ydk";
readonly string shinePath = "data/sr.ydk"; readonly string shinePath = "Data/sr.ydk";
readonly string royalPath = "data/ur.ydk"; readonly string royalPath = "Data/ur.ydk";
Card cardShowing; Card cardShowing;
public Banlist banlist; public Banlist banlist;
public static string pack = ""; public static string pack = "";
...@@ -201,12 +201,12 @@ namespace MDPro3 ...@@ -201,12 +201,12 @@ namespace MDPro3
else else
{ {
List<string> selections = new List<string> List<string> selections = new List<string>
{ {
InterString.Get("卡组未保存"), InterString.Get("卡组未保存"),
InterString.Get("卡组已修改,是否保存?"), InterString.Get("卡组已修改,是否保存?"),
InterString.Get("保存"), InterString.Get("保存"),
InterString.Get("不保存") InterString.Get("不保存")
}; };
UIManager.ShowPopupYesOrNo(selections, OnSave, OnExit); UIManager.ShowPopupYesOrNo(selections, OnSave, OnExit);
} }
} }
......
This diff is collapsed.
...@@ -275,7 +275,8 @@ namespace MDPro3 ...@@ -275,7 +275,8 @@ namespace MDPro3
MessageManager.Cast("主机地址和端口不能为空。"); MessageManager.Cast("主机地址和端口不能为空。");
return; return;
} }
if (!TcpHelper.canJoin)
return;
Room.fromSolo = false; Room.fromSolo = false;
Room.fromLocalHost = false; Room.fromLocalHost = false;
new Thread(() => { TcpHelper.Join(ip, Config.Get("DuelPlayerName0", "@ui"), port, password, version); }).Start(); new Thread(() => { TcpHelper.Join(ip, Config.Get("DuelPlayerName0", "@ui"), port, password, version); }).Start();
......
...@@ -405,7 +405,11 @@ namespace MDPro3 ...@@ -405,7 +405,11 @@ namespace MDPro3
if (Program.I().ocgcore.isShowed && player < 4) if (Program.I().ocgcore.isShowed && player < 4)
{ {
if (mode != 2) if (mode != 2)
player = Program.I().ocgcore.LocalPlayer(player); {
if (Program.I().ocgcore.isFirst && selfType == 1
|| !Program.I().ocgcore.isFirst && selfType == 0)
player = (player + 1) % 2;
}
else else
{ {
if (Program.I().ocgcore.isFirst && selfType > 1 if (Program.I().ocgcore.isFirst && selfType > 1
......
...@@ -4,6 +4,7 @@ using System; ...@@ -4,6 +4,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Reflection; using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using UnityEngine; using UnityEngine;
using UnityEngine.AddressableAssets; using UnityEngine.AddressableAssets;
...@@ -128,6 +129,14 @@ namespace MDPro3 ...@@ -128,6 +129,14 @@ namespace MDPro3
public Text replayCoinValue; public Text replayCoinValue;
public Button replayAutoInfo; public Button replayAutoInfo;
public Text replayAutoInfoValue; public Text replayAutoInfoValue;
[Header("Port")]
public Button import;
public Button exportDeck;
public Button exportReplay;
public Button exportPicture;
public Button clearPicture;
public Button clearExpansions;
public override void Initialize() public override void Initialize()
{ {
depth = 1; depth = 1;
...@@ -195,6 +204,12 @@ namespace MDPro3 ...@@ -195,6 +204,12 @@ namespace MDPro3
watchAutoInfo.onClick.AddListener(OnWatchAutoInfoClick); watchAutoInfo.onClick.AddListener(OnWatchAutoInfoClick);
replayAutoInfo.onClick.AddListener(OnReplayAutoInfoClick); replayAutoInfo.onClick.AddListener(OnReplayAutoInfoClick);
timing.onClick.AddListener(OnTimingClick); timing.onClick.AddListener(OnTimingClick);
import.onClick.AddListener(OnImport);
exportDeck.onClick.AddListener(OnExportDecks);
exportReplay.onClick.AddListener(OnExportReplays);
exportPicture.onClick.AddListener(OnExportPictures);
clearPicture.onClick.AddListener(OnClearPictures);
clearExpansions.onClick.AddListener(OnClearExpansions);
bgmVol.value = int.Parse(Config.Get("BgmVol", "700")) / (float)1000; bgmVol.value = int.Parse(Config.Get("BgmVol", "700")) / (float)1000;
seVol.value = int.Parse(Config.Get("SeVol", "700")) / (float)1000; seVol.value = int.Parse(Config.Get("SeVol", "700")) / (float)1000;
...@@ -659,10 +674,10 @@ namespace MDPro3 ...@@ -659,10 +674,10 @@ namespace MDPro3
} }
List<string> selections = new List<string> List<string> selections = new List<string>
{ {
InterString.Get("语言") InterString.Get("语言")
}; };
DirectoryInfo[] infos = new DirectoryInfo("data/locales").GetDirectories(); DirectoryInfo[] infos = new DirectoryInfo(Program.localesPath).GetDirectories();
foreach (DirectoryInfo info in infos) foreach (DirectoryInfo info in infos)
selections.Add(InterString.Get(info.Name)); selections.Add(InterString.Get(info.Name));
UIManager.ShowPopupSelection(selections, OnLanguageSelection); UIManager.ShowPopupSelection(selections, OnLanguageSelection);
...@@ -1142,6 +1157,76 @@ namespace MDPro3 ...@@ -1142,6 +1157,76 @@ namespace MDPro3
timingValue.text = InterString.Get("开"); timingValue.text = InterString.Get("开");
} }
void OnImport()
{
if (Program.I().ocgcore.isShowed)
{
MessageManager.Cast(InterString.Get("决斗中不能进行此操作。"));
return;
}
PortHelper.ImportFiles();
}
void OnExportDecks()
{
PortHelper.ExportAllDecks();
}
void OnExportReplays()
{
PortHelper.ExportAllReplays();
}
void OnExportPictures()
{
PortHelper.ExportAllPictures();
}
void OnClearPictures()
{
if (Program.I().ocgcore.isShowed)
{
MessageManager.Cast(InterString.Get("决斗中不能进行此操作。"));
return;
}
var selections = new List<string>
{
InterString.Get("确定清空"),
InterString.Get("是否确认删除所有导入的卡图?"),
InterString.Get("确认"),
InterString.Get("取消")
};
UIManager.ShowPopupYesOrNo(selections, () =>
{
if (!Directory.Exists(Program.altArtPath))
Directory.CreateDirectory(Program.altArtPath);
foreach (var file in Directory.GetFiles(Program.altArtPath))
File.Delete(file);
}, null);
}
void OnClearExpansions()
{
if (Program.I().ocgcore.isShowed)
{
MessageManager.Cast(InterString.Get("决斗中不能进行此操作。"));
return;
}
var selections = new List<string>
{
InterString.Get("确定清空"),
InterString.Get("是否确认删除所有导入的扩展卡包?"),
InterString.Get("确认"),
InterString.Get("取消")
};
UIManager.ShowPopupYesOrNo(selections, () =>
{
ZipHelper.Dispose();
if(!Directory.Exists(Program.expansionsPath))
Directory.CreateDirectory(Program.expansionsPath);
foreach (var file in Directory.GetFiles(Program.expansionsPath))
File.Delete(file);
Program.I().InitializeForDataChange();
}, null);
}
#endregion #endregion
public void OnAboutGame() public void OnAboutGame()
......
...@@ -51,7 +51,7 @@ namespace MDPro3 ...@@ -51,7 +51,7 @@ namespace MDPro3
public void Load() public void Load()
{ {
ReadBots("Data/locales/" + Config.Get("Language", "zh-CN") + "/bot.conf"); ReadBots(Program.localesPath + Program.slash + Config.Get("Language", "zh-CN") + "/bot.conf");
Print(); Print();
StartCoroutine(SelectZero()); StartCoroutine(SelectZero());
} }
......
...@@ -98,7 +98,7 @@ namespace MDPro3.UI ...@@ -98,7 +98,7 @@ namespace MDPro3.UI
mono.SelectableThis(); mono.SelectableThis();
else else
mono.UnselectableThis(); mono.UnselectableThis();
title.text = hint + "-" + OcgCore.GetSelectLevelSum(GetSelected())[0].ToString() + "/" + core.ES_level; title.text = hint + "-" + OcgCore.GetSelectLevelSum(GetSelected())[0].ToString() + Program.slash + core.ES_level;
} }
else if (core.currentMessage == GameMessage.SortCard else if (core.currentMessage == GameMessage.SortCard
|| core.currentMessage == GameMessage.SortChain) || core.currentMessage == GameMessage.SortChain)
...@@ -161,7 +161,7 @@ namespace MDPro3.UI ...@@ -161,7 +161,7 @@ namespace MDPro3.UI
else else
btnConfirm.GetComponent<ButtonPress>().SetInteractable(false); btnConfirm.GetComponent<ButtonPress>().SetInteractable(false);
} }
title.text = hint + "-" + selectedSum[0].ToString() + "/" + core.ES_level; title.text = hint + "-" + selectedSum[0].ToString() + Program.slash + core.ES_level;
} }
else else
{ {
...@@ -182,7 +182,7 @@ namespace MDPro3.UI ...@@ -182,7 +182,7 @@ namespace MDPro3.UI
mono.SelectableThis(); mono.SelectableThis();
} }
if (core.currentMessage == GameMessage.SelectCard) if (core.currentMessage == GameMessage.SelectCard)
title.text = hint + "-" + GetSelected().Count + "/" + max.ToString(); title.text = hint + "-" + GetSelected().Count + Program.slash + max.ToString();
} }
} }
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
"com.unity.timeline": "1.4.8", "com.unity.timeline": "1.4.8",
"com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.6", "com.unity.toolchain.win-x86_64-linux-x86_64": "2.0.6",
"com.unity.ugui": "1.0.0", "com.unity.ugui": "1.0.0",
"com.yasirkula.nativefilepicker": "https://github.com/yasirkula/UnityNativeFilePicker.git",
"com.unity.modules.ai": "1.0.0", "com.unity.modules.ai": "1.0.0",
"com.unity.modules.androidjni": "1.0.0", "com.unity.modules.androidjni": "1.0.0",
"com.unity.modules.animation": "1.0.0", "com.unity.modules.animation": "1.0.0",
......
...@@ -195,6 +195,13 @@ ...@@ -195,6 +195,13 @@
"com.unity.modules.imgui": "1.0.0" "com.unity.modules.imgui": "1.0.0"
} }
}, },
"com.yasirkula.nativefilepicker": {
"version": "https://github.com/yasirkula/UnityNativeFilePicker.git",
"depth": 0,
"source": "git",
"dependencies": {},
"hash": "c1b54d864f4dc3c4dff5d05b0c5ad7c45b505c6c"
},
"com.unity.modules.ai": { "com.unity.modules.ai": {
"version": "1.0.0", "version": "1.0.0",
"depth": 0, "depth": 0,
......
...@@ -134,8 +134,9 @@ PlayerSettings: ...@@ -134,8 +134,9 @@ PlayerSettings:
16:10: 1 16:10: 1
16:9: 1 16:9: 1
Others: 1 Others: 1
bundleVersion: 1.0.6 bundleVersion: 1.0.7
preloadedAssets: [] preloadedAssets:
- {fileID: 11400000, guid: 5fb02d2098f52054b89ce4a9f63ba9ee, type: 2}
metroInputSource: 0 metroInputSource: 0
wsaTransparentSwapchain: 0 wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1 m_HolographicPauseOnTrackingLoss: 1
...@@ -171,7 +172,7 @@ PlayerSettings: ...@@ -171,7 +172,7 @@ PlayerSettings:
iPhoneStrippingLevel: 0 iPhoneStrippingLevel: 0
iPhoneScriptCallOptimization: 0 iPhoneScriptCallOptimization: 0
ForceInternetPermission: 0 ForceInternetPermission: 0
ForceSDCardPermission: 0 ForceSDCardPermission: 1
CreateWallpaper: 0 CreateWallpaper: 0
APKExpansionFiles: 0 APKExpansionFiles: 0
keepLoadedShadersAlive: 0 keepLoadedShadersAlive: 0
...@@ -529,7 +530,7 @@ PlayerSettings: ...@@ -529,7 +530,7 @@ PlayerSettings:
m_APIs: 0b000000 m_APIs: 0b000000
m_Automatic: 1 m_Automatic: 1
- m_BuildTarget: WindowsStandaloneSupport - m_BuildTarget: WindowsStandaloneSupport
m_APIs: 0b000000020000001200000015000000 m_APIs: 0200000012000000150000000b000000
m_Automatic: 0 m_Automatic: 0
m_BuildTargetVRSettings: m_BuildTargetVRSettings:
- m_BuildTarget: Standalone - m_BuildTarget: Standalone
......
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