main
reng 4 months ago
parent 84f418a149
commit b72b408286
  1. 222
      Assets/Fonts/NotoSansTC-Regular SDF.asset
  2. 2488
      Assets/Fonts/NotoSerifTC-Regular SDF-Postcard.asset
  3. 8
      Assets/Fonts/NotoSerifTC-Regular SDF-Postcard.asset.meta
  4. 1913
      Assets/Fonts/NotoSerifTC-Regular SDF.asset
  5. 159
      Assets/Scenes/SampleScene.unity
  6. 77
      Assets/Scripts/OscHandler.cs
  7. 40
      Assets/Scripts/SaveImage.cs
  8. 4
      Assets/Textures/Share Texture.renderTexture

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: 9be227ebe9d11454dbc86faa54b27df8
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

@ -488,7 +488,7 @@ MonoBehaviour:
hint: {fileID: 2028163027}
stepText: {fileID: 1988834086}
hintforChat: {fileID: 585829000}
hintforStep: {fileID: 0}
hintforStep: {fileID: 611584132}
--- !u!114 &283408163
MonoBehaviour:
m_ObjectHideFlags: 0
@ -895,8 +895,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 98.5, y: 0}
m_SizeDelta: {x: 197, y: 0}
m_AnchoredPosition: {x: 104.25, y: 0}
m_SizeDelta: {x: 208.5, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &366298495
MonoBehaviour:
@ -1038,8 +1038,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 775.4286, y: -197}
m_SizeDelta: {x: 255.14287, y: 0}
m_AnchoredPosition: {x: 602, y: -208.5}
m_SizeDelta: {x: 199.33334, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &428712011
MonoBehaviour:
@ -2787,8 +2787,8 @@ MonoBehaviour:
m_Calls: []
m_text: "\u5728\u9019\u6BB5\u65C5\u7A0B\u4E2D\uFF0C\u6211\u6210\u9577\u3001\u5B78\u7FD2\uFF0C\u9762\u5C0D\u6311\u6230\uFF0C\u6536\u7A6B\u7121\u6578\u3002\u6211\u4E0D\u65B7\u63A2\u7D22\uFF0C\u8FFD\u6C42\u5922\u60F3\uFF0C\u73CD\u60DC\u6BCF\u500B\u77AC\u9593\u3002\u9019\u662F\u4E00\u751F\u96E3\u5FD8\u7684\u7D93\u6B77\u3002"
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2}
m_sharedMaterial: {fileID: -4264381060954844368, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2}
m_fontAsset: {fileID: 11400000, guid: 9be227ebe9d11454dbc86faa54b27df8, type: 2}
m_sharedMaterial: {fileID: -6120210280381436959, guid: 9be227ebe9d11454dbc86faa54b27df8, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
@ -2862,6 +2862,114 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 630451396}
m_CullTransparentMesh: 1
--- !u!1 &696492447
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 696492448}
- component: {fileID: 696492452}
- component: {fileID: 696492451}
- component: {fileID: 696492450}
- component: {fileID: 696492449}
m_Layer: 0
m_Name: RawImage (3)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &696492448
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 696492447}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1918837002}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 803.3334, y: -208.5}
m_SizeDelta: {x: 199.33334, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &696492449
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 696492447}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 86710e43de46f6f4bac7c8e50813a599, type: 3}
m_Name:
m_EditorClassIdentifier:
m_AspectMode: 1
m_AspectRatio: 0.5625
--- !u!114 &696492450
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 696492447}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 306cc8c2b49d7114eaa3623786fc2126, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreLayout: 0
m_MinWidth: -1
m_MinHeight: -1
m_PreferredWidth: -1
m_PreferredHeight: -1
m_FlexibleWidth: 0.8
m_FlexibleHeight: -1
m_LayoutPriority: 1
--- !u!114 &696492451
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 696492447}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 1344c3c82d62a2a41a3576d8abb8e3ea, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0}
m_Maskable: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_Texture: {fileID: 8400000, guid: 91633495c7c9dd040b09afd52966b6d4, type: 2}
m_UVRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
--- !u!222 &696492452
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 696492447}
m_CullTransparentMesh: 1
--- !u!1 &717506483
GameObject:
m_ObjectHideFlags: 0
@ -3204,8 +3312,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 159.4643, y: 0}
m_SizeDelta: {x: 197, y: 0}
m_AnchoredPosition: {x: 124.583336, y: 0}
m_SizeDelta: {x: 208.5, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &830016229
MonoBehaviour:
@ -3776,8 +3884,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 98.5, y: 0}
m_SizeDelta: {x: 197, y: 0}
m_AnchoredPosition: {x: 104.25, y: 0}
m_SizeDelta: {x: 208.5, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1060364296
MonoBehaviour:
@ -4183,7 +4291,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: adfb9868b2bba274fb2e49202e8dd91d, type: 3}
m_Name:
m_EditorClassIdentifier:
filePathPattern: "24070-\u5FAE\u91BA\u5927\u98EF\u5E97\u9AD8\u96C4\u7248/{time:yyyy-MM-dd}/{filename_ext}"
filePathPattern: "24070-\u5FAE\u91BA\u5927\u98EF\u5E97\u9AD8\u96C4\u7248/{time:yyyyMM}/{time:MMdd}/{time:HH00}/{filename_ext}"
timeoutSeconds: 15
encode: 1
uploadResponseEvent:
@ -4542,8 +4650,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 147.99742, y: -176.90761}
m_SizeDelta: {x: 295.99484, y: 0}
m_AnchoredPosition: {x: 124.19365, y: -196.30435}
m_SizeDelta: {x: 248.3873, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1457143873
MonoBehaviour:
@ -5251,8 +5359,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 483.39288, y: 0}
m_SizeDelta: {x: 221.625, y: 0}
m_AnchoredPosition: {x: 375.75, y: 0}
m_SizeDelta: {x: 234.5625, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1811530096
MonoBehaviour:
@ -5359,7 +5467,7 @@ Camera:
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
@ -5400,26 +5508,22 @@ Camera:
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!224 &1853931822
RectTransform:
--- !u!4 &1853931822
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1853931819}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalPosition: {x: -651.4, y: 211.6, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 528439830}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -651.7, y: 211.6}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &1918837001
GameObject:
m_ObjectHideFlags: 0
@ -5453,6 +5557,7 @@ RectTransform:
- {fileID: 830016228}
- {fileID: 1811530095}
- {fileID: 428712010}
- {fileID: 696492448}
m_Father: {fileID: 357834774}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
@ -5478,7 +5583,7 @@ MonoBehaviour:
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 3
m_Spacing: 5
m_Spacing: 2
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 1
m_ChildControlWidth: 1
@ -5934,5 +6039,5 @@ SceneRoots:
- {fileID: 1076654508}
- {fileID: 794429374}
- {fileID: 511676375}
- {fileID: 1853931822}
- {fileID: 1010487600}
- {fileID: 1853931822}

