Passion & UI
This commit is contained in:
@@ -2,6 +2,7 @@ using System;
|
||||
using Cielonos.MainGame.Inventory;
|
||||
using Cielonos.MainGame.UI;
|
||||
using Sirenix.OdinInspector;
|
||||
using SLSUtilities.UI;
|
||||
using UniRx;
|
||||
using Unity.Cinemachine;
|
||||
using UnityEngine;
|
||||
@@ -61,8 +62,11 @@ namespace Cielonos.MainGame.Characters
|
||||
var cinemachineInput = player.viewSc.freeLookCamera.GetComponent<CinemachineInputAxisController>();
|
||||
cinemachineInput.enabled = isLocked;
|
||||
});
|
||||
|
||||
player.inputSc.isCursorLocked.Value = false;
|
||||
preinputSubmodule = new PlayerPreinputSubmodule(this);
|
||||
|
||||
InputBindingResolver.Initialize(inputActions.asset, "KeyboardMouse");
|
||||
}
|
||||
|
||||
private void Start()
|
||||
@@ -136,7 +140,7 @@ namespace Cielonos.MainGame.Characters
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
Debug.Log("Value: " + ctx.ReadValue<float>());
|
||||
//Debug.Log("Value: " + ctx.ReadValue<float>());
|
||||
operation.SelectLockonTarget(ctx.ReadValue<float>());
|
||||
}
|
||||
};
|
||||
@@ -158,6 +162,19 @@ namespace Cielonos.MainGame.Characters
|
||||
operation.WalkRelease();
|
||||
}
|
||||
};
|
||||
|
||||
// 交互选项导航:滚轮向上 / ↑ = -1(向上),滚轮向下 / ↓ = +1(向下)
|
||||
// PassThrough + Axis 类型在松手/滚轮归零时也会触发 performed(raw = 0),需过滤
|
||||
inputActions.Player.NavigateInteractionChoice.performed += ctx =>
|
||||
{
|
||||
if (isCursorLocked.Value)
|
||||
{
|
||||
float raw = ctx.ReadValue<float>();
|
||||
if (Mathf.Approximately(raw, 0f)) return;
|
||||
int delta = raw > 0f ? -1 : 1;
|
||||
operation.NavigateInteractionChoice(delta);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private MainWeaponBase currentMainWeapon => player.inventorySc.equipmentSm.currentMainWeapon;
|
||||
@@ -309,7 +326,7 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
private void RegisterSupportEquipmentInputs()
|
||||
{
|
||||
inputActions.Player.UseSupportEquipment0.performed += ctx =>
|
||||
inputActions.Player.SupportEquipment0.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
@@ -317,7 +334,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment0.canceled += ctx =>
|
||||
inputActions.Player.SupportEquipment0.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
@@ -325,7 +342,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment1.performed += ctx =>
|
||||
inputActions.Player.SupportEquipment1.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
@@ -333,7 +350,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment1.canceled += ctx =>
|
||||
inputActions.Player.SupportEquipment1.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
@@ -341,7 +358,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment2.performed += ctx =>
|
||||
inputActions.Player.SupportEquipment2.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
@@ -349,7 +366,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment2.canceled += ctx =>
|
||||
inputActions.Player.SupportEquipment2.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
@@ -357,7 +374,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment3.performed += ctx =>
|
||||
inputActions.Player.SupportEquipment3.performed += ctx =>
|
||||
{
|
||||
if (ctx.performed && isCursorLocked.Value)
|
||||
{
|
||||
@@ -365,7 +382,7 @@ namespace Cielonos.MainGame.Characters
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.UseSupportEquipment3.canceled += ctx =>
|
||||
inputActions.Player.SupportEquipment3.canceled += ctx =>
|
||||
{
|
||||
if (ctx.canceled && isCursorLocked.Value)
|
||||
{
|
||||
@@ -376,12 +393,38 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
private void RegisterFunctionInputs()
|
||||
{
|
||||
inputActions.Player.Inventory.performed += ctx =>
|
||||
{
|
||||
var inventoryPage = PlayerCanvas.MainGamePages.inventoryPage;
|
||||
if(inventoryPage.IsOpen)
|
||||
{
|
||||
inventoryPage.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
inventoryPage.Open();
|
||||
}
|
||||
};
|
||||
|
||||
inputActions.Player.Map.performed += ctx =>
|
||||
{
|
||||
var mapPage = PlayerCanvas.MainGamePages.mapPage;
|
||||
if(mapPage.IsOpen) mapPage.Close();
|
||||
else mapPage.Open();
|
||||
};
|
||||
|
||||
inputActions.Player.Escape.performed += ctx =>
|
||||
{
|
||||
// 优先关闭栈顶页面(包括 Settings 覆盖在 Pause 之上的情况)
|
||||
if (UIPageManager.Instance != null && UIPageManager.Instance.HasOpenPages)
|
||||
{
|
||||
UIPageManager.Instance.CloseTopPage();
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayerCanvas.PauseUIPage.Open();
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user