Skip to content

Commit

Permalink
[MO] [KKS] HScene support (#109)
Browse files Browse the repository at this point in the history
Add Outfits change button for KKS HScene
  • Loading branch information
k7a authored Oct 9, 2021
1 parent b107cee commit 4fcf961
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/MoreOutfits.Core/MoreOutfits.UI.HScene.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using System.Linq;
using System.Reflection;
using TMPro;
using UniRx;
using UnityEngine;
using UnityEngine.UI;
Expand All @@ -27,11 +28,19 @@ internal static void InitializeHSceneUI()
{
foreach (var button in hSceneProc.sprite.categoryDress.lstButton)
{
#if KK
if (button != null && button.gameObject.name == "ChangeCoordinatType")
{
var parent = button.transform.Find("CoordinatGroup/CoordinatCategory");
SetUpList(hSceneProc, parent, 0);
}
#elif KKS
if (button != null && button.gameObject.transform.parent.name == "ChangeCoordinatType")
{
var parent = button.transform.parent.Find("CoordinatGroup/CoordinatCategory");
SetUpList(hSceneProc, parent, 0);
}
#endif
}
}
else //Multi girl H
Expand Down Expand Up @@ -62,12 +71,21 @@ private static void SetUpList(HSceneProc hSceneProc, Transform parent, int femal
var viewportPos = scroll.viewport.localPosition;
scroll.viewport.localPosition = new Vector3(0f, viewportPos.y, viewportPos.z);

#if KK
var copyTarget = GameObject.Find("Canvas").transform.Find("clothesFileWindow/Window/WinRect/ListArea/Scroll View/Scrollbar Vertical").gameObject;
#elif KKS
var copyTarget = Object.FindObjectOfType<HSprite>().transform.Find("clothesFileWindow/Window/WinRect/ListArea/Scroll View/Scrollbar Vertical").gameObject;
#endif

var newScrollbar = Object.Instantiate(copyTarget, go.transform);
scroll.verticalScrollbar = newScrollbar.GetComponent<Scrollbar>();
newScrollbar.transform.SetRect(1f, 0f, 1f, 1f, 0f, 0f, 18f);
var newScrollbarPos = newScrollbar.transform.localPosition;
#if KK
newScrollbar.transform.localPosition = new Vector3(135f, newScrollbarPos.y, newScrollbarPos.z);
#elif KKS
newScrollbar.transform.localPosition = new Vector3(170f, newScrollbarPos.y, newScrollbarPos.z);
#endif

var vlg = parent.GetComponent<VerticalLayoutGroup>();
var csf = parent.GetComponent<ContentSizeFitter>();
Expand All @@ -86,6 +104,7 @@ private static void SetUpList(HSceneProc hSceneProc, Transform parent, int femal
newButton.onClick.RemoveAllListeners();
newButton.onClick.AddListener(() => hSceneProc.sprite.OnClickCoordinateChange(femaleIndex, coordinateIndex));

#if KK
//Set the sprite to one without text
var buttonImage = newButton.GetComponent<Image>();
buttonImage.sprite = ListTemplate;
Expand All @@ -109,6 +128,10 @@ private static void SetUpList(HSceneProc hSceneProc, Transform parent, int femal
buttonText.horizontalOverflow = HorizontalWrapMode.Wrap;
buttonText.verticalOverflow = VerticalWrapMode.Overflow;
buttonText.color = Color.black;
#elif KKS
var textContainer = newButton.GetComponentInChildren<TextMeshProUGUI>();
textContainer.text = GetCoodinateName(chaControl, coordinateIndex);
#endif
}
}

Expand Down

0 comments on commit 4fcf961

Please sign in to comment.