Compare commits

...

9 Commits

  1. 6
      .vsconfig
  2. 436
      Assets/Fonts/NotoSansTC-Regular SDF.asset
  3. 1921
      Assets/Fonts/UDKakugoC80Pro-B SDF.asset
  4. 8
      Assets/Fonts/UDKakugoC80Pro-B SDF.asset.meta
  5. BIN
      Assets/Fonts/UDKakugoC80Pro-B.otf
  6. 21
      Assets/Fonts/UDKakugoC80Pro-B.otf.meta
  7. BIN
      Assets/Postcard/discard.png
  8. 114
      Assets/Postcard/discard.png.meta
  9. BIN
      Assets/Postcard/postcard.png
  10. 114
      Assets/Postcard/postcard.png.meta
  11. 8012
      Assets/Scenes/Scene-MOTY.unity
  12. 7
      Assets/Scenes/Scene-MOTY.unity.meta
  13. 2
      Assets/Scripts/GoogleDriveUtils.cs
  14. 408
      Assets/Scripts/MotyOscHandler.cs
  15. 11
      Assets/Scripts/MotyOscHandler.cs.meta
  16. 256
      Assets/Scripts/MotyUploadToGoogleDrive.cs
  17. 11
      Assets/Scripts/MotyUploadToGoogleDrive.cs.meta
  18. 1
      Assets/Scripts/OscHandler.cs
  19. 4
      Assets/Shaders/Material-shader.mat
  20. 26
      Assets/Shaders/bloom.shader
  21. 981
      Assets/Shaders/noise.shadergraph
  22. 40
      Assets/Textures/Moty DisplayTexture.renderTexture
  23. 8
      Assets/Textures/Moty DisplayTexture.renderTexture.meta
  24. 40
      Assets/Textures/Moty Video Texture Ad.renderTexture
  25. 8
      Assets/Textures/Moty Video Texture Ad.renderTexture.meta
  26. 40
      Assets/Textures/Moty Video Texture BG.renderTexture
  27. 8
      Assets/Textures/Moty Video Texture BG.renderTexture.meta
  28. 40
      Assets/Textures/Moty Video Texture Ending.renderTexture
  29. 8
      Assets/Textures/Moty Video Texture Ending.renderTexture.meta
  30. 40
      Assets/Textures/Moty Video Texture.renderTexture
  31. 8
      Assets/Textures/Moty Video Texture.renderTexture.meta
  32. 2
      Material/token.json/Google.Apis.Auth.OAuth2.Responses.TokenResponse-user
  33. 5
      ProjectSettings/EditorBuildSettings.asset

@ -0,0 +1,6 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Workload.ManagedGame"
]
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

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

Binary file not shown.

@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: b83a75b4d73f9744bbe92ddde8f63a7d
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- FOT-UDKakugoC80 Pro
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

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

File diff suppressed because it is too large Load Diff

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