@ -190,38 +190,59 @@ public class OscHandler : MonoBehaviour
Debug.Log("/input message received: " + input);
if (hint.alpha < 1f)
if (input.Length == 0)
{
if (coroutine_hint != null) StopCoroutine(coroutine_hint);
coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 1f, _hintDuration);
StartCoroutine(coroutine_hint);
statusText.text = "";
// hintforChat.alpha = 0f;
if (hintforChat.alpha > 0f)
{
StartCoroutine(FadeCanvasGroup(hintforChat, hintforChat.alpha, 0f, _hintDuration));
}
}
switch (input)
else
{
case "processing":
statusText.text = "我想一下";
hintforChat.alpha = 1f;
stepText.text = "";
break;
case "system":
statusText.text = "等我一下,\n換我說囉";
hintforChat.alpha = 1f;
stepText.text = "";
break;
case "user":
statusText.text = "換你說了";
hintforChat.alpha = 1f;
stepText.text = "";
break;
case "clear":
statusText.text = "";
break;
default:
Debug.LogWarning("Unknown input: " + input);
break;
statusText.text = 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);
}
}
// switch (input)
// {
// case "processing":
// statusText.text = "我想一下";
// hintforChat.alpha = 1f;
// stepText.text = "";
// break;
// case "system":
// statusText.text = "等我一下,\n換我說囉";
// hintforChat.alpha = 1f;
// stepText.text = "";
// break;
// case "user":
// statusText.text = "換你說了";
// hintforChat.alpha = 1f;
// stepText.text = "";
// break;
// case "clear":
// statusText.text = "";
// break;
// default:
// Debug.LogWarning("Unknown input: " + input);
// break;
// }
}
public void onHint(string text)

