Commit 69c74cd3 authored by SherryChaos's avatar SherryChaos

bug fixing

parent 5248bcee
This diff is collapsed.
......@@ -55,13 +55,14 @@ namespace MDPro3
public void Show(GameCard card, Material mat)
{
var data = card.GetData();
var tails = "<color=#0FFF0F>" + card.tails.managedString + "</color>";
var p = card.p;
if (data.Id == 0)
var origin = CardsManager.Get(data.Id);
if (origin.Id == 0)
return;
var tails = "<color=#0FFF0F>" + card.tails.managedString + "</color>";
var p = card.p;
this.data = data;
var origin = CardsManager.Get(data.Id);
manager.GetElement<RectTransform>("Window").DOAnchorPosX(20, 0.01f);
showing = true;
......
......@@ -29,26 +29,30 @@ namespace MDPro3.YGOSharp
databaseFullPath = Program.localesPath + Program.slash + "zh-CN/cards.cdb";
_cards.Clear();
LoadCDB(databaseFullPath);
foreach(var cdb in Directory.GetFiles("Expansions", "*.cdb"))
LoadCDB(cdb);
foreach(var zip in ZipHelper.zips)
if (Config.Get("Expansions", "1") == "1")
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
foreach (var cdb in Directory.GetFiles("Expansions", "*.cdb"))
LoadCDB(cdb);
foreach (var zip in ZipHelper.zips)
{
if (file.ToLower().EndsWith(".cdb"))
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
{
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);
LoadCDB(tempFile);
File.Delete(tempFile);
if (file.ToLower().EndsWith(".cdb"))
{
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);
LoadCDB(tempFile);
File.Delete(tempFile);
}
}
}
}
UpdateSetNames();
PacksManager.Initialize();
......@@ -58,23 +62,26 @@ namespace MDPro3.YGOSharp
if (!File.Exists(databaseFullPath))
databaseFullPath = Program.localesPath + Program.slash + "zh-CN/cards.cdb";
LoadCDB(databaseFullPath, true);
foreach (var cdb in Directory.GetFiles("Expansions", "*.cdb"))
LoadCDB(cdb, true);
foreach (var zip in ZipHelper.zips)
if (Config.Get("Expansions", "1") == "1")
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
foreach (var cdb in Directory.GetFiles("Expansions", "*.cdb"))
LoadCDB(cdb, true);
foreach (var zip in ZipHelper.zips)
{
if (file.ToLower().EndsWith(".cdb"))
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
{
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);
LoadCDB(tempFile, true);
File.Delete(tempFile);
if (file.ToLower().EndsWith(".cdb"))
{
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);
LoadCDB(tempFile, true);
File.Delete(tempFile);
}
}
}
}
......@@ -1990,8 +1997,12 @@ namespace MDPro3.YGOSharp
static string path = "Data/pack";
static bool initialized;
internal static void Initialize()
{
if (initialized)
return;
if (Directory.Exists(path))
{
var fileInfos = new DirectoryInfo(path).GetFiles();
......@@ -1999,6 +2010,7 @@ namespace MDPro3.YGOSharp
if (file.Name.ToLower().EndsWith(".db"))
LoadDataBase(path + Program.slash + file.Name);
InitializeSec();
initialized = true;
}
}
......
......@@ -36,20 +36,23 @@ namespace MDPro3
var language = Config.Get("Language", "zh-CN");
var path = Program.localesPath + Program.slash + language + "/strings.conf";
var text = File.ReadAllText(path);
foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
text += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipHelper.zips)
if(Config.Get("Expansions", "1") == "1")
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
text += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipHelper.zips)
{
if (file.ToLower().EndsWith(".conf"))
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
{
var ms = new MemoryStream();
var e = zip[file];
e.Extract(ms);
text += "\r\n" + Encoding.UTF8.GetString(ms.ToArray());
if (file.ToLower().EndsWith(".conf"))
{
var ms = new MemoryStream();
var e = zip[file];
e.Extract(ms);
text += "\r\n" + Encoding.UTF8.GetString(ms.ToArray());
}
}
}
}
......@@ -57,23 +60,27 @@ namespace MDPro3
language = Config.Get("CardLanguage", "zh-CN");
path = Program.localesPath + Program.slash + language + "/strings.conf";
string textForRender = File.ReadAllText(path);
foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
textForRender += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipHelper.zips)
if (Config.Get("Expansions", "1") == "1")
{
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
foreach (var conf in Directory.GetFiles("Expansions", "*.conf"))
textForRender += "\r\n" + File.ReadAllText(conf);
foreach (var zip in ZipHelper.zips)
{
if (file.ToLower().EndsWith(".conf"))
if (zip.Name.ToLower().EndsWith("script.zip"))
continue;
foreach (var file in zip.EntryFileNames)
{
var ms = new MemoryStream();
var e = zip[file];
e.Extract(ms);
textForRender += "\r\n" + Encoding.UTF8.GetString(ms.ToArray());
if (file.ToLower().EndsWith(".conf"))
{
var ms = new MemoryStream();
var e = zip[file];
e.Extract(ms);
textForRender += "\r\n" + Encoding.UTF8.GetString(ms.ToArray());
}
}
}
}
InitializeContent(text, textForRender);
}
......
......@@ -124,19 +124,6 @@ namespace MDPro3
manager.gameObject.SetActive(true);
}
public IEnumerator LoadDummyCardLoadingPic(ElementObjectManager manager, int code, bool active = false)
{
if (active)
manager.gameObject.SetActive(false);
var ie = LoadCardAsync(code, true);
while (ie.MoveNext())
yield return null;
manager.GetElement<Renderer>("DummyCardModel_side").material = cardMatSide;
manager.GetElement<Renderer>("DummyCardModel_front").material.SetTexture("_LoadingTex", ie.Current);
manager.GetElement<Renderer>("DummyCardModel_front").material.SetFloat("_LoadingBlend", 1);
if (active)
manager.gameObject.SetActive(true);
}
public static IEnumerator<Texture2D> LoadFromFileAsync(string path)
{
......
......@@ -308,7 +308,16 @@ namespace MDPro3
}
}
if (currentServant == null)
currentServant = cutin;
{
foreach (var servant in servants)
if (servant.isShowed)
{
currentServant = servant;
break;
}
if(currentServant == null)
currentServant = online;
}
currentServant.OnReturn();
}
}
......
......@@ -8,6 +8,7 @@ using UnityEngine.InputSystem;
using System;
using UnityEngine.Networking;
using YgomSystem.LocalFileSystem.Internal;
using System.IO;
namespace MDPro3
{
......@@ -31,16 +32,30 @@ namespace MDPro3
www.SetRequestHeader("Cache-Control", "max-age=0, no-cache, no-store");
www.SetRequestHeader("Pragma", "no-cache");
yield return www.SendWebRequest();
try
if (www.result == UnityWebRequest.Result.Success)
{
var result = www.downloadHandler.text;
var lines = result.Replace("\r", "").Split('\n');
if (Application.version != lines[0])
MessageManager.Cast(InterString.Get("检测到新版本[[?]]。", lines[0]));
}
catch
{
else
MessageManager.Cast(InterString.Get("检查更新失败!"));
var filePath = Path.Combine(Program.expansionsPath, Path.GetFileName(Setting.prereleasePackUrl));
if (!File.Exists(filePath))
{
Config.Set("Prerelease", "0");
Config.Save();
}
www = UnityWebRequest.Get(Setting.prereleaseVersionUrl);
yield return www.SendWebRequest();
if(www.result == UnityWebRequest.Result.Success)
{
var result = www.downloadHandler.text;
var lines = result.Replace("\r", "").Split('\n');
if (Config.Get("Prerelease", "0") != lines[0])
MessageManager.Cast(InterString.Get("检测到新版先行卡,请至 [游戏设置]-[扩展卡包]-[更新先行卡] 处进行更新。"));
}
}
......
......@@ -89,6 +89,7 @@ namespace MDPro3
public bool inAi;
public Condition condition = Condition.N;
public bool isTag;
public ChainCondition chainCondition = ChainCondition.Smart;
public Deck deck;
public Deck sideReference = new Deck();
......@@ -1561,7 +1562,7 @@ namespace MDPro3
name_1 = r.ReadUnicode(50);
name_1_tag = r.ReadUnicode(50);
name_1_c = r.ReadUnicode(50);
var isTag = !(name_0_tag == "---" && name_1_tag == "---" && name_0 == name_0_c && name_1 == name_1_c);
isTag = !(name_0_tag == "---" && name_1_tag == "---" && name_0 == name_0_c && name_1 == name_1_c);
if (Config.Get("ReplayPlayerName0", "@ui").Length > 0)
name_0 = Config.Get("ReplayPlayerName0", "@ui");
......@@ -1621,6 +1622,7 @@ namespace MDPro3
name_1_c = name_1;
player0Name.text = name_0_c;
player1Name.text = name_1_c;
isTag = false;
SetFace();
break;
case GameMessage.Win:
......@@ -1810,7 +1812,10 @@ namespace MDPro3
player1Name.text = name_1_tag;
else
player0Name.text = name_0_tag;
isTag = true;
}
else
isTag = false;
SetFace();
GCS_CreateBundle(r.ReadInt16(), LocalPlayer(0), CardLocation.Deck);
GCS_CreateBundle(r.ReadInt16(), LocalPlayer(0), CardLocation.Extra);
......@@ -4252,12 +4257,12 @@ namespace MDPro3
int forced = r.ReadByte();
var hint0 = r.ReadInt32();
var hint1 = r.ReadInt32();
var chainCards = new List<GameCard>();
for (var i = 0; i < count; i++)
{
var flag = 0;
if (length_of_message % 12 != 0) flag = r.ReadChar();
if (((length_of_message - 12) / count) % 12 != 0)
flag = r.ReadChar();
code = r.ReadInt32() % 1000000000;
gps = r.ReadGPS();
desc = StringHelper.Get(r.ReadInt32());
......@@ -4855,28 +4860,16 @@ namespace MDPro3
newWhite.transform.localScale = Vector3.one;
newWhite.GetComponent<SpriteRenderer>().color = Color.clear;
}
StartCoroutine(Program.I().texture_.LoadDummyCardLoadingPic(mner.GetElement<ElementObjectManager>("DummyCard01"), code[0], true));
StartCoroutine(Program.I().texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard01"), code[0], true));
mner.GetElement<ElementObjectManager>("DummyCard01").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
if(count > 1)
{
StartCoroutine(Program.I().texture_.LoadDummyCardLoadingPic(mner.GetElement<ElementObjectManager>("DummyCard02"), code[1], true));
mner.GetElement<ElementObjectManager>("DummyCard02").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
}
StartCoroutine(Program.I().texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard02"), code[1], true));
if (count > 2)
{
StartCoroutine(Program.I().texture_.LoadDummyCardLoadingPic(mner.GetElement<ElementObjectManager>("DummyCard03"), code[2], true));
mner.GetElement<ElementObjectManager>("DummyCard03").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
}
StartCoroutine(Program.I().texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard03"), code[2], true));
if (count > 3)
{
StartCoroutine(Program.I().texture_.LoadDummyCardLoadingPic(mner.GetElement<ElementObjectManager>("DummyCard04"), code[3], true));
mner.GetElement<ElementObjectManager>("DummyCard04").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
}
StartCoroutine(Program.I().texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard04"), code[3], true));
if (count > 4)
{
StartCoroutine(Program.I().texture_.LoadDummyCardLoadingPic(mner.GetElement<ElementObjectManager>("DummyCard05"), code[4], true));
mner.GetElement<ElementObjectManager>("DummyCard05").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
}
StartCoroutine(Program.I().texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard05"), code[4], true));
mner.GetComponent<PlayableDirector>().Play();
var mono = mner.gameObject.AddComponent<DoWhenPlayableDirectorStop>();
mono.action = () =>
......@@ -5273,15 +5266,23 @@ namespace MDPro3
var selfType = Program.I().room.selfType;
if (player0Name.text == name_0)
{
if(selfType == 0 || selfType == 2)
if (isTag)
{
player0Frame.material = Appearance.duelFrameMat0;
player0Frame.sprite = Appearance.duelFace0;
if (selfType == 0 || selfType == 2)
{
player0Frame.material = Appearance.duelFrameMat0;
player0Frame.sprite = Appearance.duelFace0;
}
else
{
player0Frame.material = Appearance.duelFrameMat0Tag;
player0Frame.sprite = Appearance.duelFace0Tag;
}
}
else
{
player0Frame.material = Appearance.duelFrameMat0Tag;
player0Frame.sprite = Appearance.duelFace0Tag;
player0Frame.material = Appearance.duelFrameMat0;
player0Frame.sprite = Appearance.duelFace0;
}
}
else
......
using DG.Tweening;
using MDPro3.UI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Reflection;
......@@ -8,6 +9,7 @@ using System.Runtime.CompilerServices;
using System.Text.RegularExpressions;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.Networking;
using UnityEngine.Rendering.Universal;
using UnityEngine.UI;
using ShadowResolution = UnityEngine.Rendering.Universal.ShadowResolution;
......@@ -137,7 +139,13 @@ namespace MDPro3
public Button exportReplay;
public Button exportPicture;
public Button clearPicture;
[Header("Expansions")]
public Button supportExpansions;
public Text supportExpansionsValue;
public Button clearExpansions;
public Button updatePrerelease;
public Text updatePrereleaseValue;
public override void Initialize()
{
......@@ -220,6 +228,9 @@ namespace MDPro3
fps.value = int.Parse(Config.Get("FPS", "60"));
scale.value = int.Parse(Config.Get("Scale", "1000")) / (float)1000;
supportExpansions.onClick.AddListener(OnSupportExpansions);
updatePrerelease.onClick.AddListener(OnUpdatePrerelease);
var defau = "1000";
#if UNITY_ANDROID
defau = "1500";
......@@ -317,6 +328,9 @@ namespace MDPro3
Config.Set("WatchAutoInfo", SaveBool(watchAutoInfoValue.text));
Config.Set("ReplayAutoInfo", SaveBool(replayAutoInfoValue.text));
Config.Set("Timing", SaveBool(timingValue.text));
Config.Set("Expansions", SaveBool(supportExpansionsValue.text));
Config.Save();
}
public string SaveBool(string value)
......@@ -328,6 +342,8 @@ namespace MDPro3
returnValue = "1";
if (value == InterString.Get("左"))
returnValue = "1";
if (value == InterString.Get("是"))
returnValue = "1";
return returnValue;
}
public void OnBgmVolChange(float vol)
......@@ -938,6 +954,12 @@ namespace MDPro3
autoRPSValue.text = InterString.Get("关");
else
autoRPSValue.text = InterString.Get("开");
value = Config.Get("Expansions", "1");
if (value == "0")
supportExpansionsValue.text = InterString.Get("否");
else
supportExpansionsValue.text = InterString.Get("是");
}
public void OnDuelAppearcanceClick()
{
......@@ -1263,6 +1285,88 @@ namespace MDPro3
Program.I().InitializeForDataChange();
}, null);
}
void OnSupportExpansions()
{
if (supportExpansionsValue.text == InterString.Get("否"))
{
supportExpansionsValue.text = InterString.Get("是");
Config.Set("Expansions", "1");
}
else
{
supportExpansionsValue.text = InterString.Get("否");
Config.Set("Expansions", "0");
}
UIManager.ChangeLanguage();
}
bool checking;
void OnUpdatePrerelease()
{
if (!checking)
{
checking = true;
StartCoroutine(UpdatePrereleaseAsync());
}
}
public static readonly string prereleaseVersionUrl = "https://cdn02.moecube.com:444/ygopro-super-pre/data/version.txt";
public static readonly string prereleasePackUrl = "https://cdn02.moecube.com:444/ygopro-super-pre/archive/ygopro-super-pre.ypk";
IEnumerator UpdatePrereleaseAsync()
{
var filePath = Path.Combine(Program.expansionsPath, Path.GetFileName(prereleasePackUrl));
if (!File.Exists(filePath))
{
Config.Set("Prerelease", "0");
Config.Save();
}
var www = UnityWebRequest.Get(prereleaseVersionUrl);
www.SendWebRequest();
while (!www.isDone)
{
yield return null;
updatePrereleaseValue.text = InterString.Get("检查更新中");
}
if (www.result == UnityWebRequest.Result.Success)
{
var result = www.downloadHandler.text;
var lines = result.Replace("\r", "").Split('\n');
if (Config.Get("Prerelease", "0") != lines[0])
{
if(!Directory.Exists(Program.expansionsPath))
Directory.CreateDirectory(Program.expansionsPath);
var download = UnityWebRequest.Get(prereleasePackUrl);
download.SendWebRequest();
MessageManager.Cast("正在更新,请耐心等待更待更新完成再进行其他操作。");
while (!download.isDone)
{
yield return null;
updatePrereleaseValue.text = (download.downloadProgress * 100f).ToString("0.##") + "%";
}
if(download.result == UnityWebRequest.Result.Success)
{
ZipHelper.Dispose();
File.WriteAllBytes(filePath, download.downloadHandler.data);
MessageManager.Cast("先行卡更新成功。");
Config.Set("Prerelease", lines[0]);
Config.Save();
Program.I().InitializeForDataChange();
}
else
MessageManager.Cast("先行卡更新失败。");
}
else
MessageManager.Cast("先行卡已是最新版。");
}
else
MessageManager.Cast(InterString.Get("检查更新失败!"));
updatePrereleaseValue.text = string.Empty;
checking = false;
}
#endregion
public void OnAboutGame()
......
......@@ -144,8 +144,8 @@ PlayerSettings:
vrSettings:
enable360StereoCapture: 0
isWsaHolographicRemotingEnabled: 0
enableFrameTimingStats: 1
useHDRDisplay: 0
enableFrameTimingStats: 0
useHDRDisplay: 1
D3DHDRBitDepth: 0
m_ColorGamuts: 00000000
targetPixelDensity: 30
......@@ -529,7 +529,7 @@ PlayerSettings:
m_APIs: 0b000000
m_Automatic: 1
- m_BuildTarget: WindowsStandaloneSupport
m_APIs: 0200000012000000150000000b000000
m_APIs: 020000000b000000
m_Automatic: 0
m_BuildTargetVRSettings:
- m_BuildTarget: Standalone
......@@ -795,7 +795,8 @@ PlayerSettings:
webGLLinkerTarget: 1
webGLThreadsSupport: 0
webGLDecompressionFallback: 0
scriptingDefineSymbols: {}
scriptingDefineSymbols:
1:
additionalCompilerArguments: {}
platformArchitecture: {}
scriptingBackend:
......
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