-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7aba6f6
commit 1ccce06
Showing
6 changed files
with
287 additions
and
0 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,15 @@ | ||
using HarmonyLib; | ||
|
||
using ChaCustom; | ||
|
||
namespace KK_MakerSearch | ||
{ | ||
public static class Hooks | ||
{ | ||
[HarmonyPostfix, HarmonyPatch(typeof(CustomControl), "Initialize")] | ||
public static void CustomControl_Initialize_CreateUI() | ||
{ | ||
Tools.CreateUI(); | ||
} | ||
} | ||
} |
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,21 @@ | ||
using BepInEx; | ||
|
||
using HarmonyLib; | ||
|
||
namespace KK_MakerSearch | ||
{ | ||
[BepInProcess("Koikatu")] | ||
[BepInPlugin(nameof(KK_MakerSearch), nameof(KK_MakerSearch), VERSION)] | ||
public class KK_MakerSearch : BaseUnityPlugin | ||
{ | ||
public const string VERSION = "1.0.0"; | ||
|
||
public static string searchString; | ||
|
||
private void Awake() | ||
{ | ||
var harmony = new Harmony(nameof(KK_MakerSearch)); | ||
harmony.PatchAll(typeof(Hooks)); | ||
} | ||
} | ||
} |
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,79 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" /> | ||
<PropertyGroup> | ||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | ||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> | ||
<ProjectGuid>{11AEB17D-AC34-4749-A8E6-79C37003828A}</ProjectGuid> | ||
<OutputType>Library</OutputType> | ||
<AppDesignerFolder>Properties</AppDesignerFolder> | ||
<RootNamespace>KK_MakerSearch</RootNamespace> | ||
<AssemblyName>KK_MakerSearch</AssemblyName> | ||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion> | ||
<FileAlignment>512</FileAlignment> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugSymbols>true</DebugSymbols> | ||
<DebugType>full</DebugType> | ||
<Optimize>false</Optimize> | ||
<OutputPath>bin\Debug\</OutputPath> | ||
<DefineConstants>DEBUG;TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> | ||
<PlatformTarget>AnyCPU</PlatformTarget> | ||
<DebugType>none</DebugType> | ||
<Optimize>true</Optimize> | ||
<OutputPath>../_bin/KK/BepInEx/plugins/2155X/</OutputPath> | ||
<DefineConstants>TRACE</DefineConstants> | ||
<ErrorReport>prompt</ErrorReport> | ||
<WarningLevel>4</WarningLevel> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<Reference Include="0Harmony, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\BepInEx\core\0Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\Koikatu_Data\Managed\Assembly-CSharp.dll</HintPath> | ||
</Reference> | ||
<Reference Include="BepInEx, Version=5.1.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\BepInEx\core\BepInEx.dll</HintPath> | ||
</Reference> | ||
<Reference Include="BepInEx.Harmony, Version=2.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\BepInEx\core\BepInEx.Harmony.dll</HintPath> | ||
</Reference> | ||
<Reference Include="System" /> | ||
<Reference Include="System.Core" /> | ||
<Reference Include="System.Data" /> | ||
<Reference Include="System.Xml" /> | ||
<Reference Include="TextMeshPro-1.0.55.56.0b12, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\Koikatu_Data\Managed\TextMeshPro-1.0.55.56.0b12.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\Koikatu_Data\Managed\UnityEngine.dll</HintPath> | ||
</Reference> | ||
<Reference Include="UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\Koikatu_Data\Managed\UnityEngine.UI.dll</HintPath> | ||
</Reference> | ||
<Reference Include="XUnity.AutoTranslator.Plugin.Core, Version=4.11.1.0, Culture=neutral, PublicKeyToken=null"> | ||
<HintPath>..\..\..\..\..\..\media\illusion\Koikatu\BepInEx\plugins\XUnity.AutoTranslator\XUnity.AutoTranslator.Plugin.Core.dll</HintPath> | ||
</Reference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<Compile Include="Hooks.cs" /> | ||
<Compile Include="KK_MakerSearch.cs" /> | ||
<Compile Include="Properties\AssemblyInfo.cs" /> | ||
<Compile Include="Tools.cs" /> | ||
</ItemGroup> | ||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> | ||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it. | ||
Other similar extension points exist, see Microsoft.Common.targets. | ||
<Target Name="BeforeBuild"> | ||
</Target> | ||
<Target Name="AfterBuild"> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using System.Reflection; | ||
using System.Runtime.InteropServices; | ||
|
||
// General Information about an assembly is controlled through the following | ||
// set of attributes. Change these attribute values to modify the information | ||
// associated with an assembly. | ||
[assembly: AssemblyTitle("KK_MakerSearch")] | ||
[assembly: AssemblyDescription("")] | ||
[assembly: AssemblyConfiguration("")] | ||
[assembly: AssemblyCompany("Mantas-2155X aka 2155X")] | ||
[assembly: AssemblyProduct("KK_MakerSearch")] | ||
[assembly: AssemblyCopyright("Copyright © 2020")] | ||
[assembly: AssemblyTrademark("")] | ||
[assembly: AssemblyCulture("")] | ||
|
||
// Setting ComVisible to false makes the types in this assembly not visible | ||
// to COM components. If you need to access a type in this assembly from | ||
// COM, set the ComVisible attribute to true on that type. | ||
[assembly: ComVisible(false)] | ||
|
||
// The following GUID is for the ID of the typelib if this project is exposed to COM | ||
[assembly: Guid("11AEB17D-AC34-4749-A8E6-79C37003828A")] | ||
|
||
// Version information for an assembly consists of the following four values: | ||
// | ||
// Major Version | ||
// Minor Version | ||
// Build Number | ||
// Revision | ||
// | ||
// You can specify all the values or you can default the Build and Revision Numbers | ||
// by using the '*' as shown below: | ||
// [assembly: AssemblyVersion("1.0.*")] | ||
[assembly: AssemblyVersion(KK_MakerSearch.KK_MakerSearch.VERSION)] | ||
[assembly: AssemblyFileVersion(KK_MakerSearch.KK_MakerSearch.VERSION)] |
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,131 @@ | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using HarmonyLib; | ||
|
||
using ChaCustom; | ||
using TMPro; | ||
|
||
using UnityEngine; | ||
|
||
namespace KK_MakerSearch | ||
{ | ||
public static class Tools | ||
{ | ||
private static List<TMP_InputField> fields; | ||
|
||
public static void CreateUI() | ||
{ | ||
fields = new List<TMP_InputField>(); | ||
|
||
var parent = GameObject.Find("CustomScene/CustomRoot/FrontUIGroup/CustomUIGroup/CvsMenuTree"); | ||
var inputField = parent.transform.Find("02_HairTop/tglFront/FrontTop/sldTemp/InputField"); | ||
|
||
// Hair | ||
{ | ||
var hairObj = parent.transform.Find("02_HairTop"); | ||
var hair = hairObj.GetComponent<CustomChangeHairMenu>(); | ||
|
||
var cvsHair = Traverse.Create(hair).Field("cvsHair").GetValue<CvsHair[]>(); | ||
|
||
foreach (var ctrl in cvsHair) | ||
{ | ||
var window = ctrl.transform.Find("winHairKind/customSelectWindow"); | ||
SetupSearchBar(window, inputField, ctrl); | ||
} | ||
|
||
var cvsHairEtc = hairObj.Find("tglEtc/EtcTop").GetComponent<CvsHairEtc>(); | ||
SetupSearchBar(cvsHairEtc.transform.Find("winGlossKind/customSelectWindow"), inputField, cvsHairEtc); | ||
} | ||
|
||
// Clothes | ||
{ | ||
var clothesObj = parent.transform.Find("03_ClothesTop"); | ||
var clothes = clothesObj.GetComponent<CustomChangeClothesMenu>(); | ||
|
||
var cvsClothes = Traverse.Create(clothes).Field("cvsClothes").GetValue<CvsClothes[]>(); | ||
|
||
foreach (var ctrl in cvsClothes) | ||
{ | ||
for (var i = 0; i < ctrl.transform.childCount; i++) | ||
{ | ||
var child = ctrl.transform.GetChild(i); | ||
|
||
if(!child.name.Contains("win") && !child.name.Contains("Kind")) | ||
continue; | ||
|
||
var window = child.Find("customSelectWindow"); | ||
SetupSearchBar(window, inputField, ctrl); | ||
} | ||
} | ||
} | ||
|
||
// Accessories | ||
{ | ||
var accessoryObj = parent.transform.Find("04_AccessoryTop"); | ||
var accessory = accessoryObj.GetComponent<CustomAcsChangeSlot>(); | ||
|
||
var selectKinds = Traverse.Create(accessory).Field("customAcsSelectKind").GetValue<CustomAcsSelectKind[]>(); | ||
|
||
foreach (var kind in selectKinds) | ||
{ | ||
var window = kind.transform.Find("customSelectWindow"); | ||
SetupSearchBar(window, inputField, kind); | ||
} | ||
} | ||
} | ||
|
||
private static void SetupSearchBar(Transform window, Transform inputField, object ctrl) | ||
{ | ||
var bg = window.Find("BasePanel/imgWindowBack"); | ||
bg.GetComponent<RectTransform>().offsetMin = new Vector2(0, -10); | ||
|
||
var newInputField = Object.Instantiate(inputField.gameObject, window); | ||
newInputField.name = "Search"; | ||
|
||
var rect = newInputField.GetComponent<RectTransform>(); | ||
rect.offsetMin = new Vector2(-390, 0); | ||
rect.offsetMax = new Vector2(-10, -610); | ||
|
||
var input = newInputField.GetComponent<TMP_InputField>(); | ||
input.contentType = TMP_InputField.ContentType.Standard; | ||
input.characterLimit = 64; | ||
|
||
input.text = ""; | ||
input.textComponent.text = ""; | ||
|
||
input.characterValidation = TMP_InputField.CharacterValidation.None; | ||
input.keyboardType = TouchScreenKeyboardType.Default; | ||
|
||
var placeholder = newInputField.transform.Find("Text Area/Placeholder").GetComponent<TextMeshProUGUI>(); | ||
placeholder.text = "Search"; | ||
|
||
input.onValueChanged.RemoveAllListeners(); | ||
input.onEndEdit.RemoveAllListeners(); | ||
|
||
input.onValueChanged.AddListener(delegate(string text) { placeholder.enabled = text == ""; }); | ||
input.onEndEdit.AddListener(delegate(string text) | ||
{ | ||
KK_MakerSearch.searchString = text; | ||
//KK_MakerSearch.Search(); | ||
|
||
//> var ctrl = geti<ChaCustom.CustomSelectListCtrl>() | ||
//> var act = ctrl.onChangeItemFunc | ||
//> ctrl.Create(act) | ||
}); | ||
|
||
fields.Add(input); | ||
} | ||
|
||
public static void ResetSearch() | ||
{ | ||
if (KK_MakerSearch.searchString == "") | ||
return; | ||
|
||
//UpdateUI(AI_MakerSearch.category); | ||
KK_MakerSearch.searchString = ""; | ||
|
||
foreach (var field in fields.Where(field => field != null)) | ||
field.text = ""; | ||
} | ||
} | ||
} |
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