main
reng 4 months ago
parent b052b323c9
commit 84f418a149
  1. 8
      Assets/Fonts.meta
  2. 1083
      Assets/Fonts/NotoSansTC-Regular SDF.asset
  3. 8
      Assets/Fonts/NotoSansTC-Regular SDF.asset.meta
  4. BIN
      Assets/Fonts/NotoSansTC-Regular.ttf
  5. 21
      Assets/Fonts/NotoSansTC-Regular.ttf.meta
  6. 1337
      Assets/Fonts/NotoSerifTC-Regular SDF.asset
  7. 8
      Assets/Fonts/NotoSerifTC-Regular SDF.asset.meta
  8. BIN
      Assets/Fonts/NotoSerifTC-Regular.ttf
  9. 21
      Assets/Fonts/NotoSerifTC-Regular.ttf.meta
  10. 149
      Assets/Scenes/SampleScene.unity
  11. 13
      Assets/Scripts/OscHandler.cs
  12. 59
      Assets/Scripts/SaveImage.cs

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

File diff suppressed because one or more lines are too long

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

@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 7fd1cf3633665b347b24f96c86d830b7
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Noto Sans TC
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because one or more lines are too long

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

@ -0,0 +1,21 @@
fileFormatVersion: 2
guid: 7b0530570b1488c4c8bf0c47083b3d47
TrueTypeFontImporter:
externalObjects: {}
serializedVersion: 4
fontSize: 16
forceTextureCase: -2
characterSpacing: 0
characterPadding: 1
includeFontData: 1
fontNames:
- Noto Serif TC
fallbackFontReferences: []
customCharacters:
fontRenderingMode: 0
ascentCalculationMode: 1
useLegacyBoundsCalculation: 0
shouldRoundAdvanceValue: 1
userData:
assetBundleName:
assetBundleVariant:

