Remake about a half of the inventory UI
This commit is contained in:
parent
5eb424bea0
commit
fc1c61e9df
78
Assets/Models/Materials/Hologram Item Selector.mat
Normal file
78
Assets/Models/Materials/Hologram Item Selector.mat
Normal file
@ -0,0 +1,78 @@
|
||||
%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: Hologram Item Selector
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHABLEND_ON _EMISSION _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
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: 30}
|
||||
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: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _InvFade: 1
|
||||
- _Metallic: 1
|
||||
- _Mode: 2
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 0
|
||||
- _SrcBlend: 5
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0.4980392, b: 0.98615295, a: 0.2509804}
|
||||
- _EmissionColor: {r: 1, g: 0.543, b: 0.97349375, a: 1}
|
||||
- _TintColor: {r: 1, g: 0.13725491, b: 0.7058824, a: 0.028}
|
9
Assets/Models/Materials/Hologram Item Selector.mat.meta
Normal file
9
Assets/Models/Materials/Hologram Item Selector.mat.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ccb492954e2b14f559ffb8163add4421
|
||||
timeCreated: 1494534721
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
78
Assets/Models/Materials/Hologram Item.mat
Normal file
78
Assets/Models/Materials/Hologram Item.mat
Normal file
@ -0,0 +1,78 @@
|
||||
%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: Hologram Item
|
||||
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
|
||||
m_ShaderKeywords: _ALPHABLEND_ON _EMISSION _GLOSSYREFLECTIONS_OFF _SPECULARHIGHLIGHTS_OFF
|
||||
m_LightmapFlags: 1
|
||||
m_EnableInstancingVariants: 0
|
||||
m_CustomRenderQueue: 3000
|
||||
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: 30}
|
||||
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: 10
|
||||
- _GlossMapScale: 1
|
||||
- _Glossiness: 0
|
||||
- _GlossyReflections: 0
|
||||
- _InvFade: 1
|
||||
- _Metallic: 1
|
||||
- _Mode: 2
|
||||
- _OcclusionStrength: 1
|
||||
- _Parallax: 0.02
|
||||
- _SmoothnessTextureChannel: 0
|
||||
- _SpecularHighlights: 0
|
||||
- _SrcBlend: 5
|
||||
- _UVSec: 0
|
||||
- _ZWrite: 0
|
||||
m_Colors:
|
||||
- _Color: {r: 1, g: 0.14700001, b: 0.97646916, a: 0.5019608}
|
||||
- _EmissionColor: {r: 2.4, g: 1.5287998, b: 2.34947, a: 1}
|
||||
- _TintColor: {r: 1, g: 0.13725491, b: 0.7058824, a: 0.028}
|
9
Assets/Models/Materials/Hologram Item.mat.meta
Normal file
9
Assets/Models/Materials/Hologram Item.mat.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dc8a9321c9cc446d3b29e4581ce4524d
|
||||
timeCreated: 1494534721
|
||||
licenseType: Free
|
||||
NativeFormatImporter:
|
||||
mainObjectFileID: 2100000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@ -1,3 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c3365db67a7080b4bbd25629e8e955db33ca4683b2810c43c21ab8f6ad137500
|
||||
size 318
|
||||
oid sha256:9a55af0841d7c7c5343907c58c3e333a9116cfacab9e3556bd871f4ac71a1a05
|
||||
size 552
|
||||
|
@ -7,8 +7,8 @@ TextureImporter:
|
||||
serializedVersion: 4
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
enableMipMap: 0
|
||||
sRGBTexture: 0
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
@ -31,7 +31,7 @@ TextureImporter:
|
||||
aniso: -1
|
||||
mipBias: -1
|
||||
wrapMode: 1
|
||||
nPOTScale: 1
|
||||
nPOTScale: 0
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -466,6 +466,49 @@ CanvasRenderer:
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 270758321}
|
||||
--- !u!1 &274219295
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
serializedVersion: 5
|
||||
m_Component:
|
||||
- component: {fileID: 274219296}
|
||||
- component: {fileID: 274219297}
|
||||
m_Layer: 0
|
||||
m_Name: MeshDB
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!4 &274219296
|
||||
Transform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 274219295}
|
||||
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: 344272455}
|
||||
m_RootOrder: 5
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!114 &274219297
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_PrefabParentObject: {fileID: 0}
|
||||
m_PrefabInternal: {fileID: 0}
|
||||
m_GameObject: {fileID: 274219295}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 928708f1fbd954c6e9e015942b8ddb92, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
Meshes:
|
||||
- {fileID: 10202, guid: 0000000000000000e000000000000000, type: 0}
|
||||
- {fileID: 10206, guid: 0000000000000000e000000000000000, type: 0}
|
||||
--- !u!1 &310461191
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -540,6 +583,7 @@ Transform:
|
||||
- {fileID: 1939832658}
|
||||
- {fileID: 375619906}
|
||||
- {fileID: 1610252930}
|
||||
- {fileID: 274219296}
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 0
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
@ -821,7 +865,7 @@ MeshFilter:
|
||||
Transform:
|
||||
m_PrefabParentObject: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2,
|
||||
type: 2}
|
||||
m_PrefabInternal: {fileID: 2139315739}
|
||||
m_PrefabInternal: {fileID: 1560587483}
|
||||
--- !u!1 &566501560
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2176,6 +2220,112 @@ Transform:
|
||||
m_Father: {fileID: 0}
|
||||
m_RootOrder: 1
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
--- !u!1001 &1560587483
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 132238582}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.02
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.02
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalScale.x
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalScale.y
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4871279644634608, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalScale.z
|
||||
value: 0.8
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 0.7071068
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalEulerAnglesHint.y
|
||||
value: 90
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4334285771407092, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
--- !u!1 &1610252928
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -2861,45 +3011,3 @@ Camera:
|
||||
m_StereoConvergence: 10
|
||||
m_StereoSeparation: 0.022
|
||||
m_StereoMirrorMode: 0
|
||||
--- !u!1001 &2139315739
|
||||
Prefab:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Modification:
|
||||
m_TransformParent: {fileID: 132238582}
|
||||
m_Modifications:
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.y
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalPosition.z
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.x
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.y
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.z
|
||||
value: -0
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_LocalRotation.w
|
||||
value: 1
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 4586682446228250, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
propertyPath: m_RootOrder
|
||||
value: 0
|
||||
objectReference: {fileID: 0}
|
||||
m_RemovedComponents: []
|
||||
m_ParentPrefab: {fileID: 100100000, guid: e8761b9491a974d1780e60dafbd372a2, type: 2}
|
||||
m_IsPrefabParent: 0
|
||||
|
@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using Cyber.Util;
|
||||
using Cyber.Console;
|
||||
|
||||
namespace Cyber.Controls {
|
||||
|
||||
@ -20,6 +21,16 @@ namespace Cyber.Controls {
|
||||
/// </summary>
|
||||
public Hologram Hologram;
|
||||
|
||||
/// <summary>
|
||||
/// The item preview mesh.
|
||||
/// </summary>
|
||||
public MeshFilter ItemPreviewMesh;
|
||||
|
||||
/// <summary>
|
||||
/// The item preview spinner.
|
||||
/// </summary>
|
||||
public Spinner ItemPreviewSpinner;
|
||||
|
||||
/// <summary>
|
||||
/// The icon for the inventory.
|
||||
/// </summary>
|
||||
@ -46,20 +57,28 @@ namespace Cyber.Controls {
|
||||
public TextTextureApplier IconExplainerText;
|
||||
|
||||
/// <summary>
|
||||
/// The text that contains the item list.
|
||||
/// The selector mesh. It'll move to the position of the selected item
|
||||
/// in the grid.
|
||||
/// </summary>
|
||||
public TextTextureApplier ItemListText;
|
||||
public Transform ItemGridSelector;
|
||||
|
||||
/// <summary>
|
||||
/// How many items can be shown on the screen at the same time.
|
||||
/// The parent of all the gameobjects that create the grid.
|
||||
/// </summary>
|
||||
public float ItemsPerScreen;
|
||||
public Transform ItemGridParent;
|
||||
|
||||
/// <summary>
|
||||
/// The item grid dimensions.
|
||||
/// </summary>
|
||||
public Vector2 ItemGridDimensions;
|
||||
|
||||
private CursorHandler CursorHandler;
|
||||
private MeshDB MeshDB;
|
||||
private bool InventoryOpen = false;
|
||||
private int TestingInventorySize = 20;
|
||||
private int ScrollingIndex = 0;
|
||||
private int SelectedIndex = -1;
|
||||
|
||||
private List<Transform> ItemGridCells;
|
||||
private List<MeshFilter> ItemGridCellMeshes;
|
||||
private int ItemGridSelectedIndex;
|
||||
|
||||
private Color IconInventoryColor;
|
||||
private Color IconStatusColor;
|
||||
@ -68,7 +87,16 @@ namespace Cyber.Controls {
|
||||
|
||||
private void Start() {
|
||||
CursorHandler = GameObject.Find("/Systems/CursorHandler").GetComponent<CursorHandler>();
|
||||
RebuildItemList(-1);
|
||||
MeshDB = GameObject.Find("/Systems/MeshDB").GetComponent<MeshDB>();
|
||||
|
||||
int ItemGridSize = (int) ItemGridDimensions.x * (int) ItemGridDimensions.y;
|
||||
ItemGridCells = new List<Transform>(ItemGridSize);
|
||||
ItemGridCellMeshes = new List<MeshFilter>(ItemGridSize);
|
||||
for (int i = 0; i < ItemGridSize; i++) {
|
||||
Transform Cell = ItemGridParent.GetChild(i).transform;
|
||||
ItemGridCells.Add(Cell);
|
||||
ItemGridCellMeshes.Add(Cell.GetComponentInChildren<MeshFilter>());
|
||||
}
|
||||
|
||||
IconInventoryColor = IconInventory.material.GetColor("_EmissionColor");
|
||||
IconStatusColor = IconStatus.material.GetColor("_EmissionColor");
|
||||
@ -77,35 +105,26 @@ namespace Cyber.Controls {
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
if (Term.IsVisible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (Input.GetButtonDown("Inventory")) {
|
||||
InventoryOpen = !InventoryOpen;
|
||||
Hologram.Visible = InventoryOpen;
|
||||
CursorHandler.RequestLockState(!InventoryOpen);
|
||||
}
|
||||
|
||||
int CurrentIndex = -1;
|
||||
RaycastHit LookedAt = CameraUtil.GetLookedAtHit(Camera, 1f, true);
|
||||
if (LookedAt.collider != null) {
|
||||
TextTextureApplier Text = LookedAt.collider.GetComponent<TextTextureApplier>();
|
||||
MeshRenderer Mesh = LookedAt.collider.GetComponent<MeshRenderer>();
|
||||
if (Text != null && Text == ItemListText) {
|
||||
if (ItemGridCells.Contains(LookedAt.collider.transform)) {
|
||||
// Interacting with the item list
|
||||
// Calculate the index
|
||||
float ScaledY = (Text.transform.InverseTransformPoint(LookedAt.point).z * 0.1f) + 0.5f;
|
||||
int CurrentIndex = ScrollingIndex + (int)(ScaledY * ItemsPerScreen);
|
||||
|
||||
// Update inputs
|
||||
if (Input.GetAxis("Mouse ScrollWheel") > 0 && ScrollingIndex > 0) {
|
||||
ScrollingIndex--;
|
||||
}
|
||||
if (Input.GetAxis("Mouse ScrollWheel") < 0 && ScrollingIndex < TestingInventorySize - 1) {
|
||||
ScrollingIndex++;
|
||||
}
|
||||
CurrentIndex = int.Parse(LookedAt.collider.name.Split(' ')[1]);
|
||||
if (Input.GetButtonDown("Activate")) {
|
||||
SelectedIndex = CurrentIndex;
|
||||
ItemGridSelectedIndex = CurrentIndex;
|
||||
}
|
||||
|
||||
// Rebuild the list
|
||||
RebuildItemList(CurrentIndex);
|
||||
} else if (Mesh != null) {
|
||||
float InvBrightness = 1f;
|
||||
float StsBrightness = 1f;
|
||||
@ -115,7 +134,7 @@ namespace Cyber.Controls {
|
||||
|
||||
if (Mesh == IconInventory) {
|
||||
InvBrightness = 1.2f;
|
||||
SelectedIcon = "Inventory";
|
||||
SelectedIcon = "Storage";
|
||||
} else if (Mesh == IconStatus) {
|
||||
StsBrightness = 1.2f;
|
||||
SelectedIcon = "Status";
|
||||
@ -131,37 +150,91 @@ namespace Cyber.Controls {
|
||||
Props.Text = SelectedIcon;
|
||||
IconExplainerText.SetTextProperties(Props);
|
||||
|
||||
IconInventory.material.SetColor("_EmissionColor", IconInventoryColor * InvBrightness);
|
||||
IconStatus.material.SetColor("_EmissionColor", IconStatusColor * StsBrightness);
|
||||
IconSocial.material.SetColor("_EmissionColor", IconSocialColor * SclBrightness);
|
||||
IconMap.material.SetColor("_EmissionColor", IconMapColor * MapBrightness);
|
||||
|
||||
IconInventory.material.SetColor("_EmissionColor", new Color(IconInventoryColor.r * InvBrightness,
|
||||
IconInventoryColor.g * InvBrightness, IconInventoryColor.b * InvBrightness));
|
||||
IconStatus.material.SetColor("_EmissionColor", new Color(IconStatusColor.r * StsBrightness,
|
||||
IconStatusColor.g * StsBrightness, IconStatusColor.b * StsBrightness));
|
||||
IconSocial.material.SetColor("_EmissionColor", new Color(IconSocialColor.r * SclBrightness,
|
||||
IconSocialColor.g * SclBrightness, IconSocialColor.b * SclBrightness));
|
||||
IconMap.material.SetColor("_EmissionColor", new Color(IconMapColor.r * MapBrightness,
|
||||
IconMapColor.g * MapBrightness, IconMapColor.b * MapBrightness));
|
||||
}
|
||||
} else {
|
||||
// Outside of the inventory, clicking will unselect
|
||||
if (Input.GetButtonDown("Activate")) {
|
||||
SelectedIndex = -1;
|
||||
RebuildItemList(-1);
|
||||
ItemGridSelectedIndex = -1;
|
||||
}
|
||||
}
|
||||
RebuildItemGrid(CurrentIndex);
|
||||
}
|
||||
|
||||
private void RebuildItemGrid(int focused) {
|
||||
if (ItemGridSelectedIndex < 0) {
|
||||
SetPreviewMesh(null);
|
||||
}
|
||||
for (int i = 0; i < ItemGridDimensions.x * ItemGridDimensions.y; i++) {
|
||||
ItemGridCellMeshes[i].mesh = MeshDB.Meshes[i % MeshDB.Meshes.Length];
|
||||
float Scale = 0.08f;
|
||||
bool Spinning = false;
|
||||
if (focused == i || ItemGridSelectedIndex == i) {
|
||||
Scale = 0.1f;
|
||||
Spinning = true;
|
||||
}
|
||||
if (ItemGridSelectedIndex == i) {
|
||||
SetPreviewMesh(ItemGridCellMeshes[i].mesh);
|
||||
if ((ItemGridSelector.position - ItemGridCells[i].position).magnitude < 0.01f) {
|
||||
ItemGridSelector.position = ItemGridCells[i].position;
|
||||
} else {
|
||||
ItemGridSelector.position =
|
||||
Vector3.Lerp(ItemGridSelector.position,
|
||||
ItemGridCells[i].position, 20f * Time.deltaTime);
|
||||
}
|
||||
ItemGridSelector.LookAt(Camera.transform);
|
||||
Vector3 NewRot = ItemGridSelector.localEulerAngles;
|
||||
NewRot.z = 0;
|
||||
ItemGridSelector.localEulerAngles = NewRot;
|
||||
}
|
||||
if (!Spinning) {
|
||||
ItemGridCellMeshes[i].transform.LookAt(Camera.transform);
|
||||
Vector3 NewRot = ItemGridCellMeshes[i].transform.localEulerAngles;
|
||||
NewRot.z = 0;
|
||||
ItemGridCellMeshes[i].transform.localEulerAngles = NewRot;
|
||||
}
|
||||
ItemGridCells[i].GetComponent<Spinner>().Spinning = Spinning;
|
||||
FixMeshScaling(ItemGridCellMeshes[i], Scale);
|
||||
}
|
||||
}
|
||||
|
||||
private void RebuildItemList(int focused) {
|
||||
string Inv = "";
|
||||
for (int i = ScrollingIndex; i < TestingInventorySize; i++) {
|
||||
if (i == focused) {
|
||||
Inv += "<b>";
|
||||
}
|
||||
if (i == SelectedIndex) {
|
||||
Inv += "·";
|
||||
}
|
||||
Inv += "Item #" + i + "\n";
|
||||
if (i == focused) {
|
||||
Inv += "</b>";
|
||||
private void SetPreviewMesh(Mesh mesh) {
|
||||
ItemPreviewSpinner.Spinning = mesh != null;
|
||||
ItemPreviewMesh.mesh = mesh;
|
||||
|
||||
if (mesh != null) {
|
||||
FixMeshScaling(ItemPreviewMesh, 0.175f);
|
||||
}
|
||||
}
|
||||
TextTextureProperties NewProps = ItemListText.TextProperties;
|
||||
NewProps.Text = Inv;
|
||||
ItemListText.SetTextProperties(NewProps);
|
||||
|
||||
private void FixMeshScaling(MeshFilter toFix, float scale) {
|
||||
float HighestExtent = 0f;
|
||||
float Height = toFix.mesh.bounds.extents.y * 2f;
|
||||
float Width = Mathf.Sqrt(Mathf.Pow(toFix.mesh.bounds.extents.x * 2f, 2) +
|
||||
Mathf.Pow(toFix.mesh.bounds.extents.y * 2f, 2));
|
||||
float Depth = Mathf.Sqrt(Mathf.Pow(toFix.mesh.bounds.extents.z * 2f, 2) +
|
||||
Mathf.Pow(toFix.mesh.bounds.extents.y * 2f, 2));
|
||||
|
||||
if (Height > HighestExtent) {
|
||||
HighestExtent = Height;
|
||||
}
|
||||
if (Width > HighestExtent) {
|
||||
HighestExtent = Width;
|
||||
}
|
||||
if (Depth > HighestExtent) {
|
||||
HighestExtent = Depth;
|
||||
}
|
||||
|
||||
float Scale = scale * 1f / HighestExtent;
|
||||
toFix.transform.localScale = new Vector3(Scale, Scale, Scale);
|
||||
}
|
||||
}
|
||||
}
|
18
Assets/Scripts/Util/MeshDB.cs
Normal file
18
Assets/Scripts/Util/MeshDB.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cyber.Util {
|
||||
|
||||
/// <summary>
|
||||
/// Mesh database, contains all the meshes in the game. This should be
|
||||
/// used if meshes are needed at runtime.
|
||||
/// </summary>
|
||||
public class MeshDB : MonoBehaviour {
|
||||
|
||||
/// <summary>
|
||||
/// The meshes that can be used at runtime.
|
||||
/// </summary>
|
||||
public Mesh[] Meshes;
|
||||
}
|
||||
}
|
12
Assets/Scripts/Util/MeshDB.cs.meta
Normal file
12
Assets/Scripts/Util/MeshDB.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 928708f1fbd954c6e9e015942b8ddb92
|
||||
timeCreated: 1494617518
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
40
Assets/Scripts/Util/Spinner.cs
Normal file
40
Assets/Scripts/Util/Spinner.cs
Normal file
@ -0,0 +1,40 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Cyber.Util {
|
||||
|
||||
/// <summary>
|
||||
/// Spins the transform at a defined speed.
|
||||
/// </summary>
|
||||
public class Spinner : MonoBehaviour {
|
||||
|
||||
/// <summary>
|
||||
/// The axis this spinner spins around.
|
||||
/// </summary>
|
||||
public Vector3 Axis = new Vector3(0, 1, 0);
|
||||
|
||||
/// <summary>
|
||||
/// The rounds per minute of the spinning.
|
||||
/// </summary>
|
||||
public float RoundsPerMinute = 30;
|
||||
|
||||
/// <summary>
|
||||
/// Whether the spinner is spinning currently.
|
||||
/// </summary>
|
||||
public bool Spinning = true;
|
||||
|
||||
private float CurrentRelativeSpeed = 1f;
|
||||
|
||||
private void Start() {
|
||||
CurrentRelativeSpeed = Spinning ? 1f : 0f;
|
||||
}
|
||||
|
||||
private void Update() {
|
||||
CurrentRelativeSpeed = Mathf.Lerp(CurrentRelativeSpeed,
|
||||
Spinning ? 1f : 0f, 20f * Time.deltaTime);
|
||||
transform.localEulerAngles = transform.localEulerAngles +
|
||||
Axis * RoundsPerMinute * CurrentRelativeSpeed * Time.deltaTime;
|
||||
}
|
||||
}
|
||||
}
|
12
Assets/Scripts/Util/Spinner.cs.meta
Normal file
12
Assets/Scripts/Util/Spinner.cs.meta
Normal file
@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0b0a8d5b96e07491dbcbbaa244f887f0
|
||||
timeCreated: 1494617956
|
||||
licenseType: Free
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue
Block a user