Commit 6a82457d authored by SherryChaos's avatar SherryChaos

remove debug

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