diff --git a/Assets/Resources/icons/view_angle_back.png b/Assets/Resources/icons/view_angle_back.png new file mode 100644 index 00000000..71ea99f4 Binary files /dev/null and b/Assets/Resources/icons/view_angle_back.png differ diff --git a/Assets/Resources/icons/view_angle_back.png.meta b/Assets/Resources/icons/view_angle_back.png.meta new file mode 100644 index 00000000..11eed7ed --- /dev/null +++ b/Assets/Resources/icons/view_angle_back.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: bcbf769f9c56ff547ae0732c726fc231 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_bottom.png b/Assets/Resources/icons/view_angle_bottom.png new file mode 100644 index 00000000..29e6d836 Binary files /dev/null and b/Assets/Resources/icons/view_angle_bottom.png differ diff --git a/Assets/Resources/icons/view_angle_bottom.png.meta b/Assets/Resources/icons/view_angle_bottom.png.meta new file mode 100644 index 00000000..0ba518f8 --- /dev/null +++ b/Assets/Resources/icons/view_angle_bottom.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: a2ee355d4680c3b629174011b502de56 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_front.png b/Assets/Resources/icons/view_angle_front.png new file mode 100644 index 00000000..05ec1e2d Binary files /dev/null and b/Assets/Resources/icons/view_angle_front.png differ diff --git a/Assets/Resources/icons/view_angle_front.png.meta b/Assets/Resources/icons/view_angle_front.png.meta new file mode 100644 index 00000000..4d6357fd --- /dev/null +++ b/Assets/Resources/icons/view_angle_front.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: 270b58f2ec2e174a3bf9bc6994a982a9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_home.png b/Assets/Resources/icons/view_angle_home.png new file mode 100644 index 00000000..80feee40 Binary files /dev/null and b/Assets/Resources/icons/view_angle_home.png differ diff --git a/Assets/Resources/icons/view_angle_home.png.meta b/Assets/Resources/icons/view_angle_home.png.meta new file mode 100644 index 00000000..716ffb89 --- /dev/null +++ b/Assets/Resources/icons/view_angle_home.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: e5fac2897094063bf9a689977fd4cb7a +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_left.png b/Assets/Resources/icons/view_angle_left.png new file mode 100644 index 00000000..b25c7b1d Binary files /dev/null and b/Assets/Resources/icons/view_angle_left.png differ diff --git a/Assets/Resources/icons/view_angle_left.png.meta b/Assets/Resources/icons/view_angle_left.png.meta new file mode 100644 index 00000000..14907364 --- /dev/null +++ b/Assets/Resources/icons/view_angle_left.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: 100571a55320e8be9874ef154bb68641 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_right.png b/Assets/Resources/icons/view_angle_right.png new file mode 100644 index 00000000..31b0dc02 Binary files /dev/null and b/Assets/Resources/icons/view_angle_right.png differ diff --git a/Assets/Resources/icons/view_angle_right.png.meta b/Assets/Resources/icons/view_angle_right.png.meta new file mode 100644 index 00000000..4e91c558 --- /dev/null +++ b/Assets/Resources/icons/view_angle_right.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: 066af14fc7d8b1f699d4a7cc9eaa81b9 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Resources/icons/view_angle_top.png b/Assets/Resources/icons/view_angle_top.png new file mode 100644 index 00000000..ad30618e Binary files /dev/null and b/Assets/Resources/icons/view_angle_top.png differ diff --git a/Assets/Resources/icons/view_angle_top.png.meta b/Assets/Resources/icons/view_angle_top.png.meta new file mode 100644 index 00000000..08f21b85 --- /dev/null +++ b/Assets/Resources/icons/view_angle_top.png.meta @@ -0,0 +1,114 @@ +fileFormatVersion: 2 +guid: c433d329a1c3ef129bfa2ff3c4503e16 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 13 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 1 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/Scenes/MainScene.unity b/Assets/Scenes/MainScene.unity index 0386a76e..93440dab 100644 --- a/Assets/Scenes/MainScene.unity +++ b/Assets/Scenes/MainScene.unity @@ -4213,9 +4213,10 @@ GameObject: - component: {fileID: 683297087} - component: {fileID: 683297086} - component: {fileID: 683297090} - - component: {fileID: 683297089} - component: {fileID: 683297088} - component: {fileID: 683297091} + - component: {fileID: 683297093} + - component: {fileID: 683297092} m_Layer: 5 m_Name: UI m_TagString: Untagged @@ -4287,7 +4288,7 @@ MonoBehaviour: m_Script: {fileID: 11500000, guid: f36ccde904b2caf1a9710801807136b0, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &683297089 +--- !u!114 &683297090 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -4296,10 +4297,10 @@ MonoBehaviour: m_GameObject: {fileID: 683297084} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: cbae07c6267889cceacfaf4e676c5ccf, type: 3} + m_Script: {fileID: 11500000, guid: 6f27710de512a0490b04a13f196dea25, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &683297090 +--- !u!114 &683297091 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -4308,10 +4309,10 @@ MonoBehaviour: m_GameObject: {fileID: 683297084} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 6f27710de512a0490b04a13f196dea25, type: 3} + m_Script: {fileID: 11500000, guid: 838111eae051196519d8d7728664669c, type: 3} m_Name: m_EditorClassIdentifier: ---- !u!114 &683297091 +--- !u!114 &683297092 MonoBehaviour: m_ObjectHideFlags: 0 m_CorrespondingSourceObject: {fileID: 0} @@ -4320,7 +4321,24 @@ MonoBehaviour: m_GameObject: {fileID: 683297084} m_Enabled: 1 m_EditorHideFlags: 0 - m_Script: {fileID: 11500000, guid: 838111eae051196519d8d7728664669c, type: 3} + m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0} + m_Name: + m_EditorClassIdentifier: + m_PanelSettings: {fileID: 11400000, guid: 3d0937a12acfdb78c88d9efe6de538b6, type: 2} + m_ParentUI: {fileID: 0} + sourceAsset: {fileID: 9197481963319205126, guid: 2e17021ff9dbce44397d3791c704adeb, + type: 3} + m_SortingOrder: 0 +--- !u!114 &683297093 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 683297084} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 419d3276628a82bccb3be4cad25b40c3, type: 3} m_Name: m_EditorClassIdentifier: --- !u!1 &705507993 @@ -6542,12 +6560,12 @@ RectTransform: m_ConstrainProportionsScale: 0 m_Children: - {fileID: 610688433} - - {fileID: 1655136414} - {fileID: 577825916} - {fileID: 1608531201} - {fileID: 1928431086} - {fileID: 1829705136} - {fileID: 227849491} + - {fileID: 1655136414} - {fileID: 382802152} - {fileID: 457082642} - {fileID: 775674122} @@ -7680,7 +7698,7 @@ MonoBehaviour: m_EditorClassIdentifier: m_Material: {fileID: 0} m_Color: {r: 1, g: 1, b: 1, a: 1} - m_RaycastTarget: 1 + m_RaycastTarget: 0 m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} m_Maskable: 1 m_OnCullStateChanged: diff --git a/Assets/Scripts/CLOiSimPlugins/MowingPlugin.cs b/Assets/Scripts/CLOiSimPlugins/MowingPlugin.cs index 3a4f1a8a..508574eb 100644 --- a/Assets/Scripts/CLOiSimPlugins/MowingPlugin.cs +++ b/Assets/Scripts/CLOiSimPlugins/MowingPlugin.cs @@ -4,6 +4,7 @@ * SPDX-License-Identifier: MIT */ +using System.Collections.Generic; using System.Collections; using System.Linq; using System; @@ -302,6 +303,21 @@ private IEnumerator PunchingGrass() var layerMask = LayerMask.GetMask("Default"); + var helperVisuals = GetComponentsInChildren(); + foreach (var helperVisual in helperVisuals) + { + var meshFilters = helperVisual.GetComponentsInChildren(); + foreach (var meshFilter in meshFilters) + { + var meshCollider = meshFilter.transform.gameObject.AddComponent(); + meshCollider.convex = true; + meshCollider.isTrigger = true; + } + } + + yield return null; + + var punchingMeshFilters = new List(); var hitColliders = Physics.OverlapBox(_grass.bounds.center, _grass.bounds.size * 0.5f, Quaternion.identity, layerMask); var i = 0; while (i < hitColliders.Length) @@ -325,11 +341,28 @@ private IEnumerator PunchingGrass() } var meshFilter = helperLink.GetComponentInChildren(); - PunchingTexture(_grass.texture, meshFilter); - yield return null; + punchingMeshFilters.Add(meshFilter); + } + } + + yield return null; + + foreach (var helperVisual in helperVisuals) + { + var meshColliders = helperVisual.GetComponentsInChildren(); + foreach (var meshCollider in meshColliders) + { + GameObject.Destroy(meshCollider); } } + yield return null; + + foreach (var meshFilter in punchingMeshFilters) + { + PunchingTexture(_grass.texture, meshFilter); + yield return null; + } _initialTexturePixels = new Color[_grass.texture.GetPixels().LongLength]; Array.Copy(_grass.texture.GetPixels(), _initialTexturePixels, _initialTexturePixels.LongLength); diff --git a/Assets/Scripts/Core/Modules/BridgeManager.cs b/Assets/Scripts/Core/Modules/BridgeManager.cs index 501dc2cc..75c031bc 100644 --- a/Assets/Scripts/Core/Modules/BridgeManager.cs +++ b/Assets/Scripts/Core/Modules/BridgeManager.cs @@ -257,7 +257,7 @@ public static ushort AllocateDevicePort(in string hashKey) { var errorMessage = string.Format("HashKey({0}) is already occupied.", hashKey); Console.Error.Write(errorMessage); - Main.Display?.SetErrorMessage(errorMessage); + Main.UIController?.SetErrorMessage(errorMessage); return 0; } diff --git a/Assets/Scripts/Core/Modules/SimulationService.cs b/Assets/Scripts/Core/Modules/SimulationService.cs index 17efd31f..c5c7365b 100644 --- a/Assets/Scripts/Core/Modules/SimulationService.cs +++ b/Assets/Scripts/Core/Modules/SimulationService.cs @@ -54,7 +54,7 @@ public SimulationService(in int port = 8080) } catch (Exception ex) { var errMessage = "Failed to start SimulationService: " + ex.Message; - Main.Display?.SetErrorMessage(errMessage); + Main.UIController?.SetErrorMessage(errMessage); Debug.LogError(errMessage); } } diff --git a/Assets/Scripts/Core/ObjectSpawning.cs b/Assets/Scripts/Core/ObjectSpawning.cs index 2ef773be..eb56eb9e 100644 --- a/Assets/Scripts/Core/ObjectSpawning.cs +++ b/Assets/Scripts/Core/ObjectSpawning.cs @@ -18,8 +18,9 @@ public enum PropsType { BOX = 0, CYLINDER = 1, SPHERE = 2 }; private static PhysicMaterial _propsPhysicalMaterial = null; private static Material _propMaterial = null; - private GameObject propsRoot = null; - private Camera mainCam = null; + private GameObject _propsRoot = null; + private Camera _mainCam = null; + private UIController _uiController = null; private RuntimeGizmos.TransformGizmo transformGizmo = null; private FollowingTargetList _followingList = null; @@ -30,7 +31,7 @@ public enum PropsType { BOX = 0, CYLINDER = 1, SPHERE = 2 }; private Dictionary propsCount = new Dictionary(); private float _scaleFactor = 0.5f; - private int propType = 0; + private PropsType _propType = 0; private const float UnitMass = 3f; @@ -39,17 +40,18 @@ public void SetScaleFactor(in float value) _scaleFactor = value; } - public void SetPropType(in int value) + public void SetPropType(in PropsType value) { - propType = value; + _propType = value; } void Awake() { _propMaterial = SDF2Unity.Material.Create(); _propsPhysicalMaterial = Resources.Load("PhysicsMaterials/Props"); - propsRoot = GameObject.Find("Props"); - mainCam = Camera.main; + _propsRoot = GameObject.Find("Props"); + _mainCam = Camera.main; + _uiController = Main.UIObject?.GetComponent(); transformGizmo = Main.Gizmos; if (Main.UIMainCanvas != null) @@ -74,17 +76,17 @@ void LateUpdate() if (leftControlPressed) { - if (Input.GetMouseButtonDown(0)) + if (Input.GetMouseButtonUp(0)) { // Add On left click spawn // selected prefab and align its rotation to a surface normal if (GetPositionAndNormalOnClick(out var hitPoint, out var hitNormal)) { var propsScale = Vector3.one * _scaleFactor; - StartCoroutine(SpawnTargetObject((PropsType)propType, hitPoint, hitNormal, propsScale)); + StartCoroutine(SpawnTargetObject((PropsType)_propType, hitPoint, hitNormal, propsScale)); } } - else if (Input.GetMouseButtonDown(1)) + else if (Input.GetMouseButtonUp(1)) { // Remove spawned prefab when holding left control and right clicking var selectedPropsTransform = GetTransformOnClick(); @@ -94,7 +96,19 @@ void LateUpdate() } } } - else if (Input.GetKey(KeyCode.Delete)) + else if (Input.GetKeyUp(KeyCode.Alpha1)) + { + ChnagePropType(PropsType.BOX); + } + else if (Input.GetKeyUp(KeyCode.Alpha2)) + { + ChnagePropType(PropsType.CYLINDER); + } + else if (Input.GetKeyUp(KeyCode.Alpha3)) + { + ChnagePropType(PropsType.SPHERE); + } + else if (Input.GetKeyUp(KeyCode.Delete)) { transformGizmo.GetSelectedTargets(out var list); StartCoroutine(DeleteTargetObject(list)); @@ -102,6 +116,14 @@ void LateUpdate() } } + private void ChnagePropType(in PropsType type) + { + if (!_uiController.IsScaleFieldFocused()) + { + SetPropType(type); + } + } + private IEnumerator SpawnTargetObject(PropsType type, Vector3 position, Vector3 normal, Vector3 scale) { GameObject spawnedObject = null; @@ -125,13 +147,13 @@ private IEnumerator SpawnTargetObject(PropsType type, Vector3 position, Vector3 break; case PropsType.SPHERE: - mesh = ProceduralMesh.CreateSphere(0.5f, 11, 11); + mesh = ProceduralMesh.CreateSphere(0.5f, 13, 13); break; } if (mesh != null) { - var newTempPropsObject = CreateProps(type.ToString(), mesh, scale); + var newTempPropsObject = CreateUnitProps(type, mesh); props.Add(type, newTempPropsObject); newTempPropsObject.hideFlags = HideFlags.DontSaveInEditor | HideFlags.DontSave; newTempPropsObject.SetActive(false); @@ -172,7 +194,7 @@ private IEnumerator SpawnTargetObject(PropsType type, Vector3 position, Vector3 spawanedObjectTransform.rotation = Quaternion.FromToRotation(spawanedObjectTransform.up, normal); spawnedObject.transform.localScale = scale; - spawnedObject.transform.SetParent(propsRoot.transform); + spawnedObject.transform.SetParent(_propsRoot.transform); yield return null; } @@ -182,9 +204,9 @@ private float CalculateMass(in Vector3 scale) return (scale.x + scale.y + scale.z) / 3 * UnitMass; } - private GameObject CreateProps(in string name, in Mesh targetMesh, in Vector3 scale) + private GameObject CreateUnitProps(in PropsType type, in Mesh targetMesh) { - var newObject = new GameObject(name); + var newObject = new GameObject(type.ToString()); newObject.tag = "Props"; newObject.isStatic = true; @@ -199,11 +221,29 @@ private GameObject CreateProps(in string name, in Mesh targetMesh, in Vector3 sc meshRenderer.material.name = targetMesh.name; meshRenderer.material.color = Color.white; - var meshCollider = newObject.AddComponent(); - meshCollider.sharedMesh = targetMesh; - meshCollider.sharedMaterial = _propsPhysicalMaterial; - meshCollider.convex = true; - meshCollider.isTrigger = false; + switch (type) + { + case PropsType.BOX: + var boxCollider = newObject.AddComponent(); + boxCollider.center = Vector3.zero; + boxCollider.size = Vector3.one; + break; + + case PropsType.SPHERE: + var sphereCollider = newObject.AddComponent(); + sphereCollider.center = Vector3.zero; + sphereCollider.radius = 0.5f; + break; + + case PropsType.CYLINDER: + default: + var meshCollider = newObject.AddComponent(); + meshCollider.sharedMesh = targetMesh; + meshCollider.sharedMaterial = _propsPhysicalMaterial; + meshCollider.convex = true; + meshCollider.isTrigger = false; + break; + } var rigidBody = newObject.AddComponent(); rigidBody.mass = 1; @@ -252,7 +292,7 @@ private IEnumerator DeleteTargetObject(List targetObjectsTransform) private bool GetPositionAndNormalOnClick(out Vector3 hitPoint, out Vector3 hitNormal) { - var ray = mainCam.ScreenPointToRay(Input.mousePosition); + var ray = _mainCam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out var hit, maxRayDistance)) { hitPoint = hit.point; // 0 = spawn poisiton @@ -270,7 +310,7 @@ private bool GetPositionAndNormalOnClick(out Vector3 hitPoint, out Vector3 hitNo private Transform GetTransformOnClick() { - var screenPoint2Ray = mainCam.ScreenPointToRay(Input.mousePosition); + var screenPoint2Ray = _mainCam.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(screenPoint2Ray, out var hit, maxRayDistance)) { diff --git a/Assets/Scripts/WorldSaver.cs b/Assets/Scripts/Core/WorldSaver.cs similarity index 100% rename from Assets/Scripts/WorldSaver.cs rename to Assets/Scripts/Core/WorldSaver.cs diff --git a/Assets/Scripts/WorldSaver.cs.meta b/Assets/Scripts/Core/WorldSaver.cs.meta similarity index 100% rename from Assets/Scripts/WorldSaver.cs.meta rename to Assets/Scripts/Core/WorldSaver.cs.meta diff --git a/Assets/Scripts/Main.cs b/Assets/Scripts/Main.cs index d5ef270e..2bf67912 100644 --- a/Assets/Scripts/Main.cs +++ b/Assets/Scripts/Main.cs @@ -38,7 +38,7 @@ public class Main : MonoBehaviour private static GameObject _uiRoot = null; private static GameObject _uiMainCanvasRoot = null; - private static SimulationDisplay _simulationDisplay = null; + private static UIController _uiController = null; private static InfoDisplay _infoDisplay = null; private static WorldNavMeshBuilder _worldNavMeshBuilder = null; private static RuntimeGizmos.TransformGizmo _transformGizmo = null; @@ -47,6 +47,7 @@ public class Main : MonoBehaviour private static MeshProcess.VHACD _vhacd = null; private static ObjectSpawning _objectSpawning = null; private static Main _instance = null; + private static Pose _cameraInitPose = Pose.identity; private static bool _isResetting = false; private static bool _resetTriggered = false; @@ -59,7 +60,7 @@ public class Main : MonoBehaviour public static GameObject UIMainCanvas => _uiMainCanvasRoot; public static RuntimeGizmos.TransformGizmo Gizmos => _transformGizmo; public static ObjectSpawning ObjectSpawning => _objectSpawning; - public static SimulationDisplay Display => _simulationDisplay; + public static UIController UIController => _uiController; public static InfoDisplay InfoDisplay => _infoDisplay; public static WorldNavMeshBuilder WorldNavMeshBuilder => _worldNavMeshBuilder; public static BridgeManager BridgeManager => _bridgeManager; @@ -67,6 +68,11 @@ public class Main : MonoBehaviour public static CameraControl CameraControl => _cameraControl; public static MeshProcess.VHACD MeshVHACD => _vhacd; public static Main Instance => _instance; + public static Pose CameraInitPose + { + get => _cameraInitPose; + set => _cameraInitPose = value; + } #region SDF Parser private SDF.Root _sdfRoot = null; @@ -242,7 +248,7 @@ void Awake() { _infoDisplay = _uiRoot.GetComponentInChildren(); _transformGizmo = _uiRoot.GetComponentInChildren(); - _simulationDisplay = _uiRoot.GetComponentInChildren(); + _uiController = _uiRoot.GetComponent(); _uiMainCanvasRoot = _uiRoot.transform.Find("Main Canvas").gameObject; _followingList = _uiMainCanvasRoot.GetComponentInChildren(); @@ -271,7 +277,7 @@ void Start() if (!SystemInfo.supportsAsyncGPUReadback) { Debug.LogError("This API does not support AsyncGPURreadback."); - _simulationDisplay?.SetErrorMessage("This API does not support AsyncGPURreadback."); + _uiController?.SetErrorMessage("This API does not support AsyncGPURreadback."); return; } @@ -306,7 +312,7 @@ void Start() if (!doNotLoad && !string.IsNullOrEmpty(worldFileName)) { - _simulationDisplay?.SetEventMessage("Start to load world file: " + worldFileName); + _uiController?.SetEventMessage("Start to load world file: " + worldFileName); StartCoroutine(LoadWorld()); } } @@ -449,7 +455,7 @@ private IEnumerator LoadWorld() { var errorMessage = "Parsing failed!!! Failed to load world file: " + worldFileName; Debug.LogError(errorMessage); - _simulationDisplay?.SetErrorMessage(errorMessage); + _uiController?.SetErrorMessage(errorMessage); } _bridgeManager.PrintLog(); diff --git a/Assets/Scripts/Tools/DebugLogWriter.cs b/Assets/Scripts/Tools/DebugLogWriter.cs index b1cb953d..1ff985c0 100644 --- a/Assets/Scripts/Tools/DebugLogWriter.cs +++ b/Assets/Scripts/Tools/DebugLogWriter.cs @@ -48,7 +48,7 @@ private void Print(in string value) Debug.LogWarning(value); if (showOnDisplay) { - Main.Display?.SetErrorMessage(value); + Main.UIController?.SetErrorMessage(value); showOnDisplay = false; } } @@ -57,7 +57,7 @@ private void Print(in string value) Debug.Log(value); if (showOnDisplay) { - Main.Display?.SetEventMessage(value); + Main.UIController?.SetEventMessage(value); showOnDisplay = false; } } diff --git a/Assets/Scripts/Tools/Mesh/ProceduralHeightmap.cs b/Assets/Scripts/Tools/Mesh/ProceduralHeightmap.cs index cab64ddb..5bd78308 100644 --- a/Assets/Scripts/Tools/Mesh/ProceduralHeightmap.cs +++ b/Assets/Scripts/Tools/Mesh/ProceduralHeightmap.cs @@ -7,7 +7,6 @@ using UnityEngine; using System.IO; using System.Drawing; -using System.Drawing.Imaging; using System; public class ProceduralHeightmap diff --git a/Assets/Scripts/Tools/SDF/Import/Import.World.cs b/Assets/Scripts/Tools/SDF/Import/Import.World.cs index f9bc3fd2..dbcdc6c0 100644 --- a/Assets/Scripts/Tools/SDF/Import/Import.World.cs +++ b/Assets/Scripts/Tools/SDF/Import/Import.World.cs @@ -22,7 +22,7 @@ protected override System.Object ImportWorld(in World world) // Debug.Log("Import World"); if (world.gui != null) { - var mainCamera = UnityEngine.Camera.main; + var mainCamera = UE.Camera.main; if (mainCamera != null && world.gui.camera != null) { var cameraPose = world.gui.camera.Pose; @@ -30,6 +30,8 @@ protected override System.Object ImportWorld(in World world) mainCamera.transform.localRotation = SDF2Unity.Rotation(cameraPose?.Rot); } + Main.CameraInitPose = new UE.Pose(mainCamera.transform.localPosition, mainCamera.transform.localRotation); + UE.Screen.fullScreen = world.gui.fullscreen; if (world.gui.fullscreen) { @@ -42,7 +44,7 @@ protected override System.Object ImportWorld(in World world) // for (int i = 0; i < UE.Screen.resolutions.Length; i++) // UE.Debug.Log(UE.Screen.resolutions[i]); var selectedResolution = UE.Screen.resolutions[resolutionIndex]; - UE.Debug.Log($"SelectedWindowResolution={selectedResolution}"); + // UE.Debug.Log($"SelectedWindowResolution={selectedResolution}"); UE.Screen.SetResolution(selectedResolution.width, selectedResolution.height, UE.FullScreenMode.Windowed); } @@ -67,7 +69,7 @@ protected override System.Object ImportWorld(in World world) ImportRoads(world.GetRoads()); - UnityEngine.Physics.gravity = SDF2Unity.Direction(world.gravity); + UE.Physics.gravity = SDF2Unity.Direction(world.gravity); ImportLights(world.GetLights()); diff --git a/Assets/Scripts/UI/CameraControl.cs b/Assets/Scripts/UI/CameraControl.cs index e8f30b5d..c8bd88a6 100644 --- a/Assets/Scripts/UI/CameraControl.cs +++ b/Assets/Scripts/UI/CameraControl.cs @@ -4,9 +4,11 @@ * SPDX-License-Identifier: MIT */ +using System.Collections; using UnityEngine; using UnityEngine.EventSystems; +[DefaultExecutionOrder(90)] public class CameraControl : MonoBehaviour { /* @@ -25,31 +27,56 @@ Converted to C# 27-02-13 - no credit wanted. private bool _verticalMovementLock = false; + private UIController _uiController = null; + public bool VerticalMovementLock { set => _verticalMovementLock = value; get => _verticalMovementLock; } - public float mainSpeed = 10.0f; //regular speed - public float shiftAdd = 20.0f; //multiplied by how long shift is held. Basically running - public float maxShift = 50.0f; //Maximum speed when holding shift - public float camSens = 0.1f; //How sensitive it with mouse - public float edgeWidth = 100.0f; - public float edgeSens = 0.02f; - public float edgeSensMax = 1.0f; - public float wheelMoveAmp = 50f; - public float angleStep = 1.5f; + private const float MoveSmoothSpeed = .05f; + + [SerializeField] + private float _mainSpeed = 10.0f; // regular speed + + [SerializeField] + private float _shiftAdd = 20.0f; // multiplied by how long shift is held. Basically running + + [SerializeField] + private float _maxShift = 50.0f; // Maximum speed when holding shift + + [SerializeField] + private float _camSens = 0.1f; // How sensitive it with mouse + + [SerializeField] + private float _edgeWidth = 100.0f; - private Vector3 lastMouse = new Vector3(255, 255, 255); //kind of in the middle of the screen, rather than at the top (play) - private float totalRun = 1.0f; - private float edgeSensAccumlated = 0.0f; + [SerializeField] + private float _edgeSens = 0.02f; + + [SerializeField] + private float _edgeSensMax = 1.0f; + + [SerializeField] + private float _wheelMoveAmp = 50f; + + [SerializeField] + private float _angleStep = 1.5f; + + private Vector3 _lastMouse = new Vector3(255, 255, 255); // kind of in the middle of the screen, rather than at the top (play) + private float _totalRun = 1.0f; + private float _edgeSensAccumlated = 0.0f; private int _targetLayerMask = 0; + Coroutine _movingCoroutine = null; + void Awake() { _targetLayerMask = LayerMask.GetMask("Default"); + _uiController = Main.UIObject?.GetComponent(); + // Debug.Log(_uiController);; } void LateUpdate() @@ -63,13 +90,14 @@ void LateUpdate() { _verticalMovementLock = !_verticalMovementLock; // Debug.Log(_verticalMovementLock); + _uiController.SetVerticalMovementLockToggle(_verticalMovementLock); } - lastMouse = Input.mousePosition - lastMouse; - lastMouse.Set(-lastMouse.y * camSens, lastMouse.x * camSens, 0); - lastMouse.Set(transform.eulerAngles.x + lastMouse.x, transform.eulerAngles.y + lastMouse.y , 0); + _lastMouse = Input.mousePosition - _lastMouse; + _lastMouse.Set(-_lastMouse.y * _camSens, _lastMouse.x * _camSens, 0); + _lastMouse.Set(transform.eulerAngles.x + _lastMouse.x, transform.eulerAngles.y + _lastMouse.y, 0); - //Mouse camera angle done. + // Mouse camera angle done. if (Input.GetMouseButton(0)) { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); @@ -85,64 +113,63 @@ void LateUpdate() else if (Input.GetMouseButton(2) || Input.GetMouseButton(1)) { // perspective move during the right or wheel click - // Debug.Log(lastMouse.ToString("F4")); - - if (edgeSensAccumlated < edgeSensMax) + // Debug.Log(_lastMouse.ToString("F4")); + if (_edgeSensAccumlated < _edgeSensMax) { - edgeSensAccumlated += edgeSens; + _edgeSensAccumlated += _edgeSens; } - if (Input.mousePosition.x < edgeWidth) + if (Input.mousePosition.x < _edgeWidth) { // Debug.Log("rotate camera left here"); - lastMouse.y -= edgeSensAccumlated; - transform.eulerAngles = lastMouse; + _lastMouse.y -= _edgeSensAccumlated; + transform.eulerAngles = _lastMouse; } - else if (Input.mousePosition.x > Screen.width - edgeWidth) + else if (Input.mousePosition.x > Screen.width - _edgeWidth) { // Debug.Log("rotate camera right here"); - lastMouse.y += edgeSensAccumlated; - transform.eulerAngles = lastMouse; + _lastMouse.y += _edgeSensAccumlated; + transform.eulerAngles = _lastMouse; } - else if (Input.mousePosition.y < edgeWidth) + else if (Input.mousePosition.y < _edgeWidth) { // Debug.Log("rotate camera down here"); - lastMouse.x += edgeSensAccumlated; - transform.eulerAngles = lastMouse; + _lastMouse.x += _edgeSensAccumlated; + transform.eulerAngles = _lastMouse; } - else if (Input.mousePosition.y > Screen.height - edgeWidth) + else if (Input.mousePosition.y > Screen.height - _edgeWidth) { // Debug.Log("rotate camera up here"); - lastMouse.x -= edgeSensAccumlated; - transform.eulerAngles = lastMouse; + _lastMouse.x -= _edgeSensAccumlated; + transform.eulerAngles = _lastMouse; } else { - edgeSensAccumlated = 0.0f; - transform.eulerAngles = lastMouse; + _edgeSensAccumlated = 0.0f; + transform.eulerAngles = _lastMouse; } } else { - edgeSensAccumlated = 0.0f; + _edgeSensAccumlated = 0.0f; } - lastMouse = Input.mousePosition; + _lastMouse = Input.mousePosition; // Keyboard commands for Translation var p = GetBaseInput(); if (Input.GetKey(KeyCode.LeftShift)) { - totalRun += Time.deltaTime; - p *= (totalRun * shiftAdd); - p.x = Mathf.Clamp(p.x, -maxShift, maxShift); - p.y = Mathf.Clamp(p.y, -maxShift, maxShift); - p.z = Mathf.Clamp(p.z, -maxShift, maxShift); + _totalRun += Time.deltaTime; + p *= (_totalRun * _shiftAdd); + p.x = Mathf.Clamp(p.x, -_maxShift, _maxShift); + p.y = Mathf.Clamp(p.y, -_maxShift, _maxShift); + p.z = Mathf.Clamp(p.z, -_maxShift, _maxShift); } else { - totalRun = Mathf.Clamp(totalRun * 0.5f, 1f, 1000f); - p *= mainSpeed; + _totalRun = Mathf.Clamp(_totalRun * 0.5f, 1f, 1000f); + p *= _mainSpeed; } p *= Time.deltaTime; @@ -171,11 +198,11 @@ private void Rotate() { if (Input.GetKey(KeyCode.Q)) { - transform.RotateAround(transform.position, Vector3.up, -angleStep); + transform.RotateAround(transform.position, Vector3.up, -_angleStep); } else if (Input.GetKey(KeyCode.E)) { - transform.RotateAround(transform.position, Vector3.up, angleStep); + transform.RotateAround(transform.position, Vector3.up, _angleStep); } } } @@ -205,7 +232,7 @@ private Vector3 GetBaseInput() var scrollWheel = Input.GetAxisRaw("Mouse ScrollWheel"); if (scrollWheel != 0) { - baseDirection += new Vector3(0, 0, Input.mouseScrollDelta.y * wheelMoveAmp); + baseDirection += new Vector3(0, 0, Input.mouseScrollDelta.y * _wheelMoveAmp); // Debug.Log(scrollWheel.ToString("F4") + " | " + Input.mouseScrollDelta.y); } } @@ -247,4 +274,29 @@ private Vector3 GetBaseInput() return baseDirection; } + + public void Move(Pose targetPose) + { + if (_movingCoroutine != null) + { + StopCoroutine(_movingCoroutine); + } + _movingCoroutine = StartCoroutine(ChangeCameraView(targetPose)); + } + + private IEnumerator ChangeCameraView(Pose targetPose) + { + while ( + Vector3.Distance(transform.position, targetPose.position) > Vector3.kEpsilon && + Quaternion.Angle(transform.rotation, targetPose.rotation) > Quaternion.kEpsilon) + { + var smoothPosition = Vector3.Lerp(transform.position, targetPose.position, MoveSmoothSpeed); + transform.position = smoothPosition; + + var smoothRotation = Quaternion.Lerp(transform.rotation, targetPose.rotation, MoveSmoothSpeed); + transform.rotation = smoothRotation; + + yield return null; + } + } } \ No newline at end of file diff --git a/Assets/Scripts/UI/FollowingCamera.cs b/Assets/Scripts/UI/FollowingCamera.cs index d571dc04..0e0a7499 100644 --- a/Assets/Scripts/UI/FollowingCamera.cs +++ b/Assets/Scripts/UI/FollowingCamera.cs @@ -104,7 +104,7 @@ public void SetTargetObject(in string targetObjectName) } else { - Main.Display?.SetWarningMessage("'" + targetObjectName + "' model seems removed from the world."); + Main.UIController?.SetWarningMessage("'" + targetObjectName + "' model seems removed from the world."); ReleaseTargetObject(); } } @@ -118,7 +118,7 @@ private void ReleaseTargetObject() { if (targetObjectTransform != null && !ReferenceEquals(targetObjectTransform.gameObject, null)) { - Main.Display?.SetInfoMessage("Camera view for '" + targetObjectTransform.name + "' model is released."); + Main.UIController?.SetInfoMessage("Camera view for '" + targetObjectTransform.name + "' model is released."); } targetObjectTransform = null; isFollowing = false; @@ -128,7 +128,7 @@ private void ReleaseTargetObject() private void LockTargetObject(in Transform targetTransform) { - Main.Display?.SetInfoMessage("Camera view for '" + targetTransform.name + "' model is locked."); + Main.UIController?.SetInfoMessage("Camera view for '" + targetTransform.name + "' model is locked."); targetObjectTransform = targetTransform; isFollowing = true; Main.CameraControl?.BlockControl(); diff --git a/Assets/Scripts/UI/FollowingTargetList.cs b/Assets/Scripts/UI/FollowingTargetList.cs index 2cbb1d03..da752dca 100644 --- a/Assets/Scripts/UI/FollowingTargetList.cs +++ b/Assets/Scripts/UI/FollowingTargetList.cs @@ -79,7 +79,7 @@ void LateUpdate() { if (objectListForFollowing.Count > 1) { - Main.Display?.SetWarningMessage("Multiple Object is selected. Only single object can be followed."); + Main.UIController?.SetWarningMessage("Multiple Object is selected. Only single object can be followed."); } foreach (var target in objectListForFollowing) diff --git a/Assets/Scripts/UI/ModelImporter.cs b/Assets/Scripts/UI/ModelImporter.cs index ae3e480d..f8710d8f 100644 --- a/Assets/Scripts/UI/ModelImporter.cs +++ b/Assets/Scripts/UI/ModelImporter.cs @@ -224,7 +224,7 @@ void LateUpdate() { if (objectListForCopy.Count > 1) { - Main.Display?.SetWarningMessage("Multiple Object is selected. Only single object can be copied."); + Main.UIController?.SetWarningMessage("Multiple Object is selected. Only single object can be copied."); } _targetObjectForCopy = objectListForCopy[objectListForCopy.Count - 1]; diff --git a/Assets/Scripts/UI/SimulationDisplay.Help.cs b/Assets/Scripts/UI/SimulationDisplay.Help.cs deleted file mode 100644 index 43352ba6..00000000 --- a/Assets/Scripts/UI/SimulationDisplay.Help.cs +++ /dev/null @@ -1,151 +0,0 @@ -/* - * Copyright (c) 2020 LG Electronics Inc. - * - * SPDX-License-Identifier: MIT - */ - -using System.Text; -using UnityEngine; - -public partial class SimulationDisplay : MonoBehaviour -{ - [Header("Help dialog")] - private StringBuilder _sbOption = new StringBuilder(45); - private GUIContent helpContents = new GUIContent(); - private float helpContentsHeight; - private const int buttonWidthHelp = 45; - private bool popupHelpDialog = false; - private Vector2 scrollPosition = Vector2.zero; - - private RectOffset padding; - private Rect viewRect; - - private void UpdateHelpContents() - { - var sb = new StringBuilder(); - sb.AppendLine("How to manipulate"); - sb.AppendLine(string.Empty); - sb.AppendLine(" - General"); - sb.AppendLine(string.Empty); - sb.AppendLine(" Left Ctrl + R: Reset simulation"); - sb.AppendLine(" Left Ctrl + Left Shift + R: simulation Full reset like restart"); - sb.AppendLine(" Left Ctrl + C: Copy Selected object (supports only single object)"); - sb.AppendLine(" Left Ctrl + V: Past copied object"); - sb.AppendLine(" Left Ctrl + S: Save current world"); - sb.AppendLine(string.Empty); - sb.AppendLine(string.Empty); - sb.AppendLine(" - Object Control"); - sb.AppendLine(string.Empty); - sb.AppendLine(" Selection/Deselection: Mouse Left click"); - sb.AppendLine(" Select static object: + Left Alt"); - sb.AppendLine(" Multiple(Adding) Selection/Deseletion: + Left Shift"); - sb.AppendLine(string.Empty); - sb.AppendLine(" After select object you want, press the key as following."); - sb.AppendLine(" T: Translation"); - sb.AppendLine(" R: Rotation"); - sb.AppendLine(" Y: Translation + Rotation"); - sb.AppendLine(" X: Change manipulation space"); - sb.AppendLine(" X: Change manipulation space"); - sb.AppendLine(" Move Axis Arrow or plane handle: move the object"); - sb.AppendLine(" Snapping(optional): + Shift"); - sb.AppendLine(string.Empty); - sb.AppendLine(string.Empty); - sb.AppendLine("- Object spawning: choose one of model on the top of screen. [Box], [Cylinder], [Sphere]"); - sb.AppendLine(string.Empty); - sb.AppendLine(" Choose Prop by Number Key"); - sb.AppendLine(" 1: [Box]"); - sb.AppendLine(" 1: [Cylinder]"); - sb.AppendLine(" 2: [Sphere]"); - sb.AppendLine(" Pressing Left Ctrl key and,"); - sb.AppendLine(" Spawning: + Mouse Left Click on the cursor"); - sb.AppendLine(" Remove: + Mouse Right Click on the object already spawned"); - sb.AppendLine(" Remove: Press delete key after select the object."); - sb.AppendLine(string.Empty); - sb.AppendLine(string.Empty); - sb.AppendLine(" - Camera following mode"); - sb.AppendLine(string.Empty); - sb.AppendLine(" Choose one object from the list on the bottom right corner."); - sb.AppendLine(" if you want cancel the following mode, choose 'UNFOLLOWING' menu from the list."); - sb.AppendLine(" Select object and Left Ctrl + F: Follow the object"); - sb.AppendLine(" Left Ctrl + Left Shift + F: Unfollow"); - sb.AppendLine(string.Empty); - sb.AppendLine(string.Empty); - sb.AppendLine(" - Camera Control: Camera control is quite intuitive like a FPS game (W/S/A/D + R/F)"); - sb.AppendLine(string.Empty); - sb.AppendLine(" W or Mouse Scroll Up: Move Forward"); - sb.AppendLine(" S or Mouse Scroll Down: Move Backward"); - sb.AppendLine(" A: Move Left(sidestep left)"); - sb.AppendLine(" D: Move Right(sidestep right)"); - sb.AppendLine(" Q: Turn Left"); - sb.AppendLine(" E: Turn Right"); - sb.AppendLine(" R: Move upward"); - sb.AppendLine(" F: Move downward"); - sb.AppendLine(" Space: moving only on current plane(XZ plane). It's toggling."); - sb.AppendLine(string.Empty); - sb.AppendLine(string.Empty); - sb.AppendLine(" - Change camera view-port(screen)"); - sb.AppendLine(" Moving cursor pressing center button or rigth button on the mouse"); - sb.AppendLine(string.Empty); - sb.AppendLine(" @ Let me know if you are stuck in any trouble :)"); - sb.AppendLine(string.Empty); - - var lines = sb.ToString().Split(new string[] { System.Environment.NewLine }, System.StringSplitOptions.None).Length; - helpContentsHeight = (int)(lines * labelFontSize * 1.2); - helpContents.text = sb.ToString(); - - viewRect = new Rect(0, 0, rectDialog.width - 20, helpContentsHeight); - } - - private void DrawHelpDialog() - { - var dialogWidth = Screen.width * 0.8f; - var dialogHeight = Screen.height * 0.85f; - rectDialog.x = Screen.width * 0.5f - dialogWidth * 0.5f; - rectDialog.y = Screen.height * 0.5f - dialogHeight * 0.5f; - rectDialog.width = dialogWidth; - rectDialog.height = dialogHeight; - - style.alignment = TextAnchor.UpperLeft; - style.padding = padding; - style.fontSize = labelFontSize; - style.richText = true; - style.wordWrap = true; - style.normal.textColor = Color.white; - style.normal.background = textureBackground; - - viewRect.width = rectDialog.width - 20; - scrollPosition = GUI.BeginScrollView(rectDialog, scrollPosition, viewRect, false, true); - GUI.Label(new Rect(0, 0, rectDialog.width - 16, helpContentsHeight), helpContents, style); - GUI.EndScrollView(); - - style.padding = zeroPadding; - style.normal.background = null; - } - - private void DrawHelpInfo() - { - style.fontSize = labelFontSize; - style.wordWrap = true; - style.clipping = TextClipping.Overflow; - style.stretchHeight = false; - style.stretchWidth = false; - - GUI.skin.button.normal.textColor = Color.white; - GUI.skin.button.alignment = TextAnchor.MiddleCenter; - if (GUI.Button(rectHelpButton, "Help")) - { - popupHelpDialog = !popupHelpDialog; - } - - style.fontSize = (int)(labelFontSize * 0.8f); - style.alignment = TextAnchor.MiddleLeft; - style.normal.textColor = Color.white; - - _sbOption.Clear(); - _sbOption.Append("Lock Vertical Moving"); - var checkValue = (cameraControl != null && cameraControl.VerticalMovementLock) ? "[X]" : "[ ]"; - _sbOption.Append(checkValue); - // var helpStatusMsg2 = "\nStatic Object Selectable(O) " + ((cameraControl.VerticalMovementLock)? "[V]":"[ ]"); - DrawLabelWithShadow(rectOption, _sbOption.ToString()); - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/SimulationDisplay.Help.cs.meta b/Assets/Scripts/UI/SimulationDisplay.Help.cs.meta deleted file mode 100644 index ab317d12..00000000 --- a/Assets/Scripts/UI/SimulationDisplay.Help.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: d93532f41dcff8f908dd379fdfcb3f41 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UI/SimulationDisplay.Props.cs b/Assets/Scripts/UI/SimulationDisplay.Props.cs deleted file mode 100644 index 2689f008..00000000 --- a/Assets/Scripts/UI/SimulationDisplay.Props.cs +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2020 LG Electronics Inc. - * - * SPDX-License-Identifier: MIT - */ - -using UnityEngine; - -public partial class SimulationDisplay : MonoBehaviour -{ - [Header("Properties for Props menu")] - private const float guiHeight = 25f; - private const float toolbarWidth = 190f; - private readonly string[] toolbarStrings = new string[] { "Box", "Cylinder", "Sphere" }; - private string scaleFactorString = "0.5"; - private int _toolbarSelected = 0; - private string prevScaleFactorString; - private bool checkScaleFactorFocused = false; - private bool doCheckScaleFactorValue = false; - private RectOffset zeroPadding; - private bool isChangingScaleFactor = false; - - private void DrawPropsMenus() - { - style.fontSize = labelFontSize; - style.wordWrap = true; - style.padding = zeroPadding; - style.alignment = TextAnchor.MiddleCenter; - style.clipping = TextClipping.Overflow; - style.stretchHeight = false; - style.stretchWidth = false; - - style.normal.textColor = Color.white; - rectToolbar.x = Screen.width * 0.5f - toolbarWidth * 0.5f; - _toolbarSelected = GUI.Toolbar(rectToolbar, _toolbarSelected, toolbarStrings); - - var rectToolbarLabel = rectToolbar; - rectToolbarLabel.x -= 45; - rectToolbarLabel.width = 45; - - style.normal.textColor = Color.white; - DrawLabelWithShadow(rectToolbarLabel, "Props"); - - var rectScaleLabel = rectToolbar; - rectScaleLabel.x += (toolbarWidth + 10); - rectScaleLabel.width = 35; - style.normal.textColor = Color.white; - DrawLabelWithShadow(rectScaleLabel, "Size"); - - var rectScale = rectScaleLabel; - rectScale.x += (rectScaleLabel.width); - rectScale.width = 45; - GUI.SetNextControlName("ScaleField"); - GUI.skin.textField.normal.textColor = Color.white; - GUI.skin.textField.alignment = TextAnchor.MiddleCenter; - scaleFactorString = GUI.TextField(rectScale, scaleFactorString, 5); - - isChangingScaleFactor = (GUI.GetNameOfFocusedControl().CompareTo("ScaleField") == 0); - - rectHelpButton.x = rectScale.x + rectScale.width + textRightMargin * 5; - - if (checkScaleFactorFocused && !GUI.GetNameOfFocusedControl().Equals("ScaleField")) - { - doCheckScaleFactorValue = true; - checkScaleFactorFocused = false; - // Debug.Log("Focused out!!"); - } - else if (!checkScaleFactorFocused && GUI.GetNameOfFocusedControl().Equals("ScaleField")) - { - // Debug.Log("Focused!!!"); - checkScaleFactorFocused = true; - prevScaleFactorString = scaleFactorString; - } - - if (doCheckScaleFactorValue) - { - // Debug.Log("Do check!! previous " + prevScaleFactorString); - if (string.IsNullOrEmpty(scaleFactorString)) - { - scaleFactorString = prevScaleFactorString; - } - else - { - if (float.TryParse(scaleFactorString, out var scaleFactor)) - { - if (scaleFactor < 0.01f) - { - scaleFactorString = "0.01"; - scaleFactor = 0.01f; - } - else if (scaleFactor > 10f) - { - scaleFactorString = "10"; - scaleFactor = 10f; - } - } - else - { - scaleFactorString = prevScaleFactorString; - } - - Main.ObjectSpawning?.SetScaleFactor(scaleFactor); - } - - doCheckScaleFactorValue = false; - } - - Main.ObjectSpawning?.SetPropType(_toolbarSelected); - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/SimulationDisplay.Props.cs.meta b/Assets/Scripts/UI/SimulationDisplay.Props.cs.meta deleted file mode 100644 index 69d85e26..00000000 --- a/Assets/Scripts/UI/SimulationDisplay.Props.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 39b6cd0251481bbe2b48145b02294421 -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Assets/Scripts/UI/SimulationDisplay.cs b/Assets/Scripts/UI/SimulationDisplay.cs deleted file mode 100644 index ebec0c22..00000000 --- a/Assets/Scripts/UI/SimulationDisplay.cs +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright (c) 2020 LG Electronics Inc. - * - * SPDX-License-Identifier: MIT - */ - -using System.Text; -using UnityEngine; - -[DefaultExecutionOrder(50)] -public partial class SimulationDisplay : MonoBehaviour -{ - private Clock clock = null; - private CameraControl cameraControl = null; - - private StringBuilder eventMessage = new StringBuilder(); - - [Header("GUI properties")] - private const int labelFontSize = 14; - private const int textFontSize = 12; - private const int topMargin = 6; - private const int bottomMargin = 15; - private const int textLeftMargin = 10; - private const int textRightMargin = 10; - private const int textHeight = 20; - - private const int textWidthFps = 70; - private const int TextWidthPointInfo = 300; - private const int textWidthVersion = 50; - private const int textWidthSimulationInfo = 500; - private const int textWidthOptionInfo = 250; - private const int textWidthEvent = 800; - - private Color logMessageColor = Color.black; - - [Header("Rect")] - private Rect rectVersion; - private Rect rectOption; - private Rect rectSimulationInfo; - private Rect rectFps; - private Rect rectPointInfo; - private Rect rectLogMessage; - private Rect rectDialog; - private Rect rectToolbar; - private Rect rectHelpButton; - - private GUIStyle style; - private Texture2D textureBackground; - - [Header("Data")] - private string versionInfo; - - // Start is called before the first frame update - void Awake() - { - versionInfo = Application.version; - - cameraControl = GetComponentInChildren(); - clock = DeviceHelper.GetGlobalClock(); - - textureBackground = new Texture2D(1, 1, TextureFormat.RGBAFloat, false); - textureBackground.SetPixel(0, 0, new Color(0, 0, 0, 0.75f)); - textureBackground.Apply(); // not sure if this is necessary - - rectVersion = new Rect(textLeftMargin, topMargin, textWidthVersion, textHeight); - rectOption = new Rect(textWidthVersion + textRightMargin, topMargin, textWidthOptionInfo, textHeight); - rectSimulationInfo = new Rect(textLeftMargin, Screen.height - textHeight - bottomMargin, textWidthSimulationInfo, textHeight); - rectFps = new Rect(rectSimulationInfo.width + rectSimulationInfo.x, Screen.height - textHeight - bottomMargin, textWidthFps, textHeight); - rectPointInfo = new Rect(rectFps.width + rectFps.x, Screen.height - textHeight - bottomMargin, TextWidthPointInfo, textHeight); - rectLogMessage = new Rect(textLeftMargin, Screen.height - (textHeight * 2) - bottomMargin, textWidthEvent, textHeight); - - rectToolbar = new Rect(0, topMargin, toolbarWidth, guiHeight); - - rectDialog = new Rect(); - rectHelpButton = new Rect(0, topMargin, buttonWidthHelp, guiHeight); - - style = new GUIStyle(); - - padding = new RectOffset(30, 30, 30, 30); - zeroPadding = new RectOffset(0, 0, 0, 0); - - UpdateHelpContents(); - } - - public void ClearLogMessage() - { - eventMessage.Clear(); - } - - public void SetEventMessage(in string value) - { - ClearLogMessage(); - logMessageColor = Color.green; - eventMessage.Append(value); - } - - public void SetDebugMessage(in string value) - { - ClearLogMessage(); - logMessageColor = Color.blue; - eventMessage.Append(value); - } - - public void SetInfoMessage(in string value) - { - ClearLogMessage(); - logMessageColor = Color.gray; - eventMessage.Append(value); - } - - public void SetErrorMessage(in string value) - { - ClearLogMessage(); - logMessageColor = Color.red; - eventMessage.Append(value); - } - - public void SetWarningMessage(in string value) - { - ClearLogMessage(); - logMessageColor = Color.yellow; - eventMessage.Append(value); - } - - private void DrawLabelWithShadow(in Rect rect, in string value) - { - var styleShadow = new GUIStyle(style); - styleShadow.normal.textColor = new Color(0.1f, 0.1f, 0.1f, 0.70f); - - var rectShadow = rect; - rectShadow.x += 1; - rectShadow.y += 1; - GUI.Label(rectShadow, value, styleShadow); - GUI.Label(rect, value, style); - } - - private void DrawText() - { - style.alignment = TextAnchor.MiddleLeft; - style.normal.textColor = new Color(0, 0, 0, 0.80f); - style.fontStyle = FontStyle.Bold; - style.fontSize = textFontSize; - style.wordWrap = true; - style.clipping = TextClipping.Overflow; - style.stretchHeight = false; - style.stretchWidth = false; - - // version info - style.normal.textColor = Color.green; - DrawLabelWithShadow(rectVersion, versionInfo); - - // logging: error message or event message - rectLogMessage.y = Screen.height - (textHeight * 2) - bottomMargin; - style.normal.textColor = logMessageColor; - DrawLabelWithShadow(rectLogMessage, eventMessage.ToString()); - } - - void OnGUI() - { - DrawText(); - - DrawPropsMenus(); - - DrawHelpInfo(); - - if (Event.current.type.Equals(EventType.KeyUp)) - { - var keyCode = Event.current.keyCode; - if (keyCode == KeyCode.F1) - { - popupHelpDialog = !popupHelpDialog; - cameraControl.BlockMouseWheelControl(true); - } - else if (keyCode == KeyCode.Escape) - { - popupHelpDialog = false; - cameraControl.BlockMouseWheelControl(false); - } - else if (keyCode >= KeyCode.Alpha1 && keyCode <= KeyCode.Alpha9 && isChangingScaleFactor == false) - { - switch (keyCode) - { - case KeyCode.Alpha1: - _toolbarSelected = 0; - break; - case KeyCode.Alpha2: - _toolbarSelected = 1; - break; - case KeyCode.Alpha3: - _toolbarSelected = 2; - break; - } - } - } - - if (popupHelpDialog) - { - // Debug.Log("Show Help dialog"); - DrawHelpDialog(); - } - } -} \ No newline at end of file diff --git a/Assets/Scripts/UI/UIController.cs b/Assets/Scripts/UI/UIController.cs new file mode 100644 index 00000000..a730ab83 --- /dev/null +++ b/Assets/Scripts/UI/UIController.cs @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2024 LG Electronics Inc. + * + * SPDX-License-Identifier: MIT + */ + +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.UIElements; + + +public class UIController : MonoBehaviour +{ + private UIDocument _uiDocument = null; + private VisualElement _rootVisualElement = null; + private Toggle _toggleLockVerticalMoving = null; + private TextField _scaleField = null; + private Label _statusMessage = null; + private CameraControl _cameraControl = null; + + private const float CameraViewDistance = 30f; + private const float ScaleFactorMin = 0.01f; + private const float ScaleFactorMax = 10; + private string _prevScaleFactorString = string.Empty; + + // Start is called before the first frame update + void Start() + { + _cameraControl = Camera.main.GetComponent(); + var objectSpawning = Main.ObjectSpawning; + + _toggleLockVerticalMoving = _rootVisualElement.Q("LockVerticalMoving"); + _toggleLockVerticalMoving.RegisterValueChangedCallback(x => _cameraControl.VerticalMovementLock = x.newValue); + + var buttonCameraView = _rootVisualElement.Q