Commit da4fdff2 authored by SherryChaos's avatar SherryChaos

see UpdateContent.txt

parent 08fa2264
......@@ -2,8 +2,12 @@
MDPro3 v1.3.8更新:
1.非中文的卡片渲染的属性球添加了注音文字;
2.决斗中点击魔陷区会缩回对应玩家的手卡以展示魔陷区(屏幕比例16:9以上的缩回);
3.为移动端的卡组编辑界面的卡片详情页添加了左右滑动的功能;
4.修复移动端的卡组编辑界面的卡片详情页缺少Genesys点数图标的错误;
3.移动端的卡组编辑界面的卡片详情页添加了左右滑动的功能;
4.为决斗中生成卡片的功能添加了支持与特效(Duel.CreateToken,但卡片不是Token);
5.优化决斗中卡片发动与无效的动画,使其更接近MasterDuel的表现;
6.卡组添加分组功能;
7.修复移动端的卡组编辑界面的卡片详情页缺少Genesys点数图标的错误;
8.修复残局的录像无法播放的错误;
MDPro3 v1.3.7更新:
1.卡组编辑界面的[测试]按钮恢复功能,并以第一位WindBot为对手,不洗牌进行决斗;
......
......@@ -319,7 +319,6 @@ namespace Percy
public static extern int get_message(IntPtr pduel, IntPtr buf);
[DllImport("ocgcore", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
//public static extern void get_log_message(IntPtr pduel, IntPtr buf);
public static extern void get_log_message(IntPtr pduel, byte[] buf);
[DllImport("ocgcore", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
......
......@@ -38,17 +38,17 @@ namespace MDPro3.Duel
{
showing = true;
AudioManager.PlaySE("SE_LOG_OPEN");
baseRect.DOAnchorPosX(-20f, 0.2f);
baseRect.DOAnchorPosX(-20f, 0.2f).SetUpdate(true);
baseRect.localScale = Vector3.one * Config.GetUIScale(1.15f);
}
public void Hide(bool silent = false)
public void Hide(bool mute = false)
{
showing = false;
draged = false;
baseRect.DOAnchorPosX(400f * Config.GetUIScale(1.15f) + SafeAreaAdapter.GetSafeAreaRightOffset(), 0.2f);
baseRect.DOAnchorPosX(400f * Config.GetUIScale(1.15f) + SafeAreaAdapter.GetSafeAreaRightOffset(), 0.2f).SetUpdate(true);
if (!silent)
if (!mute)
AudioManager.PlaySE("SE_LOG_CLOSE");
}
......@@ -72,7 +72,7 @@ namespace MDPro3.Duel
if (!showing && fullHeight > scrollRect.viewport.rect.height)
item.SetActive(false);
if (!draged)
scrollRect.DOVerticalNormalizedPos(0f, 0.1f);
scrollRect.DOVerticalNormalizedPos(0f, 0.1f).SetUpdate(true);
}
public void ClearLog()
......
This diff is collapsed.
......@@ -1070,7 +1070,6 @@ namespace MDPro3.Duel
cardsInChain.Add(card);
codesInChain.Add(code);
controllerInChain.Add(gps.controller);
card.AnimationActivate();
ES_hint = InterString.Get("「[?]」被发动时", card.GetData().Name);
if (gps.InMyControl())
{
......@@ -1084,7 +1083,7 @@ namespace MDPro3.Duel
}
if(Core.GetAutoInfo())
Core.GetUI<OcgCoreUI>().CardDescription.Show(card, null);
await UniTask.WaitForSeconds(1f);
await card.AnimationActivate().WaitAsync();
}
protected override async UniTask GameMessage_Chained(BinaryReader reader)
......
......@@ -25,6 +25,8 @@ namespace MDPro3.Duel.YGOSharp
public string userId;
public string deckId;
public string type = string.Empty;
public Deck()
{
Main = new List<int>();
......@@ -40,7 +42,11 @@ namespace MDPro3.Duel.YGOSharp
}
public Deck(string path) : this(File.ReadAllText(path), string.Empty, string.Empty)
{}
{
type = Path.GetFileName(Path.GetDirectoryName(path));
if(type == "Deck" && type == Path.GetDirectoryName(path))
type = string.Empty;
}
public Deck(string ydk, string deckID = "", string userID = "")
{
......@@ -271,17 +277,21 @@ namespace MDPro3.Duel.YGOSharp
/// <param name="saveTime"></param>
/// <param name="upload"></param>
/// <returns></returns>
public bool Save(string deckName, DateTime saveTime, bool upload = true)
public bool Save(string deckName, DateTime saveTime, bool upload = true, bool showHint = true)
{
var ydk = GetYDK();
try
{
var path = Program.PATH_DECK + deckName + Program.EXPANSION_YDK;
deckName = Path.GetFileNameWithoutExtension(deckName);
var path = Program.PATH_DECK + (type == string.Empty ? string.Empty : $"{type}/") + deckName + Program.EXPANSION_YDK;
var dir = Path.GetDirectoryName(path);
if (!Directory.Exists(dir))
Directory.CreateDirectory(dir);
File.WriteAllText(path, ydk, Encoding.UTF8);
File.SetLastWriteTimeUtc(path, saveTime);
if (MyCard.account != null && upload)
_ = OnlineDeck.SyncDeck(deckId, deckName, this, saveTime, true);
_ = OnlineDeck.SyncDeck(deckId, deckName, this, saveTime, showHint);
}
catch
{
......
......@@ -191,14 +191,20 @@ namespace MDPro3
return scale > maxUIScale ? maxUIScale : scale;
}
public static string GetConfigDeckName()
public static string GetConfigDeckName(bool containType = true)
{
return Get("DeckInUse", EMPTY_STRING);
var config = Get("DeckInUse", EMPTY_STRING);
if(!containType && config.Contains("/"))
config = Path.GetFileName(config);
return config;
}
public static void SetConfigDeck(string deckName)
public static void SetConfigDeck(string deckName, bool needCheck = false)
{
Set("DeckInUse", deckName);
if(needCheck)
Set("DeckInUse", $"{Program.instance.deckSelector.DeckType}/{deckName}");
else
Set("DeckInUse", deckName);
}
}
}
......@@ -93,7 +93,8 @@ namespace MDPro3
renderer.material = mat;
}
public async UniTask LoadDummyCard(ElementObjectManager manager, int code, uint player, bool active = false)
public async UniTask LoadDummyCard(ElementObjectManager manager, int code, uint player, bool active = false,
Renderer attachRenderer = null, Renderer attachRenderer2 = null)
{
if (active)
manager.gameObject.SetActive(false);
......@@ -102,6 +103,10 @@ namespace MDPro3
var renderer = manager.GetElement<Renderer>("DummyCardModel_front");
renderer.material = MaterialLoader.GetCardMaterial(code, true);
renderer.material.mainTexture = await CardImageLoader.LoadCardAsync(code, false, manager.destroyCancellationToken);
if(attachRenderer != null)
attachRenderer.material.mainTexture = renderer.material.mainTexture;
if (attachRenderer2 != null)
attachRenderer2.material.mainTexture = renderer.material.mainTexture;
if (active)
manager.gameObject.SetActive(true);
}
......
......@@ -437,7 +437,9 @@ namespace MDPro3
public static void ShowBlackBack(float alpha, float time, Action action = null)
{
Program.instance.ui_.blackBack.raycastTarget = true;
Program.instance.ui_.blackBack.DOFade(alpha, time).OnComplete(() =>
Program.instance.ui_.blackBack.DOFade(alpha, time)
.SetUpdate(true)
.OnComplete(() =>
{
action?.Invoke();
});
......@@ -445,7 +447,9 @@ namespace MDPro3
public static void HideBlackBack(float time)
{
Program.instance.ui_.blackBack.DOFade(0f, time).OnComplete(() =>
Program.instance.ui_.blackBack.DOFade(0f, time)
.SetUpdate(true)
.OnComplete(() =>
{
Program.instance.ui_.blackBack.raycastTarget = false;
});
......
......@@ -79,11 +79,7 @@ namespace MDPro3.Net
{
using var request = UnityWebRequest.Get(authUrl);
request.SetRequestHeader(authHeader, "Bearer " + token);
var send = request.SendWebRequest();
await TaskUtility.WaitUntil(() => send.isDone);
if(!Application.isPlaying)
return null;
await request.SendWebRequest();
if (request.result == UnityWebRequest.Result.Success)
{
......
using MDPro3.Duel.YGOSharp;
using MDPro3.Utility;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using UnityEngine;
using UnityEngine.Networking;
......@@ -129,7 +131,10 @@ namespace MDPro3.Net
if (request.result == UnityWebRequest.Result.Success)
{
//Debug.Log(request.downloadHandler.text);
//var formatted = Tools.FormatJsonString(request.downloadHandler.text);
//File.WriteAllText("Decks.txt", formatted);
//Debug.Log(formatted);
decks = JsonUtility.FromJson<ResponseMultiSimpleData>(request.downloadHandler.text).data;
return decks;
}
......@@ -206,18 +211,20 @@ namespace MDPro3.Net
{
var oldName = deckNames[i];
var newName = deckNames[i];
if (DeckNameExist(oldName))
if (DeckNameExist(oldName, decks[i].type))
{
newName += " - " + InterString.Get("复制");
while (File.Exists(Program.PATH_DECK + newName + Program.EXPANSION_YDK))
while (File.Exists(Program.PATH_DECK + (decks[i].type == string.Empty ? string.Empty : $"{decks[i].type}/")
+ newName + Program.EXPANSION_YDK))
newName += " - " + InterString.Get("复制");
File.Delete(Program.PATH_DECK + oldName + Program.EXPANSION_YDK);
File.Delete(Program.PATH_DECK + (decks[i].type == string.Empty ? string.Empty : $"{decks[i].type}/") + oldName + Program.EXPANSION_YDK);
}
body.decks[i] = new PostDeck
{
deckId = ids[i],
deckName = newName,
deckType = decks[i].type,
deckCoverCard1 = decks[i].Pickup.Count > 0 ? decks[i].Pickup[0] : 0,
deckCoverCard2 = decks[i].Pickup.Count > 1 ? decks[i].Pickup[1] : 0,
deckCoverCard3 = decks[i].Pickup.Count > 2 ? decks[i].Pickup[2] : 0,
......@@ -433,14 +440,11 @@ namespace MDPro3.Net
return true;
}
private static bool DeckNameExist(string deckName)
private static bool DeckNameExist(string deckName, string deckType)
{
if (decks == null)
return false;
foreach (var deck in decks)
if (deck.deckName == deckName && !deck.isDelete)
return true;
return false;
return decks.Any(deck => !deck.isDelete && deck.deckName == deckName && deck.deckType == deckType);
}
#endregion
......@@ -569,6 +573,7 @@ namespace MDPro3.Net
{
public string deckId;
public string deckName;
public string deckType;
public int deckCoverCard1;
public int deckCoverCard2;
public int deckCoverCard3;
......@@ -591,6 +596,7 @@ namespace MDPro3.Net
{
this.deckId = deckId;
this.deckName = deckName;
deckType = deck.type;
if (deck.Pickup.Count > 0)
deckCoverCard1 = deck.Pickup[0];
if (deck.Pickup.Count > 1)
......
......@@ -634,7 +634,7 @@ namespace MDPro3
}
catch
{
Debug.LogError("Addressables Not Found: " + $"DeckCase{code.ToString()[3..]}{suffix}");
Debug.LogError("Addressables Not Found: " + $"DeckCase {code}_{suffix}");
return await LoadAddressableSprite(ADDRESS_DEFAULT_DECK_CASE);
}
}
......
using DG.Tweening;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using UnityEngine;
using UnityEngine.AddressableAssets;
using UnityEngine.UI;
using MDPro3.Duel.YGOSharp;
using MDPro3.UI;
using MDPro3.Net;
using TMPro;
using UnityEngine.EventSystems;
using MDPro3.UI.ServantUI;
namespace MDPro3.Servant
......@@ -52,11 +39,14 @@ namespace MDPro3.Servant
public override int Depth => 4;
protected override bool ShowLine => true;
public string DeckType => GetUI<DeckSelectorUI>().deckType;
public override void Initialize()
{
base.Initialize();
SwitchCondition(Condition.ForEdit);
}
public override void OnExit()
{
if (Program.exitOnReturn)
......@@ -64,6 +54,7 @@ namespace MDPro3.Servant
else
Program.instance.ShiftToServant(returnServant);
}
public override void PerFrameFunction()
{
if (!showing) return;
......@@ -79,13 +70,21 @@ namespace MDPro3.Servant
if (GetUI<DeckSelectorUI>().ButtonOnline.gameObject.activeSelf)
GetUI<DeckSelectorUI>().OnOnlineDeckView();
else
GetUI<DeckSelectorUI>().OnDeleteConfirm();
GetUI<DeckSelectorUI>().OnConfirm();
}
if (UserInput.WasGamepadButtonNorthPressed)
{
AudioManager.PlaySE("SE_MENU_SELECT_01");
GetUI<DeckSelectorUI>().ActivateInputField();
}
if (UserInput.WasLeftShoulderPressed)
{
if (GetUI<DeckSelectorUI>().ButtonType.gameObject.activeSelf)
{
AudioManager.PlaySE("SE_MENU_SELECT_01");
GetUI<DeckSelectorUI>().OnType();
}
}
if (UserInput.WasRightShoulderPressed)
{
if (GetUI<DeckSelectorUI>().ButtonOnline.gameObject.activeSelf)
......@@ -101,11 +100,12 @@ namespace MDPro3.Servant
else
{
AudioManager.PlaySE("SE_MENU_CANCEL");
GetUI<DeckSelectorUI>().OnDeleteCancel();
GetUI<DeckSelectorUI>().OnCancel();
}
}
}
}
public override void Select(bool forced = false)
{
if (!forced && !UserInput.NeedDefaultSelect())
......@@ -113,6 +113,7 @@ namespace MDPro3.Servant
lastSelectedDeckItem.GetSelectable().Select();
}
public override bool NeedResponseInput()
{
if(servantUI == null
......
......@@ -24,7 +24,7 @@ namespace MDPro3.Servant
public class OcgCore : Servant
{
private DuelBGManager DuelBGManager => messageDispatcher.duel.duelBGManager;
public DuelBGManager DuelBGManager => messageDispatcher.duel.duelBGManager;
public List<GameObject> allGameObjects => messageDispatcher.duel.duelBGManager.allGameObjects;
public List<PlaceSelector> places => messageDispatcher.duel.duelBGManager.places;
public static List<GameCard> materialCards = new();
......@@ -740,13 +740,13 @@ namespace MDPro3.Servant
public void StocMessage_Error(string error)
{
StartCoroutine(ShowErrorMessageAsync(error));
_ = ShowErrorMessageAsync(error);
}
private IEnumerator ShowErrorMessageAsync(string error)
private async UniTask ShowErrorMessageAsync(string error)
{
while (servantUI == null)
yield return null;
await UniTask.WaitWhile(() => servantUI == null);
UniTask.ReturnToMainThread();
GetUI<OcgCoreUI>().DuelErrorLog.Show(error);
}
......@@ -939,7 +939,7 @@ namespace MDPro3.Servant
currentMessage = (GameMessage)currentPackage.Function;
//if (currentMessage != GameMessage.UpdateData)
//Debug.Log($"GameMessage: {currentMessage}");
// Debug.Log($"GameMessage: {currentMessage}");
try
{
......@@ -1374,6 +1374,49 @@ namespace MDPro3.Servant
return 0;
}
public int GetUpdateDataIdByGameCard(GameCard card)
{
for (int i = 0; i < packages.Count; i++)
{
if ((GameMessage)packages[i].Function == GameMessage.UpdateData)
{
var reader = packages[i].Data.reader;
reader.BaseStream.Seek(0, 0);
var player = LocalPlayer(reader.ReadChar());
var location = reader.ReadChar();
if (player != card.p.controller)
continue;
if((location & card.p.location) == 0)
continue;
while (true)
{
var len = reader.ReadInt32();
if (len == 4) continue;
var pos = reader.BaseStream.Position;
var flag = reader.ReadInt32();
var code = 0;
if((flag & (int)Query.Code) != 0)
code = reader.ReadInt32();
if ((flag & (int)Query.Position) != 0)
{
var gps = reader.ReadGPS();
var cardToRefresh = Program.instance.ocgcore.GCS_Get(gps);
if (cardToRefresh != null && cardToRefresh == card)
return code;
else
{
reader.BaseStream.Position = pos + len - 4;
continue;
}
}
}
}
}
return 0;
}
#endregion
#region Practicalize
......@@ -1889,13 +1932,6 @@ namespace MDPro3.Servant
DuelBGManager.UpdateExDeckTop(controller);
}
public void RefreshBgState()
{
if (DuelBGManager == null)
return;
DuelBGManager.RefreshBgState();
}
public void SetBgTimeScale(float timeScale)
{
if (DuelBGManager == null)
......@@ -1985,79 +2021,6 @@ namespace MDPro3.Servant
deck.GetElement("CardShuffleTop").SetActive(active);
}
bool CheckChain()
{
bool config = true;
if (condition == Condition.Duel && Config.Get("DuelChain", "1") == "0")
config = false;
else if (condition == Condition.Watch && Config.Get("WatchChain", "1") == "0")
config = false;
else if (condition == Condition.Replay && Config.Get("ReplayChain", "1") == "0")
config = false;
return config;
}
void ChangeChainNumber(SpriteRenderer digit, SpriteRenderer one, SpriteRenderer ten, int number)
{
if (number < 10)
{
one.gameObject.SetActive(false);
ten.gameObject.SetActive(false);
digit.sprite = TextureManager.container.GetChainNumSprite(number);
}
else
{
digit.gameObject.SetActive(false);
one.sprite = TextureManager.container.GetChainNumSprite(number % 10);
ten.sprite = TextureManager.container.GetChainNumSprite((number / 10) % 10);
}
}
private void PlayCommonSpecialWin(int[] codes)
{
var count = codes.Length;
var go = ABLoader.LoadFromFolder<ElementObjectManager>("MasterDuel/Timeline/SpecialWin/SpecialWinCommonCard0" + count, false, true);
allGameObjects.Add(go);
var mner = go.GetComponent<ElementObjectManager>();
foreach (var child in mner.transform.GetComponentsInChildren<Transform>(true))
if (child.name == "White")
{
//var newWhite = Instantiate(child.gameObject);
//newWhite.transform.SetParent(child.transform, false);
//newWhite.transform.localScale = Vector3.one;
//newWhite.GetComponent<SpriteRenderer>().color = Color.clear;
child.gameObject.SetActive(false);
}
_ = Program.instance.texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard01"), codes[0], 0, true);
mner.GetElement<ElementObjectManager>("DummyCard01").GetElement<Renderer>("DummyCardModel_front").material.renderQueue = 4000;
if (count > 1)
_ = Program.instance.texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard02"), codes[1], 0, true);
if (count > 2)
_ = Program.instance.texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard03"), codes[2], 0, true);
if (count > 3)
_ = Program.instance.texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard04"), codes[3], 0, true);
if (count > 4)
_ = Program.instance.texture_.LoadDummyCard(mner.GetElement<ElementObjectManager>("DummyCard05"), codes[4], 0, true);
mner.GetComponent<PlayableDirector>().Play();
var mono = mner.gameObject.AddComponent<DoWhenPlayableDirectorStop>();
mono.action = () =>
{
Destroy(go);
};
}
private ElementObjectManager PlaySpecialWin(string path)
{
var go = ABLoader.LoadFromFolder<ElementObjectManager>("MasterDuel/Timeline/SpecialWin/" + path, false, true);
allGameObjects.Add(go);
ElementObjectManager manager = go.GetComponent<ElementObjectManager>();
var mono = go.AddComponent<DoWhenPlayableDirectorStop>();
mono.action = () => { Destroy(go); };
return manager;
}
#endregion
#region Voice
......
using System;
using MDPro3.UI;
using MDPro3.Duel.YGOSharp;
using MDPro3.Net;
using MDPro3.UI;
using MDPro3.UI.ServantUI;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using UnityEngine;
using UnityEngine.UI;
using System.Linq;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using MDPro3.Net;
using MDPro3.UI.ServantUI;
using UnityEngine.UI;
using YgomGame.TextIDs;
using static MDPro3.Duel.YGOSharp.PacksManager;
namespace MDPro3.Servant
......@@ -267,7 +269,7 @@ namespace MDPro3.Servant
yield break;
}
var deckFiles = Directory.GetFiles(Program.PATH_DECK, "*.ydk");
var deckFiles = Directory.GetFiles(Program.PATH_DECK, "*.ydk", SearchOption.AllDirectories);
var decks = new List<Deck>();
foreach (var deckPath in deckFiles)
decks.Add(new Deck(deckPath));
......@@ -280,11 +282,10 @@ namespace MDPro3.Servant
for (int i = 0; i < decks.Count; i++)
{
var deckName = Path.GetFileNameWithoutExtension(deckFiles[i]);
if (decks[i].userId != MyCard.account.user.id.ToString())
{
decksNeedUpload.Add(deckName, decks[i]);
continue;
}
var type = Path.GetFileName(Path.GetDirectoryName(deckFiles[i]));
if (type == "Deck" && type == Path.GetDirectoryName(deckFiles[i]))
type = string.Empty;
decks[i].type = type;
bool deckIdFound = false;
foreach (var od in OnlineDeck.decks)
......@@ -292,15 +293,13 @@ namespace MDPro3.Servant
if (od.deckId == decks[i].deckId)
{
deckIdFound = true;
localFoundIds.Add(od.deckId);
if (od.isDelete)
{
Debug.LogFormat("Deck Delete: [{0}]", deckName);
File.Delete(deckFiles[i]);
}
else
{
localFoundIds.Add(od.deckId);
var fileInfo = new FileInfo(deckFiles[i]);
var serverTime = od.GetUpdateUtcTime();
var diff = serverTime - fileInfo.LastWriteTimeUtc;
......@@ -314,10 +313,13 @@ namespace MDPro3.Servant
else
decksNeedUpdateFromServer.Add(deckName, decks[i]);
}
if(deckName != od.deckName && !decksNeedUpdateFromServer.Keys.Contains(deckName))
decksNeedUpdateFromServer.Add(deckName, decks[i]);
}
break;
}
}
if (!deckIdFound)
decksNeedUpload.Add(deckName, decks[i]);
}
......@@ -337,29 +339,35 @@ namespace MDPro3.Servant
Debug.LogFormat("卡组[{0}]需要更新。", deck.Key);
var od = OnlineDeck.GetByID(deck.Value.deckId);
var oldPath = Program.PATH_DECK + deck.Key + Program.EXPANSION_YDK;
if (oldPath != od.deckName)
var oldPath = Program.PATH_DECK + (deck.Value.type == string.Empty ? string.Empty : $"{deck.Value.type}/") + deck.Key + Program.EXPANSION_YDK;
if (deck.Key != od.deckName || deck.Value.type != od.deckType)
File.Delete(oldPath);
var newPath = Program.PATH_DECK + od.deckName + Program.EXPANSION_YDK;
var newPath = Program.PATH_DECK + (od.deckType == string.Empty ? string.Empty : $"{od.deckType}/") + od.deckName + Program.EXPANSION_YDK;
File.WriteAllText(newPath, od.deckYdk);
File.SetLastWriteTimeUtc(newPath, od.GetUpdateUtcTime());
}
//下载本地ID不存在的服务器卡组
//OnlineDeck.UploadDecks() 会刷新OnlineDeck.decks,因此本功能需要在[上传没有Id的本地卡组]之前执行
List<OnlineDeck.OnlineDeckData> odtd = new List<OnlineDeck.OnlineDeckData>();
foreach (var od in OnlineDeck.decks)
if (!od.isDelete)
if (!localFoundIds.Contains(od.deckId))
odtd.Add(od);
var odtd = OnlineDeck.decks
.Where(od => !od.isDelete && !localFoundIds.Contains(od.deckId))
.ToList();
foreach (var deck in odtd)
{
Debug.LogFormat("卡组[{0}]需要下载。{1}", deck.deckName, deck.isDelete);
var path = Program.PATH_DECK + (deck.deckType == string.Empty ? string.Empty : $"{deck.deckType}/") + deck.deckName + Program.EXPANSION_YDK;
if (File.Exists(path))
{
Debug.Log($"删除服务器同名卡组 [{deck.deckType}/{deck.deckName}] [{deck.deckId}]。");
_ = OnlineDeck.DeleteDecks(new List<string> { deck.deckId });
continue;
}
Debug.Log($"卡组[{deck.deckName}] [{deck.deckId}]需要下载。");
var d = new Deck(deck.deckYdk, string.Empty, string.Empty);
d.userId = MyCard.account.user.id.ToString();
d.deckId = deck.deckId;
d.Save(deck.deckName, deck.GetUpdateUtcTime());
var d = new Deck(deck.deckYdk, deck.deckId, MyCard.account.user.username)
{
type = deck.deckType
};
d.Save(Path.GetFileName(deck.deckName), deck.GetUpdateUtcTime(), false);
}
//上传没有Id的本地卡组
......
......@@ -176,7 +176,9 @@ namespace MDPro3.Servant
if (fromDuel)
{
servantUI.ShowEvent();
DOTween.To(v => { }, 0, 0, Program.instance.ocgcore.TransitionTime).OnComplete(() =>
DOTween.To(v => { }, 0, 0, Program.instance.ocgcore.TransitionTime)
.SetUpdate(true)
.OnComplete(() =>
{
servantUI.gameObject.SetActive(true);
inTransition = false;
......@@ -237,7 +239,9 @@ namespace MDPro3.Servant
if (toDuel)
{
DOTween.To(v => { }, 0, 0, TransitionTime).OnComplete(() =>
DOTween.To(v => { }, 0, 0, TransitionTime)
.SetUpdate(true)
.OnComplete(() =>
{
servantUI.ShutDown();
inTransition = false;
......@@ -246,7 +250,9 @@ namespace MDPro3.Servant
else
{
servantUI.Hide(nextDepth > Depth);
DOTween.To(v => { }, 0, 0, TransitionTime).OnComplete(() =>
DOTween.To(v => { }, 0, 0, TransitionTime)
.SetUpdate(true)
.OnComplete(() =>
{
inTransition = false;
AfterHidingEvent();
......
using MDPro3.Utility;
using Newtonsoft.Json;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
......@@ -351,5 +352,22 @@ namespace MDPro3
#endregion
#region Json
public static string FormatJsonString(string jsonString)
{
try
{
var obj = JsonConvert.DeserializeObject(jsonString);
return JsonConvert.SerializeObject(obj, Formatting.Indented);
}
catch
{
return jsonString;
}
}
#endregion
}
}
......@@ -17,6 +17,7 @@ namespace MDPro3.UI.Popup
base.InitializeSelections();
input.GetComponent<TmpInputValidation>().type = validationType;
input.text = args[1];
input.ActivateInputField();
}
protected override void OnCancel()
......
......@@ -49,7 +49,7 @@ namespace MDPro3.UI.Popup
var tasks = new List<string[]>();
for (int i = 2; i < args.Count; i++)
{
var task = new string[] { args[i] };
var task = args[i].Split(":");
tasks.Add(task);
}
superScrollView.Print(tasks);
......@@ -61,7 +61,15 @@ namespace MDPro3.UI.Popup
private void ItemOnListRefresh(string[] task, GameObject item)
{
var handler = item.GetComponent<SelectionToggle_PopupSelectionItem>();
handler.selection = task[0];
if(task.Length == 2)
{
handler.color = task[0];
handler.selection = task[1];
}
else
{
handler.selection = task[0];
}
handler.clickAction = OnClick;
handler.manager = this;
handler.Refresh();
......
......@@ -69,7 +69,7 @@ namespace MDPro3.UI
private const string LABEL_TXT_BUTTONTEXT = "ButtonText";
private TextMeshProUGUI m_ButtonText;
private TextMeshProUGUI ButtonText =>
protected TextMeshProUGUI ButtonText =>
m_ButtonText = m_ButtonText != null ? m_ButtonText
: Manager.GetElement<TextMeshProUGUI>(LABEL_TXT_BUTTONTEXT);
......@@ -446,6 +446,19 @@ namespace MDPro3.UI
return string.Empty;
}
public virtual void SetButtonTextColor(Color color)
{
if (ButtonText != null)
ButtonText.color = color;
}
public virtual Color GetButtonTextColor()
{
if (ButtonText != null)
return ButtonText.color;
return Color.white;
}
public virtual Sprite GetIconSprite()
{
if(Icon != null)
......@@ -459,6 +472,12 @@ namespace MDPro3.UI
Icon.sprite = sprite;
}
public virtual void ShowIcon(bool show)
{
if(Icon != null)
Icon.gameObject.SetActive(show);
}
public virtual void SetHoverOnEvent(UnityAction call)
{
hoverEvent.onHoverOn.AddListener(call);
......
......@@ -102,7 +102,10 @@ namespace MDPro3.UI
await UniTask.WaitWhile(() => Program.instance.deckSelector.inTransition);
for (int i = 0; i < transform.GetSiblingIndex(); i++)
await UniTask.Yield();
await UniTask.Yield(cancellationToken: destroyCancellationToken);
if (gameObject == null)
return;
var sprite = await Program.items.LoadDeckCaseIconAsync(deckCase, "_L_SD");
if (sprite != null)
......@@ -187,7 +190,7 @@ namespace MDPro3.UI
else
{
AudioManager.PlaySE(SoundLabelClick);
Config.SetConfigDeck(deckName);
Config.SetConfigDeck(deckName, true);
if (DeckSelector.condition == DeckSelector.Condition.ForEdit)
{
Program.instance.deckEditor.SwitchCondition(DeckEditor.Condition.EditDeck);
......
......@@ -2,18 +2,36 @@ using MDPro3.UI;
using System;
using UnityEngine;
using UnityEngine.Events;
using YgomSystem.UI;
namespace MDPro3.UI.Popup
{
public class SelectionToggle_PopupSelectionItem : SelectionToggle_ScrollRectItem
{
public string selection;
public string color = string.Empty;
public Action clickAction;
public PopupSelection manager;
private void SetTextColor()
{
var targetColor = Color.white;
if(color == "r")
targetColor = Color.red;
else if(color == "g")
targetColor = Color.green;
else if(color == "b")
targetColor = Color.cyan;
var ccg = ButtonText.GetComponent<ColorContainerGraphic>();
ccg.baseColor = targetColor;
SetButtonTextColor(targetColor);
}
public override void Refresh()
{
SetButtonText(selection);
SetTextColor();
RemoveAllListeners();
SetClickEvent(new UnityAction(clickAction));
}
......
......@@ -28,6 +28,7 @@ namespace MDPro3.UI
public void Show(string log)
{
log = $"[OcgCore Message]: {log}";
lastMessage = text.text;
text.text = lastMessage + Program.STRING_LINE_BREAK + log;
......
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