From a90dce06f39fd0e46ba59dc6b0b439a96a293ce5 Mon Sep 17 00:00:00 2001 From: xiongliji <543978819@qq.com> Date: Mon, 21 Jul 2025 22:14:06 +0800 Subject: [PATCH] update --- assets/Scenes/test.scene | 1178 ++++++++++++++--- assets/Scripts/test/ChatContentsLayout.ts | 54 + .../Scripts/test/ChatContentsLayout.ts.meta | 9 + assets/Scripts/test/ChatGPTService.ts | 30 +- assets/Scripts/test/DemoData.ts | 21 + assets/Scripts/test/DemoData.ts.meta | 9 + assets/Scripts/test/DemoManager.ts | 25 + assets/Scripts/test/DemoManager.ts.meta | 9 + assets/Scripts/test/DialogBubble.ts | 23 + assets/Scripts/test/DialogBubble.ts.meta | 9 + assets/Scripts/test/index.ts | 0 assets/Scripts/test/index.ts.meta | 9 + assets/Scripts/test/system_prompt.txt | 0 assets/Scripts/test/system_prompt.txt.meta | 11 + settings/v2/packages/cocos-service.json | 4 +- settings/v2/packages/information.json | 12 +- 16 files changed, 1229 insertions(+), 174 deletions(-) create mode 100644 assets/Scripts/test/ChatContentsLayout.ts create mode 100644 assets/Scripts/test/ChatContentsLayout.ts.meta create mode 100644 assets/Scripts/test/DemoData.ts create mode 100644 assets/Scripts/test/DemoData.ts.meta create mode 100644 assets/Scripts/test/DemoManager.ts create mode 100644 assets/Scripts/test/DemoManager.ts.meta create mode 100644 assets/Scripts/test/DialogBubble.ts create mode 100644 assets/Scripts/test/DialogBubble.ts.meta create mode 100644 assets/Scripts/test/index.ts create mode 100644 assets/Scripts/test/index.ts.meta create mode 100644 assets/Scripts/test/system_prompt.txt create mode 100644 assets/Scripts/test/system_prompt.txt.meta diff --git a/assets/Scenes/test.scene b/assets/Scenes/test.scene index a7fa27ab..d451bc4b 100644 --- a/assets/Scenes/test.scene +++ b/assets/Scenes/test.scene @@ -52,7 +52,7 @@ }, "autoReleaseAssets": false, "_globals": { - "__id__": 38 + "__id__": 63 }, "_id": "11f821b7-0408-4ecd-a1e3-b380e01cf759" }, @@ -79,21 +79,33 @@ }, { "__id__": 27 + }, + { + "__id__": 31 + }, + { + "__id__": 38 + }, + { + "__id__": 49 } ], "_active": true, "_components": [ { - "__id__": 34 + "__id__": 59 }, { - "__id__": 35 + "__id__": 60 + }, + { + "__id__": 61 + }, + { + "__id__": 62 }, { "__id__": 36 - }, - { - "__id__": 37 } ], "_prefab": null, @@ -1108,21 +1120,17 @@ "_parent": { "__id__": 2 }, - "_children": [ - { - "__id__": 28 - } - ], + "_children": [], "_active": true, "_components": [ { - "__id__": 31 + "__id__": 28 }, { - "__id__": 32 + "__id__": 29 }, { - "__id__": 33 + "__id__": 30 } ], "_prefab": null, @@ -1155,138 +1163,6 @@ }, "_id": "f96sah7PJJDqDVpo+AehBS" }, - { - "__type__": "cc.Node", - "_name": "Reply", - "_objFlags": 0, - "__editorExtras__": {}, - "_parent": { - "__id__": 27 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 29 - }, - { - "__id__": 30 - } - ], - "_prefab": null, - "_lpos": { - "__type__": "cc.Vec3", - "x": 0, - "y": 3.923999999999978, - "z": 0 - }, - "_lrot": { - "__type__": "cc.Quat", - "x": 0, - "y": 0, - "z": 0, - "w": 1 - }, - "_lscale": { - "__type__": "cc.Vec3", - "x": 1, - "y": 1, - "z": 1 - }, - "_mobility": 0, - "_layer": 33554432, - "_euler": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_id": "b8JbaoFoBDwJ26PgSZAmTs" - }, - { - "__type__": "cc.UITransform", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 28 - }, - "_enabled": true, - "__prefab": null, - "_contentSize": { - "__type__": "cc.Size", - "width": 670.3, - "height": 50.4 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_id": "3fDCsV34VLkJRdSip79ECO" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "__editorExtras__": {}, - "node": { - "__id__": 28 - }, - "_enabled": true, - "__prefab": null, - "_customMaterial": null, - "_srcBlendFactor": 2, - "_dstBlendFactor": 4, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_string": "...", - "_horizontalAlign": 0, - "_verticalAlign": 1, - "_actualFontSize": 20, - "_fontSize": 20, - "_fontFamily": "NotoSans-Regular", - "_lineHeight": 40, - "_overflow": 3, - "_enableWrapText": true, - "_font": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_isItalic": false, - "_isBold": false, - "_isUnderline": false, - "_underlineHeight": 2, - "_cacheMode": 0, - "_enableOutline": false, - "_outlineColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_outlineWidth": 2, - "_enableShadow": false, - "_shadowColor": { - "__type__": "cc.Color", - "r": 0, - "g": 0, - "b": 0, - "a": 255 - }, - "_shadowOffset": { - "__type__": "cc.Vec2", - "x": 2, - "y": 2 - }, - "_shadowBlur": 2, - "_id": "falQdr/A5IH6s/azmK7CnT" - }, { "__type__": "cc.UITransform", "_name": "", @@ -1378,6 +1254,994 @@ "_lockFlags": 0, "_id": "4fW+L8YvtP6Yzcff5mqBd9" }, + { + "__type__": "cc.Node", + "_name": "BubbleBox", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 32 + }, + { + "__id__": 33 + }, + { + "__id__": 34 + }, + { + "__id__": 35 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 0, + "y": 44.75, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "2aIterK+5G9YunKzwxpTT1" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 31 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 720, + "height": 969.5 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "4fXLe8yUpDM4bAWZI/pFFb" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 31 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "17LRimjWJMGbznwcuae7h3" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 31 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 45, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 110.5, + "_bottom": 200, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 100, + "_originalHeight": 100, + "_alignMode": 2, + "_lockFlags": 5, + "_id": "656qjl88hF8Yq1mVI3JWU8" + }, + { + "__type__": "3f083uxM8tOh5OpfBIPOqDm", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 31 + }, + "_enabled": true, + "__prefab": null, + "manager": { + "__id__": 36 + }, + "lBubble": { + "__id__": 37 + }, + "rBubble": { + "__id__": 48 + }, + "_id": "44ymZ3jMRKQLsoK6blU18g" + }, + { + "__type__": "1bbb6ZFGGhLRpMqwp+7n/D8", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 2 + }, + "_enabled": true, + "__prefab": null, + "_id": "cdwiH3TZxAv4zsLbU6zlUv" + }, + { + "__type__": "174d8WN3QRCg7wgPa7/k8UY", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 38 + }, + "_enabled": true, + "__prefab": null, + "bg": { + "__id__": 40 + }, + "content": { + "__id__": 45 + }, + "contentT": { + "__id__": 44 + }, + "_id": "810lL2T5ZN/aZna9sQzVDb" + }, + { + "__type__": "cc.Node", + "_name": "DialogBubble_Left", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 39 + }, + { + "__id__": 43 + } + ], + "_active": true, + "_components": [ + { + "__id__": 47 + }, + { + "__id__": 37 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -253.362, + "y": -301.604, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "08+BB6c/hH2oNjjIHdNHy3" + }, + { + "__type__": "cc.Node", + "_name": "SpriteSplash", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 38 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 40 + }, + { + "__id__": 41 + }, + { + "__id__": 42 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 200, + "y": -32.599999999999994, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "19LPoJwiRJJpZnoSqzkc8t" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 500, + "height": 165.2 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "94tFNRys5K862zE/WyD9Pr" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 206, + "g": 206, + "b": 206, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "e7V1hrWUBJC4WnYMgNMt0f" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 39 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 9, + "_target": null, + "_left": 0, + "_right": -200, + "_top": 0, + "_bottom": -26.900000000000002, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 500, + "_originalHeight": 153.8, + "_alignMode": 1, + "_lockFlags": 9, + "_id": "5cxgLffd5Gu4SaVXQJetRY" + }, + { + "__type__": "cc.Node", + "_name": "content", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 38 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 44 + }, + { + "__id__": 45 + }, + { + "__id__": 46 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 185, + "y": -39.584999999999994, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "7a22EibORGbKwijps+1ONE" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 43 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 450, + "height": 159.17 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "5dsk1tdN1B1ZgrCJdPbYVf" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 43 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "LKSDJLKASJDAUBSDJLKSDJLKLKSDJLKASJDAUBSDJLKSDJLKLKSDJLKASJDAUBSDJLKSDJLKLKSDJLKASJDAUBSDJLKSDJLKLKSDJLKASJDAUBSDJLKSDJLK", + "_horizontalAlign": 0, + "_verticalAlign": 0, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "NotoSans-Regular", + "_lineHeight": 29.5, + "_overflow": 3, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "efDAh1bWVOe5fh0yuoEjC9" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 43 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 9, + "_target": null, + "_left": 10, + "_right": 0, + "_top": 10, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 1, + "_lockFlags": 9, + "_id": "b2Gh4LKMtAd5NBaQ/HC958" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 38 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "15yyp72dlNn7zwdBZ1/9ne" + }, + { + "__type__": "174d8WN3QRCg7wgPa7/k8UY", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 49 + }, + "_enabled": true, + "__prefab": null, + "bg": { + "__id__": 51 + }, + "content": { + "__id__": 56 + }, + "contentT": { + "__id__": 55 + }, + "_id": "37bwmiBgtGTZTFxJbaG7Fc" + }, + { + "__type__": "cc.Node", + "_name": "DialogBubble_Right", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 2 + }, + "_children": [ + { + "__id__": 50 + }, + { + "__id__": 54 + } + ], + "_active": true, + "_components": [ + { + "__id__": 58 + }, + { + "__id__": 48 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": 253.36199999999997, + "y": -142.43200000000002, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "301RLi5GRBiY2t05gK6kEg" + }, + { + "__type__": "cc.Node", + "_name": "SpriteSplash", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 49 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 51 + }, + { + "__id__": 52 + }, + { + "__id__": 53 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -200, + "y": 4, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "e4aSGHBJ5DA4pNTqVf2vq4" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 50 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 500, + "height": 92 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "00eR5SUm5BJZv67XQiGSIB" + }, + { + "__type__": "cc.Sprite", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 50 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 206, + "g": 206, + "b": 206, + "a": 255 + }, + "_spriteFrame": { + "__uuid__": "7d8f9b89-4fd1-4c9f-a3ab-38ec7cded7ca@f9941", + "__expectedType__": "cc.SpriteFrame" + }, + "_type": 0, + "_fillType": 0, + "_sizeMode": 0, + "_fillCenter": { + "__type__": "cc.Vec2", + "x": 0, + "y": 0 + }, + "_fillStart": 0, + "_fillRange": 0, + "_isTrimmedMode": true, + "_useGrayscale": false, + "_atlas": null, + "_id": "48qPQU9fRMBoW6FWKb3iKp" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 50 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 33, + "_target": null, + "_left": 0, + "_right": 0, + "_top": 0, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 0, + "_originalHeight": 0, + "_alignMode": 1, + "_lockFlags": 41, + "_id": "f4WgyqI2RNiYp8oDObTY52" + }, + { + "__type__": "cc.Node", + "_name": "content", + "_objFlags": 0, + "__editorExtras__": {}, + "_parent": { + "__id__": 49 + }, + "_children": [], + "_active": true, + "_components": [ + { + "__id__": 55 + }, + { + "__id__": 56 + }, + { + "__id__": 57 + } + ], + "_prefab": null, + "_lpos": { + "__type__": "cc.Vec3", + "x": -185, + "y": -69.085, + "z": 0 + }, + "_lrot": { + "__type__": "cc.Quat", + "x": 0, + "y": 0, + "z": 0, + "w": 1 + }, + "_lscale": { + "__type__": "cc.Vec3", + "x": 1, + "y": 1, + "z": 1 + }, + "_mobility": 0, + "_layer": 33554432, + "_euler": { + "__type__": "cc.Vec3", + "x": 0, + "y": 0, + "z": 0 + }, + "_id": "0fBOLXBFdGPKis9YN6B6I/" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 54 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 450, + "height": 218.17 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "aaz8b3GAlB4490UD5nT49X" + }, + { + "__type__": "cc.Label", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 54 + }, + "_enabled": true, + "__prefab": null, + "_customMaterial": null, + "_srcBlendFactor": 2, + "_dstBlendFactor": 4, + "_color": { + "__type__": "cc.Color", + "r": 255, + "g": 255, + "b": 255, + "a": 255 + }, + "_string": "LKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJLKSDJLKASJDAUBSDJ", + "_horizontalAlign": 0, + "_verticalAlign": 0, + "_actualFontSize": 30, + "_fontSize": 30, + "_fontFamily": "NotoSans-Regular", + "_lineHeight": 29.5, + "_overflow": 3, + "_enableWrapText": true, + "_font": null, + "_isSystemFontUsed": true, + "_spacingX": 0, + "_isItalic": false, + "_isBold": false, + "_isUnderline": false, + "_underlineHeight": 2, + "_cacheMode": 0, + "_enableOutline": true, + "_outlineColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_outlineWidth": 2, + "_enableShadow": false, + "_shadowColor": { + "__type__": "cc.Color", + "r": 0, + "g": 0, + "b": 0, + "a": 255 + }, + "_shadowOffset": { + "__type__": "cc.Vec2", + "x": 2, + "y": 2 + }, + "_shadowBlur": 2, + "_id": "deg2290XpMV4XIP3iyKBLC" + }, + { + "__type__": "cc.Widget", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 54 + }, + "_enabled": true, + "__prefab": null, + "_alignFlags": 33, + "_target": null, + "_left": 10, + "_right": 10, + "_top": 10, + "_bottom": 0, + "_horizontalCenter": 0, + "_verticalCenter": 0, + "_isAbsLeft": true, + "_isAbsRight": true, + "_isAbsTop": true, + "_isAbsBottom": true, + "_isAbsHorizontalCenter": true, + "_isAbsVerticalCenter": true, + "_originalWidth": 450, + "_originalHeight": 0, + "_alignMode": 1, + "_lockFlags": 9, + "_id": "38bb+Nkk1BRL9HJ4ME4T17" + }, + { + "__type__": "cc.UITransform", + "_name": "", + "_objFlags": 0, + "__editorExtras__": {}, + "node": { + "__id__": 49 + }, + "_enabled": true, + "__prefab": null, + "_contentSize": { + "__type__": "cc.Size", + "width": 100, + "height": 100 + }, + "_anchorPoint": { + "__type__": "cc.Vec2", + "x": 0.5, + "y": 0.5 + }, + "_id": "7dh2+BsyxJ9JnW6N3juMQ2" + }, { "__type__": "cc.UITransform", "_name": "", @@ -1456,39 +2320,39 @@ }, "_enabled": true, "__prefab": null, + "manager": { + "__id__": 36 + }, "editBox": { "__id__": 18 }, - "reply": { - "__id__": 30 - }, "_id": "695K83XBJE/IaXNPNw93lE" }, { "__type__": "cc.SceneGlobals", "ambient": { - "__id__": 39 + "__id__": 64 }, "shadows": { - "__id__": 40 + "__id__": 65 }, "_skybox": { - "__id__": 41 + "__id__": 66 }, "fog": { - "__id__": 42 + "__id__": 67 }, "octree": { - "__id__": 43 + "__id__": 68 }, "skin": { - "__id__": 44 + "__id__": 69 }, "lightProbeInfo": { - "__id__": 45 + "__id__": 70 }, "postSettings": { - "__id__": 46 + "__id__": 71 }, "bakedWithStationaryMainLight": false, "bakedWithHighpLightmap": false diff --git a/assets/Scripts/test/ChatContentsLayout.ts b/assets/Scripts/test/ChatContentsLayout.ts new file mode 100644 index 00000000..8c7c258e --- /dev/null +++ b/assets/Scripts/test/ChatContentsLayout.ts @@ -0,0 +1,54 @@ +import { _decorator, Component, instantiate, Node, Vec3 } from "cc"; +import { DemoManager } from "./DemoManager"; +import { DialogBubble } from "./DialogBubble"; +import { Dialog } from "./DemoData"; +const { ccclass, property } = _decorator; + +const BUTTOM_Y = -346.354; + +@ccclass("ChatContentsLayout") +export class ChatContentsLayout extends Component { + @property(DemoManager) + manager: DemoManager = null; + + @property(DialogBubble) + lBubble: DialogBubble = null; + @property(DialogBubble) + rBubble: DialogBubble = null; + + bubbles: DialogBubble[] = []; + + protected start(): void { + this.lBubble.node.active = false; + this.rBubble.node.active = false; + this.manager.layoutout = this; + } + + UpdateDialog(dialogs: Dialog[]) { + //if (!this.bubbles) this.bubbles = []; + for (let i = this.bubbles.length - 1; i >= 0; i--) { + if (this.bubbles[i].node) { + this.bubbles[i].node.destroy(); + } + } + this.bubbles = []; + let initPosY: number = BUTTOM_Y; + for (let i = dialogs.length - 1; i >= 0; i--) { + const dialog = dialogs[i]; //倒序 + + let newBubbleNode = dialog.isPlayer + ? instantiate(this.rBubble.node) + : instantiate(this.lBubble.node); + let newBubble = newBubbleNode.getComponent(DialogBubble); + + newBubbleNode.setParent(this.node); + newBubble.node.active = true; + let pos = newBubble.node.position; + newBubble.node.position = new Vec3(pos.x, initPosY, pos.z); + + let offset = newBubble.updateBubbleContent(dialog.content); + initPosY += offset + 40; + this.bubbles.push(newBubble); + } + } +} diff --git a/assets/Scripts/test/ChatContentsLayout.ts.meta b/assets/Scripts/test/ChatContentsLayout.ts.meta new file mode 100644 index 00000000..769eef1b --- /dev/null +++ b/assets/Scripts/test/ChatContentsLayout.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "3f083bb1-33cb-4e87-93a9-7c120f3aa0e6", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/ChatGPTService.ts b/assets/Scripts/test/ChatGPTService.ts index c66a399a..ef9e9857 100644 --- a/assets/Scripts/test/ChatGPTService.ts +++ b/assets/Scripts/test/ChatGPTService.ts @@ -1,13 +1,15 @@ import { _decorator, Component, EditBox, Label, Node } from "cc"; import { l10n } from "db://localization-editor/l10n"; +import { DemoManager } from "./DemoManager"; const { ccclass, property } = _decorator; @ccclass("ChatGPTService") export class ChatGPTService extends Component { + @property(DemoManager) + manager: DemoManager = null; + @property(EditBox) editBox: EditBox = null; - @property(Label) - reply: Label = null; private apiurl: string = "https://cloud.fastgpt.cn/api/v1/chat/completions"; private apikey: string = @@ -36,25 +38,35 @@ export class ChatGPTService extends Component { } protected async start(): Promise { - console.log(l10n.t("hello")); - l10n.changeLanguage("zh-Hans-CN"); - console.log(l10n.t("hello")); - l10n.changeLanguage("en"); - console.log(l10n.t("hello")); + // console.log(l10n.t("hello")); + // l10n.changeLanguage("zh-Hans-CN"); + // console.log(l10n.t("hello")); + // l10n.changeLanguage("en"); + // console.log(l10n.t("hello")); } public async OnClickSend() { const str = this.editBox.string; if (!str || str == "") return; console.log("post:" + str); + + if (this.manager) { + this.manager.updateDialog(true, str); + } + let ret = await this.Post({ model: "llama3.1:8b", messages: [{ role: "user", content: str }], - temperature: 0.0, + temperature: 0.8, }); const rep = ret.choices[0].message.content; - this.reply.string = rep; + if (rep == null) { + console.warn("rep null"); + } + if (this.manager) { + this.manager.updateDialog(false, rep); + } console.log("ret:" + rep); } } diff --git a/assets/Scripts/test/DemoData.ts b/assets/Scripts/test/DemoData.ts new file mode 100644 index 00000000..ca5204d8 --- /dev/null +++ b/assets/Scripts/test/DemoData.ts @@ -0,0 +1,21 @@ +export interface Dialog { + isPlayer: boolean; + content: string; +} + +export class DemoData { + public Dialogs: Dialog[] = []; + + public cleanDialog() { + this.Dialogs = []; + } + + public pushDialog(isPlayer: boolean, str: string) { + if (!this.Dialogs) this.Dialogs = []; + this.Dialogs.push({ isPlayer: isPlayer, content: str }); + } + + public GetDialogs() { + return this.Dialogs; + } +} diff --git a/assets/Scripts/test/DemoData.ts.meta b/assets/Scripts/test/DemoData.ts.meta new file mode 100644 index 00000000..4fbb19f0 --- /dev/null +++ b/assets/Scripts/test/DemoData.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "830fbab3-0034-468c-9c91-754a8c7e4088", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/DemoManager.ts b/assets/Scripts/test/DemoManager.ts new file mode 100644 index 00000000..bf92e7a9 --- /dev/null +++ b/assets/Scripts/test/DemoManager.ts @@ -0,0 +1,25 @@ +import { _decorator, Component, Node } from "cc"; +import { DemoData, Dialog } from "./DemoData"; +import { ChatContentsLayout } from "./ChatContentsLayout"; +const { ccclass, property } = _decorator; + +@ccclass("DemoManager") +export class DemoManager extends Component { + demoData: DemoData; + + public layoutout: ChatContentsLayout; + + start() { + this.demoData = new DemoData(); + } + + public updateDialog(isPlayer: boolean, str: string) { + this.demoData.pushDialog(isPlayer, str); + console.log("update dialog"); + this.layoutout.UpdateDialog(this.getDialogs()); + } + + public getDialogs() { + return this.demoData.GetDialogs(); + } +} diff --git a/assets/Scripts/test/DemoManager.ts.meta b/assets/Scripts/test/DemoManager.ts.meta new file mode 100644 index 00000000..7d9fae22 --- /dev/null +++ b/assets/Scripts/test/DemoManager.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "1bbb6645-1868-4b46-932a-c29fbb9ff0fc", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/DialogBubble.ts b/assets/Scripts/test/DialogBubble.ts new file mode 100644 index 00000000..56620a9b --- /dev/null +++ b/assets/Scripts/test/DialogBubble.ts @@ -0,0 +1,23 @@ +import { _decorator, Component, Label, Node, Size, UITransform } from "cc"; +const { ccclass, property } = _decorator; + +@ccclass("DialogBubble") +export class DialogBubble extends Component { + @property(UITransform) + bg: UITransform = null; + @property(Label) + content: Label = null; + @property(UITransform) + contentT: UITransform = null; + + updateBubbleContent(str: string) { + this.content.string = str; + this.content.updateRenderData(); + + this.bg.setContentSize( + new Size(this.contentT.contentSize.x + 5, this.contentT.contentSize.y + 5) + ); + + return this.bg.contentSize.y / 2; + } +} diff --git a/assets/Scripts/test/DialogBubble.ts.meta b/assets/Scripts/test/DialogBubble.ts.meta new file mode 100644 index 00000000..37bb9353 --- /dev/null +++ b/assets/Scripts/test/DialogBubble.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "174d858d-dd04-4283-bc20-3daeff93c518", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/index.ts b/assets/Scripts/test/index.ts new file mode 100644 index 00000000..e69de29b diff --git a/assets/Scripts/test/index.ts.meta b/assets/Scripts/test/index.ts.meta new file mode 100644 index 00000000..bb4e0932 --- /dev/null +++ b/assets/Scripts/test/index.ts.meta @@ -0,0 +1,9 @@ +{ + "ver": "4.0.24", + "importer": "typescript", + "imported": true, + "uuid": "eb853b2f-d932-485d-b928-8de811c83ae8", + "files": [], + "subMetas": {}, + "userData": {} +} diff --git a/assets/Scripts/test/system_prompt.txt b/assets/Scripts/test/system_prompt.txt new file mode 100644 index 00000000..e69de29b diff --git a/assets/Scripts/test/system_prompt.txt.meta b/assets/Scripts/test/system_prompt.txt.meta new file mode 100644 index 00000000..910bdc08 --- /dev/null +++ b/assets/Scripts/test/system_prompt.txt.meta @@ -0,0 +1,11 @@ +{ + "ver": "1.0.1", + "importer": "text", + "imported": true, + "uuid": "0751a71b-f7fc-4905-af59-24965a4e0921", + "files": [ + ".json" + ], + "subMetas": {}, + "userData": {} +} diff --git a/settings/v2/packages/cocos-service.json b/settings/v2/packages/cocos-service.json index 60459241..f7dec085 100644 --- a/settings/v2/packages/cocos-service.json +++ b/settings/v2/packages/cocos-service.json @@ -1,7 +1,7 @@ { - "__version__": "3.0.5", + "__version__": "3.0.7", "game": { - "name": "未知游戏", + "name": "UNKNOW GAME", "app_id": "UNKNOW", "c_id": "0" }, diff --git a/settings/v2/packages/information.json b/settings/v2/packages/information.json index 535a5601..94848dec 100644 --- a/settings/v2/packages/information.json +++ b/settings/v2/packages/information.json @@ -4,19 +4,19 @@ "customSplash": { "id": "customSplash", "label": "customSplash", - "enable": true, + "enable": false, "customSplash": { - "complete": true, - "form": "https://creator-api.cocos.com/api/form/show?sid=05d2919f40e0134fd62411d578aed4d8" + "complete": false, + "form": "https://creator-api.cocos.com/api/form/show?" } }, "removeSplash": { "id": "removeSplash", "label": "removeSplash", - "enable": true, + "enable": false, "removeSplash": { - "complete": true, - "form": "https://creator-api.cocos.com/api/form/show?sid=05d2919f40e0134fd62411d578aed4d8" + "complete": false, + "form": "https://creator-api.cocos.com/api/form/show?" } } }