Jelajahi Sumber

优化游戏场景

baxi 1 hari lalu
induk
melakukan
2bfd4bf7a1

+ 8 - 0
Assets/TowerDevil/Resources/DevilArt/Courtyard.meta

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

TEMPAT SAMPAH
Assets/TowerDevil/Resources/DevilArt/Courtyard/backdrop.jpg


+ 143 - 0
Assets/TowerDevil/Resources/DevilArt/Courtyard/backdrop.jpg.meta

@@ -0,0 +1,143 @@
+fileFormatVersion: 2
+guid: 9fee40ef75a2495498872f12bfaf3ea7
+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: 1
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 0
+  spriteExtrude: 1
+  spriteMeshType: 1
+  alignment: 0
+  spritePivot: {x: 0.5, y: 0.5}
+  spritePixelsToUnits: 100
+  spriteBorder: {x: 0, y: 0, z: 0, w: 0}
+  spriteGenerateFallbackPhysicsShape: 1
+  alphaUsage: 1
+  alphaIsTransparency: 0
+  spriteTessellationDetail: -1
+  textureType: 0
+  textureShape: 1
+  singleChannelComponent: 0
+  flipbookRows: 1
+  flipbookColumns: 1
+  maxTextureSizeSet: 0
+  compressionQualitySet: 0
+  textureFormatSet: 0
+  ignorePngGamma: 0
+  applyGammaDecoding: 0
+  swizzle: 50462976
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 4
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    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: 0
+  - serializedVersion: 4
+    buildTarget: iOS
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  spriteSheet:
+    serializedVersion: 2
+    sprites: []
+    outline: []
+    customData: 
+    physicsShape: []
+    bones: []
+    spriteID: 
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    spriteCustomMetadata:
+      entries: []
+    nameFileIdTable: {}
+  mipmapLimitGroupName: 
+  pSDRemoveMatte: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

TEMPAT SAMPAH
Assets/TowerDevil/Resources/DevilArt/Courtyard/equipment.png


+ 468 - 0
Assets/TowerDevil/Resources/DevilArt/Courtyard/equipment.png.meta

@@ -0,0 +1,468 @@
+fileFormatVersion: 2
+guid: 717082fff027f2541a848ede3ead553d
+TextureImporter:
+  internalIDToNameTable:
+  - first:
+      213: 5357457282185501634
+    second: equipment_0
+  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: 1
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 2
+  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: 0
+  swizzle: 50462976
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 4
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    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: 0
+  - serializedVersion: 4
+    buildTarget: iOS
+    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:
+    - serializedVersion: 2
+      name: ballista_d
+      rect:
+        serializedVersion: 2
+        x: 24
+        y: 678
+        width: 292
+        height: 260
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 286895ece9b7e9748a672971e590c197
+      internalID: -578036558
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ballista2
+      rect:
+        serializedVersion: 2
+        x: 348
+        y: 684
+        width: 291
+        height: 281
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 4164bffe4f263ac4fa126bd0e2dea682
+      internalID: 1335409085
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ballista2_d
+      rect:
+        serializedVersion: 2
+        x: 663
+        y: 678
+        width: 294
+        height: 251
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 4eb58566c8fcadf4a93a4fe6442c2070
+      internalID: -1589720962
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ballista3
+      rect:
+        serializedVersion: 2
+        x: 977
+        y: 682
+        width: 312
+        height: 282
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: fbe6b0934c689fe4f813e87c64229cde
+      internalID: -2083333902
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ballista3_d
+      rect:
+        serializedVersion: 2
+        x: 1307
+        y: 678
+        width: 307
+        height: 256
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 3b110d921631bfd45ac39387116c0302
+      internalID: -1805387890
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: cannon2
+      rect:
+        serializedVersion: 2
+        x: 23
+        y: 357
+        width: 273
+        height: 275
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 1950aa7ab08f3624391929db2c17fc89
+      internalID: 1595585963
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: cannon3
+      rect:
+        serializedVersion: 2
+        x: 347
+        y: 358
+        width: 281
+        height: 273
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 9adb11929abee1e40b317b165ab12b6c
+      internalID: -1585513815
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: arrow2
+      rect:
+        serializedVersion: 2
+        x: 679
+        y: 354
+        width: 261
+        height: 297
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 12b36d8e98e8caa4ea1562a49e92882a
+      internalID: 239831899
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: arrow3
+      rect:
+        serializedVersion: 2
+        x: 1000
+        y: 353
+        width: 262
+        height: 306
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: f31106db5df3aad4ab70f812a7276679
+      internalID: 2005980158
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: frost2
+      rect:
+        serializedVersion: 2
+        x: 1321
+        y: 350
+        width: 275
+        height: 283
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 06b54e0f678ed3c40a5f5cb17a6359d1
+      internalID: -658531199
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: frost3
+      rect:
+        serializedVersion: 2
+        x: 22
+        y: 10
+        width: 289
+        height: 325
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 8044bf9eb68e96d4ea14bd32582452e7
+      internalID: -1117752208
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: chest2
+      rect:
+        serializedVersion: 2
+        x: 356
+        y: 21
+        width: 262
+        height: 294
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: bf6dbbfcf49af33478b760d67a104854
+      internalID: 185063660
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: chest3
+      rect:
+        serializedVersion: 2
+        x: 671
+        y: 23
+        width: 271
+        height: 295
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 7d096f008174e534c9066667b3597ffd
+      internalID: -1839981580
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: chest4
+      rect:
+        serializedVersion: 2
+        x: 993
+        y: 20
+        width: 279
+        height: 310
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 2b71e93f41f42674091bcd2e78609a29
+      internalID: 932955033
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    outline: []
+    customData: 
+    physicsShape: []
+    bones: []
+    spriteID: 5bc5f74cf9eb68341b51fcaf67165dce
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    spriteCustomMetadata:
+      entries: []
+    nameFileIdTable:
+      arrow2: 239831899
+      arrow3: 2005980158
+      ballista2: 1335409085
+      ballista2_d: -1589720962
+      ballista3: -2083333902
+      ballista3_d: -1805387890
+      ballista_d: -578036558
+      cannon2: 1595585963
+      cannon3: -1585513815
+      chest2: 185063660
+      chest3: -1839981580
+      chest4: 932955033
+      frost2: -658531199
+      frost3: -1117752208
+  mipmapLimitGroupName: 
+  pSDRemoveMatte: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

TEMPAT SAMPAH
Assets/TowerDevil/Resources/DevilArt/Courtyard/pieces.png


+ 376 - 0
Assets/TowerDevil/Resources/DevilArt/Courtyard/pieces.png.meta