@ -488,6 +488,7 @@ MonoBehaviour:
hint: {fileID: 2028163027} hint: {fileID: 2028163027}
stepText: {fileID: 1988834086} stepText: {fileID: 1988834086}
hintforChat: {fileID: 585829000} hintforChat: {fileID: 585829000}
hintforStep: {fileID: 0}
--- !u!114 &283408163 --- !u!114 &283408163
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -894,8 +895,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 90.75, y: 0} m_AnchoredPosition: {x: 98.5, y: 0}
m_SizeDelta: {x: 181.5, y: 0} m_SizeDelta: {x: 197, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &366298495 --- !u!114 &366298495
MonoBehaviour: MonoBehaviour:
@ -1037,8 +1038,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 1} m_AnchorMin: {x: 0, y: 1}
m_AnchorMax: {x: 0, y: 1} m_AnchorMax: {x: 0, y: 1}
m_AnchoredPosition: {x: 650.2857, y: -181.5} m_AnchoredPosition: {x: 775.4286, y: -197}
m_SizeDelta: {x: 213.42857, y: 0} m_SizeDelta: {x: 255.14287, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &428712011 --- !u!114 &428712011
MonoBehaviour: MonoBehaviour:
@ -2590,6 +2591,7 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 585828999} - component: {fileID: 585828999}
- component: {fileID: 585829000} - component: {fileID: 585829000}
- component: {fileID: 585829001}
m_Layer: 5 m_Layer: 5
m_Name: Hint-chat m_Name: Hint-chat
m_TagString: Untagged m_TagString: Untagged
@ -2609,14 +2611,14 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1255800683}
- {fileID: 1638762747} - {fileID: 1638762747}
- {fileID: 1255800683}
m_Father: {fileID: 1786403752} m_Father: {fileID: 1786403752}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0.5, y: 0.5} m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 173}
m_SizeDelta: {x: 100, y: 100} m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &585829000 --- !u!225 &585829000
CanvasGroup: CanvasGroup:
@ -2630,6 +2632,81 @@ CanvasGroup:
m_Interactable: 1 m_Interactable: 1
m_BlocksRaycasts: 1 m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0 m_IgnoreParentGroups: 0
--- !u!114 &585829001
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 585828998}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 30649d3a9faa99c48a7b1166b86bf2a0, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Padding:
m_Left: 0
m_Right: 0
m_Top: 0
m_Bottom: 0
m_ChildAlignment: 7
m_Spacing: 40
m_ChildForceExpandWidth: 0
m_ChildForceExpandHeight: 0
m_ChildControlWidth: 0
m_ChildControlHeight: 0
m_ChildScaleWidth: 0
m_ChildScaleHeight: 0
m_ReverseArrangement: 0
--- !u!1 &611584130
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 611584131}
- component: {fileID: 611584132}
m_Layer: 5
m_Name: Hint-steps
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &611584131
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 611584130}
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:
- {fileID: 1988834085}
m_Father: {fileID: 1786403752}
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: -349, y: 353}
m_SizeDelta: {x: 0, y: 60}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!225 &611584132
CanvasGroup:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 611584130}
m_Enabled: 1
m_Alpha: 1
m_Interactable: 1
m_BlocksRaycasts: 1
m_IgnoreParentGroups: 0
--- !u!1 &630451396 --- !u!1 &630451396
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -3127,8 +3204,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 133.39285, y: 0} m_AnchoredPosition: {x: 159.4643, y: 0}
m_SizeDelta: {x: 181.5, y: 0} m_SizeDelta: {x: 197, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &830016229 --- !u!114 &830016229
MonoBehaviour: MonoBehaviour:
@ -3699,8 +3776,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 90.75, y: 0} m_AnchoredPosition: {x: 98.5, y: 0}
m_SizeDelta: {x: 181.5, y: 0} m_SizeDelta: {x: 197, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1060364296 --- !u!114 &1060364296
MonoBehaviour: MonoBehaviour:
@ -4129,7 +4206,7 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
_connection: {fileID: 11400000, guid: 403214990dd9b8f499d3a894e1575167, type: 2} _connection: {fileID: 11400000, guid: 403214990dd9b8f499d3a894e1575167, type: 2}
_oscAddress: /save _oscAddress: /export
_dataType: 3 _dataType: 3
_event: _event:
m_PersistentCalls: m_PersistentCalls:
@ -4195,11 +4272,12 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uploader: {fileID: 1146279349} uploader: {fileID: 1146279349}
renderTexture: {fileID: 8400000, guid: 35e8ac38ef95d18419a5a58ab9299adf, type: 2} renderTexture_postcard: {fileID: 8400000, guid: 35e8ac38ef95d18419a5a58ab9299adf, type: 2}
renderTexture_share: {fileID: 8400000, guid: 91633495c7c9dd040b09afd52966b6d4, type: 2}
OutputFolder: output OutputFolder: output
FirebaseUrl: https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/ FirebaseUrl: https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/
TextNumber: {fileID: 1020432302} TextNumber: {fileID: 1020432302}
TextSummary: {fileID: 225567322} TextSummary: {fileID: 630451399}
--- !u!1 &1255800682 --- !u!1 &1255800682
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -4234,9 +4312,9 @@ RectTransform:
- {fileID: 555167254} - {fileID: 555167254}
m_Father: {fileID: 585828999} m_Father: {fileID: 585828999}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 439.9999, y: 75.000046} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 70, y: 70} m_SizeDelta: {x: 70, y: 70}
m_Pivot: {x: 1, y: 0} m_Pivot: {x: 1, y: 0}
--- !u!114 &1255800684 --- !u!114 &1255800684
@ -4900,8 +4978,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: "\u7B49\u6211\u4E00\u4E0B,\n\u63DB\u6211\u8AAA\u56C9" m_text: "\u7B49\u6211\u4E00\u4E0B,\n\u63DB\u6211\u8AAA\u56C9"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2} m_fontAsset: {fileID: 11400000, guid: 7f0534057c5fa054986287e586e6a05e, type: 2}
m_sharedMaterial: {fileID: -4264381060954844368, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2} m_sharedMaterial: {fileID: -4566397573293869855, guid: 7f0534057c5fa054986287e586e6a05e, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -4991,8 +5069,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: -439.9999, y: 75.000046} m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 327.1, y: 60} m_SizeDelta: {x: 140.06, y: 70}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!1 &1688229443 --- !u!1 &1688229443
GameObject: GameObject:
@ -5116,7 +5194,7 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1988834085} - {fileID: 611584131}
- {fileID: 585828999} - {fileID: 585828999}
m_Father: {fileID: 2028163026} m_Father: {fileID: 2028163026}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -5173,8 +5251,8 @@ RectTransform:
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0} m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0} m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 405.17856, y: 0} m_AnchoredPosition: {x: 483.39288, y: 0}
m_SizeDelta: {x: 204.1875, y: 0} m_SizeDelta: {x: 221.625, y: 0}
m_Pivot: {x: 0.5, y: 0.5} m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1811530096 --- !u!114 &1811530096
MonoBehaviour: MonoBehaviour:
@ -5487,7 +5565,7 @@ MonoBehaviour:
m_OnCullStateChanged: m_OnCullStateChanged:
m_PersistentCalls: m_PersistentCalls:
m_Calls: [] m_Calls: []
m_Texture: {fileID: 0} m_Texture: {fileID: 8400000, guid: 03a5ea2ccdc34a645ae9ebab8b7f7a8d, type: 2}
m_UVRect: m_UVRect:
serializedVersion: 2 serializedVersion: 2
x: 0 x: 0
@ -5515,7 +5593,8 @@ MonoBehaviour:
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
uploader: {fileID: 0} uploader: {fileID: 0}
renderTexture: {fileID: 8400000, guid: 03a5ea2ccdc34a645ae9ebab8b7f7a8d, type: 2} renderTexture_postcard: {fileID: 0}
renderTexture_share: {fileID: 0}
OutputFolder: output OutputFolder: output
FirebaseUrl: https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/ FirebaseUrl: https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/
TextNumber: {fileID: 0} TextNumber: {fileID: 0}
@ -5566,12 +5645,12 @@ RectTransform:
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: [] m_Children: []
m_Father: {fileID: 1786403752} m_Father: {fileID: 611584131}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0.5} m_AnchorMin: {x: 0, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5} m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: 191, y: 353} m_AnchoredPosition: {x: 0.000045776367, y: 0.000030517578}
m_SizeDelta: {x: 0, y: 60} m_SizeDelta: {x: 1080, y: 60}
m_Pivot: {x: 0, y: 0} m_Pivot: {x: 0, y: 0}
--- !u!114 &1988834086 --- !u!114 &1988834086
MonoBehaviour: MonoBehaviour:
@ -5595,8 +5674,8 @@ MonoBehaviour:
m_Calls: [] m_Calls: []
m_text: "\u8F38\u5165\u5169\u4F4D\u6578\u865F\u78BC\n\u8F38\u5165\u5B8C\u6210\uFF0C\u8ACB\u6309\u4E95\u5B57\n\u53D6\u6D88\u8F38\u5165\uFF0C\u8ACB\u6309\u7C73\u5B57" m_text: "\u8F38\u5165\u5169\u4F4D\u6578\u865F\u78BC\n\u8F38\u5165\u5B8C\u6210\uFF0C\u8ACB\u6309\u4E95\u5B57\n\u53D6\u6D88\u8F38\u5165\uFF0C\u8ACB\u6309\u7C73\u5B57"
m_isRightToLeft: 0 m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2} m_fontAsset: {fileID: 11400000, guid: b25f209be0fbd2e4c834d22f2abd6b55, type: 2}
m_sharedMaterial: {fileID: -4264381060954844368, guid: 2f1ea7d7bb8b67740ae93a973eaf8fd9, type: 2} m_sharedMaterial: {fileID: -6120210280381436959, guid: b25f209be0fbd2e4c834d22f2abd6b55, type: 2}
m_fontSharedMaterials: [] m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0} m_fontMaterial: {fileID: 0}
m_fontMaterials: [] m_fontMaterials: []
@ -5620,8 +5699,8 @@ MonoBehaviour:
m_faceColor: m_faceColor:
serializedVersion: 2 serializedVersion: 2
rgba: 4294967295 rgba: 4294967295
m_fontSize: 30 m_fontSize: 40
m_fontSizeBase: 30 m_fontSizeBase: 40
m_fontWeight: 400 m_fontWeight: 400
m_enableAutoSizing: 0 m_enableAutoSizing: 0
m_fontSizeMin: 0 m_fontSizeMin: 0