@ -53,6 +53,8 @@ public class GoogleDriveUtils
{ {
Debug.Log("Getting/Creating folder path: " + path); Debug.Log("Getting/Creating folder path: " + path);
if (path.Length == 0) return parentFolderId;
List<string> folders = new List<string>(path.Split('/')); List<string> folders = new List<string>(path.Split('/'));
string currentFolderId = parentFolderId; string currentFolderId = parentFolderId;

@ -0,0 +1,408 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.Video;
using OscJack;
using TMPro;
public class MotyOscHandler : MonoBehaviour
{
[SerializeField]
public CanvasGroup standby;
[SerializeField]
public CanvasGroup ending;
[SerializeField]
public CanvasGroup ad;
[SerializeField]
public CanvasGroup main;
[SerializeField]
public VideoPlayer videoStandby;
[SerializeField]
public VideoPlayer videoIntro;
[SerializeField]
public VideoPlayer videoEnding;
[SerializeField]
public VideoPlayer videoAd;
[SerializeField]
public Image mask;
[SerializeField]
public float _fadeDuration = 1f;
[SerializeField]
public float _hintDuration = 0.5f;
[SerializeField]
public float _maskDuration = 0.2f;
[SerializeField]
public float _lastDurationToShow = 30f;
[SerializeField]
public TextMeshProUGUI statusText;
[SerializeField]
public CanvasGroup hint;
private IEnumerator coroutine_hint;
private IEnumerator coroutine_countdown;
SetChoiceEffect setChoiceEffect;
[SerializeField]
public TextMeshProUGUI stepText;
[SerializeField]
public CanvasGroup hintforChat;
[SerializeField]
public CanvasGroup hintforStep;
private IEnumerator coroutine_breath;
public CanvasGroup hintforInput;
// Start is called before the first frame update
void Start()
{
setChoiceEffect = main?.GetComponent<SetChoiceEffect>();
}
// Update is called once per frame
void Update()
{
}
private IEnumerator FadeCanvasGroup(CanvasGroup canvasGroup, float startAlpha, float endAlpha, float duration, float delay = 0f)
{
if (delay > 0f)
yield return new WaitForSeconds(delay);
canvasGroup.alpha = startAlpha;
float elapsedTime = 0f;
while (elapsedTime < duration)
{
elapsedTime += Time.deltaTime;
canvasGroup.alpha = Mathf.Lerp(startAlpha, endAlpha, elapsedTime / duration);
yield return null;
}
canvasGroup.alpha = endAlpha;
}
private IEnumerator DecreaseFill(float duration)
{
float elapsed = 0f;
mask.fillAmount = 1f;
while (elapsed < duration)
{
elapsed += Time.deltaTime;
if (duration - elapsed > _lastDurationToShow)
{
mask.fillAmount = 0;
mask.gameObject.SetActive(false);
}
else
{
mask.gameObject.SetActive(true);
mask.fillAmount = Mathf.Lerp(0f, 1f, (duration - elapsed) / _lastDurationToShow);
}
yield return null;
}
mask.fillAmount = 0f;
}
public void ToggleVideo(string status)
{
switch(status)
{
case "intro":
videoStandby.gameObject.SetActive(false);
videoEnding.gameObject.SetActive(false);
videoIntro.time = 0f;
videoIntro.Play();
if (standby.alpha > 0f) StartCoroutine(FadeCanvasGroup(standby, standby.alpha, 0f, _fadeDuration));
if (main.alpha > 0f) StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
if (ad.alpha > 0f) StartCoroutine(FadeCanvasGroup(ad, ad.alpha, 0f, _fadeDuration));
if (ending.alpha > 0f) StartCoroutine(FadeCanvasGroup(ending, ending.alpha, 0f, _fadeDuration));
break;
case "end":
videoStandby.gameObject.SetActive(false);
videoEnding.gameObject.SetActive(true);
videoAd.gameObject.SetActive(false);
videoEnding.time = 0f;
videoEnding.Play();
if (standby.alpha > 0f) StartCoroutine(FadeCanvasGroup(standby, standby.alpha, 0f, _fadeDuration));
if (main.alpha > 0f) StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
if (ad.alpha > 0f) StartCoroutine(FadeCanvasGroup(ad, ad.alpha, 0f, _fadeDuration));
if (ending.alpha < 1.0f) StartCoroutine(FadeCanvasGroup(ending, ending.alpha, 1f, _fadeDuration));
break;
case "standby":
case "reset":
videoStandby.gameObject.SetActive(true);
videoEnding.gameObject.SetActive(false);
videoAd.gameObject.SetActive(false);
videoStandby.time = 0f;
videoStandby.Play();
if (standby.alpha < 1.0f) StartCoroutine(FadeCanvasGroup(standby, standby.alpha, 1f, _fadeDuration));
if (main.alpha > 0f) StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
if (ad.alpha > 0f) StartCoroutine(FadeCanvasGroup(ad, ad.alpha, 0f, _fadeDuration));
if (ending.alpha > 0f) StartCoroutine(FadeCanvasGroup(ending, ending.alpha, 0f, _fadeDuration));
break;
case "ad":
videoStandby.gameObject.SetActive(false);
videoEnding.gameObject.SetActive(false);
videoAd.gameObject.SetActive(true);
videoAd.time = 0f;
videoAd.Play();
if (standby.alpha > 0f) StartCoroutine(FadeCanvasGroup(standby, standby.alpha, 0f, _fadeDuration));
if (main.alpha > 0f) StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
if (ad.alpha < 1f) StartCoroutine(FadeCanvasGroup(ad, ad.alpha, 1f, _fadeDuration));
if (ending.alpha > 0f) StartCoroutine(FadeCanvasGroup(ending, ending.alpha, 0f, _fadeDuration));
break;
}
}
public void onStatus(string status)
{
Debug.Log("/status message received: " + status);
ToggleVideo("reset");
if (coroutine_hint != null) StopCoroutine(coroutine_hint);
mask.fillAmount = 0f;
switch (status)
{
case "reset":
// intro.alpha = 1.0f;
if (main.alpha > 0f)
StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
// if (intro.alpha < 1f)
// StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 1f, _fadeDuration));
// light_mask.alpha = 0f;
hint.alpha = 0f;
// setChoiceEffect?.Reset();
ToggleVideo("standby");
break;
case "intro":
// StartCoroutine(FadeCanvasGroup(light_mask, 0f, 1f, _maskDuration));
// StartCoroutine(FadeCanvasGroup(intro, 0f, 1f, _fadeDuration, _maskDuration));
if (main.alpha > 0f)
StartCoroutine(FadeCanvasGroup(main, main.alpha, 0f, _fadeDuration));
StartCoroutine(FadeCanvasGroup(hint, hint.alpha, 1f, _hintDuration));
ToggleVideo("intro");
break;
case "go":
// if (light_mask.alpha < 1f) StartCoroutine(FadeCanvasGroup(light_mask, light_mask.alpha, 1f, _fadeDuration));
// StartCoroutine(FadeCanvasGroup(intro, intro.alpha, 0f, _fadeDuration));
StartCoroutine(FadeCanvasGroup(main, main.alpha, 1f, _fadeDuration));
break;
case "end":
// if (intro.alpha > 0f) StartCoroutine(FadeCanvasGroup(intro, 1f, 0f, _fadeDuration));
// StartCoroutine(FadeCanvasGroup(main, 1f, 0f, _fadeDuration));
main.alpha = 0f;
standby.alpha=0f;
// StartCoroutine(FadeCanvasGroup(light_mask, 1f, 0f, _maskDuration, _fadeDuration));
if (hint.alpha > 0f)
{
coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 0f, _hintDuration);
StartCoroutine(coroutine_hint);
}
ToggleVideo("end");
break;
case "ad":
ToggleVideo("ad");
break;
default:
Debug.LogWarning("Unknown status: " + status);
break;
}
}
public void onCountDown(string time)
{
Debug.Log("/countdown message received: " + time);
if (mask != null)
{
if (coroutine_countdown != null) StopCoroutine(coroutine_countdown);
if (time == "0")
{
mask.fillAmount = 0f;
mask.gameObject.SetActive(false);
}
else
{
coroutine_countdown = DecreaseFill(float.Parse(time));
StartCoroutine(coroutine_countdown);
}
}
}
public void onSpeechPause(string pause)
{
Debug.Log("/speechpause message received: " + pause);
float pause_time = float.Parse(pause);
if (pause_time > 0f)
{
StartCoroutine(FadeCanvasGroup(hintforInput, hintforInput.alpha, 0f, pause_time/1000.0f));
}
}
public void onInput(string input)
{
Debug.Log("/input message received: " + input);
if (input.Length == 0)
{
statusText.text = "";
// hintforChat.alpha = 0f;
if (hintforChat.alpha > 0f)
{
StartCoroutine(FadeCanvasGroup(hintforChat, hintforChat.alpha, 0f, _hintDuration));
}
}
else
{
hintforInput.alpha = 1.0f;
if (hint.alpha < 1f)
{
if (coroutine_hint != null) StopCoroutine(coroutine_hint);
coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 1f, _hintDuration);
StartCoroutine(coroutine_hint);
}
// statusText.text = input;
StartCoroutine(TypeWriter(statusText, input));
// hintforChat.alpha = 1f;
// if (hintforChat.alpha < 1f)
// {
StartCoroutine(FadeCanvasGroup(hintforChat, hintforChat.alpha, 1f, _hintDuration));
// }
if (hint.alpha < 1f)
{
// if (coroutine_hint != null) StopCoroutine(coroutine_hint);
// coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 1f, _hintDuration);
// StartCoroutine(coroutine_hint);
if (coroutine_hint != null) StopCoroutine(coroutine_hint);
coroutine_hint = BreathFade(hint);
StartCoroutine(coroutine_hint);
}
}
}
public void onHint(string text)
{
Debug.Log("/hint message received: " + text);
// stepText.text = text;
StartCoroutine(TypeWriter(stepText, text));
StartCoroutine(FadeCanvasGroup(hintforStep, hintforStep.alpha, 1f, _hintDuration));
if (coroutine_breath != null) StopCoroutine(coroutine_breath);
// coroutine_hint = FadeCanvasGroup(hint, hint.alpha, text.Length > 0 ? 1f : 0f, _hintDuration);
// StartCoroutine(coroutine_hint);
hintforInput.alpha = 1.0f;
coroutine_breath = BreathFade(hintforStep);
StartCoroutine(coroutine_breath);
}
private IEnumerator BreathFade(CanvasGroup canvasGroup, float maxAlpha=1f, float minAlpha=0.5f,
float fadeInDuration=1.2f, float fadeOutDuration=1.2f, int cycles=20)
{
for (int i = 0; i < cycles; i++)
{
// Fade out
float elapsed = 0f;
while (elapsed < fadeOutDuration)
{
elapsed += Time.deltaTime;
canvasGroup.alpha = Mathf.Lerp(maxAlpha, minAlpha, elapsed / fadeOutDuration);
yield return null;
}
canvasGroup.alpha = minAlpha;
// Fade in
elapsed = 0f;
while (elapsed < fadeInDuration)
{
elapsed += Time.deltaTime;
canvasGroup.alpha = Mathf.Lerp(minAlpha, maxAlpha, elapsed / fadeInDuration);
yield return null;
}
canvasGroup.alpha = maxAlpha;
}
}
public IEnumerator TypeWriter(TextMeshProUGUI textComponent, string message, float typeSpeed = 0.2f)
{
textComponent.text = "";
foreach (char c in message)
{
textComponent.text += c;
yield return new WaitForSeconds(typeSpeed);
}
}
}

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

