Hologram calls, HaulOS phone, Enhanced lighting, smoother camera; Blender remaster review files
Game: - Assistant and Director portraits: GPT backgrounds and a holographic appear/disappear shader (Talk/TalkHolo) instead of on/off - Phone redesigned (HaulOS home, address bar, dock, error/loading states) and the browser link made sturdier - Settings > Graphics > Lighting: Classic / Enhanced (runtime volume, no project assets changed); Enhanced SSAO uses the smooth interleaved-gradient method at high samples so flat panels don't speckle - Painted board textures (T_HullPanel, T_BarnRed) keep only edge wear: the big bare-wood patches read as dirty smudges - The head leans into a sidestep smoothly instead of snapping with A / D - New keys in all 11 languages Review only (nothing swapped into the game yet): ArtSource/Blender/remaster (v1 paint pass of our own models, Synty-built ones left out), remaster/crew (crew repaint with arm, colour-edge and face fixes), remaster_v2 (smooth-geometry pilot). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BIN
Assets/Art/Textures/T_BarnRed.png
(Stored with Git LFS)
BIN
Assets/Art/Textures/T_BarnRed.png
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Art/Textures/T_HullPanel.png
(Stored with Git LFS)
BIN
Assets/Art/Textures/T_HullPanel.png
(Stored with Git LFS)
Binary file not shown.
BIN
Assets/Art/UI/phone_wallpaper.png
(Stored with Git LFS)
BIN
Assets/Art/UI/phone_wallpaper.png
(Stored with Git LFS)
Binary file not shown.
@ -79,6 +79,16 @@ namespace GrassCutter.EditorTools
|
||||
ti.maxTextureSize = assetPath.Contains("PolygonFarm") || crew ? 2048 : 1024;
|
||||
ti.textureCompression = crew ? TextureImporterCompression.Compressed : TextureImporterCompression.CompressedHQ;
|
||||
}
|
||||
else if (assetPath.StartsWith("Assets/Resources/Talk/"))
|
||||
{
|
||||
// the rooms behind the video calls: mipmapped, so TalkHolo can take them a little out of focus
|
||||
ti.textureType = TextureImporterType.Default;
|
||||
ti.mipmapEnabled = true;
|
||||
ti.sRGBTexture = true;
|
||||
ti.wrapMode = TextureWrapMode.Clamp;
|
||||
ti.maxTextureSize = 1024;
|
||||
ti.textureCompression = TextureImporterCompression.CompressedHQ;
|
||||
}
|
||||
else if (assetPath.StartsWith("Assets/Art/Generated/"))
|
||||
{
|
||||
ti.textureType = TextureImporterType.Default;
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Du kannst hier weitermähen, aber in der Demo gibt es nichts mehr zu kaufen.
|
||||
LEAVE FEEDBACK FEEDBACK GEBEN
|
||||
KEEP MOWING WEITERMÄHEN
|
||||
Browser Browser
|
||||
Try again Nochmal
|
||||
Home Start
|
||||
Enter to go · Esc to cancel Enter: los · Esc: abbrechen
|
||||
Typing on the page · Esc to stop Tippen auf der Seite · Esc: fertig
|
||||
Lighting Beleuchtung
|
||||
Classic Klassisch
|
||||
Enhanced Verbessert
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Verbessert: sattere Farben, warmes Licht und kühle Schatten, tiefere Schattierung und eine unscharfe Welt hinter dem Handy und Fenstern. Klassisch: der ursprüngliche Look.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Puedes seguir segando aquí, pero en la demo ya no hay nada más a la venta.
|
||||
LEAVE FEEDBACK DAR MI OPINIÓN
|
||||
KEEP MOWING SEGUIR SEGANDO
|
||||
Browser Navegador
|
||||
Try again Reintentar
|
||||
Home Inicio
|
||||
Enter to go · Esc to cancel Enter: ir · Esc: cancelar
|
||||
Typing on the page · Esc to stop Escribiendo en la página · Esc: terminar
|
||||
Lighting Iluminación
|
||||
Classic Clásica
|
||||
Enhanced Mejorada
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Mejorada: colores más ricos, luz cálida y sombras frías, sombreado más profundo y el mundo desenfocado tras el móvil y las ventanas. Clásica: el aspecto original.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Vous pouvez continuer à tondre ici, mais plus rien n'est en vente dans la démo.
|
||||
LEAVE FEEDBACK DONNER MON AVIS
|
||||
KEEP MOWING CONTINUER À TONDRE
|
||||
Browser Navigateur
|
||||
Try again Réessayer
|
||||
Home Accueil
|
||||
Enter to go · Esc to cancel Entrée : aller · Échap : annuler
|
||||
Typing on the page · Esc to stop Saisie sur la page · Échap : terminer
|
||||
Lighting Éclairage
|
||||
Classic Classique
|
||||
Enhanced Améliorée
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Améliorée : couleurs plus riches, lumière chaude et ombres froides, ombrage plus profond, et le monde flou derrière le téléphone et les fenêtres. Classique : le rendu d'origine.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Puoi continuare a falciare qui, ma nella demo non c'è più niente in vendita.
|
||||
LEAVE FEEDBACK LASCIA UN FEEDBACK
|
||||
KEEP MOWING CONTINUA A FALCIARE
|
||||
Browser Browser
|
||||
Try again Riprova
|
||||
Home Home
|
||||
Enter to go · Esc to cancel Invio: vai · Esc: annulla
|
||||
Typing on the page · Esc to stop Scrivi sulla pagina · Esc: fine
|
||||
Lighting Illuminazione
|
||||
Classic Classica
|
||||
Enhanced Migliorata
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Migliorata: colori più ricchi, luce calda e ombre fredde, ombreggiatura più profonda e il mondo sfocato dietro il telefono e le finestre. Classica: l'aspetto originale.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. ここで草刈りを続けられますが、体験版ではこれ以上何も買えません。
|
||||
LEAVE FEEDBACK フィードバックを送る
|
||||
KEEP MOWING 草刈りを続ける
|
||||
Browser ブラウザ
|
||||
Try again 再試行
|
||||
Home ホーム
|
||||
Enter to go · Esc to cancel Enterで移動 · Escで取消
|
||||
Typing on the page · Esc to stop ページに入力中 · Escで終了
|
||||
Lighting ライティング
|
||||
Classic クラシック
|
||||
Enhanced 強化
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 強化:豊かな色、暖かい光と涼しい影、深い陰影、スマホや画面を開くと背景がぼける。クラシック:元の見た目。
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. 여기서 계속 풀을 벨 수 있지만, 데모에서는 더 이상 살 수 있는 것이 없습니다.
|
||||
LEAVE FEEDBACK 피드백 남기기
|
||||
KEEP MOWING 계속 풀 베기
|
||||
Browser 브라우저
|
||||
Try again 다시 시도
|
||||
Home 홈
|
||||
Enter to go · Esc to cancel Enter 이동 · Esc 취소
|
||||
Typing on the page · Esc to stop 페이지에 입력 중 · Esc 종료
|
||||
Lighting 조명
|
||||
Classic 클래식
|
||||
Enhanced 향상
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 향상: 더 풍부한 색, 따뜻한 빛과 차가운 그림자, 깊은 음영, 휴대폰과 창 뒤의 흐린 배경. 클래식: 원래 모습.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Możesz dalej kosić, ale w demo nic więcej nie jest na sprzedaż.
|
||||
LEAVE FEEDBACK WYŚLIJ OPINIĘ
|
||||
KEEP MOWING KOŚ DALEJ
|
||||
Browser Przeglądarka
|
||||
Try again Ponów
|
||||
Home Start
|
||||
Enter to go · Esc to cancel Enter: przejdź · Esc: anuluj
|
||||
Typing on the page · Esc to stop Pisanie na stronie · Esc: koniec
|
||||
Lighting Oświetlenie
|
||||
Classic Klasyczne
|
||||
Enhanced Ulepszone
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Ulepszone: żywsze kolory, ciepłe światło i chłodne cienie, głębsze cieniowanie i rozmyty świat za telefonem i oknami. Klasyczne: pierwotny wygląd.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Você pode continuar cortando aqui, mas nada mais está à venda na demo.
|
||||
LEAVE FEEDBACK DAR FEEDBACK
|
||||
KEEP MOWING CONTINUAR CORTANDO
|
||||
Browser Navegador
|
||||
Try again Tentar de novo
|
||||
Home Início
|
||||
Enter to go · Esc to cancel Enter: ir · Esc: cancelar
|
||||
Typing on the page · Esc to stop Digitando na página · Esc: parar
|
||||
Lighting Iluminação
|
||||
Classic Clássica
|
||||
Enhanced Aprimorada
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Aprimorada: cores mais ricas, luz quente e sombras frias, sombreamento mais profundo e o mundo desfocado atrás do celular e das janelas. Clássica: o visual original.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Косить здесь можно и дальше, но больше ничего в демо не продаётся.
|
||||
LEAVE FEEDBACK ОСТАВИТЬ ОТЗЫВ
|
||||
KEEP MOWING КОСИТЬ ДАЛЬШЕ
|
||||
Browser Браузер
|
||||
Try again Ещё раз
|
||||
Home Домой
|
||||
Enter to go · Esc to cancel Enter — перейти · Esc — отмена
|
||||
Typing on the page · Esc to stop Ввод на странице · Esc — готово
|
||||
Lighting Освещение
|
||||
Classic Классика
|
||||
Enhanced Улучшенное
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Улучшенное: сочнее цвета, тёплый свет и холодные тени, глубже затенение, а мир размывается за телефоном и окнами. Классика: исходный вид.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. Burada biçmeye devam edebilirsin ama demoda satılık başka bir şey yok.
|
||||
LEAVE FEEDBACK GERİ BİLDİRİM VER
|
||||
KEEP MOWING BİÇMEYE DEVAM
|
||||
Browser Tarayıcı
|
||||
Try again Tekrar dene
|
||||
Home Ana ekran
|
||||
Enter to go · Esc to cancel Enter: git · Esc: iptal
|
||||
Typing on the page · Esc to stop Sayfaya yazılıyor · Esc: bitir
|
||||
Lighting Aydınlatma
|
||||
Classic Klasik
|
||||
Enhanced Gelişmiş
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. Gelişmiş: daha zengin renkler, sıcak ışık ve soğuk gölgeler, daha derin gölgelendirme, telefon ve pencerelerin arkasında bulanık dünya. Klasik: orijinal görünüm.
|
||||
|
||||
@ -1007,3 +1007,12 @@ Your crew shipped {0} kg of grass and reached the end of the demo. In the full g
|
||||
You can keep mowing here, but nothing more is for sale in the demo. 你可以继续在这里割草,但试玩版中不再出售任何东西。
|
||||
LEAVE FEEDBACK 提交反馈
|
||||
KEEP MOWING 继续割草
|
||||
Browser 浏览器
|
||||
Try again 重试
|
||||
Home 主页
|
||||
Enter to go · Esc to cancel Enter 前往 · Esc 取消
|
||||
Typing on the page · Esc to stop 正在页面输入 · Esc 结束
|
||||
Lighting 光照
|
||||
Classic 经典
|
||||
Enhanced 增强
|
||||
Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look. 增强:色彩更丰富,暖光冷影,阴影更深,打开手机和窗口时背景虚化。经典:原始画面。
|
||||
|
||||
8
Assets/Resources/Talk.meta
Normal file
8
Assets/Resources/Talk.meta
Normal file
@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 1a278eb01734ffa4a936ac7f7bca699c
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
BIN
Assets/Resources/Talk/T_Talk_AsstBg.png
(Stored with Git LFS)
Normal file
BIN
Assets/Resources/Talk/T_Talk_AsstBg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
132
Assets/Resources/Talk/T_Talk_AsstBg.png.meta
Normal file
132
Assets/Resources/Talk/T_Talk_AsstBg.png.meta
Normal file
@ -0,0 +1,132 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5abd9308ce329b846900acfde7f9ba41
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationMethod: 0
|
||||
spriteTessellationDetail: -1
|
||||
spriteGeometrySubdivision: -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: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
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: WebGL
|
||||
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:
|
||||
BIN
Assets/Resources/Talk/T_Talk_BossBg.png
(Stored with Git LFS)
Normal file
BIN
Assets/Resources/Talk/T_Talk_BossBg.png
(Stored with Git LFS)
Normal file
Binary file not shown.
132
Assets/Resources/Talk/T_Talk_BossBg.png.meta
Normal file
132
Assets/Resources/Talk/T_Talk_BossBg.png.meta
Normal file
@ -0,0 +1,132 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 537930ff76b550b4c9f7bdf8e8a09460
|
||||
TextureImporter:
|
||||
internalIDToNameTable: []
|
||||
externalObjects: {}
|
||||
serializedVersion: 13
|
||||
mipmaps:
|
||||
mipMapMode: 0
|
||||
enableMipMap: 1
|
||||
sRGBTexture: 1
|
||||
linearTexture: 0
|
||||
fadeOut: 0
|
||||
borderMipMap: 0
|
||||
mipMapsPreserveCoverage: 0
|
||||
alphaTestReferenceValue: 0.5
|
||||
mipMapFadeDistanceStart: 1
|
||||
mipMapFadeDistanceEnd: 3
|
||||
bumpmap:
|
||||
convertToNormalMap: 0
|
||||
externalNormalMap: 0
|
||||
heightScale: 0.25
|
||||
normalMapFilter: 0
|
||||
flipGreenChannel: 0
|
||||
isReadable: 0
|
||||
streamingMipmaps: 0
|
||||
streamingMipmapsPriority: 0
|
||||
vTOnly: 0
|
||||
ignoreMipmapLimit: 0
|
||||
grayScaleToAlpha: 0
|
||||
generateCubemap: 6
|
||||
cubemapConvolution: 0
|
||||
seamlessCubemap: 0
|
||||
textureFormat: 1
|
||||
maxTextureSize: 2048
|
||||
textureSettings:
|
||||
serializedVersion: 2
|
||||
filterMode: 1
|
||||
aniso: 1
|
||||
mipBias: 0
|
||||
wrapU: 1
|
||||
wrapV: 1
|
||||
wrapW: 1
|
||||
nPOTScale: 1
|
||||
lightmap: 0
|
||||
compressionQuality: 50
|
||||
spriteMode: 0
|
||||
spriteExtrude: 1
|
||||
spriteMeshType: 1
|
||||
alignment: 0
|
||||
spritePivot: {x: 0.5, y: 0.5}
|
||||
spritePixelsToUnits: 100
|
||||
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||
spriteGenerateFallbackPhysicsShape: 1
|
||||
alphaUsage: 1
|
||||
alphaIsTransparency: 0
|
||||
spriteTessellationMethod: 0
|
||||
spriteTessellationDetail: -1
|
||||
spriteGeometrySubdivision: -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: 1024
|
||||
resizeAlgorithm: 0
|
||||
textureFormat: -1
|
||||
textureCompression: 2
|
||||
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: WebGL
|
||||
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:
|
||||
145
Assets/Resources/Talk/TalkHolo.shader
Normal file
145
Assets/Resources/Talk/TalkHolo.shader
Normal file
@ -0,0 +1,145 @@
|
||||
// The video call's picture (TalkVideo): a talking loop filmed on black (Unity's player drops the webm's alpha), keyed
|
||||
// out again here and laid over the room behind the character, with a hologram that brings it in and takes it away.
|
||||
// The key: near-black is see-through, with a soft rim by brightness; dark bits the figure closes round (pupils, creases
|
||||
// of a navy suit) stay solid, because opaque figure is found on both sides of them.
|
||||
// _Appear 0..1: a glow of light sweeps up the window and leaves the picture behind it, tinted, scanlined, flickering,
|
||||
// breaking up in blocks and slipping sideways in bands; it settles as _Appear reaches 1, where only faint scanlines,
|
||||
// a slow bright roll and a rare glitch stay.
|
||||
Shader "GrassCutter/TalkHolo"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_MainTex ("Stacked loop", 2D) = "black" {}
|
||||
_BgTex ("Room behind", 2D) = "black" {}
|
||||
_Appear ("Appear", Range(0, 1)) = 1
|
||||
_Tint ("Hologram", Color) = (0.35, 0.9, 1, 1)
|
||||
}
|
||||
SubShader
|
||||
{
|
||||
Cull Off ZWrite Off ZTest Always
|
||||
Pass
|
||||
{
|
||||
CGPROGRAM
|
||||
#pragma vertex vert_img
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
sampler2D _MainTex, _BgTex;
|
||||
float4 _FigST, _BgST, _Px, _Tint, _MainTex_TexelSize;
|
||||
float _Appear, _T, _HasBg;
|
||||
|
||||
float hash(float2 p) { return frac(sin(dot(p, float2(127.1, 311.7))) * 43758.5453); }
|
||||
float noise(float2 p)
|
||||
{
|
||||
float2 i = floor(p), f = frac(p);
|
||||
f = f * f * (3 - 2 * f);
|
||||
return lerp(lerp(hash(i), hash(i + float2(1, 0)), f.x), lerp(hash(i + float2(0, 1)), hash(i + 1), f.x), f.y);
|
||||
}
|
||||
|
||||
// how bright the brightest channel is, as filmed (the texture hands it over in linear)
|
||||
float Peak(float2 uv)
|
||||
{
|
||||
float3 c = max(tex2Dlod(_MainTex, float4(uv, 0, 0)).rgb, 0);
|
||||
#ifndef UNITY_COLORSPACE_GAMMA
|
||||
c = LinearToGammaSpace(c);
|
||||
#endif
|
||||
return max(c.r, max(c.g, c.b));
|
||||
}
|
||||
|
||||
// the background is at most this bright (a little blue from the codec); a pixel this bright is figure for sure
|
||||
#define LO (14.0 / 255.0)
|
||||
#define HI (30.0 / 255.0)
|
||||
|
||||
float Solid(float2 uv) { return step(HI, Peak(uv)); }
|
||||
|
||||
// a dark pixel with figure on both sides of it, at any of three reaches (a pupil is ~30 texels across), along any
|
||||
// of four lines, is figure
|
||||
float Closed(float2 uv)
|
||||
{
|
||||
float fill = 0;
|
||||
[unroll] for (int k = 0; k < 3; k++)
|
||||
{
|
||||
float2 t = _MainTex_TexelSize.xy * (k == 0 ? 6.0 : k == 1 ? 14.0 : 26.0);
|
||||
fill = max(fill, Solid(uv + float2(t.x, 0)) * Solid(uv - float2(t.x, 0)));
|
||||
fill = max(fill, Solid(uv + float2(0, t.y)) * Solid(uv - float2(0, t.y)));
|
||||
fill = max(fill, Solid(uv + t) * Solid(uv - t));
|
||||
fill = max(fill, Solid(uv + float2(t.x, -t.y)) * Solid(uv - float2(t.x, -t.y)));
|
||||
}
|
||||
return fill;
|
||||
}
|
||||
|
||||
// the figure at fuv: colour (dark at the edge, as filmed on black, so it's already "premultiplied") and coverage
|
||||
float4 Figure(float2 fuv)
|
||||
{
|
||||
if (any(fuv < 0) || any(fuv > 1)) return 0;
|
||||
float3 c = tex2D(_MainTex, fuv).rgb;
|
||||
float a = smoothstep(LO, HI, Peak(fuv));
|
||||
if (a < 1) a = max(a, Closed(fuv));
|
||||
return float4(c * step(0.001, a), a);
|
||||
}
|
||||
|
||||
float3 Colour(float2 fuv)
|
||||
{
|
||||
if (any(fuv < 0) || any(fuv > 1)) return 0;
|
||||
return tex2D(_MainTex, fuv).rgb;
|
||||
}
|
||||
|
||||
float4 frag(v2f_img i) : SV_Target
|
||||
{
|
||||
float2 uv = i.uv;
|
||||
float t = _T;
|
||||
float ap = smoothstep(0, 1, _Appear);
|
||||
float hs = saturate((1 - ap) * 1.6); // how much hologram
|
||||
|
||||
// sideways slips in bands: often while it's coming in, now and then once it's on
|
||||
float tick = floor(t * 14);
|
||||
float band = floor(uv.y * 28 + hash(float2(tick, 7)) * 9);
|
||||
float slipOn = step(0.8, hash(float2(band, tick))) * (hs + step(0.985, hash(float2(floor(t * 3), 1))) * 0.25);
|
||||
uv.x += (hash(float2(band, tick + 3)) - 0.5) * 0.08 * slipOn;
|
||||
|
||||
// the sweep: up the window, its front ragged with noise
|
||||
float n = noise(uv * float2(14, 30) + t * 2.5);
|
||||
float front = ap * 1.3 - 0.15;
|
||||
float edge = uv.y + (n - 0.5) * 0.1;
|
||||
float shown = smoothstep(front + 0.012, front - 0.012, edge);
|
||||
float glow = exp(-abs(edge - front) * 55) * saturate(hs * 4);
|
||||
|
||||
// breaking up into blocks just behind the front
|
||||
float zone = saturate((edge - (front - 0.22)) / 0.22) * hs;
|
||||
// (only while it's coming or going: a hash can come out at exactly 0, and step(0, 0) is 1)
|
||||
float holes = zone > 0.001 ? step(hash(floor(uv * float2(46, 70)) + floor(t * 22) * 0.137), zone) : 0;
|
||||
|
||||
// the room, a little out of focus and darker than her
|
||||
float3 bg = 0;
|
||||
if (_HasBg > 0.5)
|
||||
{
|
||||
bg = tex2Dbias(_BgTex, float4(uv * _BgST.xy + _BgST.zw, 0, 1.2)).rgb;
|
||||
float2 d = i.uv - 0.5;
|
||||
bg *= 0.82 * (1 - dot(d, d) * 0.9);
|
||||
}
|
||||
|
||||
// her, split a hair into red/green/blue (more while coming in), each over the room
|
||||
float2 fuv = uv * _FigST.xy + _FigST.zw;
|
||||
float ca = 0.0015 + 0.02 * hs;
|
||||
float4 fg = Figure(fuv);
|
||||
float3 fc = float3(Colour(fuv + float2(ca, 0)).r, fg.g, Colour(fuv - float2(ca, 0)).b) * step(0.001, fg.a);
|
||||
float3 col = fc + bg * (1 - fg.a);
|
||||
|
||||
// the hologram's tint, scanlines, a slow bright roll, flicker
|
||||
float lum = dot(col, float3(0.3, 0.59, 0.11));
|
||||
col = lerp(col, lum * _Tint.rgb * 1.7 + _Tint.rgb * 0.06, hs * 0.8);
|
||||
float scan = 0.5 + 0.5 * sin(uv.y * _Px.y * 1.6 - t * 8);
|
||||
col *= 1 - (0.06 + 0.3 * hs) * scan;
|
||||
float r = frac(uv.y * 0.7 - t * 0.12);
|
||||
col += _Tint.rgb * smoothstep(0, 0.05, r) * (1 - smoothstep(0.05, 0.14, r)) * (0.035 + 0.1 * hs);
|
||||
float flick = 1 - hs * 0.4 * step(0.55, hash(float2(floor(t * 24), 3)));
|
||||
|
||||
float body = shown * flick * (1 - holes * 0.9);
|
||||
float a = saturate(body + glow);
|
||||
float3 rgb = (col * body + _Tint.rgb * glow * 1.6) / max(a, 1e-3);
|
||||
return float4(saturate(rgb), a);
|
||||
}
|
||||
ENDCG
|
||||
}
|
||||
}
|
||||
}
|
||||
9
Assets/Resources/Talk/TalkHolo.shader.meta
Normal file
9
Assets/Resources/Talk/TalkHolo.shader.meta
Normal file
@ -0,0 +1,9 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 85f876d4978b59f4a9cbcc8b4be8c5ba
|
||||
ShaderImporter:
|
||||
externalObjects: {}
|
||||
defaultTextures: []
|
||||
nonModifiableTextures: []
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@ -1653,6 +1653,9 @@ namespace GrassCutter
|
||||
float wait = Time.time;
|
||||
while (Time.time - wait < 8f && !(Phone.I && Phone.I.Mode != PhoneMode.Away)) yield return null;
|
||||
if (Phone.I) Phone.I.Show(PhoneMode.Up);
|
||||
// the hologram coming in
|
||||
yield return new WaitForSeconds(0.35f);
|
||||
yield return Shot("c00_call_appearing");
|
||||
(float at, string name)[] marks = { (1.5f, "c01"), (3f, "c02"), (6f, "c03"), (9f, "c04"), (13f, "c05"), (20f, "c06") };
|
||||
float t0 = Time.time;
|
||||
foreach (var (at, name) in marks)
|
||||
@ -1666,12 +1669,17 @@ namespace GrassCutter
|
||||
foreach (var line in new[] { "asst_twister", "asst_meteors" })
|
||||
{
|
||||
Assistant.Say(line);
|
||||
yield return new WaitForSeconds(1.4f);
|
||||
yield return new WaitForSeconds(0.45f);
|
||||
yield return Shot("c09_" + line + "_appearing");
|
||||
yield return new WaitForSeconds(0.95f);
|
||||
yield return Shot("c10_" + line);
|
||||
yield return Booths("c10_" + line);
|
||||
yield return new WaitForSeconds(0.9f);
|
||||
yield return Booths("c11_" + line);
|
||||
while (Assistant.Busy) yield return null;
|
||||
// and going out
|
||||
yield return new WaitForSeconds(0.2f);
|
||||
yield return Shot("c12_" + line + "_leaving");
|
||||
yield return new WaitForSeconds(0.5f);
|
||||
}
|
||||
UIRoot.I.OpenSettings();
|
||||
|
||||
@ -90,6 +90,8 @@ namespace GrassCutter
|
||||
/// <summary>Blades of grass drawn: 0 fewer, 1 more, 2 all.</summary>
|
||||
public static int GrassDetail { get => PlayerPrefs.GetInt("s_grass", PGrass[P]); set => SetOwn("s_grass", value); }
|
||||
public static bool Bloom { get => PlayerPrefs.GetInt("s_bloom", PBloom[P]) == 1; set => SetOwn("s_bloom", value ? 1 : 0); }
|
||||
/// <summary>LightingStyle: 0 the classic look, 1 enhanced (the default). Not part of the quality presets.</summary>
|
||||
public static int Lighting { get => Mathf.Clamp(PlayerPrefs.GetInt("s_light", LightingStyle.Enhanced), 0, 1); set { PlayerPrefs.SetInt("s_light", value); ApplyGraphics(); } }
|
||||
|
||||
/// <summary>A single row changed: the others keep what they show, and the preset becomes the player's own mix.</summary>
|
||||
static void SetOwn(string key, float v)
|
||||
@ -131,7 +133,7 @@ namespace GrassCutter
|
||||
{
|
||||
new[] { "s_shake", "s_bob", "s_tips", "s_hints" },
|
||||
new[] { "s_dmode", "s_fs", "s_resw", "s_resh", "s_vsync", "s_fpscap", "s_fov", "s_bright" },
|
||||
new[] { "s_quality", "s_rscale", "s_shadows", "s_msaa", "s_grass", "s_bloom" },
|
||||
new[] { "s_quality", "s_rscale", "s_shadows", "s_msaa", "s_grass", "s_bloom", "s_light" },
|
||||
new[] { "s_master", "s_music", "s_sfx", "s_voice", "s_phone", "s_bgsound" },
|
||||
new[] { "s_sens", "s_padsens", "s_invy", "s_sprinttog" },
|
||||
};
|
||||
@ -244,6 +246,7 @@ namespace GrassCutter
|
||||
s_rp.mainLightShadowmapResolution = new[] { 1024, 1024, 2048, 2048, 4096 }[sh];
|
||||
s_rp.msaaSampleCount = new[] { 1, 2, 4, 8 }[Mathf.Clamp(Antialias, 0, 3)];
|
||||
}
|
||||
LightingStyle.Apply();
|
||||
GrassField.Detail = new[] { 0.5f, 0.75f, 1f }[Mathf.Clamp(GrassDetail, 0, 2)];
|
||||
ApplyBloom();
|
||||
}
|
||||
|
||||
@ -22,7 +22,7 @@ namespace GrassCutter
|
||||
/// </summary>
|
||||
public class PhoneWeb
|
||||
{
|
||||
const int TallW = 390, WideH = 390, FrameTall = 540, FrameWide = 1120;
|
||||
const int TallW = 390, WideH = 390, FrameTall = 640, FrameWide = 1120;
|
||||
const int Retries = 4;
|
||||
// our eyes in every document and frame: the game's volume, quiet when the phone goes away, and new windows in the one tab
|
||||
const string Keep =
|
||||
@ -64,6 +64,7 @@ namespace GrassCutter
|
||||
public readonly CancellationTokenSource Stop = new CancellationTokenSource();
|
||||
public readonly BlockingCollection<string> Out = new BlockingCollection<string>();
|
||||
public volatile bool Ready;
|
||||
public bool Dressed;
|
||||
}
|
||||
|
||||
/// <summary>A frame on its way to the screen. Reused: at 30 a second, fresh arrays of half a megabyte would be a garbage collection a second.</summary>
|
||||
@ -114,8 +115,9 @@ namespace GrassCutter
|
||||
_mute = CommandLine.Has("-autodemo");
|
||||
_profile = Path.Combine(_mute ? Application.temporaryCachePath : Application.persistentDataPath, "PhoneWeb");
|
||||
_decoded = new Texture2D(FrameTall, FrameTall, TextureFormat.RGB24, false);
|
||||
_rt = new RenderTexture(1024, 1024, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB) { name = "PhoneWeb" };
|
||||
_rt = new RenderTexture(FrameTall, FrameTall * _pageH / TallW, 0, RenderTextureFormat.ARGB32, RenderTextureReadWrite.sRGB) { name = "PhoneWeb" };
|
||||
_rt.Create();
|
||||
ClearPicture();
|
||||
}
|
||||
|
||||
// ───────────────────────── what the phone asks of it ─────────────────────────
|
||||
@ -130,6 +132,7 @@ namespace GrassCutter
|
||||
_pending = url;
|
||||
_loading = true;
|
||||
_restarts = 0;
|
||||
ClearPicture();
|
||||
Boot();
|
||||
}
|
||||
|
||||
@ -140,9 +143,31 @@ namespace GrassCutter
|
||||
_pending = _wanted = _last = null;
|
||||
_loading = false;
|
||||
_url = null;
|
||||
ClearPicture();
|
||||
if (Ready) Cmd("Page.navigate", "{\"url\":\"about:blank\"}");
|
||||
}
|
||||
|
||||
/// <summary>Black, so the last site's last frame isn't what the next one opens on.</summary>
|
||||
void ClearPicture()
|
||||
{
|
||||
var was = RenderTexture.active;
|
||||
RenderTexture.active = _rt;
|
||||
GL.Clear(false, true, Color.black);
|
||||
RenderTexture.active = was;
|
||||
var s = Interlocked.Exchange(ref _shot, null);
|
||||
if (s != null) Ack(s);
|
||||
}
|
||||
|
||||
public void Stop() { if (Ready) { Cmd("Page.stopLoading"); _loading = false; } }
|
||||
|
||||
/// <summary>Something else has the phone's screen (a call): whatever plays on the page is paused under it.</summary>
|
||||
public bool Hold
|
||||
{
|
||||
get => _hold;
|
||||
set { if (_hold != value) { _hold = value; _nextState = 0f; } }
|
||||
}
|
||||
bool _hold;
|
||||
|
||||
public void Back() { if (Ready) Cmd("Runtime.evaluate", "{\"expression\":\"void history.back()\"}"); }
|
||||
public void Forward() { if (Ready) Cmd("Runtime.evaluate", "{\"expression\":\"void history.forward()\"}"); }
|
||||
public void Reload() { if (Ready) { _loading = true; Cmd("Page.reload"); } }
|
||||
@ -160,14 +185,15 @@ namespace GrassCutter
|
||||
{
|
||||
if (_wide == on) return;
|
||||
_wide = on;
|
||||
ClearPicture();
|
||||
if (Ready) { Metrics(); if (_shown) { Cmd("Page.stopScreencast"); Screencast(true); } }
|
||||
}
|
||||
|
||||
void Screencast(bool on)
|
||||
{
|
||||
if (on) Cmd("Page.startScreencast", _wide
|
||||
? $"{{\"format\":\"jpeg\",\"quality\":62,\"maxWidth\":{FrameWide},\"maxHeight\":{FrameWide * WideH / _fullW},\"everyNthFrame\":1}}"
|
||||
: $"{{\"format\":\"jpeg\",\"quality\":58,\"maxWidth\":{FrameTall},\"maxHeight\":{FrameTall * _pageH / TallW},\"everyNthFrame\":1}}");
|
||||
? $"{{\"format\":\"jpeg\",\"quality\":70,\"maxWidth\":{FrameWide},\"maxHeight\":{FrameWide * WideH / _fullW},\"everyNthFrame\":1}}"
|
||||
: $"{{\"format\":\"jpeg\",\"quality\":68,\"maxWidth\":{FrameTall},\"maxHeight\":{FrameTall * _pageH / TallW},\"everyNthFrame\":1}}");
|
||||
else Cmd("Page.stopScreencast");
|
||||
}
|
||||
|
||||
@ -226,7 +252,10 @@ namespace GrassCutter
|
||||
}
|
||||
|
||||
/// <summary>The mouse wheel, one notch at a time. Positive is on down the page.</summary>
|
||||
public void Wheel(int dir)
|
||||
public void Wheel(int dir) => Wheel(dir, CssW / 2f, CssH / 2f);
|
||||
|
||||
/// <summary>The wheel over a point of the page: what's under it scrolls (a chat beside a stream, a list in a menu).</summary>
|
||||
public void Wheel(int dir, float x, float y)
|
||||
{
|
||||
if (!Ready) return;
|
||||
if (OnFeed)
|
||||
@ -236,23 +265,30 @@ namespace GrassCutter
|
||||
Flick(dir);
|
||||
return;
|
||||
}
|
||||
Cmd("Input.dispatchMouseEvent", string.Format(CultureInfo.InvariantCulture, "{{\"type\":\"mouseWheel\",\"x\":{0},\"y\":{1},\"deltaX\":0,\"deltaY\":{2}}}", CssW / 2, CssH / 2, dir * 260));
|
||||
Cmd("Input.dispatchMouseEvent", string.Format(CultureInfo.InvariantCulture, "{{\"type\":\"mouseWheel\",\"x\":{0:0.#},\"y\":{1:0.#},\"deltaX\":0,\"deltaY\":{2}}}", x, y, dir * 220));
|
||||
}
|
||||
|
||||
public void Insert(string text) { if (Ready) Cmd("Input.insertText", "{\"text\":" + Str(text) + "}"); }
|
||||
|
||||
public void Key(string name, int code, string text)
|
||||
/// <param name="modifiers">CDP's: 1 Alt, 2 Ctrl, 4 Meta, 8 Shift.</param>
|
||||
public void Key(string name, int code, string text, int modifiers = 0)
|
||||
{
|
||||
if (!Ready) return;
|
||||
string common = $"\"key\":\"{name}\",\"code\":\"{name}\",\"windowsVirtualKeyCode\":{code}";
|
||||
string common = $"\"key\":\"{name}\",\"code\":\"{name}\",\"windowsVirtualKeyCode\":{code},\"modifiers\":{modifiers}";
|
||||
Cmd("Input.dispatchKeyEvent", "{\"type\":\"" + (text != null ? "keyDown" : "rawKeyDown") + "\"," + common + (text != null ? ",\"text\":\"" + text + "\"" : "") + "}");
|
||||
Cmd("Input.dispatchKeyEvent", "{\"type\":\"keyUp\"," + common + "}");
|
||||
}
|
||||
|
||||
/// <summary>An editing command on the focused text box: selectAll, undo, redo.</summary>
|
||||
public void Command(string name)
|
||||
{
|
||||
if (Ready) Cmd("Input.dispatchKeyEvent", "{\"type\":\"rawKeyDown\",\"key\":\"\",\"windowsVirtualKeyCode\":0,\"commands\":[\"" + name + "\"]}");
|
||||
}
|
||||
|
||||
/// <summary>Is the page waiting for typing?</summary>
|
||||
public async Task<bool> FieldActive()
|
||||
{
|
||||
const string js = "(()=>{const e=document.activeElement;return String(!!e&&(e.isContentEditable||e.tagName==='TEXTAREA'||e.tagName==='IFRAME'||(e.tagName==='INPUT'&&!/^(checkbox|radio|button|submit|range|file)$/.test(e.type))))})()";
|
||||
const string js = "(()=>{const e=document.activeElement;return String(!!e&&(e.isContentEditable||e.tagName==='TEXTAREA'||(e.tagName==='INPUT'&&!/^(checkbox|radio|button|submit|range|file)$/.test(e.type))))})()";
|
||||
return await Ask(js) == "true";
|
||||
}
|
||||
|
||||
@ -288,6 +324,13 @@ namespace GrassCutter
|
||||
_link = null;
|
||||
}
|
||||
if (_died) Revive();
|
||||
if (Ready && !_link.Dressed)
|
||||
{
|
||||
// the page's shape and the frames, as they are now: a Show or a turn while it started can't be lost
|
||||
_link.Dressed = true;
|
||||
Metrics();
|
||||
if (_shown) Screencast(true);
|
||||
}
|
||||
if (Ready)
|
||||
{
|
||||
if (_pending != null)
|
||||
@ -314,6 +357,14 @@ namespace GrassCutter
|
||||
float started = Time.realtimeSinceStartup;
|
||||
if (_decoded.LoadImage(s.Jpeg, false))
|
||||
{
|
||||
// the texture takes the frame's own size: no squeezing a 1120-wide frame into less and back
|
||||
if (_rt.width != _decoded.width || _rt.height != _decoded.height)
|
||||
{
|
||||
_rt.Release();
|
||||
_rt.width = _decoded.width;
|
||||
_rt.height = _decoded.height;
|
||||
_rt.Create();
|
||||
}
|
||||
Graphics.Blit(_decoded, _rt);
|
||||
Fresh = true;
|
||||
}
|
||||
@ -361,7 +412,7 @@ namespace GrassCutter
|
||||
if (Time.unscaledTime < _nextState) return;
|
||||
_nextState = Time.unscaledTime + 0.5f;
|
||||
string v = (GameSettings.Master * GameSettings.PhoneVolume).ToString("0.00", CultureInfo.InvariantCulture);
|
||||
Cmd("Runtime.evaluate", "{\"expression\":\"void(window.__gc&&(__gc.vol=" + v + ",__gc.hold=" + (_shown ? "false" : "true") + "))\"}");
|
||||
Cmd("Runtime.evaluate", "{\"expression\":\"void(window.__gc&&(__gc.vol=" + v + ",__gc.hold=" + (_shown && !_hold ? "false" : "true") + "))\"}");
|
||||
}
|
||||
|
||||
void Revive()
|
||||
@ -393,7 +444,7 @@ namespace GrassCutter
|
||||
foreach (var root in new[] { pf86, pf, local })
|
||||
{
|
||||
if (string.IsNullOrEmpty(root)) continue;
|
||||
foreach (var exe in new[] { @"Microsoft\Edge\Application\msedge.exe", @"Google\Chrome\Application\chrome.exe" })
|
||||
foreach (var exe in new[] { @"Microsoft\Edge\Application\msedge.exe", @"Google\Chrome\Application\chrome.exe", @"BraveSoftware\Brave-Browser\Application\brave.exe", @"Chromium\Application\chrome.exe" })
|
||||
{
|
||||
var path = Path.Combine(root, exe);
|
||||
if (File.Exists(path)) return path;
|
||||
@ -440,7 +491,7 @@ namespace GrassCutter
|
||||
if (port == null) throw new TimeoutException("The browser didn't start.");
|
||||
|
||||
string ws, ua, chrome;
|
||||
using (var http = new HttpClient(new HttpClientHandler { UseProxy = false }))
|
||||
using (var http = new HttpClient(new HttpClientHandler { UseProxy = false }) { Timeout = TimeSpan.FromSeconds(10) })
|
||||
{
|
||||
// the debug server hangs up after each answer, so no reusing the connection
|
||||
http.DefaultRequestHeaders.ConnectionClose = true;
|
||||
@ -461,7 +512,11 @@ namespace GrassCutter
|
||||
|
||||
link.Ws = new ClientWebSocket();
|
||||
link.Ws.Options.Proxy = null;
|
||||
await link.Ws.ConnectAsync(new Uri(ws), link.Stop.Token);
|
||||
using (var limit = CancellationTokenSource.CreateLinkedTokenSource(link.Stop.Token))
|
||||
{
|
||||
limit.CancelAfter(TimeSpan.FromSeconds(10));
|
||||
await link.Ws.ConnectAsync(new Uri(ws), limit.Token);
|
||||
}
|
||||
_ = Task.Run(() => Sender(link));
|
||||
_ = Task.Run(() => Receiver(link));
|
||||
|
||||
@ -478,8 +533,6 @@ namespace GrassCutter
|
||||
int win = Interlocked.Increment(ref _id);
|
||||
_winAsk = win;
|
||||
Send(link, "{\"id\":" + win + ",\"method\":\"Browser.getWindowForTarget\",\"params\":{}}");
|
||||
Metrics();
|
||||
if (_shown) Screencast(true);
|
||||
link.Ready = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -609,7 +662,13 @@ namespace GrassCutter
|
||||
}
|
||||
else if (m.method == "Page.frameNavigated")
|
||||
{
|
||||
if (string.IsNullOrEmpty(m.@params?.frame?.parentId)) _url = m.@params?.frame?.url;
|
||||
if (string.IsNullOrEmpty(m.@params?.frame?.parentId))
|
||||
{
|
||||
var u = m.@params?.frame?.url;
|
||||
// the blank page from going home, landing after the next site was asked for
|
||||
if (u == "about:blank" && (_wanted != null || _pending != null)) return;
|
||||
_url = u;
|
||||
}
|
||||
}
|
||||
else if (m.method == "Page.navigatedWithinDocument") _url = m.@params?.url;
|
||||
else if (m.method == "Page.frameStartedLoading") { if (m.@params?.frameId == link.Tab) _loading = true; }
|
||||
@ -660,8 +719,10 @@ namespace GrassCutter
|
||||
_died = true;
|
||||
}
|
||||
|
||||
/// <summary>Closed properly, so the logins from this session make it to disk.</summary>
|
||||
public void Close()
|
||||
/// <summary>Closed properly, so the logins from this session make it to disk. The game doesn't wait for it, unless it's quitting.</summary>
|
||||
public void Close() => Close(true);
|
||||
|
||||
public void Close(bool quitting)
|
||||
{
|
||||
Application.quitting -= Close;
|
||||
var link = _link;
|
||||
@ -675,6 +736,15 @@ namespace GrassCutter
|
||||
{
|
||||
link.Ready = false;
|
||||
Send(link, "Browser.close", "{}");
|
||||
if (!quitting)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
try { link.Proc?.WaitForExit(4000); } catch (InvalidOperationException) { }
|
||||
Drop(link);
|
||||
});
|
||||
return;
|
||||
}
|
||||
try { link.Proc?.WaitForExit(1500); } catch (InvalidOperationException) { }
|
||||
}
|
||||
Drop(link);
|
||||
|
||||
@ -84,6 +84,13 @@ namespace GrassCutter
|
||||
|
||||
public void Bind(PlayerAgent p) { _p = p; }
|
||||
|
||||
/// <summary>The scene goes (back to the menu): the browser goes with it.</summary>
|
||||
void OnDestroy()
|
||||
{
|
||||
Screen?.Close();
|
||||
if (I == this) I = null;
|
||||
}
|
||||
|
||||
/// <summary>The match is over: the phone goes away, and the browser with it.</summary>
|
||||
public void Unbind()
|
||||
{
|
||||
@ -132,7 +139,7 @@ namespace GrassCutter
|
||||
if (Ctl.PhoneUpPressed) Show(_mode == PhoneMode.Up ? PhoneMode.Side : PhoneMode.Up);
|
||||
if (Ctl.PhoneTurnPressed) Screen.Turn();
|
||||
float w = Ctl.PhoneWheel;
|
||||
if (w != 0f) Screen.Wheel(w < 0f ? 1 : -1);
|
||||
if (w != 0f) Screen.Wheel(w < 0f ? 1 : -1, _mode == PhoneMode.Up ? ScreenToPhone(Ctl.Pointer) : new Vector2(-1f, -1f));
|
||||
if (_mode == PhoneMode.Up)
|
||||
{
|
||||
var uv = ScreenToPhone(Ctl.Pointer);
|
||||
|
||||
@ -152,7 +152,7 @@ namespace GrassCutter
|
||||
CameraFx.FovTarget(_vel.magnitude > 12f ? 7f : 0f);
|
||||
}
|
||||
|
||||
float _coyote, _jumpBuffer, _bobPhase, _stepAcc, _landDip, _airTime;
|
||||
float _coyote, _jumpBuffer, _bobPhase, _stepAcc, _landDip, _airTime, _lean;
|
||||
bool _wasGrounded = true;
|
||||
|
||||
void Awake()
|
||||
@ -421,7 +421,11 @@ namespace GrassCutter
|
||||
if (!Seated) transform.rotation = _frame;
|
||||
float flat = Vector3.ProjectOnPlane(_vel, up).magnitude;
|
||||
float bob = (Grounded || _swimming) && !Seated && GameSettings.HeadBob ? Mathf.Sin(_bobPhase * 2f) * (_swimming ? 0.05f : 0.035f) * Mathf.Clamp01(flat / sprintSpeed + (_swimming ? 0.4f : 0f)) : 0f;
|
||||
float roll = -Ctl.Move.x * 1.5f;
|
||||
// the head leans into a sidestep: it follows the body's sideways speed and eases in and out, instead of snapping
|
||||
// with the A / D key (which jerked the view on every press and release)
|
||||
float side = Seated || Flying ? 0f : Mathf.Clamp(Vector3.Dot(_vel, _frame * Vector3.right) / walkSpeed, -1.3f, 1.3f);
|
||||
_lean = Mathf.Lerp(_lean, -side * 1.2f, 1f - Mathf.Exp(-Time.deltaTime * 6f));
|
||||
float roll = _lean;
|
||||
if (_swimming) roll += Mathf.Sin(Time.time * 1.3f) * 2f;
|
||||
_landDip = Mathf.Lerp(_landDip, 0f, Time.deltaTime * 8f);
|
||||
head.localPosition = new Vector3(0, eyeHeight + bob - _landDip, 0);
|
||||
|
||||
@ -77,7 +77,7 @@ namespace GrassCutter
|
||||
readonly Dictionary<string, float> _said = new Dictionary<string, float>();
|
||||
readonly float[] _mood = new float[7];
|
||||
AudioSource _voice;
|
||||
VisualElement _panel, _picture;
|
||||
VisualElement _panel, _frame, _picture;
|
||||
Label _caption;
|
||||
Booth _booth;
|
||||
// the user's filmed loops of her, one per mood
|
||||
@ -128,6 +128,7 @@ namespace GrassCutter
|
||||
I._voice.Stop();
|
||||
I._queue.Clear();
|
||||
I.Panel(false);
|
||||
I._talk?.Cut();
|
||||
I._on = false;
|
||||
}
|
||||
|
||||
@ -135,6 +136,8 @@ namespace GrassCutter
|
||||
{
|
||||
// she lives on the cinema layer, above the windows: a window opened mid-line hides her till it closes
|
||||
if (_panel != null) _panel.style.visibility = UIRoot.I && UIRoot.I.AnyModal ? Visibility.Hidden : Visibility.Visible;
|
||||
// the frame lights up ahead of the hologram filling it, and goes out after
|
||||
if (_frame != null && _talk != null) _frame.style.opacity = Mathf.Clamp01(_talk.Appear * 3f);
|
||||
if (_on || _queue.Count == 0) return;
|
||||
if (!Ready()) return;
|
||||
var (line, at) = _queue.Dequeue();
|
||||
@ -214,22 +217,26 @@ namespace GrassCutter
|
||||
if (on && (_panel == null || _panel.panel == null)) Build();
|
||||
if (_panel == null) return;
|
||||
_booth?.Show(on);
|
||||
if (on) _talk?.Play(0);
|
||||
else _talk?.Stop();
|
||||
// the picture comes in and goes out as a hologram; the panel goes once it has (TalkVideo.Gone)
|
||||
_talk?.Show(on);
|
||||
_caption.style.display = on ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
if (on)
|
||||
{
|
||||
_panel.style.display = DisplayStyle.Flex;
|
||||
_panel.BringToFront();
|
||||
UIK.PopIn(_panel, 0f, 0.25f);
|
||||
UIK.PopIn(_caption, 0.2f, 0.25f);
|
||||
}
|
||||
else _panel.style.display = DisplayStyle.None;
|
||||
else if (_talk == null) _panel.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
void Build()
|
||||
{
|
||||
var root = UIRoot.I ? UIRoot.I.Cinema : null;
|
||||
if (root == null) return;
|
||||
_talk = new TalkVideo("asst", new[] { "happy", "stern", "fed" }, 400, 406);
|
||||
// the window inside its 3 px border, at 1.5x
|
||||
int outW = Mathf.RoundToInt((PicW * 0.8f - 6f) * 1.5f), outH = Mathf.RoundToInt((PicH * 0.8f - 6f) * 1.5f);
|
||||
_talk = new TalkVideo("asst", new[] { "happy", "stern", "fed" }, 400, 406, outW, outH, new Rect(0f, 0f, 1f, 1f), "T_Talk_AsstBg");
|
||||
_talk.Gone = () => { if (_panel != null) _panel.style.display = DisplayStyle.None; };
|
||||
_panel = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
_panel.style.position = Position.Absolute;
|
||||
_panel.style.left = 22;
|
||||
@ -246,20 +253,15 @@ namespace GrassCutter
|
||||
var edge = new Color(0.55f, 0.85f, 0.95f, 0.9f);
|
||||
frame.style.borderLeftColor = frame.style.borderRightColor = frame.style.borderTopColor = frame.style.borderBottomColor = edge;
|
||||
frame.style.overflow = Overflow.Hidden;
|
||||
frame.style.backgroundColor = new Color(0.08f, 0.12f, 0.22f);
|
||||
var bg = AssetBank.I ? AssetBank.I.Tex("T_Dir_Bg") : null;
|
||||
if (bg)
|
||||
{
|
||||
frame.style.backgroundImage = new StyleBackground(bg);
|
||||
frame.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
frame.style.unityBackgroundImageTintColor = new Color(0.82f, 0.86f, 0.95f);
|
||||
}
|
||||
// see-through glass: the room behind her is in the picture, which the hologram brings in
|
||||
frame.style.backgroundColor = new Color(0.02f, 0.06f, 0.12f, 0.35f);
|
||||
frame.style.opacity = 0f;
|
||||
_frame = frame;
|
||||
_panel.Add(frame);
|
||||
_picture = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
_picture.style.flexGrow = 1;
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_talk.Switched = rt => _picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(rt));
|
||||
_talk.Switched(_talk.Rt);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.StretchToFill;
|
||||
_picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(_talk.Rt));
|
||||
frame.Add(_picture);
|
||||
var tag = UIK.Text(Loc.T("ASSISTANT · G.R.A.S.S.A."), "", frame, true);
|
||||
tag.style.position = Position.Absolute;
|
||||
|
||||
@ -405,20 +405,15 @@ namespace GrassCutter
|
||||
public PhoneCall(VisualElement screen)
|
||||
{
|
||||
_root = Box(screen, 0f, 0f, W, H);
|
||||
_root.style.backgroundColor = new Color(0.1f, 0.16f, 0.3f);
|
||||
// mission control behind him, and him in front from the hips up, like a video call
|
||||
var bg = AssetBank.I ? AssetBank.I.Tex("T_Dir_Bg") : null;
|
||||
if (bg)
|
||||
{
|
||||
_root.style.backgroundImage = new StyleBackground(bg);
|
||||
_root.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_root.style.unityBackgroundImageTintColor = new Color(0.82f, 0.86f, 0.95f);
|
||||
}
|
||||
_talk = new TalkVideo("boss", new[] { "calm", "stern", "angry" }, 640, 650);
|
||||
_picture = Box(_root, 0f, PicTop, W, H - PicTop - PicBottom);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.ScaleAndCrop;
|
||||
_talk.Switched = rt => _picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(rt));
|
||||
_talk.Switched(_talk.Rt);
|
||||
_root.style.backgroundColor = new Color(0.02f, 0.04f, 0.09f);
|
||||
// his office on Earth behind him, him in front from the hips up, like a video call: the whole screen is one
|
||||
// picture, which comes in and goes out as a hologram (TalkVideo)
|
||||
var fig = new Rect(0f, PicBottom / H, 1f, (H - PicTop - PicBottom) / H);
|
||||
_talk = new TalkVideo("boss", new[] { "calm", "stern", "angry" }, 640, 650, RtW, RtH, fig, "T_Talk_BossBg");
|
||||
_picture = Box(_root, 0f, 0f, W, H);
|
||||
_picture.style.unityBackgroundScaleMode = ScaleMode.StretchToFill;
|
||||
_picture.style.backgroundImage = new StyleBackground(Background.FromRenderTexture(_talk.Rt));
|
||||
_talk.Gone = () => _root.style.display = DisplayStyle.None;
|
||||
_fx = Box(_root, 0f, 0f, W, H);
|
||||
|
||||
// the anger vein on his forehead
|
||||
@ -438,7 +433,7 @@ namespace GrassCutter
|
||||
var bar = Box(_root, 0f, 0f, W, 230f);
|
||||
bar.style.backgroundColor = new Color(0.02f, 0.05f, 0.12f, 0.72f);
|
||||
bar.style.alignItems = Align.Center;
|
||||
bar.style.paddingTop = 78;
|
||||
bar.style.paddingTop = 46;
|
||||
var name = UIK.Text("G.R.A.S.S.A.", "", bar, true);
|
||||
name.style.fontSize = 64; name.style.color = new Color(1f, 0.86f, 0.4f);
|
||||
var row = new VisualElement { pickingMode = PickingMode.Ignore };
|
||||
@ -454,6 +449,10 @@ namespace GrassCutter
|
||||
who.style.fontSize = 28; who.style.color = new Color(0.86f, 0.92f, 1f);
|
||||
_timer = UIK.Text("00:00", "", bar, false);
|
||||
_timer.style.fontSize = 26; _timer.style.color = new Color(0.7f, 0.8f, 0.9f, 0.8f);
|
||||
_timer.style.marginTop = 6;
|
||||
// the bar is a fixed height: nothing in it may be squeezed (the row under the name was, to nothing, and the
|
||||
// timer sat on top of it)
|
||||
name.style.flexShrink = 0; row.style.flexShrink = 0; _timer.style.flexShrink = 0;
|
||||
|
||||
// the red button at the foot
|
||||
var hang = Box(_root, (W - 110f) * 0.5f, H - 160f, 110f, 110f);
|
||||
@ -463,7 +462,9 @@ namespace GrassCutter
|
||||
key.style.fontSize = 48; key.style.color = Color.white;
|
||||
key.style.unityTextAlign = TextAnchor.MiddleCenter;
|
||||
key.style.flexGrow = 1;
|
||||
Show(false);
|
||||
// the agency's bar and the button light up ahead of the picture, and go out after it
|
||||
_talk.Drawn = a => { float o = Mathf.Clamp01(a * 3f); bar.style.opacity = o; hang.style.opacity = o; };
|
||||
_root.style.display = DisplayStyle.None;
|
||||
}
|
||||
|
||||
static VisualElement Box(VisualElement parent, float x, float y, float w, float h)
|
||||
@ -482,9 +483,15 @@ namespace GrassCutter
|
||||
|
||||
public void Show(bool on)
|
||||
{
|
||||
_root.style.display = on ? DisplayStyle.Flex : DisplayStyle.None;
|
||||
_booth?.Show(on);
|
||||
if (!on) { _talk?.Stop(); return; }
|
||||
// off: the hologram fades out, then TalkVideo.Gone hides the screen
|
||||
_talk?.Show(on);
|
||||
if (!on)
|
||||
{
|
||||
if (_talk == null) _root.style.display = DisplayStyle.None;
|
||||
return;
|
||||
}
|
||||
_root.style.display = DisplayStyle.Flex;
|
||||
_root.BringToFront();
|
||||
_lastT = 0f;
|
||||
for (int i = 0; i < _mood.Length; i++) _mood[i] = 0f;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5,35 +5,52 @@ using UnityEngine.Video;
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>
|
||||
/// A character's talking loops (Assets/StreamingAssets/Talk/<who>_<mood>.webm, VP8 with alpha, made by
|
||||
/// Tools/director/talk_videos.py): one player per mood, each looping into its own texture. The picture shows the one for
|
||||
/// the mood of the moment; the others wait where they left off, so a change of mood is a cut, not a stall.
|
||||
/// A character's talking loops (Assets/StreamingAssets/Talk/<who>_<mood>.webm, made by Tools/director/talk_videos.py):
|
||||
/// one player per mood, each looping into its own texture; the picture shows the one for the mood of the moment, the others
|
||||
/// wait where they left off, so a change of mood is a cut, not a stall.
|
||||
///
|
||||
/// Unity's player drops the webm's alpha and shows the figure on the black it was filmed on. Every frame the shader
|
||||
/// (Resources/Talk/TalkHolo) cuts the black away again, puts the figure over the room behind the character, and draws the
|
||||
/// hologram: <see cref="Show"/> fades the call in with a sweep of light, scanlines
|
||||
/// and glitches, and out the same way; while on, only faint scanlines are left.
|
||||
/// </summary>
|
||||
public class TalkVideo
|
||||
{
|
||||
const float InTime = 0.8f, OutTime = 0.5f;
|
||||
|
||||
readonly VideoPlayer[] _players;
|
||||
readonly RenderTexture[] _rts;
|
||||
readonly RenderTexture[] _raw;
|
||||
readonly RenderTexture _out;
|
||||
readonly Material _mat;
|
||||
int _on = -1;
|
||||
float _appear, _target;
|
||||
bool _clear = true;
|
||||
|
||||
/// <summary>The picture now; <see cref="Switched"/> says when it changes.</summary>
|
||||
public RenderTexture Rt => _rts[Mathf.Max(0, _on)];
|
||||
public System.Action<RenderTexture> Switched;
|
||||
/// <summary>The finished picture, the size of the window it fills.</summary>
|
||||
public RenderTexture Rt => _out;
|
||||
/// <summary>0 gone .. 1 fully there.</summary>
|
||||
public float Appear => _appear;
|
||||
/// <summary>Called once the picture has faded right out after <see cref="Show"/>(false).</summary>
|
||||
public System.Action Gone;
|
||||
/// <summary>Called every frame the picture is drawn, with <see cref="Appear"/>: for what fades along with it.</summary>
|
||||
public System.Action<float> Drawn;
|
||||
|
||||
public TalkVideo(string who, string[] moods, int w, int h)
|
||||
/// <param name="figW">The loops' width and height (the picture half).</param>
|
||||
/// <param name="outW">The window's shape, in pixels to render.</param>
|
||||
/// <param name="figRect">Where the figure stands in the window, 0..1 from the bottom left; it fills it like ScaleAndCrop.</param>
|
||||
/// <param name="bg">Resources/Talk/<bg>: the room behind, filling the window.</param>
|
||||
public TalkVideo(string who, string[] moods, int figW, int figH, int outW, int outH, Rect figRect, string bg)
|
||||
{
|
||||
var go = new GameObject("Talk " + who);
|
||||
Object.DontDestroyOnLoad(go);
|
||||
go.AddComponent<TalkVideoTicker>().Owner = this;
|
||||
_players = new VideoPlayer[moods.Length];
|
||||
_rts = new RenderTexture[moods.Length];
|
||||
_raw = new RenderTexture[moods.Length];
|
||||
for (int i = 0; i < moods.Length; i++)
|
||||
{
|
||||
var rt = new RenderTexture(w, h, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who} {moods[i]}" };
|
||||
var rt = new RenderTexture(figW, figH, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who} {moods[i]}" };
|
||||
rt.Create();
|
||||
// see-through until the first frame is in
|
||||
var was = RenderTexture.active;
|
||||
RenderTexture.active = rt;
|
||||
GL.Clear(true, true, Color.clear);
|
||||
RenderTexture.active = was;
|
||||
Clear(rt, Color.black);
|
||||
var vp = go.AddComponent<VideoPlayer>();
|
||||
vp.playOnAwake = false;
|
||||
vp.source = VideoSource.Url;
|
||||
@ -45,8 +62,38 @@ namespace GrassCutter
|
||||
vp.targetTexture = rt;
|
||||
vp.Prepare();
|
||||
_players[i] = vp;
|
||||
_rts[i] = rt;
|
||||
_raw[i] = rt;
|
||||
}
|
||||
_out = new RenderTexture(outW, outH, 0, RenderTextureFormat.ARGB32) { name = $"Talk {who}" };
|
||||
_out.Create();
|
||||
Clear(_out, Color.clear);
|
||||
|
||||
var shader = Resources.Load<Shader>("Talk/TalkHolo");
|
||||
_mat = new Material(shader) { hideFlags = HideFlags.DontSave };
|
||||
var bgTex = Resources.Load<Texture2D>("Talk/" + bg);
|
||||
_mat.SetTexture("_BgTex", bgTex);
|
||||
_mat.SetFloat("_HasBg", bgTex ? 1f : 0f);
|
||||
_mat.SetVector("_FigST", Cover(figRect, outW, outH, figW, figH));
|
||||
_mat.SetVector("_BgST", Cover(new Rect(0f, 0f, 1f, 1f), outW, outH, bgTex ? bgTex.width : outW, bgTex ? bgTex.height : outH));
|
||||
_mat.SetVector("_Px", new Vector4(outW, outH, 0f, 0f));
|
||||
}
|
||||
|
||||
/// <summary>uv in the window -> uv in a picture of srcW x srcH that fills <paramref name="r"/> (cropped, not squeezed).</summary>
|
||||
static Vector4 Cover(Rect r, int outW, int outH, float srcW, float srcH)
|
||||
{
|
||||
float rw = r.width * outW, rh = r.height * outH;
|
||||
float s = Mathf.Max(rw / srcW, rh / srcH);
|
||||
float fx = rw / (srcW * s), fy = rh / (srcH * s);
|
||||
float sx = fx / r.width, sy = fy / r.height;
|
||||
return new Vector4(sx, sy, 0.5f - fx * 0.5f - r.x * sx, 0.5f - fy * 0.5f - r.y * sy);
|
||||
}
|
||||
|
||||
static void Clear(RenderTexture rt, Color c)
|
||||
{
|
||||
var was = RenderTexture.active;
|
||||
RenderTexture.active = rt;
|
||||
GL.Clear(true, true, c);
|
||||
RenderTexture.active = was;
|
||||
}
|
||||
|
||||
/// <summary>Plays the loop for this mood (and only it).</summary>
|
||||
@ -57,14 +104,44 @@ namespace GrassCutter
|
||||
{
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
_on = mood;
|
||||
Switched?.Invoke(_rts[mood]);
|
||||
}
|
||||
if (!_players[mood].isPlaying) _players[mood].Play();
|
||||
}
|
||||
|
||||
public void Stop()
|
||||
/// <summary>Fades the call in (with the hologram's sweep) or out; out, the loop stops once it's gone.</summary>
|
||||
public void Show(bool on)
|
||||
{
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
_target = on ? 1f : 0f;
|
||||
if (on && _on < 0) Play(0);
|
||||
}
|
||||
|
||||
/// <summary>Gone at once, no fade (a film cuts in).</summary>
|
||||
public void Cut()
|
||||
{
|
||||
_target = _appear = 0f;
|
||||
Tick();
|
||||
}
|
||||
|
||||
internal void Tick()
|
||||
{
|
||||
float dt = Time.unscaledDeltaTime;
|
||||
_appear = Mathf.MoveTowards(_appear, _target, dt / (_target > _appear ? InTime : OutTime));
|
||||
if (_appear <= 0f && _target <= 0f)
|
||||
{
|
||||
if (_clear) return;
|
||||
_clear = true;
|
||||
if (_on >= 0) _players[_on].Pause();
|
||||
Clear(_out, Color.clear);
|
||||
Drawn?.Invoke(0f);
|
||||
Gone?.Invoke();
|
||||
return;
|
||||
}
|
||||
_clear = false;
|
||||
if (_on < 0) return;
|
||||
_mat.SetFloat("_Appear", _appear);
|
||||
_mat.SetFloat("_T", Time.unscaledTime);
|
||||
Graphics.Blit(_raw[_on], _out, _mat);
|
||||
Drawn?.Invoke(_appear);
|
||||
}
|
||||
|
||||
/// <summary>The Director: calm (and pleased), stern (and worried), furious.</summary>
|
||||
@ -81,4 +158,11 @@ namespace GrassCutter
|
||||
return (Mood)best;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Draws a <see cref="TalkVideo"/>'s picture once a frame, after the players have had theirs.</summary>
|
||||
public class TalkVideoTicker : MonoBehaviour
|
||||
{
|
||||
public TalkVideo Owner;
|
||||
void LateUpdate() => Owner?.Tick();
|
||||
}
|
||||
}
|
||||
|
||||
@ -163,6 +163,8 @@ namespace GrassCutter
|
||||
SetChoice(Loc.T("Grass density"), Loc.T("How many blades are drawn. There is just as much to cut either way."),
|
||||
new[] { Loc.T("Low"), Loc.T("Medium"), Loc.T("High") }, () => GameSettings.GrassDetail, v => { GameSettings.GrassDetail = v; RefreshRows(); });
|
||||
SetToggle(Loc.T("Bloom"), Loc.T("A soft glow around the sun, lamps and anything bright."), () => GameSettings.Bloom, v => { GameSettings.Bloom = v; RefreshRows(); });
|
||||
SetChoice(Loc.T("Lighting"), Loc.T("Enhanced: richer colour, warm light and cool shadows, deeper shade, and the world out of focus behind the phone and windows. Classic: the original look."),
|
||||
new[] { Loc.T("Classic"), Loc.T("Enhanced") }, () => GameSettings.Lighting, v => GameSettings.Lighting = v);
|
||||
}
|
||||
|
||||
void AudioTab()
|
||||
|
||||
@ -85,8 +85,9 @@ namespace GrassCutter
|
||||
_sky = RenderSettings.ambientSkyColor;
|
||||
_mid = RenderSettings.ambientEquatorColor;
|
||||
_low = RenderSettings.ambientGroundColor;
|
||||
var volume = FindAnyObjectByType<Volume>();
|
||||
if (volume && volume.profile.TryGet(out _grade)) _exposure = _grade.postExposure.value;
|
||||
// the scene's own post volume, not the enhanced look laid over it (LightingStyle)
|
||||
foreach (var volume in FindObjectsByType<Volume>(FindObjectsSortMode.None))
|
||||
if (!LightingStyle.IsOurs(volume) && volume.profile.TryGet(out _grade)) { _exposure = _grade.postExposure.value; break; }
|
||||
if (!GetComponent<WeatherFx>()) gameObject.AddComponent<WeatherFx>();
|
||||
}
|
||||
|
||||
@ -130,6 +131,7 @@ namespace GrassCutter
|
||||
var sky = RenderSettings.skybox;
|
||||
if (sky) sky.SetVector(SunId, Quaternion.Inverse(Planet.Frame) * Sun.Dir);
|
||||
TickLamp(cam);
|
||||
LightingStyle.Tick();
|
||||
}
|
||||
|
||||
void TickLamp(Camera cam)
|
||||
|
||||
246
Assets/Scripts/World/LightingStyle.cs
Normal file
246
Assets/Scripts/World/LightingStyle.cs
Normal file
@ -0,0 +1,246 @@
|
||||
using System.Reflection;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Rendering;
|
||||
using UnityEngine.Rendering.Universal;
|
||||
|
||||
namespace GrassCutter
|
||||
{
|
||||
/// <summary>
|
||||
/// The look of the light, from Settings › Graphics › Lighting: Classic is the scene's own post volume as it always was;
|
||||
/// Enhanced lays a second volume over it with the grade of the prototype (TheWorstEscape's prison yard), softened for a
|
||||
/// bright cartoon: split toning (cool shadows, warm highlights), a touch of cool in the shadows,
|
||||
/// a little more colour and warmth, a warmer and wider bloom, a vignette, a fine grain and a hair of chromatic aberration,
|
||||
/// stronger contact shadows (SSAO) and a glint on the sun. The prototype's ACES stays out: on this sunny meadow it crushed
|
||||
/// the shade to black and burnt the colours (tried, 2026-11-23), and so did switching the pipeline to HDR grading at
|
||||
/// runtime: the scene's own Neutral tonemapping and LDR grading stay. It also takes the world out of focus behind the phone held up and behind a window.
|
||||
///
|
||||
/// Nothing here touches the project's assets: the volumes and profiles are made at runtime, the pipeline is the
|
||||
/// settings' own copy, and the SSAO strength changed in memory is put back on quit. Classic switches it all off again.
|
||||
/// </summary>
|
||||
public static class LightingStyle
|
||||
{
|
||||
public const int Classic = 0, Enhanced = 1;
|
||||
|
||||
static Volume s_look, s_focus;
|
||||
static DepthOfField s_dof;
|
||||
static float s_blur;
|
||||
static ScriptableRendererFeature s_ssao;
|
||||
static object s_ssaoSettings;
|
||||
static float s_ssaoIntensity = -1f, s_ssaoDirect = -1f;
|
||||
static int s_ssaoMethod = -1, s_ssaoSamples = -1;
|
||||
|
||||
public static bool On => GameSettings.Lighting == Enhanced;
|
||||
|
||||
/// <summary>
|
||||
/// Test runs: -lookskip bloom,grade,wb,split,smh,vig,grain,ca,ssao,flare,dof leaves those parts of the look
|
||||
/// out, to see which one does what; aooff switches the renderer's SSAO off altogether.
|
||||
/// </summary>
|
||||
public static bool Skip(string part) => (CommandLine.Get("-lookskip") ?? "").Contains(part);
|
||||
|
||||
/// <summary>The profile of the Enhanced look, so the day/night grade can tell the scene's volume from ours.</summary>
|
||||
public static bool IsOurs(Volume v) => v && (v == s_look || v == s_focus);
|
||||
|
||||
public static void Apply()
|
||||
{
|
||||
Make();
|
||||
s_look.enabled = On;
|
||||
s_focus.enabled = On;
|
||||
if (!Skip("flare")) Flare(RenderSettings.sun);
|
||||
if (s_flare) s_flare.enabled = On;
|
||||
if (!Skip("ssao")) Ssao(On);
|
||||
if (Skip("dof")) s_focus.enabled = false;
|
||||
}
|
||||
|
||||
static void Make()
|
||||
{
|
||||
if (s_look) return;
|
||||
var go = new GameObject("Lighting (enhanced)");
|
||||
Object.DontDestroyOnLoad(go);
|
||||
go.hideFlags = HideFlags.DontSave;
|
||||
|
||||
var p = ScriptableObject.CreateInstance<VolumeProfile>();
|
||||
p.name = "Enhanced look";
|
||||
if (!Skip("bloom")) {
|
||||
var bloom = p.Add<Bloom>(true);
|
||||
bloom.intensity.Override(0.85f);
|
||||
bloom.threshold.Override(0.95f);
|
||||
bloom.scatter.Override(0.7f);
|
||||
bloom.tint.Override(new Color(1f, 0.93f, 0.85f)); }
|
||||
// contrast and saturation only: exposure and the colour filter stay the scene volume's, which the day and the
|
||||
// night vision drive (DayNight)
|
||||
if (!Skip("grade")) {
|
||||
var grade = p.Add<ColorAdjustments>();
|
||||
grade.contrast.Override(17f);
|
||||
grade.saturation.Override(18f); }
|
||||
if (!Skip("wb")) p.Add<WhiteBalance>().temperature.Override(4f);
|
||||
if (!Skip("split")) {
|
||||
var split = p.Add<SplitToning>();
|
||||
split.shadows.Override(new Color(0.46f, 0.5f, 0.56f));
|
||||
split.highlights.Override(new Color(0.56f, 0.53f, 0.48f));
|
||||
split.balance.Override(-10f); }
|
||||
if (!Skip("smh")) {
|
||||
var smh = p.Add<ShadowsMidtonesHighlights>();
|
||||
smh.shadows.Override(new Vector4(0.97f, 1f, 1.05f, 0f));
|
||||
smh.midtones.Override(new Vector4(1f, 1f, 1f, 0.02f)); }
|
||||
if (!Skip("vig")) {
|
||||
var vig = p.Add<Vignette>();
|
||||
vig.intensity.Override(0.24f);
|
||||
vig.smoothness.Override(0.45f); }
|
||||
if (!Skip("grain")) {
|
||||
var grain = p.Add<FilmGrain>();
|
||||
grain.type.Override(FilmGrainLookup.Thin1);
|
||||
grain.intensity.Override(0.1f);
|
||||
grain.response.Override(0.8f); }
|
||||
if (!Skip("ca")) p.Add<ChromaticAberration>().intensity.Override(0.04f);
|
||||
|
||||
s_look = go.AddComponent<Volume>();
|
||||
s_look.isGlobal = true;
|
||||
s_look.priority = 10f;
|
||||
s_look.sharedProfile = p;
|
||||
|
||||
var f = ScriptableObject.CreateInstance<VolumeProfile>();
|
||||
f.name = "Focus";
|
||||
s_dof = f.Add<DepthOfField>(true);
|
||||
s_dof.mode.Override(DepthOfFieldMode.Gaussian);
|
||||
s_dof.gaussianStart.Override(0.4f);
|
||||
s_dof.gaussianEnd.Override(5f);
|
||||
s_dof.gaussianMaxRadius.Override(1.5f);
|
||||
s_dof.highQualitySampling.Override(true);
|
||||
s_focus = go.AddComponent<Volume>();
|
||||
s_focus.isGlobal = true;
|
||||
s_focus.priority = 11f;
|
||||
s_focus.weight = 0f;
|
||||
s_focus.sharedProfile = f;
|
||||
GameSettings.ApplyBloom();
|
||||
}
|
||||
|
||||
static LensFlareComponentSRP s_flare;
|
||||
|
||||
/// <summary>
|
||||
/// A glint on the sun: a warm glow, a faint halo and a few soft ghosts across the screen, all drawn shapes (no
|
||||
/// textures), hidden behind anything in front of the sun.
|
||||
/// </summary>
|
||||
static void Flare(Light sun)
|
||||
{
|
||||
if (!sun) return;
|
||||
if (!s_flare || s_flare.gameObject != sun.gameObject)
|
||||
{
|
||||
s_flare = sun.GetComponent<LensFlareComponentSRP>();
|
||||
if (!s_flare)
|
||||
{
|
||||
var d = ScriptableObject.CreateInstance<LensFlareDataSRP>();
|
||||
d.name = "Sun glint";
|
||||
d.elements = new[]
|
||||
{
|
||||
Shape(SRPLensFlareType.Circle, 0f, 2.2f, 0.55f, new Color(1f, 0.86f, 0.62f), 0.12f),
|
||||
Shape(SRPLensFlareType.Ring, 0f, 5.5f, 0.05f, new Color(0.8f, 0.9f, 1f), 0.5f),
|
||||
Shape(SRPLensFlareType.Polygon, 0.45f, 0.7f, 0.06f, new Color(0.55f, 1f, 0.85f), 0.6f, 6),
|
||||
Shape(SRPLensFlareType.Polygon, 0.85f, 0.35f, 0.08f, new Color(1f, 0.7f, 0.45f), 0.6f, 6),
|
||||
Shape(SRPLensFlareType.Circle, 1.25f, 1.1f, 0.035f, new Color(0.6f, 0.75f, 1f), 0.9f),
|
||||
Shape(SRPLensFlareType.Polygon, 1.6f, 0.5f, 0.05f, new Color(1f, 0.9f, 0.6f), 0.5f, 6),
|
||||
};
|
||||
s_flare = sun.gameObject.AddComponent<LensFlareComponentSRP>();
|
||||
s_flare.lensFlareData = d;
|
||||
s_flare.useOcclusion = true;
|
||||
s_flare.occlusionRadius = 0.6f;
|
||||
s_flare.sampleCount = 8;
|
||||
s_flare.allowOffScreen = false;
|
||||
}
|
||||
}
|
||||
s_flare.enabled = On;
|
||||
}
|
||||
|
||||
static LensFlareDataElementSRP Shape(SRPLensFlareType kind, float at, float size, float strength, Color tint, float soft, int sides = 4)
|
||||
{
|
||||
return new LensFlareDataElementSRP
|
||||
{
|
||||
flareType = kind,
|
||||
position = at,
|
||||
uniformScale = size,
|
||||
localIntensity = strength,
|
||||
tint = tint,
|
||||
fallOff = soft,
|
||||
sideCount = sides,
|
||||
blendMode = SRPLensFlareBlendMode.Additive,
|
||||
modulateByLightColor = true,
|
||||
visible = true,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Every frame (DayNight): the world goes soft behind the phone up at your face and behind a window.</summary>
|
||||
public static void Tick()
|
||||
{
|
||||
if (!s_focus || !On) return;
|
||||
var sun = RenderSettings.sun;
|
||||
if (sun && !Skip("flare") && (!s_flare || s_flare.gameObject != sun.gameObject)) Flare(sun);
|
||||
// the glint is the sun's: it goes with the daylight (the same light is the moon at night) and the clouds
|
||||
if (s_flare) s_flare.intensity = (1f - DayNight.Dark) * Mathf.Clamp01(sun ? sun.intensity / 2f : 0f);
|
||||
bool soft = Phone.Focused || (UIRoot.I && UIRoot.I.AnyModal) || Ctl.UIOpen;
|
||||
s_blur = Mathf.MoveTowards(s_blur, soft ? 1f : 0f, Time.unscaledDeltaTime * 4f);
|
||||
s_focus.weight = s_blur * s_blur * (3f - 2f * s_blur);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The renderer's SSAO, stronger and reaching into the sunlight a little. Its settings are private to URP, so they
|
||||
/// are found by name; if a URP update renames them this quietly does nothing.
|
||||
/// </summary>
|
||||
static void Ssao(bool strong)
|
||||
{
|
||||
if (s_ssaoSettings == null)
|
||||
{
|
||||
var rp = GraphicsSettings.currentRenderPipeline as UniversalRenderPipelineAsset;
|
||||
var data = rp ? rp.rendererDataList : default;
|
||||
foreach (var d in data)
|
||||
{
|
||||
if (!d) continue;
|
||||
foreach (var feature in d.rendererFeatures)
|
||||
if (feature && feature.GetType().Name == "ScreenSpaceAmbientOcclusion") s_ssao = feature;
|
||||
if (s_ssao) break;
|
||||
}
|
||||
if (!s_ssao) return;
|
||||
var field = s_ssao.GetType().GetField("m_Settings", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
s_ssaoSettings = field?.GetValue(s_ssao);
|
||||
if (s_ssaoSettings == null) return;
|
||||
s_ssaoIntensity = Get("Intensity");
|
||||
s_ssaoDirect = Get("DirectLightingStrength");
|
||||
s_ssaoMethod = GetEnum("AOMethod");
|
||||
s_ssaoSamples = GetEnum("Samples");
|
||||
Application.quitting += () => Ssao(false);
|
||||
}
|
||||
if (s_ssaoIntensity < 0f) return;
|
||||
// the scene's blue-noise SSAO at medium samples speckles the flat panels once it is stronger (seen on the travel
|
||||
// terminal, 2026-11-23): the stronger look takes the smooth interleaved-gradient method and the most samples
|
||||
Set("Intensity", strong ? 0.6f : s_ssaoIntensity);
|
||||
if (s_ssaoDirect >= 0f) Set("DirectLightingStrength", strong ? 0.15f : s_ssaoDirect);
|
||||
if (s_ssaoMethod >= 0) SetEnum("AOMethod", strong ? 1 : s_ssaoMethod);
|
||||
if (s_ssaoSamples >= 0) SetEnum("Samples", strong ? 0 : s_ssaoSamples);
|
||||
s_ssao.SetActive(false);
|
||||
s_ssao.SetActive(!Skip("aooff"));
|
||||
Debug.Log($"[Look] SSAO {(Skip("aooff") ? "off" : "on")}: intensity {Get("Intensity")}, direct {Get("DirectLightingStrength")}, method {GetEnum("AOMethod")}, samples {GetEnum("Samples")}");
|
||||
}
|
||||
|
||||
static float Get(string name)
|
||||
{
|
||||
var f = s_ssaoSettings.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
return f != null && f.FieldType == typeof(float) ? (float)f.GetValue(s_ssaoSettings) : -1f;
|
||||
}
|
||||
|
||||
static void Set(string name, float v)
|
||||
{
|
||||
var f = s_ssaoSettings.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (f != null && f.FieldType == typeof(float)) f.SetValue(s_ssaoSettings, v);
|
||||
}
|
||||
|
||||
static int GetEnum(string name)
|
||||
{
|
||||
var f = s_ssaoSettings.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
return f != null && f.FieldType.IsEnum ? System.Convert.ToInt32(f.GetValue(s_ssaoSettings)) : -1;
|
||||
}
|
||||
|
||||
static void SetEnum(string name, int v)
|
||||
{
|
||||
var f = s_ssaoSettings.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
|
||||
if (f != null && f.FieldType.IsEnum) f.SetValue(s_ssaoSettings, System.Enum.ToObject(f.FieldType, v));
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/World/LightingStyle.cs.meta
Normal file
2
Assets/Scripts/World/LightingStyle.cs.meta
Normal file
@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 44bc328baa8f46f498af396975b6991a
|
||||
Reference in New Issue
Block a user