added: lock on target graphic
This commit is contained in:
8
Assets/Core/UI/In-Game/Graphics.meta
Normal file
8
Assets/Core/UI/In-Game/Graphics.meta
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: e45b89ba6f77d1143bc70dc6be5a042c
|
||||||
|
folderAsset: yes
|
||||||
|
DefaultImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Core/UI/In-Game/Graphics/Icon-LockOnTarget.png
Normal file
BIN
Assets/Core/UI/In-Game/Graphics/Icon-LockOnTarget.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.7 KiB |
117
Assets/Core/UI/In-Game/Graphics/Icon-LockOnTarget.png.meta
Normal file
117
Assets/Core/UI/In-Game/Graphics/Icon-LockOnTarget.png.meta
Normal file
@@ -0,0 +1,117 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: fca1c462b5714044698de6793787093a
|
||||||
|
TextureImporter:
|
||||||
|
internalIDToNameTable: []
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 13
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
sRGBTexture: 1
|
||||||
|
linearTexture: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapsPreserveCoverage: 0
|
||||||
|
alphaTestReferenceValue: 0.5
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: 0.25
|
||||||
|
normalMapFilter: 0
|
||||||
|
flipGreenChannel: 0
|
||||||
|
isReadable: 0
|
||||||
|
streamingMipmaps: 0
|
||||||
|
streamingMipmapsPriority: 0
|
||||||
|
vTOnly: 0
|
||||||
|
ignoreMipmapLimit: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 6
|
||||||
|
cubemapConvolution: 0
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: 1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
serializedVersion: 2
|
||||||
|
filterMode: 1
|
||||||
|
aniso: 1
|
||||||
|
mipBias: 0
|
||||||
|
wrapU: 0
|
||||||
|
wrapV: 0
|
||||||
|
wrapW: 0
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: 0.5, y: 0.5}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spriteGenerateFallbackPhysicsShape: 1
|
||||||
|
alphaUsage: 1
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
spriteTessellationDetail: -1
|
||||||
|
textureType: 0
|
||||||
|
textureShape: 1
|
||||||
|
singleChannelComponent: 0
|
||||||
|
flipbookRows: 1
|
||||||
|
flipbookColumns: 1
|
||||||
|
maxTextureSizeSet: 0
|
||||||
|
compressionQualitySet: 0
|
||||||
|
textureFormatSet: 0
|
||||||
|
ignorePngGamma: 0
|
||||||
|
applyGammaDecoding: 0
|
||||||
|
swizzle: 50462976
|
||||||
|
cookieLightType: 0
|
||||||
|
platformSettings:
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: DefaultTexturePlatform
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
- serializedVersion: 4
|
||||||
|
buildTarget: Standalone
|
||||||
|
maxTextureSize: 2048
|
||||||
|
resizeAlgorithm: 0
|
||||||
|
textureFormat: -1
|
||||||
|
textureCompression: 1
|
||||||
|
compressionQuality: 50
|
||||||
|
crunchedCompression: 0
|
||||||
|
allowsAlphaSplitting: 0
|
||||||
|
overridden: 0
|
||||||
|
ignorePlatformSupport: 0
|
||||||
|
androidETC2FallbackOverride: 0
|
||||||
|
forceMaximumCompressionQuality_BC6H_BC7: 0
|
||||||
|
spriteSheet:
|
||||||
|
serializedVersion: 2
|
||||||
|
sprites: []
|
||||||
|
outline: []
|
||||||
|
customData:
|
||||||
|
physicsShape: []
|
||||||
|
bones: []
|
||||||
|
spriteID:
|
||||||
|
internalID: 0
|
||||||
|
vertices: []
|
||||||
|
indices:
|
||||||
|
edges: []
|
||||||
|
weights: []
|
||||||
|
secondaryTextures: []
|
||||||
|
spriteCustomMetadata:
|
||||||
|
entries: []
|
||||||
|
nameFileIdTable: {}
|
||||||
|
mipmapLimitGroupName:
|
||||||
|
pSDRemoveMatte: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
@@ -1,3 +1,8 @@
|
|||||||
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
<ui:UXML xmlns:ui="UnityEngine.UIElements" xmlns:uie="UnityEditor.UIElements" editor-extension-mode="False">
|
||||||
<ui:VisualElement name="Blank" style="flex-grow: 1;" />
|
<ui:VisualElement name="StretchBG" style="width: 100%; height: 100%;">
|
||||||
|
<ui:VisualElement name="LockOnGroup" style="align-items: center; align-self: flex-start;">
|
||||||
|
<ui:Label text="Unit Name" name="LockOnName" style="color: rgb(255, 255, 255); font-size: 29px; -unity-font-style: bold; -unity-font-definition: resource('FlatSkin/Font/Roboto-Bold');" />
|
||||||
|
<ui:VisualElement name="LockOnIcon" style="flex-grow: 1; height: 40px; width: 40px; background-image: url("project://database/Assets/Core/UI/In-Game/Graphics/Icon-LockOnTarget.png?fileID=2800000&guid=fca1c462b5714044698de6793787093a&type=3#Icon-LockOnTarget"); -unity-background-image-tint-color: rgb(238, 66, 66);" />
|
||||||
|
</ui:VisualElement>
|
||||||
|
</ui:VisualElement>
|
||||||
</ui:UXML>
|
</ui:UXML>
|
||||||
|
|||||||
@@ -2922,7 +2922,7 @@ MonoBehaviour:
|
|||||||
BindingMode: 0
|
BindingMode: 0
|
||||||
PositionDamping: {x: 1, y: 1, z: 1}
|
PositionDamping: {x: 1, y: 1, z: 1}
|
||||||
AngularDampingMode: 0
|
AngularDampingMode: 0
|
||||||
RotationDamping: {x: 0.7, y: 0.7, z: 0.7}
|
RotationDamping: {x: 0, y: 0, z: 0}
|
||||||
QuaternionDamping: 1
|
QuaternionDamping: 1
|
||||||
OrbitStyle: 1
|
OrbitStyle: 1
|
||||||
Radius: 10
|
Radius: 10
|
||||||
@@ -6759,6 +6759,7 @@ MonoBehaviour:
|
|||||||
m_Name:
|
m_Name:
|
||||||
m_EditorClassIdentifier:
|
m_EditorClassIdentifier:
|
||||||
lockOnDocument: {fileID: 1223043171}
|
lockOnDocument: {fileID: 1223043171}
|
||||||
|
lockOnTarget: {fileID: 1379573502}
|
||||||
--- !u!1 &2024357130
|
--- !u!1 &2024357130
|
||||||
GameObject:
|
GameObject:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
|
|||||||
@@ -5,16 +5,46 @@ using UnityEngine.UIElements;
|
|||||||
public class LockOnManager : MonoBehaviour{
|
public class LockOnManager : MonoBehaviour{
|
||||||
[ShowInInspector]
|
[ShowInInspector]
|
||||||
public UIDocument lockOnDocument;
|
public UIDocument lockOnDocument;
|
||||||
[ShowInInspector, SerializeField]
|
public GameObject lockOnTarget;
|
||||||
public ILockOnTarget lockOnTarget;
|
|
||||||
|
private Label elementLabelName;
|
||||||
|
private VisualElement elementRoot;
|
||||||
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
// Start is called once before the first execution of Update after the MonoBehaviour is created
|
||||||
void Start()
|
void Start()
|
||||||
{
|
{
|
||||||
|
if (lockOnTarget.GetComponent<ILockOnTarget>() == null) {
|
||||||
|
Debug.LogError($"Game Object {lockOnTarget.name} does not implement the ILockOnTarget interface. Not processing lock-on actions!");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
elementRoot = lockOnDocument.rootVisualElement.Query<VisualElement>("LockOnGroup");
|
||||||
|
elementLabelName = lockOnDocument.rootVisualElement.Query<Label>("LockOnName").First();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
void Update(){
|
void LateUpdate(){
|
||||||
Debug.Log(RuntimePanelUtils.CameraTransformWorldToPanel(lockOnDocument.rootVisualElement.panel, lockOnTarget.GetReticlePosition(), Camera.main.GetComponent<Camera>()));
|
if (lockOnTarget.GetComponent<ILockOnTarget>() != null) {
|
||||||
|
// This is just test logic to get an image above a lock on.
|
||||||
|
// TODO: Replace with something less silly
|
||||||
|
Vector2 screenPos = RuntimePanelUtils.CameraTransformWorldToPanel(
|
||||||
|
lockOnDocument.rootVisualElement.panel,
|
||||||
|
lockOnTarget.GetComponent<ILockOnTarget>().GetReticlePosition(),
|
||||||
|
Camera.main.GetComponent<Camera>()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Set name
|
||||||
|
elementLabelName.name = lockOnTarget.name;
|
||||||
|
|
||||||
|
// Set position (add the width/height of the element)
|
||||||
|
elementRoot.style.top = new StyleLength(screenPos.y - elementRoot.resolvedStyle.height * .7f );
|
||||||
|
elementRoot.style.left = new StyleLength(screenPos.x - elementRoot.resolvedStyle.width / 2f);
|
||||||
|
|
||||||
|
// Set enabled
|
||||||
|
elementRoot.SetEnabled(true);
|
||||||
|
} else {
|
||||||
|
elementRoot.SetEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,2 +1,11 @@
|
|||||||
fileFormatVersion: 2
|
fileFormatVersion: 2
|
||||||
guid: 092c74123418b7a4482fc45aa5870077
|
guid: 092c74123418b7a4482fc45aa5870077
|
||||||
|
MonoImporter:
|
||||||
|
externalObjects: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
defaultReferences: []
|
||||||
|
executionOrder: 5000
|
||||||
|
icon: {instanceID: 0}
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
|
|||||||
@@ -17,14 +17,14 @@ MonoBehaviour:
|
|||||||
m_TargetTexture: {fileID: 0}
|
m_TargetTexture: {fileID: 0}
|
||||||
m_RenderMode: 0
|
m_RenderMode: 0
|
||||||
m_WorldSpaceLayer: 0
|
m_WorldSpaceLayer: 0
|
||||||
m_ScaleMode: 1
|
m_ScaleMode: 0
|
||||||
m_ReferenceSpritePixelsPerUnit: 100
|
m_ReferenceSpritePixelsPerUnit: 100
|
||||||
m_PixelsPerUnit: 100
|
m_PixelsPerUnit: 100
|
||||||
m_Scale: 1
|
m_Scale: 1
|
||||||
m_ReferenceDpi: 96
|
m_ReferenceDpi: 96
|
||||||
m_FallbackDpi: 96
|
m_FallbackDpi: 96
|
||||||
m_ReferenceResolution: {x: 1200, y: 800}
|
m_ReferenceResolution: {x: 1920, y: 1080}
|
||||||
m_ScreenMatchMode: 0
|
m_ScreenMatchMode: 1
|
||||||
m_Match: 0
|
m_Match: 0
|
||||||
m_SortingOrder: 0
|
m_SortingOrder: 0
|
||||||
m_TargetDisplay: 0
|
m_TargetDisplay: 0
|
||||||
|
|||||||
Reference in New Issue
Block a user