@ -0,0 +1,256 @@
using System.Collections;
using UnityEngine;
using TMPro;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Drive.v3;
using Google.Apis.Services;
using System;
public class MotyUploadToGoogleDrive : MonoBehaviour
{
public float PrintBrightnessMultiplier = 1.2f;
public class UploadRequestMoty
{
public string id;
public string filename;
public bool default_image;
}
public RenderTexture renderTexture_share;
public string OutputFolder = "output";
public TextMeshProUGUI TextNumber;
public TextMeshProUGUI TextSummary;
// public GameObject BackgroundDefault;
public GameObject ImageDiscardPostcard;
public GameObject ImageGeneratePostcard;
// Start is called before the first frame update
public string GoogleDriveFolderId = "1lZ_dJkr4qrIWG1IFd-nPCv__LHALUv0J";
UploadRequestMoty latest_input;
// DriveService service;
void Start()
{
setupService();
}
// Update is called once per frame
void Update()
{
}
public void Save(string input_text)
{
var parmas = input_text.Split('#');
if (parmas.Length < 2)
{
Debug.LogError("Input text must contain at least two parts separated by '#'.");
return;
}
string id = parmas[0].Trim();
// string summary = parmas[2].Trim();
string filename = id;
bool default_image = parmas[1].Trim().ToLower() == "default";
Debug.Log("/export id=" + id + " default:" + default_image);
if (default_image)
{
ImageGeneratePostcard.SetActive(false);
}
else
{
ImageGeneratePostcard.SetActive(true);
}
TextNumber.SetText(id);
// TextSummary.SetText(summary);
TextNumber.ForceMeshUpdate();
TextSummary.ForceMeshUpdate();
latest_input = new UploadRequestMoty()
{
id = id,
filename = filename,
default_image = default_image,
};
if (!this.enabled || !gameObject.activeInHierarchy){
Debug.LogError("Cannot start coroutine: Host is not active or enabled!");
return;
}
StartCoroutine(ExportAfterFrame(latest_input));
// Export(latest_input);
}
private IEnumerator ExportAfterFrame(UploadRequestMoty uploadRequest)
{
Debug.Log("Waiting for end of frame before exporting...");
// yield return new WaitForEndOfFrame();
yield return null;
Debug.Log("End of frame reached, starting export...");
Export(uploadRequest);
}
public void Export(UploadRequestMoty uploadRequest = null)
{
if (uploadRequest == null)
{
Debug.LogError("UploadRequest is null.");
return;
}
string id = uploadRequest.id;
string filename = uploadRequest.filename;
Debug.Log("Saving image to: filename=" + filename + " id=" + id);
if (string.IsNullOrEmpty(filename))
{
Debug.LogError("Filename cannot be null or empty.");
filename = "untitled_" + System.DateTime.Now.ToString("yyyyMMdd_HHmmss");
// return;
}
Debug.Log("Saving image to: filename=" + filename + " id=" + id);
// string timestamp = System.DateTime.Now.ToString("yyyyMMdd");
// if (!System.IO.Directory.Exists(OutputFolder + "/" + uploadDest))
// {
// System.IO.Directory.CreateDirectory(OutputFolder + "/" + uploadDest);
// }
SaveRenderTextureToPNG(renderTexture_share, System.IO.Path.Combine(OutputFolder, filename + ".png"));
Debug.Log("Image saved to " + filename);
string share_fullPath = System.IO.Path.Combine(OutputFolder + "/", filename + ".png");
Debug.Log("share_path: " + share_fullPath);
upload(share_fullPath, id, "share");
}
void SaveRenderTextureToPNG(RenderTexture rt, string filePath)
{
Debug.Log("Saving RenderTexture to PNG at " + filePath);
RenderTexture currentRT = RenderTexture.active;
RenderTexture.active = rt;
Texture2D tex = new Texture2D(rt.width, rt.height, TextureFormat.RGBA32, false);
tex.ReadPixels(new Rect(0, 0, rt.width, rt.height), 0, 0);
// Apply gamma correction (sRGB conversion) to each pixel
for (int y = 0; y < tex.height; y++)
{
for (int x = 0; x < tex.width; x++)
{
Color linearColor = tex.GetPixel(x, y);
Color sRGBColor = new Color(
Mathf.LinearToGammaSpace(linearColor.r),
Mathf.LinearToGammaSpace(linearColor.g),
Mathf.LinearToGammaSpace(linearColor.b),
linearColor.a
);
sRGBColor.r *= PrintBrightnessMultiplier;
                sRGBColor.g *= PrintBrightnessMultiplier;
sRGBColor.b *= PrintBrightnessMultiplier;
tex.SetPixel(x, y, sRGBColor);
}
}
tex.Apply();
byte[] bytes = tex.EncodeToPNG();
System.IO.File.WriteAllBytes(filePath, bytes);
Debug.Log("Saved RenderTexture to PNG at " + filePath + " with size: " + bytes.Length + " bytes");
RenderTexture.active = currentRT;
Destroy(tex);
}
void setupService()
{
// Debug.Log("Setting up Google Drive service...");
// // Initialize Google Drive API service
// service = new DriveService(new BaseClientService.Initializer()
// {
// HttpClientInitializer = GoogleCredential.FromFile("../Material/tech-277909-8bd38efb7464.json").CreateScoped(DriveService.Scope.DriveFile),
// ApplicationName = "24070-Upload",
// });
GoogleDriveUtils.setupService();
}
void upload(string _uploadFile, string _fileId, string type, bool needToPrint = true)
{
if (GoogleDriveUtils.service == null)
{
Debug.Log("service is null, setting up service again.");
setupService();
}
// string path = "";
// int lastSlash = path.LastIndexOf('/');
// Debug.Log("Extracted path: " + path + ", lastSlash=" + lastSlash);
// if (lastSlash >= 0)
// {
// // path = path[..lastSlash];
// path=path.Substring(0, lastSlash);
// }
Debug.Log("Uploading file to Google Drive: " + _uploadFile);
string folderId = GoogleDriveUtils.getFolder(GoogleDriveUtils.service, "", GoogleDriveFolderId);
StartCoroutine(GoogleDriveUtils.UploadCoroutine(GoogleDriveUtils.service, _uploadFile, folderId, _fileId, type,
(response) =>
{
if (response != null)
{
var url = response;
Debug.Log("Upload successful:" + url);
// TODO: back to standby
}
else
{
Debug.LogError("Upload failed: " + response);
}
}
));
}
}

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