@@ -0,0 +1,376 @@
+fileFormatVersion: 2
+guid: 54d97d2a4810954448e854f094db89df
+TextureImporter:
+  internalIDToNameTable:
+  - first:
+      213: -5619150752979459227
+    second: pieces_0
+  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: 1
+  nPOTScale: 0
+  lightmap: 0
+  compressionQuality: 50
+  spriteMode: 2
+  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: 0
+  swizzle: 50462976
+  cookieLightType: 0
+  platformSettings:
+  - serializedVersion: 4
+    buildTarget: DefaultTexturePlatform
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    buildTarget: Standalone
+    maxTextureSize: 2048
+    resizeAlgorithm: 0
+    textureFormat: -1
+    textureCompression: 1
+    compressionQuality: 50
+    crunchedCompression: 0
+    allowsAlphaSplitting: 0
+    overridden: 0
+    ignorePlatformSupport: 0
+    androidETC2FallbackOverride: 0
+    forceMaximumCompressionQuality_BC6H_BC7: 0
+  - serializedVersion: 4
+    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: 0
+  - serializedVersion: 4
+    buildTarget: iOS
+    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:
+    - serializedVersion: 2
+      name: stone
+      rect:
+        serializedVersion: 2
+        x: 46
+        y: 425
+        width: 318
+        height: 323
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 26562a54c14e14348af18fd99e160801
+      internalID: 821669287
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: timber
+      rect:
+        serializedVersion: 2
+        x: 422
+        y: 424
+        width: 345
+        height: 306
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 777ba34c7baed6942ba370646707e6e8
+      internalID: -1783038256
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: crystal
+      rect:
+        serializedVersion: 2
+        x: 822
+        y: 417
+        width: 333
+        height: 350
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 1b5f25a6de9b30343ba7ccc67af8d979
+      internalID: 1219788960
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ice
+      rect:
+        serializedVersion: 2
+        x: 1237
+        y: 427
+        width: 315
+        height: 339
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: e229aa05eb5e07a4ca1aea3c3c7633aa
+      internalID: -2039055657
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: gold
+      rect:
+        serializedVersion: 2
+        x: 1617
+        y: 459
+        width: 345
+        height: 271
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: d952e94b7c2c2ad4fab14d08be7f1461
+      internalID: 1919227678
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: ballista
+      rect:
+        serializedVersion: 2
+        x: 16
+        y: 55
+        width: 380
+        height: 314
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 23eb0b6088aa62c4bae4e69a7ce06b36
+      internalID: -1421365574
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: cannon
+      rect:
+        serializedVersion: 2
+        x: 443
+        y: 37
+        width: 301
+        height: 321
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 4e9442260451b6d4bb793eb41779211d
+      internalID: 1399704450
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: arrow
+      rect:
+        serializedVersion: 2
+        x: 820
+        y: 36
+        width: 336
+        height: 348
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: aa1cf2535d295de4fac792c18108478c
+      internalID: -1461179956
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: frost
+      rect:
+        serializedVersion: 2
+        x: 1215
+        y: 26
+        width: 362
+        height: 356
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 843e91783f984ec46aca8ff5ce2ba505
+      internalID: -1268619255
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    - serializedVersion: 2
+      name: chest1
+      rect:
+        serializedVersion: 2
+        x: 1634
+        y: 38
+        width: 311
+        height: 329
+      alignment: 7
+      pivot: {x: 0.5, y: 0}
+      border: {x: 0, y: 0, z: 0, w: 0}
+      customData: 
+      outline: []
+      physicsShape: []
+      tessellationDetail: 0
+      bones: []
+      spriteID: 68e34d9c425e4d64db9cae740d9f2a29
+      internalID: 440112003
+      vertices: []
+      indices: 
+      edges: []
+      weights: []
+    outline: []
+    customData: 
+    physicsShape: []
+    bones: []
+    spriteID: 1b6303ad1ae6f0444b9cfb7115eed9eb
+    internalID: 0
+    vertices: []
+    indices: 
+    edges: []
+    weights: []
+    secondaryTextures: []
+    spriteCustomMetadata:
+      entries: []
+    nameFileIdTable:
+      arrow: -1461179956
+      ballista: -1421365574
+      cannon: 1399704450
+      chest1: 440112003
+      crystal: 1219788960
+      frost: -1268619255
+      gold: 1919227678
+      ice: -2039055657
+      stone: 821669287
+      timber: -1783038256
+  mipmapLimitGroupName: 
+  pSDRemoveMatte: 0
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 1 - 0
Assets/TowerDevil/Scripts/AssemblyInfo.cs

@@ -1,2 +1,3 @@
 using System.Runtime.CompilerServices;
 using System.Runtime.CompilerServices;
 [assembly:InternalsVisibleTo("TowerDevil.EditorTests")]
 [assembly:InternalsVisibleTo("TowerDevil.EditorTests")]
+[assembly:InternalsVisibleTo("TowerDevil.PlayTests")]

+ 106 - 102
Assets/TowerDevil/Scripts/BattleView.cs