@ -51,6 +51,8 @@ public class OscHandler : MonoBehaviour
[SerializeField] [SerializeField]
public CanvasGroup hintforChat; public CanvasGroup hintforChat;
[SerializeField]
public CanvasGroup hintforStep;
// Start is called before the first frame update // Start is called before the first frame update
@ -195,19 +197,23 @@ public class OscHandler : MonoBehaviour
StartCoroutine(coroutine_hint); StartCoroutine(coroutine_hint);
} }
switch (input) switch (input)
{ {
case "processing": case "processing":
statusText.text = "我想一下"; statusText.text = "我想一下";
hintforChat.alpha = 1f; hintforChat.alpha = 1f;
stepText.text = "";
break; break;
case "system": case "system":
statusText.text = "等我一下,\n換我說囉"; statusText.text = "等我一下,\n換我說囉";
hintforChat.alpha = 1f; hintforChat.alpha = 1f;
stepText.text = "";
break; break;
case "user": case "user":
statusText.text = "換你說了"; statusText.text = "換你說了";
hintforChat.alpha = 1f; hintforChat.alpha = 1f;
stepText.text = "";
break; break;
case "clear": case "clear":
statusText.text = ""; statusText.text = "";
@ -230,6 +236,11 @@ public class OscHandler : MonoBehaviour
// } // }
stepText.text = text; stepText.text = text;
if(text.Length>0) hintforChat.alpha = 0f;
StartCoroutine(FadeCanvasGroup(hintforStep, hintforStep.alpha, 1f, _hintDuration));
if (coroutine_hint != null) StopCoroutine(coroutine_hint);
coroutine_hint = FadeCanvasGroup(hint, hint.alpha, 0f, _hintDuration);
StartCoroutine(coroutine_hint);
} }
} }