@ -54,51 +54,47 @@ public class SaveImage : MonoBehaviour
return;
}
string id = parmas[0].Trim();
string summary = parmas[1].Trim();
string password = parmas.Length > 2 ? parmas[2].Trim() : string.Empty;
string uploadDest=parmas[0].Trim();
string id = parmas[1].Trim();
string summary = parmas[2].Trim();
string filename = parmas.Length > 3 ? parmas[3].Trim() : string.Empty;
TextNumber.text = id;
TextSummary.text = summary;
string filename = $"{password}_{id}.png"; // Use the ID as the filename
if (string.IsNullOrEmpty(filename))
{
Debug.LogError("Filename cannot be null or empty.");
return;
}
Debug.Log("Saving image to: " + filename + " with password: " + password);
Debug.Log("Saving image to: " + uploadDest + " filename=" + filename+ " id=" + id);
string timestamp = System.DateTime.Now.ToString("yyyyMMdd");
if (!System.IO.Directory.Exists(OutputFolder + "/print/" + timestamp))
{
System.IO.Directory.CreateDirectory(OutputFolder + "/print/" + timestamp);
}
if (!System.IO.Directory.Exists(OutputFolder + "/share/" + timestamp))
if (!System.IO.Directory.Exists(OutputFolder+"/" + uploadDest))
{
System.IO.Directory.CreateDirectory(OutputFolder + "/share/" + timestamp);
System.IO.Directory.CreateDirectory(OutputFolder+"/" + uploadDest);
}
SaveRenderTextureToPNG(renderTexture_postcard, System.IO.Path.Combine(OutputFolder + "/print/" + timestamp, filename));
SaveRenderTextureToPNG(renderTexture_postcard, System.IO.Path.Combine(OutputFolder+"/" + uploadDest, filename + "_print.png"));
Debug.Log("Image saved to " + filename);
SaveRenderTextureToPNG(renderTexture_share, System.IO.Path.Combine(OutputFolder + "/share/" + timestamp, filename));
SaveRenderTextureToPNG(renderTexture_share, System.IO.Path.Combine(OutputFolder+"/" + uploadDest, filename + ".png"));
Debug.Log("Image saved to " + filename);
// Optionally, you can also log the full path
string print_fullPath = System.IO.Path.Combine(OutputFolder + "/print/" + timestamp + "/", filename);
string print_fullPath = System.IO.Path.Combine(OutputFolder+"/" + uploadDest + "/", filename + "_print.png");
Debug.Log("print_path: " + print_fullPath);
upload(id, print_fullPath, "print");
upload(print_fullPath, id, "print");
string share_fullPath = System.IO.Path.Combine(OutputFolder + "/share/" + timestamp + "/", filename);
string share_fullPath = System.IO.Path.Combine(OutputFolder+"/" + uploadDest + "/", filename + ".png");
Debug.Log("share_path: " + share_fullPath);
upload(id, share_fullPath, "share");
upload(share_fullPath, id, "share");
}
void SaveRenderTextureToPNG(RenderTexture rt, string filePath)
@ -119,7 +115,7 @@ public class SaveImage : MonoBehaviour
Destroy(tex);
}
void upload(string id, string filename, string type)
void upload(string filename, string id, string type)
{
if (uploader != null)
{
@ -129,8 +125,8 @@ public class SaveImage : MonoBehaviour
{
Debug.Log("Upload successful: " + response.message);
if(type=="print") writeToFirebase("prints", id, response.message, type);
writeToFirebase("records", id, response.message, type);
if(type=="print") writeToFirebase("prints", System.DateTime.Now.ToString("yyyyMMdd_hhmmss"), response.message, type);
writeToFirebase("records","user/"+id+"/file/"+type, response.message, type);
}
else
{
@ -146,7 +142,7 @@ public class SaveImage : MonoBehaviour
public void writeToFirebase(string collection, string id, string url, string type)
{
Debug.Log("Writing to Firebase: " + id);
Debug.Log("Writing to Firebase: " + collection + "/" + id);
StartCoroutine(WriteToFirebaseCoroutine(id, url));
IEnumerator WriteToFirebaseCoroutine(string id, string url)

@ -14,8 +14,8 @@ RenderTexture:
m_DownscaleFallback: 0
m_IsAlphaChannelOptional: 0
serializedVersion: 5
m_Width: 1241
m_Height: 1754
m_Width: 1080
m_Height: 1920
m_AntiAliasing: 1
m_MipCount: -1
m_DepthStencilFormat: 94

Loading…
Cancel
Save