-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from PrashantMohta/moreskin
Custom Knight 2.0
- Loading branch information
Showing
61 changed files
with
2,481 additions
and
1,455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
|
||
using Modding; | ||
using UnityEngine; | ||
using CustomKnight; | ||
using System; | ||
|
||
namespace AsymmetricalKnight{ | ||
public class Asymmetrical { | ||
public string name; | ||
public Texture2D leftSkin,rightSkin; | ||
|
||
public Asymmetrical(string name){ | ||
this.name = name; | ||
} | ||
|
||
public Texture2D GetTexture(ISelectableSkin skin, bool isLeft){ | ||
if(rightSkin == null){ | ||
rightSkin = skin.Exists($"{name}.png") ? skin.GetTexture($"{name}.png") : null; | ||
} | ||
if(leftSkin == null){ | ||
leftSkin = skin.Exists($"{name}_left.png") ? skin.GetTexture($"{name}_left.png") : rightSkin; | ||
} | ||
if(isLeft){ | ||
return leftSkin; | ||
} else { | ||
return rightSkin; | ||
} | ||
} | ||
|
||
|
||
} | ||
public class AsymmetricalKnight : Mod { | ||
new public string GetName() => "Asymmetrical Knight"; | ||
public override string GetVersion() => "v1"; | ||
public bool isCustomKnightInstalled(){ | ||
return ModHooks.GetMod("CustomKnight") is Mod; | ||
} | ||
public void AddCustomKnightHandlers(){ | ||
SkinManager.OnSetSkin += (_,e) => { | ||
var skin = SkinManager.GetCurrentSkin(); | ||
var currDirIsLeft = HeroController.instance.transform.localScale.x < 0; | ||
|
||
if(lastSkin != skin.GetId()){ | ||
Knight = new Asymmetrical(CustomKnight.Knight.NAME); | ||
Sprint = new Asymmetrical(CustomKnight.Sprint.NAME); | ||
Unn = new Asymmetrical(CustomKnight.Unn.NAME); | ||
Knight.GetTexture(skin,currDirIsLeft); | ||
Unn.GetTexture(skin,currDirIsLeft); | ||
Sprint.GetTexture(skin,currDirIsLeft); | ||
lastSkin = skin.GetId(); | ||
} | ||
}; | ||
} | ||
public override void Initialize() | ||
{ | ||
if(isCustomKnightInstalled()){ //do not do anything with ck if ck is not installed | ||
ModHooks.HeroUpdateHook += UpdateSkin; | ||
AddCustomKnightHandlers(); | ||
} else { | ||
Log("Custom Knight not found, doing nothing!"); | ||
} | ||
} | ||
|
||
Asymmetrical Knight; | ||
Asymmetrical Sprint; | ||
Asymmetrical Unn; | ||
string lastSkin = ""; | ||
bool lastDirWasLeft = false; | ||
public void UpdateSkin(){ | ||
var skin = SkinManager.GetCurrentSkin(); | ||
var currDirIsLeft = HeroController.instance.transform.localScale.x > 0; | ||
|
||
if(lastSkin != skin.GetId()){ | ||
Knight = new Asymmetrical(CustomKnight.Knight.NAME); | ||
Sprint = new Asymmetrical(CustomKnight.Sprint.NAME); | ||
Unn = new Asymmetrical(CustomKnight.Unn.NAME); | ||
Knight.GetTexture(skin,currDirIsLeft); | ||
Unn.GetTexture(skin,currDirIsLeft); | ||
Sprint.GetTexture(skin,currDirIsLeft); | ||
lastSkin = skin.GetId(); | ||
} | ||
|
||
if(currDirIsLeft != lastDirWasLeft){ | ||
var knight = Knight.GetTexture(skin,currDirIsLeft); | ||
var unn = Unn.GetTexture(skin,currDirIsLeft); | ||
var sprint = Sprint.GetTexture(skin,currDirIsLeft); | ||
if(knight != null){ | ||
SkinManager.Skinables[CustomKnight.Knight.NAME].ApplyTexture(knight); | ||
} | ||
if(sprint != null){ | ||
SkinManager.Skinables[CustomKnight.Sprint.NAME].ApplyTexture(sprint); | ||
} | ||
if(unn != null){ | ||
SkinManager.Skinables[CustomKnight.Unn.NAME].ApplyTexture(unn); | ||
} | ||
lastDirWasLeft = currDirIsLeft; | ||
} | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>AsymmetricKnight</RootNamespace> | ||
<AssemblyName>AsymmetricKnight</AssemblyName> | ||
<AssemblyVersion>1.0.0</AssemblyVersion> | ||
<TargetFramework>net472</TargetFramework> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
<LangVersion>latest</LangVersion> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>CS1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<VanillaFiles>..\..\..\Vanilla</VanillaFiles> | ||
<ModdingAPi>..\..\..\HollowKnight.Modding\OutputFinal</ModdingAPi> | ||
<HollowKnightModsDirectory>..\..\..\linkedtoHKMods</HollowKnightModsDirectory> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>$(ModdingAPi)\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MMHOOK_Assembly-CSharp"> | ||
<HintPath>$(ModdingAPi)\MMHOOK_Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MMHOOK_PlayMaker"> | ||
<HintPath>$(ModdingAPi)\MMHOOK_PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="PlayMaker"> | ||
<HintPath>$(VanillaFiles)\PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="PlayMaker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AnimationModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.AnimationModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.InputLegacyModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.InputLegacyModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>$(VanillaFiles)\UnityEngine.ImageConversionModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.IMGUIModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.IMGUIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.Physics2DModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.TextRenderingModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ParticleSystemModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.ParticleSystemModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Satchel"> | ||
<HintPath>..\..\..\Satchel\bin\Debug\Satchel.dll</HintPath> | ||
</Reference> | ||
<Reference Include="CustomKnight"> | ||
<HintPath>..\..\CustomKnight\bin\Debug\net472\CustomKnight.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Copy SourceFiles="$(TargetPath);$(TargetDir)$(TargetName).pdb;$(TargetDir)$(TargetName).xml" DestinationFolder="$(HollowKnightModsDirectory)\$(TargetName)" SkipUnchangedFiles="true" /> | ||
</Target> | ||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
using Modding; | ||
using UnityEngine; | ||
using CustomKnight; | ||
using Satchel; | ||
using System; | ||
using System.Collections; | ||
using System.Collections.Generic; | ||
|
||
namespace SkinProvider{ | ||
public class EmbeddedSkin : ISelectableSkin{ | ||
public string SkinName = "EmbeddedSkin"; | ||
public Dictionary<string,Texture2D> textures = new(); | ||
public Dictionary<string,Texture2D> Alttextures = new(); | ||
|
||
public bool isAlt = false; | ||
public EmbeddedSkin() { | ||
textures["Knight.png"] = AssemblyUtils.GetTextureFromResources("Knight.png"); | ||
textures["Sprint.png"] = AssemblyUtils.GetTextureFromResources("Sprint.png"); | ||
Alttextures["Knight.png"] = AssemblyUtils.GetTextureFromResources("AKnight.png"); | ||
Alttextures["Sprint.png"] = AssemblyUtils.GetTextureFromResources("ASprint.png"); | ||
} | ||
|
||
public bool shouldCache() => false; | ||
public string GetId() => SkinName; | ||
public string GetName() => SkinName; | ||
public bool hasSwapper() => false; | ||
public string getSwapperPath() => ""; | ||
|
||
public bool Exists(string FileName){ | ||
return isAlt? Alttextures.ContainsKey(FileName) : textures.ContainsKey(FileName); | ||
} | ||
public Texture2D GetTexture(string FileName){ | ||
Texture2D texture = null; | ||
try{ | ||
texture = isAlt? Alttextures[FileName] : textures[FileName]; | ||
} catch(Exception e){ | ||
Modding.Logger.Log(e.ToString()); | ||
} | ||
return texture; | ||
} | ||
} | ||
public class SkinProvider : Mod { | ||
new public string GetName() => "Skin Provider"; | ||
public override string GetVersion() => "v1"; | ||
|
||
public EmbeddedSkin Skin = new EmbeddedSkin(); | ||
public override void Initialize() | ||
{ | ||
CustomKnight.CustomKnight.OnReady += (_,e)=>{ | ||
SkinManager.AddSkin(Skin); | ||
}; | ||
ModHooks.HeroUpdateHook += ()=>{ | ||
if(Input.GetKeyDown(KeyCode.O)){ | ||
Skin.isAlt = !Skin.isAlt; | ||
SkinManager.RefreshSkin(true); | ||
} | ||
}; | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<OutputType>Library</OutputType> | ||
<RootNamespace>SkinProvider</RootNamespace> | ||
<AssemblyName>SkinProvider</AssemblyName> | ||
<AssemblyVersion>1.0.0</AssemblyVersion> | ||
<TargetFramework>net472</TargetFramework> | ||
<FileAlignment>512</FileAlignment> | ||
<Deterministic>true</Deterministic> | ||
<LangVersion>latest</LangVersion> | ||
<GenerateDocumentationFile>true</GenerateDocumentationFile> | ||
<NoWarn>CS1591</NoWarn> | ||
</PropertyGroup> | ||
|
||
<PropertyGroup> | ||
<VanillaFiles>..\..\..\Vanilla</VanillaFiles> | ||
<ModdingAPi>..\..\..\HollowKnight.Modding\OutputFinal</ModdingAPi> | ||
<HollowKnightModsDirectory>..\..\..\linkedtoHKMods</HollowKnightModsDirectory> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Reference Include="Assembly-CSharp"> | ||
<HintPath>$(ModdingAPi)\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MMHOOK_Assembly-CSharp"> | ||
<HintPath>$(ModdingAPi)\MMHOOK_Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="MMHOOK_PlayMaker"> | ||
<HintPath>$(ModdingAPi)\MMHOOK_PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="PlayMaker"> | ||
<HintPath>$(VanillaFiles)\PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="PlayMaker, Version=1.6.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\PlayMaker.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Xml.Linq" /> | ||
<Reference Include="System.Data.DataSetExtensions" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="UnityEngine"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.CoreModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.CoreModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.AnimationModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.AnimationModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.InputLegacyModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.InputLegacyModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL"> | ||
<SpecificVersion>False</SpecificVersion> | ||
<HintPath>$(VanillaFiles)\UnityEngine.ImageConversionModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.IMGUIModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.IMGUIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.Physics2DModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.TextRenderingModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.TextRenderingModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UIModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.UIModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.ParticleSystemModule"> | ||
<HintPath>$(VanillaFiles)\UnityEngine.ParticleSystemModule.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Satchel"> | ||
<HintPath>..\..\..\Satchel\bin\Debug\Satchel.dll</HintPath> | ||
</Reference> | ||
<Reference Include="CustomKnight"> | ||
<HintPath>..\..\CustomKnight\bin\Debug\net472\CustomKnight.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<EmbeddedResource Include="Skin\Knight.png" /> | ||
<EmbeddedResource Include="Skin\Sprint.png" /> | ||
<EmbeddedResource Include="Skin\AKnight.png" /> | ||
<EmbeddedResource Include="Skin\ASprint.png" /> | ||
</ItemGroup> | ||
|
||
<Target Name="PostBuild" AfterTargets="PostBuildEvent"> | ||
<Copy SourceFiles="$(TargetPath);$(TargetDir)$(TargetName).pdb;$(TargetDir)$(TargetName).xml" DestinationFolder="$(HollowKnightModsDirectory)\$(TargetName)" SkipUnchangedFiles="true" /> | ||
</Target> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.