@ -4,6 +4,7 @@ using UltraCombos.Upload;
using OscJack; using OscJack;
using System.Collections; using System.Collections;
using TMPro; using TMPro;
using System;
[System.Serializable] [System.Serializable]
public class S3Tag public class S3Tag
@ -18,7 +19,9 @@ public class SaveImage : MonoBehaviour
public Uploader uploader; public Uploader uploader;
public RenderTexture renderTexture; public RenderTexture renderTexture_postcard;
public RenderTexture renderTexture_share;
public string OutputFolder = "output"; public string OutputFolder = "output";
public string FirebaseUrl = "https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/"; public string FirebaseUrl = "https://firestore.googleapis.com/v1/projects/uc-24070-thegreattipsy/databases/(default)/documents/";
@ -52,37 +55,50 @@ public class SaveImage : MonoBehaviour
} }
string id = parmas[0].Trim(); string id = parmas[0].Trim();
string summary = parmas[1].Trim(); string summary = parmas[1].Trim();
string password = parmas.Length > 2 ? parmas[2].Trim() : string.Empty;
TextNumber.text = id; TextNumber.text = id;
TextSummary.text = summary; TextSummary.text = summary;
string filename = $"{id}.png"; // Use the ID as the filename
string filename = $"{password}_{id}.png"; // Use the ID as the filename
if (string.IsNullOrEmpty(filename)) if (string.IsNullOrEmpty(filename))
{ {
Debug.LogError("Filename cannot be null or empty."); Debug.LogError("Filename cannot be null or empty.");
return; return;
} }
Debug.Log("Saving image to: " + filename); Debug.Log("Saving image to: " + filename + " with password: " + password);
string timestamp = System.DateTime.Now.ToString("yyyyMMdd"); string timestamp = System.DateTime.Now.ToString("yyyyMMdd");
if (!System.IO.Directory.Exists(OutputFolder + "/" + timestamp))
if (!System.IO.Directory.Exists(OutputFolder + "/print/" + timestamp))
{ {
System.IO.Directory.CreateDirectory(OutputFolder + "/" + timestamp); System.IO.Directory.CreateDirectory(OutputFolder + "/print/" + timestamp);
} }
if (!System.IO.Directory.Exists(OutputFolder + "/share/" + timestamp))
{
System.IO.Directory.CreateDirectory(OutputFolder + "/share/" + timestamp);
}
SaveRenderTextureToPNG(renderTexture_postcard, System.IO.Path.Combine(OutputFolder + "/print/" + timestamp, filename));
Debug.Log("Image saved to " + filename);
SaveRenderTextureToPNG(renderTexture, System.IO.Path.Combine(OutputFolder + "/" + timestamp, filename)); SaveRenderTextureToPNG(renderTexture_share, System.IO.Path.Combine(OutputFolder + "/share/" + timestamp, filename));
Debug.Log("Image saved to " + filename); Debug.Log("Image saved to " + filename);
// Optionally, you can also log the full path // Optionally, you can also log the full path
string fullPath = System.IO.Path.Combine(OutputFolder + "/" + timestamp + "/", filename); string print_fullPath = System.IO.Path.Combine(OutputFolder + "/print/" + timestamp + "/", filename);
Debug.Log("path: " + fullPath); Debug.Log("print_path: " + print_fullPath);
upload(id, print_fullPath, "print");
upload(fullPath); string share_fullPath = System.IO.Path.Combine(OutputFolder + "/share/" + timestamp + "/", filename);
Debug.Log("share_path: " + share_fullPath);
upload(id, share_fullPath, "share");
} }
void SaveRenderTextureToPNG(RenderTexture rt, string filePath) void SaveRenderTextureToPNG(RenderTexture rt, string filePath)
@ -103,7 +119,7 @@ public class SaveImage : MonoBehaviour
Destroy(tex); Destroy(tex);
} }
void upload(string filename) void upload(string id, string filename, string type)
{ {
if (uploader != null) if (uploader != null)
{ {
@ -113,8 +129,8 @@ public class SaveImage : MonoBehaviour
{ {
Debug.Log("Upload successful: " + response.message); Debug.Log("Upload successful: " + response.message);
writeToFirebase("prints", filename, response.message); if(type=="print") writeToFirebase("prints", id, response.message, type);
writeToFirebase("records", filename, response.message); writeToFirebase("records", id, response.message, type);
} }
else else
{ {
@ -128,19 +144,20 @@ public class SaveImage : MonoBehaviour
} }
} }
public void writeToFirebase(string collection, string filename, string url) public void writeToFirebase(string collection, string id, string url, string type)
{ {
Debug.Log("Writing to Firebase: " + filename); Debug.Log("Writing to Firebase: " + id);
StartCoroutine(WriteToFirebaseCoroutine(filename, url)); StartCoroutine(WriteToFirebaseCoroutine(id, url));
IEnumerator WriteToFirebaseCoroutine(string filename, string url) IEnumerator WriteToFirebaseCoroutine(string id, string url)
{ {
string id=filename.Split('/')[2].Split('.')[0]; // string[] tags=filename.Split('/');
// string id=tags[tags.Length - 1].Split('.')[0];
Debug.Log("Extracted ID: " + id); Debug.Log("Extracted ID: " + id);
string firebaseUrl = FirebaseUrl + collection + "/" + id; string firebaseUrl = FirebaseUrl + collection + "/" + id;
string jsonData = "{ \"fields\": { " + string jsonData = "{ \"fields\": { " +
"\"url\": { \"stringValue\": \"" + url + "\" }, " + "\""+type+"_url\": { \"stringValue\": \"" + url + "\" }, " +
"\"timestamp\": { \"timestampValue\": \"" + System.DateTime.UtcNow.ToString("o") + "\" } " + "\"timestamp\": { \"timestampValue\": \"" + System.DateTime.UtcNow.ToString("o") + "\" } " +
"} }"; "} }";

Loading…
Cancel
Save