Skip to content

Commit

Permalink
Improved logging
Browse files Browse the repository at this point in the history
  • Loading branch information
PrashantMohta committed Mar 11, 2023
1 parent 6f9ec44 commit 83d9333
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 24 deletions.
13 changes: 0 additions & 13 deletions CustomKnight/DebugLogger.cs

This file was deleted.

2 changes: 1 addition & 1 deletion CustomKnight/Skin/Base/SelectableSkin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ public string GetCinematicUrl(string CinematicName){
if(File.Exists(file+".webm")){
path = file+".webm";
}
CustomKnight.Instance.Log("[getCine]"+CinematicName+":"+path);
CustomKnight.Instance.LogFine("[GetCinematicUrl]" + CinematicName+":"+path);
return path;
}

Expand Down
10 changes: 5 additions & 5 deletions CustomKnight/Skin/Base/Skinable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,23 @@ public virtual void prepare(){}
/// Wrapper Method for SaveDefaultTexture, used for logging.
/// </summary>
public void SaveTexture(){
DebugLogger.Log($"SaveTexture skinable {name}");
CustomKnight.Instance.LogFine($"SaveTexture skinable {name}");
SaveDefaultTexture();
}

/// <summary>
/// Wrapper Method for ApplyTexture, used for logging.
/// </summary>
public void Apply(){
DebugLogger.Log($"Apply skinable {name}");
CustomKnight.Instance.LogFine($"Apply skinable {name}");
ApplyTexture(ckTex.currentTexture);
}

/// <summary>
/// Wrapper Method for ApplyTexture, used for Resetting the skin to default texture.
/// </summary>
public virtual void Reset(){
DebugLogger.Log($"Reset skinable {name}");
CustomKnight.Instance.LogFine($"Reset skinable {name}");
ApplyTexture(ckTex.defaultTex);
}

Expand Down Expand Up @@ -166,7 +166,7 @@ public override void ApplyTexture(Texture2D tex){
if(!ckTex.missing){
ApplySprite(Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f), ckTex.defaultSprite.pixelsPerUnit));
} else {
DebugLogger.Log($"Missing Sprite for skinable {name}");
CustomKnight.Instance.Log($"Missing Sprite for skinable {name}");
Reset();
}
}
Expand All @@ -176,7 +176,7 @@ public override void ApplyTexture(Texture2D tex){
/// </summary>
public abstract void ApplySprite(Sprite sprite);
public override void Reset(){
DebugLogger.Log($"Reset skinable {name}");
CustomKnight.Instance.LogFine($"Reset skinable {name}");
ApplySprite(ckTex.defaultSprite);
}
}
Expand Down
2 changes: 1 addition & 1 deletion CustomKnight/Skin/Cinematics/CinematicsManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public string GetCinematicUrl(string CinematicName){
if(File.Exists(file+".webm")){
path = file+".webm";
}
CustomKnight.Instance.Log("[getCine]"+CinematicName+":"+path);
CustomKnight.Instance.LogFine("[GetCinematicUrl]" + CinematicName+":"+path);
return path;
}

Expand Down
4 changes: 2 additions & 2 deletions CustomKnight/Skin/Swapper/DumpManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ internal IEnumerator walkScenes(){
try{
AsyncOperation asyncLoad = loadScene(i);
} catch(Exception e){
Modding.Logger.Log($"error in dumpng scene {i} with {e.ToString()}");
CustomKnight.Instance.Log($"Error in dumpng scene {i} with {e.ToString()}");
}
yield return new WaitForSeconds(5);
dumpAllSprites();
Expand All @@ -178,7 +178,7 @@ internal IEnumerator walkScenes(){
UnityEngine.SceneManagement.SceneManager.UnloadSceneAsync(i);
}
} catch(Exception e){
Modding.Logger.Log($"error in dumpng scene {i} with {e.ToString()}");
CustomKnight.Instance.Log($"error in dumpng scene {i} with {e.ToString()}");
}
i++;
}
Expand Down
4 changes: 2 additions & 2 deletions CustomKnight/Skin/Swapper/SwapManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ private void SwapSkinForGo(string objectPath,GameObject GO){
if(anim != null || SpecialCases.childSpriteAnimatedByParent(objectPath)){
//maybe animated things can be replaced with a single sprite
if(anim != null){
CustomKnight.Instance.Log($"Animation : {anim.name}");
this.LogFine($"Animation : {anim.name}");
}
var behaviour = GO.GetAddComponent<SpriteRendererMaterialPropertyBlock>();
MaterialPropertyBlock block = new MaterialPropertyBlock();
Expand All @@ -152,7 +152,7 @@ private void SwapSkinForGo(string objectPath,GameObject GO){
} else {
//currentSkinnedSceneObjs.Add(objectPath); re add sprites for a while
//some sprites are still not perfectly matched
CustomKnight.Instance.Log($"game object : {sr.name} ");
this.LogFine($"game object : {sr.name} ");
var pivot = new Vector2(0.5f, 0.5f); // this needs offset sometimes
sr.sprite = Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), pivot ,sr.sprite.pixelsPerUnit);
//Log($"pivot post application {sr.sprite.pivot/new Vector2(tex.width, tex.height)}");
Expand Down

0 comments on commit 83d9333

Please sign in to comment.