Commit 28146cf1 authored by haiyoucuv's avatar haiyoucuv

整理一下代码1

parent b6a53179
This diff is collapsed.
{
"__type__": "cc.RenderTexture",
"content": {
"base": "1,1,0,0,0,0",
"w": 750,
"h": 1624,
"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": 750,
"height": 1624
},
"ver": "1.0.0",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"width": 750,
"height": 1624,
"anisotropy": 0,
"minfilter": "nearest",
"magfilter": "nearest",
"mipfilter": "none",
"wrapModeS": "repeat",
"wrapModeT": "repeat"
}
}
{
"__type__": "cc.RenderTexture",
"content": {
"base": "1,1,0,0,0,0",
"w": 750,
"h": 1624,
"n": "截图2d"
}
}
\ No newline at end of file
{
"ver": "1.2.1",
"importer": "render-texture",
"imported": true,
"uuid": "d0e5177d-8d71-4f2a-b72c-6d0fc3ad746d",
"files": [
".json"
],
"subMetas": {
"f9941": {
"importer": "rt-sprite-frame",
"uuid": "d0e5177d-8d71-4f2a-b72c-6d0fc3ad746d@f9941",
"displayName": "截图3d",
"id": "f9941",
"name": "spriteFrame",
"userData": {
"imageUuidOrDatabaseUri": "d0e5177d-8d71-4f2a-b72c-6d0fc3ad746d",
"width": 750,
"height": 1624
},
"ver": "1.0.0",
"imported": true,
"files": [
".json"
],
"subMetas": {}
}
},
"userData": {
"width": 750,
"height": 1624,
"anisotropy": 0,
"minfilter": "nearest",
"magfilter": "nearest",
"mipfilter": "none",
"wrapModeS": "repeat",
"wrapModeT": "repeat"
}
}
import {
_decorator,
Animation,
AudioSource,
Button, EPhysicsDrawFlags,
Button,
EventTouch,
input,
Input,
......@@ -11,14 +12,14 @@ import {
Node,
PhysicsSystem,
Prefab,
RenderTexture,
SkeletalAnimation,
Tween,
tween,
UIOpacity,
UITransform,
v3,
Animation,
Vec3,
Vec3
} from "cc";
import Scene from "db://assets/Module/Scene";
import { Quan } from "./MainGame/Quan";
......@@ -39,7 +40,7 @@ import {
} from "db://assets/Scripts/Utils/WebNet/WebNet";
import BackPanel from "db://assets/Scripts/Panels/BackPanel";
const { ccclass, property } = _decorator;
const {ccclass, property} = _decorator;
@ccclass("MainGame")
export class MainGame extends Scene {
......@@ -47,7 +48,7 @@ export class MainGame extends Scene {
static skin: string = "MainGame";
static group: string[] = ["MainGame"];
@property({ type: Prefab })
@property({type: Prefab})
ipPrefab: Prefab = null;
@property(Node)
......@@ -62,41 +63,44 @@ export class MainGame extends Scene {
@property(AudioSource)
bgMusic: AudioSource = null;
@property({ displayName: "游戏时间", group: "游戏配置" })
@property({displayName: "游戏时间", group: "游戏配置"})
totalCD = 60;
@property({ displayName: "手移动速度", group: "游戏配置" })
@property({displayName: "手移动速度", group: "游戏配置"})
handSpeed = 5;
@property({ displayName: "台子旋转速度", group: "游戏配置" })
@property({displayName: "台子旋转速度", group: "游戏配置"})
rotateSpeed = 50;
@property({ displayName: "铜圈", group: "圈", type: Prefab })
@property({displayName: "铜圈", group: "圈", type: Prefab})
cu: Prefab = null!;
@property({ displayName: "银圈", group: "圈", type: Prefab })
@property({displayName: "银圈", group: "圈", type: Prefab})
ag: Prefab = null!;
@property({ displayName: "金圈", group: "圈", type: Prefab })
@property({displayName: "金圈", group: "圈", type: Prefab})
au: Prefab = null!;
@property({ displayName: "翡翠圈", group: "圈", type: Prefab })
@property({displayName: "翡翠圈", group: "圈", type: Prefab})
jadeite: Prefab = null!;
@property({ displayName: "财神圈", group: "圈", type: Prefab })
@property({displayName: "财神圈", group: "圈", type: Prefab})
god: Prefab = null!;
@property({ displayName: "猫手", group: "手", type: Prefab })
@property({displayName: "猫手", group: "手", type: Prefab})
cat: Prefab = null!;
@property({ displayName: "龙手", group: "手", type: Prefab })
@property({displayName: "龙手", group: "手", type: Prefab})
dragon: Prefab = null!;
@property({ displayName: "人手", group: "手", type: Prefab })
@property({displayName: "人手", group: "手", type: Prefab})
human: Prefab = null!;
@property({ displayName: "分数", group: "UI", type: Label })
@property({displayName: "分数", group: "UI", type: Label})
scoreLabel: Label = null!;
@property({ displayName: "倒计时", group: "UI", type: Label })
@property({displayName: "倒计时", group: "UI", type: Label})
cdLabel: Label = null!;
@property({ displayName: "向上滑动", group: "UI", type: Node })
@property({displayName: "向上滑动", group: "UI", type: Node})
operationTip: Node = null!;
@property({ displayName: "闹钟图标", group: "UI", type: Node }) clockIcon: Node = null!;
@property({displayName: "闹钟图标", group: "UI", type: Node}) clockIcon: Node = null!;
@property(RenderTexture) rt: RenderTexture = null;
@property(RenderTexture) rt3: RenderTexture = null;
loopArr: Prefab[] = [];
handArr: Prefab[] = [];
......@@ -132,7 +136,7 @@ export class MainGame extends Scene {
this._score = v >> 0;
this.scoreTween = tween(this)
// @ts-ignore
.to(0.66, { _tempScore: this.score }, { progress: this.updateScore })
.to(0.66, {_tempScore: this.score}, {progress: this.updateScore})
.start();
}
......@@ -167,7 +171,80 @@ export class MainGame extends Scene {
cdPause = false;
_canvas: HTMLCanvasElement = null;
_canvas2: HTMLCanvasElement = null;
// _canvas3: HTMLCanvasElement = null;
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/jpeg", 0.9);
return b64;
}
async uploadScreenshot() {
try {
const b64 = this.copyRenderTex();
const {success, data} = await sendWebNet(WebNetName.imgUploadUrl, {
img64: b64,
}, null, true, false, {
'Content-Type': 'application/json'
})
if (!success) return;
await sendWebNet(WebNetName.transfer, {
startId: GameMgr.ins.gameInfo.startId,
detail: data,
}, null, true, false);
} catch (e) {
console.log(e);
}
}
onLoad() {
this.schedule(this.uploadScreenshot, 10);
PhysicsSystem.instance.enable = true;
// PhysicsSystem.instance.debugDrawFlags
// = EPhysicsDrawFlags.AABB
......@@ -229,7 +306,7 @@ export class MainGame extends Scene {
this.handSpeed += Math.random() * 2 - 1;
const { loopType, handType, rongNum, targetNum, richManNum, isDouble, newGuide } = GameMgr.ins.gameInfo;
const {loopType, handType, rongNum, targetNum, richManNum, isDouble, newGuide} = GameMgr.ins.gameInfo;
this.isDouble = isDouble;
this.richManNum = 0;
......@@ -308,7 +385,7 @@ export class MainGame extends Scene {
this.uiLayer.view["gamePre/cd"].on(Svga.EventType.END_FRAME, () => {
this.uiLayer.view["gamePre/cd"].active = false;
tween(this.operationTip.getComponent(UIOpacity))
.to(0.5, { opacity: 255 })
.to(0.5, {opacity: 255})
.delay(2)
.call(() => {
this.uiLayer.view["gamePre"].active = false;
......@@ -349,7 +426,7 @@ export class MainGame extends Scene {
if (this.isOver) return;
this.isOver = true;
const { isUsedDelay } = GameMgr.ins.gameInfo;
const {isUsedDelay} = GameMgr.ins.gameInfo;
if (isUsedDelay) {
this.submit();
} else {
......@@ -365,7 +442,7 @@ export class MainGame extends Scene {
* 复活
*/
review = async () => {
const { success, data } = await sendWebNetWithToken(WebNetName.delay);
const {success, data} = await sendWebNetWithToken(WebNetName.delay);
if (!success) {
return this.submit();
}
......@@ -442,13 +519,13 @@ export class MainGame extends Scene {
Tween.stopAllByTarget(this.addScoreTip);
Tween.stopAllByTarget(scoreTipAlpha);
tween(this.addScoreTip)
.set({ position: v3(0, stopY - moveY, 0) })
.to(duration, { position: v3(0, stopY, 0) })
.set({position: v3(0, stopY - moveY, 0)})
.to(duration, {position: v3(0, stopY, 0)})
.delay(delay)
.to(duration, { position: v3(0, stopY + moveY, 0) })
.to(duration, {position: v3(0, stopY + moveY, 0)})
.start();
tween(scoreTipAlpha).set({ opacity: 0 }).to(duration, { opacity: 225 }).delay(delay).to(duration, { opacity: 0 }).start();
tween(scoreTipAlpha).set({opacity: 0}).to(duration, {opacity: 225}).delay(delay).to(duration, {opacity: 0}).start();
}
changeHand(type: HAND_TYPE) {
......
......@@ -32,6 +32,8 @@ export enum WebNetName {
baseInfo = "loop/baseInfo.do",
imgUploadUrl = "/customActivity/duiba/imgUploadUrl",
transfer = "snapshot/transfer.do",
/**
* 购买天降财神道具接口
......
......@@ -9,7 +9,8 @@ import {
profiler,
ProgressBar,
resources,
Sprite
Sprite,
macro,
} from 'cc';
import { PREVIEW } from 'cc/env';
import { UIMgr } from "../Module/UIMgr";
......
......@@ -39,7 +39,7 @@
<script src="//yun.duiba.com.cn/polaris/SVGA.Lite.v2.1.1.d3a67cbc13c591c53c6f87ab34c57ce387010374.js" crossorigin="anonymous"></script>
<script src="//yun.duiba.com.cn/aurora/assets/2403d1edf2acd15b179306b6ddaa5f0967d78a8f.js"></script>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1722502435064/style.css"/>
<link rel="stylesheet" type="text/css" href="//yun.duiba.com.cn/db_games/ccc_game/template3d/1724137628569/style.css"/>
<style>
.sui-captcha {
......@@ -99,16 +99,16 @@
</script>
<!-- Polyfills bundle. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1722502435064/src/polyfills.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1724137628569/src/polyfills.bundle.js" charset="utf-8"></script>
<!-- SystemJS support. -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1722502435064/src/system.bundle.js" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1724137628569/src/system.bundle.js" charset="utf-8"></script>
<!-- Import map -->
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1722502435064/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script src="//yun.duiba.com.cn/db_games/ccc_game/template3d/1724137628569/src/import-map.json" type="systemjs-importmap" charset="utf-8"></script>
<script>
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1722502435064/index.js').catch(function (err) {
System.import('//yun.duiba.com.cn/db_games/ccc_game/template3d/1724137628569/index.js').catch(function (err) {
console.error(err);
})
</script>
......
......@@ -7,7 +7,7 @@
"enable": true,
"customSplash": {
"complete": true,
"form": "https://creator-api.cocos.com/api/form/show?sid=ed5f7e7e88978f75ec1dddd4e3508760"
"form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
}
},
"removeSplash": {
......@@ -16,7 +16,7 @@
"enable": true,
"removeSplash": {
"complete": true,
"form": "https://creator-api.cocos.com/api/form/show?sid=ed5f7e7e88978f75ec1dddd4e3508760"
"form": "https://creator-api.cocos.com/api/form/show?sid=441e6f8e3e7ba0c9581ed7936daee45d"
}
}
}
......
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