@@ -8,9 +8,12 @@ namespace TowerDevil
     public sealed partial class TowerGame
     public sealed partial class TowerGame
     {
     {
         RectTransform tiles, monsters, fx, shieldPips, guide, actionArea;
         RectTransform tiles, monsters, fx, shieldPips, guide, actionArea;
-        RectTransform hud, boardStage, battleFooter, gateWindow, fieldClip, laneShade;
-        RawImage gateArt;
+        RectTransform hud, boardStage, battleFooter, fieldClip;
+        CourtyardBackdrop courtyard;
+        PieceShadows pieceShadows;
+        readonly Dictionary<string, Sprite> courtSprites = new Dictionary<string, Sprite>();
         GateFractures gateFractures;
         GateFractures gateFractures;
+        Vector2 fractureOrigin;
         BattleEffects battleEffects;
         BattleEffects battleEffects;
         IronPanel turnDot, turnStrip;
         IronPanel turnDot, turnStrip;
         readonly Dictionary<Piece, RawImage> pieces = new Dictionary<Piece, RawImage>();
         readonly Dictionary<Piece, RawImage> pieces = new Dictionary<Piece, RawImage>();
@@ -89,50 +92,27 @@ namespace TowerDevil
             nextMotionSeed = 0;
             nextMotionSeed = 0;
             lastPlates = -1;
             lastPlates = -1;
             guide = null;
             guide = null;
-            boardStage = Box(page, "Battlefield", 0, 0, BoardLayout.Width, BoardLayout.Height);
-            gateWindow = Box(boardStage, "Gate overlook", 0, 0, 750, 200);
-            gateWindow.gameObject.AddComponent<RectMask2D>();
-            gateArt = Image(gateWindow, "Sealed prison gate", "fortress", 55, 0, 640, 291);
-            var gateRect = gateArt.rectTransform;
-            gateRect.anchorMin = gateRect.anchorMax = gateRect.pivot = new Vector2(.5f, 0);
-            gateRect.anchoredPosition = Vector2.zero;
-            gateFractures = Box(gateRect, "Gate fractures", 0, 0, 0, 0).gameObject.AddComponent<GateFractures>();
-            Stretch(gateFractures.rectTransform);
+            if (courtSprites.Count == 0)
+                foreach (var sprite in Resources.LoadAll<Sprite>("DevilArt/Courtyard"))
+                    courtSprites.Add(sprite.name, sprite);
+            courtyard = Box(page, "Basalt courtyard", 0, 0, 1000, 1334).gameObject.AddComponent<CourtyardBackdrop>();
+            courtyard.SetPainting(Art("Courtyard/backdrop"));
+            gateFractures = Box(courtyard.transform, "Gate fractures", 0, 0, 0, 0).gameObject.AddComponent<GateFractures>();
             gateFractures.raycastTarget = false;
             gateFractures.raycastTarget = false;
-            shieldPips = Box(boardStage, "Seal stones", 230, -88, 290, 38);
-            turnStrip = Round(boardStage, "Turn strip", 27, -48, 696, 38, "24171B", "69404B", 19, "130C0F");
+            boardStage = Box(page, "Battlefield", 0, 0, BoardLayout.Width, BoardLayout.Height);
+            shieldPips = Box(boardStage, "Seal stones", 230, -92, 290, 35);
+            turnStrip = Round(boardStage, "Turn strip", 33, -47, 684, 33, "261D20", "75605A", 16, "171114");
             assaultTint = false;
             assaultTint = false;
-            turnDot = Round(turnStrip.transform, "Phase light", 18, 12, 14, 14, "A4F09D", "366439", 7, "5FC56F");
-            turnLabel = Label(turnStrip.transform, "YOUR TURN", 45, 0, 228, 38, 17, Ink);
-            waitLabel = Label(turnStrip.transform, "", 260, 0, 418, 38, 16, Hex("FFDA89"), TextAnchor.MiddleRight);
-            for (int r = 0; r < Run.Size; r++)
-            {
-                float size = BoardLayout.Size(r), y = BoardLayout.Top(r);
-                float x = (BoardLayout.Width - Run.Size * size) * .5f;
-                Round(boardStage, "Rank " + r, x - 8, y - 6, size * Run.Size + 16, size + 14,
-                      "291920", "38252B", 13, "140C10");
-                for (int c = 0; c < Run.Size; c++)
-                    Round(boardStage, "Cell " + r + "," + c, x + c * size + 1.5f, y, size - 3, size - 3,
-                          "513241", "82605C", 13, "271520");
-            }
+            turnDot = Round(turnStrip.transform, "Phase light", 20, 11, 12, 12, "A4F09D", "366439", 6, "5FC56F");
+            turnLabel = Label(turnStrip.transform, "YOUR TURN", 46, 0, 223, 33, 17, Ink);
+            waitLabel = Label(turnStrip.transform, "", 247, 0, 418, 33, 16, Hex("FFDA89"), TextAnchor.MiddleRight);
             var pieceWindow = Box(boardStage, "Piece viewport", 0, -10, BoardLayout.Width, BoardLayout.Height + 27);
             var pieceWindow = Box(boardStage, "Piece viewport", 0, -10, BoardLayout.Width, BoardLayout.Height + 27);
             pieceWindow.gameObject.AddComponent<RectMask2D>();
             pieceWindow.gameObject.AddComponent<RectMask2D>();
+            pieceShadows = Box(pieceWindow, "Contact shadows", 0, 10, BoardLayout.Width, BoardLayout.Height)
+                              .gameObject.AddComponent<PieceShadows>();
+            pieceShadows.raycastTarget = false;
+            pieceShadows.Bind(pieces);
             tiles = Box(pieceWindow, "Pieces", 0, 10, BoardLayout.Width, BoardLayout.Height);
             tiles = Box(pieceWindow, "Pieces", 0, 10, BoardLayout.Width, BoardLayout.Height);
-            laneShade = Panel(boardStage, "Approach shadow", 0, BoardLayout.Height + 8, 750, 130, "11090D",
-                              "120A0D", 0).rectTransform;
-            var shade = laneShade.GetComponent<IronPanel>();
-            shade.stroke = 0;
-            shade.top = new Color(.04f, .02f, .03f, .14f);
-            shade.bottom = new Color(.06f, .025f, .04f, .84f);
-            for (int side = 0; side < 2; side++)
-            {
-                var rock = Image(laneShade, "Runway rubble", "rubble", side == 0 ? -14 : 650, 0, 114, 112);
-                rock.rectTransform.anchorMin = rock.rectTransform.anchorMax = new Vector2(0, 0);
-                rock.rectTransform.anchoredPosition += Vector2.up * 112;
-                rock.color = new Color(.47f, .40f, .42f, .78f);
-                if (side == 1)
-                    rock.uvRect = new Rect(1, 0, -1, 1);
-            }
             fieldClip = Box(boardStage, "Visible battlefield", 0, -15, 750, 850);
             fieldClip = Box(boardStage, "Visible battlefield", 0, -15, 750, 850);
             fieldClip.gameObject.AddComponent<RectMask2D>();
             fieldClip.gameObject.AddComponent<RectMask2D>();
             monsters = Box(fieldClip, "Horde", 0, 15, 750, 1334);
             monsters = Box(fieldClip, "Horde", 0, 15, 750, 1334);
@@ -143,14 +123,14 @@ namespace TowerDevil
                             .gameObject.AddComponent<BoardInput>();
                             .gameObject.AddComponent<BoardInput>();
             input.Game = this;
             input.Game = this;
             BuildBattleHud();
             BuildBattleHud();
-            battleFooter = Box(page, "Battle footer", 0, 1184, 750, 150);
+            battleFooter = Box(page, "Battle footer", 0, 1221, 750, 113);
             waveLabel = Label(battleFooter, "", 26, 0, 125, 35, 17, Ink);
             waveLabel = Label(battleFooter, "", 26, 0, 125, 35, 17, Ink);
             Round(battleFooter, "Wave track", 145, 13, 454, 10, "3A292C", "49353A", 5, "2A1C20");
             Round(battleFooter, "Wave track", 145, 13, 454, 10, "3A292C", "49353A", 5, "2A1C20");
             waveFill = Round(battleFooter, "Wave progress", 145, 13, 1, 10, "FFD473", "CD8D34", 5, "E59B38").rectTransform;
             waveFill = Round(battleFooter, "Wave progress", 145, 13, 1, 10, "FFD473", "CD8D34", 5, "E59B38").rectTransform;
             leftLabel = Label(battleFooter, "", 606, 0, 116, 35, 17, Muted, TextAnchor.MiddleRight);
             leftLabel = Label(battleFooter, "", 606, 0, 116, 35, 17, Muted, TextAnchor.MiddleRight);
-            actionArea = Box(battleFooter, "Actions", 0, 57, 750, 84);
-            SideAction("SHOP", "shop", 24, Merchant);
-            SideAction("MENU", "menu", 558, PauseSheet);
+            actionArea = Box(battleFooter, "Actions", 0, 41, 750, 64);
+            SideAction("SHOP", "shop", 20, Merchant);
+            SideAction("MENU", "menu", 544, PauseSheet);
             Fit();
             Fit();
             lastDay = run.Day;
             lastDay = run.Day;
             lastPhase = run.Phase;
             lastPhase = run.Phase;
@@ -163,30 +143,23 @@ namespace TowerDevil
         void FitBattle(float safeHeight)
         void FitBattle(float safeHeight)
         {
         {
             float extra = Mathf.Max(0, safeHeight - 1334);
             float extra = Mathf.Max(0, safeHeight - 1334);
-            float boardY = 426 - extra * .2f;
+            float boardY = 460 - extra * .19f;
             hud.anchoredPosition = new Vector2(0, extra * .5f);
             hud.anchoredPosition = new Vector2(0, extra * .5f);
             boardStage.anchoredPosition = new Vector2(0, -boardY);
             boardStage.anchoredPosition = new Vector2(0, -boardY);
-            battleFooter.anchoredPosition = new Vector2(0, -1184 - extra * .5f);
-            float gateTop = 108 - extra * .5f - boardY;
-            gateWindow.anchoredPosition = new Vector2(0, -gateTop);
-            gateWindow.sizeDelta = new Vector2(750, -96 - gateTop);
-            float available = boardY + extra * .5f - 96 - 158;
-            float width = Mathf.Clamp((available + 20) * 2.7f, 495, 668);
-            gateArt.rectTransform.sizeDelta =
-                new Vector2(width, width * gateArt.texture.height / gateArt.texture.width);
+            battleFooter.anchoredPosition = new Vector2(0, -1221 - extra * .5f);
             float laneEnd = -battleFooter.anchoredPosition.y - boardY;
             float laneEnd = -battleFooter.anchoredPosition.y - boardY;
             fieldClip.sizeDelta = new Vector2(750, laneEnd + 15);
             fieldClip.sizeDelta = new Vector2(750, laneEnd + 15);
-            laneShade.sizeDelta = new Vector2(750, laneEnd - BoardLayout.Height - 8);
-        }
-        void BattleShade(float low, float high, float lowerAlpha, float upperAlpha)
-        {
-            var band = Panel(battleVeil, "Shadow", 0, 0, 0, 0, "12090C", "12090C", 0);
-            band.stroke = 0;
-            band.bottom = new Color(.046f, .023f, .035f, lowerAlpha);
-            band.top = new Color(.046f, .023f, .035f, upperAlpha);
-            band.rectTransform.anchorMin = new Vector2(0, low);
-            band.rectTransform.anchorMax = new Vector2(1, high);
-            band.rectTransform.offsetMin = band.rectTransform.offsetMax = Vector2.zero;
+
+            Vector2 topLeft = page.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMin, screen.rect.yMax)));
+            Vector2 bottomRight = page.InverseTransformPoint(screen.TransformPoint(new Vector2(screen.rect.xMax, screen.rect.yMin)));
+            float visibleWidth = 2 * Mathf.Max(375 - topLeft.x, bottomRight.x - 375) + 2;
+            float width = Mathf.Max(1000, visibleWidth);
+            var painting = courtyard.rectTransform;
+            painting.anchoredPosition = new Vector2(375 - width * .5f, topLeft.y);
+            painting.sizeDelta = new Vector2(width, topLeft.y - bottomRight.y);
+            courtyard.Fit(topLeft.y + 138 - extra * .5f, topLeft.y + boardY - 66, visibleWidth);
+            courtyard.RegisterFractures(gateFractures.rectTransform);
+            fractureOrigin = gateFractures.rectTransform.anchoredPosition;
         }
         }
         static IronPanel Round(Transform parent, string name, float x, float y, float w, float h, string face,
         static IronPanel Round(Transform parent, string name, float x, float y, float w, float h, string face,
                                string rim, float radius, string lower = null)
                                string rim, float radius, string lower = null)
@@ -198,31 +171,31 @@ namespace TowerDevil
         }
         }
         void BuildBattleHud()
         void BuildBattleHud()
         {
         {
-            hud = Box(page, "Warden HUD", 0, 0, 750, 158);
-            Round(hud, "Portrait setting", 22, 13, 53, 53, "39251C", "F4B943", 14, "170F0D");
-            Image(hud, "Warden portrait", "av_" + profile.avatar, 24, 15, 49, 49);
-            var name = Label(hud, profile.name, 88, 13, 325, 53, 22, Ink);
+            hud = Box(page, "Warden HUD", 0, 0, 750, 118);
+            Round(hud, "Portrait setting", 15, 1, 44, 42, "39251C", "F4B943", 14, "170F0D");
+            Image(hud, "Warden portrait", "av_" + profile.avatar, 17, 2, 39, 39);
+            var name = Label(hud, profile.name, 71, 0, 325, 43, 22, Ink);
             name.resizeTextForBestFit = true;
             name.resizeTextForBestFit = true;
             name.resizeTextMinSize = 15;
             name.resizeTextMinSize = 15;
             name.resizeTextMaxSize = 22;
             name.resizeTextMaxSize = 22;
-            coinLabel = WalletPill("Gold", "ui_coin", 435, 108, "70404B", "FFCE65");
-            shardLabel = WalletPill("Shards", "ui_gem", 554, 89, "34627C", "79D6FF");
-            var pause = Round(hud, "Pause bezel", 664, 18, 49, 45, "22171C", "804452", 14, "120D10");
+            coinLabel = WalletPill("Gold", "ui_coin", 450, 94, "70404B", "FFCE65");
+            shardLabel = WalletPill("Shards", "ui_gem", 554, 83, "34627C", "79D6FF");
+            var pause = Round(hud, "Pause bezel", 693, 1, 46, 41, "22171C", "804452", 14, "120D10");
             for (int i = 0; i < 2; i++)
             for (int i = 0; i < 2; i++)
-                Solid(pause.transform, "Pause bar", 18 + i * 9, 15, 5, 15, Ink);
-            Hotspot(hud, "Pause battle", 652, 2, 78, 70, PauseSheet);
-            movesLabel = StatCard("MOVES", 22, "FF7964", "B82E23", "F8AA91", "A33D2C", Color.white);
-            sealLabel = StatCard("SEAL", 261, "FFDA5E", "C48812", "FFE49B", "BE8D29", Hex("442C0C"));
-            nightLabel = StatCard("NIGHT", 500, "67C8FC", "1B67AC", "96D5FE", "357CAA", Color.white);
-            Hotspot(hud, "Seal details", 261, 78, 228, 78, SealSheet);
+                Solid(pause.transform, "Pause bar", 17 + i * 9, 12, 5, 15, Ink);
+            Hotspot(hud, "Pause battle", 674, 0, 74, 49, PauseSheet);
+            movesLabel = StatCard("MOVES", 15, "FF7964", "B82E23", "F8AA91", "A33D2C", Color.white);
+            sealLabel = StatCard("SEAL", 255, "FFDA5E", "C48812", "FFE49B", "BE8D29", Hex("442C0C"));
+            nightLabel = StatCard("NIGHT", 497, "67C8FC", "1B67AC", "96D5FE", "357CAA", Color.white);
+            Hotspot(hud, "Seal details", 255, 49, 230, 69, SealSheet);
         }
         }
         Text WalletPill(string name, string icon, float x, float w, string border, string accent)
         Text WalletPill(string name, string icon, float x, float w, string border, string accent)
         {
         {
-            var pill = Round(hud, name, x, 18, w, 44, "21171A", border, 22, "0F0B10");
-            var symbol = Image(pill.transform, icon, icon, 15, 11, 21, 21);
+            var pill = Round(hud, name, x, 1, w, 41, "21171A", border, 22, "0F0B10");
+            var symbol = Image(pill.transform, icon, icon, 14, 10, 21, 21);
             symbol.uvRect = name == "Gold" ? new Rect(.17f, .17f, .66f, .66f) : new Rect(.20f, .18f, .6f, .64f);
             symbol.uvRect = name == "Gold" ? new Rect(.17f, .17f, .66f, .66f) : new Rect(.20f, .18f, .6f, .64f);
             symbol.color = Hex(accent);
             symbol.color = Hex(accent);
-            var label = Label(pill.transform, "", 37, 0, w - 46, 44, 22, Hex(accent), TextAnchor.MiddleCenter);
+            var label = Label(pill.transform, "", 37, 0, w - 45, 41, 22, Hex(accent), TextAnchor.MiddleCenter);
             label.resizeTextForBestFit = true;
             label.resizeTextForBestFit = true;
             label.resizeTextMinSize = 12;
             label.resizeTextMinSize = 12;
             label.resizeTextMaxSize = 22;
             label.resizeTextMaxSize = 22;
@@ -230,10 +203,10 @@ namespace TowerDevil
         }
         }
         Text StatCard(string caption, float x, string hi, string lo, string rim, string inset, Color ink)
         Text StatCard(string caption, float x, string hi, string lo, string rim, string inset, Color ink)
         {
         {
-            Round(hud, caption + " shadow", x, 82, 228, 78, "28171B", "241418", 21, "100B0E");
-            var card = Round(hud, caption + " card", x, 77, 228, 78, hi, rim, 21, lo);
+            Round(hud, caption + " shadow", x, 53, 232, 68, "28171B", "241418", 21, "100B0E");
+            var card = Round(hud, caption + " card", x, 49, 232, 68, hi, rim, 21, lo);
             card.stroke = 3;
             card.stroke = 3;
-            var badge = Round(card.transform, "Icon well", 17, 20, 40, 38, inset, inset, 12);
+            var badge = Round(card.transform, "Icon well", 15, 15, 40, 38, inset, inset, 12);
             if (caption == "SEAL")
             if (caption == "SEAL")
             {
             {
                 Shield(badge.transform, 11, 9, 18, 19, "77501D", "513714");
                 Shield(badge.transform, 11, 9, 18, 19, "77501D", "513714");
@@ -250,8 +223,8 @@ namespace TowerDevil
                 }
                 }
                 Round(badge.transform, "Sun", 13, 12, 14, 14, "FFF0D6", "FFF0D6", 7);
                 Round(badge.transform, "Sun", 13, 12, 14, 14, "FFF0D6", "FFF0D6", 7);
             }
             }
-            var value = Label(card.transform, "", 70, 8, 145, 40, 30, ink);
-            Label(card.transform, caption, 71, 45, 142, 23, 14, ink);
+            var value = Label(card.transform, "", 70, 4, 150, 34, 30, ink);
+            Label(card.transform, caption, 71, 38, 145, 23, 14, ink);
             return value;
             return value;
         }
         }
         static void Shield(Transform parent, float x, float y, float width, float height, string top, string bottom)
         static void Shield(Transform parent, float x, float y, float width, float height, string top, string bottom)
@@ -263,18 +236,18 @@ namespace TowerDevil
         }
         }
         void SideAction(string label, string glyph, float x, System.Action callback)
         void SideAction(string label, string glyph, float x, System.Action callback)
         {
         {
-            var button = ButtonAt(actionArea, label, x, 0, 168, 82, callback, false, 18);
+            var button = ButtonAt(actionArea, label, x, 0, 186, 62, callback, false, 18);
             StyleBattleButton(button, false);
             StyleBattleButton(button, false);
             var caption = button.GetComponentInChildren<Text>().rectTransform;
             var caption = button.GetComponentInChildren<Text>().rectTransform;
-            caption.anchoredPosition = new Vector2(53, -2);
-            caption.sizeDelta = new Vector2(94, 78);
-            Image(button.transform, label + " icon", "ui_" + glyph, 37, 29, 24, 24).color = Ink;
+            caption.anchoredPosition = new Vector2(58, -2);
+            caption.sizeDelta = new Vector2(96, 58);
+            Image(button.transform, label + " icon", "ui_" + glyph, 40, 18, 27, 27).color = Ink;
         }
         }
         void StyleBattleButton(Button button, bool primary)
         void StyleBattleButton(Button button, bool primary)
         {
         {
             var plate = (IronPanel)button.targetGraphic;
             var plate = (IronPanel)button.targetGraphic;
             plate.rounded = true;
             plate.rounded = true;
-            plate.bevel = 24;
+            plate.bevel = 19;
             plate.stroke = 3;
             plate.stroke = 3;
             plate.top = Hex(primary ? "FFDC77" : "482932");
             plate.top = Hex(primary ? "FFDC77" : "482932");
             plate.bottom = Hex(primary ? "E89B22" : "2E1821");
             plate.bottom = Hex(primary ? "E89B22" : "2E1821");
@@ -288,13 +261,15 @@ namespace TowerDevil
             string caption = run.Phase == Phase.Assault ? "HORDE ATTACKING"
             string caption = run.Phase == Phase.Assault ? "HORDE ATTACKING"
                              : run.Phase == Phase.Rest  ? "DONE"
                              : run.Phase == Phase.Rest  ? "DONE"
                                                         : "LET THEM COME";
                                                         : "LET THEM COME";
-            var b = ButtonAt(actionArea, caption, 208, 0, 334, 82, BeginAttack, true, 23, run.CanArrange);
+            var b = ButtonAt(actionArea, caption, 219, 0, 312, 62, BeginAttack, true, 23, run.CanArrange);
             StyleBattleButton(b, true);
             StyleBattleButton(b, true);
             b.name = "Primary";
             b.name = "Primary";
-            var label = b.GetComponentInChildren<Text>().rectTransform;
+            var captionText = b.GetComponentInChildren<Text>();
+            captionText.font = sans;
+            var label = captionText.rectTransform;
             label.anchoredPosition = new Vector2(52, -2);
             label.anchoredPosition = new Vector2(52, -2);
-            label.sizeDelta = new Vector2(267, 78);
-            Image(b.transform, "Sword", "ui_sword", 30, 25, 32, 32).color = Hex("342315");
+            label.sizeDelta = new Vector2(247, 58);
+            Image(b.transform, "Sword", "ui_sword", 27, 15, 32, 32).color = Hex("342315");
         }
         }
         void BeginAttack()
         void BeginAttack()
         {
         {
@@ -337,6 +312,32 @@ namespace TowerDevil
                 RefreshHud();
                 RefreshHud();
         }
         }
 
 
+        static Vector2 SetRegion(RawImage image, Sprite sprite, bool flip)
+        {
+            Texture2D texture = sprite.texture;
+            Rect crop = sprite.rect;
+            var uv = new Rect(crop.x / texture.width, crop.y / texture.height,
+                              crop.width / texture.width, crop.height / texture.height);
+            if (flip)
+                uv = new Rect(uv.xMax, uv.y, -uv.width, uv.height);
+            image.texture = texture;
+            image.uvRect = uv;
+            return crop.size;
+        }
+        void SetPieceArt(RawImage image, Piece piece, bool firing = false)
+        {
+            // The painted cannon points right at rest. A shot sets its actual facing;
+            // board re-layouts retain that facing until the next shot.
+            bool flip = piece.Kind == Kind.Cannon && (firing ? !piece.Reversed : image.uvRect.width < 0);
+            Vector2 size = SetRegion(image, courtSprites[piece.Art], flip);
+            image.name = piece.Art;
+            float footprint = piece.Kind switch {
+                Kind.Stone => .70f, Kind.Ice => .74f, Kind.Gold => .80f, Kind.Ballista => .91f,
+                Kind.Frost => .90f, Kind.Cannon => .86f, Kind.Arrow => .86f, _ => .77f
+            };
+            float span = BoardLayout.FrontCell * (footprint + .035f * (piece.Tier - 1));
+            image.rectTransform.sizeDelta = size * (span / Mathf.Max(size.x, size.y));
+        }
         void DrawBoard(Piece[,] cells, Dictionary<RectTransform, Vector2> previous = null)
         void DrawBoard(Piece[,] cells, Dictionary<RectTransform, Vector2> previous = null)
         {
         {
             var used = new HashSet<Piece>();
             var used = new HashSet<Piece>();
@@ -349,18 +350,15 @@ namespace TowerDevil
                     used.Add(p);
                     used.Add(p);
                     if (!pieces.TryGetValue(p, out var image))
                     if (!pieces.TryGetValue(p, out var image))
                     {
                     {
-                        float span = BoardLayout.FrontCell * (p.Tower ? 1.14f + .05f * (p.Tier - 1) :
-                                                             p.Kind == Kind.Chest ? 1.02f : 1f);
-                        image = Image(tiles, p.Art, p.Art, 0, 0, span, span);
+                        image = Box(tiles, p.Art, 0, 0, 0, 0).gameObject.AddComponent<RawImage>();
+                        image.raycastTarget = false;
                         image.rectTransform.pivot = new Vector2(.5f, 0);
                         image.rectTransform.pivot = new Vector2(.5f, 0);
                         pieces.Add(p, image);
                         pieces.Add(p, image);
                     }
                     }
-                    image.texture = Art(p.Art);
-                    image.uvRect = new Rect(p.Kind == Kind.Cannon && p.Reversed ? 1 : 0, 0,
-                                            p.Kind == Kind.Cannon && p.Reversed ? -1 : 1, 1);
+                    SetPieceArt(image, p);
                     var rt = image.rectTransform;
                     var rt = image.rectTransform;
                     var center = BoardLayout.Center(r, c);
                     var center = BoardLayout.Center(r, c);
-                    var end = center + Vector2.down * (BoardLayout.Size(r) * (p.Tower ? .54f : .58f));
+                    var end = center + Vector2.down * (BoardLayout.Depth(r) * .42f);
                     rt.localScale = Vector3.one * (BoardLayout.Size(r) / BoardLayout.FrontCell);
                     rt.localScale = Vector3.one * (BoardLayout.Size(r) / BoardLayout.FrontCell);
                     rt.SetAsLastSibling();
                     rt.SetAsLastSibling();
                     if (previous != null && !previous.ContainsKey(rt))
                     if (previous != null && !previous.ContainsKey(rt))
@@ -377,6 +375,12 @@ namespace TowerDevil
                 }
                 }
             foreach (var key in removed)
             foreach (var key in removed)
                 pieces.Remove(key);
                 pieces.Remove(key);
