更改文件架构
This commit is contained in:
22
Packages/Common~/Scripts/UX/Input/BITKit.UX.OnScreen.asmdef
Normal file
22
Packages/Common~/Scripts/UX/Input/BITKit.UX.OnScreen.asmdef
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "BITKit.UX.OnScreen",
|
||||
"rootNamespace": "",
|
||||
"references": [
|
||||
"GUID:a209c53514018594f9f482516f2a6781",
|
||||
"GUID:6ef4ed8ff60a7aa4bb60a8030e6f4008",
|
||||
"GUID:75469ad4d38634e559750d17036d5f7c",
|
||||
"GUID:2bafac87e7f4b9b418d9448d219b01ab",
|
||||
"GUID:be17a8778dbfe454890ed8279279e153",
|
||||
"GUID:14fe60d984bf9f84eac55c6ea033a8f4",
|
||||
"GUID:9400d40641bab5b4a9702f65bf5c6eb5"
|
||||
],
|
||||
"includePlatforms": [],
|
||||
"excludePlatforms": [],
|
||||
"allowUnsafeCode": false,
|
||||
"overrideReferences": false,
|
||||
"precompiledReferences": [],
|
||||
"autoReferenced": true,
|
||||
"defineConstraints": [],
|
||||
"versionDefines": [],
|
||||
"noEngineReferences": false
|
||||
}
|
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 917f4379101d8ba4f8226ed9bbeeeb84
|
||||
AssemblyDefinitionImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
47
Packages/Common~/Scripts/UX/Input/UXScreenJoyStick.cs
Normal file
47
Packages/Common~/Scripts/UX/Input/UXScreenJoyStick.cs
Normal file
@@ -0,0 +1,47 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UnityEngine.Events;
|
||||
namespace BITKit.UX
|
||||
{
|
||||
public class UXScreenJoyStick : UXDrag
|
||||
{
|
||||
[Header(Constant.Header.Settings)]
|
||||
public float range;
|
||||
public bool resetOnUp;
|
||||
public bool updateDelta;
|
||||
[Header(Constant.Header.Events)]
|
||||
public UnityEvent<Vector2> onDelta;
|
||||
[Header(Constant.Header.InternalVariables)]
|
||||
public Vector2 delta;
|
||||
protected override Vector2 GetProcessDelta(Vector2 delta)
|
||||
{
|
||||
delta = Vector2.ClampMagnitude(delta, range);
|
||||
return delta;
|
||||
}
|
||||
protected override void PointerUpEventHandler(PointerUpEvent evt)
|
||||
{
|
||||
base.PointerUpEventHandler(evt);
|
||||
if (resetOnUp)
|
||||
{
|
||||
visualElement.transform.position = default;
|
||||
onDelta.Invoke(this.delta = default);
|
||||
}
|
||||
}
|
||||
protected override void OnDelta(Vector2 delta)
|
||||
{
|
||||
delta.y = -delta.y;
|
||||
if (updateDelta is false)
|
||||
onDelta.Invoke(delta);
|
||||
this.delta = delta;
|
||||
}
|
||||
void Update()
|
||||
{
|
||||
if (updateDelta && delta.sqrMagnitude is not 0)
|
||||
{
|
||||
onDelta.Invoke(delta);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
Packages/Common~/Scripts/UX/Input/UXScreenJoyStick.cs.meta
Normal file
11
Packages/Common~/Scripts/UX/Input/UXScreenJoyStick.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 38765acb716bd8b409e8b336ce84f19c
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user