@ -65,6 +65,7 @@ public class OscHandler : MonoBehaviour
void Start() void Start()
{ {
setChoiceEffect = main?.GetComponent<SetChoiceEffect>(); setChoiceEffect = main?.GetComponent<SetChoiceEffect>();
onStatus("reset");
} }
// Update is called once per frame // Update is called once per frame

@ -70,7 +70,7 @@ Material:
- _DetailNormalMapScale: 1 - _DetailNormalMapScale: 1
- _DstBlend: 0 - _DstBlend: 0
- _FadeAmount: 1 - _FadeAmount: 1
- _FisheyeStrength: 1.1 - _FisheyeStrength: 1.05
- _FlashAmount: 0 - _FlashAmount: 0
- _GlossMapScale: 1 - _GlossMapScale: 1
- _Glossiness: 0.5 - _Glossiness: 0.5
@ -88,6 +88,6 @@ Material:
m_Colors: m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1} - _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1} - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _Resolution: {r: 1080, g: 1920, b: 0, a: 0} - _Resolution: {r: 1280, g: 960, b: 0, a: 0}
- _TintColor: {r: 1, g: 1, b: 1, a: 1} - _TintColor: {r: 1, g: 1, b: 1, a: 1}
m_BuildTextureStacks: [] m_BuildTextureStacks: []

