다이어로그, 조이스틱 에셋

This commit is contained in:
99jamin 2025-04-16 14:23:16 +09:00
parent dc2e962522
commit 0382709b1a
152 changed files with 6872 additions and 1 deletions

View File

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

View File

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

BIN
Assets/StoreAssets/DDSystem/Demo/Demo.unity (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 2ee905b7a480ead4caaece7733a17acf
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Demo_Selection.unity (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: a0bd63f07d288df4a909270e4c5cd763
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/BackGround.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: cdd462abd453053419a990cea66008bb
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/Happy.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 77fa19401d8472a498f2164bce0d7a4b
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/Normal.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 34f96a43c2ac0804b95b2e3ab9751332
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/Sa_Happy.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 055c44a6ee790d743bcf692c99bfef6c
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/Sad.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 8f01fa9aca81c9142a73bb0c759a88de
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Demo/Graphic/test02.PNG (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,127 @@
fileFormatVersion: 2
guid: 02ba6bee2195f46479dfe6cf1f0bf242
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 13
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
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: 1
wrapV: 1
wrapW: 0
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
flipbookRows: 1
flipbookColumns: 1
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
ignorePngGamma: 0
applyGammaDecoding: 1
swizzle: 50462976
cookieLightType: 1
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: 1
- 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: 1
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
ignorePlatformSupport: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 1
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 5e97eb03825dee720800000000000000
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
nameFileIdTable: {}
mipmapLimitGroupName:
pSDRemoveMatte: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

View File

@ -0,0 +1,47 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Doublsb.Dialog;
public class TestMessage : MonoBehaviour
{
public DialogManager DialogManager;
public GameObject[] Example;
private void Awake()
{
var dialogTexts = new List<DialogData>();
dialogTexts.Add(new DialogData("/size:up/Hi, /size:init/my name is Li.", "Li"));
dialogTexts.Add(new DialogData("I am Sa. Popped out to let you know Asset can show other characters.", "Sa"));
dialogTexts.Add(new DialogData("This Asset, The D'Dialog System has many features.", "Li"));
dialogTexts.Add(new DialogData("You can easily change text /color:red/color, /color:white/and /size:up//size:up/size/size:init/ like this.", "Li", () => Show_Example(0)));
dialogTexts.Add(new DialogData("Just put the command in the string!", "Li", () => Show_Example(1)));
dialogTexts.Add(new DialogData("You can also change the character's sprite /emote:Sad/like this, /click//emote:Happy/Smile.", "Li", () => Show_Example(2)));
dialogTexts.Add(new DialogData("If you need an emphasis effect, /wait:0.5/wait... /click/or click command.", "Li", () => Show_Example(3)));
dialogTexts.Add(new DialogData("Text can be /speed:down/slow... /speed:init//speed:up/or fast.", "Li", () => Show_Example(4)));
dialogTexts.Add(new DialogData("You don't even need to click on the window like this.../speed:0.1/ tada!/close/", "Li", () => Show_Example(5)));
dialogTexts.Add(new DialogData("/speed:0.1/AND YOU CAN'T SKIP THIS SENTENCE.", "Li", () => Show_Example(6), false));
dialogTexts.Add(new DialogData("And here we go, the haha sound! /click//sound:haha/haha.", "Li", null, false));
dialogTexts.Add(new DialogData("That's it! Please check the documents. Good luck to you.", "Sa"));
DialogManager.Show(dialogTexts);
}
private void Show_Example(int index)
{
Example[index].SetActive(true);
}
}

View File

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

View File

@ -0,0 +1,53 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Doublsb.Dialog;
public class TestMessage_Selection : MonoBehaviour
{
public DialogManager DialogManager;
private void Awake()
{
var dialogTexts = new List<DialogData>();
var Text1 = new DialogData("What is 2 times 5?");
Text1.SelectList.Add("Correct", "10");
Text1.SelectList.Add("Wrong", "7");
Text1.SelectList.Add("Whatever", "Why should I care?");
Text1.Callback = () => Check_Correct();
dialogTexts.Add(Text1);
DialogManager.Show(dialogTexts);
}
private void Check_Correct()
{
if(DialogManager.Result == "Correct")
{
var dialogTexts = new List<DialogData>();
dialogTexts.Add(new DialogData("You are right."));
DialogManager.Show(dialogTexts);
}
else if (DialogManager.Result == "Wrong")
{
var dialogTexts = new List<DialogData>();
dialogTexts.Add(new DialogData("You are wrong."));
DialogManager.Show(dialogTexts);
}
else
{
var dialogTexts = new List<DialogData>();
dialogTexts.Add(new DialogData("Right. You don't have to get the answer."));
DialogManager.Show(dialogTexts);
}
}
}

View File

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

View File

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

BIN
Assets/StoreAssets/DDSystem/Demo/Sound/haha.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: 7796b54b22f7f02439fc159ff0ec2b7c
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 1
normalize: 0
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: dd48e3ab03b351b44acfa892b24a4999
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

@ -0,0 +1,23 @@
fileFormatVersion: 2
guid: 17634245762b6db4d8d4c494af41f721
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontName: NanumSquare
fontNames:
- NanumSquare
fallbackFontReferences:
- {fileID: 12800000, guid: 07211f32b4445044eb6e600871cd43b3, type: 3}
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -0,0 +1,86 @@
Copyright (c) 2010, NAVER Corporation (https://www.navercorp.com/),
with Reserved Font Name Nanum, Naver Nanum, NanumGothic, Naver NanumGothic, NanumMyeongjo, Naver NanumMyeongjo, NanumBrush, Naver NanumBrush, NanumPen, Naver NanumPen, Naver NanumGothicEco, NanumGothicEco, Naver NanumMyeongjoEco, NanumMyeongjoEco, Naver NanumGothicLight, NanumGothicLight, NanumBarunGothic, Naver NanumBarunGothic, NanumSquareRound, NanumBarunPen
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
SIL OPEN FONT LICENSE
Version 1.1 - 26 February 2007
[DEFINITIONS]
"Font Software" refers to the set of files released by the Copyright Holder(s) under this license and clearly marked as such. This may include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the copyright statement(s).
"Original Version" refers to the collection of Font Software components as distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting, or substituting in part or in whole any of the components of the Original Version, by changing formats or by porting the Font Software to a new environment.¡®
"Author" refers to any designer, engineer, programmer, technical writer or other person who contributed to the Font Software.
[PREAMBLE]
The goals of the Open Font License (OFL) are to stimulate worldwide development of collaborative font projects,
to support the font creation efforts of academic and linguistic communities, and to provide a free and open framework in which fonts may be shared and improved in partnership with others.
The OFL allows the licensed fonts to be used, studied, modified and redistributed freely as long as they are not sold
by themselves. The fonts, including any derivative works, can be bundled, embedded, redistributed and/or sold with any software provided that any reserved names are not used by derivative works.
The fonts and derivatives, however, cannot be released under any other type of license.
The requirement for fonts to remain under this license does not apply to any document created using the fonts or their derivatives.
[PERMISSION & CONDITIONS]
Permission is hereby granted, free of charge, to any person obtaining a copy of the Font Software, to use, study, copy, merge, embed, modify, redistribute, and sell modified and unmodified copies of the Font Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled, redistributed and/or sold with any software, provided that each copy contains the above copyright notice and this license. These can be included either as stand-alone text files, human-readable headers or in the appropriate machine-readable metadata fields within text or binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font Name(s) unless explicit written
permission is granted by the corresponding Copyright Holder. This restriction only applies to the primary font name as presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font Software shall not be used to promote, endorse or advertise any Modified Version, except to acknowledge the contribution(s) of the Copyright Holder(s) and the Author(s) or with their explicit written permission.
5) The Font Software, modified or unmodified, in part or in whole, must be distributed entirely under this license, and must not be distributed any other license. The requirement for fonts to remain under this license does not apply to any document created using the Font Software.
[TERMINATION]
This license becomes null and void if any of the above conditions are not met.
[DISCLAIMER]
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 960570075744a5c40892b29a066c9b1f
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/DDSystem/Graphic/Window.png (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,99 @@
fileFormatVersion: 2
guid: 55032ee68f7dd5e4eadb7879c77fd938
TextureImporter:
fileIDToRecycleName: {}
externalObjects: {}
serializedVersion: 9
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: -1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 1
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 30, y: 30, z: 30, w: 30}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 8
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
platformSettings:
- serializedVersion: 2
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
- serializedVersion: 2
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID: 8c702a32294a0014ca79421cbab1b0a7
vertices: []
indices:
edges: []
weights: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

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

BIN
Assets/StoreAssets/DDSystem/Prefab/Character.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

BIN
Assets/StoreAssets/DDSystem/Prefab/DialogAsset.prefab (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

View File

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

View File

@ -0,0 +1,13 @@
using UnityEngine;
using UnityEngine.UI;
namespace Doublsb.Dialog
{
[RequireComponent(typeof(Image))]
public class Character : MonoBehaviour
{
public Emotion Emotion;
public AudioClip[] ChatSE;
public AudioClip[] CallSE;
}
}

View File

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

View File

@ -0,0 +1,398 @@
/*
The MIT License
Copyright (c) 2020 DoublSB
https://github.com/DoublSB/UnityDialogAsset
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Text.RegularExpressions;
using UnityEngine.Events;
using System.Linq;
namespace Doublsb.Dialog
{
#region Enum
public enum State
{
Active,
Wait,
Deactivate
}
public enum Command
{
print,
color,
emote,
size,
sound,
speed,
click,
close,
wait
}
public enum TextColor
{
aqua,
black,
blue,
brown,
cyan,
darkblue,
fuchsia,
green,
grey,
lightblue,
lime,
magenta,
maroon,
navy,
olive,
orange,
purple,
red,
silver,
teal,
white,
yellow
}
#endregion
#region Emotion
[Serializable]
public class Emotion
{
//================================================
//Public Variable
//================================================
private Dictionary<string, Sprite> _data;
public Dictionary<string, Sprite> Data
{
get
{
if (_data == null) _init_emotionList();
return _data;
}
}
public string[] _emotion = new string[] { "Normal" };
public Sprite[] _sprite;
//================================================
//Private Method
//================================================
private void _init_emotionList()
{
_data = new Dictionary<string, Sprite>();
if (_emotion.Length != _sprite.Length)
Debug.LogError("Emotion and Sprite have different lengths");
for (int i = 0; i < _emotion.Length; i++)
_data.Add(_emotion[i], _sprite[i]);
}
}
#endregion
/// <summary>
/// Convert string to Data. Contains List of DialogCommand and DialogFormat.
/// </summary>
public class DialogData
{
//================================================
//Public Variable
//================================================
public string Character;
public List<DialogCommand> Commands = new List<DialogCommand>();
public DialogSelect SelectList = new DialogSelect();
public DialogFormat Format = new DialogFormat();
public string PrintText = string.Empty;
public bool isSkippable = true;
public UnityAction Callback = null;
//================================================
//Public Method
//================================================
public DialogData(string originalString, string character = "", UnityAction callback = null, bool isSkipable = true)
{
_convert(originalString);
this.isSkippable = isSkipable;
this.Callback = callback;
this.Character = character;
}
//================================================
//Private Method
//================================================
private void _convert(string originalString)
{
string printText = string.Empty;
for (int i = 0; i < originalString.Length; i++)
{
if (originalString[i] != '/') printText += originalString[i];
else // If find '/'
{
// Convert last printText to command
if (printText != string.Empty)
{
Commands.Add(new DialogCommand(Command.print, printText));
printText = string.Empty;
}
// Substring /CommandSyntex/
var nextSlashIndex = originalString.IndexOf('/', i + 1);
string commandSyntex = originalString.Substring(i + 1, nextSlashIndex - i - 1);
// Add converted command
var com = _convert_Syntex_To_Command(commandSyntex);
if (com != null) Commands.Add(com);
// Move i
i = nextSlashIndex;
}
}
if (printText != string.Empty) Commands.Add(new DialogCommand(Command.print, printText));
}
private DialogCommand _convert_Syntex_To_Command(string text)
{
var spliter = text.Split(':');
Command command;
if (Enum.TryParse(spliter[0], out command))
{
if (spliter.Length >= 2) return new DialogCommand(command, spliter[1]);
else return new DialogCommand(command);
}
else
Debug.LogError("Cannot parse to commands");
return null;
}
}
/// <summary>
/// You can get RichText tagger of size and color.
/// </summary>
public class DialogFormat
{
//================================================
//Private Variable
//================================================
public string DefaultSize = "60";
private string _defaultColor = "white";
private string _color;
private string _size;
//================================================
//Public Method
//================================================
public DialogFormat(string defaultSize = "", string defaultColor = "")
{
_color = string.Empty;
_size = string.Empty;
if (defaultSize != string.Empty) DefaultSize = defaultSize;
if (defaultColor != string.Empty) _defaultColor = defaultColor;
}
public string Color
{
set
{
if (isColorValid(value))
{
_color = value;
if (_size == string.Empty) _size = DefaultSize;
}
}
get => _color;
}
public string Size
{
set
{
if (isSizeValid(value))
{
_size = value;
if (_color == string.Empty) _color = _defaultColor;
}
}
get => _size;
}
public string OpenTagger
{
get
{
if (isValid) return $"<color={Color}><size={Size}>";
else return string.Empty;
}
}
public string CloseTagger
{
get
{
if (isValid) return "</size></color>";
else return string.Empty;
}
}
public void Resize(string command)
{
if (_size == string.Empty) Size = DefaultSize;
switch (command)
{
case "up":
_size = (int.Parse(_size) + 10).ToString();
break;
case "down":
_size = (int.Parse(_size) - 10).ToString();
break;
case "init":
_size = DefaultSize;
break;
default:
_size = command;
break;
}
}
//================================================
//Private Method
//================================================
private bool isValid
{
get => _color != string.Empty && _size != string.Empty;
}
private bool isColorValid(string Color)
{
TextColor textColor;
Regex hexColor = new Regex("^#(?:[0-9a-fA-F]{3}){1,2}$");
return Enum.TryParse(Color, out textColor) || hexColor.Match(Color).Success;
}
private bool isSizeValid(string Size)
{
float size;
return float.TryParse(Size, out size);
}
}
public class DialogCommand
{
public Command Command;
public string Context;
public DialogCommand(Command command, string context = "")
{
Command = command;
Context = context;
}
}
public class DialogSelect
{
private List<DialogSelectItem> ItemList;
public DialogSelect()
{
ItemList = new List<DialogSelectItem>();
}
public int Count
{
get => ItemList.Count;
}
public DialogSelectItem GetByIndex(int index)
{
return ItemList[index];
}
public List<DialogSelectItem> Get_List()
{
return ItemList;
}
public string Get_Value(string Key)
{
return ItemList.Find((var) => var.isSameKey(Key)).Value;
}
public void Clear()
{
ItemList.Clear();
}
public void Add(string Key, string Value)
{
ItemList.Add(new DialogSelectItem(Key, Value));
}
public void Remove(string Key)
{
var item = ItemList.Find((var) => var.isSameKey(Key));
if (item != null) ItemList.Remove(item);
}
}
public class DialogSelectItem
{
public string Key;
public string Value;
public bool isSameKey(string key)
{
return Key == key;
}
public DialogSelectItem(string key, string value)
{
this.Key = key;
this.Value = value;
}
}
}

View File

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

View File

@ -0,0 +1,359 @@
/*
The MIT License
Copyright (c) 2020 DoublSB
https://github.com/DoublSB/UnityDialogAsset
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using System;
namespace Doublsb.Dialog
{
public class DialogManager : MonoBehaviour
{
//================================================
//Public Variable
//================================================
[Header("Game Objects")]
public GameObject Printer;
public GameObject Characters;
[Header("UI Objects")]
public Text Printer_Text;
[Header("Audio Objects")]
public AudioSource SEAudio;
public AudioSource CallAudio;
[Header("Preference")]
public float Delay = 0.1f;
[Header("Selector")]
public GameObject Selector;
public GameObject SelectorItem;
public Text SelectorItemText;
[HideInInspector]
public State state;
[HideInInspector]
public string Result;
//================================================
//Private Method
//================================================
private Character _current_Character;
private DialogData _current_Data;
private float _currentDelay;
private float _lastDelay;
private Coroutine _textingRoutine;
private Coroutine _printingRoutine;
//================================================
//Public Method
//================================================
#region Show & Hide
public void Show(DialogData Data)
{
_current_Data = Data;
_find_character(Data.Character);
if(_current_Character != null)
_emote("Normal");
_textingRoutine = StartCoroutine(Activate());
}
public void Show(List<DialogData> Data)
{
StartCoroutine(Activate_List(Data));
}
public void Click_Window()
{
switch (state)
{
case State.Active:
StartCoroutine(_skip()); break;
case State.Wait:
if(_current_Data.SelectList.Count <= 0) Hide(); break;
}
}
public void Hide()
{
if(_textingRoutine != null)
StopCoroutine(_textingRoutine);
if(_printingRoutine != null)
StopCoroutine(_printingRoutine);
Printer.SetActive(false);
Characters.SetActive(false);
Selector.SetActive(false);
state = State.Deactivate;
if (_current_Data.Callback != null)
{
_current_Data.Callback.Invoke();
_current_Data.Callback = null;
}
}
#endregion
#region Selector
public void Select(int index)
{
Result = _current_Data.SelectList.GetByIndex(index).Key;
Hide();
}
#endregion
#region Sound
public void Play_ChatSE()
{
if (_current_Character != null)
{
SEAudio.clip = _current_Character.ChatSE[UnityEngine.Random.Range(0, _current_Character.ChatSE.Length)];
SEAudio.Play();
}
}
public void Play_CallSE(string SEname)
{
if (_current_Character != null)
{
var FindSE
= Array.Find(_current_Character.CallSE, (SE) => SE.name == SEname);
CallAudio.clip = FindSE;
CallAudio.Play();
}
}
#endregion
#region Speed
public void Set_Speed(string speed)
{
switch (speed)
{
case "up":
_currentDelay -= 0.25f;
if (_currentDelay <= 0) _currentDelay = 0.001f;
break;
case "down":
_currentDelay += 0.25f;
break;
case "init":
_currentDelay = Delay;
break;
default:
_currentDelay = float.Parse(speed);
break;
}
_lastDelay = _currentDelay;
}
#endregion
//================================================
//Private Method
//================================================
private void _find_character(string name)
{
if (name != string.Empty)
{
Transform Child = Characters.transform.Find(name);
if (Child != null) _current_Character = Child.GetComponent<Character>();
}
}
private void _initialize()
{
_currentDelay = Delay;
_lastDelay = 0.1f;
Printer_Text.text = string.Empty;
Printer.SetActive(true);
Characters.SetActive(_current_Character != null);
foreach (Transform item in Characters.transform) item.gameObject.SetActive(false);
if(_current_Character != null) _current_Character.gameObject.SetActive(true);
}
private void _init_selector()
{
_clear_selector();
if (_current_Data.SelectList.Count > 0)
{
Selector.SetActive(true);
for (int i = 0; i < _current_Data.SelectList.Count; i++)
{
_add_selectorItem(i);
}
}
else Selector.SetActive(false);
}
private void _clear_selector()
{
for (int i = 1; i < Selector.transform.childCount; i++)
{
Destroy(Selector.transform.GetChild(i).gameObject);
}
}
private void _add_selectorItem(int index)
{
SelectorItemText.text = _current_Data.SelectList.GetByIndex(index).Value;
var NewItem = Instantiate(SelectorItem, Selector.transform);
NewItem.GetComponent<Button>().onClick.AddListener(() => Select(index));
NewItem.SetActive(true);
}
#region Show Text
private IEnumerator Activate_List(List<DialogData> DataList)
{
state = State.Active;
foreach (var Data in DataList)
{
Show(Data);
_init_selector();
while (state != State.Deactivate) { yield return null; }
}
}
private IEnumerator Activate()
{
_initialize();
state = State.Active;
foreach (var item in _current_Data.Commands)
{
switch (item.Command)
{
case Command.print:
yield return _printingRoutine = StartCoroutine(_print(item.Context));
break;
case Command.color:
_current_Data.Format.Color = item.Context;
break;
case Command.emote:
_emote(item.Context);
break;
case Command.size:
_current_Data.Format.Resize(item.Context);
break;
case Command.sound:
Play_CallSE(item.Context);
break;
case Command.speed:
Set_Speed(item.Context);
break;
case Command.click:
yield return _waitInput();
break;
case Command.close:
Hide();
yield break;
case Command.wait:
yield return new WaitForSeconds(float.Parse(item.Context));
break;
}
}
state = State.Wait;
}
private IEnumerator _waitInput()
{
while (!Input.GetMouseButtonDown(0)) yield return null;
_currentDelay = _lastDelay;
}
private IEnumerator _print(string Text)
{
_current_Data.PrintText += _current_Data.Format.OpenTagger;
for (int i = 0; i < Text.Length; i++)
{
_current_Data.PrintText += Text[i];
Printer_Text.text = _current_Data.PrintText + _current_Data.Format.CloseTagger;
if (Text[i] != ' ') Play_ChatSE();
if (_currentDelay != 0) yield return new WaitForSeconds(_currentDelay);
}
_current_Data.PrintText += _current_Data.Format.CloseTagger;
}
public void _emote(string Text)
{
_current_Character.GetComponent<Image>().sprite = _current_Character.Emotion.Data[Text];
}
private IEnumerator _skip()
{
if (_current_Data.isSkippable)
{
_currentDelay = 0;
while (state != State.Wait) yield return null;
_currentDelay = Delay;
}
}
#endregion
}
}

View File

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

View File

@ -0,0 +1,195 @@
/*
The MIT License
Copyright (c) 2020 DoublSB
https://github.com/DoublSB/UnityDialogAsset
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
namespace Doublsb.Dialog
{
[CustomPropertyDrawer(typeof(Emotion))]
public class EmotionDrawer : PropertyDrawer
{
#region variables
//================================================
//Private Variable
//================================================
private int ArraySize = 0;
private string EmotionName = "Input the emotion name";
private SerializedProperty _emotion = null;
private SerializedProperty _sprite = null;
#endregion
#region override
//================================================
//Public Method
//================================================
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
EditorGUI.BeginProperty(position, label, property);
_initialize(position, property);
_display_Header(position);
_display_EmotionList(position);
_display_AddArea(position);
EditorGUI.EndProperty();
}
public override float GetPropertyHeight(SerializedProperty property, GUIContent label)
{
return 18 * (ArraySize + 2);
}
#endregion
#region init
//================================================
//Private Method : init
//================================================
private void _initialize(Rect pos, SerializedProperty property)
{
_emotion = property.FindPropertyRelative("_emotion");
_sprite = property.FindPropertyRelative("_sprite");
ArraySize = _emotion.arraySize;
}
#endregion
#region display
//================================================
//Private Method : display
//================================================
private void _display_Header(Rect startPos)
{
EditorGUI.LabelField(startPos, "Emotion");
EditorGUI.indentLevel++;
}
private void _display_Array(Rect startPos, SerializedProperty array)
{
for (int i = 0; i < array.arraySize; i++)
{
startPos = new Rect(startPos.position + new Vector2(0, 18), startPos.size);
EditorGUI.PropertyField(startPos, array.GetArrayElementAtIndex(i), GUIContent.none);
}
}
private void _display_DeleteButton(Rect startPos)
{
for (int i = 0; i < _sprite.arraySize; i++)
{
startPos = new Rect(startPos.position + new Vector2(0, 18), startPos.size);
if(_emotion.GetArrayElementAtIndex(i).stringValue != "Normal" && GUI.Button(startPos, "-"))
{
int j = i;
_delete_Raw(j);
}
}
}
private void _display_EmotionList(Rect startPos)
{
Rect NewRect = new Rect(startPos.position, new Vector2(startPos.width / 3, 16));
_display_Array(NewRect, _emotion);
_display_Array(_get_Rect(NewRect, NewRect.width, NewRect.width), _sprite);
_display_DeleteButton(_get_Rect(NewRect, NewRect.width * 2 + 10, 30));
}
private void _display_AddButton(Rect rect)
{
if (GUI.Button(rect, "create"))
{
_add_Raw();
EmotionName = "";
}
}
private void _display_TextArea(Rect rect)
{
EmotionName = EditorGUI.TextField(rect, EmotionName);
}
private void _display_AddArea(Rect startPos)
{
Rect InputRect = _get_Rect(startPos, 0, startPos.width / 3 * 2, (_emotion.arraySize + 1) * 18);
_display_TextArea(InputRect);
_display_AddButton(_get_Rect(InputRect, InputRect.width + 20, 70));
}
#endregion
#region methods
//================================================
//Private Method : methods
//================================================
private void _delete_ArrayElement(SerializedProperty array, int index, bool isObject = false)
{
if (isObject && array.GetArrayElementAtIndex(index) != null) array.DeleteArrayElementAtIndex(index);
array.DeleteArrayElementAtIndex(index);
}
private void _delete_Raw(int index)
{
_delete_ArrayElement(_emotion, index);
_delete_ArrayElement(_sprite, index, true);
}
private void _add_Raw()
{
if (!_is_duplicated_emotion_name(EmotionName))
{
_emotion.InsertArrayElementAtIndex(_emotion.arraySize);
_emotion.GetArrayElementAtIndex(_emotion.arraySize - 1).stringValue = EmotionName;
_sprite.InsertArrayElementAtIndex(_sprite.arraySize);
}
}
private bool _is_duplicated_emotion_name(string name)
{
for (int i = 0; i < _emotion.arraySize; i++)
{
if (_emotion.GetArrayElementAtIndex(i).stringValue == name) return true;
}
return false;
}
private Rect _get_Rect(Rect From, float x, float width)
{
return new Rect(From.position + new Vector2(x, 0), new Vector2(width, 16));
}
private Rect _get_Rect(Rect From, float x, float width, float y)
{
return new Rect(From.position + new Vector2(x, y), new Vector2(width, 16));
}
#endregion
}
}
#endif

View File

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

View File

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

BIN
Assets/StoreAssets/DDSystem/Sound/ChatSE01.wav (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,22 @@
fileFormatVersion: 2
guid: d892de2cb9eb07941bef7f5f4245c1b3
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 1
normalize: 0
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -4,7 +4,7 @@ ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
userData: dontshow
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

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

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: cfa813ed406827e43b967abd54ab5b9a
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

@ -0,0 +1,7 @@
fileFormatVersion: 2
guid: 414bddd31c5ea4f4c9f5d1452e5bbb41
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

BIN
Assets/StoreAssets/Joystick Pack/Examples/Ground.mat (Stored with Git LFS) Normal file

Binary file not shown.

View File

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

View File

@ -0,0 +1,16 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class JoystickPlayerExample : MonoBehaviour
{
public float speed;
public VariableJoystick variableJoystick;
public Rigidbody rb;
public void FixedUpdate()
{
Vector3 direction = Vector3.forward * variableJoystick.Vertical + Vector3.right * variableJoystick.Horizontal;
rb.AddForce(direction * speed * Time.fixedDeltaTime, ForceMode.VelocityChange);
}
}

View File

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

View File

@ -0,0 +1,66 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class JoystickSetterExample : MonoBehaviour
{
public VariableJoystick variableJoystick;
public Text valueText;
public Image background;
public Sprite[] axisSprites;
public void ModeChanged(int index)
{
switch(index)
{
case 0:
variableJoystick.SetMode(JoystickType.Fixed);
break;
case 1:
variableJoystick.SetMode(JoystickType.Floating);
break;
case 2:
variableJoystick.SetMode(JoystickType.Dynamic);
break;
default:
break;
}
}
public void AxisChanged(int index)
{
switch (index)
{
case 0:
variableJoystick.AxisOptions = AxisOptions.Both;
background.sprite = axisSprites[index];
break;
case 1:
variableJoystick.AxisOptions = AxisOptions.Horizontal;
background.sprite = axisSprites[index];
break;
case 2:
variableJoystick.AxisOptions = AxisOptions.Vertical;
background.sprite = axisSprites[index];
break;
default:
break;
}
}
public void SnapX(bool value)
{
variableJoystick.SnapX = value;
}
public void SnapY(bool value)
{
variableJoystick.SnapY = value;
}
private void Update()
{
valueText.text = "Current Value: " + variableJoystick.Direction;
}
}

View File

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

BIN
Assets/StoreAssets/Joystick Pack/Examples/Player.mat (Stored with Git LFS) Normal file

Binary file not shown.

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 59e4faf24927edf4a82f463ad16f1c37
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

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

View File

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

View File

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

View File

@ -0,0 +1,150 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class Joystick : MonoBehaviour, IPointerDownHandler, IDragHandler, IPointerUpHandler
{
public float Horizontal { get { return (snapX) ? SnapFloat(input.x, AxisOptions.Horizontal) : input.x; } }
public float Vertical { get { return (snapY) ? SnapFloat(input.y, AxisOptions.Vertical) : input.y; } }
public Vector2 Direction { get { return new Vector2(Horizontal, Vertical); } }
public float HandleRange
{
get { return handleRange; }
set { handleRange = Mathf.Abs(value); }
}
public float DeadZone
{
get { return deadZone; }
set { deadZone = Mathf.Abs(value); }
}
public AxisOptions AxisOptions { get { return AxisOptions; } set { axisOptions = value; } }
public bool SnapX { get { return snapX; } set { snapX = value; } }
public bool SnapY { get { return snapY; } set { snapY = value; } }
[SerializeField] private float handleRange = 1;
[SerializeField] private float deadZone = 0;
[SerializeField] private AxisOptions axisOptions = AxisOptions.Both;
[SerializeField] private bool snapX = false;
[SerializeField] private bool snapY = false;
[SerializeField] protected RectTransform background = null;
[SerializeField] private RectTransform handle = null;
private RectTransform baseRect = null;
private Canvas canvas;
private Camera cam;
private Vector2 input = Vector2.zero;
protected virtual void Start()
{
HandleRange = handleRange;
DeadZone = deadZone;
baseRect = GetComponent<RectTransform>();
canvas = GetComponentInParent<Canvas>();
if (canvas == null)
Debug.LogError("The Joystick is not placed inside a canvas");
Vector2 center = new Vector2(0.5f, 0.5f);
background.pivot = center;
handle.anchorMin = center;
handle.anchorMax = center;
handle.pivot = center;
handle.anchoredPosition = Vector2.zero;
}
public virtual void OnPointerDown(PointerEventData eventData)
{
OnDrag(eventData);
}
public void OnDrag(PointerEventData eventData)
{
cam = null;
if (canvas.renderMode == RenderMode.ScreenSpaceCamera)
cam = canvas.worldCamera;
Vector2 position = RectTransformUtility.WorldToScreenPoint(cam, background.position);
Vector2 radius = background.sizeDelta / 2;
input = (eventData.position - position) / (radius * canvas.scaleFactor);
FormatInput();
HandleInput(input.magnitude, input.normalized, radius, cam);
handle.anchoredPosition = input * radius * handleRange;
}
protected virtual void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
{
if (magnitude > deadZone)
{
if (magnitude > 1)
input = normalised;
}
else
input = Vector2.zero;
}
private void FormatInput()
{
if (axisOptions == AxisOptions.Horizontal)
input = new Vector2(input.x, 0f);
else if (axisOptions == AxisOptions.Vertical)
input = new Vector2(0f, input.y);
}
private float SnapFloat(float value, AxisOptions snapAxis)
{
if (value == 0)
return value;
if (axisOptions == AxisOptions.Both)
{
float angle = Vector2.Angle(input, Vector2.up);
if (snapAxis == AxisOptions.Horizontal)
{
if (angle < 22.5f || angle > 157.5f)
return 0;
else
return (value > 0) ? 1 : -1;
}
else if (snapAxis == AxisOptions.Vertical)
{
if (angle > 67.5f && angle < 112.5f)
return 0;
else
return (value > 0) ? 1 : -1;
}
return value;
}
else
{
if (value > 0)
return 1;
if (value < 0)
return -1;
}
return 0;
}
public virtual void OnPointerUp(PointerEventData eventData)
{
input = Vector2.zero;
handle.anchoredPosition = Vector2.zero;
}
protected Vector2 ScreenPointToAnchoredPosition(Vector2 screenPosition)
{
Vector2 localPoint = Vector2.zero;
if (RectTransformUtility.ScreenPointToLocalPointInRectangle(baseRect, screenPosition, cam, out localPoint))
{
Vector2 pivotOffset = baseRect.pivot * baseRect.sizeDelta;
return localPoint - (background.anchorMax * baseRect.sizeDelta) + pivotOffset;
}
return Vector2.zero;
}
}
public enum AxisOptions { Both, Horizontal, Vertical }

View File

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

View File

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

View File

@ -0,0 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(DynamicJoystick))]
public class DynamicJoystickEditor : JoystickEditor
{
private SerializedProperty moveThreshold;
protected override void OnEnable()
{
base.OnEnable();
moveThreshold = serializedObject.FindProperty("moveThreshold");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (background != null)
{
RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
backgroundRect.anchorMax = Vector2.zero;
backgroundRect.anchorMin = Vector2.zero;
backgroundRect.pivot = center;
}
}
protected override void DrawValues()
{
base.DrawValues();
EditorGUILayout.PropertyField(moveThreshold, new GUIContent("Move Threshold", "The distance away from the center input has to be before the joystick begins to move."));
}
}

View File

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

View File

@ -0,0 +1,21 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(FloatingJoystick))]
public class FloatingJoystickEditor : JoystickEditor
{
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (background != null)
{
RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
backgroundRect.anchorMax = Vector2.zero;
backgroundRect.anchorMin = Vector2.zero;
backgroundRect.pivot = center;
}
}
}

View File

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

View File

@ -0,0 +1,64 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(Joystick), true)]
public class JoystickEditor : Editor
{
private SerializedProperty handleRange;
private SerializedProperty deadZone;
private SerializedProperty axisOptions;
private SerializedProperty snapX;
private SerializedProperty snapY;
protected SerializedProperty background;
private SerializedProperty handle;
protected Vector2 center = new Vector2(0.5f, 0.5f);
protected virtual void OnEnable()
{
handleRange = serializedObject.FindProperty("handleRange");
deadZone = serializedObject.FindProperty("deadZone");
axisOptions = serializedObject.FindProperty("axisOptions");
snapX = serializedObject.FindProperty("snapX");
snapY = serializedObject.FindProperty("snapY");
background = serializedObject.FindProperty("background");
handle = serializedObject.FindProperty("handle");
}
public override void OnInspectorGUI()
{
serializedObject.Update();
DrawValues();
EditorGUILayout.Space();
DrawComponents();
serializedObject.ApplyModifiedProperties();
if(handle != null)
{
RectTransform handleRect = (RectTransform)handle.objectReferenceValue;
handleRect.anchorMax = center;
handleRect.anchorMin = center;
handleRect.pivot = center;
handleRect.anchoredPosition = Vector2.zero;
}
}
protected virtual void DrawValues()
{
EditorGUILayout.PropertyField(handleRange, new GUIContent("Handle Range", "The distance the visual handle can move from the center of the joystick."));
EditorGUILayout.PropertyField(deadZone, new GUIContent("Dead Zone", "The distance away from the center input has to be before registering."));
EditorGUILayout.PropertyField(axisOptions, new GUIContent("Axis Options", "Which axes the joystick uses."));
EditorGUILayout.PropertyField(snapX, new GUIContent("Snap X", "Snap the horizontal input to a whole value."));
EditorGUILayout.PropertyField(snapY, new GUIContent("Snap Y", "Snap the vertical input to a whole value."));
}
protected virtual void DrawComponents()
{
EditorGUILayout.ObjectField(background, new GUIContent("Background", "The background's RectTransform component."));
EditorGUILayout.ObjectField(handle, new GUIContent("Handle", "The handle's RectTransform component."));
}
}

View File

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

View File

@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
[CustomEditor(typeof(VariableJoystick))]
public class VariableJoystickEditor : JoystickEditor
{
private SerializedProperty moveThreshold;
private SerializedProperty joystickType;
protected override void OnEnable()
{
base.OnEnable();
moveThreshold = serializedObject.FindProperty("moveThreshold");
joystickType = serializedObject.FindProperty("joystickType");
}
public override void OnInspectorGUI()
{
base.OnInspectorGUI();
if (background != null)
{
RectTransform backgroundRect = (RectTransform)background.objectReferenceValue;
backgroundRect.pivot = center;
}
}
protected override void DrawValues()
{
base.DrawValues();
EditorGUILayout.PropertyField(moveThreshold, new GUIContent("Move Threshold", "The distance away from the center input has to be before the joystick begins to move."));
EditorGUILayout.PropertyField(joystickType, new GUIContent("Joystick Type", "The type of joystick the variable joystick is current using."));
}
}

View File

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

View File

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

View File

@ -0,0 +1,41 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class DynamicJoystick : Joystick
{
public float MoveThreshold { get { return moveThreshold; } set { moveThreshold = Mathf.Abs(value); } }
[SerializeField] private float moveThreshold = 1;
protected override void Start()
{
MoveThreshold = moveThreshold;
base.Start();
background.gameObject.SetActive(false);
}
public override void OnPointerDown(PointerEventData eventData)
{
background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position);
background.gameObject.SetActive(true);
base.OnPointerDown(eventData);
}
public override void OnPointerUp(PointerEventData eventData)
{
background.gameObject.SetActive(false);
base.OnPointerUp(eventData);
}
protected override void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
{
if (magnitude > moveThreshold)
{
Vector2 difference = normalised * (magnitude - moveThreshold) * radius;
background.anchoredPosition += difference;
}
base.HandleInput(magnitude, normalised, radius, cam);
}
}

View File

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

View File

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

View File

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

View File

@ -0,0 +1,26 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class FloatingJoystick : Joystick
{
protected override void Start()
{
base.Start();
background.gameObject.SetActive(false);
}
public override void OnPointerDown(PointerEventData eventData)
{
background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position);
background.gameObject.SetActive(true);
base.OnPointerDown(eventData);
}
public override void OnPointerUp(PointerEventData eventData)
{
background.gameObject.SetActive(false);
base.OnPointerUp(eventData);
}
}

View File

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

View File

@ -0,0 +1,63 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.EventSystems;
public class VariableJoystick : Joystick
{
public float MoveThreshold { get { return moveThreshold; } set { moveThreshold = Mathf.Abs(value); } }
[SerializeField] private float moveThreshold = 1;
[SerializeField] private JoystickType joystickType = JoystickType.Fixed;
private Vector2 fixedPosition = Vector2.zero;
public void SetMode(JoystickType joystickType)
{
this.joystickType = joystickType;
if(joystickType == JoystickType.Fixed)
{
background.anchoredPosition = fixedPosition;
background.gameObject.SetActive(true);
}
else
background.gameObject.SetActive(false);
}
protected override void Start()
{
base.Start();
fixedPosition = background.anchoredPosition;
SetMode(joystickType);
}
public override void OnPointerDown(PointerEventData eventData)
{
if(joystickType != JoystickType.Fixed)
{
background.anchoredPosition = ScreenPointToAnchoredPosition(eventData.position);
background.gameObject.SetActive(true);
}
base.OnPointerDown(eventData);
}
public override void OnPointerUp(PointerEventData eventData)
{
if(joystickType != JoystickType.Fixed)
background.gameObject.SetActive(false);
base.OnPointerUp(eventData);
}
protected override void HandleInput(float magnitude, Vector2 normalised, Vector2 radius, Camera cam)
{
if (joystickType == JoystickType.Dynamic && magnitude > moveThreshold)
{
Vector2 difference = normalised * (magnitude - moveThreshold) * radius;
background.anchoredPosition += difference;
}
base.HandleInput(magnitude, normalised, radius, cam);
}
}
public enum JoystickType { Fixed, Floating, Dynamic }

View File

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

View File

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

Some files were not shown because too many files have changed in this diff Show More