+            pieceShadows.SetVerticesDirty();
+        }
+        void LateUpdate()
+        {
+            if (route == "Run" && pieceShadows && (animating || held || run.Phase == Phase.Assault))
+                pieceShadows.SetVerticesDirty();
         }
         }
         void UpdateRun()
         void UpdateRun()
         {
         {

+ 15 - 20
Assets/TowerDevil/Scripts/BoardLayout.cs

@@ -2,41 +2,36 @@ using UnityEngine;
 
 
 namespace TowerDevil
 namespace TowerDevil
 {
 {
-    // Coordinates are local to the board's top edge, with +Y pointing up in uGUI.
+    // Coordinates are measured from the back edge of the courtyard; uGUI Y increases upwards.
     internal static class BoardLayout
     internal static class BoardLayout
     {
     {
-        internal const float Width = 750, FrontCell = 106, Gap = 14;
+        internal const float Width = 750, FrontCell = 116;
         const int Count = Run.Size;
         const int Count = Run.Size;
-        const float BackCell = FrontCell * .88f;
-        const float Step = (FrontCell - BackCell) / (Count - 1);
-        internal static float Size(float row) => BackCell + Step * Mathf.Clamp(row, 0, Count - 1);
-        internal static float Top(int row) => row * (BackCell + Gap) + Step * row * (row - 1) * .5f;
-        internal static float Height => Top(Count - 1) + FrontCell;
+        const float BackCell = 107, BackDepth = 91, FrontDepth = 98;
+        const float DepthStep = (FrontDepth - BackDepth) / (Count - 1);
+
+        internal static float Size(float row) => Mathf.Lerp(BackCell, FrontCell, row / (Count - 1));
+        internal static float Depth(int row) => BackDepth + DepthStep * row;
+        internal static float Top(int row) => row * BackDepth + DepthStep * row * (row - 1) * .5f;
+        internal static float Height => Top(Count);
 
 
         internal static Vector2 Center(float row, float col)
         internal static Vector2 Center(float row, float col)
         {
         {
-            // Project the logical half-row boundaries to the midpoint of each gutter.
             int band = Mathf.Clamp(Mathf.FloorToInt(row + .5f), 0, Count - 1);
             int band = Mathf.Clamp(Mathf.FloorToInt(row + .5f), 0, Count - 1);
-            float y = Top(band) + Size(band) * .5f + (row - band) * (Size(band) + Gap);
-            if (row >= Count - .5f)
-                y -= Gap * .5f;
-            else if (row > Count - 1)
-                y -= (row - Count + 1) * Gap;
+            float y = Top(band) + (row - band + .5f) * Depth(band);
             return new Vector2(Width * .5f + (col - (Count - 1) * .5f) * Size(row), -y);
             return new Vector2(Width * .5f + (col - (Count - 1) * .5f) * Size(row), -y);
         }
         }
 
 
         internal static bool TryCell(Vector2 point, out int row, out int col)
         internal static bool TryCell(Vector2 point, out int row, out int col)
         {
         {
             col = -1;
             col = -1;
+            float depth = -point.y;
             for (row = 0; row < Count; row++)
             for (row = 0; row < Count; row++)
             {
             {
-                float size = Size(row), y = -point.y - Top(row);
-                if (y < 0 || y >= size - 3)
-                    continue;
-                float x = point.x - (Width - Count * size) * .5f;
-                col = Mathf.FloorToInt(x / size);
-                float within = x - col * size;
-                return col >= 0 && col < Count && within >= 1.5f && within < size - 1.5f;
+                if (depth < Top(row) || depth >= Top(row + 1)) continue;
+                float size = Size(row);
+                col = Mathf.FloorToInt((point.x - Width * .5f) / size + Count * .5f);
+                return col >= 0 && col < Count;
             }
             }
             return false;
             return false;
         }
         }

+ 3 - 1
Assets/TowerDevil/Scripts/BoardMotion.cs

@@ -38,6 +38,7 @@ namespace TowerDevil
                 held.localRotation = Quaternion.identity;
                 held.localRotation = Quaternion.identity;
             }
             }
             held = null;
             held = null;
+            if (pieceShadows) pieceShadows.SetVerticesDirty();
         }
         }
         static Color MaterialGlow(Kind k)
         static Color MaterialGlow(Kind k)
         {
         {
@@ -101,7 +102,7 @@ namespace TowerDevil
                         bool born = !oldScale.TryGetValue(rt, out var scale);
                         bool born = !oldScale.TryGetValue(rt, out var scale);
                         var start = oldPos[rt];
                         var start = oldPos[rt];
                         if (born && arrivals[c] > 0)
                         if (born && arrivals[c] > 0)
-                            start = end + Vector2.up * arrivals[c] * (BoardLayout.Size(0) + BoardLayout.Gap);
+                            start = end + Vector2.up * arrivals[c] * BoardLayout.Depth(0);
                         if (born && forge)
                         if (born && forge)
                         {
                         {
                             start = end;
                             start = end;
@@ -157,6 +158,7 @@ namespace TowerDevil
                 }
                 }
             }
             }
             animating = false;
             animating = false;
+            pieceShadows.SetVerticesDirty();
             playback = null;
             playback = null;
             RefreshHud();
             RefreshHud();
             if (run.Phase == Phase.Plan && run.Moves == 0)
             if (run.Phase == Phase.Plan && run.Moves == 0)

+ 6 - 4
Assets/TowerDevil/Scripts/CombatMotion.cs

@@ -104,8 +104,7 @@ namespace TowerDevil
             Vector2 end = HitPoint(run.ShotEnd ?? foe), start = Muzzle(r, c, tower.Kind, end);
             Vector2 end = HitPoint(run.ShotEnd ?? foe), start = Muzzle(r, c, tower.Kind, end);
             if (pieces.TryGetValue(tower, out var im))
             if (pieces.TryGetValue(tower, out var im))
             {
             {
-                im.texture = Art(tower.Art);
-                im.uvRect = tower.Kind == Kind.Cannon && tower.Reversed ? new Rect(1, 0, -1, 1) : new Rect(0, 0, 1, 1);
+                SetPieceArt(im, tower, true);
                 StartCoroutine(Kick(im.rectTransform, (end - start).normalized, tower.Kind));
                 StartCoroutine(Kick(im.rectTransform, (end - start).normalized, tower.Kind));
             }
             }
             battleEffects.Shoot(tower.Kind, start, end);
             battleEffects.Shoot(tower.Kind, start, end);
@@ -176,7 +175,9 @@ namespace TowerDevil
             if (route != "Run")
             if (route != "Run")
                 return;
                 return;
             var from = Feet(foe);
             var from = Feet(foe);
-            var target = new Vector2(Mathf.Lerp(from.x, 375, .56f), 124);
+            Vector2 seal = boardStage.InverseTransformPoint(courtyard.rectTransform.TransformPoint(
+                courtyard.Point(CourtyardBackdrop.SealU, CourtyardBackdrop.SealV)));
+            var target = new Vector2(Mathf.Lerp(from.x, seal.x, .63f), seal.y - 20);
             if (foes.TryGetValue(foe, out var existing))
             if (foes.TryGetValue(foe, out var existing))
             {
             {
                 Remove(existing.root);
                 Remove(existing.root);
@@ -232,7 +233,8 @@ namespace TowerDevil
             Vector2 shake = gateHitTime >= 0 && t >= 0 && t < .24f
             Vector2 shake = gateHitTime >= 0 && t >= 0 && t < .24f
                                 ? new Vector2(Mathf.Sin(77 * t) * 8, Mathf.Cos(94 * t) * 4) * (1 - t / .24f)
                                 ? new Vector2(Mathf.Sin(77 * t) * 8, Mathf.Cos(94 * t) * 4) * (1 - t / .24f)
                                 : Vector2.zero;
                                 : Vector2.zero;
-            gateArt.rectTransform.anchoredPosition = shake;
+            courtyard.MoveGate(shake);
+            gateFractures.rectTransform.anchoredPosition = fractureOrigin + shake;
         }
         }
     }
     }
 }
 }

+ 79 - 0
Assets/TowerDevil/Scripts/CourtyardBackdrop.cs

@@ -0,0 +1,79 @@
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace TowerDevil
+{
+    // The castle and paving occupy one continuous painting. The two flexible margins
+    // absorb aspect-ratio changes while the castle base stays aligned with the seal HUD.
+    [RequireComponent(typeof(CanvasRenderer))]
+    public sealed class CourtyardBackdrop : MaskableGraphic
+    {
+        const float Crown = .10f, Base = .29f;
+        internal const float SealU = .5f, SealV = .235f;
+        static readonly float[] columns = { 0, .12f, .23f, .36f, .5f, .64f, .77f, .88f, 1 };
+        static readonly float[] rows = { 0, Crown * .5f, Crown, .16f, SealV, Base, Base + .055f, .70f, .79f, .88f, .95f, 1 };
+        Texture2D painting;
+        float crownDepth, baseDepth, foregroundWidth;
+        Vector2 shake;
+        public override Texture mainTexture => painting ? painting : base.mainTexture;
+
+        internal void SetPainting(Texture2D art)
+        {
+            painting = art;
+            raycastTarget = false;
+            SetMaterialDirty();
+        }
+        internal void Fit(float crownY, float baseY, float visibleWidth)
+        {
+            crownDepth = crownY;
+            baseDepth = baseY;
+            foregroundWidth = visibleWidth;
+            SetVerticesDirty();
+        }
+        internal Vector2 Point(float u, float v)
+        {
+            float depth;
+            if (v <= Crown) depth = Mathf.Lerp(0, crownDepth, v / Crown);
+            else if (v <= Base) depth = Mathf.Lerp(crownDepth, baseDepth, (v - Crown) / (Base - Crown));
+            else depth = Mathf.Lerp(baseDepth, rectTransform.rect.height, (v - Base) / (1 - Base));
+            float artworkWidth = rectTransform.rect.width;
+            // Bring the foreground rock shoulders into view on narrow phones.
+            float width = Mathf.SmoothStep(artworkWidth, foregroundWidth, Mathf.InverseLerp(.70f, .95f, v));
+            return new Vector2(artworkWidth * .5f + (u - .5f) * width, -depth);
+        }
+        internal void MoveGate(Vector2 offset)
+        {
+            if (shake == offset) return;
+            shake = offset;
+            SetVerticesDirty();
+        }
+        internal void RegisterFractures(RectTransform overlay)
+        {
+            // Bounds of the central gatehouse within the backdrop, measured in art UVs from the top.
+            Vector2 a = Point(.20f, .094f), b = Point(.80f, .272f);
+            overlay.anchoredPosition = a;
+            overlay.sizeDelta = new Vector2(b.x - a.x, a.y - b.y);
+        }
+        protected override void OnPopulateMesh(VertexHelper mesh)
+        {
+            mesh.Clear();
+            for (int r = 0; r < rows.Length; r++)
+            {
+                float v = rows[r];
+                float vertical = Mathf.InverseLerp(Crown * .5f, Crown, v) *
+                                 (1 - Mathf.InverseLerp(Base, Base + .055f, v));
+                for (int c = 0; c < columns.Length; c++)
+                {
+                    float u = columns[c];
+                    float lateral = Mathf.InverseLerp(0, .20f, Mathf.Min(u, 1 - u));
+                    mesh.AddVert(Point(u,v) + shake * (vertical * lateral), color, new Vector2(u, 1 - v));
+                    if (r == 0 || c == 0) continue;
+                    int d = r * columns.Length + c;
+                    int a = d - columns.Length - 1;
+                    mesh.AddTriangle(a, a + 1, d);
+                    mesh.AddTriangle(a, d, d - 1);
+                }
+            }
+        }
+    }
+}