@ -136,12 +136,36 @@ Shader "Unlit/NewUnlitShader"
} }
} }
float2 mirrorX(float2 uv)
{
float x= uv.x*_Resolution.x;
float border=(_Resolution.x-_Resolution.y)/2.0;
if (x < border)
{
return float2((border - x)/_Resolution.y, uv.y);
}
else if(x < border + _Resolution.y)
{
return float2((x - border)/_Resolution.y, uv.y);
}
else
{
return float2(1.0-pow((x - border - _Resolution.y)/_Resolution.y, 1.2), uv.y);
}
}
fixed4 frag (v2f i) : SV_Target fixed4 frag (v2f i) : SV_Target
{ {
// sample the texture // sample the texture
v2f o; v2f o;
o.uv=mirror(i.uv, _OffsetY); // Apply mirror effect based on offset
if(_Resolution.y>_Resolution.x) o.uv=mirror(i.uv, _OffsetY); // Apply mirror effect based on offset
else if(_Resolution.x>_Resolution.y) o.uv= mirrorX(i.uv);
else o.uv=i.uv;
o.uv = fisheyeWarp(o.uv, _FisheyeStrength); // Apply fisheye warp effect o.uv = fisheyeWarp(o.uv, _FisheyeStrength); // Apply fisheye warp effect
float dist= length(i.uv*_Resolution - float2(0.5, _OffsetY + _Resolution.x/_Resolution.y*0.5)* _Resolution)/_Resolution.x; // Calculate distance from center float dist= length(i.uv*_Resolution - float2(0.5, _OffsetY + _Resolution.x/_Resolution.y*0.5)* _Resolution)/_Resolution.x; // Calculate distance from center

File diff suppressed because it is too large Load Diff

@ -0,0 +1,40 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Moty DisplayTexture
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1280
m_Height: 720
m_AntiAliasing: 8
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2

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

@ -0,0 +1,40 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Moty Video Texture Ad
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1280
m_Height: 720
m_AntiAliasing: 8
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2

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

@ -0,0 +1,40 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Moty Video Texture BG
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1280
m_Height: 720
m_AntiAliasing: 8
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2

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

@ -0,0 +1,40 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Moty Video Texture Ending
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1280
m_Height: 720
m_AntiAliasing: 8
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2

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

@ -0,0 +1,40 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!84 &8400000
RenderTexture:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: Moty Video Texture
m_ImageContentsHash:
serializedVersion: 2
Hash: 00000000000000000000000000000000
m_ForcedFallbackFormat: 4
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1280
m_Height: 720
m_AntiAliasing: 8
m_MipCount: -1
m_DepthStencilFormat: 94
m_ColorFormat: 8
m_MipMap: 0
m_GenerateMips: 1
m_SRGB: 0
m_UseDynamicScale: 0
m_BindMS: 0
m_EnableCompatibleFormat: 1
m_EnableRandomWrite: 0
m_TextureSettings:
serializedVersion: 2
m_FilterMode: 1
m_Aniso: 0
m_MipBias: 0
m_WrapU: 1
m_WrapV: 1
m_WrapW: 1
m_Dimension: 2
m_VolumeDepth: 1
m_ShadowSamplingMode: 2

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 6c974968dd7933a4daab7dba5fd02dfd
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 8400000
userData:
assetBundleName:
assetBundleVariant:

@ -1 +1 @@
{"access_token":"ya29.a0AQQ_BDS2nYM6KNRSPy8ekvW2klxI4l3eOqVEEZgTcJyUvqQ-wja9VCNytq1Mny7pwhyrjpxuTHZ04Ug1ekdiXc4DtfV85vI00TfZoSzqpwnyzqHcDBVFrwF84Y_UNyGONmPzGM3eYz_tGDNmzAFWtW-FB60saWpUBDKN3Q53JOpF4BmIjhpnn2lBmJjlubQU1xF_GTeKDwaCgYKAckSARESFQHGX2Mi1q-NANLVrX2jjRDuQ8FD6A0209","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-10-17T12:21:26.480+08:00","IssuedUtc":"2025-10-17T04:21:26.480Z"} {"access_token":"ya29.a0ATi6K2siNXd-9yVS2aNG4MRh8nsyICfP3YsEhF288MqLmnZIXPhbEDWHcB8hN8iRPh98egC7twftdKUayY3cwkYQM-fGK42wByjQJQrSVEnvZEK4tXrae6xl_QJpaJLWUVKl47EyTTQLSVYGKWpkQLm8jovWtMex1Ze1Lrgle-4Xm8NPvFX6qQM8Ha_iyCSHwFjrFEhkeQaCgYKASISARESFQHGX2Mit3WynDpQS7swnYO8m1loeg0209","token_type":"Bearer","expires_in":3599,"refresh_token":"1//0e-urCtqMVSK6CgYIARAAGA4SNwF-L9IrTWfNUsKFuBn8-mJmQxbXhkBlRW8776bD9xuFk1rFTaMH0dA9yRyESXHTchyXJDAJgkU","scope":"https://www.googleapis.com/auth/drive","Issued":"2025-11-20T18:53:12.188+08:00","IssuedUtc":"2025-11-20T10:53:12.188Z"}

@ -5,7 +5,10 @@ EditorBuildSettings:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
serializedVersion: 2 serializedVersion: 2
m_Scenes: m_Scenes:
- enabled: 1 - enabled: 0
path: Assets/Scenes/SampleScene.unity path: Assets/Scenes/SampleScene.unity
guid: 2cda990e2423bbf4892e6590ba056729 guid: 2cda990e2423bbf4892e6590ba056729
- enabled: 1
path: Assets/Scenes/Scene-MOTY.unity
guid: bac84382a290ed04eb82c435dcb6cdbf
m_configObjects: {} m_configObjects: {}

Loading…
Cancel
Save