Many changes

This commit is contained in:
Rabidus 2023-08-15 17:38:54 +03:00
parent 05ec26cc9f
commit 66c6898e17
299 changed files with 122746 additions and 5299 deletions

View File

@ -28,6 +28,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0.01, y: 0.0179, z: -0.0071}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6808192234808069332}
m_RootOrder: 0
@ -51,10 +52,12 @@ MeshRenderer:
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -79,6 +82,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &966261301251419732
GameObject:
m_ObjectHideFlags: 0
@ -107,6 +111,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3844078741364124473}
m_Father: {fileID: 0}
@ -170,6 +175,16 @@ MonoBehaviour:
RightThumbstickAxis: {x: 0, y: 0}
LeftTouchPadAxis: {x: 0, y: 0}
RightTouchPadAxis: {x: 0, y: 0}
LeftThumbCurl: 0
LeftIndexCurl: 0
LeftMiddleCurl: 0
LeftRingCurl: 0
LeftPinkyCurl: 0
RightThumbCurl: 0
RightIndexCurl: 0
RightMiddleCurl: 0
RightRingCurl: 0
RightPinkyCurl: 0
ConnectedControllerType: 0
HMDActive: 0
SupportsBothTouchPadAndJoystick: 0
@ -189,13 +204,18 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
EmulatorEnabled: 1
EditorOnly: 1
RequireGameFocus: 1
EmulatorActionSet: {fileID: -944628639613478452, guid: 27bafa1c7d8a77b47985ab70c0511986,
type: 3}
ForceStraightTeleportRotation: 1
AllowUpDownControls: 1
PlayerUpAction: {fileID: -4870421553478864907, guid: 27bafa1c7d8a77b47985ab70c0511986,
type: 3}
PlayerDownAction: {fileID: -5448902572583850724, guid: 27bafa1c7d8a77b47985ab70c0511986,
type: 3}
MinPlayerHeight: 0.2
MaxPlayerHeight: 5
LockCameraAction: {fileID: 7248157346319567513, guid: 27bafa1c7d8a77b47985ab70c0511986,
type: 3}
CameraLookAction: {fileID: 3400255892409606642, guid: 27bafa1c7d8a77b47985ab70c0511986,
@ -245,6 +265,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 966261301282438172}
- {fileID: 966261301282349426}
@ -278,6 +299,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 965805929298375642}
m_Father: {fileID: 966261301282368098}
@ -309,6 +331,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 965521697644191124}
m_Father: {fileID: 966261301282368098}
@ -340,6 +363,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 966261301282368098}
m_Father: {fileID: 3844078741364124473}
@ -359,6 +383,7 @@ GameObject:
- component: {fileID: 2002945485523434694}
- component: {fileID: 966261301282267199}
- component: {fileID: 3075193522572325490}
- component: {fileID: 8775641515755371787}
m_Layer: 0
m_Name: CenterEyeAnchor
m_TagString: MainCamera
@ -376,6 +401,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 966261301282368098}
m_RootOrder: 0
@ -482,6 +508,39 @@ MonoBehaviour:
FadeInSpeed: 6
FadeOutSpeed: 6
SceneFadeInDelay: 1
--- !u!114 &8775641515755371787
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 966261301282267196}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 0
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
--- !u!1 &966909112288987788
GameObject:
m_ObjectHideFlags: 0
@ -509,6 +568,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.2, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6567273624064263208}
m_Father: {fileID: 966261301282353436}
@ -554,6 +614,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.2, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6567273622351038539}
m_Father: {fileID: 966261301282349426}
@ -600,6 +661,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 966261301282438168}
m_Father: {fileID: 966261301251419734}
@ -619,6 +681,7 @@ MonoBehaviour:
m_EditorClassIdentifier:
MoveCharacterWithCamera: 1
RotateCharacterWithCamera: 1
ResizeCharacterHeightWithCamera: 1
TrackingSpace: {fileID: 966261301282368098}
CameraRig: {fileID: 966261301282438168}
CenterEyeAnchor: {fileID: 966261301282438172}
@ -762,6 +825,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -0.007, y: 0.0179, z: -0.0071}
m_LocalScale: {x: 0.1, y: 0.1, z: 0.1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7371194616433351675}
m_RootOrder: 0
@ -785,10 +849,12 @@ MeshRenderer:
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -813,6 +879,7 @@ MeshRenderer:
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1 &5252065515755812032
GameObject:
m_ObjectHideFlags: 0
@ -845,6 +912,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.007, y: 0.0179, z: -0.0071}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6567273622351038539}
m_RootOrder: 1
@ -931,6 +999,7 @@ ConfigurableJoint:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5252065515755812032}
m_ConnectedBody: {fileID: 0}
m_ConnectedArticulationBody: {fileID: 0}
m_Anchor: {x: 0, y: 0, z: 0}
m_Axis: {x: 0, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 0
@ -1061,6 +1130,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 7371194616433351675}
- {fileID: 5252065515755812039}
@ -1085,7 +1155,8 @@ MonoBehaviour:
HandAnimator: {fileID: 0}
handPoser: {fileID: 0}
autoPoser: {fileID: 0}
AutoPoseWhenNoGrabbable: 0
IdlePoseType: 0
UseIndexFingerTracking: 1
HandAnimationSpeed: 20
grabber: {fileID: 0}
GripAmount: 0
@ -1139,6 +1210,7 @@ Transform:
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6808192234808069332}
- {fileID: 6808192235254901043}
@ -1163,7 +1235,8 @@ MonoBehaviour:
HandAnimator: {fileID: 0}
handPoser: {fileID: 0}
autoPoser: {fileID: 0}
AutoPoseWhenNoGrabbable: 0
IdlePoseType: 0
UseIndexFingerTracking: 1
HandAnimationSpeed: 20
grabber: {fileID: 0}
GripAmount: 0
@ -1215,6 +1288,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 6039302616918204892}
m_Father: {fileID: 6567273624064263208}
@ -1250,6 +1324,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.01, y: 0.0179, z: 0.05}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6567273624064263208}
m_RootOrder: 2
@ -1349,6 +1424,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.01, y: 0.0179, z: -0.0071}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6567273624064263208}
m_RootOrder: 1
@ -1435,6 +1511,7 @@ ConfigurableJoint:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6808192235254901044}
m_ConnectedBody: {fileID: 0}
m_ConnectedArticulationBody: {fileID: 0}
m_Anchor: {x: 0, y: 0, z: 0}
m_Axis: {x: 0, y: 0, z: 0}
m_AutoConfigureConnectedAnchor: 0
@ -1567,6 +1644,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0.01, y: 0.0179, z: 0.05}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 6567273622351038539}
m_RootOrder: 2
@ -1660,6 +1738,7 @@ Transform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 3057265871269006133}
m_Father: {fileID: 6567273622351038539}

View File

@ -28,6 +28,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.005}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8574887230304856879}
m_RootOrder: 0
@ -54,12 +55,14 @@ MonoBehaviour:
m_GameObject: {fileID: 8574887230032114979}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: eca70ad1867acb141a7914818d64faa8, type: 2}
m_Color: {r: 1, g: 1, b: 1, a: 0.76862746}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
@ -72,6 +75,7 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8574887230304856864
GameObject:
m_ObjectHideFlags: 0
@ -101,6 +105,7 @@ RectTransform:
m_LocalRotation: {x: -0, y: 1, z: -0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0.0012500018, y: 0.00125, z: 0.0025000037}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8574887230032114978}
- {fileID: 8574887230597185244}
@ -152,7 +157,7 @@ MonoBehaviour:
m_GameObject: {fileID: 8574887230304856864}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
@ -165,6 +170,7 @@ MonoBehaviour:
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 10
m_PresetInfoIsWorld: 0
--- !u!1 &8574887230593980963
GameObject:
m_ObjectHideFlags: 0
@ -192,6 +198,7 @@ Transform:
m_LocalRotation: {x: 0, y: 1, z: 0, w: 0}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 10, y: 10, z: 10}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 8574887230304856879}
m_Father: {fileID: 0}
@ -241,6 +248,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8574887230304856879}
m_RootOrder: 1
@ -267,12 +275,14 @@ MonoBehaviour:
m_GameObject: {fileID: 8574887230597185245}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: fe87c0e1cc204ed48ad3b37840f39efc, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 3e14a760198d8714288e9921d74985a1, type: 2}
m_Color: {r: 0, g: 0, b: 0, a: 0.76862746}
m_RaycastTarget: 0
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
@ -285,6 +295,7 @@ MonoBehaviour:
m_FillClockwise: 1
m_FillOrigin: 0
m_UseSpriteMesh: 0
m_PixelsPerUnitMultiplier: 1
--- !u!1 &8574887230939293684
GameObject:
m_ObjectHideFlags: 0
@ -311,8 +322,9 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8574887230939293684}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: -90.01, y: -30.03, z: 0}
m_LocalPosition: {x: -4, y: -30, z: -0.1}
m_LocalScale: {x: 80, y: 80, z: 80}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8574887230304856879}
m_RootOrder: 3
@ -328,9 +340,12 @@ LineRenderer:
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 0
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_RayTracingMode: 0
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
@ -342,6 +357,7 @@ LineRenderer:
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
@ -453,6 +469,7 @@ RectTransform:
m_LocalRotation: {x: 0, y: 0.00000016048051, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8574887230304856879}
m_RootOrder: 2
@ -479,12 +496,14 @@ MonoBehaviour:
m_GameObject: {fileID: 8574887231078247985}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f70555f144d8491a825f0804e09c671c, type: 3}
m_Script: {fileID: 11500000, guid: 5f7201a12d95ffc409449d95f23cf332, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 2100000, guid: 0ebbcec4dd8e2f040b163f10df7e8382, type: 3}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []

View File

@ -8,9 +8,27 @@ public class CheckPoint : MonoBehaviour
{
public UnityEvent OnCheckpointPass;
private SplineTrigger _splineTrigger;
[ContextMenu("Debug Checkpoint")]
public void CheckPointPass()
{
OnCheckpointPass?.Invoke();
}
private void Awake()
{
_splineTrigger = GetComponentInChildren<SplineTrigger>();
}
private void OnEnable()
{
_splineTrigger.OnTriggerEvent.AddListener(CheckPointPass);
}
private void OnDisable()
{
_splineTrigger.OnTriggerEvent.RemoveListener(CheckPointPass);
}
}