+ 2 - 0
Assets/TowerDevil/Scripts/CourtyardBackdrop.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: 6ff059c673c6d844ebccc0b1bc28ca6b

+ 2 - 1
Assets/TowerDevil/Scripts/GamePages.cs

@@ -278,7 +278,8 @@ namespace TowerDevil
             Sheet(p.Kind.ToString().ToUpperInvariant(),
             Sheet(p.Kind.ToString().ToUpperInvariant(),
                   () =>
                   () =>
                   {
                   {
-                      Image(sheetBody, p.Art, p.Art, 232, 5, 150, 140);
+                      var icon = Image(sheetBody, p.Art, p.Art, 232, 5, 150, 140);
+                      if (pieces.TryGetValue(p, out var figure)) icon.uvRect = figure.uvRect;
                       bodyY = 155;
                       bodyY = 155;
                       Note(tips[index]);
                       Note(tips[index]);
                       Stat("Tier", p.Tier + " / 3");
                       Stat("Tier", p.Tier + " / 3");

+ 56 - 0
Assets/TowerDevil/Scripts/PieceShadows.cs

@@ -0,0 +1,56 @@
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+namespace TowerDevil
+{
+    // All contact shadows share a mesh underneath the removable and animated pieces.
+    [RequireComponent(typeof(CanvasRenderer))]
+    public sealed class PieceShadows : MaskableGraphic
+    {
+        Dictionary<Piece, RawImage> figures;
+        const int Segments = 16;
+        static readonly Vector2[] circle = BuildCircle();
+
+        static Vector2[] BuildCircle()
+        {
+            var points = new Vector2[Segments];
+            for (int i = 0; i < Segments; i++)
+            {
+                float angle = i * 2 * Mathf.PI / Segments;
+                points[i] = new Vector2(Mathf.Cos(angle), Mathf.Sin(angle));
+            }
+            return points;
+        }
+
+        internal void Bind(Dictionary<Piece, RawImage> pieces) => figures = pieces;
+
+        protected override void OnPopulateMesh(VertexHelper mesh)
+        {
+            mesh.Clear();
+            if (figures == null) return;
+            foreach (var pair in figures)
+            {
+                RectTransform rt = pair.Value.rectTransform;
+                float width = rt.rect.width * rt.localScale.x;
+                Vector2 center = rt.anchoredPosition + new Vector2(width * .055f, width * .055f);
+                Vector2 radius = new Vector2(width * .54f, width * .15f);
+                int start = mesh.currentVertCount;
+                mesh.AddVert(center, new Color32(12, 8, 13, 179), Vector2.zero);
+                for (int i = 0; i < Segments; i++)
+                {
+                    Vector2 d = Vector2.Scale(circle[i], radius);
+                    mesh.AddVert(center + d * .47f, new Color32(14, 10, 14, 142), Vector2.zero);
+                    mesh.AddVert(center + d, new Color32(14, 10, 14, 0), Vector2.zero);
+                }
+                for (int i = 0; i < Segments; i++)
+                {
+                    int a = start + 1 + i * 2, b = start + 1 + ((i + 1) % Segments) * 2;
+                    mesh.AddTriangle(start, a, b);
+                    mesh.AddTriangle(a, a + 1, b);
+                    mesh.AddTriangle(a + 1, b + 1, b);
+                }
+            }
+        }
+    }
+}

+ 2 - 0
Assets/TowerDevil/Scripts/PieceShadows.cs.meta

@@ -0,0 +1,2 @@
+fileFormatVersion: 2
+guid: f8cf693f8f9089b47904b0d30415fede

+ 11 - 10
Assets/TowerDevil/Scripts/TowerGame.cs

@@ -12,7 +12,7 @@ namespace TowerDevil
         const string SaveKey = "TowerDevil.iOS.profile.v1";
         const string SaveKey = "TowerDevil.iOS.profile.v1";
         static readonly Color Ink = Hex("F8E9CC"), Gold = Hex("E6B36F"), Muted = Hex("BEAEA0");
         static readonly Color Ink = Hex("F8E9CC"), Gold = Hex("E6B36F"), Muted = Hex("BEAEA0");
         readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();
         readonly Dictionary<string, Texture2D> textures = new Dictionary<string, Texture2D>();
-        RectTransform screen, frame, page, modal, toastRoot, battleVeil;
+        RectTransform screen, frame, page, modal, toastRoot;
         RawImage environment;
         RawImage environment;
         Font sans, serif;
         Font sans, serif;
         Profile profile;
         Profile profile;
@@ -69,11 +69,6 @@ namespace TowerDevil
             Stretch(environment.rectTransform);
             Stretch(environment.rectTransform);
             var wash = Solid(screen, "Environment shadow", 0, 0, 750, 1334, new Color(.04f, .025f, .035f, .57f));
             var wash = Solid(screen, "Environment shadow", 0, 0, 750, 1334, new Color(.04f, .025f, .035f, .57f));
             Stretch(wash.rectTransform);
             Stretch(wash.rectTransform);
-            battleVeil = Box(screen, "Battle lighting", 0, 0, 750, 1334);
-            Stretch(battleVeil);
-            BattleShade(0, .16f, .93f, .88f);
-            BattleShade(.16f, .7f, .88f, .40f);
-            BattleShade(.7f, 1, .40f, .71f);
             frame = Box(screen, "Safe play area", 0, 0, 750, 1334);
             frame = Box(screen, "Safe play area", 0, 0, 750, 1334);
             frame.pivot = new Vector2(.5f, .5f);
             frame.pivot = new Vector2(.5f, .5f);
             frame.anchorMin = frame.anchorMax = new Vector2(.5f, .5f);
             frame.anchorMin = frame.anchorMax = new Vector2(.5f, .5f);
@@ -196,14 +191,21 @@ namespace TowerDevil
                        bool contain = true)
                        bool contain = true)
         {
         {
             var im = Box(parent, name, x, y, w, h).gameObject.AddComponent<RawImage>();
             var im = Box(parent, name, x, y, w, h).gameObject.AddComponent<RawImage>();
-            im.texture = Art(art);
             im.raycastTarget = false;
             im.raycastTarget = false;
+            Vector2 source = Vector2.zero;
+            if (contain && route == "Run" && courtSprites.TryGetValue(art, out var sprite))
+                source = SetRegion(im, sprite, false);
+            else
+            {
+                im.texture = Art(art);
+                if (im.texture) source = new Vector2(im.texture.width, im.texture.height);
+            }
             if (im.texture)
             if (im.texture)
             {
             {
                 if (contain)
                 if (contain)
                 {
                 {
-                    float scale = Mathf.Min(w / im.texture.width, h / im.texture.height);
-                    var size = new Vector2(im.texture.width, im.texture.height) * scale;
+                    float scale = Mathf.Min(w / source.x, h / source.y);
+                    var size = source * scale;
                     im.rectTransform.sizeDelta = size;
                     im.rectTransform.sizeDelta = size;
                     im.rectTransform.anchoredPosition = new Vector2(x + (w - size.x) * .5f, -y - (h - size.y) * .5f);
                     im.rectTransform.anchoredPosition = new Vector2(x + (w - size.x) * .5f, -y - (h - size.y) * .5f);
                 }
                 }
@@ -284,7 +286,6 @@ namespace TowerDevil
             Remove(toastRoot);
             Remove(toastRoot);
             toastRoot = null;
             toastRoot = null;
             route = next;
             route = next;
-            battleVeil.gameObject.SetActive(next == "Run");
             page = Box(frame, next, 0, 0, 750, 1334);
             page = Box(frame, next, 0, 0, 750, 1334);
             nextAttack = -1;
             nextAttack = -1;
             if (next != "Run")
             if (next != "Run")

+ 52 - 12
Assets/TowerDevil/Tests/PlayMode/InterfaceTests.cs

@@ -1,6 +1,7 @@
 #if UNITY_EDITOR
 #if UNITY_EDITOR
 using System.Collections;
 using System.Collections;
 using System.Collections.Generic;
 using System.Collections.Generic;
+using System.Linq;
 using NUnit.Framework;
 using NUnit.Framework;
 using UnityEngine;
 using UnityEngine;
 using UnityEngine.EventSystems;
 using UnityEngine.EventSystems;
@@ -49,11 +50,14 @@ namespace TowerDevil.Tests
             Assert.IsNotNull(handler, name);
             Assert.IsNotNull(handler, name);
             ExecuteEvents.Execute(handler, e, ExecuteEvents.pointerClickHandler);
             ExecuteEvents.Execute(handler, e, ExecuteEvents.pointerClickHandler);
         }
         }
+        static RectTransform PieceAt(int row, int col) =>
+            (RectTransform)GameObject.Find("Pieces").transform.GetChild(row * Run.Size + col);
+
         static void Swipe(int r, int c, int dr, int dc)
         static void Swipe(int r, int c, int dr, int dc)
         {
         {
             var rect = (RectTransform)GameObject.Find("Board input").transform;
             var rect = (RectTransform)GameObject.Find("Board input").transform;
-            var cell = (RectTransform)GameObject.Find("Cell " + r + "," + c).transform;
-            var next = (RectTransform)GameObject.Find("Cell " + (r + dr) + "," + (c + dc)).transform;
+            var cell = PieceAt(r, c);
+            var next = PieceAt(r + dr, c + dc);
             var e = At(LocalPoint(cell, cell.rect.center));
             var e = At(LocalPoint(cell, cell.rect.center));
             var hit = e.pointerCurrentRaycast.gameObject;
             var hit = e.pointerCurrentRaycast.gameObject;
             Assert.AreEqual(rect.gameObject, hit);
             Assert.AreEqual(rect.gameObject, hit);
@@ -67,18 +71,27 @@ namespace TowerDevil.Tests
         public IEnumerator PerspectiveCellsMatchRaycastsAndExcludeTheRunway()
         public IEnumerator PerspectiveCellsMatchRaycastsAndExcludeTheRunway()
         {
         {
             var input = GameObject.Find("Board input").GetComponent<BoardInput>();
             var input = GameObject.Find("Board input").GetComponent<BoardInput>();
+            var fieldRect = (RectTransform)input.transform;
             float previousWidth = 0;
             float previousWidth = 0;
-            for (int r = 0; r < 6; r++)
+            Assert.IsNull(GameObject.Find("Board rim"));
+            Assert.IsEmpty(fieldRect.parent.GetComponentsInChildren<IronPanel>(true)
+                               .Where(panel => panel.name.StartsWith("Cell ") || panel.name.StartsWith("Rank ")));
+            for (int r = 0; r < Run.Size; r++)
             {
             {
-                var first = (RectTransform)GameObject.Find("Cell " + r + ",0").transform;
-                Assert.Greater(first.rect.width, previousWidth);
-                previousWidth = first.rect.width;
-                Assert.False(input.IsRaycastLocationValid(LocalPoint(first, first.rect.center -
-                    Vector2.right * (first.rect.width * .5f + 5)), null));
-                for (int c = 0; c < 6; c++)
+                var first = PieceAt(r, 0);
+                var last = PieceAt(r, Run.Size - 1);
+                float spacing = (last.anchoredPosition.x - first.anchoredPosition.x) / (Run.Size - 1);
+                Assert.Greater(spacing, previousWidth);
+                previousWidth = spacing;
+                var outside = new Vector2(first.anchoredPosition.x - spacing * .5f - 3, BoardLayout.Center(r, 0).y);
+                Assert.False(input.IsRaycastLocationValid(LocalPoint(fieldRect, outside), null));
+                for (int c = 0; c < Run.Size; c++)
                 {
                 {
-                    var cell = (RectTransform)GameObject.Find("Cell " + r + "," + c).transform;
-                    Assert.AreSame(input.gameObject, At(LocalPoint(cell, cell.rect.center)).pointerCurrentRaycast.gameObject);
+                    var piece = PieceAt(r, c);
+                    Vector2 point = fieldRect.InverseTransformPoint(piece.TransformPoint(piece.rect.center));
+                    Assert.AreSame(input.gameObject, At(LocalPoint(piece, piece.rect.center)).pointerCurrentRaycast.gameObject);
+                    Assert.True(BoardLayout.TryCell(point, out var row, out var col));
+                    Assert.AreEqual(new Vector2Int(c, r), new Vector2Int(col, row));
                 }
                 }
             }
             }
             var field = (RectTransform)input.transform;
             var field = (RectTransform)input.transform;
@@ -88,6 +101,33 @@ namespace TowerDevil.Tests
             Assert.NotNull(GameObject.Find("RESUME"));
             Assert.NotNull(GameObject.Find("RESUME"));
         }
         }
 
 
+        [UnityTest]
+        public IEnumerator CourtyardSpritesCoverEveryTierAndFaceTheActualShot()
+        {
+            var names = Resources.LoadAll<Sprite>("DevilArt/Courtyard").Select(sprite => sprite.name).ToHashSet();
+            foreach (Kind kind in System.Enum.GetValues(typeof(Kind)))
+            {
+                int tiers = kind == Kind.Chest ? 4 : kind >= Kind.Cannon ? 3 : 1;
+                for (int tier = 1; tier <= tiers; tier++)
+                {
+                    var piece = new Piece(kind, tier);
+                    Assert.Contains(piece.Art, names.ToList());
+                    piece.Reversed = true;
+                    Assert.Contains(piece.Art, names.ToList());
+                }
+            }
+            var run = game.CurrentRun;
+            var cannon = PieceAt(3, 1).GetComponent<RawImage>();
+            foreach (float col in new[] { 4f, 0f })
+            {
+                run.Enemies.Clear();
+                run.Enemies.Add(new Foe(Breed.Armor, col, 3, 8));
+                run.Fire(3, 1, run.Board[3, 1]);
+                Assert.AreEqual(col > 1, cannon.uvRect.width > 0);
+            }
+            yield return null;
+        }
+
         [UnityTest]
         [UnityTest]
         public IEnumerator CornerSwipesOnAllFourEdges()
         public IEnumerator CornerSwipesOnAllFourEdges()
         {
         {
@@ -209,7 +249,7 @@ namespace TowerDevil.Tests
             Assert.True(sawMerge);
             Assert.True(sawMerge);
             Assert.True(game.CanUseBoard);
             Assert.True(game.CanUseBoard);
             var art = GameObject.Find("Pieces").GetComponentsInChildren<RawImage>();
             var art = GameObject.Find("Pieces").GetComponentsInChildren<RawImage>();
-            Assert.AreEqual(2, System.Array.FindAll(art, item => item.texture.name == "ballista").Length);
+            Assert.AreEqual(2, System.Array.FindAll(art, item => item.name == "ballista").Length);
         }
         }
         [UnityTest]
         [UnityTest]
         public IEnumerator FourWeaponHitsAndGateLungeFollowTheSimulation()
         public IEnumerator FourWeaponHitsAndGateLungeFollowTheSimulation()