Skip to content

Commit

Permalink
change skip button style & fix 1p touch sensor test (#7)
Browse files Browse the repository at this point in the history
* change skip button style

* fix 1p touch sensor test not working

* allow skip by press outside button

---------

Co-authored-by: Clansty <[email protected]>
  • Loading branch information
ck2739046 and clansty authored Jan 8, 2025
1 parent e35b4cd commit 19634ed
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 2 additions & 2 deletions AquaMai.Mods/GameSystem/SinglePlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ public static IEnumerable<MethodBase> TargetMethods()

public static void Prefix(MonoBehaviour gameMainObject, ref Transform left, ref Transform right)
{
left.transform.position = Vector3.zero;
Vector3 position = Camera.main.gameObject.transform.position;
Camera.main.gameObject.transform.position = new Vector3(position.x - 540f, position.y, position.z);
right.localScale = Vector3.zero;
GameObject.Find("Mask").transform.position = new Vector3(540f, 0f, 0f);
}
}

Expand Down
28 changes: 19 additions & 9 deletions AquaMai.Mods/UX/QuickEndPlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public static void GameProcessPostUpdate(GameProcess __instance, Message[] ____m
break;
}

if (_timer > 60 && (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.B4) || InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.E4)))
if (_timer > 60 && (InputManager.GetTouchPanelAreaDown(InputManager.TouchPanelArea.A4) || InputManager.GetButtonDown(0, InputManager.ButtonSetting.Button04)))
{
var traverse = Traverse.Create(__instance);
___container.processManager.SendMessage(____message[0]);
Expand All @@ -53,18 +53,28 @@ public static void GameProcessPostUpdate(GameProcess __instance, Message[] ____m

private class Ui : MonoBehaviour
{
//button position(x,y) topleft point
public float topleftx = Screen.width / 2 - GuiSizes.PlayerWidth * 0.097f;
public float toplefty = Screen.height - GuiSizes.PlayerWidth * 0.09f;
//button size(w,h)
public float width = GuiSizes.PlayerWidth * .50f;
public float height = GuiSizes.PlayerWidth * .23f;

public void OnGUI()
{
if (_timer < 60) return;

// 这里重新 setup 一下 style 也可以
var x = GuiSizes.PlayerCenter;
var y = Screen.height - GuiSizes.PlayerWidth * .37f;
var width = GuiSizes.PlayerWidth * .25f;
var height = GuiSizes.PlayerWidth * .13f;

GUI.Box(new Rect(x, y, width, height), "");
GUI.Button(new Rect(x, y, width, height), Locale.Skip);
// get button texture 4 -> SKIP
Texture2D buttonTexture = ButtonControllerBase.GetFlatButtonParam(4).Image.texture;
// set button background to transparent
GUIStyle buttonBG = new GUIStyle(GUI.skin.button);
buttonBG.normal.background = null;
buttonBG.hover.background = null;
// rotate -22.5°
Vector2 topLeftPosition = new Vector2(topleftx, toplefty);
GUIUtility.RotateAroundPivot((float)-22.5, topLeftPosition);
// draw button
GUI.Button(new Rect(topleftx, toplefty, width, height), buttonTexture, buttonBG);
}
}
}

0 comments on commit 19634ed

Please sign in to comment.