Commit 6a82457d authored by SherryChaos's avatar SherryChaos

remove debug

parent ad88a144
......@@ -238,7 +238,6 @@ namespace MDPro3.Servant
{
Debug.Log($"ReturnTo: {returnServant}");
Program.instance.ShiftToServant(returnServant);
}
else
{
......@@ -589,8 +588,6 @@ namespace MDPro3.Servant
{
if (manual)
{
Debug.Log("mark7");
surrendered = false;
RoomServant.NeedSide = false;
RoomServant.SideWaitingObserver = false;
......
......@@ -364,7 +364,6 @@ namespace MDPro3.UI.ServantUI
ShowPopupInput(selections, OnSaveReplay, OnGiveUpReplay, InputValidation.ValidationType.Path);
}
private void OnSaveReplay(string replayName)
{
TcpHelper.SaveRecord(replayName);
......
......@@ -69,6 +69,7 @@ namespace MDPro3.Utility
bool persistent = false,
CancellationToken token = default)
{
var lockObj = artLoadingLocks.GetOrAdd(code, _ => new SemaphoreSlim(1, 1));
await lockObj.WaitAsync(token);
......@@ -76,15 +77,18 @@ namespace MDPro3.Utility
{
if (cachedArts.TryGetValue(code, out var entry))
{
if (entry.LoadingTask != null)
await entry.LoadingTask.AsUniTask().AttachExternalCancellation(token);
if (entry.Texture != null)
{
Interlocked.Increment(ref entry.ReferenceCount);
entry.IsPersistent |= persistent;
}
else
Debug.LogError($"Art texture is null for code {code}");
return entry.Texture;
}
......@@ -95,6 +99,7 @@ namespace MDPro3.Utility
if (cachedArts.TryAdd(code, newEntry))
{
newEntry.ReferenceCount = 1;
newEntry.IsPersistent = persistent;
try
......@@ -107,7 +112,7 @@ namespace MDPro3.Utility
throw ex;
}
if (newEntry.Texture == null)
Debug.Log($"{code} art is null");
Debug.LogError($"{code} art is null");
newEntry.LoadingTask = null;
return newEntry.Texture;
......@@ -151,7 +156,6 @@ namespace MDPro3.Utility
{
var lockObj = cardLoadingLocks.GetOrAdd(code, _ => new SemaphoreSlim(1, 1));
await lockObj.WaitAsync(token);
try
{
if (!CardRenderer.CardHasVideoArt(code) || forceTexture)
......@@ -189,18 +193,17 @@ namespace MDPro3.Utility
throw ex;
}
newEntry.LoadingTask = null;
return newEntry.Texture;
}
else
{
Debug.LogError("CardImageLoader: Unexpected Errror.");
Debug.LogError("CardImageLoader: Unexpected Error.");
return null;
}
}
else
{
if(cachedVideoCards.TryGetValue(code, out var tex))
if (cachedVideoCards.TryGetValue(code, out var tex))
return tex;
Texture texture = null;
texture = await InternalLoadVideoCardAsync(code, token);
......@@ -290,6 +293,7 @@ namespace MDPro3.Utility
lastCardFoundArt = false;
return null;
}
if (needCrop)
art = CropCardToArt(art, code);
return art;
......@@ -320,7 +324,10 @@ namespace MDPro3.Utility
}
return DownloadHandlerTexture.GetContent(request);
}
finally { artSemaphore.Release(); }
finally
{
artSemaphore.Release();
}
}
private static async Task<Texture2D> InternalLoadCardAsync(
......@@ -333,6 +340,7 @@ namespace MDPro3.Utility
try
{
var data = CardsManager.Get(code, true);
if (data.Id == 0)
{
......@@ -346,7 +354,7 @@ namespace MDPro3.Utility
if (art == null)
{
Debug.Log($"Get null from ArtLoad for Card {data.Id}:");
Debug.LogError($"Get null from ArtLoad for Card {data.Id}:");
art = TextureManager.container.unknownArt.texture;
}
if (!Program.instance.cardRenderer.RenderCard(code, art))
......@@ -361,6 +369,7 @@ namespace MDPro3.Utility
returnValue.Apply();
returnValue.name = "Card_" + code;
ReleaseArt(code);
return returnValue;
}
finally { cardSemaphore.Release(); }
......@@ -382,14 +391,13 @@ namespace MDPro3.Utility
lastCardRenderSucceed = false;
return TextureManager.container.unknownCard.texture;
}
var art = await LoadArtAsync(code, false, token).AsUniTask().AttachExternalCancellation(token);
if (token.IsCancellationRequested)
throw new OperationCanceledException(token);
if (art == null)
{
Debug.Log($"Get null from ArtLoad for Card {data.Id}:");
Debug.LogError($"Get null from ArtLoad for Card {data.Id}:");
art = TextureManager.container.unknownArt.texture;
}
......@@ -558,7 +566,8 @@ namespace MDPro3.Utility
private static async UniTask InitializeArtFileListAsync()
{
if (artFileListInitialized) return;
await UniTask.SwitchToThreadPool();
//await UniTask.SwitchToThreadPool();
await UniTask.Yield();
var path = Program.PATH_ART;
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
......@@ -639,7 +648,6 @@ namespace MDPro3.Utility
private static async UniTask InitializeVideoArtFileListAsync()
{
if (videoArtFileListInitialized) return;
await UniTask.SwitchToThreadPool();
var path = Program.PATH_VIDEO_ART;
#if !UNITY_EDITOR && (UNITY_ANDROID || UNITY_IOS)
......@@ -652,6 +660,8 @@ namespace MDPro3.Utility
if (Directory.Exists(path))
{
//await UniTask.SwitchToThreadPool();
await UniTask.Yield();
foreach (var file in Directory.GetFiles(path, "*.mp4"))
{
var fileName = Path.GetFileNameWithoutExtension(file);
......
// Better Streaming Assets, Piotr Gwiazdowski <gwiazdorrr+github at gmail.com>, 2017
// Better Streaming Assets, Piotr Gwiazdowski <gwiazdorrr+github at gmail.com>, 2017
using System;
using System.Collections.Generic;
......@@ -642,12 +642,12 @@ public static partial class BetterStreamingAssets
}
else
{
Debug.LogAssertionFormat($"BetterStreamingAssets: file {fileName} is where Streaming Assets are put, but is compressed. " +
$"If this is a App Bundle build, see README.md for a possible workaround. " +
$"If this file is not a Streaming Asset (has been on purpose by hand or by another plug-in), handle " +
$"{nameof(CompressedStreamingAssetFound)} event or implement " +
$"{nameof(AndroidIsCompressedFileStreamingAsset)} partial method to prevent " +
$"this message from appearing again. ");
//Debug.LogAssertionFormat($"BetterStreamingAssets: file {fileName} is where Streaming Assets are put, but is compressed. " +
// $"If this is a App Bundle build, see README.md for a possible workaround. " +
// $"If this file is not a Streaming Asset (has been on purpose by hand or by another plug-in), handle " +
// $"{nameof(CompressedStreamingAssetFound)} event or implement " +
// $"{nameof(AndroidIsCompressedFileStreamingAsset)} partial method to prevent " +
// $"this message from appearing again. ");
}
}
#endif
......
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