37
Assets/CockpitUIModule.cs Normal file
View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
using UnityEngine.UI;
public class CockpitUIModule : MonoBehaviour
{
[SerializeField]
private UIPanel _previewPanel;
[SerializeField]
private Image _image;
[SerializeField]
private UITextShow _UITextShow;
public void ShowInfo(Sprite image, string description)
{
_image.sprite = image;
_previewPanel.ShowPanel();
_UITextShow.ShowSubtitle
(
description,
0.01f,
5,
null,
() => { _previewPanel.HidePanel(); }
);
}
[ContextMenu("Debug subtitre")]
private void DebugSubtitre()
{
ShowInfo(null, "Áîëüøîé òåêñò,Áîëüøîé òåêñò,Áîëüøîé òåêñò,Áîëüøîé òåêñò,Áîëüøîé òåêñò,Áîëüøîé òåêñò,Áîëüøîé òåêñò,");
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 7d4e50b97305e9143b92482db2537e43
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

8
Assets/CurvedUI.meta Normal file
View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1d29d85790e06c64b97a474009a8c090
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 2e8c173f938abc1458a125942335da72
timeCreated: 1452128296
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,207 @@

CurvedUI changelog--------------------------------//
3.2
Bugfixes
- Fixed an issue where TMP Text would not clear properly.
- Fixed a compile error in Unity 2020.1 and above.
- Removed Shaders that could show errors on URP and HDRP in Unity 2020.
- Fixed errors showing in Prefab Mode and added more descriptive messages.
3.1
New
- Added support for Oculus Integration v19.1 and above.
- Added a global Layer Mask for easier control over interactions.
Bugfixes
- Fixed an issue that could cause the UI to become unresponsive in Android platform builds.
- Fixed a naming conflict with Selectable class from other VR assets.
- Fixed an issue where Controller Override would not work in some Control Methods. If you are using this feature, you may need to re-assign your reference.
- Fixed an issue where CurvedUIPhysicsRaycaster would always raycast on all layers.
Changes
- CurvedUI now requires Unity 2018.4 or above.
- RaycastMyLayerOnly property has been deprecated to make room for new global Layer Mask.
3.0
New
- Added support for Unity XR Interaction Toolkit.
- Added support for interactions with 3D objects via EventTrigger components on all control methods.
Bugfixes
- Fixed an issue which could cause UI to be unresponsive to clicks in builds, even though it worked in Editor.
- Fixed an issue where cyrillic or chinese characters would be improperly displayed on dropdowns. Big thanks to Patrick M. for this one!
2.8p2
New
- CurvedUI will now check for common scene setup issues and let you know what might be happening.
Bugfixes
- Fixed GoogleVR issues on Unity 2019.2
- Updated demo scenes to include prefabs from new version of major SDKs.
2.8p1
Bugfixes
- Fixed an issue where dropdown would not work properly in Unity 2019+
- Fixed an issue where UI elements would be unresponsive on ultra wide aspect ratios.
- Fixed an issue where Text Mesh Pro objects would cause uneccesary performance cost when placed on scroll rects.
- Fixed an issue where Input Fields would get deselected on some control methods when user moves the pointer outside.
- Fixed an issue where TMP Input Fields would be improperly masked.
2.8
New
- Added support for Player Prefab from SteamVR's Interaction system.
- Improved performance with Text Mesh Pro.
- Small improvements to make SteamVR Plugin setup easier.
- CurvedUI will now automatically detect if Text Mesh Pro is present - no setup needed.
Bugfixes
- Fixed an issue that might cause a crash when curving super-long TMPro texts.
- Fixed code compilation warnings in Unity 2019
2.7p1
Bugfixes
- Fixed an issue in Gaze control method when pointing in and out of the canvas after a click would fire another click immidiately upon returning.
2.7
New
- Added support for SteamVR 2.0+
- Added an easy way to override pointer direction and origin for non-standard controllers.
Bugfixes
- Fixed gc leak in custom ray control method.
- GAZE control method will now properly work with vertical sliders.
- Dragging a slider will no longer cause it to flicker.
2.6p2
CurvedUI will now support VRTK with OculusSDK.
2.6p1
Bugfixes
- Fixed an issue which caused Image and Texts sometimes revert to flat versions.
- Fixed small gc leak.
2.6
New
- Added support for TMP Input Field' caret and selection.
- GearVR touchpad can now be used to click objects on canvas without having to be set up in Unity InputManager first.
- Added support for Oculus Go. Thanks to John for helping to test things out.
Bugfixes
-Fixed an issue where dropdowns could not be operated in OculusVR control
method.
-Fixed an issue where objects with interactable property set to false could still be
clicked with Gaze control method.
-Reduced GC allocation in continuously updated objects. Big thanks to Marko for
suggestions.
-Fixed improper slider value being set when clicked with Gaze control method on
Unity 2017.3+
-Fixed TMP objects not working as templates of a dropdown.
-Fixed an issue where Gaze Progress Image would not animate properly with 2 or
more curved canvases on the screen.
-Fixed an issue where changing the fill of an image would not prompt CurvedUI to
update it.
Fixed an issue where Grip and Menu button presses where not properly fired in CurvedUIViveController class.
2.5p1
- fixed compile error on some Unity versions when used in SteamVR control method
2.5
New
-CurvedUI can now auto detect newest version of Text Mesh Pro and automatically enable support for it. A big thank you to TMP author - Stephan_B - for providing a way for this.
- CurvedUI will now automatically check for interactable objects outside of the canvas and suggest a fix.
- Added public PointingAtCanvas bool for easy access to this data.
- CurvedUILaserBeam now has an option to hide the beam when not aiming at a canvas.
- OCULUSVR control method will now support GearVR remote.
Changes
- Renamed VIVE control method to STEAMVR control method. It now supports Vive, Oculus, Microsoft Mixed Reality and all other devices using SteamVR SDK.
- Renamed OCULUS TOUCH control method to OCULUSVR control method. It now supports Oculus, GearVR and (in the future) Oculus Go headsets.
Bugfixes
-Fixed a bug where some VRTK rigs would throw a null reference exception when used with CurvedUI
-Fixed an issue where TMP Submeshes would be curved twice.
-Fixed an issue where some TMP objects would be deformed in Edit mode.
-Fixed an issue with GAZE control method where progress bar would stay full if scene was launched without a visible canvas.
-Fixed an issue where large scale (ex. 1,1,1) canvases with very small size (ex. 1x1) would suffer from bad curve quality.
2.4
New and Improved
-Added Support for GoogleVR SDK 1.110 or later.
Changes
-Removed support for Unity 5.2 and earlier for clearer code base.
-Removed Daydream control method. Use GoogleVR control method for Daydream apps instead.
-CurvedUI now requires Unity 5.6 and up to run GoogleVR. Other control methods can be used in earlier versions of Unity.
Bugfixes
-Fixed a bug where adding CurvedUI to a GoogleVR demo scene required additional modifications of components on EventSystem gameobject.
-Gaze control method will now properly fire all click events.
-Gaze control method will now properly work with dropdowns.
-RaycastToCanvasSpace method will now properly take canvas layer into account.
-Fixed a bug where using ScrollView with Custom Ray control method would make it jump upon pressing down the controller.
2.3p1
New and Improved:
-Updated GoogleVR demo scene to Google VR Unity SDK 1.70
Bugfixes:
-Fixed a memory leak issue that sometimes affected canvases with TMP components.
-CurvedUISettings.CanvasToCurvedCanvas method will now work before first Update.
2.3
New and Improved:
-Updated OrientOnCurvedSurface.cs script to work in every possible case.
-Cached some references in scripts for added performance.
-Raycast My Layer Only is now default option for new canvases.
Bugfixes:
-Gaze Click now works on toggles.
-Gaze Click will no longer fire when no Selectable is under the pointer.
-Gaze Click will no longer fire on disabled Buttons.
-Fixed Gaze Click firing multiple times in single frame with multiple canvases on the scene.
-Fixed Gaze Control Method not firing OnBeginDrag and OnEndDrag events.
-Fixed Text Mesh Pro support excessive performance cost due to constant updates.
-Fixed OnPointerExit and OnPointerEnter events being called every frame with Custom Ray control method.
-Fixed erratic scroll behaviour with Custom Ray control method.
2.2:
New and Improved:
-Added support for switching to Vive control method during runtime.
-Vive Control method now also supports Oculus Touch when used via SteamVR. This includes adjusted pointing direction.
-Controller hand can now be picked for Oculus Touch
-Oculus Touch control method will now automatically find hand controllers.
-Unified variable names across namespace. ActiveVRController is now Hand. CurvedUIController is now CUIControlMethod.
-Added an error message for when EventSystem component is missing from the scene.
-Added a controlling hand auto switcher script to allow you to replicate the behavior in Oculus Home using your menu.
-Added an option to force box collider use for cylinder and ring canvases.
-Removed or resized some assets from Demo Scenes to make the package smaller.
Bugfixes:
-Fixed a bug where "Raycast My Layer Only" option would not work on canvases that are children of rigidbodies.
-Fixed an issue where objects were not properly deselected in Custom Ray control method.
-Fixed jittery motion in Dragging with Gaze demo
-Fixed Text Mesh Pro submeshes not being properly Curved
-Fixed sudden jump that occurred for some scrollrects when using Gaze control method.
-Fixed Input caret not working on multi-line Input fields.
-Gaze demo scene will now work when launched on mobiles.
-Fixed an issue where turning off a controller during runtime would throw index out of bounds exception
-Fixed a bug where Text Mesh Pro objects would wiggle when planced on a canvas attached to a steamvr controller.
-"Remove Effect From Canvas" will now properly remove TMP related components.
2.1p1
Fixed Unity 5.6 compile bug.
Fixed World Space Mouse demo scene.
2.1:
Moved all the scripts to CurvedUI namesspace. You may need to add "using CurvedUI;" to your scripts accessing CurvedUI methods.
Fixed a bug where CurvedUI would not compile on some older unity versions.
Fixed a bug where objects with z different than 0 would not be rendered in a right spot in sphere canvas.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0472aa2e752b0024da18ef6977db9e68
timeCreated: 1544385427
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 30a5839c64710084bb08de9642a0fa5b
folderAsset: yes
timeCreated: 1450574478
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6587f89f0fecf07488ca56ad03898989
timeCreated: 1453838068
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 1ccc7d7ba4e4b4de7bb0f51967d2f59e
timeCreated: 1453941443
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: faca241add7f99c459f548f9d1e6ca35
timeCreated: 1453670823
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3391a558826c77242955cba56264e864
timeCreated: 1452909403
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 06c69c9d191620c4ab0298cf166e8a43
timeCreated: 1453329406
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 118ac02c94c9a6547aa021ca1a89b1da
timeCreated: 1461951776
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 642f1711dfc24644b99ffd22552518b2
timeCreated: 1455058727
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: bbda1dbd218e76443b1bd6fc3dfb310a
timeCreated: 1455376422
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a2a0d41527917c346b32e609d1fc811d
timeCreated: 1457184188
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 40071f9cfc6591041904e7e8d3f08b53
timeCreated: 1457191383
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: a7135d14b891c894384d81a2061594b1
timeCreated: 1463937449
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 29814d04dd6c2a34590e8615d250046b
timeCreated: 1539217215
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: dc119db224c293b4696571d89342a5f5
timeCreated: 1480523764
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: c2588879e0050492f916d382829f7072
timeCreated: 1511550918
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 87f0de67ee0baa14fb5b95be8730a737
folderAsset: yes
timeCreated: 1451860091
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,35 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace CurvedUI
{
public class CUI_AnimateCurvedFillOnStart : MonoBehaviour
{
// Update is called once per frame
void Update()
{
CurvedUISettings set = this.GetComponent<CurvedUISettings>();
Text textie = this.GetComponentInChildren<Text>();
if (Time.time < 1.5f)
{
set.RingFill = Mathf.PerlinNoise(Time.time * 30.23234f, Time.time * 30.2313f) * 0.15f;
textie.text = "Accesing Mainframe...";
}
else if (Time.time < 2.5f)
{
set.RingFill = Mathf.Clamp(set.RingFill + Time.deltaTime * 3, 0, 1);
textie.text = "Mainframe Active";
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 352e27348d502a945a10820320590fb3
timeCreated: 1453675907
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,46 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_CameraController : MonoBehaviour
{
public static CUI_CameraController instance;
#pragma warning disable 0649
[SerializeField]
Transform CameraObject;
[SerializeField]
float rotationMargin = 25;
[SerializeField]
bool runInEditorOnly = true;
#pragma warning restore 0649
// Use this for initialization
void Awake()
{
instance = this;
}
#if UNITY_EDITOR
// Update is called once per frame
void Update()
{
if((Application.isEditor || !runInEditorOnly) && !UnityEngine.XR.XRSettings.enabled)
{
CameraObject.localEulerAngles = new Vector3(Input.mousePosition.y.Remap(0, Screen.height, rotationMargin, -rotationMargin),
Input.mousePosition.x.Remap(0, Screen.width, -rotationMargin, rotationMargin),
0);
}
}
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e2f593149fee947adb37ef66cd8b7f5c
timeCreated: 1451320085
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,43 @@
using UnityEngine;
using System.Collections;
public class CUI_CameraRotationOnButtonHeld : MonoBehaviour {
[SerializeField]
float Sensitivity = 0.5f;
Vector3 oldMousePos;
bool move = true;
// Use this for initialization
void Start () {
oldMousePos = Input.mousePosition;
}
#if UNITY_EDITOR
// Update is called once per frame
void Update() {
if (Input.GetButton("Fire2"))
{
move = true;
}
else
move = false;
if (move)
{
Vector2 mouseDelta = Input.mousePosition - oldMousePos;
this.transform.eulerAngles = this.transform.eulerAngles + new Vector3(mouseDelta.y, -mouseDelta.x, 0) * Sensitivity;
}
oldMousePos = Input.mousePosition;
}
#endif
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: f1286595337f32d4db5ac6f23a9d5210
timeCreated: 1455382946
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using System.Security.Cryptography.X509Certificates;
using UnityEngine;
namespace CurvedUI
{
public class CUI_ChangeColor : MonoBehaviour
{
public void ChangeColorToBlue()
{
this.GetComponent<Renderer>().material.color = Color.blue;
}
public void ChangeColorToCyan()
{
this.GetComponent<Renderer>().material.color = Color.cyan;
}
public void ChangeColorToWhite()
{
this.GetComponent<Renderer>().material.color = Color.white;
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: d10cbeeea58fa0441b1bb92c83da6e6e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,73 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace CurvedUI
{
public class CUI_ChangeValueOnHold : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
{
bool pressed = false;
bool selected = false;
#pragma warning disable 0649
[SerializeField]
Image bg;
[SerializeField]
Color SelectedColor;
[SerializeField]
Color NormalColor;
[SerializeField]
CanvasGroup IntroCG;
[SerializeField]
CanvasGroup MenuCG;
#pragma warning restore 0649
// Update is called once per frame
void Update()
{
pressed = Input.GetKey(KeyCode.Space) || Input.GetButton("Fire1");
ChangeVal();
}
void ChangeVal()
{
if (this.GetComponent<Slider>().normalizedValue == 1)
{
//fade intro screen if we reached max slider value
IntroCG.alpha -= Time.deltaTime;
MenuCG.alpha += Time.deltaTime;
}
else {
//change slider value - increase if its selected and button is pressed
this.GetComponent<Slider>().normalizedValue += (pressed && selected) ? Time.deltaTime : -Time.deltaTime;
}
//change if intro screen can block interactions based on its opacity
IntroCG.blocksRaycasts = IntroCG.alpha > 0;
}
public void OnPointerEnter(PointerEventData data)
{
bg.color = SelectedColor;
bg.GetComponent<CurvedUIVertexEffect>().TesselationRequired = true;
selected = true;
}
public void OnPointerExit(PointerEventData data)
{
bg.color = NormalColor;
bg.GetComponent<CurvedUIVertexEffect>().TesselationRequired = true;
selected = false;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a2cee7bf50f35b849b453cf36ef321ad
timeCreated: 1453329811
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,109 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace CurvedUI
{
/// <summary>
/// This component enables accurate object dragging over curved canvas. It also allows user to drop the object on another canvas.
/// It supports both mouse and gaze controllers. Add it to your canvas object with image component.
/// </summary>
public class CUI_DragBetweenCanvases : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{
//saved location where we grabbed the panel
Vector2 dragPoint;
public void OnBeginDrag(PointerEventData data)
{
Debug.Log("OnBeginDrag");
Vector2 newPos = Vector2.zero;
RaycastPosition(out newPos);
//save distance from click point to object center to allow for precise dragging
dragPoint = new Vector2((transform as RectTransform).localPosition.x, (transform as RectTransform).localPosition.y) - newPos;
}
/// <summary>
/// drag the transform along the mouse. We use raycast to determine its position on curved canvas.
/// </summary>
/// <param name="data"></param>
public void OnDrag(PointerEventData data)
{
CurvedUISettings myCurvedCanvas = GetComponentInParent<CurvedUISettings>();
Ray ray3d = Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));
if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.MOUSE)
{
//position when using mouse
ray3d = Camera.main.ScreenPointToRay(Input.mousePosition);
}
else if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.GAZE)
{
//position when using gaze
ray3d = Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f));
}
//find a canvas underneath the pointer.
RaycastHit hit;
if (Physics.Raycast(ray3d, out hit))
{
CurvedUISettings curvedCanvasUnderPointer = hit.collider.GetComponentInParent<CurvedUISettings>();
Vector2 newPos = Vector2.zero;
if (curvedCanvasUnderPointer != null)
{
//change canvas if we moved it to the other one.
if(curvedCanvasUnderPointer != myCurvedCanvas)
{
//move this panel to the other canvas and resets its position.
this.transform.SetParent(curvedCanvasUnderPointer.transform);
this.transform.ResetTransform();
//force the panel and each of its children to update their parent CurvedUISettings.
//This will ensure they will rebuild with proper angle and stuff.
foreach(CurvedUIVertexEffect eff in GetComponentsInChildren<CurvedUIVertexEffect>())
{
eff.FindParentSettings(true);
}
}
//find the raycast position in flat canvas units.
curvedCanvasUnderPointer.RaycastToCanvasSpace(ray3d, out newPos);
//set the new position of the panel. Add the drag point so we're still holding the object in the same spot.
(transform as RectTransform).localPosition = newPos + dragPoint;
}
}
}
public void OnEndDrag(PointerEventData data)
{
Debug.Log("OnEndDrag");
}
void RaycastPosition(out Vector2 newPos)
{
if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.MOUSE)
{
//position when using mouse
GetComponentInParent<CurvedUISettings>().RaycastToCanvasSpace(Camera.main.ScreenPointToRay(Input.mousePosition), out newPos);
}
else if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.GAZE)
{
//position when using gaze
GetComponentInParent<CurvedUISettings>().RaycastToCanvasSpace(Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f)), out newPos);
}
else newPos = Vector2.zero;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1e61d03f703496f4393e12b100d437d9
timeCreated: 1468436008
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,63 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace CurvedUI
{
public class CUI_GunController : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
CurvedUISettings ControlledCanvas;
[SerializeField]
Transform LaserBeamTransform;
#pragma warning restore 0649
// Update is called once per frame
void Update()
{
//tell canvas to use the direction of the gun as a ray controller
Ray myRay = new Ray(this.transform.position, this.transform.forward);
if (ControlledCanvas)
CurvedUIInputModule.CustomControllerRay = myRay;
//change the laser's length depending on where it hits
float length = 10000;
RaycastHit hit;
if (Physics.Raycast(myRay, out hit, length))
{
//check for graphic under pointer if we hit curved canvas. We only want transforms with graphics that are drawn by canvas (depth not -1) to block the pointer.
int SelectablesUnderPointer = 0;
if (hit.transform.GetComponent<CurvedUIRaycaster>() != null)
{
SelectablesUnderPointer = hit.transform.GetComponent<CurvedUIRaycaster>().GetObjectsUnderPointer().FindAll(x => x.GetComponent<Graphic>() != null && x.GetComponent<Graphic>().depth != -1).Count;
}
//Debug.Log("found graphics: " + SelectablesUnderPointer);
length = SelectablesUnderPointer == 0 ? 10000 : Vector3.Distance(hit.point, this.transform.position);
}
LaserBeamTransform.localScale = LaserBeamTransform.localScale.ModifyZ(length);
//make laser beam thicker if mose is pressed
if (Input.GetMouseButton(0))
{
LaserBeamTransform.localScale = LaserBeamTransform.localScale.ModifyX(0.75f).ModifyY(0.75f);
}
else {
LaserBeamTransform.localScale = LaserBeamTransform.localScale.ModifyX(0.2f).ModifyY(0.2f);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 97902b8f214c3495ca9c34b007589a95
timeCreated: 1455977003
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,44 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
/// <summary>
/// A simple script to make the pointer follow mouse movement and pass the control ray to canvsa
/// </summary>
public class CUI_GunMovement : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
CurvedUISettings mySettings;
[SerializeField]
Transform pivot;
[SerializeField]
float sensitivity = 0.1f;
Vector3 lastMouse;
#pragma warning restore 0649
// Use this for initialization
void Start()
{
lastMouse = Input.mousePosition;
}
// Update is called once per frame
void Update()
{
Vector3 mouseDelta = Input.mousePosition - lastMouse;
lastMouse = Input.mousePosition;
pivot.localEulerAngles += new Vector3(-mouseDelta.y, mouseDelta.x, 0) * sensitivity;
//pass ray to canvas
Ray myRay = new Ray(this.transform.position, this.transform.forward);
CurvedUIInputModule.CustomControllerRay = myRay;
CurvedUIInputModule.CustomControllerButtonState = Input.GetButton("Fire1");
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ecf5234e5e13740a090810d98086d328
timeCreated: 1455977016
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,19 @@
using UnityEngine;
using System.Collections;
public class CUI_MoveAlong : MonoBehaviour {
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
(transform as RectTransform).anchoredPosition = new Vector2((transform as RectTransform).anchoredPosition.x + (transform as RectTransform).anchoredPosition.x / 100.0f, (transform as RectTransform).anchoredPosition.y);
if((transform as RectTransform).anchoredPosition.x > (transform.parent as RectTransform).rect.width)
(transform as RectTransform).anchoredPosition = new Vector2(20, (transform as RectTransform).anchoredPosition.y);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ea03d4139d9c0594db5f99faf8204491
timeCreated: 1451940575
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,31 @@
using UnityEngine;
using System.Collections;
public class CUI_MoveHeartbeat : MonoBehaviour {
public float speed;
public bool wrapAroundParent = true;
RectTransform rectie;
RectTransform parentRectie;
void Start(){
rectie = (transform as RectTransform);
parentRectie = transform.parent as RectTransform;
}
// Update is called once per frame
void Update () {
rectie.anchoredPosition = new Vector2(rectie.anchoredPosition.x - speed * Time.deltaTime,
rectie.anchoredPosition.y);
if(wrapAroundParent){
if(rectie.anchoredPosition.x + rectie.rect.width < 0 )
rectie.anchoredPosition = new Vector2(parentRectie.rect.width, rectie.anchoredPosition.y);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: cdf6eda1caf908949b4fc97abb39247c
timeCreated: 1452030171
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_OrientOnCurvedSpace : MonoBehaviour
{
public CurvedUISettings mySettings;
// Use this for initialization
void Awake()
{
mySettings = GetComponentInParent<CurvedUISettings>();
}
// Update is called once per frame
void Update()
{
Vector3 positionInCanvasSpace = mySettings.transform.worldToLocalMatrix.MultiplyPoint3x4(this.transform.parent.position);
transform.position = mySettings.CanvasToCurvedCanvas(positionInCanvasSpace);
transform.rotation = Quaternion.LookRotation(mySettings.CanvasToCurvedCanvasNormal(transform.parent.localPosition), transform.parent.up);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6855572de39673e4e87aaaae77c04e76
timeCreated: 1455057006
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_PerlinNoisePosition : MonoBehaviour
{
public float samplingSpeed = 1;
public Vector2 Range;
RectTransform rectie;
// Use this for initialization
void Start()
{
rectie = transform as RectTransform;
}
// Update is called once per frame
void Update()
{
rectie.anchoredPosition = new Vector2(Mathf.PerlinNoise(Time.time * samplingSpeed, Time.time * samplingSpeed).Remap(0, 1, -Range.x, Range.x),
Mathf.PerlinNoise(Time.time * samplingSpeed * 1.333f, Time.time * samplingSpeed * 0.888f).Remap(0, 1, -Range.y, Range.y));
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 01a69fb5ed7f9f4459e5ac373ce731ed
timeCreated: 1452031113
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,28 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_PerlinNoiseRotation : MonoBehaviour
{
public float samplingSpeed = 1;
public float maxrotation = 60;
RectTransform rectie;
// Use this for initialization
void Start()
{
rectie = transform as RectTransform;
}
// Update is called once per frame
void Update()
{
rectie.localEulerAngles = new Vector3(0, 0, Mathf.PerlinNoise(Time.time * samplingSpeed, Time.time * samplingSpeed).Remap(0, 1, -maxrotation, maxrotation));
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 3e32822674f3035459f9e8378e054359
timeCreated: 1452031430
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,29 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace CurvedUI
{
public class CUI_PickImageFromSet : MonoBehaviour
{
static CUI_PickImageFromSet picked = null;
public void PickThis()
{
if (picked != null)
picked.GetComponent<Button>().targetGraphic.color = Color.white;
Debug.Log("Clicked this!", this.gameObject);
picked = this;
picked.GetComponent<Button>().targetGraphic.color = Color.red;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 96e169e56a3546446b6e88b46e799dbe
timeCreated: 1494355383
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,27 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_RaycastToCanvas : MonoBehaviour
{
CurvedUISettings mySettings;
// Use this for initialization
void Start()
{
mySettings = GetComponentInParent<CurvedUISettings>();
}
// Update is called once per frame
void Update()
{
Vector2 pos = Vector2.zero;
mySettings.RaycastToCanvasSpace(Camera.main.ScreenPointToRay(Input.mousePosition), out pos);
this.transform.localPosition = pos;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9056800cd0f6b204aa1cb4c1e7e206c6
timeCreated: 1455056269
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CUI_RemoteMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _Glossiness: 0.281
- _Metallic: 0.53
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0.25735295, g: 0.25735295, b: 0.25735295, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 58128c602a6a4c74b9ac5b22a7244265
timeCreated: 1462558172
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_RiseChildrenOverTime : MonoBehaviour
{
float current = 0;
public float Speed = 10;
public float RiseBy = 50;
// Use this for initialization
void Start()
{
}
// Update is called once per frame
void Update()
{
current += Speed * Time.deltaTime;
if (Mathf.RoundToInt(current) >= this.transform.childCount)
current = 0;
if (Mathf.RoundToInt(current) < 0)
current = this.transform.childCount - 1;
for (int i = 0; i < this.transform.childCount; i++)
{
if (Mathf.RoundToInt(current) == i)
this.transform.GetChild(i).localPosition = this.transform.GetChild(i).localPosition.ModifyZ(-RiseBy);
else
this.transform.GetChild(i).localPosition = this.transform.GetChild(i).localPosition.ModifyZ(0);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 322b74a1fcc1b184f9c47fb8290bfa99
timeCreated: 1453675093
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,16 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class CUI_ShowParentCoordinates : MonoBehaviour {
// Use this for initialization
void Start () {
this.GetComponent<Text>().text = transform.parent.GetComponent<RectTransform>().anchoredPosition.ToString();
}
// Update is called once per frame
void Update () {
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2f88cc6852da34004b9a9d73e76dd3dc
timeCreated: 1451386426
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,36 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_TMPChecker : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
GameObject testMsg;
[SerializeField]
GameObject enabledMsg;
[SerializeField]
GameObject disabledMsg;
#pragma warning restore 0649
// Use this for initialization
void Start()
{
testMsg.gameObject.SetActive(false);
#if CURVEDUI_TMP || TMP_PRESENT
enabledMsg.gameObject.SetActive(true);
disabledMsg.gameObject.SetActive(false);
#else
enabledMsg.gameObject.SetActive(false);
disabledMsg.gameObject.SetActive(true);
#endif
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: e2216561c03910048a8773e191c9461e
timeCreated: 1457184525
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,84 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
namespace CurvedUI {
/// <summary>
/// This script show you how to access the state of any button on Vive Controller via CurvedUI scripts. We use right controller as an example
/// </summary>
public class CUI_ViveButtonState : MonoBehaviour
{
enum ViveButton
{
Trigger,
TouchpadTouch,
TouchpadPress,
Grip,
Menu,
}
#pragma warning disable 414 // this is just so we wont get "unused variable" code warnings when compiling without Vive.
[SerializeField]
Color ActiveColor = Color.green;
[SerializeField]
Color InActiveColor = Color.gray;
[SerializeField] ViveButton ShowStateFor = ViveButton.Trigger;
#pragma warning restore 414
#if CURVEDUI_STEAMVR_LEGACY
// Update is called once per frame
void Update()
{
if(CurvedUIInputModule.Right == null)
{
Debug.LogError("Right controller not found - it may be off");
return;
}
bool pressed = false;
switch (ShowStateFor)
{
case ViveButton.Trigger:
{
pressed = GetUsedController().IsTriggerPressed;
break;
}
case ViveButton.TouchpadPress:
{
pressed = GetUsedController().IsTouchpadPressed;
break;
}
case ViveButton.TouchpadTouch:
{
pressed = GetUsedController().IsTouchpadTouched;
break;
}
case ViveButton.Grip:
{
pressed = GetUsedController().IsGripPressed;
break;
}
case ViveButton.Menu:
{
pressed = GetUsedController().IsApplicationMenuPressed;
break;
}
}
this.GetComponentInChildren<Image>().color = pressed ? ActiveColor : InActiveColor;
}
CurvedUIViveController GetUsedController()
{
return CurvedUIInputModule.Instance.UsedHand == CurvedUIInputModule.Hand.Right ? CurvedUIInputModule.Right : CurvedUIInputModule.Left;
}
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 411881b1a2deb6f449d6e3a17ed24a1d
timeCreated: 1465031357
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI {
public class CUI_ViveHapticPulse : MonoBehaviour
{
#pragma warning disable 414 // this is just so we wont get "unused variable" code warnings when compiling without Vive.
float PulseStrength;
#pragma warning restore 414
void Start()
{
PulseStrength = 1;
}
public void SetPulseStrength(float newStr)
{
PulseStrength = Mathf.Clamp(newStr, 0, 1);
}
public void TriggerPulse()
{
#if CURVEDUI_STEAMVR_LEGACY
CurvedUIInputModule.Right.TriggerHapticPulse(1, (ushort)(PulseStrength * 3000));
#endif
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: d21ee6958fde00a459bad1dd21c69cdf
timeCreated: 1465032281
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_WorldSpaceCursorFollow : MonoBehaviour
{
CurvedUISettings mySettings;
// Use this for initialization
void Start()
{
mySettings = GetComponentInParent<CurvedUISettings>();
CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace -= (mySettings.transform as RectTransform).rect.size / 2.0f;
}
// Update is called once per frame
void Update()
{
transform.localPosition = CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 5da4fac42ba88a14aa79010b056f5c35
timeCreated: 1455376524
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace CurvedUI
{
public class CUI_WorldSpaceMouseMultipleCanvases : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
List<CurvedUISettings> ControlledCanvases;
[SerializeField]
Transform WorldSpaceMouse;
[SerializeField]
CurvedUISettings MouseCanvas;
#pragma warning restore 0649
// Update is called once per frame
void Update()
{
Vector3 worldSpaceMousePosInWorldSpace = MouseCanvas.CanvasToCurvedCanvas(WorldSpaceMouse.localPosition);
Ray ControllerRay = new Ray(Camera.main.transform.position, worldSpaceMousePosInWorldSpace - Camera.main.transform.position);
CurvedUIInputModule.CustomControllerRay = ControllerRay;
if (Input.GetButton("Fire2"))
{
Vector2 newPos = Vector2.zero;
MouseCanvas.RaycastToCanvasSpace(new Ray(Camera.main.transform.position, Camera.main.transform.forward), out newPos);
CurvedUIInputModule.Instance.WorldSpaceMouseInCanvasSpace = newPos;
}
Debug.DrawRay(ControllerRay.GetPoint(0), ControllerRay.direction * 1000, Color.cyan);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6206dea7ed484b149ab1982eba89d551
timeCreated: 1455382387
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 66f869436ad3f3e41a8b35aa1d5e7d1b
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: b9a4e0d5bbe15284d85d077fc42c4974
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 147ae205ff448a544a091aa19d032aa1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 35, y: 35, z: 35, w: 35}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 02323fee9b41c9e49ae51da96b227e67
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 403 B

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 4461ec9a5cc44e94a9e5e3328e0ea1a8
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: af6ab107aa02832488a0bb9c935ce275
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 806 B

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 303230561df1d3c47bb04082101df0d6
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 34767731de85b084cbfbadb7f6a04e26
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 35e866292b6fced4291b4827053930f3
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: a17c216d62e23bc428c542df796ed7ae
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 2d5a15a342801574faa1555be6aeb52d
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 7e6f8ce167b288442a7861572b0237e0
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 598870637d12c72428d4b103312db9cd
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 37786d8100c10104b85861a074209b62
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 729 B

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 1d4948cb340975049a089512e0d55db0
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: ac5e80c746392734b89bd0d139a41eaf
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 858 B

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: d1a648e5201a01a4f81bf03d26d870c8
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 27bb77ac519f6e145988f834f13c0184
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 269185afa1036b94eb055cc280df3d7d
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 7dc8c9c76a867d04f813f509f7a3404d
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 1ca24597949c7354184c89ed00f75878
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 99d7f8546cd91304c93242c515296a76
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 99e1b1e2835ee8b42b81dc16683b1a79
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 500
spriteBorder: {x: 125, y: 125, z: 125, w: 125}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: f855335519ba563408b8b5632517f5ed
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 7d906c9e2617bee489b89f268114fb55
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2469f75e489f2cb458628bd152af4e00
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 203e6d7e0be3c7d48b77fe119ea3c17c
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 1155e2afb5fce2240b015169c40e4dc0
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 880355417caa6ac48b6b29490221ea24
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: c119215e0f5ec92408963647f5c6fc5d
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,72 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace CurvedUI
{
/// <summary>
/// This component enables accurate object dragging over curved canvas. It supports both mouse and gaze controllers. Add it to your canvas object with image component.
/// </summary>
public class CUI_draggable : MonoBehaviour, IBeginDragHandler, IEndDragHandler, IDragHandler
{
Vector2 savedVector;
bool isDragged = false;
public void OnBeginDrag(PointerEventData data)
{
Debug.Log("OnBeginDrag");
Vector2 newPos = Vector2.zero;
RaycastPosition(out newPos);
//save distance from click point to object center to allow for precise dragging
savedVector = new Vector2((transform as RectTransform).localPosition.x, (transform as RectTransform).localPosition.y) - newPos;
isDragged = true;
}
public void OnDrag(PointerEventData data) { }
public void OnEndDrag(PointerEventData data)
{
Debug.Log("OnEndDrag");
isDragged = false;
}
void LateUpdate()
{
if (!isDragged) return;
Debug.Log("OnDrag");
//drag the transform along the mouse. We use raycast to determine its position on curved canvas.
Vector2 newPos = Vector2.zero;
RaycastPosition(out newPos);
//add our initial distance from objects center
(transform as RectTransform).localPosition = newPos + savedVector;
}
void RaycastPosition(out Vector2 newPos)
{
if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.MOUSE)
{
//position when using mouse
GetComponentInParent<CurvedUISettings>().RaycastToCanvasSpace(Camera.main.ScreenPointToRay(Input.mousePosition), out newPos);
}
else if (CurvedUIInputModule.ControlMethod == CurvedUIInputModule.CUIControlMethod.GAZE)
{
//position when using gaze - uses the center of the screen as guiding point.
GetComponentInParent<CurvedUISettings>().RaycastToCanvasSpace(Camera.main.ScreenPointToRay(new Vector2(Screen.width / 2.0f, Screen.height / 2.0f)), out newPos);
}
else newPos = Vector2.zero;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 9df78d2658b45594ea87b756ef684b4c
timeCreated: 1456862010
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: dc4338bce18c0a842917063439ad30c6
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 9178a34c3b424cd4fa6798ad8b05d5f8
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: a5f9e76f8f35b554c8b9c0ee3c84fcc4
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: f0a937afbae48644a98b45b395d371dd
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 4d58b4a339a78f949b984ac880c61fb1
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 9a55dd4d00688e04ab390999aeccf899
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 07eaae54faefa09459116a548bd95870
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 0e817f504dfbde54694188e66c60c3c3
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: f6fe0162ad87201498bfa56d33084322
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: d130b27cc0a28594aaf3339b96b1d78a
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 9bf77713c15c1044da05340b0f6d8380
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: e2dd136d7b6953e488700bbcdf460a2e
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 65 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: ccad86f60f935ae41a74a90337895ea0
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -3
maxTextureSize: 512
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 512
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 0
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2574bae63ba33ec46be88558d596188a
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 617c32f9cbe8f134087bdc99edbf7afd
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 546f6254e60b2fa4fafcdfecb08293fa
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 535 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 11feeab7fc306234b941d696fcb38509
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 1b1d441d463b0a74ba3bdbd411fe7110
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 56e6662f7228f63459766efeb1470a81
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 4a4752eef96780747ada5afb097e7887
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: d16f13cc8b620494c90f8fadb41d1537
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 822c0e90e8411bc48b7525d752854ddb
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.5 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 6a972d2522e604349bbffdfe3c59b786
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: a6f9bca8221ca254d9e1f21abae2c1b0
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.0 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 9c992602dca3c20439cbaeba77cc97d5
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 46cdaf20821fbd641a566014ab909407
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 3c037ef55dbb2c74caec8e0a284876cc
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5af2e7e5d6220f04b80e5e7857063827
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: b23acdc87c3f4794c8dc8a44fb71807b
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 530ad750348b9ef47b8ea142cd9d6b97
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,39 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
public class CUI_inventory_paralax : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
Transform front;
[SerializeField]
Transform back;
#pragma warning restore 0649
Vector3 initFG;
Vector3 initBG;
public float change = 50;
// Use this for initialization
void Start()
{
initFG = front.position;
initBG = back.position;
}
// Update is called once per frame
void Update()
{
front.position = front.position.ModifyX(initFG.x + Input.mousePosition.x.Remap(0, Screen.width, -change, change));
back.position = back.position.ModifyX(initBG.x - Input.mousePosition.x.Remap(0, Screen.width, -change, change));
front.position = front.position.ModifyY(initFG.y + Input.mousePosition.y.Remap(0, Screen.height, -change, change) * (Screen.height / Screen.width));
back.position = back.position.ModifyY(initBG.y - Input.mousePosition.y.Remap(0, Screen.height, -change, change) * (Screen.height / Screen.width));
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 1dc35770747ad214692acc5d8d4200d2
timeCreated: 1453838464
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,79 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CUI_laserbeam
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHAPREMULTIPLY_ON
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 2000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMask: 15
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _Glossiness: 0.5
- _Metallic: 0
- _Mode: 3
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SrcBlend: 1
- _Stencil: 0
- _StencilComp: 8
- _StencilOp: 0
- _StencilReadMask: 255
- _StencilWriteMask: 255
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 0, b: 0, a: 0.322}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f9da22ae34fa249c9b5d876eaa40a3a2
timeCreated: 1456064520
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 495b9e424ef58b44daa5a3a65e19cc04
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: a5a4fc767bfef9748b596ea8430a1993
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 23b824c0b23f7684dbadc89a963f7169
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: d2c1212a9df3be14ab926c9954070f35
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 0c2b9356e91dd264e92b13fea674a51e
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 0b4d7156408eb7a4c999aa8f8cffd740
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 8a01994e8a3d2cf4f97dc67f0010e29f
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 560db87fc46a93d4cb40ed72a167c45b
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 52 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: d01ccea566cf92a4d8f85a781206c5da
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 35f125763f1e49d41a2aae34cae8009c
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

@ -0,0 +1,110 @@
fileFormatVersion: 2
guid: 0fb5af2261ed91245ae5d2f1574ee5d3
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: PS4
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 506e8027602ea7d4794ec556540a6a4d
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,22 @@
using UnityEngine;
using System.Collections;
public class CUI_rotation_anim : MonoBehaviour {
public Vector3 Rotation;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
this.transform.RotateAround(this.transform.position, this.transform.up, Rotation.y * Time.deltaTime);
this.transform.RotateAround(this.transform.position, this.transform.right, Rotation.x * Time.deltaTime);
this.transform.RotateAround(this.transform.position, this.transform.forward, Rotation.z * Time.deltaTime);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 27ec5bc2b6ce84387a29fe79ed245e38
timeCreated: 1454101950
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: f2c31004430cee341be9a17eab16e23b
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 414875a518f13a84a8d20f0e62858d8e
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 53 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 5b737c3a72bd90f40b50c20a0bdf0463
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 138c5dea612b39546a1aa523535c7052
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 6a7f848d6286044448bed69087cde5ae
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: f11132b3123deee449f5f1521f35910c
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,42 @@
using UnityEngine;
using System.Collections;
using CurvedUI;
public class CUI_touchpad : MonoBehaviour {
#pragma warning disable 0649
RectTransform container;
[SerializeField] RectTransform dot;
#pragma warning restore 0649
#if CURVEDUI_STEAMVR_LEGACY
CurvedUIViveController controller;
void Start () {
controller = CurvedUIInputModule.Right;
//subscribe to event that will be fired every time a finger moves across the touchpad.
controller.TouchpadAxisChanged += MoveDotOnTouchpadAxisChanged;
}
void Update()
{
//show / hide dot when touchpad is touched or not
dot.gameObject.SetActive(controller.IsTouchpadTouched);
}
#endif
void Awake()
{
container = this.transform as RectTransform;
}
void MoveDotOnTouchpadAxisChanged(object o, ViveInputArgs args)
{
//update dot position when touch position changes.
dot.anchoredPosition = new Vector2(args.touchpadAxis.x * container.rect.width * 0.5f, args.touchpadAxis.y * container.rect.width * 0.5f);
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b9d18c9c9ec93e0409354ed5f04463f1
timeCreated: 1465031212
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: b65513681b02147a489dd0e25eb0127a
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 565f554df2a762a4bbd6b720beb76bd8
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 82 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: b0d606b6d9be41d429e4a9e64a272e08
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 1a34cb98ebddb4f4a98c39e81afb09ac
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 64 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 92267aa4e61f70d46bdb0a19ea8fb848
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 2de9c567990a23e4e93526f961c0944e
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 1c14d986d44a1e44ebe48dd2d166e3c4
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: f85914d4a51249949abdf8767ab900c9
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

@ -0,0 +1,88 @@
fileFormatVersion: 2
guid: 76ee765c8b592e54c8272656b0e1fb36
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 16
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: 1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 200
spriteBorder: {x: 11, y: 0, z: 11, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: bfa95243b657c2b4ca79910273dc5863
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: deefd278dddd2414fabed103974f08f2
folderAsset: yes
timeCreated: 1463937755
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,219 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &116662
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 22482398}
- component: {fileID: 22265742}
- component: {fileID: 11405692}
- component: {fileID: 11413366}
m_Layer: 5
m_Name: bg
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &189006
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 22493858}
- component: {fileID: 22327806}
- component: {fileID: 11464250}
- component: {fileID: 11430226}
- component: {fileID: 11425648}
m_Layer: 5
m_Name: CurvedCanvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &11405692
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 116662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 0.797}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10905, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!114 &11413366
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 116662}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4e62188adca544cf1b96ccf1630f15f9, type: 3}
m_Name:
m_EditorClassIdentifier:
DoNotTesselate: 0
savedPos: {x: 0, y: 0, z: 0}
savedUp: {x: 0, y: 1, z: 0}
savedRectSize: {x: 1500, y: 500}
savedColor: {r: 1, g: 1, b: 1, a: 0.797}
savedTextUV0: {x: 0, y: 0}
savedFill: 1
--- !u!114 &11425648
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 189006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a783f671592674b589cfc4953e28656b, type: 3}
m_Name:
m_EditorClassIdentifier:
shape: 0
quality: 1
interactable: 1
blocksRaycasts: 1
raycastMyLayerOnly: 0
forceUseBoxCollider: 0
angle: 180
preserveAspect: 1
vertAngle: 90
ringFill: 0.5
ringExternalDiamater: 1000
ringFlipVertical: 0
--- !u!114 &11430226
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 189006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ba045fa4943b5428da9ef8508c8ada33, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
showDebug: 0
--- !u!114 &11464250
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 189006}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!222 &22265742
CanvasRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 116662}
--- !u!223 &22327806
Canvas:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 189006}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 0}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 25
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &22482398
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 116662}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 22493858}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!224 &22493858
RectTransform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 189006}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 477}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 22482398}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 1475, y: -80}
m_SizeDelta: {x: 1500, y: 500}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 189006}
m_IsPrefabParent: 1

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 132e7f65a3fd16f48bb0cfcc88ef5e27
timeCreated: 1465578230
licenseType: Store
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,269 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1001 &100100000
Prefab:
m_ObjectHideFlags: 1
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications: []
m_RemovedComponents: []
m_ParentPrefab: {fileID: 0}
m_RootGameObject: {fileID: 1767736181399190}
m_IsPrefabParent: 1
--- !u!1 &1054084449215146
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4189041639345540}
- component: {fileID: 33576755705380598}
- component: {fileID: 23131795572898510}
m_Layer: 0
m_Name: Beam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1113501378102464
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4518417087497826}
m_Layer: 0
m_Name: BeamOrigin
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1226162708196206
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4110634513111764}
- component: {fileID: 114264954886025654}
m_Layer: 0
m_Name: LaserBeam
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1343425575842618
GameObject:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4014797184409420}
- component: {fileID: 33985842153343410}
- component: {fileID: 23535212596380056}
m_Layer: 0
m_Name: Dot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!1 &1767736181399190
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 5
m_Component:
- component: {fileID: 4669569845911490}
- component: {fileID: 114273684015460166}
m_Layer: 0
m_Name: CurvedUILaserPointer
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4014797184409420
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1343425575842618}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 5, y: 5, z: 0.01}
m_Children: []
m_Father: {fileID: 4518417087497826}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4110634513111764
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1226162708196206}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4518417087497826}
m_Father: {fileID: 4669569845911490}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4189041639345540
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1054084449215146}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0.5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4518417087497826}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4518417087497826
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1113501378102464}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: 0, z: -0.01}
m_LocalScale: {x: 0.005, y: 0.005, z: 1}
m_Children:
- {fileID: 4189041639345540}
- {fileID: 4014797184409420}
m_Father: {fileID: 4110634513111764}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &4669569845911490
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767736181399190}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 4110634513111764}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!23 &23131795572898510
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1054084449215146}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_Materials:
- {fileID: 2100000, guid: f9da22ae34fa249c9b5d876eaa40a3a2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!23 &23535212596380056
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1343425575842618}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_MotionVectors: 1
m_LightProbeUsage: 0
m_ReflectionProbeUsage: 0
m_Materials:
- {fileID: 2100000, guid: f9da22ae34fa249c9b5d876eaa40a3a2, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &33576755705380598
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1054084449215146}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &33985842153343410
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1343425575842618}
m_Mesh: {fileID: 10207, guid: 0000000000000000e000000000000000, type: 0}
--- !u!114 &114264954886025654
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1226162708196206}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 367959482ff0f0948b11d2021ee48a8b, type: 3}
m_Name:
m_EditorClassIdentifier:
LaserBeamTransform: {fileID: 4518417087497826}
LaserBeamDot: {fileID: 4014797184409420}
CollideWithMyLayerOnly: 0
hideWhenNotAimingAtCanvas: 0
--- !u!114 &114273684015460166
MonoBehaviour:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 1767736181399190}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 339e11e7da1e83f4e8f7cd332ee3b66e, type: 3}
m_Name:
m_EditorClassIdentifier:
LaserBeam: {fileID: 1226162708196206}
autoSwitchHands: 1

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: bcd9d94a56f575340a261fb992072904
timeCreated: 1528073705
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 100100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: e4c978296ec2c2e4f88aa4f4031c6606
folderAsset: yes
timeCreated: 1450574478
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,30 @@
using UnityEngine.EventSystems;
namespace CurvedUI
{
/// <summary>
/// Fixes the issue where UI input would stop working in VR if the game window looses focus.
/// </summary>
public class CurvedUIEventSystem : EventSystem
{
public static CurvedUIEventSystem instance;
protected override void Awake()
{
base.Awake();
instance = this;
}
protected override void OnApplicationFocus(bool hasFocus)
{
base.OnApplicationFocus(true);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 651aa76e8cc8486469816be09993892d
timeCreated: 1501535446
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,149 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace CurvedUI{
public static class CurvedUIExtensionMethods
{
/// <summary>
///Direct Vector3 comparison can produce wrong results sometimes due to float inacuracies.
///This is an aproximate comparison.
/// <returns></returns>
public static bool AlmostEqual(this Vector3 a, Vector3 b, double accuracy = 0.01)
{
return Vector3.SqrMagnitude(a - b) < accuracy;
}
public static float Remap(this float value, float from1, float to1, float from2, float to2)
{
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
}
public static float RemapAndClamp(this float value, float from1, float to1, float from2, float to2)
{
return value.Remap(from1, to1, from2, to2).Clamp(from2, to2);
}
public static float Remap(this int value, float from1, float to1, float from2, float to2)
{
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
}
public static double Remap(this double value, double from1, double to1, double from2, double to2)
{
return (value - from1) / (to1 - from1) * (to2 - from2) + from2;
}
public static float Clamp(this float value, float min, float max)
{
return Mathf.Clamp(value, min, max);
}
public static float Clamp(this int value, int min, int max)
{
return Mathf.Clamp(value, min, max);
}
public static int Abs(this int value)
{
return Mathf.Abs(value);
}
public static float Abs(this float value)
{
return Mathf.Abs(value);
}
/// <summary>
/// Returns value rounded to nearest integer (both up and down).
/// </summary>
/// <returns>The int.</returns>
/// <param name="value">Value.</param>
public static int ToInt(this float value)
{
return Mathf.RoundToInt(value);
}
public static int FloorToInt(this float value)
{
return Mathf.FloorToInt(value);
}
public static int CeilToInt(this float value)
{
return Mathf.FloorToInt(value);
}
public static Vector3 ModifyX(this Vector3 trans, float newVal)
{
trans = new Vector3(newVal, trans.y, trans.z);
return trans;
}
public static Vector3 ModifyY(this Vector3 trans, float newVal)
{
trans = new Vector3(trans.x, newVal, trans.z);
return trans;
}
public static Vector3 ModifyZ(this Vector3 trans, float newVal)
{
trans = new Vector3(trans.x, trans.y, newVal);
return trans;
}
public static Vector2 ModifyVectorX(this Vector2 trans, float newVal)
{
trans = new Vector3(newVal, trans.y);
return trans;
}
public static Vector2 ModifyVectorY(this Vector2 trans, float newVal)
{
trans = new Vector3(trans.x, newVal);
return trans;
}
/// <summary>
/// Resets transform's local position, rotation and scale
/// </summary>
/// <param name="trans">Trans.</param>
public static void ResetTransform(this Transform trans)
{
trans.localPosition = Vector3.zero;
trans.localRotation = Quaternion.identity;
trans.localScale = Vector3.one;
}
public static T AddComponentIfMissing<T>(this GameObject go) where T : Component
{
if (go.GetComponent<T>() == null)
{
return go.AddComponent<T>();
}
else return go.GetComponent<T>();
}
/// <summary>
/// Checks if given component is preset and if not, adds it and returns it.
/// </summary>
public static T AddComponentIfMissing<T>(this Component go) where T : Component
{
return go.gameObject.AddComponentIfMissing<T>();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 8051728d05bdb4c9d8127e0c1f229ca3
timeCreated: 1511548416
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,205 @@
using UnityEngine;
using System.Collections;
using System.Security.Permissions;
namespace CurvedUI {
/// <summary>
/// This script switches the hand controlling the UI when a click on the other controller's trigger is detected.
/// This emulates the functionality seen in SteamVR overlay or Oculus Home.
/// Works both for SteamVR and Oculus SDK.
/// </summary>
public class CurvedUIHandSwitcher : MonoBehaviour
{
#pragma warning disable 0649
#pragma warning disable 414
[SerializeField]
GameObject LaserBeam;
[SerializeField]
[Tooltip("If true, when player clicks the trigger on the other hand, we'll instantly set it as UI controlling hand and move the pointer to it.")]
bool autoSwitchHands = true;
[Header("Optional")]
[SerializeField] [Tooltip("If set, pointer will be placed as a child of this transform, instead of the current VR SDKs Camera Rig.")]
private Transform leftHandOverride;
[SerializeField] [Tooltip("If set, pointer will be placed as a child of this transform, instead of the current VR SDKs Camera Rig.")]
private Transform rightHandOverride;
#pragma warning restore 414
#pragma warning restore 0649
#if CURVEDUI_OCULUSVR
//variables
OVRInput.Controller activeCont;
bool initialized = false;
void Update()
{
if (CurvedUIInputModule.ControlMethod != CurvedUIInputModule.CUIControlMethod.OCULUSVR) return;
activeCont = OVRInput.GetActiveController();
if (!initialized && CurvedUIInputModule.Instance.OculusTouchUsedControllerTransform != null)
{
//Launch Hand Switch. This will place the laser pointer in the current hand.
SwitchHandTo(CurvedUIInputModule.Instance.UsedHand);
initialized = true;
}
//for Oculus Go and GearVR, switch automatically if a different controller is connected.
//This covers the case where User changes hand setting in Oculus Go menu and gets back to our app.
if ((activeCont == OVRInput.Controller.LTouch || activeCont == OVRInput.Controller.LHand)
&& CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Left)
SwitchHandTo(CurvedUIInputModule.Hand.Left);
else if ((activeCont == OVRInput.Controller.RTouch || activeCont == OVRInput.Controller.RHand)
&& CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Right)
SwitchHandTo(CurvedUIInputModule.Hand.Right);
if(autoSwitchHands){
//For Oculus Rift, we wait for the click before we change the pointer.
if (IsButtonDownOnController(OVRInput.Controller.LTouch) && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Left)
{
SwitchHandTo(CurvedUIInputModule.Hand.Left);
}
else if (IsButtonDownOnController(OVRInput.Controller.RTouch) && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Right)
{
SwitchHandTo(CurvedUIInputModule.Hand.Right);
}
}
}
bool IsButtonDownOnController(OVRInput.Controller cont, OVRInput.Controller cont2 = OVRInput.Controller.None)
{
return OVRInput.GetDown(CurvedUIInputModule.Instance.OculusTouchInteractionButton, cont) || (cont2 != OVRInput.Controller.None && OVRInput.GetDown(CurvedUIInputModule.Instance.OculusTouchInteractionButton, cont2));
}
#elif CURVEDUI_STEAMVR_LEGACY
void Start()
{
//connect to steamVR's OnModelLoaded events so we can update the pointer the moment controller is detected.
CurvedUIInputModule.Right.ModelLoaded += OnModelLoaded;
CurvedUIInputModule.Left.ModelLoaded += OnModelLoaded;
}
void OnModelLoaded(object sender)
{
SwitchHandTo(CurvedUIInputModule.Instance.UsedHand);
}
void Update()
{
if (CurvedUIInputModule.ControlMethod != CurvedUIInputModule.CUIControlMethod.STEAMVR_LEGACY) return;
if(autoSwitchHands){
if (CurvedUIInputModule.Right != null && CurvedUIInputModule.Right.IsTriggerDown && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Right)
{
SwitchHandTo(CurvedUIInputModule.Hand.Right);
}
else if (CurvedUIInputModule.Left != null && CurvedUIInputModule.Left.IsTriggerDown && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Left)
{
SwitchHandTo(CurvedUIInputModule.Hand.Left);
}
}
}
#elif CURVEDUI_STEAMVR_2
void Start()
{
//initial setup in proper hand
SwitchHandTo(CurvedUIInputModule.Instance.UsedHand);
}
void Update()
{
if (CurvedUIInputModule.ControlMethod != CurvedUIInputModule.CUIControlMethod.STEAMVR_2) return;
//Switch hands during runtime when user clicks the action button on another controller
if (autoSwitchHands && CurvedUIInputModule.Instance.SteamVRClickAction != null)
{
if (CurvedUIInputModule.Instance.SteamVRClickAction.GetState(Valve.VR.SteamVR_Input_Sources.RightHand) && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Right){
SwitchHandTo(CurvedUIInputModule.Hand.Right);
}
else if (CurvedUIInputModule.Instance.SteamVRClickAction.GetState(Valve.VR.SteamVR_Input_Sources.LeftHand) && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Left ){
SwitchHandTo(CurvedUIInputModule.Hand.Left);
}
}
}
#elif CURVEDUI_UNITY_XR
void Start()
{
//initial setup in proper hand
SwitchHandTo(CurvedUIInputModule.Instance.UsedHand);
}
void Update()
{
if (!autoSwitchHands || CurvedUIInputModule.ControlMethod != CurvedUIInputModule.CUIControlMethod.UNITY_XR) return;
bool pressed = false;
if (CurvedUIInputModule.Instance.RightXRController != null && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Right)
{
//get pressed ui button state on right controller.
CurvedUIInputModule.Instance.RightXRController.inputDevice.IsPressed(CurvedUIInputModule.Instance.RightXRController.uiPressUsage,
out pressed, CurvedUIInputModule.Instance.RightXRController.axisToPressThreshold);
if(pressed)
SwitchHandTo(CurvedUIInputModule.Hand.Right);
}
if (CurvedUIInputModule.Instance.LeftXRController != null && CurvedUIInputModule.Instance.UsedHand != CurvedUIInputModule.Hand.Left)
{
//get pressed ui button state on left controller.
CurvedUIInputModule.Instance.LeftXRController.inputDevice.IsPressed(CurvedUIInputModule.Instance.LeftXRController.uiPressUsage,
out pressed, CurvedUIInputModule.Instance.LeftXRController.axisToPressThreshold);
if(pressed)
SwitchHandTo(CurvedUIInputModule.Hand.Left);
}
}
#endif
#region HELPER FUNCTIONS
void SwitchHandTo(CurvedUIInputModule.Hand newHand)
{
CurvedUIInputModule.Instance.UsedHand = newHand;
if (CurvedUIInputModule.Instance.ControllerTransform)
{
//hand overrides
if (newHand == CurvedUIInputModule.Hand.Left && leftHandOverride)
{
CurvedUIInputModule.Instance.PointerTransformOverride = leftHandOverride;
}
if (newHand == CurvedUIInputModule.Hand.Right && rightHandOverride)
{
CurvedUIInputModule.Instance.PointerTransformOverride = rightHandOverride;
}
LaserBeam.transform.SetParent(CurvedUIInputModule.Instance.ControllerTransform);
LaserBeam.transform.ResetTransform();
LaserBeam.transform.LookAt(LaserBeam.transform.position + CurvedUIInputModule.Instance.ControllerPointingDirection);
}
else Debug.LogError("CURVEDUI: No Active controller that can be used as a parent of the pointer. Is the controller gameobject present on the scene and active?");
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 339e11e7da1e83f4e8f7cd332ee3b66e
timeCreated: 1485352578
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,210 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
namespace CurvedUI
{
#if !UNITY_5_1 && !UNITY_5_2
/// <summary>
/// Creates a recttransform caret with image component that can be curved with curvedUI. Hides inputfield's original caret.
/// </summary>
public class CurvedUIInputFieldCaret : MonoBehaviour, ISelectHandler, IDeselectHandler
{
//references
InputField myField;
RectTransform myCaret;
Color origCaretColor;
Color origSelectionColor;
//variables
bool selected = false;
bool selectingText = false;
//settings
int lastCharDist = 2;
void Awake()
{
myField = this.GetComponent<InputField>();
}
void Update()
{
//only update the caret's position when the field is selected.
if (selected)
UpdateCaret();
}
/// <summary>
/// On select, set the caret active and start blinker coroutine.
/// </summary>
/// <param name="eventData"></param>
public void OnSelect(BaseEventData eventData)
{
if (myCaret == null)
CreateCaret();
selected = true;
myCaret.gameObject.SetActive(true);
StartCoroutine(CaretBlinker());
}
/// <summary>
/// Hide the caret on deselect.
/// </summary>
/// <param name="eventData"></param>
public void OnDeselect(BaseEventData eventData)
{
selected = false;
myCaret.gameObject.SetActive(false);
}
/// <summary>
/// Simple blinker. Blinks the caret if inputfield is selected and user is not selecting text.
/// </summary>
/// <returns></returns>
IEnumerator CaretBlinker()
{
while (selected)
{
myCaret.gameObject.SetActive(selectingText ? true : !myCaret.gameObject.activeSelf);
yield return new WaitForSeconds(0.5f / (float)myField.caretBlinkRate);
}
}
void CreateCaret()
{
//lets create a curvedui caret and copy the settings from our input field
GameObject go = new GameObject("CurvedUICaret");
go.AddComponent<RectTransform>();
go.AddComponent<Image>();
go.AddComponent<CurvedUIVertexEffect>();
go.transform.SetParent(this.transform);
go.transform.localScale = Vector3.one;
(go.transform as RectTransform).anchoredPosition3D = Vector3.zero;
//(go.transform as RectTransform).pivot = new Vector2(0, 0.5f);
(go.transform as RectTransform).pivot = new Vector2(0, 1.0f);
go.GetComponent<Image>().color = myField.caretColor;
myCaret = go.transform as RectTransform;
go.transform.SetAsFirstSibling();
//save original color and hide the original caret
myField.customCaretColor = true;
origCaretColor = myField.caretColor;
myField.caretColor = new Color(0, 0, 0, 0);
origSelectionColor = myField.selectionColor;
myField.selectionColor = new Color(0, 0, 0, 0);
go.gameObject.SetActive(false);
}
void UpdateCaret()
{
if (myCaret == null)
CreateCaret();
//Debug.Log("caret:" + myField.caretPosition + " / focus:"+ myField.selectionFocusPosition + " / anchor:" + myField.selectionAnchorPosition + " / charc:" + myField.textComponent.cachedTextGenerator.characterCount + " / charvis:" + myField.textComponent.cachedTextGenerator.characterCountVisible);
Vector2 newCaretPos = GetLocalPositionInText(myField.caretPosition);
//RectTransform originalCaret = (RectTransform)myField.transform.FindChild(myField.name + " Input Caret");
if (myField.selectionFocusPosition != myField.selectionAnchorPosition) // user is selecting text is those two are not equal.
{
selectingText = true;
Vector2 selectionSize = new Vector2(
GetLocalPositionInText(myField.selectionAnchorPosition).x - GetLocalPositionInText(myField.selectionFocusPosition).x,
GetLocalPositionInText(myField.selectionAnchorPosition).y - GetLocalPositionInText(myField.selectionFocusPosition).y
);
newCaretPos = selectionSize.x < 0 ? GetLocalPositionInText(myField.selectionAnchorPosition) : GetLocalPositionInText(myField.selectionFocusPosition);
selectionSize = new Vector2(Mathf.Abs(selectionSize.x), Mathf.Abs(selectionSize.y) + myField.textComponent.fontSize);
myCaret.sizeDelta = new Vector2(selectionSize.x, selectionSize.y);
myCaret.anchoredPosition = newCaretPos;
myCaret.GetComponent<Image>().color = origSelectionColor;
}
else { // user is not selecting text, just update the caret position.
selectingText = false;
//myCaret.sizeDelta = new Vector2(myField.caretWidth, originalCaret == null ? 10 : originalCaret.rect.height);
myCaret.sizeDelta = new Vector2(myField.caretWidth, myField.textComponent.fontSize);
myCaret.anchoredPosition = newCaretPos;
myCaret.GetComponent<Image>().color = origCaretColor;
}
}
/// <summary>
/// Returns the position in inputfield's rectransform local space, based on character position in text. Pretty neat actually.
/// </summary>
/// <param name="charNo"></param>
/// <returns></returns>
Vector2 GetLocalPositionInText(int charNo)
{
if (myField.isFocused)
{
TextGenerator gen = myField.textComponent.cachedTextGenerator;
if (charNo > gen.characterCount - 1) //do not go over the text length.
charNo = gen.characterCount - 1;
if (charNo > 0)
{
UICharInfo charInfo = gen.characters[charNo - 1];
float x = (charInfo.cursorPos.x + charInfo.charWidth) / myField.textComponent.pixelsPerUnit + lastCharDist;
float y = (charInfo.cursorPos.y) / myField.textComponent.pixelsPerUnit;
return new Vector2(x, y);
}
else {
UICharInfo charInfo = gen.characters[charNo];
float x = (charInfo.cursorPos.x) / myField.textComponent.pixelsPerUnit;
float y = (charInfo.cursorPos.y) / myField.textComponent.pixelsPerUnit;
return new Vector2(x, y);
}
}
else return Vector2.zero; // field not focused, return 0,0
}
#region SETTERS AND GETTERS
public Color CaretColor {
get { return origCaretColor; }
set { origCaretColor = value; }
}
public Color SelectionColor {
get { return origSelectionColor; }
set { origSelectionColor = value; }
}
public float CaretBlinkRate {
get { return myField.caretBlinkRate; }
set { myField.caretBlinkRate = value; }
}
#endregion
#else
public class CurvedUIInputFieldCaret : MonoBehaviour
{
//Unity before 5.3 does not contain methods necessary to curve the input field caret without changing original script.
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 32727669a74c41a4093f8796bb6916aa
timeCreated: 1462736335
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b2e569dc832500047bf4350b4dae9b97
timeCreated: 1480528188
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,61 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace CurvedUI
{
/// <summary>
/// This class contains code that controls the visuals (only!) of the laser pointer.
/// </summary>
public class CurvedUILaserBeam : MonoBehaviour
{
#pragma warning disable 0649
[SerializeField]
Transform LaserBeamTransform;
[SerializeField]
Transform LaserBeamDot;
[SerializeField]
bool hideWhenNotAimingAtCanvas = false;
#pragma warning restore 0649
// Update is called once per frame
protected void Update()
{
//get direction of the controller
Ray myRay = new Ray(this.transform.position, this.transform.forward);
//make laser beam hit stuff it points at.
if(LaserBeamTransform && LaserBeamDot) {
//change the laser's length depending on where it hits
float length = 10000;
RaycastHit hit;
if (Physics.Raycast(myRay, out hit, length, CurvedUIInputModule.Instance.RaycastLayerMask))
{
length = Vector3.Distance(hit.point, this.transform.position);
//Find if we hit a canvas
CurvedUISettings cuiSettings = hit.collider.GetComponentInParent<CurvedUISettings>();
if (cuiSettings != null)
{
//find if there are any canvas objects we're pointing at. we only want transforms with graphics to block the pointer. (that are drawn by canvas => depth not -1)
int selectablesUnderPointer = cuiSettings.GetObjectsUnderPointer().FindAll(x => x != null && x.GetComponent<Graphic>() != null && x.GetComponent<Graphic>().depth != -1).Count;
length = selectablesUnderPointer == 0 ? 10000 : Vector3.Distance(hit.point, this.transform.position);
}
else if (hideWhenNotAimingAtCanvas) length = 0;
}
else if (hideWhenNotAimingAtCanvas) length = 0;
//set the leangth of the beam
LaserBeamTransform.localScale = LaserBeamTransform.localScale.ModifyZ(length);
}
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 367959482ff0f0948b11d2021ee48a8b
timeCreated: 1461966372
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,83 @@
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using UnityEngine.UI;
using System.Collections.Generic;
namespace CurvedUI
{
/// <summary>
/// Raycaster used for interactions with 3D objects.
/// </summary>
public class CurvedUIPhysicsRaycaster : BaseRaycaster
{
#region VARIABLES AND SETTINGS
[SerializeField]
protected int sortOrder = 20;
//variables
RaycastHit hitInfo;
RaycastResult result;
#endregion
#region CONSTRUCTOR
protected CurvedUIPhysicsRaycaster() { }
#endregion
#region RAYCASTING
public override void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList)
{
//check if we have camera from which to cast a ray
if (CurvedUIInputModule.Instance == null || CurvedUIInputModule.Instance.EventCamera == null)
return;
if (Physics.Raycast(CurvedUIInputModule.Instance.GetEventRay(), out hitInfo, float.PositiveInfinity, CompoundEventMask))
{
if (hitInfo.collider.GetComponentInParent<CurvedUISettings>()) return; //a canvas is hit - these raycastsResults are handled by CurvedUIRaycasters
result = new RaycastResult
{
gameObject = hitInfo.collider.gameObject,
module = this,
distance = hitInfo.distance,
index = resultAppendList.Count,
worldPosition = hitInfo.point,
worldNormal = hitInfo.normal,
};
resultAppendList.Add(result);
}
//Debug.Log("CUIPhysRaycaster: " + resultAppendList.Count);
}
#endregion
#region SETTERS AND GETTERS
/// <summary>
/// This Component's event mask + eventCamera's event mask.
/// </summary>
public int CompoundEventMask {
get { return (eventCamera != null) ? eventCamera.cullingMask & CurvedUIInputModule.Instance.RaycastLayerMask : -1; }
}
/// <summary>
/// Camera used to process events
/// </summary>
public override Camera eventCamera {
get { return CurvedUIInputModule.Instance? CurvedUIInputModule.Instance.EventCamera : null; }
}
public virtual int Depth {
get { return (eventCamera != null) ? (int)eventCamera.depth : 0xFFFFFF; }
}
public override int sortOrderPriority {
get { return sortOrder; }
}
#endregion
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b4d6485c257874646b5d46ab8a0cfa6b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,33 @@
using System;
using System.Text;
using UnityEngine;
using UnityEngine.EventSystems;
namespace CurvedUI
{
/// <summary>
/// This class stores additional information that CurvedUI uses for its Pointer Events.
/// Right now its only used to store the controller used to interact with canvas.
/// </summary>
public class CurvedUIPointerEventData : PointerEventData
{
public CurvedUIPointerEventData(EventSystem eventSystem)
: base(eventSystem)
{
}
public enum ControllerType
{
NONE = -1,
VIVE = 0,
}
public GameObject Controller;
/// <summary>
/// Basically the position of user's finger on a touchpad. Goes from -1,-1 to 1,1
/// </summary>
public Vector2 TouchPadAxis = Vector2.zero;
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a9b2ea41969ca7a45ab6888044c0c0d9
timeCreated: 1463839864
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: ba045fa4943b5428da9ef8508c8ada33
timeCreated: 1462736341
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,813 @@
#define CURVEDUI_PRESENT //If you're an asset creator and want to see if CurvedUI is imported, just use "#if CURVEDUI_PRESENT [your code] #endif"
using System;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using System.Collections.Generic;
#if CURVEDUI_TMP || TMP_PRESENT
using TMPro;
#endif
/// <summary>
/// This class stores settings for the entire canvas. It also stores useful methods for converting cooridinates to and from 2d canvas to curved canvas, or world space.
/// CurvedUIVertexEffect components (added to every canvas gameobject)ask this class for per-canvas settings when applying their curve effect.
/// </summary>
namespace CurvedUI
{
[AddComponentMenu("CurvedUI/CurvedUISettings")]
[RequireComponent(typeof(Canvas))]
public class CurvedUISettings : MonoBehaviour
{
public const string Version = "3.2";
#region SETTINGS
//Global settings
[SerializeField]
CurvedUIShape shape;
[SerializeField]
float quality = 1f;
[SerializeField]
bool interactable = true;
[SerializeField]
bool blocksRaycasts = true;
[SerializeField]
bool forceUseBoxCollider = false;
//Cyllinder settings
[SerializeField]
int angle = 90;
[SerializeField]
bool preserveAspect = true;
//Sphere settings
[SerializeField]
int vertAngle = 90;
//ring settings
[SerializeField]
float ringFill = 0.5f;
[SerializeField]
int ringExternalDiamater = 1000;
[SerializeField]
bool ringFlipVertical = false;
//internal system settings
int baseCircleSegments = 16;
//stored variables
Vector2 savedRectSize;
float savedRadius;
Canvas myCanvas;
RectTransform m_rectTransform;
#endregion
#region LIFECYCLE
void Awake()
{
// If this canvas is on Default layer, switch it to UI layer..
// this is to make sure that when using raycasting to detect interactions,
// nothing will interfere with it.
if (gameObject.layer == 0) this.gameObject.layer = 5;
//save initial variables
savedRectSize = RectTransform.rect.size;
}
void Start()
{
if (Application.isPlaying)
{
// lets get rid of any raycasters and add our custom one
// It will be responsible for handling interactions.
BaseRaycaster[] raycasters = GetComponents<BaseRaycaster>();
foreach(BaseRaycaster caster in raycasters)
{
if (!(caster is CurvedUIRaycaster))
caster.enabled = false;
}
this.gameObject.AddComponentIfMissing<CurvedUIRaycaster>();
//find if there are any child canvases that may break interactions
Canvas[] canvases = GetComponentsInChildren<Canvas>();
foreach(Canvas cnv in canvases)
{
if (cnv.gameObject != this.gameObject)
{
Transform trans = cnv.transform;
string hierarchyName = trans.name;
while(trans.parent != null)
{
hierarchyName = trans.parent.name + "/" + hierarchyName;
trans = trans.parent;
}
Debug.LogWarning("CURVEDUI: Interactions on nested canvases are not supported. You won't be able to interact with any child object of [" + hierarchyName + "]", cnv.gameObject);
}
}
}
//find needed references
if (myCanvas == null)
myCanvas = GetComponent<Canvas>();
savedRadius = GetCyllinderRadiusInCanvasSpace();
}
void OnEnable()
{
//Redraw canvas object on enable.
foreach (UnityEngine.UI.Graphic graph in (this).GetComponentsInChildren<UnityEngine.UI.Graphic>())
{
graph.SetAllDirty();
}
}
void OnDisable()
{
foreach (UnityEngine.UI.Graphic graph in (this).GetComponentsInChildren<UnityEngine.UI.Graphic>())
{
graph.SetAllDirty();
}
}
void Update()
{
//recreate the geometry if entire canvas has been resized
if (RectTransform.rect.size != savedRectSize)
{
savedRectSize = RectTransform.rect.size;
SetUIAngle(angle);
}
//check for improper canvas size
if (savedRectSize.x == 0 || savedRectSize.y == 0)
Debug.LogError("CurvedUI: Your Canvas size must be bigger than 0!");
}
#endregion
#region PRIVATE
/// <summary>
/// Changes the horizontal angle of the canvas.
/// </summary>
/// <param name="newAngle"></param>
void SetUIAngle(int newAngle) {
if (myCanvas == null)
myCanvas = GetComponent<Canvas>();
//temp fix to make interactions with angle 0 possible
if (newAngle == 0) newAngle = 1;
angle = newAngle;
savedRadius = GetCyllinderRadiusInCanvasSpace();
foreach (CurvedUIVertexEffect ve in GetComponentsInChildren<CurvedUIVertexEffect>())
ve.SetDirty();
foreach (Graphic graph in GetComponentsInChildren<Graphic>())
graph.SetAllDirty();
if (Application.isPlaying && GetComponent<CurvedUIRaycaster>() != null)
//tell raycaster to update its collider now that angle has changed.
GetComponent<CurvedUIRaycaster>().RebuildCollider();
}
Vector3 CanvasToCyllinder(Vector3 pos)
{
float theta = (pos.x / savedRectSize.x) * Angle * Mathf.Deg2Rad;
pos.x = Mathf.Sin(theta) * (SavedRadius + pos.z);
pos.z += Mathf.Cos(theta) * (SavedRadius + pos.z) - (SavedRadius + pos.z);
return pos;
}
Vector3 CanvasToCyllinderVertical(Vector3 pos)
{
float theta = (pos.y / savedRectSize.y) * Angle * Mathf.Deg2Rad;
pos.y = Mathf.Sin(theta) * (SavedRadius + pos.z);
pos.z += Mathf.Cos(theta) * (SavedRadius + pos.z) - (SavedRadius + pos.z);
return pos;
}
Vector3 CanvasToRing(Vector3 pos)
{
float r = pos.y.Remap(savedRectSize.y * 0.5f * (RingFlipVertical ? 1 : -1), -savedRectSize.y * 0.5f * (RingFlipVertical ? 1 : -1), RingExternalDiameter * (1 - RingFill) * 0.5f, RingExternalDiameter * 0.5f);
float theta = (pos.x / savedRectSize.x).Remap(-0.5f, 0.5f, Mathf.PI / 2.0f, angle * Mathf.Deg2Rad + Mathf.PI / 2.0f);
pos.x = r * Mathf.Cos(theta);
pos.y = r * Mathf.Sin(theta);
return pos;
}
Vector3 CanvasToSphere(Vector3 pos)
{
float radius = SavedRadius;
float vAngle = VerticalAngle;
if (PreserveAspect)
{
vAngle = angle * (savedRectSize.y / savedRectSize.x);
radius += Angle > 0 ? -pos.z : pos.z;
}
else {
radius = savedRectSize.x / 2.0f + pos.z;
if (vAngle == 0) return Vector3.zero;
}
//convert planar coordinates to spherical coordinates
float theta = (pos.x / savedRectSize.x).Remap(-0.5f, 0.5f, (180 - angle) / 2.0f - 90, 180 - (180 - angle) / 2.0f - 90);
theta *= Mathf.Deg2Rad;
float gamma = (pos.y / savedRectSize.y).Remap(-0.5f, 0.5f, (180 - vAngle) / 2.0f, 180 - (180 - vAngle) / 2.0f);
gamma *= Mathf.Deg2Rad;
pos.z = Mathf.Sin(gamma) * Mathf.Cos(theta) * radius;
pos.y = -radius * Mathf.Cos(gamma);
pos.x = Mathf.Sin(gamma) * Mathf.Sin(theta) * radius;
if (PreserveAspect)
pos.z -= radius;
return pos;
}
#endregion
#region PUBLIC
RectTransform RectTransform {
get
{
if (m_rectTransform == null) m_rectTransform = transform as RectTransform;
return m_rectTransform;
}
}
/// <summary>
/// Adds the CurvedUIVertexEffect component to every child gameobject that requires it.
/// CurvedUIVertexEffect creates the curving effect.
/// </summary>
public void AddEffectToChildren()
{
foreach (UnityEngine.UI.Graphic graph in GetComponentsInChildren<UnityEngine.UI.Graphic>(true))
{
if (graph.GetComponent<CurvedUIVertexEffect>() == null)
{
graph.gameObject.AddComponent<CurvedUIVertexEffect>();
graph.SetAllDirty();
}
}
//additional script that will create a curved caret for input fields
foreach(UnityEngine.UI.InputField iField in GetComponentsInChildren<UnityEngine.UI.InputField>(true))
{
if (iField.GetComponent<CurvedUIInputFieldCaret>() == null)
{
iField.gameObject.AddComponent<CurvedUIInputFieldCaret>();
}
}
//TextMeshPro experimental support. Go to CurvedUITMP.cs to learn how to enable it.
#if CURVEDUI_TMP || TMP_PRESENT
foreach(TextMeshProUGUI tmp in GetComponentsInChildren<TextMeshProUGUI>(true)){
if(tmp.GetComponent<CurvedUITMP>() == null){
tmp.gameObject.AddComponent<CurvedUITMP>();
tmp.SetAllDirty();
}
}
foreach (TMP_InputField tmp in GetComponentsInChildren<TMP_InputField>(true))
{
tmp.AddComponentIfMissing<CurvedUITMPInputFieldCaret>();
}
#endif
}
/// <summary>
/// Maps a world space vector to a curved canvas.
/// Operates in Canvas's local space.
/// </summary>
/// <param name="pos">World space vector</param>
/// <returns>
/// A vector on curved canvas in canvas's local space
/// </returns>
public Vector3 VertexPositionToCurvedCanvas(Vector3 pos)
{
switch (Shape)
{
case CurvedUIShape.CYLINDER:
{
return CanvasToCyllinder(pos);
}
case CurvedUIShape.CYLINDER_VERTICAL:
{
return CanvasToCyllinderVertical(pos);
}
case CurvedUIShape.RING:
{
return CanvasToRing(pos);
}
case CurvedUIShape.SPHERE:
{
return CanvasToSphere(pos);
}
default:
{
return Vector3.zero;
}
}
}
/// <summary>
/// Converts a point in Canvas space to a point on Curved surface in world space units.
/// </summary>
/// <param name="pos">Position on canvas in canvas space</param>
/// <returns>
/// Position on curved canvas in world space.
/// </returns>
public Vector3 CanvasToCurvedCanvas(Vector3 pos)
{
pos = VertexPositionToCurvedCanvas(pos);
if (float.IsNaN(pos.x) || float.IsInfinity(pos.x)) return Vector3.zero;
else return transform.localToWorldMatrix.MultiplyPoint3x4(pos);
}
/// <summary>
/// Returns a normal direction on curved canvas for a given point on flat canvas. Works in canvas' local space.
/// </summary>
/// <param name="pos"></param>
/// <returns></returns>
public Vector3 CanvasToCurvedCanvasNormal(Vector3 pos)
{
//find the position in canvas space
pos = VertexPositionToCurvedCanvas(pos);
switch (Shape)
{
case CurvedUIShape.CYLINDER:
{
// find the direction to the center of cyllinder on flat XZ plane
return transform.localToWorldMatrix.MultiplyVector((pos - new Vector3(0, 0, -GetCyllinderRadiusInCanvasSpace())).ModifyY(0)).normalized;
}
case CurvedUIShape.CYLINDER_VERTICAL:
{
// find the direction to the center of cyllinder on flat YZ plane
return transform.localToWorldMatrix.MultiplyVector((pos - new Vector3(0, 0, -GetCyllinderRadiusInCanvasSpace())).ModifyX(0)).normalized;
}
case CurvedUIShape.RING:
{
// just return the back direction of the canvas
return -transform.forward;
}
case CurvedUIShape.SPHERE:
{
//return the direction towards the sphere's center
Vector3 center = (PreserveAspect ? new Vector3(0, 0, -GetCyllinderRadiusInCanvasSpace()) : Vector3.zero);
return transform.localToWorldMatrix.MultiplyVector((pos - center)).normalized;
}
default:
{
return Vector3.zero;
}
}
}
/// <summary>
/// Raycasts along the given ray and returns the intersection with the flat canvas.
/// Use to convert from world space to flat canvas space.
/// </summary>
/// <param name="ray"></param>
/// <returns>
/// Returns the true if ray hits the CurvedCanvas.
/// Outputs intersection point in flat canvas space.
/// </returns>
public bool RaycastToCanvasSpace(Ray ray, out Vector2 o_positionOnCanvas)
{
CurvedUIRaycaster caster = this.GetComponent<CurvedUIRaycaster>();
o_positionOnCanvas = Vector2.zero;
switch (Shape)
{
case CurvedUISettings.CurvedUIShape.CYLINDER:
{
return caster.RaycastToCyllinderCanvas(ray, out o_positionOnCanvas, true);
}
case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL:
{
return caster.RaycastToCyllinderVerticalCanvas(ray, out o_positionOnCanvas, true);
}
case CurvedUISettings.CurvedUIShape.RING:
{
return caster.RaycastToRingCanvas(ray, out o_positionOnCanvas, true);
}
case CurvedUISettings.CurvedUIShape.SPHERE:
{
return caster.RaycastToSphereCanvas(ray, out o_positionOnCanvas, true);
}
default:
{
return false;
}
}
}
/// <summary>
/// Returns the radius of curved canvas cyllinder, expressed in Cavas's local space units.
/// </summary>
public float GetCyllinderRadiusInCanvasSpace()
{
float ret;
if (PreserveAspect)
{
if(shape == CurvedUIShape.CYLINDER_VERTICAL)
ret = (RectTransform.rect.size.y / ((2 * Mathf.PI) * (angle / 360.0f)));
else
ret = (RectTransform.rect.size.x / ((2 * Mathf.PI) * (angle / 360.0f)));
}
else
ret = (RectTransform.rect.size.x * 0.5f) / Mathf.Sin(Mathf.Clamp(angle, -180.0f, 180.0f) * 0.5f * Mathf.Deg2Rad);
return angle == 0 ? 0 : ret;
}
/// <summary>
/// Tells you how big UI quads can get before they should be tesselate to look good on current canvas settings.
/// Used by CurvedUIVertexEffect to determine how many quads need to be created for each graphic.
/// </summary>
public Vector2 GetTesslationSize(bool modifiedByQuality = true)
{
Vector2 ret = RectTransform.rect.size;
if (Angle != 0 || (!PreserveAspect && vertAngle != 0))
{
switch (shape)
{
case CurvedUIShape.CYLINDER: ret /= GetSegmentsByAngle(angle); break;
case CurvedUIShape.CYLINDER_VERTICAL: goto case CurvedUIShape.CYLINDER;
case CurvedUIShape.RING: goto case CurvedUIShape.CYLINDER;
case CurvedUIShape.SPHERE:
{
ret.x /= GetSegmentsByAngle(angle);
if (PreserveAspect)
ret.y = ret.x * RectTransform.rect.size.y / RectTransform.rect.size.x;
else
ret.y /= GetSegmentsByAngle(VerticalAngle);
break;
}
}
}
//Debug.Log(this.gameObject.name + " returning size " + ret + " which is " + ret * this.transform.localScale.x + " in world space.", this.gameObject);
return ret / (modifiedByQuality ? Mathf.Clamp(Quality, 0.01f, 10.0f) : 1);
}
float GetSegmentsByAngle(float angle)
{
if (angle.Abs() <= 1)
return 1;
else if (angle.Abs() < 90)//proportionaly twice as many segments for small angle canvases
return baseCircleSegments * (Mathf.Abs(angle).Remap(0, 90, 0.01f, 0.5f));
else
return baseCircleSegments * (Mathf.Abs(angle).Remap(90, 360.0f, 0.5f, 1));
}
/// <summary>
/// Tells you how many segmetens should the entire 360 deg. cyllinder or sphere consist of.
/// Used by CurvedUIVertexEffect
/// </summary>
public int BaseCircleSegments {
get { return baseCircleSegments; }
}
/// <summary>
/// The measure of the arc of the Canvas.
/// </summary>
public int Angle {
get { return angle; }
set {
if (angle != value)
SetUIAngle(value);
}
}
/// <summary>
/// Multiplier used to deremine how many segments a base curve of a shape has.
/// Default 1. Lower values greatly increase performance. Higher values give you sharper curve.
/// </summary>
public float Quality {
get { return quality; }
set {
if (quality != value)
{
quality = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Current Shape of the canvas
/// </summary>
public CurvedUIShape Shape {
get { return shape; }
set {
if (shape != value)
{
shape = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Vertical angle of the canvas. Used in sphere shape and ring shape.
/// </summary>
public int VerticalAngle {
get { return vertAngle; }
set {
if (vertAngle != value)
{
vertAngle = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Fill of a ring in ring shaped canvas. 0-1
/// </summary>
public float RingFill {
get { return ringFill; }
set {
if (ringFill != value)
{
ringFill = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Calculated radius of the curved canvas.
/// </summary>
public float SavedRadius {
get {
if (savedRadius == 0)
savedRadius = GetCyllinderRadiusInCanvasSpace();
return savedRadius;
}
}
/// <summary>
/// External diameter of the ring shaped canvas.
/// </summary>
public int RingExternalDiameter {
get { return ringExternalDiamater; }
set {
if (ringExternalDiamater != value)
{
ringExternalDiamater = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Whether the center of the ring should be bottom or top of the canvas.
/// </summary>
public bool RingFlipVertical {
get { return ringFlipVertical; }
set {
if (ringFlipVertical != value)
{
ringFlipVertical = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// If enabled, CurvedUI will try to preserve aspect ratio of original canvas.
/// </summary>
public bool PreserveAspect {
get { return preserveAspect; }
set {
if (preserveAspect != value)
{
preserveAspect = value;
SetUIAngle(angle);
}
}
}
/// <summary>
/// Can the canvas be interacted with?
/// </summary>
public bool Interactable {
get { return interactable; }
set { interactable = value; }
}
/// <summary>
/// Should The collider for this canvas be created using more expensive box colliders?
/// DEfault false.
/// </summary>
public bool ForceUseBoxCollider {
get { return forceUseBoxCollider; }
set { forceUseBoxCollider = value; }
}
/// <summary>
/// Will the canvas block raycasts
/// Settings this to false will destroy the canvas' collider.
/// </summary>
public bool BlocksRaycasts {
get { return blocksRaycasts; }
set
{
if (blocksRaycasts != value) {
blocksRaycasts = value;
//tell raycaster to update its collider now that angle has changed.
if (Application.isPlaying && GetComponent<CurvedUIRaycaster>() != null)
GetComponent<CurvedUIRaycaster>().RebuildCollider();
}
}
}
/// <summary>
/// Should the raycaster take other layers into account to determine if canvas has been interacted with.
/// </summary>
[Obsolete("Use RaycastLayerMask property instead.")]
public bool RaycastMyLayerOnly {
get { return true; }
set { }
}
/// <summary>
/// Forces all child CurvedUI objects to recalculate
/// </summary>
/// <param name="calculateCurvedOnly"> Forces children to recalculate only the curvature. Will not make them retesselate vertices. Much faster.</param>
public void SetAllChildrenDirty(bool recalculateCurveOnly = false)
{
foreach (CurvedUIVertexEffect eff in this.GetComponentsInChildren<CurvedUIVertexEffect>())
{
if (recalculateCurveOnly)
eff.SetDirty();
else
eff.CurvingRequired = true;
}
}
#endregion
#region SHORTCUTS
/// <summary>
/// Returns true if user's pointer is currently pointing inside this canvas.
/// This is a shortcut to CurvedUIRaycaster's PointingAtCanvas bool.
/// </summary>
public bool PointingAtCanvas {
get {
if (GetComponent<CurvedUIRaycaster>() != null)
return GetComponent<CurvedUIRaycaster>().PointingAtCanvas;
else {
Debug.LogWarning("CURVEDUI: Can't check if user is pointing at this canvas - No CurvedUIRaycaster is added to this canvas.");
return false;
}
}
}
/// <summary>
/// Sends OnClick event to every Button under pointer.
/// This is a shortcut to CurvedUIRaycaster's Click method.
/// </summary>
public void Click()
{
if (GetComponent<CurvedUIRaycaster>() != null)
GetComponent<CurvedUIRaycaster>().Click();
}
/// <summary>
/// Current controller mode. Decides how user can interact with the canvas.
/// This is a shortcut to CurvedUIInputModule's property.
/// </summary>
public CurvedUIInputModule.CUIControlMethod ControlMethod {
get { return CurvedUIInputModule.ControlMethod; }
set { CurvedUIInputModule.ControlMethod = value; }
}
/// <summary>
/// Returns all objects currently under the pointer.
/// This is a shortcut to CurvedUIInputModule's method.
/// </summary>
public List<GameObject> GetObjectsUnderPointer()
{
if (GetComponent<CurvedUIRaycaster>() != null)
return GetComponent<CurvedUIRaycaster>().GetObjectsUnderPointer();
else return new List<GameObject>();
}
/// <summary>
/// Returns all the canvas objects that are visible under given Screen Position of EventCamera
/// This is a shortcut to CurvedUIInputModule's method.
/// </summary>
public List<GameObject> GetObjectsUnderScreenPos(Vector2 pos, Camera eventCamera = null)
{
if (eventCamera == null)
eventCamera = myCanvas.worldCamera;
if (GetComponent<CurvedUIRaycaster>() != null)
return GetComponent<CurvedUIRaycaster>().GetObjectsUnderScreenPos(pos, eventCamera);
else return new List<GameObject>();
}
/// <summary>
/// Returns all the canvas objects that are intersected by given ray.
/// This is a shortcut to CurvedUIInputModule's method.
/// </summary>
public List<GameObject> GetObjectsHitByRay(Ray ray)
{
if (GetComponent<CurvedUIRaycaster>() != null)
return GetComponent<CurvedUIRaycaster>().GetObjectsHitByRay(ray);
else return new List<GameObject>();
}
/// <summary>
/// Gaze Control Method. Should execute OnClick events on button after user points at them?
/// This is a shortcut to CurvedUIInputModule's property.
/// </summary>
public bool GazeUseTimedClick {
get { return CurvedUIInputModule.Instance.GazeUseTimedClick; }
set { CurvedUIInputModule.Instance.GazeUseTimedClick = value; }
}
/// <summary>
/// Gaze Control Method. How long after user points on a button should we click it?
/// This is a shortcut to CurvedUIInputModule's property.
/// </summary>
public float GazeClickTimer {
get { return CurvedUIInputModule.Instance.GazeClickTimer; }
set { CurvedUIInputModule.Instance.GazeClickTimer = value; }
}
/// <summary>
/// Gaze Control Method. How long after user looks at a button should we start the timer? Default 1 second.
/// This is a shortcut to CurvedUIInputModule's property.
/// </summary>
public float GazeClickTimerDelay {
get { return CurvedUIInputModule.Instance.GazeClickTimerDelay; }
set { CurvedUIInputModule.Instance.GazeClickTimerDelay = value; }
}
/// <summary>
/// Gaze Control Method. How long till Click method is executed on Buttons under gaze? Goes 0-1.
/// This is a shortcut to CurvedUIInputModule's property.
/// </summary>
public float GazeTimerProgress {
get { return CurvedUIInputModule.Instance.GazeTimerProgress; }
}
#endregion
#region ENUMS
public enum CurvedUIShape
{
CYLINDER = 0,
RING = 1,
SPHERE = 2,
CYLINDER_VERTICAL = 3,
}
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: a783f671592674b589cfc4953e28656b
timeCreated: 1474550691
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,708 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections;
using System.Collections.Generic;
#if UNITY_EDITOR
using UnityEditor;
#endif
#if CURVEDUI_TMP || TMP_PRESENT
using TMPro;
#endif
[assembly: CurvedUI.OptionalDependency("TMPro.TextMeshProUGUI", "CURVEDUI_TMP")]
namespace CurvedUI
{
//Added to every UI object by CurvedUISettings.
//This is the script that subdivides and modifies the shape of the canvas object it is attached to.
//
//Requires Unity 5.3 or later
public partial class CurvedUIVertexEffect : BaseMeshEffect
{
#region VARIABLES
//public settings
[Tooltip("Check to skip tesselation pass on this object. CurvedUI will not create additional vertices to make this object have a smoother curve. Checking this can solve some issues if you create your own procedural mesh for this object. Default false.")]
public bool DoNotTesselate = false;
//stored references
Canvas myCanvas;
CurvedUISettings mySettings;
Graphic myGraphic;
Text myText;
#if CURVEDUI_TMP || TMP_PRESENT
TextMeshProUGUI myTMP;
CurvedUITMPSubmesh myTMPSubMesh;
#endif
//variables we operate on
bool m_tesselationRequired = true;
bool tesselationRequired {
get { return m_tesselationRequired; }
set { m_tesselationRequired = value;
//Debug.Log(this.gameObject.name + " settting tess to " + value, this.gameObject);
}
}
bool curvingRequired = true;
bool TransformMisaligned = false;
Matrix4x4 CanvasToWorld;
Matrix4x4 CanvasToLocal;
Matrix4x4 MyToWorld;
Matrix4x4 MyToLocal;
List<UIVertex> m_tesselatedVerts = new List<UIVertex>();
List<UIVertex> m_curvedVerts = new List<UIVertex>();
List<UIVertex> m_vertsInQuads = new List<UIVertex>();
UIVertex m_ret;
UIVertex[] m_quad = new UIVertex[4];
float[] m_weights = new float[4];
[SerializeField] [HideInInspector] Vector3 savedPos;
[SerializeField] [HideInInspector] Vector3 savedUp;
[SerializeField] [HideInInspector] Vector2 savedRectSize;
[SerializeField] [HideInInspector] Color savedColor;
#if UNITY_2020_2_OR_NEWER
[SerializeField] [HideInInspector] Vector4 savedTextUV0;
#else
[SerializeField] [HideInInspector] Vector2 savedTextUV0;
#endif
[SerializeField] [HideInInspector] float savedFill;
#endregion
#region LIFECYCLE
protected override void Awake()
{
base.Awake();
myGraphic = GetComponent<Graphic>();
myText = GetComponent<Text>();
#if CURVEDUI_TMP || TMP_PRESENT
myTMP = GetComponent<TextMeshProUGUI>();
myTMPSubMesh = GetComponent<CurvedUITMPSubmesh>();
#endif
}
protected override void OnEnable()
{
//find the settings object and its canvas.
FindParentSettings();
//If there is an update to the graphic, we cant reuse old vertices, so new tesselation will be required
if (myGraphic)
{
myGraphic.RegisterDirtyMaterialCallback(TesselationRequiredCallback);
myGraphic.SetVerticesDirty();
}
//add text events and callbacks
if (myText)
{
myText.RegisterDirtyVerticesCallback(TesselationRequiredCallback);
Font.textureRebuilt += FontTextureRebuiltCallback;
}
}
/// <summary>
/// Start is executed after OnEnable
/// </summary>
protected override void Start()
{
base.Start();
//if we have an interactable component, make sure its inside the canvas and it's Z position is 0 in relation to the canvas.
//Otherwise the interactions on it will not be accurate, or it may not work at all!
//This is because, in order to save performance, CurvedUI creates a collider only for the space inside the Canvas rectangle.
if (myCanvas && GetComponent<Selectable>())
{
Vector3 myPosOnCanvas = myCanvas.transform.worldToLocalMatrix.MultiplyPoint3x4(this.transform.position);
RectTransform canvasRect = (myCanvas.transform as RectTransform);
if (myPosOnCanvas.x.Abs() > canvasRect.rect.width / 2.0f || myPosOnCanvas.y.Abs() > canvasRect.rect.height / 2.0f)
{
Debug.LogWarning("CurvedUI: " + GetComponent<Selectable>().GetType().Name + " \"" + this.gameObject.name + "\" is outside of the canvas. It will not be interactable. Move it inside the canvas rectangle (white border in scene view) for it to work.", this.gameObject);
}
if (myPosOnCanvas.z.Abs() > 0.1f)
{
Debug.LogWarning("CurvedUI: The Z position of \"" + this.gameObject.name + "\" " + GetComponent<Selectable>().GetType().Name + ", or one of its parents is not 0 in relation to the canvas. The interactions may not be accurate.", this.gameObject);
}
}
}
protected override void OnDisable()
{
//If there is an update to the graphic, we cant reuse old vertices, so new tesselation will be required
if (myGraphic)
myGraphic.UnregisterDirtyMaterialCallback(TesselationRequiredCallback);
if (myText)
{
myText.UnregisterDirtyVerticesCallback(TesselationRequiredCallback);
Font.textureRebuilt -= FontTextureRebuiltCallback;
}
}
/// <summary>
/// Subscribed to graphic componenet to find out when vertex information changes and we need to create new geometry based on that.
/// </summary>
void TesselationRequiredCallback()
{
tesselationRequired = true;
}
/// <summary>
/// Called by Font class to let us know font atlas has ben rebuilt and we need to update our vertices.
/// </summary>
void FontTextureRebuiltCallback(Font fontie)
{
if (myText.font == fontie)
tesselationRequired = true;
}
void LateUpdate()
{
#if CURVEDUI_TMP || TMP_PRESENT // CurvedUITMP handles updates for TextMeshPro objects.
if (myTMP || myTMPSubMesh) return;
#endif
//Find if the change in transform requires us to retesselate the UI
// do not perform the check it it will happen anyway
if (!tesselationRequired)
{
if ((transform as RectTransform).rect.size != savedRectSize)
{
//the size of this RectTransform has changed, we have to tesselate again!
tesselationRequired = true;
}
else if (myGraphic != null)//test for color changes if it has a graphic component
{
if (myGraphic.color != savedColor)
{
tesselationRequired = true;
savedColor = myGraphic.color;
}
else if (myGraphic is Image)
{
if ((myGraphic as Image).fillAmount != savedFill)
{
tesselationRequired = true;
savedFill = (myGraphic as Image).fillAmount;
}
}
}
}
if (!tesselationRequired && !curvingRequired) // do not perform a check if we're already tesselating or curving. Tesselation includes curving.
{
//test if position in canvas's local space has been changed. We would need to recalculate vertices again
Vector3 testedPos = mySettings.transform.worldToLocalMatrix.MultiplyPoint3x4(this.transform.position);
if (!testedPos.AlmostEqual(savedPos))
{
//we dont have to curve vertices if we only moved the object vertically in a cylinder.
if (mySettings.Shape != CurvedUISettings.CurvedUIShape.CYLINDER || Mathf.Pow(testedPos.x - savedPos.x, 2) > 0.00001 || Mathf.Pow(testedPos.z - savedPos.z, 2) > 0.00001)
{
savedPos = testedPos;
curvingRequired = true;
//Debug.Log("crv req - tested pos: " + testedPos, this.gameObject);
}
}
//test this object's rotation in relation to canvas.
Vector3 testedUp = mySettings.transform.worldToLocalMatrix.MultiplyVector(this.transform.up).normalized;
if (!savedUp.AlmostEqual(testedUp, 0.0001))
{
bool testedEqual = testedUp.AlmostEqual(Vector3.up.normalized);
bool savedEqual = savedUp.AlmostEqual(Vector3.up.normalized);
//special case - if we change the z angle from or to 0, we need to retesselate to properly display geometry in cyllinder
if ((!testedEqual && savedEqual) || (testedEqual && !savedEqual))
tesselationRequired = true;
savedUp = testedUp;
curvingRequired = true;
//Debug.Log("crv req - tested up: " + testedUp);
}
}
////if we find we need to make a change in the mesh, set vertices dirty to trigger BaseMeshEffect firing.
if (myGraphic && (tesselationRequired || curvingRequired)) myGraphic.SetVerticesDirty();
}
#endregion
#region MESH EFFECT
//This is called by canvas after UI object's mesh is generated, but before it is rendered.
//Best place to modify the vertices of the object.
public override void ModifyMesh(VertexHelper vh)
{
if (!ShouldModify()) return;
//check for changes in text font material that would mean a retesselation in required to get fresh UV's
CheckTextFontMaterial();
//TESSELATING VERTICES--------------------------------------------------------//
//tesselate (subdivide) the vertices of the UI object if we need more of them
//to display nice curvature. Save them to a list, so we don't have to retesselate
//if RectTransform's size has not changed.
if (tesselationRequired || !Application.isPlaying)
{
//Prepare a list and get vertices from the vertex stream. These come as triangles.
if (m_tesselatedVerts == null)
m_tesselatedVerts = new List<UIVertex>();
else
m_tesselatedVerts.Clear();
vh.GetUIVertexStream(m_tesselatedVerts);
//subdivide them
TesselateGeometry(m_tesselatedVerts);
//save the transform properties we last tesselated for.
savedRectSize = (transform as RectTransform).rect.size;
//set flag
tesselationRequired = false;
curvingRequired = true;
}
//CURVING VERTICES ---------------------------------------------------------//
if (curvingRequired)
{
//update transformation matrices we're going to use in curving the verts.
CanvasToWorld = myCanvas.transform.localToWorldMatrix;
CanvasToLocal = myCanvas.transform.worldToLocalMatrix;
MyToWorld = transform.localToWorldMatrix;
MyToLocal = transform.worldToLocalMatrix;
//prepare list
if (m_curvedVerts == null)
m_curvedVerts = new List<UIVertex>();
//Debug.Log("verts:" + m_curvedVerts.Count + " tess'd:" + m_tesselatedVerts.Count);
if (m_curvedVerts.Count == m_tesselatedVerts.Count)
{
//Debug.Log("count equal");
for (int i = 0; i < m_curvedVerts.Count; i++)
m_curvedVerts[i] = CurveVertex(m_tesselatedVerts[i], mySettings.Angle, mySettings.GetCyllinderRadiusInCanvasSpace(), (myCanvas.transform as RectTransform).rect.size);
}
else
{
m_curvedVerts.Clear();
for (int i = 0; i < m_tesselatedVerts.Count; i++)
m_curvedVerts.Add(CurveVertex(m_tesselatedVerts[i], mySettings.Angle, mySettings.GetCyllinderRadiusInCanvasSpace(), (myCanvas.transform as RectTransform).rect.size));
}
//set flags
curvingRequired = false;
}
//SAVE CURVED VERTICES TO THE VERTEX HELPER------------------------//
//They can come as quads or as triangles.
vh.Clear();
if (m_curvedVerts.Count % 4 == 0)
{
for (int i = 0; i < m_curvedVerts.Count; i += 4)
{
for (int v = 0; v < 4; v++)//create a quad
m_quad[v] = m_curvedVerts[i + v];
vh.AddUIVertexQuad(m_quad); // add it to the list
}
}
else vh.AddUIVertexTriangleStream(m_curvedVerts);
}
//This is called by canvas after UI object's mesh is generated, but before it is rendered.
//Best place to modify the vertices of the object.
public void ModifyTMPMesh(ref List<UIVertex> vertexList)
{
if (!ShouldModify()) return;
//check for changes in text font material that would mean a retesselation in required to get fresh UV's
CheckTextFontMaterial();
//TESSELATING VERTICES--------------------------------------------------------//
//not needed in TMP object, skip to curving
tesselationRequired = false;
curvingRequired = true;
//CURVING VERTICES ---------------------------------------------------------//
if (curvingRequired)
{
//update transformation matrices we're going to use in curving the verts.
CanvasToWorld = myCanvas.transform.localToWorldMatrix;
CanvasToLocal = myCanvas.transform.worldToLocalMatrix;
MyToWorld = transform.localToWorldMatrix;
MyToLocal = transform.worldToLocalMatrix;
//Debug.Log("verts:" + m_curvedVerts.Count + " tess'd:" + m_tesselatedVerts.Count);
for (int i = 0; i < vertexList.Count; i++)
vertexList[i] = CurveVertex(vertexList[i], mySettings.Angle, mySettings.GetCyllinderRadiusInCanvasSpace(), (myCanvas.transform as RectTransform).rect.size);
//set flags
curvingRequired = false;
}
}
#endregion
#region HELPERS
bool ShouldModify()
{
if (!this.IsActive()) return false;
if (mySettings == null) FindParentSettings();
if (mySettings == null || !mySettings.enabled || mySettings.Angle == 1) return false;
return true;
}
void CheckTextFontMaterial()
{
//we check for a sudden change in text's fontMaterialTexture. This is a very hacky way, but the only one working reliably for now.
if (myText)
{
if (myText.cachedTextGenerator.verts.Count > 0 && myText.cachedTextGenerator.verts[0].uv0 != savedTextUV0)
{
//Debug.Log("tess req - texture");
savedTextUV0 = myText.cachedTextGenerator.verts[0].uv0;
tesselationRequired = true;
}
}
}
public CurvedUISettings FindParentSettings(bool forceNew = false)
{
if (mySettings == null || forceNew)
{
mySettings = GetComponentInParent<CurvedUISettings>();
if (mySettings == null) return null;
else
{
myCanvas = mySettings.GetComponent<Canvas>();
}
}
return mySettings;
}
#endregion
#region CURVING
/// <summary>
/// Map position of a vertex to a section of a circle. calculated in canvas's local space
/// </summary>
UIVertex CurveVertex(UIVertex input, float cylinder_angle, float radius, Vector2 canvasSize)
{
Vector3 pos = input.position;
//calculated in canvas local space version:
pos = CanvasToLocal.MultiplyPoint3x4(MyToWorld.MultiplyPoint3x4(pos));
// pos = mySettings.VertexPositionToCurvedCanvas(pos);
if (mySettings.Shape == CurvedUISettings.CurvedUIShape.CYLINDER && mySettings.Angle != 0)
{
float theta = (pos.x / canvasSize.x) * cylinder_angle * Mathf.Deg2Rad;
radius += pos.z; // change the radius depending on how far the element is moved in z direction from canvas plane
pos.x = Mathf.Sin(theta) * radius;
pos.z += Mathf.Cos(theta) * radius - radius;
}
else if (mySettings.Shape == CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL && mySettings.Angle != 0)
{
float theta = (pos.y / canvasSize.y) * cylinder_angle * Mathf.Deg2Rad;
radius += pos.z; // change the radius depending on how far the element is moved in z direction from canvas plane
pos.y = Mathf.Sin(theta) * radius;
pos.z += Mathf.Cos(theta) * radius - radius;
}
else if (mySettings.Shape == CurvedUISettings.CurvedUIShape.RING)
{
float angleOffset = 0;
float r = pos.y.Remap(canvasSize.y * 0.5f * (mySettings.RingFlipVertical ? 1 : -1), -canvasSize.y * 0.5f * (mySettings.RingFlipVertical ? 1 : -1), mySettings.RingExternalDiameter * (1 - mySettings.RingFill) * 0.5f, mySettings.RingExternalDiameter * 0.5f);
float theta = (pos.x / canvasSize.x).Remap(-0.5f, 0.5f, Mathf.PI / 2.0f, cylinder_angle * Mathf.Deg2Rad + Mathf.PI / 2.0f) - angleOffset;
pos.x = r * Mathf.Cos(theta);
pos.y = r * Mathf.Sin(theta);
}
else if (mySettings.Shape == CurvedUISettings.CurvedUIShape.SPHERE && mySettings.Angle != 0)
{
float vangle = mySettings.VerticalAngle;
float savedZ = -pos.z;
if (mySettings.PreserveAspect)
{
vangle = cylinder_angle * (canvasSize.y / canvasSize.x);
}
else
{
radius = canvasSize.x / 2.0f;
if (vangle == 0) return input;
}
//convert planar coordinates to spherical coordinates
float theta = (pos.x / canvasSize.x).Remap(-0.5f, 0.5f, (180 - cylinder_angle) / 2.0f - 90, 180 - (180 - cylinder_angle) / 2.0f - 90);
theta *= Mathf.Deg2Rad;
float gamma = (pos.y / canvasSize.y).Remap(-0.5f, 0.5f, (180 - vangle) / 2.0f, 180 - (180 - vangle) / 2.0f);
gamma *= Mathf.Deg2Rad;
pos.z = Mathf.Sin(gamma) * Mathf.Cos(theta) * (radius + savedZ);
pos.y = -(radius + savedZ) * Mathf.Cos(gamma);
pos.x = Mathf.Sin(gamma) * Mathf.Sin(theta) * (radius + savedZ);
if (mySettings.PreserveAspect)
pos.z -= radius;
}
//4. write output
input.position = MyToLocal.MultiplyPoint3x4(CanvasToWorld.MultiplyPoint3x4(pos));
return input;
}
#endregion
#region TESSELATION
void TesselateGeometry(List<UIVertex> verts)
{
Vector2 tessellatedSize = mySettings.GetTesslationSize();
//find if we are aligned with canvas main axis
TransformMisaligned = !(savedUp.AlmostEqual(Vector3.up.normalized));
// Convert the list from triangles to quads to be used by the tesselation
TrisToQuads(verts);
//do not tesselate text verts. Text usually is small and has plenty of verts already.
#if CURVEDUI_TMP || TMP_PRESENT
if (myText == null && myTMP == null && !DoNotTesselate)
{
#else
if (myText == null && !DoNotTesselate)
{
#endif
// Tesselate quads and apply transformation
int startingVertexCount = verts.Count;
for (int i = 0; i < startingVertexCount; i += 4)
ModifyQuad(verts, i, tessellatedSize);
// Remove old quads
verts.RemoveRange(0, startingVertexCount);
}
}
void ModifyQuad(List<UIVertex> verts, int vertexIndex, Vector2 requiredSize)
{
// Read the existing quad vertices
for (int i = 0; i < 4; i++)
m_quad[i] = verts[vertexIndex + i];
// horizotal and vertical directions of a quad. We're going to tesselate parallel to these.
Vector3 horizontalDir = m_quad[2].position - m_quad[1].position;
Vector3 verticalDir = m_quad[1].position - m_quad[0].position;
//To make sure filled image is properly tesselated, were going to find the bigger side of the quad.
if (myGraphic != null && (myGraphic is Image) && (myGraphic as Image).type == Image.Type.Filled)
{
horizontalDir = (horizontalDir).x > (m_quad[3].position - m_quad[0].position).x ? horizontalDir : m_quad[3].position - m_quad[0].position;
verticalDir = (verticalDir).y > (m_quad[2].position - m_quad[3].position).y ? verticalDir : m_quad[2].position - m_quad[3].position;
}
// Find how many quads we need to create
int horizontalQuads = 1;
int verticalQuads = 1;
// Tesselate vertically only if the recttransform (or parent) is rotated
// This cuts down the time needed to tesselate by 90% in some cases.
if (TransformMisaligned || mySettings.Shape == CurvedUISettings.CurvedUIShape.SPHERE || mySettings.Shape == CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL)
verticalQuads = Mathf.CeilToInt(verticalDir.magnitude * (1.0f / Mathf.Max(0.0001f, requiredSize.y)));
if (TransformMisaligned || mySettings.Shape != CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL)
{
horizontalQuads = Mathf.CeilToInt(horizontalDir.magnitude * (1.0f / Mathf.Max(0.0001f, requiredSize.x)));
}
//Debug.Log(this.transform.root.name + "'s panel: hori size:" + horizontalDir.magnitude + " req:" + requiredSize.x + " divs:"+horizontalQuads);
bool oneVert = false;
bool oneHori = false;
// Create the quads!
float yStart = 0.0f;
for (int y = 0; y < verticalQuads || !oneVert; ++y)
{
oneVert = true;
float yEnd = (y + 1.0f) / verticalQuads;
float xStart = 0.0f;
for (int x = 0; x < horizontalQuads || !oneHori; ++x)
{
oneHori = true;
float xEnd = (x + 1.0f) / horizontalQuads;
//Add new quads to list
verts.Add(TesselateQuad(xStart, yStart));
verts.Add(TesselateQuad(xStart, yEnd));
verts.Add(TesselateQuad(xEnd, yEnd));
verts.Add(TesselateQuad(xEnd, yStart));
//begin the next quad where we ened this one
xStart = xEnd;
}
//begin the next row where we ended this one
yStart = yEnd;
}
}
/// <summary>
/// Converts a List of triangle mesh vertices to a list of quad mesh vertices
/// </summary>
void TrisToQuads(List<UIVertex> verts)
{
int vertsInTrisCount = verts.Count;
m_vertsInQuads.Clear();
for (int i = 0; i < vertsInTrisCount; i += 6)
{
// Get four corners from two triangles. Basic UI always comes in quads anyway.
m_vertsInQuads.Add(verts[i + 0]);
m_vertsInQuads.Add(verts[i + 1]);
m_vertsInQuads.Add(verts[i + 2]);
m_vertsInQuads.Add(verts[i + 4]);
}
//add quads to the list and remove the triangles
verts.AddRange(m_vertsInQuads);
verts.RemoveRange(0, vertsInTrisCount);
}
/// <summary>
/// Subdivides a quad into 4 quads.
/// </summary>
/// <returns>The quad.</returns>
/// <param name="quad">Quad.</param>
/// <param name="x">The x coordinate.</param>
/// <param name="y">The y coordinate.</param>
#if UNITY_2020_2_OR_NEWER
private Vector4 _uv0;
private Vector4 _uv1;
#else
private Vector2 _uv0;
private Vector2 _uv1;
#endif
private Vector3 _pos;
UIVertex TesselateQuad(float x, float y)
{
//1. calculate weighting factors
m_weights[0] = (1 - x) * (1 - y);
m_weights[1] = (1 - x) * y;
m_weights[2] = x * y;
m_weights[3] = x * (1 - y);
//2. interpolate all the vertex properties using weighting factors
_uv0 = _uv1 = Vector2.zero;
_pos = Vector3.zero;
for (int i = 0; i < 4; i++)
{
_uv0 += m_quad[i].uv0 * m_weights[i];
_uv1 += m_quad[i].uv1 * m_weights[i];
_pos += m_quad[i].position * m_weights[i];
//normal += quad[i].normal * weights[i]; // normals should be recalculated to take the curve into account. Skipped to save performance.
//tan += quad[i].tangent * weights[i]; // tangents should be recalculated to take the curve into account. Skipped to save performance.
}
//4. return output
m_ret.position = _pos;
//ret.color = Color32.Lerp(Color32.Lerp(quad[3].color, quad[1].color, y), Color32.Lerp(quad[0].color, quad[2].color, y), x);
m_ret.color = m_quad[0].color; //used instead to save performance. Color lerps are expensive.
m_ret.uv0 = _uv0;
m_ret.uv1 = _uv1;
m_ret.normal = m_quad[0].normal;
m_ret.tangent = m_quad[0].tangent;
return m_ret;
}
#endregion
#region PUBLIC
/// <summary>
/// Force Mesh to be rebuild during canvas' next update loop.
/// </summary>
public void SetDirty()
{
TesselationRequired = true;
}
/// <summary>
/// Force vertices to be tesselated again from original vertices.
/// Set by CurvedUIVertexEffect when updating object's visual property.
/// </summary>
public bool TesselationRequired
{
get { return tesselationRequired; }
set { tesselationRequired = value; }
}
/// <summary>
/// Force vertices to be repositioned on the curved canvas.
/// set by CurvedUIVertexEffect when moving UI objects on canvas.
/// </summary>
public bool CurvingRequired
{
get { return curvingRequired; }
set { curvingRequired = value; }
}
#endregion
}// end of class
} //end of namespace

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4e62188adca544cf1b96ccf1630f15f9
timeCreated: 1462736356
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,433 @@
using UnityEngine;
using System.Collections;
namespace CurvedUI
{
/// <summary>
/// Contains a bunch of events you can subscribe to and bools to ask for current state of the controller. Can also trigger haptic feedback if you ask nicely.
/// </summary>
public class CurvedUIViveController : MonoBehaviour
{
#if CURVEDUI_STEAMVR_LEGACY
#region settings
public int axisFidelity = 1;
#endregion
#region internal variables
private uint controllerIndex;
private Type controllerType = Type.UNDEFINED;
private SteamVR_TrackedObject trackedController;
private SteamVR_Controller.Device device;
private Vector2 touchpadAxis = Vector2.zero;
private Vector2 triggerAxis = Vector2.zero;
private bool controllerVisible = true;
private ushort hapticPulseStrength;
private int hapticPulseCountdown;
private ushort maxHapticVibration = 3999;
private Vector3 oculusTouchPoitingOriginOffset = new Vector3(0, -0.0258f, -0.033f);
private Vector3 oculusTouchPoitingRotationOffset = new Vector3(38, 0, 0);
public enum Type
{
UNDEFINED = 0,
VIVE = 1,
OCULUS_TOUCH = 2,
}
#endregion
#region EVENTS
public event ViveInputEvent TriggerClicked;
public event ViveInputEvent TriggerUnclicked;
public event ViveInputEvent TriggerAxisChanged;
public event ViveInputEvent ApplicationMenuClicked;
public event ViveInputEvent ApplicationMenuUnclicked;
public event ViveInputEvent GripClicked;
public event ViveInputEvent GripUnclicked;
public event ViveInputEvent TouchpadClicked;
public event ViveInputEvent TouchpadUnclicked;
public event ViveInputEvent TouchpadTouched;
public event ViveInputEvent TouchpadUntouched;
public event ViveInputEvent TouchpadAxisChanged;
public event ViveEvent ModelLoaded;
public virtual void OnTriggerClicked(ViveInputArgs e)
{
if (TriggerClicked != null)
TriggerClicked(this, e);
}
public virtual void OnTriggerUnclicked(ViveInputArgs e)
{
if (TriggerUnclicked != null)
TriggerUnclicked(this, e);
}
public virtual void OnTriggerAxisChanged(ViveInputArgs e)
{
if (TriggerAxisChanged != null)
TriggerAxisChanged(this, e);
}
public virtual void OnApplicationMenuClicked(ViveInputArgs e)
{
if (ApplicationMenuClicked != null)
ApplicationMenuClicked(this, e);
}
public virtual void OnApplicationMenuUnclicked(ViveInputArgs e)
{
if (ApplicationMenuUnclicked != null)
ApplicationMenuUnclicked(this, e);
}
public virtual void OnGripClicked(ViveInputArgs e)
{
if (GripClicked != null)
GripClicked(this, e);
}
public virtual void OnGripUnclicked(ViveInputArgs e)
{
if (GripUnclicked != null)
GripUnclicked(this, e);
}
public virtual void OnTouchpadClicked(ViveInputArgs e)
{
if (TouchpadClicked != null)
TouchpadClicked(this, e);
}
public virtual void OnTouchpadUnclicked(ViveInputArgs e)
{
if (TouchpadUnclicked != null)
TouchpadUnclicked(this, e);
}
public virtual void OnTouchpadTouched(ViveInputArgs e)
{
if (TouchpadTouched != null)
TouchpadTouched(this, e);
}
public virtual void OnTouchpadUntouched(ViveInputArgs e)
{
if (TouchpadUntouched != null)
TouchpadUntouched(this, e);
}
public virtual void OnTouchpadAxisChanged(ViveInputArgs e)
{
if (TouchpadAxisChanged != null)
TouchpadAxisChanged(this, e);
}
#endregion
#region LIFECYCLE
void Awake()
{
trackedController = GetComponent<SteamVR_TrackedObject>();
SteamVR_Events.RenderModelLoaded.AddListener(SteamVRModelLoaded);
}
void Update()
{
controllerIndex = (uint)trackedController.index;
//this device is not tracked right now - it has no device index - skip it.
if (controllerIndex < 0 || controllerIndex >= Valve.VR.OpenVR.k_unMaxTrackedDeviceCount) return;
device = SteamVR_Controller.Input((int)controllerIndex);
//get axis inputfrom debice
Vector2 currentTriggerAxis = device.GetAxis(Valve.VR.EVRButtonId.k_EButton_SteamVR_Trigger);
Vector2 currentTouchpadAxis = device.GetAxis();
//haptic feedback
if (hapticPulseCountdown > 0)
{
device.TriggerHapticPulse(hapticPulseStrength);
hapticPulseCountdown -= 1;
}
//check for changes in trigger press
if (Vector2ShallowEquals(triggerAxis, currentTriggerAxis))
{
triggerAxisChanged = false;
}
else
{
OnTriggerAxisChanged(SetButtonEvent(ref triggerPressed, true, currentTriggerAxis.x));
triggerAxisChanged = true;
}
//check for changes in finger pos on touchpad
if (Vector2ShallowEquals(touchpadAxis, currentTouchpadAxis))
{
touchpadAxisChanged = false;
}
else
{
OnTouchpadAxisChanged(SetButtonEvent(ref touchpadTouched, true, 1f));
touchpadAxisChanged = true;
}
touchpadAxis = new Vector2(currentTouchpadAxis.x, currentTouchpadAxis.y);
triggerAxis = new Vector2(currentTriggerAxis.x, currentTriggerAxis.y);
//Trigger
if (device.GetPressDown(SteamVR_Controller.ButtonMask.Trigger))
{
OnTriggerClicked(SetButtonEvent(ref triggerPressed, true, currentTriggerAxis.x));
triggerDown = true;
}
else {
triggerDown = false;
}
if (device.GetPressUp(SteamVR_Controller.ButtonMask.Trigger))
{
OnTriggerUnclicked(SetButtonEvent(ref triggerPressed, false, 0f));
triggerUp = true;
}
else {
triggerUp = false;
}
//ApplicationMenu
if (device.GetPressDown(SteamVR_Controller.ButtonMask.ApplicationMenu))
{
OnApplicationMenuClicked(SetButtonEvent(ref applicationMenuPressed, true, 1f));
}
else if (device.GetPressUp(SteamVR_Controller.ButtonMask.ApplicationMenu))
{
OnApplicationMenuUnclicked(SetButtonEvent(ref applicationMenuPressed, false, 0f));
}
//Grip
if (device.GetPressDown(SteamVR_Controller.ButtonMask.Grip))
{
OnGripClicked(SetButtonEvent(ref gripPressed, true, 1f));
}
else if (device.GetPressUp(SteamVR_Controller.ButtonMask.Grip))
{
OnGripUnclicked(SetButtonEvent(ref gripPressed, false, 0f));
}
//Touchpad Clicked
if (device.GetPressDown(SteamVR_Controller.ButtonMask.Touchpad))
{
OnTouchpadClicked(SetButtonEvent(ref touchpadPressed, true, 1f));
}
else if (device.GetPressUp(SteamVR_Controller.ButtonMask.Touchpad))
{
OnTouchpadUnclicked(SetButtonEvent(ref touchpadPressed, false, 0f));
}
//Touchpad Touched
if (device.GetTouchDown(SteamVR_Controller.ButtonMask.Touchpad))
{
OnTouchpadTouched(SetButtonEvent(ref touchpadTouched, true, 1f));
}
else if (device.GetTouchUp(SteamVR_Controller.ButtonMask.Touchpad))
{
OnTouchpadUntouched(SetButtonEvent(ref touchpadTouched, false, 0f));
}
}
#endregion
#region PRIVATE
/// <summary>
/// Compare two vectors if there are about equal.
/// </summary>
bool Vector2ShallowEquals(Vector2 vectorA, Vector2 vectorB)
{
return (vectorA.x.ToString("F" + axisFidelity) == vectorB.x.ToString("F" + axisFidelity) &&
vectorA.y.ToString("F" + axisFidelity) == vectorB.y.ToString("F" + axisFidelity));
}
void SteamVRModelLoaded(SteamVR_RenderModel model, bool loaded)
{
//find if the controller is touch or vive by the type of its trackpad
Valve.VR.ETrackedPropertyError pError = new Valve.VR.ETrackedPropertyError();
int axisprop = Valve.VR.OpenVR.System.GetInt32TrackedDeviceProperty((uint)trackedController.index, Valve.VR.ETrackedDeviceProperty.Prop_Axis0Type_Int32, ref pError);
controllerType = axisprop == (int)Valve.VR.EVRControllerAxisType.k_eControllerAxis_Joystick ? Type.OCULUS_TOUCH : Type.VIVE;
//call evenets
if (ModelLoaded != null) ModelLoaded(this);
}
#endregion
#region PUBLIC
public void ToggleControllerVisible(bool on)
{
foreach (MeshRenderer renderer in this.GetComponentsInChildren<MeshRenderer>())
{
renderer.enabled = on;
}
foreach (SkinnedMeshRenderer renderer in this.GetComponentsInChildren<SkinnedMeshRenderer>())
{
renderer.enabled = on;
}
controllerVisible = on;
}
/// <summary>
/// Triggers the haptic pulse.
/// </summary>
/// <param name="duration">Duration in frames.</param>
/// <param name="strength">Strength of the pulse. 100 is barely noticable, 300-500 seems about right for most uses. </param>
public void TriggerHapticPulse(int duration, ushort strength)
{
hapticPulseCountdown = duration;
hapticPulseStrength = (strength <= maxHapticVibration ? strength : maxHapticVibration);
}
#endregion
#region SETTERS AND GETTERS
/// <summary>
/// Is this controller a Vive Controller, Oculush Touch, or other?
/// </summary>
public Type ControllerType {
get { return controllerType; }
}
/// <summary>
/// Returns the pointing direction, based on controller type. Oculus touch controllers point in a slighlty different way than Vive controllers.
/// </summary>
public Vector3 PointingDirection {
get { return controllerType == Type.OCULUS_TOUCH ? transform.localToWorldMatrix.MultiplyVector(Quaternion.Euler(oculusTouchPoitingRotationOffset) * Vector3.forward) : transform.forward; }
}
/// <summary>
/// Returns the pointing origin, based on controller type. Oculus touch controllers point in a slighlty different way than Vive controllers.
/// </summary>
public Vector3 PointingOrigin {
get { return transform.TransformPoint(controllerType == Type.OCULUS_TOUCH ? oculusTouchPoitingOriginOffset : Vector3.zero); }
}
/// <summary>
/// Are the render components of the Controller enabled?
/// </summary>
/// <returns><c>true</c> if this instance is controller visible; otherwise, <c>false</c>.</returns>
public bool IsControllerVisible() { return controllerVisible; }
/// <summary>
/// Has trigger been pressed down this frame?
/// </summary>
public bool IsTriggerDown { get { return triggerDown; } }
bool triggerDown = false;
/// <summary>
/// Has trigger been released this frame?
/// </summary>
public bool IsTriggerUp { get { return triggerUp; } }
bool triggerUp = false;
/// <summary>
/// Is trigger pressed during this frame?
/// </summary>
public bool IsTriggerPressed { get { return triggerAxis.x > 0.5f; } }
bool triggerPressed = false;
/// <summary>
/// Has trigger axis (how hard trigger is pressed) changed this frame?
/// </summary>
public bool IsTriggerAxisChanged { get { return triggerAxisChanged; } }
bool triggerAxisChanged = false;
/// <summary>
/// Has user's finger position changed on touchpad this grame?
/// </summary>
public bool IsTouchpadAxisChanged { get { return touchpadAxisChanged; } }
bool touchpadAxisChanged = false;
/// <summary>
/// Is Application menu pressed right now?
/// </summary>
public bool IsApplicationMenuPressed { get { return applicationMenuPressed; } }
bool applicationMenuPressed = false;
/// <summary>
/// Is touchpad pressed this frame?
/// </summary>
public bool IsTouchpadPressed { get { return touchpadPressed; } }
bool touchpadPressed = false;
/// <summary>
/// Is user's finger resting on the touchpad?
/// </summary>
public bool IsTouchpadTouched { get { return touchpadTouched; } }
bool touchpadTouched = false;
/// <summary>
/// Is user holding the grip button?
/// </summary>
public bool IsGripPressed { get { return gripPressed; } }
bool gripPressed = false;
/// <summary>
/// FingerPosition on touchpad?
/// </summary>
public Vector2 TouchPadAxis { get { return touchpadAxis; } }
#endregion
ViveInputArgs SetButtonEvent(ref bool buttonBool, bool value, float buttonPressure)
{
buttonBool = value;
ViveInputArgs e;
e.controllerIndex = controllerIndex;
e.buttonPressure = buttonPressure;
e.touchpadAxis = device.GetAxis();
return e;
}
#endif
}
public struct ViveInputArgs
{
public uint controllerIndex;
public float buttonPressure;
public Vector2 touchpadAxis;
}
public delegate void ViveInputEvent(object sender, ViveInputArgs e);
public delegate void ViveEvent(object sender);
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 76095c04a5388a64098bbd3671620117
timeCreated: 1463840360
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 370b2aea2ee318241afde9388830df32
folderAsset: yes
timeCreated: 1452993462
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,173 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using UnityEditor;
using Debug = UnityEngine.Debug;
namespace CurvedUI.ConditionalCompilation
{
/// <summary>
/// Conditional Compilation Utility (CCU) by Unity
/// https://github.com/Unity-Technologies/EditorXR/blob/development/Scripts/Utilities/Editor/ConditionalCompilationUtility.cs
///
/// The Conditional Compilation Utility (CCU) will add defines to the build settings once dependendent classes have been detected.
/// In order for this to be specified in any project without the project needing to include the CCU, at least one custom attribute
/// must be created in the following form:
///
/// [Conditional(UNITY_CCU)] // | This is necessary for CCU to pick up the right attributes
/// public class OptionalDependencyAttribute : Attribute // | Must derive from System.Attribute
/// {
/// public string dependentClass; // | Required field specifying the fully qualified dependent class
/// public string define; // | Required field specifying the define to add
/// }
///
/// Then, simply specify the assembly attribute(s) you created:
/// [assembly: OptionalDependency("UnityEngine.InputNew.InputSystem", "USE_NEW_INPUT")]
/// [assembly: OptionalDependency("Valve.VR.IVRSystem", "ENABLE_STEAMVR_INPUT")]
/// </summary>
[InitializeOnLoad]
public static class ConditionalCompilationUtility
{
const string k_EnableCCU = "UNITY_CCU";
public static bool enabled {
get
{
var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
return PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Contains(k_EnableCCU);
}
}
public static string[] defines { private set; get; }
static ConditionalCompilationUtility()
{
var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup;
var defines = PlayerSettings.GetScriptingDefineSymbolsForGroup(buildTargetGroup).Split(';').ToList();
if (!defines.Contains(k_EnableCCU, StringComparer.OrdinalIgnoreCase))
{
defines.Add(k_EnableCCU);
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, string.Join(";", defines.ToArray()));
// This will trigger another re-compile, which needs to happen, so all the custom attributes will be visible
return;
}
var ccuDefines = new List<string> { k_EnableCCU };
var conditionalAttributeType = typeof(ConditionalAttribute);
const string kDependentClass = "dependentClass";
const string kDefine = "define";
var attributeTypes = GetAssignableTypes(typeof(Attribute), type =>
{
var conditionals = (ConditionalAttribute[])type.GetCustomAttributes(conditionalAttributeType, true);
foreach (var conditional in conditionals)
{
if (string.Equals(conditional.ConditionString, k_EnableCCU, StringComparison.OrdinalIgnoreCase))
{
var dependentClassField = type.GetField(kDependentClass);
if (dependentClassField == null)
{
Debug.LogErrorFormat("[CCU] Attribute type {0} missing field: {1}", type.Name, kDependentClass);
return false;
}
var defineField = type.GetField(kDefine);
if (defineField == null)
{
Debug.LogErrorFormat("[CCU] Attribute type {0} missing field: {1}", type.Name, kDefine);
return false;
}
}
return true;
}
return false;
});
var dependencies = new Dictionary<string, string>();
ForEachAssembly(assembly =>
{
var typeAttributes = assembly.GetCustomAttributes(false).Cast<Attribute>();
foreach (var typeAttribute in typeAttributes)
{
if (attributeTypes.Contains(typeAttribute.GetType()))
{
var t = typeAttribute.GetType();
// These fields were already validated in a previous step
var dependentClass = t.GetField(kDependentClass).GetValue(typeAttribute) as string;
var define = t.GetField(kDefine).GetValue(typeAttribute) as string;
if (!string.IsNullOrEmpty(dependentClass) && !string.IsNullOrEmpty(define) && !dependencies.ContainsKey(dependentClass))
dependencies.Add(dependentClass, define);
}
}
});
ForEachAssembly(assembly =>
{
foreach (var dependency in dependencies)
{
var type = assembly.GetType(dependency.Key);
if (type != null)
{
var define = dependency.Value;
if (!defines.Contains(define, StringComparer.OrdinalIgnoreCase))
defines.Add(define);
ccuDefines.Add(define);
}
}
});
ConditionalCompilationUtility.defines = ccuDefines.ToArray();
PlayerSettings.SetScriptingDefineSymbolsForGroup(buildTargetGroup, string.Join(";", defines.ToArray()));
}
static void ForEachAssembly(Action<Assembly> callback)
{
var assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in assemblies)
{
try
{
callback(assembly);
}
catch (ReflectionTypeLoadException)
{
// Skip any assemblies that don't load properly
continue;
}
}
}
static void ForEachType(Action<Type> callback)
{
ForEachAssembly(assembly =>
{
var types = assembly.GetTypes();
foreach (var t in types)
callback(t);
});
}
static IEnumerable<Type> GetAssignableTypes(Type type, Func<Type, bool> predicate = null)
{
var list = new List<Type>();
ForEachType(t =>
{
if (type.IsAssignableFrom(t) && !t.IsInterface && !t.IsAbstract && (predicate == null || predicate(t)))
list.Add(t);
});
return list;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 2863d0ba5a803c143b1d0d32c42c3149
timeCreated: 1558205458
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Reflection;
namespace CurvedUI
{
[CustomEditor(typeof(CurvedUIHandSwitcher))]
public class CurvedUIHandSwitcherEditor : Editor
{
override public void OnInspectorGUI()
{
EditorGUILayout.HelpBox("This script moves the Laser Beam to the proper hand of OculusVR or SteamVR rig. Keep it active on the scene.", MessageType.Info);
EditorGUILayout.HelpBox("The Laser Beam is just a visual guide - it does not handle interactions.", MessageType.Info);
CurvedUIHandSwitcher manager = (CurvedUIHandSwitcher)target;
DrawDefaultInspector();
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: dcf6766b148aded4590346efb88c0eac
timeCreated: 1528073794
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.UI;
namespace CurvedUI {
[CustomEditor(typeof(CurvedUIInputModule))]
public class CurvedUIInputModuleEditor : Editor {
bool opened = false;
#if CURVEDUI_GOOGLEVR
bool isGVR = true;
#else
bool isGVR = false;
#endif
void OnEnable()
{
CurvedUIInputModule myTarget = (CurvedUIInputModule)target;
#if CURVEDUI_OCULUSVR
//automatically find Oculus Rig, if possible
if (myTarget.OculusCameraRig == null)
myTarget.OculusCameraRig = Object.FindObjectOfType<OVRCameraRig>();
#elif CURVEDUI_STEAMVR_LEGACY
//automatically find SteamVR Rig, if possible
if (myTarget.SteamVRControllerManager == null)
myTarget.SteamVRControllerManager = Object.FindObjectOfType<SteamVR_ControllerManager>();
#elif CURVEDUI_STEAMVR_2
//automatically find SteamVR Rig, if possible
if (myTarget.SteamVRPlayArea == null)
myTarget.SteamVRPlayArea = FindObjectOfType<Valve.VR.SteamVR_PlayArea>();
#endif
}
public override void OnInspectorGUI()
{
EditorGUILayout.HelpBox("Use CurvedUISettings component on your Canvas to configure CurvedUI", MessageType.Info);
if (isGVR)//on GVR we draw all the stuff.
{
DrawDefaultInspector();
}
else
{
if (opened)
{
if (GUILayout.Button("Hide Fields"))
opened = !opened;
DrawDefaultInspector();
}
else
{
if (GUILayout.Button("Show Fields"))
opened = !opened;
}
}
GUILayout.Space(20);
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 6fedfb069538a4de780c313250b8adce
timeCreated: 1482544593
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,74 @@
using UnityEditor;
namespace CurvedUI
{
/// <summary>
/// This class changes the Execution Order of Scripts in CurvedUI package.
/// Some of them must be executed before or after default time to work properly.
/// </summary>
[InitializeOnLoad]
public class CurvedUIScriptOrder : Editor
{
static CurvedUIScriptOrder()
{
ChangeScriptOrder(typeof(CurvedUITMP).Name, 100, OrderMatch.GREATER_THAN);
}
static void ChangeScriptOrder(string scriptName, int order, OrderMatch match = OrderMatch.EXACT)
{
// Iterate through all scripts (Might be a better way to do this?)
foreach (MonoScript monoScript in MonoImporter.GetAllRuntimeMonoScripts())
{
// If found our script
if (monoScript.name == scriptName)
{
if(match == OrderMatch.EXACT)
{
// And it's not at the execution time we want already
if (MonoImporter.GetExecutionOrder(monoScript) != order)
{
MonoImporter.SetExecutionOrder(monoScript, order);
}
break;
}
if (match == OrderMatch.LESSER_THAN)
{
// And it's not at the execution time we want already
if (MonoImporter.GetExecutionOrder(monoScript) > order)
{
MonoImporter.SetExecutionOrder(monoScript, order);
}
break;
}
if (match == OrderMatch.GREATER_THAN)
{
// And it's not at the execution time we want already
if (MonoImporter.GetExecutionOrder(monoScript) < order)
{
MonoImporter.SetExecutionOrder(monoScript, order);
}
break;
}
}
}
}
enum OrderMatch
{
EXACT = 0,
GREATER_THAN = 1,
LESSER_THAN = 2,
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: bf869527b6896e640b93087e346823b3
timeCreated: 1492858614
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,740 @@
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.UI;
using UnityEngine.EventSystems;
#if CURVEDUI_TMP || TMP_PRESENT
using TMPro;
#endif
#if CURVEDUI_STEAMVR_2
using Valve.VR;
using System.Reflection;
using System;
#endif
namespace CurvedUI {
[CustomEditor(typeof(CurvedUISettings))]
[ExecuteInEditMode]
public class CurvedUISettingsEditor : Editor {
#pragma warning disable 414
bool ShowRemoveCurvedUI = false;
static bool ShowAdvaced = false;
bool loadingCustomDefine = false;
static bool CUIeventSystemPresent = false;
private bool inPrefabMode = false;
[SerializeField][HideInInspector]
Dictionary<CurvedUIInputModule.CUIControlMethod, string> m_controlMethodDefineDict;
#if CURVEDUI_STEAMVR_2
SteamVR_Action_Boolean[] steamVRActions;
string[] steamVRActionsPaths;
#endif
#pragma warning restore 414
#region LIFECYCLE
void Awake()
{
AddCurvedUIComponents();
}
void OnEnable()
{
//if we're firing OnEnable, this means any compilation has ended. We're good!
loadingCustomDefine = false;
//look for CurvedUI custom EventSystem -> we'll check later if it makes sense to have one.
CUIeventSystemPresent = (FindObjectsOfType(typeof(CurvedUIEventSystem)).Length > 0);
//hacky way to make sure event is connected only once, but it works!
#if UNITY_2018_1_OR_NEWER
EditorApplication.hierarchyChanged -= AddCurvedUIComponents;
EditorApplication.hierarchyChanged -= AddCurvedUIComponents;
EditorApplication.hierarchyChanged += AddCurvedUIComponents;
#else
//hacky way to make sure event is connected only once, but it works!
EditorApplication.hierarchyWindowChanged -= AddCurvedUIComponents;
EditorApplication.hierarchyWindowChanged -= AddCurvedUIComponents;
EditorApplication.hierarchyWindowChanged += AddCurvedUIComponents;
#endif
//Warnings-------------------------------------//
if (Application.isPlaying)
{
CurvedUISettings myTarget = (CurvedUISettings)target;
//Canvas' layer not included in RaycastLayerMask warning
if (!IsInLayerMask(myTarget.gameObject.layer, CurvedUIInputModule.Instance.RaycastLayerMask) &&
myTarget.Interactable)
{
Debug.LogError("CURVEDUI: " + WarningLayerNotIncluded, myTarget.gameObject);
}
//check if the currently selected control method is enabled in editor.
//Otherwise, show error.
string define = PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
foreach(var key in ControlMethodDefineDict.Keys)
{
if(myTarget.ControlMethod == key && !define.Contains(ControlMethodDefineDict[key]))
Debug.LogError("CURVEDUI: Selected control method (" + key.ToString() + ") is not enabled. " +
"Enable it on CurvedUISettings component", myTarget.gameObject);
}
}
#if CURVEDUI_STEAMVR_2
//Get action and their paths to show in the popup.
steamVRActions = SteamVR_Input.GetActions<SteamVR_Action_Boolean>();
steamVRActionsPaths = new string[] { "None" };
if (steamVRActions != null && steamVRActions.Length > 0)
{
List<string> enumList = new List<string>();
//add all action paths to list.
for (int i = 0; i < steamVRActions.Length; i++)
enumList.Add(steamVRActions[i].fullPath);
enumList.Add("None"); //need a way to null that field, so add None as last pick.
//replace forward slashes with backslack instead. Otherwise they will not show up.
for (int index = 0; index < enumList.Count; index++)
enumList[index] = enumList[index].Replace('/', '\\');
steamVRActionsPaths = enumList.ToArray();
}
#endif
}
#endregion
public override void OnInspectorGUI()
{
//initial settings------------------------------------//
CurvedUISettings myTarget = (CurvedUISettings)target;
if (target == null) return;
GUI.changed = false;
EditorGUIUtility.labelWidth = 150;
#if UNITY_2018_3_OR_NEWER
inPrefabMode = (UnityEditor.SceneManagement.PrefabStageUtility.GetCurrentPrefabStage() != null);
#endif
//Version----------------------------------------------//
GUILayout.Label("Version " + CurvedUISettings.Version, EditorStyles.miniLabel);
//Warnings------------------------------------------//
//Canvas is on layer that is not part of RaycastLayerMask
if(!IsInLayerMask(myTarget.gameObject.layer, CurvedUIInputModule.Instance.RaycastLayerMask) && myTarget.Interactable)
{
EditorGUILayout.HelpBox(WarningLayerNotIncluded, MessageType.Error);
GUILayout.Space(30);
}
//Improper event system warning
if (CUIeventSystemPresent == false)
{
EditorGUILayout.HelpBox("Unity UI may become unresponsive in VR if game window loses focus. " +
"Use CurvedUIEventSystem instead of standard EventSystem component to solve this issue.",
MessageType.Warning);
GUILayout.BeginHorizontal();
GUILayout.Space(146);
if (GUILayout.Button("Use CurvedUI Event System")) SwapEventSystem();
GUILayout.EndHorizontal();
GUILayout.Space(30);
}
//-----------------------------------------------------//
//Control methods--------------------------------------//
DrawControlMethods();
//shape settings----------------------------------------//
GUILayout.Label("Shape", EditorStyles.boldLabel);
myTarget.Shape = (CurvedUISettings.CurvedUIShape)EditorGUILayout.EnumPopup("Canvas Shape", myTarget.Shape);
switch (myTarget.Shape)
{
case CurvedUISettings.CurvedUIShape.CYLINDER:
{
myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360);
myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect);
break;
}
case CurvedUISettings.CurvedUIShape.CYLINDER_VERTICAL:
{
myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360);
myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect);
break;
}
case CurvedUISettings.CurvedUIShape.RING:
{
myTarget.RingExternalDiameter = Mathf.Clamp(EditorGUILayout.IntField("External Diameter", myTarget.RingExternalDiameter), 1, 100000);
myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, 0, 360);
myTarget.RingFill = EditorGUILayout.Slider("Fill", myTarget.RingFill, 0.0f, 1.0f);
myTarget.RingFlipVertical = EditorGUILayout.Toggle("Flip Canvas Vertically", myTarget.RingFlipVertical);
break;
}
case CurvedUISettings.CurvedUIShape.SPHERE:
{
GUILayout.BeginHorizontal();
GUILayout.Space(150);
EditorGUILayout.HelpBox("Sphere shape is more expensive than a Cylinder shape. Keep this in mind when working on mobile VR.", MessageType.Info);
GUILayout.EndHorizontal();
GUILayout.Space(10);
if (myTarget.PreserveAspect)
{
myTarget.Angle = EditorGUILayout.IntSlider("Angle", myTarget.Angle, -360, 360);
}
else {
myTarget.Angle = EditorGUILayout.IntSlider("Horizontal Angle", myTarget.Angle, 0, 360);
myTarget.VerticalAngle = EditorGUILayout.IntSlider("Vertical Angle", myTarget.VerticalAngle, 0, 180);
}
myTarget.PreserveAspect = EditorGUILayout.Toggle("Preserve Aspect", myTarget.PreserveAspect);
break;
}
}//end of shape settings-------------------------------//
//180 degree warning ----------------------------------//
if ((myTarget.Shape != CurvedUISettings.CurvedUIShape.RING && myTarget.Angle.Abs() > 180) ||
(myTarget.Shape == CurvedUISettings.CurvedUIShape.SPHERE && myTarget.VerticalAngle > 180))
Draw180DegreeWarning();
//advanced settings------------------------------------//
GUILayout.Space(30);
if (!ShowAdvaced)
{
if (GUILayout.Button("Show Advanced Settings"))
{
ShowAdvaced = true;
loadingCustomDefine = false;
}
}
else
{
//hide advances settings button.
if (GUILayout.Button("Hide Advanced Settings")) ShowAdvaced = false;
GUILayout.Space(20);
//InputModule Options - only if we're not in prefab mode.
if (!inPrefabMode)
{
CurvedUIInputModule.Instance.RaycastLayerMask = LayerMaskField("Raycast Layer Mask",
CurvedUIInputModule.Instance.RaycastLayerMask);
//pointer override
GUILayout.Space(20);
CurvedUIInputModule.Instance.PointerTransformOverride = (Transform)EditorGUILayout.ObjectField("Pointer Override", CurvedUIInputModule.Instance.PointerTransformOverride, typeof(Transform), true);
GUILayout.BeginHorizontal();
GUILayout.Space(150);
GUILayout.Label("(Optional) If set, its position and forward (blue) direction will be used to point at canvas.", EditorStyles.helpBox);
GUILayout.EndHorizontal();
}
else
{
EditorGUILayout.HelpBox("Some settings are hidden in Prefab Mode", MessageType.Warning);
}
//quality
GUILayout.Space(20);
myTarget.Quality = EditorGUILayout.Slider("Quality", myTarget.Quality, 0.1f, 3.0f);
GUILayout.BeginHorizontal();
GUILayout.Space(150);
GUILayout.Label("Smoothness of the curve. Bigger values mean more subdivisions. Decrease for better performance. Default 1", EditorStyles.helpBox);
GUILayout.EndHorizontal();
//common options
myTarget.Interactable = EditorGUILayout.Toggle("Interactable", myTarget.Interactable);
myTarget.BlocksRaycasts = EditorGUILayout.Toggle("Blocks Raycasts", myTarget.BlocksRaycasts);
if (myTarget.Shape != CurvedUISettings.CurvedUIShape.SPHERE) myTarget.ForceUseBoxCollider =
EditorGUILayout.Toggle("Force Box Colliders Use", myTarget.ForceUseBoxCollider);
//add components button
GUILayout.Space(20);
GUILayout.BeginHorizontal();
GUILayout.Label("Components", GUILayout.Width(146));
if (GUILayout.Button("Add Curved Effect To Children")) AddCurvedUIComponents();
GUILayout.EndHorizontal();
//remove components button
GUILayout.BeginHorizontal();
GUILayout.Label("", GUILayout.Width(146));
if (!ShowRemoveCurvedUI)
{
if (GUILayout.Button("Remove CurvedUI from Canvas")) ShowRemoveCurvedUI = true;
}
else {
if (GUILayout.Button("Remove CurvedUI")) RemoveCurvedUIComponents();
if (GUILayout.Button("Cancel")) ShowRemoveCurvedUI = false;
}
GUILayout.EndHorizontal();
//documentation link
GUILayout.Space(20);
GUILayout.BeginHorizontal();
GUILayout.Label("Documentation", GUILayout.Width(146));
if (GUILayout.Button("Open in web browser")) Help.BrowseURL("https://docs.google.com/document/d/10hNcvOMissNbGgjyFyV1MS7HwkXXE6270A6Ul8h8pnQ/edit");
GUILayout.EndHorizontal();
}//end of Advanced settings---------------------------//
GUILayout.Space(20);
//final settings
if (GUI.changed && myTarget != null)
EditorUtility.SetDirty(myTarget);
}
#region CUSTOM GUI ELEMENTS
void DrawControlMethods()
{
GUILayout.Label("Global Settings", EditorStyles.boldLabel);
//Do not allow to change Global Settings in Prefab Mode
//These are stored in CurvedUInputModule
if (inPrefabMode)
{
EditorGUILayout.HelpBox(
"Some global settings (including Control Method) are hidden in Prefab Mode. These are stored on CurvedUIInputModule component which cannot be accessed now.",
MessageType.Warning);
return;
}
//Control Method dropdown--------------------------------//
CurvedUIInputModule.ControlMethod = (CurvedUIInputModule.CUIControlMethod)EditorGUILayout.EnumPopup("Control Method", CurvedUIInputModule.ControlMethod);
GUILayout.BeginHorizontal();
GUILayout.Space(150);
GUILayout.BeginVertical();
//Custom Settings for each Control Method---------------//
switch (CurvedUIInputModule.ControlMethod)
{
case CurvedUIInputModule.CUIControlMethod.MOUSE:
{
#if CURVEDUI_GOOGLEVR
EditorGUILayout.HelpBox("Enabling this control method will disable GoogleVR support.", MessageType.Warning);
DrawCustomDefineSwitcher("");
#else
GUILayout.Label("Basic Controller. Mouse on screen", EditorStyles.helpBox);
#endif
break;
}// end of MOUSE
case CurvedUIInputModule.CUIControlMethod.GAZE:
{
#if CURVEDUI_GOOGLEVR
EditorGUILayout.HelpBox("Enabling this control method will disable GoogleVR support.", MessageType.Warning);
DrawCustomDefineSwitcher("");
#else
GUILayout.Label("Center of Canvas's Event Camera acts as a pointer. Can be used with any headset. If you're on cardboard, you can use it instead of GOOGLEVR control method.", EditorStyles.helpBox);
CurvedUIInputModule.Instance.GazeUseTimedClick = EditorGUILayout.Toggle("Use Timed Click", CurvedUIInputModule.Instance.GazeUseTimedClick);
if (CurvedUIInputModule.Instance.GazeUseTimedClick)
{
GUILayout.Label("Clicks a button if player rests his gaze on it for a period of time. You can assign an image to be used as a progress bar.", EditorStyles.helpBox);
CurvedUIInputModule.Instance.GazeClickTimer = EditorGUILayout.FloatField("Click Timer (seconds)", CurvedUIInputModule.Instance.GazeClickTimer);
CurvedUIInputModule.Instance.GazeClickTimerDelay = EditorGUILayout.FloatField("Timer Start Delay", CurvedUIInputModule.Instance.GazeClickTimerDelay);
CurvedUIInputModule.Instance.GazeTimedClickProgressImage = (UnityEngine.UI.Image)EditorGUILayout.ObjectField("Progress Image To FIll", CurvedUIInputModule.Instance.GazeTimedClickProgressImage, typeof(UnityEngine.UI.Image), true);
}
#endif
break;
}// end of GAZE
case CurvedUIInputModule.CUIControlMethod.WORLD_MOUSE:
{
#if CURVEDUI_GOOGLEVR
EditorGUILayout.HelpBox("Enabling this control method will disable GoogleVR support.", MessageType.Warning);
DrawCustomDefineSwitcher("");
#else
GUILayout.Label("Mouse controller that is independent of the camera view. Use WorldSpaceMouseOnCanvas function to get its position.", EditorStyles.helpBox);
CurvedUIInputModule.Instance.WorldSpaceMouseSensitivity = EditorGUILayout.FloatField("Mouse Sensitivity", CurvedUIInputModule.Instance.WorldSpaceMouseSensitivity);
#endif
break;
}// end of WORLD_MOUSE
case CurvedUIInputModule.CUIControlMethod.CUSTOM_RAY:
{
#if CURVEDUI_GOOGLEVR
EditorGUILayout.HelpBox("Enabling this control method will disable GoogleVR support.", MessageType.Warning);
DrawCustomDefineSwitcher("");
#else
GUILayout.Label("Set a ray used to interact with canvas using CustomControllerRay function. Use CustomControllerButtonState bool to set button pressed state. Find both in CurvedUIInputModule class", EditorStyles.helpBox);
GUILayout.BeginHorizontal();
//GUILayout.Space(20);
GUILayout.FlexibleSpace();
if (GUILayout.Button("View code snippet")) Help.BrowseURL("https://docs.google.com/document/d/10hNcvOMissNbGgjyFyV1MS7HwkXXE6270A6Ul8h8pnQ/edit#heading=h.b164qm67xp15");
GUILayout.EndHorizontal();
#endif
break;
}// end of CUSTOM_RAY
case CurvedUIInputModule.CUIControlMethod.STEAMVR_LEGACY:
{
#if CURVEDUI_STEAMVR_LEGACY
// vive enabled, we can show settings
GUILayout.Label("Use with SteamVR plugin 1.2 or below. Trigger acts a button", EditorStyles.helpBox);
CurvedUIInputModule.Instance.UsedHand = (CurvedUIInputModule.Hand)EditorGUILayout.EnumPopup("Used Controller", CurvedUIInputModule.Instance.UsedHand);
#else
GUILayout.Label("For SteamVR plugin 1.2 or below. Make sure you imported that SDK before enabling.", EditorStyles.helpBox);
DrawCustomDefineSwitcher(ControlMethodDefineDict[CurvedUIInputModule.CUIControlMethod.STEAMVR_LEGACY]);
#endif
break;
}// end of STEAMVR_LEGACY
case CurvedUIInputModule.CUIControlMethod.STEAMVR_2:
{
#if CURVEDUI_STEAMVR_2
GUILayout.Label("Use SteamVR controllers to interact with canvas. Requires SteamVR Plugin 2.0 or later.", EditorStyles.helpBox);
if(steamVRActions != null)
{
CurvedUIInputModule.Instance.UsedHand = (CurvedUIInputModule.Hand)EditorGUILayout.EnumPopup("Hand", CurvedUIInputModule.Instance.UsedHand);
//Find currently selected action in CurvedUIInputModule
int curSelected = steamVRActionsPaths.Length - 1;
for (int i = 0; i < steamVRActions.Length; i++)
{
//no action selected? select one that most likely deals with UI
if(CurvedUIInputModule.Instance.SteamVRClickAction == null && steamVRActions[i].GetShortName().Contains("UI"))
CurvedUIInputModule.Instance.SteamVRClickAction = steamVRActions[i];
//otherwise show currently selected
if (steamVRActions[i] == CurvedUIInputModule.Instance.SteamVRClickAction) //otherwise show selected
curSelected = i;
}
//Show popup
int newSelected = EditorGUILayout.Popup("Click With", curSelected, steamVRActionsPaths, EditorStyles.popup);
//assign selected SteamVR Action to CurvedUIInputMOdule
if (curSelected != newSelected)
{
//none has been selected
if (newSelected >= steamVRActions.Length)
CurvedUIInputModule.Instance.SteamVRClickAction = null;
else
CurvedUIInputModule.Instance.SteamVRClickAction = steamVRActions[newSelected];
}
}
else
{
//draw error
EditorGUILayout.HelpBox("No SteamVR Actions set up. Configure your SteamVR plugin first in Window > Steam VR Input", MessageType.Error);
}
#else
GUILayout.Label("For SteamVR plugin 2.0 or above. Make sure you imported that SDK before enabling.", EditorStyles.helpBox);
DrawCustomDefineSwitcher(ControlMethodDefineDict[CurvedUIInputModule.CUIControlMethod.STEAMVR_2]);
#endif
break;
}// end of STEAMVR_2
case CurvedUIInputModule.CUIControlMethod.OCULUSVR:
{
#if CURVEDUI_OCULUSVR
// oculus enabled, we can show settings
GUILayout.Label("Use Rift, Quest, Go, or GearVR controller to interact with your canvas.", EditorStyles.helpBox);
//hand property
CurvedUIInputModule.Instance.UsedHand = (CurvedUIInputModule.Hand)EditorGUILayout.EnumPopup("Hand", CurvedUIInputModule.Instance.UsedHand);
//button property
CurvedUIInputModule.Instance.OculusTouchInteractionButton = (OVRInput.Button)EditorGUILayout.EnumPopup("Interaction Button", CurvedUIInputModule.Instance.OculusTouchInteractionButton);
#else
GUILayout.Label("Make sure you imported the SDK before enabling.", EditorStyles.helpBox);
DrawCustomDefineSwitcher(ControlMethodDefineDict[CurvedUIInputModule.CUIControlMethod.OCULUSVR]);
#endif
break;
}// end of OCULUSVR
case CurvedUIInputModule.CUIControlMethod.UNITY_XR:
{
#if CURVEDUI_UNITY_XR
// oculus enabled, we can show settings
GUILayout.Label("Use Unity XR Toolkit to interact with the canvas. You can choose UI button on the XRController itself.", EditorStyles.helpBox);
//hand property
CurvedUIInputModule.Instance.UsedHand = (CurvedUIInputModule.Hand)EditorGUILayout.EnumPopup("Hand", CurvedUIInputModule.Instance.UsedHand);
//assign controllers
CurvedUIInputModule.Instance.RightXRController = (UnityEngine.XR.Interaction.Toolkit.XRController)EditorGUILayout.ObjectField("Right Controller",
CurvedUIInputModule.Instance.RightXRController, typeof(UnityEngine.XR.Interaction.Toolkit.XRController), true);
CurvedUIInputModule.Instance.LeftXRController = (UnityEngine.XR.Interaction.Toolkit.XRController)EditorGUILayout.ObjectField("Left Controller",
CurvedUIInputModule.Instance.LeftXRController, typeof(UnityEngine.XR.Interaction.Toolkit.XRController), true);
#else
GUILayout.Label("Make sure you imported Unity XR Toolkit before enabling.", EditorStyles.helpBox);
DrawCustomDefineSwitcher(ControlMethodDefineDict[CurvedUIInputModule.CUIControlMethod.UNITY_XR]);
#endif
break;
}// end of UNITY_XR
case CurvedUIInputModule.CUIControlMethod.GOOGLEVR:
{
#if CURVEDUI_GOOGLEVR
GUILayout.Label("Use GoogleVR Reticle to interact with canvas. Requires GoogleVR SDK 1.200.1 or later. Make sure you imported the SDK before enabling.", EditorStyles.helpBox);
#else
GUILayout.Label("Make sure you imported the GoogleVR SDK before enabling.", EditorStyles.helpBox);
DrawCustomDefineSwitcher(ControlMethodDefineDict[CurvedUIInputModule.CUIControlMethod.GOOGLEVR]);
#endif
break;
}// end of GOOGLEVR
}//end of CUIControlMethod Switch
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(20);
}
/// <summary>
/// Draws the define switcher for different control methods.
/// Because different control methods use different API's that may not always be available,
/// CurvedUI needs to be recompile with different custom defines to fix this. This method
/// manages the defines.
/// </summary>
/// <param name="defineToSet">Switcho.</param>
void DrawCustomDefineSwitcher(string defineToSet)
{
GUILayout.BeginVertical();
GUILayout.Label("Press the [Enable] button to recompile scripts for this control method. Afterwards, you'll see more settings here.", EditorStyles.helpBox);
GUILayout.BeginHorizontal();
GUILayout.Space(50);
if (GUILayout.Button(loadingCustomDefine ? "Please wait..." : "Enable."))
{
loadingCustomDefine = true;
//retrieve current defines
string str = "";
str += PlayerSettings.GetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
//remove unused curvedui defines - dictionary based.
string define = "";
foreach (var key in ControlMethodDefineDict.Keys)
{
define = ControlMethodDefineDict[key];
if (str.Contains(define))
{
if (str.Contains((";" + define)))
str = str.Replace((";" + define), "");
else
str = str.Replace(define, "");
}
}
//add this one, if not present.
if (defineToSet != "" && !str.Contains(defineToSet))
str += ";" + defineToSet;
//Submit defines. This will cause recompilation
PlayerSettings.SetScriptingDefineSymbolsForGroup(EditorUserBuildSettings.selectedBuildTargetGroup, str);
}
GUILayout.EndHorizontal();
GUILayout.EndVertical();
}
void Draw180DegreeWarning()
{
GUILayout.BeginHorizontal();
GUILayout.Space(150);
EditorGUILayout.HelpBox("Cavas with angle bigger than 180 degrees will not be interactable. \n" +
"This is caused by Unity Event System requirements. Use two canvases facing each other for fully interactive 360 degree UI.", MessageType.Warning);
GUILayout.EndHorizontal();
GUILayout.Space(10);
}
#endregion
#region HELPER FUNCTIONS
static List<string> layers;
static string[] layerNames;
public static LayerMask LayerMaskField (string label, LayerMask selected)
{
if (layers == null) {
layers = new List<string>();
layerNames = new string[4];
} else {
layers.Clear ();
}
int emptyLayers = 0;
for (int i=0;i<32;i++) {
string layerName = LayerMask.LayerToName (i);
if (layerName != "") {
for (;emptyLayers>0;emptyLayers--) layers.Add ("Layer "+(i-emptyLayers));
layers.Add (layerName);
} else {
emptyLayers++;
}
}
if (layerNames.Length != layers.Count) {
layerNames = new string[layers.Count];
}
for (int i=0;i<layerNames.Length;i++) layerNames[i] = layers[i];
selected.value = EditorGUILayout.MaskField (label,selected.value,layerNames);
return selected;
}
bool IsInLayerMask(int layer, LayerMask layermask)
{
return layermask == (layermask | (1 << layer));
}
Dictionary<CurvedUIInputModule.CUIControlMethod, string> ControlMethodDefineDict {
get
{
if (m_controlMethodDefineDict == null)
{
m_controlMethodDefineDict = new Dictionary<CurvedUIInputModule.CUIControlMethod, string>();
m_controlMethodDefineDict.Add(CurvedUIInputModule.CUIControlMethod.GOOGLEVR, "CURVEDUI_GOOGLEVR");
m_controlMethodDefineDict.Add(CurvedUIInputModule.CUIControlMethod.STEAMVR_LEGACY, "CURVEDUI_STEAMVR_LEGACY");
m_controlMethodDefineDict.Add(CurvedUIInputModule.CUIControlMethod.STEAMVR_2, "CURVEDUI_STEAMVR_2");
m_controlMethodDefineDict.Add(CurvedUIInputModule.CUIControlMethod.OCULUSVR, "CURVEDUI_OCULUSVR");
m_controlMethodDefineDict.Add(CurvedUIInputModule.CUIControlMethod.UNITY_XR, "CURVEDUI_UNITY_XR");
}
return m_controlMethodDefineDict;
}
}
void SwapEventSystem()
{
if (Application.isPlaying)
{
Debug.LogError("Cant do this in Play mode!");
return;
}
EventSystem system = FindObjectOfType<EventSystem>();
if (!(system is CurvedUIEventSystem))
{
system.AddComponentIfMissing<CurvedUIEventSystem>();
DestroyImmediate(system);
}
CUIeventSystemPresent = true;
}
/// <summary>
///Travel the hierarchy and add CurvedUIVertexEffect to every gameobject that can be bent.
/// </summary>
private void AddCurvedUIComponents()
{
if (target == null) return;
(target as CurvedUISettings).AddEffectToChildren();
}
/// <summary>
/// Removes all CurvedUI components from this canvas.
/// </summary>
private void RemoveCurvedUIComponents()
{
if (target == null) return;
//destroy TMP objects
List<CurvedUITMP> tmps = new List<CurvedUITMP>();
tmps.AddRange((target as CurvedUISettings).GetComponentsInChildren<CurvedUITMP>(true));
for (int i = 0; i < tmps.Count; i++)
{
DestroyImmediate(tmps[i]);
}
List<CurvedUITMPSubmesh> submeshes = new List<CurvedUITMPSubmesh>();
submeshes.AddRange((target as CurvedUISettings).GetComponentsInChildren<CurvedUITMPSubmesh>(true));
for (int i = 0; i < submeshes.Count; i++)
{
DestroyImmediate(submeshes[i]);
}
//destroy curving componenets
List<CurvedUIVertexEffect> comps = new List<CurvedUIVertexEffect>();
comps.AddRange((target as CurvedUISettings).GetComponentsInChildren<CurvedUIVertexEffect>(true));
for (int i = 0; i < comps.Count; i++)
{
if (comps[i].GetComponent<UnityEngine.UI.Graphic>() != null) comps[i].GetComponent<UnityEngine.UI.Graphic>().SetAllDirty();
DestroyImmediate(comps[i]);
}
//destroy raycasters
List<CurvedUIRaycaster> raycasters = new List<CurvedUIRaycaster>();
raycasters.AddRange((target as CurvedUISettings).GetComponents<CurvedUIRaycaster>());
for (int i = 0; i < raycasters.Count; i++)
{
DestroyImmediate(raycasters[i]);
}
DestroyImmediate(target);
}
#endregion
#region STRINGS
private static string WarningLayerNotIncluded = "This Canvas' layer " +
"is not included in the RaycastLayerMask. User will not be able to interact with it. " +
"Add its layer to RaycastLayerMask below to fix it, or set the " +
"Interactable property to False to dismiss this message.";
#endregion
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 457860ef911848b478f762007e52c91e
timeCreated: 1453646046
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,9 @@
fileFormatVersion: 2
guid: 598d61e3836aeaf4fa5ce5add9724393
folderAsset: yes
timeCreated: 1453646046
licenseType: Store
DefaultImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,343 @@
using UnityEngine;
using UnityEngine.UI;
using System.Collections.Generic;
#if CURVEDUI_TMP || TMP_PRESENT
using TMPro;
#endif
//To use this class you have to add CURVEDUI_TMP to your define symbols. You can do it in project settings.
//To learn how to do it visit http://docs.unity3d.com/Manual/PlatformDependentCompilation.html and search for "Platform Custom Defines"
namespace CurvedUI
{
[ExecuteInEditMode]
public class CurvedUITMP : MonoBehaviour
{
#if CURVEDUI_TMP || TMP_PRESENT
//internal
private CurvedUIVertexEffect crvdVE;
private TextMeshProUGUI tmpText;
private CurvedUISettings mySettings;
private List<UIVertex> m_UIVerts = new List<UIVertex>();
private UIVertex m_tempVertex;
private CurvedUITMPSubmesh m_tempSubMsh;
private Vector2 savedSize;
private Vector3 savedUp;
private Vector3 savedPos;
private Vector3 savedLocalScale;
private Vector3 savedGlobalScale;
private List<CurvedUITMPSubmesh> subMeshes = new List<CurvedUITMPSubmesh>();
//flags
public bool Dirty = false; // set this to true to force mesh update.
private bool curvingRequired = false;
private bool tesselationRequired = false;
private bool quitting = false;
//mesh data
private Vector3[] vertices;
//These are commented here and throught the script,
//cause CurvedUI operates only on vertex positions,
//but left here for future-proofing against some TMP features.
//private Color32[] colors32;
//private Vector2[] uv;
//private Vector2[] uv2;
//private Vector2[] uv3;
//private Vector2[] uv4;
//private Vector3[] normals;
//private Vector4[] tangents;
//private int[] indices;
#region LIFECYCLE
void Start()
{
if (mySettings == null)
mySettings = GetComponentInParent<CurvedUISettings>();
}
void OnEnable()
{
FindTMP();
if (tmpText)
{
tmpText.RegisterDirtyMaterialCallback(TesselationRequiredCallback);
TMPro_EventManager.TEXT_CHANGED_EVENT.Add(TMPTextChangedCallback);
tmpText.SetText(tmpText.text);
}
#if UNITY_EDITOR
if (!Application.isPlaying)
UnityEditor.EditorApplication.update += LateUpdate;
#endif
}
void OnDisable()
{
#if UNITY_EDITOR
if (!Application.isPlaying)
UnityEditor.EditorApplication.update -= LateUpdate;
#endif
if (tmpText)
{
tmpText.UnregisterDirtyMaterialCallback(TesselationRequiredCallback);
TMPro_EventManager.TEXT_CHANGED_EVENT.Remove(TMPTextChangedCallback);
}
}
void OnDestroy()
{
quitting = true;
}
void LateUpdate()
{
//if we're missing stuff, find it
if (!tmpText) FindTMP();
if (mySettings == null) return;
//Edit Mesh on TextMeshPro component
if (tmpText && !quitting)
{
if (ShouldTesselate())
tesselationRequired = true;
if (Dirty || tesselationRequired || (curvingRequired && !Application.isPlaying))
{
if (mySettings == null)
{
enabled = false;
return;
}
//Get the flat vertices from TMP object.
//store a copy of flat UIVertices for later so we dont have to retrieve the Mesh every framee.
tmpText.renderMode = TMPro.TextRenderFlags.Render;
tmpText.ForceMeshUpdate(true);
CreateUIVertexList(tmpText.mesh);
//Tesselate and Curve the flat UIVertices stored in Vertex Helper
crvdVE.ModifyTMPMesh(ref m_UIVerts);
//fill curved vertices back to TMP mesh
FillMeshWithUIVertexList(tmpText.mesh, m_UIVerts);
//cleanup
tmpText.renderMode = TMPro.TextRenderFlags.DontRender;
//save current data
savedLocalScale = mySettings.transform.localScale;
savedGlobalScale = mySettings.transform.lossyScale;
savedSize = (transform as RectTransform).rect.size;
savedUp = mySettings.transform.worldToLocalMatrix.MultiplyVector(transform.up);
savedPos = mySettings.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position);
//reset flags
tesselationRequired = false;
curvingRequired = false;
Dirty = false;
//prompt submeshes to update
FindSubmeshes();
foreach (CurvedUITMPSubmesh mesh in subMeshes)
mesh.UpdateSubmesh(true, false);
}
//Upload mesh to TMP Object's renderer
if(tmpText.text.Length > 0)
tmpText.canvasRenderer.SetMesh(tmpText.mesh);
else
tmpText.canvasRenderer.Clear();
}
}
#endregion
#region UIVERTEX MANAGEMENT
void CreateUIVertexList(Mesh mesh)
{
//trim if too long list
if (mesh.vertexCount < m_UIVerts.Count)
m_UIVerts.RemoveRange(mesh.vertexCount, m_UIVerts.Count - mesh.vertexCount);
//extract mesh data
vertices = mesh.vertices;
//colors32 = mesh.colors32;
//uv = mesh.uv;
//uv2 = mesh.uv2;
//uv3 = mesh.uv3;
//uv4 = mesh.uv4;
//normals = mesh.normals;
//tangents = mesh.tangents;
for (int i = 0; i < mesh.vertexCount; i++)
{
//add if list too short
if (m_UIVerts.Count <= i)
{
m_tempVertex = new UIVertex();
GetUIVertexFromMesh(ref m_tempVertex, i);
m_UIVerts.Add(m_tempVertex);
}
else //modify
{
m_tempVertex = m_UIVerts[i];
GetUIVertexFromMesh(ref m_tempVertex, i);
m_UIVerts[i] = m_tempVertex;
}
}
//indices = mesh.GetIndices(0);
}
void GetUIVertexFromMesh(ref UIVertex vert, int i)
{
vert.position = vertices[i];
//vert.color = colors32[i];
//vert.uv0 = uv[i];
//vert.uv1 = uv2.Length > i ? uv2[i] : Vector2.zero;
//vert.uv2 = uv3.Length > i ? uv3[i] : Vector2.zero;
//vert.uv3 = uv4.Length > i ? uv4[i] : Vector2.zero;
//vert.normal = normals[i];
//vert.tangent = tangents[i];
}
void FillMeshWithUIVertexList(Mesh mesh, List<UIVertex> list)
{
if (list.Count >= 65536)
{
Debug.LogError("CURVEDUI: Unity UI Mesh can not have more than 65536 vertices. Remove some UI elements or lower quality.");
return;
}
for (int i = 0; i < list.Count; i++)
{
vertices[i] = list[i].position;
//colors32[i] = list[i].color;
//uv[i] = list[i].uv0;
//if (uv2.Length < i) uv2[i] = list[i].uv1;
////if (uv3.Length < i) uv3[i] = list[i].uv2;
////if (uv4.Length < i) uv4[i] = list[i].uv3;
//normals[i] = list[i].normal;
//tangents[i] = list[i].tangent;
}
//Fill mesh with data
mesh.vertices = vertices;
//mesh.colors32 = colors32;
//mesh.uv = uv;
//mesh.uv2 = uv2;
////mesh.uv3 = uv3;
////mesh.uv4 = uv4;
//mesh.normals = normals;
//mesh.tangents = tangents;
//mesh.SetTriangles(indices, 0);
mesh.RecalculateBounds();
}
#endregion
#region PRIVATE
void FindTMP()
{
if (this.GetComponent<TextMeshProUGUI>() != null)
{
tmpText = this.gameObject.GetComponent<TextMeshProUGUI>();
crvdVE = this.gameObject.GetComponent<CurvedUIVertexEffect>();
mySettings = GetComponentInParent<CurvedUISettings>();
transform.hasChanged = false;
FindSubmeshes();
}
}
void FindSubmeshes()
{
foreach (TMP_SubMeshUI sub in GetComponentsInChildren<TMP_SubMeshUI>())
{
m_tempSubMsh = sub.gameObject.AddComponentIfMissing<CurvedUITMPSubmesh>();
if (!subMeshes.Contains(m_tempSubMsh))
subMeshes.Add(m_tempSubMsh);
}
}
bool ShouldTesselate()
{
if (savedSize != (transform as RectTransform).rect.size)
{
//Debug.Log("size changed");
return true;
}
else if (savedLocalScale != mySettings.transform.localScale)
{
//Debug.Log("local scale changed");
return true;
}
else if (savedGlobalScale != mySettings.transform.lossyScale)
{
//Debug.Log("global scale changed");
return true;
}
else if (!savedUp.AlmostEqual(mySettings.transform.worldToLocalMatrix.MultiplyVector(transform.up)))
{
// Debug.Log("up changed");
return true;
}
Vector3 testedPos = mySettings.transform.worldToLocalMatrix.MultiplyPoint3x4(transform.position);
if (!savedPos.AlmostEqual(testedPos))
{
//we dont have to curve vertices if we only moved the object vertically in a cylinder.
if (mySettings.Shape != CurvedUISettings.CurvedUIShape.CYLINDER || Mathf.Pow(testedPos.x - savedPos.x, 2) > 0.00001 || Mathf.Pow(testedPos.z - savedPos.z, 2) > 0.00001)
{
//Debug.Log("pos changed");
return true;
}
}
return false;
}
#endregion
#region EVENTS AND CALLBACKS
void TMPTextChangedCallback(object obj)
{
if (obj != (object)tmpText) return;
tesselationRequired = true;
//Debug.Log("tmp prop changed on "+this.gameObject.name, this.gameObject);
}
void TesselationRequiredCallback()
{
tesselationRequired = true;
curvingRequired = true;
}
#endregion
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 004b8ec0c25535c409b1f6115963d476
timeCreated: 1492859310
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 100
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,224 @@
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
using UnityEngine.EventSystems;
#if CURVEDUI_TMP
using TMPro;
#endif
namespace CurvedUI
{
#if !UNITY_5_1 && !UNITY_5_2 && CURVEDUI_TMP
/// <summary>
/// Creates a recttransform caret with image component that can be curved with curvedUI. Hides inputfield's original caret.
/// </summary>
[ExecuteInEditMode]
public class CurvedUITMPInputFieldCaret : MonoBehaviour, ISelectHandler, IDeselectHandler
{
//references
TMP_InputField myField;
RectTransform myCaret;
Color origCaretColor;
Color origSelectionColor;
//variables
bool selected = false;
bool selectingText = false;
void Awake()
{
myField = this.GetComponent<TMP_InputField>();
if (myField)
CheckAndConvertMask();
}
void Update()
{
//only update the caret's position when the field is selected.
if (selected)
UpdateCaret();
}
/// <summary>
/// On select, set the caret active and start blinker coroutine.
/// </summary>
/// <param name="eventData"></param>
public void OnSelect(BaseEventData eventData)
{
if (myCaret == null)
CreateCaret();
selected = true;
myCaret.gameObject.SetActive(true);
StartCoroutine(CaretBlinker());
}
/// <summary>
/// Hide the caret on deselect.
/// </summary>
/// <param name="eventData"></param>
public void OnDeselect(BaseEventData eventData)
{
selected = false;
myCaret.gameObject.SetActive(false);
}
/// <summary>
/// Simple blinker. Blinks the caret if inputfield is selected and user is not selecting text.
/// </summary>
/// <returns></returns>
IEnumerator CaretBlinker()
{
while (selected)
{
myCaret.gameObject.SetActive(selectingText ? true : !myCaret.gameObject.activeSelf);
yield return new WaitForSeconds(0.5f / (float)myField.caretBlinkRate);
}
}
void CreateCaret()
{
//lets create a curvedui caret and copy the settings from our input field
GameObject go = new GameObject("CurvedUI_TMPCaret");
go.AddComponent<RectTransform>();
go.AddComponent<Image>();
go.AddComponent<CurvedUIVertexEffect>();
go.transform.SetParent(transform.GetChild(0).GetChild(0));//Nest the cursor down with the scrolling child so it properly moves with text.
go.transform.localScale = Vector3.one;
(go.transform as RectTransform).anchoredPosition3D = Vector3.zero;
//(go.transform as RectTransform).pivot = new Vector2(0, 0.5f);
(go.transform as RectTransform).pivot = new Vector2(0, 1.0f);
//Copy caret color into new image.
go.GetComponent<Image>().color = myField.caretColor;
myCaret = go.transform as RectTransform;
go.transform.SetAsFirstSibling();
//save original color and hide the original caret
myField.customCaretColor = true;
origCaretColor = myField.caretColor;
myField.caretColor = new Color(0f, 0f, 0f, 0f);
origSelectionColor = myField.selectionColor;
myField.selectionColor = new Color(0f, 0f, 0f, 0f);
go.gameObject.SetActive(false);
}
void UpdateCaret()
{
if (myCaret == null)
CreateCaret();
//Debug.Log("caret:" + myField.caretPosition + " / focus:"+ myField.selectionFocusPosition + " / anchor:" + myField.selectionAnchorPosition + " / charc:" + myField.textComponent.cachedTextGenerator.characterCount + " / charvis:" + myField.textComponent.cachedTextGenerator.characterCountVisible);
Vector2 newCaretPos = GetLocalPositionInText(myField.caretPosition);
//RectTransform originalCaret = (RectTransform)myField.transform.FindChild(myField.name + " Input Caret");
if (myField.selectionFocusPosition != myField.selectionAnchorPosition) // user is selecting text is those two are not equal.
{
selectingText = true;
Vector2 selectionSize = new Vector2(
GetLocalPositionInText(myField.selectionAnchorPosition).x - GetLocalPositionInText(myField.selectionFocusPosition).x,
GetLocalPositionInText(myField.selectionAnchorPosition).y - GetLocalPositionInText(myField.selectionFocusPosition).y
);
newCaretPos = selectionSize.x < 0 ? GetLocalPositionInText(myField.selectionAnchorPosition) : GetLocalPositionInText(myField.selectionFocusPosition);
selectionSize = new Vector2(Mathf.Abs(selectionSize.x), Mathf.Abs(selectionSize.y) + myField.textComponent.fontSize);
myCaret.sizeDelta = new Vector2(selectionSize.x, selectionSize.y);
myCaret.anchoredPosition = newCaretPos;
myCaret.GetComponent<Image>().color = origSelectionColor;
}
else { // user is not selecting text, just update the caret position.
selectingText = false;
//myCaret.sizeDelta = new Vector2(myField.caretWidth, originalCaret == null ? 10 : originalCaret.rect.height);
myCaret.sizeDelta = new Vector2(myField.caretWidth, myField.textComponent.fontSize);
myCaret.anchoredPosition = newCaretPos;
myCaret.GetComponent<Image>().color = origCaretColor;
}
}
/// <summary>
/// Returns the position in TMP_Inputfield's rectransform local space, based on character position in text. Pretty neat actually.
/// </summary>
/// <param name="charNo"></param>
/// <returns></returns>
Vector2 GetLocalPositionInText(int charNo)
{
if (myField.isFocused)
{
TMP_TextInfo txtInfo = myField.textComponent.textInfo;
if (charNo > txtInfo.characterCount - 1) //do not go over the text length.
charNo = txtInfo.characterCount - 1;
TMP_CharacterInfo charInfo = txtInfo.characterInfo[charNo];
return new Vector2(charInfo.topLeft.x, charInfo.ascender);
}
else return Vector2.zero; // field not focused, return 0,0
}
#region MASK CONVERTING
/// <summary>
/// Converts InputField's RectMask2D to a Mask + Image component combination that works better with CurvedUI
/// </summary>
void CheckAndConvertMask()
{
foreach(Transform trans in this.transform)
{
if(trans.GetComponent<RectMask2D>()!= null)
{
DestroyImmediate (trans.GetComponent<RectMask2D>());
trans.AddComponentIfMissing<Image>();
trans.AddComponentIfMissing<Mask>();
}
}
}
#endregion
#region SETTERS AND GETTERS
public Color CaretColor {
get { return origCaretColor; }
set { origCaretColor = value; }
}
public Color SelectionColor {
get { return origSelectionColor; }
set { origSelectionColor = value; }
}
public float CaretBlinkRate {
get { return myField.caretBlinkRate; }
set { myField.caretBlinkRate = value; }
}
#endregion
#else
public class CurvedUITMPInputFieldCaret : MonoBehaviour
{
//Unity before 5.3 does not contain methods necessary to curve the input field caret without changing original script.
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: b38bdd8f01b04cb4ba7f116b2f8ec4ba
timeCreated: 1526051515
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,78 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
#if CURVEDUI_TMP || TMP_PRESENT
using TMPro;
#endif
namespace CurvedUI
{
[ExecuteInEditMode]
public class CurvedUITMPSubmesh : MonoBehaviour
{
#if CURVEDUI_TMP || TMP_PRESENT
//saved references
private VertexHelper vh;
private Mesh straightMesh;
private Mesh curvedMesh;
private CurvedUIVertexEffect crvdVE;
private TMP_SubMeshUI TMPsub;
private TextMeshProUGUI TMPtext;
public void UpdateSubmesh(bool tesselate, bool curve)
{
//find required components
if (TMPsub == null) TMPsub = gameObject.GetComponent<TMP_SubMeshUI>();
if (TMPsub == null) return;
if (TMPtext == null)TMPtext = GetComponentInParent<TextMeshProUGUI>();
if (crvdVE == null)crvdVE = gameObject.AddComponentIfMissing<CurvedUIVertexEffect>();
//perform tesselatio and curving
if (tesselate || straightMesh == null || vh == null || (!Application.isPlaying))
{
vh = new VertexHelper(TMPsub.mesh);
//save straight mesh - it will be curved then every time the object moves on the canvas.
straightMesh = new Mesh();
vh.FillMesh(straightMesh);
curve = true;
}
if (curve)
{
//Debug.Log("Submesh: Curve", this.gameObject);
vh = new VertexHelper(straightMesh);
crvdVE.ModifyMesh(vh);
curvedMesh = new Mesh();
vh.FillMesh(curvedMesh);
crvdVE.CurvingRequired = true;
}
//upload mesh to TMP object's renderer
TMPsub.canvasRenderer.SetMesh(curvedMesh);
//cleanup for not needed submeshes.
if (TMPtext != null && TMPtext.textInfo.materialCount < 2)
{
//Each submesh uses 1 additional material.
//If materialCount is 1, this means Submesh is not needed. Bounce it to toggle cleanup.
TMPsub.enabled = false;
TMPsub.enabled = true;
}
}
#endif
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 610658cf59cbbf9458ce86b28870ead0
timeCreated: 1486662465
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,24 @@

using System;
using System.Diagnostics;
//Used in this project:
//[assembly: CurvedUI.OptionalDependency("TMPro.TextMeshProUGUI", "CURVEDUI_TMP")]
//[assembly: CurvedUI.OptionalDependency("Valve.VR.InteractionSystem.Player", "CURVEDUI_STEAMVR_INT")]
namespace CurvedUI
{
[Conditional("UNITY_CCU")]
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
public class OptionalDependencyAttribute : Attribute
{
public string dependentClass;
public string define;
public OptionalDependencyAttribute(string dependentClass, string define)
{
this.dependentClass = dependentClass;
this.define = define;
}
}
}

View File

@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 4d31a1c3ba39b224d9a4979116a9aa59
timeCreated: 1558205458
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -0,0 +1,57 @@
fileFormatVersion: 2
guid: 2c672dc55849c1442b3ab9ad1e795855
timeCreated: 1462735340
licenseType: Store
TextureImporter:
fileIDToRecycleName: {}
serializedVersion: 2
mipmaps:
mipMapMode: 0
enableMipMap: 1
linearTexture: 0
correctGamma: 0
fadeOut: 0
borderMipMap: 0
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
grayScaleToAlpha: 0
generateCubemap: 0
cubemapConvolution: 0
cubemapConvolutionSteps: 7
cubemapConvolutionExponent: 1.5
seamlessCubemap: 0
textureFormat: -1
maxTextureSize: 2048
textureSettings:
filterMode: -1
aniso: -1
mipBias: -1
wrapMode: -1
nPOTScale: 1
lightmap: 0
rGBM: 0
compressionQuality: 50
allowsAlphaSplitting: 0
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spritePixelsToUnits: 100
alphaIsTransparency: 0
textureType: -1
buildTargetSettings: []
spriteSheet:
sprites: []
outline: []
spritePackingTag:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,7 +8,7 @@ LightingSettings:
m_PrefabAsset: {fileID: 0}
m_Name: SceneSettings
serializedVersion: 4
m_GIWorkflowMode: 0
m_GIWorkflowMode: 1
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
m_RealtimeEnvironmentLighting: 1

31
Assets/EndGameModule.cs Normal file
View File

@ -0,0 +1,31 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class EndGameModule : MonoBehaviour
{
[TextArea]
public string VicoryText;
[TextArea]
public string LoseText;
[SerializeField]
private UITextShow _textShow;
[SerializeField]
private UIPanel _uiPanel;
public void ShowEndMenu(bool success)
{
_uiPanel.ShowPanel();
if (success)
{
_textShow.SetText(VicoryText);
}
else
{
_textShow.SetText(LoseText);
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b3a0af54ed388d24190a7fadd39fa5b7
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -2,29 +2,11 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnergyText : MonoBehaviour
public class EnergyText : UITextDisplayBase
{
private EnergyController _energyController;
private TMPro.TextMeshProUGUI _text;
private void Awake()
protected override void Awake()
{
_energyController = FindObjectOfType<EnergyController>();
_text = GetComponent<TMPro.TextMeshProUGUI>();
}
private void OnEnable()
{
_energyController.OnEnergyChange += UpdateText;
}
private void OnDisable()
{
_energyController.OnEnergyChange -= UpdateText;
}
private void UpdateText(float energy)
{
_text.SetText(energy.ToString());
base.Awake();
_textChanger = FindObjectOfType<EnergyController>();
}
}

10
Assets/ITextChangable.cs Normal file
View File

@ -0,0 +1,10 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public interface ITextChangable
{
UnityEvent<object> OnTextChange { get; }
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8ed4f6f3d35c5774a8b9906507ed919c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 521 KiB

View File

@ -0,0 +1,135 @@
fileFormatVersion: 2
guid: 10bfab33973b5a24eaa65b25e69fa880
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 12
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
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
vTOnly: 0
ignoreMasterTextureLimit: 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: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
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: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 0
cookieLightType: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Server
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: WebGL
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -8,15 +8,14 @@ public class MonumentController : MonoBehaviour
private float _energyToUnlock;
[SerializeField]
private MonumentInfo _info;
private PlayerSetup _playerSetup;
private EnergyController _energyController;
private float _currentEnergy;
private CockpitUIModule _cockpitUI;
private void Awake()
{
_playerSetup = FindObjectOfType<PlayerSetup>();
_cockpitUI = FindObjectOfType<CockpitUIModule>();
_energyController = FindObjectOfType<EnergyController>();
_currentEnergy = _energyToUnlock;
}
@ -33,6 +32,11 @@ public class MonumentController : MonoBehaviour
});
//TODO: ÐÀÇÁËÎÊÈÐÎÂÀÒÜ ÌÎÍÓÌÅÍÒ ÒÎËÜÊÎ ÅÑËÈ ÕÂÀÒÈËÎ ÝÍÅÐÃÈÈ
_playerSetup.UnlockMonument(_info, _currentEnergy);
PlayerSetup.Instance.UnlockMonument(_info);
}
public void ShowPreview()
{
_cockpitUI.ShowInfo(_info.Image, _info.Description);
}
}

View File

@ -5,11 +5,10 @@ using UnityEngine;
[CreateAssetMenu(fileName = "Monumet")]
public class MonumentInfo : ScriptableObject
{
public readonly string Name;
public readonly Sprite Image;
public string Name;
public Sprite Image;
[TextArea]
public readonly string Description;
[HideInInspector]
public string Description;
public GameObject MiniModel;
public float Score;
}

View File

@ -5,7 +5,7 @@ using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class MonumentResultController : MonoBehaviour, IPlayerInfoRequre
public class MonumentResultController : MonoBehaviour
{
private List<MonumentInfo> _monuments;
@ -14,28 +14,25 @@ public class MonumentResultController : MonoBehaviour, IPlayerInfoRequre
[SerializeField]
private Transform _placeHolder;
[SerializeField]
private Transform _miniPlaceholder;
[SerializeField]
private TMPro.TextMeshProUGUI _descriptionText;
[SerializeField]
private Image _icon;
[SerializeField]
private TMPro.TextMeshProUGUI _score;
[SerializeField]
private Image _icon;
private PlayerSetup _playerSetup;
private Dictionary<MonumentInfo,GameObject> _miniModels = new Dictionary<MonumentInfo, GameObject>();
private GameObject _lastMiniModel;
private void Start()
{
_monuments = new List<MonumentInfo>();
_monuments = Resources.LoadAll<MonumentInfo>("Monuments/").ToList();
InitPlayerInfo();
InitMonuments();
}
public void InitPlayerInfo()
{
_playerSetup = FindObjectOfType<PlayerSetup>();
}
private bool _showFirst = true;
private void InitMonuments()
@ -45,7 +42,11 @@ public class MonumentResultController : MonoBehaviour, IPlayerInfoRequre
var newUIMonument = Instantiate(_UIMonumentPrefab, _placeHolder);
newUIMonument.Init(x);
if (_playerSetup.TryFindMonument(x))
var newMiniModel = Instantiate(x.MiniModel, _miniPlaceholder);
newMiniModel.SetActive(false);
_miniModels.Add(x, newMiniModel);
if (PlayerSetup.Instance.TryFindMonument(x))
{
newUIMonument.Unlock();
@ -55,13 +56,22 @@ public class MonumentResultController : MonoBehaviour, IPlayerInfoRequre
newUIMonument.SelectMonument();
}
}
else
{
newUIMonument.Lock();
}
});
}
public void SelectMonument(MonumentInfo info)
{
if (_lastMiniModel)
_lastMiniModel.SetActive(false);
_miniModels[info].SetActive(true);
_lastMiniModel = _miniModels[info];
_icon.sprite = info.Image;
_score.SetText(info.Score.ToString());
_descriptionText.SetText(info.Description);
}
}

View File

@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class PlayerController : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: da326184b7fde4f49836dbd274df129c
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -231,6 +231,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: b64a96362efa9ba44802d57e2e074f27, type: 3}
m_Name:
m_EditorClassIdentifier:
_postfix:
--- !u!1 &9027889519720641281
GameObject:
m_ObjectHideFlags: 0
@ -264,6 +265,7 @@ Transform:
m_Children:
- {fileID: 9027889520435396036}
- {fileID: 9027889519819089750}
- {fileID: 5145598549098378746}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -730,3 +732,113 @@ MeshRenderer:
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!1001 &5458133831166232630
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 9027889519720641280}
m_Modifications:
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalScale.x
value: 88.40001
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalPosition.x
value: -577.1286
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalPosition.y
value: -183.81604
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalPosition.z
value: 932.67645
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalRotation.w
value: 0.6990287
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalRotation.x
value: -0.17240688
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalRotation.y
value: -0.6825062
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalRotation.z
value: -0.1257779
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 925482383945416141, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_Name
value: SplineTrigger
objectReference: {fileID: 0}
- target: {fileID: 925482383945416142, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: OnTriggerEvent.m_PersistentCalls.m_Calls.Array.size
value: 0
objectReference: {fileID: 0}
- target: {fileID: 925482383945416142, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: OnTriggerEvent.m_PersistentCalls.m_Calls.Array.data[0].m_Mode
value: 1
objectReference: {fileID: 0}
- target: {fileID: 925482383945416142, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: OnTriggerEvent.m_PersistentCalls.m_Calls.Array.data[0].m_Target
value:
objectReference: {fileID: 9027889519720641281}
- target: {fileID: 925482383945416142, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: OnTriggerEvent.m_PersistentCalls.m_Calls.Array.data[0].m_CallState
value: 2
objectReference: {fileID: 0}
- target: {fileID: 925482383945416143, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: _spline
value:
objectReference: {fileID: 0}
- target: {fileID: 925482383945416143, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
propertyPath: m_Enabled
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 12c9d9623955d4e48825c5b19ea0b159, type: 3}
--- !u!4 &5145598549098378746 stripped
Transform:
m_CorrespondingSourceObject: {fileID: 925482383945416140, guid: 12c9d9623955d4e48825c5b19ea0b159,
type: 3}
m_PrefabInstance: {fileID: 5458133831166232630}
m_PrefabAsset: {fileID: 0}

View File

@ -91,6 +91,8 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: aab187bed59cfe845b0ceb0c3ab0a2b0, type: 3}
m_Name:
m_EditorClassIdentifier:
_scoreAdd: 50
_energy: 1
--- !u!54 &3598344221402252609
Rigidbody:
m_ObjectHideFlags: 0

View File

@ -0,0 +1,131 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &29097867612519240
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 29097867612519243}
- component: {fileID: 29097867612519244}
- component: {fileID: 29097867612519245}
- component: {fileID: 29097867612519242}
m_Layer: 0
m_Name: Mesh
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &29097867612519243
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 29097867612519240}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0.557, z: 0}
m_LocalScale: {x: 0.64743173, y: 1.2073361, z: 0.64743173}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 7622773944286828885}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!33 &29097867612519244
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 29097867612519240}
m_Mesh: {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
--- !u!23 &29097867612519245
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 29097867612519240}
m_Enabled: 1
m_CastShadows: 1
m_ReceiveShadows: 1
m_DynamicOccludee: 1
m_StaticShadowCaster: 0
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RayTracingMode: 2
m_RayTraceProcedural: 0
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2100000, guid: 31321ba15b8f8eb4c954353edc038b1d, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_ReceiveGI: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 1
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0}
--- !u!65 &29097867612519242
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 29097867612519240}
m_Material: {fileID: 0}
m_IsTrigger: 0
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &7721131150223155987
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7622773944286828885}
m_Layer: 0
m_Name: MiniMonument_1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7622773944286828885
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7721131150223155987}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 29097867612519243}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 06c162bf7cb8e0340b5981d7ce3925c7
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,173 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &925482383945416141
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 925482383945416140}
- component: {fileID: 925482383945416143}
- component: {fileID: 925482383945416142}
- component: {fileID: 925482383945416137}
m_Layer: 0
m_Name: SplineTrigger
m_TagString: Untagged
m_Icon: {fileID: -5442936267250999957, guid: 0000000000000000d000000000000000, type: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &925482383945416140
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925482383945416141}
m_LocalRotation: {x: -0.0046972446, y: -0.06098742, z: 0.06951997, w: 0.9957035}
m_LocalPosition: {x: 47.5974, y: -2.4039319, z: -365.4837}
m_LocalScale: {x: 88.4, y: 81.941, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &925482383945416143
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925482383945416141}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0def5156137c6d14082064fa7b5d5247, type: 3}
m_Name:
m_EditorClassIdentifier:
updateMethod: 0
_spline: {fileID: 0}
_autoUpdate: 1
_rotationModifier:
blend: 1
useClippedPercent: 0
keys: []
_offsetModifier:
blend: 1
useClippedPercent: 0
keys: []
_colorModifier:
blend: 1
useClippedPercent: 0
keys: []
_sizeModifier:
blend: 1
useClippedPercent: 0
keys: []
_clipFromSample:
position: {x: 104.326294, y: -5.5460205, z: -1932.3633}
up: {x: 0, y: 1, z: 0}
forward: {x: -0.001450564, y: 0.002455365, z: 0.99999595}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0
_clipToSample:
position: {x: 18.377234, y: 416.88184, z: 507}
up: {x: 0.00000011950283, y: 1, z: 0.000000044703484}
forward: {x: 0.01662724, y: -0.008324823, z: 0.9998271}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 1
_loopSamples: 0
_clipFrom: 0
_clipTo: 1
animClipFrom: 0
animClipTo: 1
multithreaded: 0
buildOnAwake: 1
buildOnEnable: 0
applyDirectionRotation: 1
useTriggers: 0
triggerGroup: 0
_direction: 1
_dontLerpDirection: 0
_physicsMode: 0
_motion:
_hasOffset: 0
_hasRotationOffset: 0
_offset: {x: 0, y: 0}
_rotationOffset: {x: 0, y: 0, z: 0}
_baseScale: {x: 1, y: 1, z: 1}
_2dMode: 0
velocityHandleMode: 0
applyPositionX: 1
applyPositionY: 1
applyPositionZ: 1
applyPosition2D: 1
retainLocalPosition: 0
direction: 1
applyRotationX: 1
applyRotationY: 1
applyRotationZ: 1
applyRotation2D: 1
retainLocalRotation: 0
applyScaleX: 0
applyScaleY: 0
applyScaleZ: 0
targetUser: {fileID: 925482383945416143}
targetRigidbody: {fileID: 0}
targetRigidbody2D: {fileID: 0}
targetTransform: {fileID: 925482383945416140}
_result:
position: {x: 47.5974, y: -2.4039319, z: -365.4837}
up: {x: -0.13622025, y: 0.9901891, z: -0.031138089}
forward: {x: -0.12210388, y: 0.0008744399, z: 0.99251693}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.18799999356269836
_finalResult:
position: {x: 47.5974, y: -2.4039319, z: -365.4837}
up: {x: -0.13622025, y: 0.9901891, z: -0.031138089}
forward: {x: -0.12210388, y: 0.0008744399, z: 0.99251693}
color: {r: 1, g: 1, b: 1, a: 1}
size: 1
percent: 0.18799999356269836
_targetObject: {fileID: 0}
_followTarget: {fileID: 0}
_followTargetDistance: 0
_followLoop: 0
_followTargetDirection: -1
_position: 0.188
_mode: 0
--- !u!114 &925482383945416142
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925482383945416141}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: c77a6647f89e24a40930e0d4abd7d395, type: 3}
m_Name:
m_EditorClassIdentifier:
_layerMask:
serializedVersion: 2
m_Bits: 512
OnTriggerEvent:
m_PersistentCalls:
m_Calls: []
--- !u!65 &925482383945416137
BoxCollider:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 925482383945416141}
m_Material: {fileID: 0}
m_IsTrigger: 1
m_Enabled: 1
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 12c9d9623955d4e48825c5b19ea0b159
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 59bb54bf798778349a37c58fbf18880c
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 4a88f6f36bda305499bdcac5bcc22d90
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -7,21 +7,13 @@ using UnityEngine.UI;
public class PreviewModule : MonoBehaviour
{
[SerializeField]
private GameObject _previewPanel;
private UIPanel _previewPanel;
[SerializeField]
private RawImage _secondDisplayPreviewImage;
private bool _isShow = false;
private void Start()
{
TogglePanel(false);
}
public void TogglePanel(bool value)
{
_isShow = value;
if (_isShow)
if (value)
{
ShowPanel();
}
@ -33,13 +25,13 @@ public class PreviewModule : MonoBehaviour
private void ShowPanel()
{
_previewPanel.SetActive(true);
_previewPanel.ShowPanel();
_secondDisplayPreviewImage.gameObject.SetActive(true);
}
private void HidePanel()
{
_previewPanel.SetActive(false);
_previewPanel.HidePanel();
_secondDisplayPreviewImage.gameObject.SetActive(false);
}
}

View File

@ -15,3 +15,6 @@ MonoBehaviour:
Name: Test 1
Image: {fileID: 21300000, guid: 5f7fa9a7940a64e79b5a42d9f661d42c, type: 3}
Description: Test description
MiniModel: {fileID: 7721131150223155987, guid: 06c162bf7cb8e0340b5981d7ce3925c7,
type: 3}
Score: 0

View File

@ -15,3 +15,6 @@ MonoBehaviour:
Name: Test 2
Image: {fileID: 21300000, guid: 5f7fa9a7940a64e79b5a42d9f661d42c, type: 3}
Description: Test description
MiniModel: {fileID: 7721131150223155987, guid: 06c162bf7cb8e0340b5981d7ce3925c7,
type: 3}
Score: 0

View File

@ -15,3 +15,6 @@ MonoBehaviour:
Name: Test
Image: {fileID: 21300000, guid: 5f7fa9a7940a64e79b5a42d9f661d42c, type: 3}
Description: Test description
MiniModel: {fileID: 7721131150223155987, guid: 06c162bf7cb8e0340b5981d7ce3925c7,
type: 3}
Score: 0

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 84fd3a10b31999045996a7c834343233
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 0b8a79cef8f591d41984f613fd6fc070
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 112000000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class ScoreController : MonoBehaviour
{
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 92aa80cd89d9d1342be45efd1ced37c3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,13 @@
using UnityEngine;
public class BaseItem : MonoBehaviour, IInteractable
{
[SerializeField]
private float _scoreAdd = 0;
public virtual void Interact()
{
PlayerSetup.Instance.AddScore(_scoreAdd);
Destroy(gameObject);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: cc0d146f6cfe0044cadc742aad059c21
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -3,12 +3,13 @@ using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class EnergyController : MonoBehaviour
public class EnergyController : MonoBehaviour, ITextChangable
{
[SerializeField]
private float _energy;
public event UnityAction<float> OnEnergyChange;
public UnityEvent<object> OnTextChange => _OnTextChange;
private UnityEvent<object> _OnTextChange = new UnityEvent<object>();
public float Energy
{
@ -16,7 +17,7 @@ public class EnergyController : MonoBehaviour
set
{
_energy = value;
OnEnergyChange?.Invoke(_energy);
_OnTextChange?.Invoke(_energy);
}
}
}

View File

@ -2,7 +2,7 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EnergyItem : MonoBehaviour, IInteractable
public class EnergyItem : BaseItem
{
[SerializeField]
private float _energy = 1;
@ -14,9 +14,9 @@ public class EnergyItem : MonoBehaviour, IInteractable
_energyController = FindObjectOfType<EnergyController>();
}
public void Interact()
public override void Interact()
{
base.Interact();
_energyController.Energy += _energy;
Destroy(gameObject);
}
}

View File

@ -17,12 +17,20 @@ public class GameManager : MonoBehaviour
{
public static GameManager Instance { get; private set; }
private PlayerSetup _playerSetup;
private EnergyController _energyController;
private vTimerCounter _timerCounter;
private EndGameModule _endGameModule;
private LeaderboardController _leaderboardController;
private bool _successEnd;
public UnityEvent OnGameStarted;
public UnityEvent OnGameEnded;
[SerializeField]
private UITextShow _UITextShow;
public GameState CurrentGameState = GameState.None;
@ -41,44 +49,79 @@ public class GameManager : MonoBehaviour
InitReferences();
}
private void OnEnable()
{
_timerCounter.OnTimeEnded.AddListener(OnEndTime);
}
private void OnDisable()
{
_timerCounter.OnTimeEnded.AddListener(OnEndTime);
}
private void InitReferences()
{
_playerSetup = FindObjectOfType<PlayerSetup>();
_energyController = FindObjectOfType<EnergyController>();
_leaderboardController = FindObjectOfType<LeaderboardController>();
_endGameModule = FindObjectOfType<EndGameModule>();
_timerCounter = FindObjectOfType<vTimerCounter>();
}
public void ChangeState(GameState newState)
{
if (CurrentGameState == newState)
return;
CurrentGameState = newState;
Debug.Log(newState);
switch (CurrentGameState)
{
case GameState.None:
{
SceneManager.LoadSceneAsync(1);
}
break;
case GameState.Started:
{
_playerSetup.CreateNewPlayer();
OnGameStarted?.Invoke();
var player = PlayerSetup.Instance.CreateNewPlayer();
_leaderboardController.InitPlayerInfo(player);
_UITextShow?.ShowTimer
(
3,
"ÑÒÀÐÒ!",
0,
null,
() => { OnGameStarted?.Invoke(); }
);
}
break;
case GameState.Ended:
{
_playerSetup.SetPlayerScore(_energyController.Energy);
OnGameEnded?.Invoke();
ChangeState(GameState.None);
_endGameModule.ShowEndMenu(_successEnd);
}
break;
}
}
private bool _startedOnce = false;
[ContextMenu("Debug Start")]
public void OnStartGame()
{
if (_startedOnce)
return;
_startedOnce = true;
ChangeState(GameState.Started);
}
public void OnEndTime()
{
_successEnd = false;
ChangeState(GameState.Ended);
}
public void OnFinish()
{
_successEnd = true;
ChangeState(GameState.Ended);
}
}

View File

@ -5,13 +5,12 @@ using System.Linq;
using UnityEngine;
using UnityEngine.UI;
public class LeaderboardController : MonoBehaviour, IPlayerInfoRequre
public class LeaderboardController : MonoBehaviour
{
[SerializeField]
private RectTransform _content;
[SerializeField]
private LeaderboardEntry _leaderboardEntryPrefab;
private PlayerSetup _playerSetup;
[SerializeField]
private InputField _nameInputField;
@ -20,17 +19,16 @@ public class LeaderboardController : MonoBehaviour, IPlayerInfoRequre
private void Start()
{
InitPlayerInfo();
UpdateLeaderboard();
UpdateLeaderboard(0);
}
private void UpdateLeaderboard()
private void UpdateLeaderboard(float newScore)
{
_entries.ForEach(x => Destroy(x.gameObject));
_entries.Clear();
_entries = new List<LeaderboardEntry>();
var sortedList = _playerSetup.PlayerInfo.Players.OrderByDescending(x => x.Score).ToList();
var sortedList = PlayerSetup.Instance.PlayerInfo.Players.OrderByDescending(x => x.Score).ToList();
for (int i = 0; i < sortedList.Count; i++)
{
@ -42,13 +40,13 @@ public class LeaderboardController : MonoBehaviour, IPlayerInfoRequre
public void SubmitNewEntry()
{
_playerSetup.SetPlayerName(_nameInputField.text);
_playerSetup.SavePlayer();
UpdateLeaderboard();
PlayerSetup.Instance.SetPlayerName(_nameInputField.text);
PlayerSetup.Instance.SavePlayer();
UpdateLeaderboard(0);
}
public void InitPlayerInfo()
public void InitPlayerInfo(Player player)
{
_playerSetup = FindObjectOfType<PlayerSetup>();
player.OnScoreChange += UpdateLeaderboard;
}
}

View File

@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -6,9 +7,20 @@ using UnityEngine;
public class Player
{
public string Name;
public float Score;
public float Score
{
get => _score;
set
{
_score = value;
OnScoreChange?.Invoke(_score);
}
}
private float _score;
public List<MonumentInfo> UnlockedMonumets = new List<MonumentInfo>();
public event Action<float> OnScoreChange;
}
[CreateAssetMenu(fileName = "PlayerInfo")]

View File

@ -7,6 +7,7 @@ public class PlayerSetup : MonoBehaviour
public static PlayerSetup Instance;
[SerializeField]
private PlayerInfo _playerInfo;
[SerializeField]
private Player _currentPlayer;
public PlayerInfo PlayerInfo => _playerInfo;
@ -25,14 +26,20 @@ public class PlayerSetup : MonoBehaviour
DontDestroyOnLoad(gameObject);
}
public void CreateNewPlayer()
public Player CreateNewPlayer()
{
_currentPlayer = new Player();
return _currentPlayer;
}
public void SetPlayerScore(float ammount)
public void SetPlayerScore(float value)
{
_currentPlayer.Score = ammount;
_currentPlayer.Score = value;
}
public void AddScore(float ammount)
{
_currentPlayer.Score += ammount;
}
public void SetPlayerName(string name)
@ -40,10 +47,10 @@ public class PlayerSetup : MonoBehaviour
_currentPlayer.Name = name;
}
public void UnlockMonument(MonumentInfo info, float score)
public void UnlockMonument(MonumentInfo info)
{
info.Score = score;
_currentPlayer.UnlockedMonumets.Add(info);
AddScore(info.Score);
}
public bool TryFindMonument(MonumentInfo info)

View File

@ -6,7 +6,7 @@ using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
public class ShipPathFollower : MonoBehaviour
public class ShipPathFollower : MonoBehaviour, ITextChangable
{
public float speed = 10f;
public float minSpeed = 1f;
@ -27,11 +27,12 @@ public class ShipPathFollower : MonoBehaviour
public float soundFadeLength = 0.15f;
public event UnityAction<float> OnSpeedChange;
public InputActionReference LeftTrigger;
public InputActionReference RightTrigger;
public UnityEvent<object> OnTextChange => _OnTextChange;
private UnityEvent<object> _OnTextChange = new UnityEvent<object>();
// Update is called once per frame
void Update()
{
@ -70,7 +71,7 @@ public class ShipPathFollower : MonoBehaviour
brakeForce = Mathf.MoveTowards(brakeForce, 0f, Time.deltaTime * brakeReleaseSpeed);
speedPercent = Mathf.Clamp01(speed / maxSpeed) * (1f - brakeForce);
OnSpeedChange?.Invoke(speed);
_OnTextChange?.Invoke(speed);
}
public void AddBrake(float time)

View File

@ -2,29 +2,11 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SpeedText : MonoBehaviour
public class SpeedText : UITextDisplayBase
{
private ShipPathFollower _pathFollower;
private TMPro.TextMeshProUGUI _text;
private void Awake()
protected override void Awake()
{
_pathFollower = FindObjectOfType<ShipPathFollower>();
_text = GetComponent<TMPro.TextMeshProUGUI>();
}
private void OnEnable()
{
_pathFollower.OnSpeedChange += UpdateText;
}
private void OnDisable()
{
_pathFollower.OnSpeedChange -= UpdateText;
}
private void UpdateText(float speed)
{
_text.SetText(speed.ToString());
base.Awake();
_textChanger = FindObjectOfType<ShipPathFollower>();
}
}

View File

@ -2,12 +2,10 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class TimeBonus : MonoBehaviour, IInteractable
public class TimeBonus : BaseItem
{
[SerializeField]
private int _timeBonus;
[SerializeField]
private bool _selfDestroy = true;
private vTimerCounter _timerCounter;
@ -16,10 +14,9 @@ public class TimeBonus : MonoBehaviour, IInteractable
_timerCounter = FindObjectOfType<vTimerCounter>();
}
public void Interact()
public override void Interact()
{
base.Interact();
_timerCounter.AddTime(_timeBonus);
if (_selfDestroy)
Destroy(gameObject);
}
}

View File

@ -2,30 +2,11 @@ using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(TMPro.TextMeshProUGUI))]
public class TimerText : MonoBehaviour
public class TimerText : UITextDisplayBase
{
private vTimerCounter _timer;
private TMPro.TextMeshProUGUI _text;
private void Awake()
protected override void Awake()
{
_timer = FindObjectOfType<vTimerCounter>();
_text = GetComponent<TMPro.TextMeshProUGUI>();
}
private void OnEnable()
{
_timer.OnUpdateTimer += UpdateText;
}
private void OnDisable()
{
_timer.OnUpdateTimer -= UpdateText;
}
private void UpdateText(string text)
{
_text.SetText(text);
base.Awake();
_textChanger = FindObjectOfType<vTimerCounter>();
}
}

View File

@ -2,15 +2,17 @@
using System.Collections;
using UnityEngine;
using UnityEngine.Events;
public class vTimerCounter : MonoBehaviour
public class vTimerCounter : MonoBehaviour, ITextChangable
{
public bool startTimerOnStart = false;
private bool started = false;
public event UnityAction<string> OnUpdateTimer;
public UnityEvent<object> OnTextChange => _OnTextChange;
public UnityEvent<object> _OnTextChange = new UnityEvent<object>();
DateTime StartTime;
public UnityEvent OnTimeEnded;
public int Seconds;
public void Start()
{
@ -25,6 +27,8 @@ public class vTimerCounter : MonoBehaviour
private string lastText;
public void AddTime(int seconds)
{
if (!started)
@ -43,9 +47,9 @@ public class vTimerCounter : MonoBehaviour
if (time > StartTime)
{
started = false;
GameManager.Instance.ChangeState(GameState.Ended);
OnTimeEnded?.Invoke();
lastText = $"{0:D2}:{0:D2}:{0:D2}.<size=60%>{0:D3}";
OnUpdateTimer?.Invoke(lastText);
_OnTextChange?.Invoke(lastText);
return;
}
@ -57,6 +61,6 @@ public class vTimerCounter : MonoBehaviour
var hour = timeSpan.Hours;
lastText = $"{hour:D2}:{min:D2}:{sec:D2}.<size=60%>{ms:D3}";
OnUpdateTimer?.Invoke(lastText);
_OnTextChange?.Invoke(lastText);
}
}

27
Assets/SplineTrigger.cs Normal file
View File

@ -0,0 +1,27 @@
using Dreamteck.Splines;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
public class SplineTrigger : MonoBehaviour
{
[SerializeField]
private LayerMask _layerMask;
private bool _triggerOnce = false;
public UnityEvent OnTriggerEvent;
private void OnTriggerEnter(Collider other)
{
if (_triggerOnce)
return;
if ((_layerMask.value & (1 << other.transform.gameObject.layer)) > 0)
{
_triggerOnce = true;
OnTriggerEvent?.Invoke();
}
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: c77a6647f89e24a40930e0d4abd7d395
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

View File

@ -38,11 +38,6 @@ public class UIMonumentButton : MonoBehaviour
_button.onClick.RemoveListener(SelectMonument);
}
private void Start()
{
Lock();
}
public void Lock()
{
_button.interactable = false;

56
Assets/UIPanel.cs Normal file
View File

@ -0,0 +1,56 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class UIPanel : MonoBehaviour
{
public bool HideOnStart = true;
public bool UseScale = true;
public float ScaleTime = 0.5f;
private CanvasGroup canvasGroup;
private void Awake()
{
canvasGroup = GetComponent<CanvasGroup>();
}
private void Start()
{
if (HideOnStart)
{
canvasGroup.alpha = 0;
canvasGroup.blocksRaycasts = false;
}
}
public void ShowPanel()
{
if (UseScale)
{
gameObject.transform.localScale = Vector3.zero;
gameObject.LeanScale(Vector3.one, 0.5f);
}
canvasGroup.alpha = 1;
canvasGroup.blocksRaycasts = true;
}
public void HidePanel()
{
if (UseScale)
{
gameObject.transform.localScale = Vector3.one;
gameObject.LeanScale(Vector3.zero, 0.5f).setOnComplete(() =>
{
canvasGroup.alpha = 0;
canvasGroup.blocksRaycasts = false;
});
}
else
{
canvasGroup.alpha = 0;
canvasGroup.blocksRaycasts = false;
}
}
}

11
Assets/UIPanel.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1cf2dd2e98b7e3a419c61540a217f283
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,32 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[RequireComponent(typeof(TMPro.TextMeshProUGUI))]
public class UITextDisplayBase : MonoBehaviour
{
protected TMPro.TextMeshProUGUI _text;
protected ITextChangable _textChanger;
[SerializeField]
protected string _postfix;
protected virtual void Awake()
{
_text = GetComponent<TMPro.TextMeshProUGUI>();
}
protected virtual void OnEnable()
{
_textChanger.OnTextChange.AddListener(UpdateText);
}
protected virtual void OnDisable()
{
_textChanger.OnTextChange.RemoveListener(UpdateText);
}
private void UpdateText(object obj)
{
_text.SetText(obj.ToString() + _postfix);
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4cb225d1fab2ede49b58a4ab4a5c9136
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

63
Assets/UITextShow.cs Normal file
View File

@ -0,0 +1,63 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
public class UITextShow : MonoBehaviour
{
private TMPro.TextMeshProUGUI _text;
private void Awake()
{
_text = GetComponent<TMPro.TextMeshProUGUI>();
}
public void SetText(string text)
{
_text.SetText(text);
}
public void ShowSubtitle(string text, float delay, float afterDelay, Action onStart, Action onEnd)
{
StartCoroutine(Subtitle_Coroutine(text, delay, afterDelay, onStart, onEnd));
}
public void ShowTimer(int time, string afterTimerText, float afterDelay, Action onStart, Action onEnd)
{
StartCoroutine(Timer_Coroutine(time, afterTimerText, afterDelay, onStart, onEnd));
}
private IEnumerator Timer_Coroutine(int time, string afterTimerText, float afterDelay, Action onStart, Action onEnd)
{
onStart?.Invoke();
for (int i = time; i > 0; i--)
{
_text.SetText(i.ToString());
yield return new WaitForSeconds(1);
}
_text.SetText(afterTimerText);
yield return new WaitForSeconds(afterDelay);
_text.SetText(string.Empty);
onEnd?.Invoke();
}
private IEnumerator Subtitle_Coroutine(string text, float delay, float afterDelay, Action onStart, Action onEnd)
{
onStart?.Invoke();
StringBuilder sb = new StringBuilder();
for (int i = 0; i < text.Length; i++)
{
sb.Append(text[i]);
_text.SetText(sb);
yield return new WaitForSeconds(delay);
}
yield return new WaitForSeconds(afterDelay);
_text.SetText(string.Empty);
onEnd?.Invoke();
}
}

11
Assets/UITextShow.cs.meta Normal file
View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 9b59f0a5fc1510a499be3b33770ec226
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

61
Assets/VisorUIModule.cs Normal file
View File

@ -0,0 +1,61 @@
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.UI;
public class VisorUIModule : MonoBehaviour
{
[SerializeField]
private CanvasGroup _mainPanel;
[SerializeField]
private CanvasGroup _tutorPanel;
[SerializeField]
private Image _progressBarImage;
public InputActionReference LeftTrigger;
public InputActionReference RightTrigger;
private float _visibleValue = 0;
private bool _visorActivated = false;
public UnityEvent OnVisorActivated = new UnityEvent();
private void Update()
{
if (_visorActivated)
return;
if (RightTrigger.action.inProgress && LeftTrigger.action.inProgress)
{
_visibleValue = Mathf.Clamp01(_visibleValue + Time.deltaTime);
}
else
{
_visibleValue = Mathf.Clamp01(_visibleValue - Time.deltaTime);
}
UpdateVisorValue();
}
private void UpdateVisorValue()
{
_mainPanel.alpha = _visibleValue;
_tutorPanel.alpha = 1 - _visibleValue;
_progressBarImage.fillAmount = _visibleValue;
if (_visibleValue == 1)
{
ActivateVisor();
}
}
private void ActivateVisor()
{
_visorActivated = true;
OnVisorActivated?.Invoke();
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: b19444df1d6ea7d4ebb514fb52415ba4
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -726,7 +726,7 @@ PlayerSettings:
Nintendo Switch: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER
PS4: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER
Stadia: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER
Standalone: SCSM_SSC;SSC_UIS;SCSM_XR;DREAMTECK_SPLINES;SSC_URP
Standalone: SCSM_SSC;SSC_UIS;SCSM_XR;DREAMTECK_SPLINES;SSC_URP;UNITY_CCU;CURVEDUI_TMP
WebGL: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER
Windows Store Apps: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER
XboxOne: PHOTON_UNITY_NETWORKING;PUN_2_0_OR_NEWER;PUN_2_OR_NEWER;PUN_2_19_OR_NEWER