parent
462271d683
commit
517dbfde0d
File diff suppressed because it is too large
Load Diff
@ -19,7 +19,7 @@ namespace BlueWaterProject
|
||||
{
|
||||
var gridSize = 0;
|
||||
|
||||
switch (pirateUnitStat.SailorCount)
|
||||
switch (pirateUnitStat.PirateAiList.Count)
|
||||
{
|
||||
case 0:
|
||||
gridSize = 1;
|
||||
@ -44,7 +44,7 @@ namespace BlueWaterProject
|
||||
{
|
||||
var currentPos = i * gridSize + j;
|
||||
|
||||
if (currentPos > pirateUnitStat.SailorCount) break;
|
||||
if (currentPos >= pirateUnitStat.PirateAiList.Count) return;
|
||||
|
||||
var zOffset = (i - (gridSize - 1) / 2.0f) * UnitManager.Inst.UnitSpacing;
|
||||
var xOffset = (j - (gridSize - 1) / 2.0f) * UnitManager.Inst.UnitSpacing;
|
||||
|
@ -31,8 +31,9 @@ namespace BlueWaterProject
|
||||
{
|
||||
var controls = new BlueWater();
|
||||
|
||||
controls.Unit.LeftClick.performed += OnLeftClick;
|
||||
controls.Unit.RightClick.performed += OnRightClick;
|
||||
controls.Unit.SelectUnit.performed += OnSelectUnit;
|
||||
controls.Unit.CancelSelectedUnit.performed += OnCancelSelectedUnit;
|
||||
controls.Unit.MoveUnit.performed += OnMoveUnit;
|
||||
controls.Enable();
|
||||
|
||||
unitLayer = LayerMask.GetMask("Pirate");
|
||||
@ -44,7 +45,7 @@ namespace BlueWaterProject
|
||||
|
||||
#region New input system
|
||||
|
||||
private void OnLeftClick(InputAction.CallbackContext context)
|
||||
private void OnSelectUnit(InputAction.CallbackContext context)
|
||||
{
|
||||
if (!context.performed || !IsSelectable) return;
|
||||
|
||||
@ -111,7 +112,20 @@ namespace BlueWaterProject
|
||||
}
|
||||
}
|
||||
|
||||
private void OnRightClick(InputAction.CallbackContext context)
|
||||
private void OnCancelSelectedUnit(InputAction.CallbackContext context)
|
||||
{
|
||||
if (!context.performed || !IsSelectable || SelectedPirateUnit == null) return;
|
||||
|
||||
foreach (var pirateAi in SelectedPirateUnit.pirateUnitStat.PirateAiList)
|
||||
{
|
||||
pirateAi.ResetHighlight();
|
||||
}
|
||||
|
||||
SelectedPirateUnit = null;
|
||||
GameManager.Inst.DefaultSpeedMode();
|
||||
}
|
||||
|
||||
private void OnMoveUnit(InputAction.CallbackContext context)
|
||||
{
|
||||
if (!context.performed || !IsSelectable || SelectedPirateUnit == null) return;
|
||||
|
||||
|
@ -319,7 +319,7 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
""id"": ""72deb161-83b9-4d14-8bcf-0bd0c122f76f"",
|
||||
""actions"": [
|
||||
{
|
||||
""name"": ""LeftClick"",
|
||||
""name"": ""SelectUnit"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""2c1978d2-b4be-453a-9413-7b54903dbf38"",
|
||||
""expectedControlType"": ""Button"",
|
||||
@ -328,7 +328,16 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""RightClick"",
|
||||
""name"": ""CancelSelectedUnit"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""952be7b5-8952-47b7-a2db-ced6517d161a"",
|
||||
""expectedControlType"": ""Button"",
|
||||
""processors"": """",
|
||||
""interactions"": """",
|
||||
""initialStateCheck"": false
|
||||
},
|
||||
{
|
||||
""name"": ""MoveUnit"",
|
||||
""type"": ""Button"",
|
||||
""id"": ""2fe8434e-42e2-4b88-b0b3-0b2b4f8596a8"",
|
||||
""expectedControlType"": ""Button"",
|
||||
@ -344,8 +353,8 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
""path"": ""<Mouse>/leftButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""LeftClick"",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""SelectUnit"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
@ -355,8 +364,19 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
""path"": ""<Mouse>/rightButton"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": """",
|
||||
""action"": ""RightClick"",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""MoveUnit"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
},
|
||||
{
|
||||
""name"": """",
|
||||
""id"": ""e768abd0-e04f-4441-b6b3-09f456041cd8"",
|
||||
""path"": ""<Keyboard>/escape"",
|
||||
""interactions"": """",
|
||||
""processors"": """",
|
||||
""groups"": ""Keyboard&Mouse"",
|
||||
""action"": ""CancelSelectedUnit"",
|
||||
""isComposite"": false,
|
||||
""isPartOfComposite"": false
|
||||
}
|
||||
@ -410,8 +430,9 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
m_Camera_Rotate = m_Camera.FindAction("Rotate", throwIfNotFound: true);
|
||||
// Unit
|
||||
m_Unit = asset.FindActionMap("Unit", throwIfNotFound: true);
|
||||
m_Unit_LeftClick = m_Unit.FindAction("LeftClick", throwIfNotFound: true);
|
||||
m_Unit_RightClick = m_Unit.FindAction("RightClick", throwIfNotFound: true);
|
||||
m_Unit_SelectUnit = m_Unit.FindAction("SelectUnit", throwIfNotFound: true);
|
||||
m_Unit_CancelSelectedUnit = m_Unit.FindAction("CancelSelectedUnit", throwIfNotFound: true);
|
||||
m_Unit_MoveUnit = m_Unit.FindAction("MoveUnit", throwIfNotFound: true);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
@ -637,14 +658,16 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
// Unit
|
||||
private readonly InputActionMap m_Unit;
|
||||
private List<IUnitActions> m_UnitActionsCallbackInterfaces = new List<IUnitActions>();
|
||||
private readonly InputAction m_Unit_LeftClick;
|
||||
private readonly InputAction m_Unit_RightClick;
|
||||
private readonly InputAction m_Unit_SelectUnit;
|
||||
private readonly InputAction m_Unit_CancelSelectedUnit;
|
||||
private readonly InputAction m_Unit_MoveUnit;
|
||||
public struct UnitActions
|
||||
{
|
||||
private @BlueWater m_Wrapper;
|
||||
public UnitActions(@BlueWater wrapper) { m_Wrapper = wrapper; }
|
||||
public InputAction @LeftClick => m_Wrapper.m_Unit_LeftClick;
|
||||
public InputAction @RightClick => m_Wrapper.m_Unit_RightClick;
|
||||
public InputAction @SelectUnit => m_Wrapper.m_Unit_SelectUnit;
|
||||
public InputAction @CancelSelectedUnit => m_Wrapper.m_Unit_CancelSelectedUnit;
|
||||
public InputAction @MoveUnit => m_Wrapper.m_Unit_MoveUnit;
|
||||
public InputActionMap Get() { return m_Wrapper.m_Unit; }
|
||||
public void Enable() { Get().Enable(); }
|
||||
public void Disable() { Get().Disable(); }
|
||||
@ -654,22 +677,28 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
{
|
||||
if (instance == null || m_Wrapper.m_UnitActionsCallbackInterfaces.Contains(instance)) return;
|
||||
m_Wrapper.m_UnitActionsCallbackInterfaces.Add(instance);
|
||||
@LeftClick.started += instance.OnLeftClick;
|
||||
@LeftClick.performed += instance.OnLeftClick;
|
||||
@LeftClick.canceled += instance.OnLeftClick;
|
||||
@RightClick.started += instance.OnRightClick;
|
||||
@RightClick.performed += instance.OnRightClick;
|
||||
@RightClick.canceled += instance.OnRightClick;
|
||||
@SelectUnit.started += instance.OnSelectUnit;
|
||||
@SelectUnit.performed += instance.OnSelectUnit;
|
||||
@SelectUnit.canceled += instance.OnSelectUnit;
|
||||
@CancelSelectedUnit.started += instance.OnCancelSelectedUnit;
|
||||
@CancelSelectedUnit.performed += instance.OnCancelSelectedUnit;
|
||||
@CancelSelectedUnit.canceled += instance.OnCancelSelectedUnit;
|
||||
@MoveUnit.started += instance.OnMoveUnit;
|
||||
@MoveUnit.performed += instance.OnMoveUnit;
|
||||
@MoveUnit.canceled += instance.OnMoveUnit;
|
||||
}
|
||||
|
||||
private void UnregisterCallbacks(IUnitActions instance)
|
||||
{
|
||||
@LeftClick.started -= instance.OnLeftClick;
|
||||
@LeftClick.performed -= instance.OnLeftClick;
|
||||
@LeftClick.canceled -= instance.OnLeftClick;
|
||||
@RightClick.started -= instance.OnRightClick;
|
||||
@RightClick.performed -= instance.OnRightClick;
|
||||
@RightClick.canceled -= instance.OnRightClick;
|
||||
@SelectUnit.started -= instance.OnSelectUnit;
|
||||
@SelectUnit.performed -= instance.OnSelectUnit;
|
||||
@SelectUnit.canceled -= instance.OnSelectUnit;
|
||||
@CancelSelectedUnit.started -= instance.OnCancelSelectedUnit;
|
||||
@CancelSelectedUnit.performed -= instance.OnCancelSelectedUnit;
|
||||
@CancelSelectedUnit.canceled -= instance.OnCancelSelectedUnit;
|
||||
@MoveUnit.started -= instance.OnMoveUnit;
|
||||
@MoveUnit.performed -= instance.OnMoveUnit;
|
||||
@MoveUnit.canceled -= instance.OnMoveUnit;
|
||||
}
|
||||
|
||||
public void RemoveCallbacks(IUnitActions instance)
|
||||
@ -724,7 +753,8 @@ public partial class @BlueWater: IInputActionCollection2, IDisposable
|
||||
}
|
||||
public interface IUnitActions
|
||||
{
|
||||
void OnLeftClick(InputAction.CallbackContext context);
|
||||
void OnRightClick(InputAction.CallbackContext context);
|
||||
void OnSelectUnit(InputAction.CallbackContext context);
|
||||
void OnCancelSelectedUnit(InputAction.CallbackContext context);
|
||||
void OnMoveUnit(InputAction.CallbackContext context);
|
||||
}
|
||||
}
|
||||
|
@ -297,7 +297,7 @@
|
||||
"id": "72deb161-83b9-4d14-8bcf-0bd0c122f76f",
|
||||
"actions": [
|
||||
{
|
||||
"name": "LeftClick",
|
||||
"name": "SelectUnit",
|
||||
"type": "Button",
|
||||
"id": "2c1978d2-b4be-453a-9413-7b54903dbf38",
|
||||
"expectedControlType": "Button",
|
||||
@ -306,7 +306,16 @@
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "RightClick",
|
||||
"name": "CancelSelectedUnit",
|
||||
"type": "Button",
|
||||
"id": "952be7b5-8952-47b7-a2db-ced6517d161a",
|
||||
"expectedControlType": "Button",
|
||||
"processors": "",
|
||||
"interactions": "",
|
||||
"initialStateCheck": false
|
||||
},
|
||||
{
|
||||
"name": "MoveUnit",
|
||||
"type": "Button",
|
||||
"id": "2fe8434e-42e2-4b88-b0b3-0b2b4f8596a8",
|
||||
"expectedControlType": "Button",
|
||||
@ -322,8 +331,8 @@
|
||||
"path": "<Mouse>/leftButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "LeftClick",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "SelectUnit",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
@ -333,8 +342,19 @@
|
||||
"path": "<Mouse>/rightButton",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "",
|
||||
"action": "RightClick",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "MoveUnit",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
},
|
||||
{
|
||||
"name": "",
|
||||
"id": "e768abd0-e04f-4441-b6b3-09f456041cd8",
|
||||
"path": "<Keyboard>/escape",
|
||||
"interactions": "",
|
||||
"processors": "",
|
||||
"groups": "Keyboard&Mouse",
|
||||
"action": "CancelSelectedUnit",
|
||||
"isComposite": false,
|
||||
"isPartOfComposite": false
|
||||
}
|
||||
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a55ee4efaad27d948ba5f03fc6d7bc80
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed9b95dc6ed6d0647ad7f1a8f305385d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff1f29eab234cf4490d9bb383892c44
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f5789d13135b86645a366dac6583d1cd
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3643c0d76ec153646b1203880bfb64ed
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3d7c4217783978e4abe6496ac71eee94
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 697b6e7dea1fde146b7e3e5cf3ed9e9f
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 078b8f13a17171b49892ad10426d5af0
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9406a33814af9c47b352e77f079d798
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9aacf6f3043624194bb6f6fe9a580786
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f4227764308e84f89a765fbf315e2945
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 41e59f562b69648719f2424c438758f3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b044a2387a61dac41bdf204adffdce9d
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cd287c84e887ea24a8679e67aac7c074
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5f3f53ee059b45a4d9a5b9fc75e8aea9
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f211254f5bfad224ba88868f2c75432c
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4368c9be31b3c174dbfd80f2caf98889
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 617b3f1032a08c14ebfedfa340767cdf
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f597f19f656ba56eae4f6a3a7cc528f4
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 48e08dc33330d11e9d4a1b246c52e4f6
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ed09910c0094cb27be8f3ca264680da3
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,7 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: cc355dd4cf1e6173beaeb22c2858cbe1
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user