Commit 4104a036 authored by 罗睿卓's avatar 罗睿卓

增加快照

parent ca0686d5
This diff is collapsed.
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "2db2da00-aa4f-4fd4-b615-23e7d10a556f",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "2db2da00-aa4f-4fd4-b615-23e7d10a556f@6c48a",
"displayName": "排行榜气泡提示",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "2db2da00-aa4f-4fd4-b615-23e7d10a556f",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "2db2da00-aa4f-4fd4-b615-23e7d10a556f@f9941",
"displayName": "排行榜气泡提示",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 126,
"height": 58,
"rawWidth": 126,
"rawHeight": 58,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-63,
-29,
0,
63,
-29,
0,
-63,
29,
0,
63,
29,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
58,
126,
58,
0,
0,
126,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-63,
-29,
0
],
"maxPos": [
63,
29,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "2db2da00-aa4f-4fd4-b615-23e7d10a556f@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "2db2da00-aa4f-4fd4-b615-23e7d10a556f@6c48a"
}
}
{
"ver": "1.0.27",
"importer": "image",
"imported": true,
"uuid": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1",
"files": [
".json",
".png"
],
"subMetas": {
"6c48a": {
"importer": "texture",
"uuid": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1@6c48a",
"displayName": "黄色fudai_btn",
"id": "6c48a",
"name": "texture",
"userData": {
"wrapModeS": "clamp-to-edge",
"wrapModeT": "clamp-to-edge",
"imageUuidOrDatabaseUri": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1",
"isUuid": true,
"visible": false,
"minfilter": "linear",
"magfilter": "linear",
"mipfilter": "none",
"anisotropy": 0
},
"ver": "1.0.22",
"imported": true,
"files": [
".json"
],
"subMetas": {}
},
"f9941": {
"importer": "sprite-frame",
"uuid": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1@f9941",
"displayName": "黄色fudai_btn",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"trimType": "auto",
"trimThreshold": 1,
"rotated": false,
"offsetX": 0,
"offsetY": 0,
"trimX": 0,
"trimY": 0,
"width": 245,
"height": 280,
"rawWidth": 245,
"rawHeight": 280,
"borderTop": 0,
"borderBottom": 0,
"borderLeft": 0,
"borderRight": 0,
"packable": true,
"pixelsToUnit": 100,
"pivotX": 0.5,
"pivotY": 0.5,
"meshType": 0,
"vertices": {
"rawPosition": [
-122.5,
-140,
0,
122.5,
-140,
0,
-122.5,
140,
0,
122.5,
140,
0
],
"indexes": [
0,
1,
2,
2,
1,
3
],
"uv": [
0,
280,
245,
280,
0,
0,
245,
0
],
"nuv": [
0,
0,
1,
0,
0,
1,
1,
1
],
"minPos": [
-122.5,
-140,
0
],
"maxPos": [
122.5,
140,
0
]
},
"isUuid": true,
"imageUuidOrDatabaseUri": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1@6c48a",
"atlasUuid": ""
},
"ver": "1.0.12",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"type": "sprite-frame",
"hasAlpha": true,
"fixAlphaTransparencyArtifacts": false,
"redirect": "f71dd0d1-8bc4-4a9d-a6a2-7b759dfe47f1@6c48a"
}
}
This diff is collapsed.
{
"__type__": "cc.RenderTexture",
"content": {
"base": "1,1,0,0,0,0",
"w": 1624,
"h": 750,
"n": "截图2d"
}
}
\ No newline at end of file
{
"ver": "1.2.1",
"importer": "render-texture",
"imported": true,
"uuid": "8645d365-78c7-4ef6-a89b-cb99abdaec0f",
"files": [
".json"
],
"subMetas": {
"f9941": {
"importer": "rt-sprite-frame",
"uuid": "8645d365-78c7-4ef6-a89b-cb99abdaec0f@f9941",
"displayName": "截图2d",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"imageUuidOrDatabaseUri": "8645d365-78c7-4ef6-a89b-cb99abdaec0f",
"width": 1624,
"height": 750
},
"ver": "1.0.0",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"width": 1624,
"height": 750,
"anisotropy": 0,
"minfilter": "nearest",
"magfilter": "nearest",
"mipfilter": "none",
"wrapModeS": "repeat",
"wrapModeT": "repeat"
}
}
......@@ -36,6 +36,7 @@ import mobx from "mobx";
import { getUrlParam } from "../../Utils/Utils";
import { Snake } from "./Snake";
import { isType1 } from "../../AppTool";
import { RenderTexture } from "cc";
const { reaction, } = mobx;
......@@ -73,9 +74,13 @@ export class MainGame extends Scene {
@property({ type: Label, group: "UI" }) killTxt: Label = null;
@property({ type: Label, group: "UI" }) lengthTxt: Label = null;
@property({ type: Label, group: "UI" }) luckyNum: Label = null;
@property(RenderTexture) rt: RenderTexture = null;
_canvas: HTMLCanvasElement = null;
_canvas2: HTMLCanvasElement = null;
private isStart: boolean = false;
private isOver: boolean = false;
private isShort = 0;
async onLoad() {
......@@ -228,8 +233,66 @@ export class MainGame extends Scene {
this.lengthTxt.string = `${energy}`;
this.killTxt.string = `${killNum}`;
this.luckyNum.string = ${luckNum + gameStore.startInfo?.accumulateLuckNum || 0}`;
let canShort = Math.floor((energy / 51)) > this.isShort
if(canShort){
this.isShort +=1
const b64 = this.copyRenderTex();
store.upLoadImg(b64)
}
}
copyRenderTex() {
const width = this.rt.width;
const height = this.rt.height;
const buffer = this.rt.readPixels();
// const buffer3 = this.rt3.readPixels();
if (!this._canvas) {
this._canvas = document.createElement('canvas');
this._canvas.width = width;
this._canvas.height = height;
this._canvas2 = document.createElement('canvas');
this._canvas2.width = width;
this._canvas2.height = height;
// this._canvas3 = document.createElement('canvas');
// this._canvas3.width = width;
// this._canvas3.height = height;
} else {
const ctx = this._canvas.getContext('2d');
ctx.clearRect(0, 0, width, height);
const ctx2 = this._canvas2.getContext('2d');
ctx2.clearRect(0, 0, width, height);
// const ctx3 = this._canvas3.getContext('2d');
// ctx3.clearRect(0, 0, width, height);
}
// const ctx3 = this._canvas3.getContext('2d')!;
// const copiedBuffer3 = new ArrayBuffer(buffer3.length);
// const copiedUint8Array3 = new Uint8ClampedArray(copiedBuffer3);
// copiedUint8Array3.set(buffer3);
// const imageData3 = new ImageData(copiedUint8Array3, width, height);
// ctx3.putImageData(imageData3, 0, 0);
const ctx2 = this._canvas2.getContext('2d')!;
const copiedBuffer = new ArrayBuffer(buffer.length);
const copiedUint8Array = new Uint8ClampedArray(copiedBuffer);
copiedUint8Array.set(buffer);
const imageData = new ImageData(copiedUint8Array, width, height);
ctx2.putImageData(imageData, 0, 0);
const ctx = this._canvas.getContext('2d');
// ctx.drawImage(this._canvas3, 0, 0);
ctx.drawImage(this._canvas2, 0, 0);
const b64 = this._canvas.toDataURL("image/png");
console.info("b64",b64)
return b64;
}
reactionLenDisposer = null;
async initStage() {
let { currentStage } = gameStore.startInfo;
......
......@@ -142,7 +142,12 @@ export enum WebNetName {
/**
* 使用道具
*/
consumeSp = "game/consumeSp.do"
consumeSp = "game/consumeSp.do",
/** 上传图片 */
uploadImg = "/customActivity/duiba/imgUploadUrl",
/** 游戏快照存储 */
transfer = "snapshot/transfer.do,"
}
export const ERR_MESSAGE = {
......
......@@ -5,6 +5,9 @@ import RankPrizePanel from "../Panels/RankPrizePanel";
import { getUrlParams } from "../Utils/WebNet/web/webTools";
import { assetManager, ImageAsset, SpriteFrame, Texture2D } from "cc";
import GetPrize from "db://assets/Scripts/Panels/GetPrize";
import gameStore from "./gameStore";
import html2canvas from "html2canvas";
const { makeAutoObservable } = mobx;
......@@ -208,6 +211,40 @@ class Store {
this.exchangeInfo = data;
}
async upLoadImg(b64) {
const {success, data} = await sendWebNet(
WebNetName.uploadImg,
{img64: b64},
{
headers: {"Content-Type": "application/json"},
hideMsg: true
}
);
if (success) {
await sendWebNet(WebNetName.transfer, {detail: data, startId: gameStore.startInfo?.startId}, {hideMsg: true});
}
return
let shortDoc = document.getElementById('Cocos3dGameContainer');
await html2canvas(shortDoc, {
useCORS: true,
allowTaint: true,
scale: 1,
// backgroundColor: "rgba(0, 0, 0, 0)",
}).then(async canvas => {
const imgData = canvas.toDataURL('image/png');
console.info("imgData",imgData)
const {success,data} = await sendWebNet(WebNetName.uploadImg, {img64:imgData}, {
headers:{ 'Content-Type': 'application/json'},
hideMsg:true,
}
);
if(success){
await sendWebNet(WebNetName.transfer, {detail:data,startId:gameStore.startInfo?.startId},{hideMsg:true});
}
});
}
}
......
......@@ -187,7 +187,7 @@
"_priority": 65535,
"_fov": 45,
"_fovAxis": 0,
"_orthoHeight": 739.6666666666667,
"_orthoHeight": 556.2162162162163,
"_near": 1,
"_far": 2000,
"_color": {
......@@ -1104,6 +1104,7 @@
"node": {
"__id__": 9
},
"type": 0,
"skin1": {
"__uuid__": "4a038fd0-6019-4409-bb30-663b83a756eb@f9941",
"__expectedType__": "cc.SpriteFrame"
......@@ -1111,13 +1112,16 @@
"skin2": {
"__uuid__": "eb2abb13-dd12-481c-b88d-a6edd827eac5@f9941",
"__expectedType__": "cc.SpriteFrame"
}
},
"node1": null,
"node2": null
},
{
"__type__": "SkinNode",
"node": {
"__id__": 14
},
"type": 0,
"skin1": {
"__uuid__": "a5636d44-661d-4e68-8eda-f0fd9b5cd647@f9941",
"__expectedType__": "cc.SpriteFrame"
......@@ -1125,13 +1129,16 @@
"skin2": {
"__uuid__": "e0130c0f-2d6a-408c-a775-126f3a888ce9@f9941",
"__expectedType__": "cc.SpriteFrame"
}
},
"node1": null,
"node2": null
},
{
"__type__": "SkinNode",
"node": {
"__id__": 17
},
"type": 0,
"skin1": {
"__uuid__": "979b8e0b-ee8a-4711-8627-55773ac71179@f9941",
"__expectedType__": "cc.SpriteFrame"
......@@ -1139,7 +1146,9 @@
"skin2": {
"__uuid__": "ec31c82f-98eb-43e6-9a17-58ad6684f02d@f9941",
"__expectedType__": "cc.SpriteFrame"
}
},
"node1": null,
"node2": null
},
{
"__type__": "cc.PrefabInfo",
......
......@@ -22,6 +22,7 @@ import { AudioMgr } from "../core_tgx/base/AudioMgr";
import shareStore from "../Scripts/store/shareStore";
import GetPrize from "../Scripts/Panels/GetPrize";
const { ccclass, property } = _decorator;
const _FPS = 61;
......@@ -116,8 +117,6 @@ export class Start extends Component{
const list = await getPreLoadList(pkg, this.setProgress, 0.05, 0.2);
await preload(list, this.setProgress, 0.2, 1);
await changeScene(HomeScene);
AudioMgr.ins.play("audio/背景音乐");
......
......@@ -98,14 +98,14 @@
</style>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/assets/plugin/rem.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/assets/plugin/zepto.min.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/assets/plugin/declare-process.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/assets/plugin/SVGA.Lite.v2.1.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/assets/plugin/jszip.min.v3.10.1.js"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/assets/plugin/rem.min.js"></script>
<script src="//res.wx.qq.com/open/js/jweixin-1.6.0.js"></script>
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/style.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/custom.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/style.css" />-->
<!-- <link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/custom.css" />-->
<!-- <script src="//yun-duiba-credits-test.duibatest.com.cn/TNGD_GAMES/libs/eruda.min.js"></script>-->
<!-- <script>eruda.init()</script>-->
......@@ -118,20 +118,20 @@
</div>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/polyfills.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/system.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map -->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<!--<script src="https://yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>-->
<script type="systemjs-importmap" charset="utf-8">
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/cocos-js/cc.js"}}
{"imports":{"cc":"//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/cocos-js/cc.js"}}
</script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1735632777821/index.js').catch(function (err) {
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1735820937146/index.js').catch(function (err) {
console.error(err);
})
</script>
......
This diff is collapsed.
This diff is collapsed.
......@@ -45,8 +45,8 @@
"progress": 1,
"state": "success",
"stage": "build",
"message": "2024-12-31 16:13:45 build success in 47 s!",
"detailMessage": "refresh db internal success\r",
"message": "2025-1-2 20:32:38 build success in 3 min 41 s!",
"detailMessage": "builder:build-project-total (221324ms)\r",
"options": {
"name": "cocos-template-3d",
"server": "",
......@@ -109,7 +109,7 @@
"__version__": "1.3.8",
"logDest": "project://temp/builder/log/web-mobile2024-11-6 15-39.log"
},
"time": "2024-12-31 16:12:57",
"time": "2025-1-2 20:28:56",
"dirty": false
}
}
......
This diff is collapsed.
......@@ -7,7 +7,7 @@
"enable": true,
"customSplash": {
"complete": true,
"form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
"form": "https://creator-api.cocos.com/api/form/show?sid=89ca74d316d6341a14aae897a7fd7ec2"
}
},
"removeSplash": {
......@@ -16,7 +16,7 @@
"enable": true,
"removeSplash": {
"complete": true,
"form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
"form": "https://creator-api.cocos.com/api/form/show?sid=89ca74d316d6341a14aae897a7fd7ec2"
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment