Commit cdbbdef6 authored by Friends233's avatar Friends233

init

parents
node_modules/
dist/
build/
released/resource/
yarn-error.log
debug/
.DS_Store
# 最新模板
### psd命名规则
按钮单图 图层名字_btn_id
按钮多图 组名_btn_id (里面多图层,0常态,1不可点击,2按钮)
普通图片png 图层名字_id
普通图片jpg 图层名字_jpg_id
矩形 图层名字_id
文本 图层名字_id (默认都居左,未改文本前, 调整调用Tool里方法changeTextAlign)
贴图 图层名字_tex (只切图,不进皮肤)
作为item的皮肤不进root 组名_item (比如自定义的类或滚动列表的item)
(组名,图层名字,id均为动态)
(id为英文,显示对象原属性名不能作为id,比如"name")
(同名的的图片只要图片相同就行,用clearSameImg脚本将同图移进common)
(能合并的图自行合并)
(视图模块名字命名成...Panel,...Scene,例如StartScene,RulePanel,方便生成模块传参,否则自行修改createModule脚本里的参数)
(id必须是英文,作为item的组名必须是英文,因为会生成类)
### psd解析
生成./resource/skinJson.json和./src/SkinJson.ts,
初始一致,json只用于脚本createModule.js生成场景或弹框模块,实际作用数据是ts,有需要自行修改SkinJson.ts
执行,会刷新资源配置及覆盖SkinJson.ts,注意
```shell script
#多视图解析,会解析./psd文件夹内所有psd及内视图
npm run psd
#单视图解析,主要用于处理后添加的视图,传参./psd文件夹内psd名字,
#资源及皮肤数据skin.json会在./psd文件夹内生成,自行处理进./resource/skin.json和./src/SkinJson.ts文件
npm run psdSin
```
### 生成模块 有psd生成皮肤数据时使用
会根据参数Panel或者Scene生成ts文件写入./src/panels或./src/scenes文件夹
```shell script
npm run createModule RulePanel
```
### 本地开发
```shell script
npm run dev
```
### 图集工具安装
```shell script
#全局安装
cnpm install pack_textures -g
#终端输入packTextures检查环境变量是否存在
```
### 打包
```shell script
#带资源打包,并生成./released/resource文件夹和./released/output.js文件
npm run build
#只打包代码,
npm run buildTS
```
### 适配
./module/views/layers.ts可设置所有层级适配(弹框场景等等)
单独模块的适配自行在模块里处理,修改this.y
### psd导出文本
部分文案尺寸错误自行在SkinJson,ts里修改
居中居右,在未修改文本字号字符等属性前调用Tools.changeTextAlign修改,可与psd表现保持一致
/*
* index.mjs
* Created by 还有醋v on 2022/5/27.
* Copyright © 2022 haiyoucuv. All rights reserved.
*/
/**
* 插入banner变量
* @param {{values:{[key in string]: string|number|Function<string|number>}}} options
*/
export default function pluginBannerVariable(options) {
const { values } = options;
return {
name: "banner-variable",
banner() {
let code = "var ";
for (const key in values) {
const value = values[key] instanceof Function ? values[key]() : values[key];
code += `${key}=${value},`;
}
code = code.slice(0, code.length - 1) + ";";
return code;
},
}
}
/*
* utils.mjs.js
* Created by 还有醋v on 2022/5/27.
* Copyright © 2022 haiyoucuv. All rights reserved.
*/
import childProcess from "child_process";
export function _debounce(fn, delay = 1000) {
let timer = null;
return function (...args) {
timer && clearTimeout(timer);
timer = setTimeout(fn, delay, ...args);
};
}
export function runScript(scriptPath, callback) {
let invoked = false;
const process = childProcess.fork(scriptPath);
process.on('error', (err) => {
if (invoked) return;
invoked = true;
callback(err);
});
process.on('exit', (code) => {
if (invoked) return;
invoked = true;
const err = code === 0 ? null : new Error('exit code ' + code);
callback(err);
});
}
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>new_game_template</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<!-- polyfill -->
<!-- <script src="//yun.duiba.com.cn/db_games/libs0924/polyfill_220525.js" crossorigin="anonymous"></script>-->
<!-- 渲染引擎 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/fyge2044.min.js" crossorigin="anonymous"></script>
<!--<script src="libs/fyge.min.js" crossorigin="anonymous"></script>-->
<!-- svga解析库 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js" crossorigin="anonymous"></script>
<!-- 放声音的 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/howler.min.js" crossorigin="anonymous"></script>
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #ffffff;
}
#__loading__ {
position: absolute;
left: 50%;
top: 50%;
margin-left: -45px;
color: #ffffff;
}
#cusEngine {
line-height: 0;
font-size: 0;
position: absolute;
}
#canvas {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="__loading__">拼命加载中...</div>
<div id="cusEngine">
<canvas id="canvas"></canvas>
</div>
<!-- 帧率检测 -->
<!-- <script src="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> -->
<script>
const app = {
checkMember: () => {
return false;
}
};
function getApp() {
return app;
}
// document.oncontextmenu = () => false;
</script>
<script>
var CFG = CFG || {};
CFG.projectId = 'pa525eacc';//线上直接写死
CFG.appID = '76177';//线上直接写死
//TODO我的奖品链接
window["recordUrl"] = "fe071865b.html";
window.addEventListener("load", function () {
//获取canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
var main = new output.Game(canvas);
main.initWebEvent();
window.stage = main.stage
})
</script>
<!-- 构建的js -->
<script src="./debug/output.js" crossorigin="anonymous"></script>
</body>
</html>
This diff is collapsed.
declare module SvgaParser {
/**
* 加载方法
* @param url 资源路径
* @param success
* @param failure
*/
export function loadSvga(url: string, success: (videoItem: VideoEntity) => void, failure?: (err: string) => void): void;
/**
* 导出只是当作类型接口用
*/
export interface VideoEntity {
/**
* SVGA 文件版本
*/
version: string;
/**
* 影片尺寸
*/
videoSize: {
width: number;
height: number;
};
/**
* 帧率,60,30等每秒
*/
FPS: number;
/**
* 总帧数
*/
frames: number;
/**
* base64图片数据记录
*/
images: {
[key: string]: string
};
/**
* 图片是否已被缓存,缓存全局,注意名字覆盖
*/
hasBeenCached: boolean;
/**
* sprite对象数据
*/
sprites: SpriteEntity[];
}
interface SpriteEntity {
/**
* 标识
*/
matteKey: string;
/**
* 图片key值
*/
imageKey: string;
/**
* 帧数据数组
*/
frames: FrameEntity[];
}
/**
* 还有很多其他数据,暂不需要,比如矢量路径和遮罩路径暂时都无
*/
interface FrameEntity {
/**
* 透明度
*/
alpha: number;
/**
* 2维矩阵数据
*/
transform: {
a: number,
b: number,
c: number,
d: number,
tx: number,
ty: number,
};
}
}
declare module "svga-parser" { export = SvgaParser; }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
// Type definitions for howler.js v2.1.1
// Project: https://github.com/goldfire/howler.js
// Definitions by: Pedro Casaubon <https://github.com/xperiments>
// Alexander Leon <https://github.com/alien35>
// Nicholas Higgins <https://github.com/nicholashza>
// Carlos Urango <https://github.com/cjurango>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface HowlerGlobal {
mute(muted: boolean): this;
volume(): number;
volume(volume: number): this;
codecs(ext: string): boolean;
unload(): this;
usingWebAudio: boolean;
html5PoolSize: number;
noAudio: boolean;
autoUnlock: boolean;
autoSuspend: boolean;
ctx: AudioContext;
masterGain: GainNode;
stereo(pan: number): this;
pos(x: number, y: number, z: number): this | void;
orientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): this | void;
}
declare let Howler: HowlerGlobal;
interface IHowlSoundSpriteDefinition {
[name: string]: [number, number] | [number, number, boolean]
}
interface IHowlProperties {
src: string | string[];
volume?: number;
html5?: boolean;
loop?: boolean;
preload?: boolean;
autoplay?: boolean;
mute?: boolean;
sprite?: IHowlSoundSpriteDefinition;
rate?: number;
pool?: number;
format?: string[] | string;
xhrWithCredentials?: boolean;
onload?: () => void;
onloaderror?: (soundId: number, error: any) => void;
onplay?: (soundId: number) => void;
onplayerror?: (soundId: number, error: any) => void;
onend?: (soundId: number) => void;
onpause?: (soundId: number) => void;
onstop?: (soundId: number) => void;
onmute?: (soundId: number) => void;
onvolume?: (soundId: number) => void;
onrate?: (soundId: number) => void;
onseek?: (soundId: number) => void;
onfade?: (soundId: number) => void;
onunlock?: (soundId: number) => void;
}
interface Howl {
play(spriteOrId?: string | number): number; // .play() is not chainable; the other methods are
pause(id?: number): this;
stop(id?: number): this;
mute(): boolean;
mute(muted: boolean, id?: number): this;
volume(): number;
volume(idOrSetVolume: number): this | number;
volume(volume: number, id: number): this;
fade(from: number, to: number, duration: number, id?: number): this;
rate(): number;
rate(idOrSetRate: number): this | number;
rate(rate: number, id: number): this;
seek(seek?: number, id?: number): this | number;
loop(id?: number): boolean;
loop(loop: boolean, id?: number): this;
playing(id?: number): boolean;
duration(id?: number): number;
state(): 'unloaded' | 'loading' | 'loaded';
load(): this;
unload(): void;
on(event: 'load', callback: () => void, id?: number): this;
on(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this;
on(event: 'play', callback: (soundId: number) => void, id?: number): this;
on(event: 'playerror', callback: (soundId: number, error: any) => void, id?: number): this;
on(event: 'end', callback: (soundId: number) => void, id?: number): this;
on(event: 'pause', callback: (soundId: number) => void, id?: number): this;
on(event: 'stop', callback: (soundId: number) => void, id?: number): this;
on(event: 'mute', callback: (soundId: number) => void, id?: number): this;
on(event: 'volume', callback: (soundId: number) => void, id?: number): this;
on(event: 'rate', callback: (soundId: number) => void, id?: number): this;
on(event: 'seek', callback: (soundId: number) => void, id?: number): this;
on(event: 'fade', callback: (soundId: number) => void, id?: number): this;
on(event: string, callback: Function, id?: number): this;
on(event: 'unlock', callback: (soundId: number) => void, id?: number): this;
once(event: 'load', callback: () => void, id?: number): this;
once(event: 'loaderror', callback: (soundId: number, error: any) => void, id?: number): this;
once(event: 'play', callback: (soundId: number) => void, id?: number): this;
once(event: 'playerror', callback: (soundId: number, error: any) => void, id?: number): this;
once(event: 'end', callback: (soundId: number) => void, id?: number): this;
once(event: 'pause', callback: (soundId: number) => void, id?: number): this;
once(event: 'stop', callback: (soundId: number) => void, id?: number): this;
once(event: 'mute', callback: (soundId: number) => void, id?: number): this;
once(event: 'volume', callback: (soundId: number) => void, id?: number): this;
once(event: 'rate', callback: (soundId: number) => void, id?: number): this;
once(event: 'seek', callback: (soundId: number) => void, id?: number): this;
once(event: 'fade', callback: (soundId: number) => void, id?: number): this;
once(event: string, callback: Function, id?: number): this;
once(event: 'unlock', callback: (soundId: number) => void, id?: number): this;
off(event: string, callback?: Function, id?: number): this;
off(): this;
stereo(pan: number, id?: number): this | void;
pos(x: number, y: number, z: number, id?: number): this | void;
orientation(x: number, y: number, z: number, xUp: number, yUp: number, zUp: number): this | void;
pannerAttr(o: {
coneInnerAngle?: number,
coneOuterAngle?: number, coneOuterGain?: number,
distanceModel: 'inverse' | 'linear', maxDistance: number,
panningModel: 'HRTF' | 'equalpower', refDistance: number, rolloffFactor: number
}, id?: number): this;
}
interface HowlStatic {
new(properties: IHowlProperties): Howl;
}
declare let Howl: HowlStatic;
declare module "howler" {
export let Howler: HowlerGlobal;
export let Howl: HowlStatic;
}
/*
* lib.d.ts
* Created by 还有醋v on 2022/5/27.
* Copyright © 2022 haiyoucuv. All rights reserved.
*/
declare const __ENV__: "development" | "production";
declare const __version__: string;
declare const __buildDate__: string;
/**
* shader文件类型
*/
declare module '*.vert' {
const source: string;
export default source;
}
declare module '*.frag' {
const source: string;
export default source;
}
declare module '*.vs' {
const source: string;
export default source;
}
declare module '*.fs' {
const source: string;
export default source;
}
declare module '*.glsl' {
const source: string;
export default source;
}
This diff is collapsed.
This diff is collapsed.
{
"code": "000000",
"data": {
"isOpenMember": 1,
"newerBelongPrize": "",
"memberGrade": 0,
"showNotice": false,
"end": false,
"detail": {
"feedTime": 1623242500923,
"showNewGiftPop": true,
"milkCreateTime": 1623242500923,
"feedWeight": 500,
"activityId": "60a60966114fbb7eb9b576ab",
"delTaskInfoTag": true,
"cowName": "小Q",
"guideStep": 4,
"userNick": "我",
"grassGrowTime": 1623242663382,
"gainCowMilkBottlesTime": 1623240837744,
"taskInfo": {
"foreverLimit": {
"focusShop": [],
"beMember": []
}
},
"tag": 0,
"reduceMilkDropsCount": 0,
"nextMilkCreateTime": 1623242950923,
"milkDrops": [],
"cowId": "60c0a3f667f1372ade1bb80b",
"guideisEnd": true,
"clickCrazyGainGrassTime": "",
"feedInfo": "",
"updateTime": 1623242663403,
"avatar": "http://wwc.alicdn.com/avatar/getAvatar.do?userIdStr=O8gbM07HMG9eOHRhPFxYMF*evCHbPHReMC-HP0cWMCcT&width=80&height=80&type=sns",
"cowMilkBottles": 2,
"cowLevel": 2,
"growthValue": 12,
"gainCowMilkBottlesTotal": 2,
"clickCrazyGainGrassCount": 0,
"progressGrassWeight": 107,
"milkWeight": 250,
"_id": "60c0a3f60cb7332a070d5c9c",
"createGrassWeight": 0
},
"shopUrl": "//market.m.taobao.com/apps/market/shopmember/index.html?wh_weex=true&sellerId=2207623078795&extraInfo=%7B%22source%22%3A%22isvapp%22%2C%22entrance%22%3A%22duiba%22%7D",
"contentArr": [
"玉立测试活动",
"玉立测试活动"
],
"newerBelongPrizeIsReceived": false,
"isVip": false
},
"success": true,
"message": "成功"
}
{
"code": "000000",
"data": {
"feedTime": 1623242500923,
"showNewGiftPop": true,
"milkCreateTime": 1623242500923,
"feedWeight": 500,
"activityId": "60a60966114fbb7eb9b576ab",
"delTaskInfoTag": true,
"cowName": "小Q",
"guideStep": 4,
"userNick": "我",
"grassGrowTime": 1623242693835,
"gainCowMilkBottlesTime": 1623240837744,
"end": false,
"taskInfo": {
"foreverLimit": {
"focusShop": [],
"beMember": []
}
},
"tag": 0,
"nextMilkCreateTime": 1623242890923,
"milkDrops": [],
"cowId": "60c0a3f667f1372ade1bb80b",
"guideisEnd": true,
"clickCrazyGainGrassTime": "",
"newerBelongPrize": "",
"feedInfo": "",
"updateTime": 1623242693847,
"avatar": "http://wwc.alicdn.com/avatar/getAvatar.do?userIdStr=O8gbM07HMG9eOHRhPFxYMF*evCHbPHReMC-HP0cWMCcT&width=80&height=80&type=sns",
"cowMilkBottles": 2,
"milkProduceGap": 450000,
"cowLevel": 2,
"growthValue": 12,
"gainCowMilkBottlesTotal": 2,
"clickCrazyGainGrassCount": 0,
"progressGrassWeight": 111,
"milkWeight": 250,
"_id": "60c0a3f60cb7332a070d5c9c",
"createGrassWeight": 0,
"newerBelongPrizeIsReceived": false
},
"success": true,
"message": "成功"
}
{
"code": "0000000000",
"data": {
"creditsConf": {
"creditsUp": 100,
"creditsType": "virtual",
"creditsDown": 50,
"prize": [
{
"img": "adsfsadf",
"credits": 20,
"id": 4,
"title": "0.3"
},
{
"img": "sadfasdf",
"credits": 150,
"id": 3,
"title": "1.5倍"
},
{
"img": "sadfasdf",
"credits": 100,
"id": 2,
"title": "1倍"
},
{
"img": "sadfasdf",
"credits": 50,
"id": 1,
"title": "0.5倍"
}
]
},
"floating": {
"jsTest": "//yun1.duiba.com.cn/h5/showCouponPrize/4.0.0/index_201710191434.js",
"cssTest": "//yun1.duiba.com.cn/h5/showCouponPrize/4.0.0/index_201710191440.css"
},
"options": [
{
"itemId": 47861,
"hidden": false,
"prizeType": "thanks",
"name": "谢谢参与",
"description": "",
"logo": "//yun1.duiba.com.cn/upload/uP99F1462438316972.png",
"id": 15581
},
{
"itemId": 47862,
"hidden": false,
"prizeType": "lucky",
"name": "幸运福袋",
"description": "",
"logo": "//yun1.duiba.com.cn/webapp/img/luckynewn.png",
"id": 15582
},
{
"itemId": 47863,
"scoreArea": "",
"hidden": false,
"prizeType": "alipay",
"name": "支付宝1",
"description": "",
"logo": "//yun1.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png",
"id": 15585
},
{
"itemId": 47864,
"scoreArea": "",
"hidden": false,
"prizeType": "alipay",
"name": "支付宝1",
"description": "",
"logo": "//yun1.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png",
"id": 15585
}
],
"rule": "adsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【iadsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【iadsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【i",
"type": "hdtool",
"element": {
"isCreditsTypeOpen": false,
"myCreditsLong": 999999632167,
"freeLimit": 5,
"success": false,
"myCredits": "999999632167",
"needCredits": "100",
"freeEmpty": true,
"needCreditsLong": 9,
"status": 7
},
"coinPusherConf": {
"exchangeRate": 60,
"creditsGear": "25,60,75,80"
}
},
"success": true,
"desc": "OK",
"timestamp": 1548832971636
}
\ No newline at end of file
{
"code": "0000000000",
"data": {
"creditsConf": {
"creditsUp": 100,
"creditsType": "virtual",
"creditsDown": 50,
"prize": [
{
"img": "adsfsadf",
"credits": 20,
"id": 4,
"title": "0.3"
},
{
"img": "sadfasdf",
"credits": 150,
"id": 3,
"title": "1.5倍"
},
{
"img": "sadfasdf",
"credits": 100,
"id": 2,
"title": "1倍"
},
{
"img": "sadfasdf",
"credits": 50,
"id": 1,
"title": "0.5倍"
}
]
},
"floating": {
"jsTest": "//yun1.duiba.com.cn/h5/showCouponPrize/4.0.0/index_201710191434.js",
"cssTest": "//yun1.duiba.com.cn/h5/showCouponPrize/4.0.0/index_201710191440.css"
},
"options": [
{
"itemId": 47861,
"hidden": false,
"prizeType": "thanks",
"name": "谢谢参与",
"description": "",
"logo": "//yun1.duiba.com.cn/upload/uP99F1462438316972.png",
"id": 15581
},
{
"itemId": 47862,
"hidden": false,
"prizeType": "lucky",
"name": "幸运福袋",
"description": "",
"logo": "//yun1.duiba.com.cn/webapp/img/luckynewn.png",
"id": 15582
},
{
"itemId": 47863,
"scoreArea": "",
"hidden": false,
"prizeType": "alipay",
"name": "支付宝1",
"description": "",
"logo": "//yun1.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png",
"id": 15585
},
{
"itemId": 47864,
"scoreArea": "",
"hidden": false,
"prizeType": "alipay",
"name": "支付宝1",
"description": "",
"logo": "//yun1.duiba.com.cn/developer/img/activityTool/slotMachine/alipay.png",
"id": 15585
}
],
"rule": "adsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【iadsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【iadsfasdfasd啊实打实爱的额求稳怕哦i求稳怕请问赔钱片尾曲哦物品i区乌日千万人i去我日哦确认iqo【i",
"type": "hdtool",
"element": {
"isCreditsTypeOpen": false,
"myCreditsLong": 999999632167,
"freeLimit": 5,
"success": false,
"myCredits": "999999632167",
"needCredits": "100",
"freeEmpty": true,
"needCreditsLong": 9,
"status": 7
},
"coinPusherConf": {
"exchangeRate": 60,
"creditsGear": "25,60,75,80"
}
},
"success": true,
"desc": "OK",
"timestamp": 1548832971636
}
\ No newline at end of file
{
"success":true,
"code":"0000000000",
"desc":"OK",
"timestamp":1548915321930,
"data":123456
}
\ No newline at end of file
{
"code": "000000",
"data": {
"showNewGiftPop": false,
"activityId": "5f855a0a738989848ebb5050",
"guideStep": 4,
"userNick": "卿卿我我",
"gainCowMilkBottlesTime": "",
"end": false,
"taskInfo": {
"freeReceive": 2,
"foreverLimit": {
"focusShop": [
{
"grass": 12222,
"isReceive": false,
"time": 1602727797457
}
],
"beMember": [
{
"grass": 12,
"isReceive": false,
"time": 1602727797427
}
]
},
"2020/10/15": {
"todayCompleteTaskTimes": 2
}
},
"tag": 0,
"nextMilkCreateTime": 1602904190337,
"milkDrops": [
{
"createTime": 1602679659133
},
{
"createTime": 1602679809133
},
{
"createTime": 1602679959133
},
{
"createTime": 1602680109133
},
{
"createTime": 1602680259133
},
{
"createTime": 1602680409133
},
{
"createTime": 1602680559133
},
{
"createTime": 1602680709133
},
{
"createTime": 1602680859133
},
{
"createTime": 1602681009133
},
{
"createTime": 1602681159133
},
{
"createTime": 1602681309133
},
{
"createTime": 1602681459133
},
{
"createTime": 1602681609133
},
{
"createTime": 1602681759133
},
{
"createTime": 1602681909133
},
{
"createTime": 1602682059133
},
{
"createTime": 1602682209133
},
{
"createTime": 1602682359133
},
{
"createTime": 1602682509133
}
],
"cowId": "5f86f0ede5c0d7316b457dd8",
"guideisEnd": true,
"clickCrazyGainGrassTime": "",
"newerBelongPrize": "",
"feedInfo": {},
"eachDropReduceTime": 5,
"updateTime": 1602903776711,
"milkProduceGap": 450000,
"gainCowMilkBottlesTotal": 0,
"clickCrazyGainGrassCount": 0,
"milkWeight": 250,
"_id": "5f86f0ed964f97d1ee73633a",
"speedUpEndTime": 1602683250085,
"newerBelongPrizeIsReceived": false
},
"success": true,
"message": "成功"
}
{
"code": "33000",
"data": {
"isOpenMember": false,
"newerBelongPrize": "",
"memberGrade": 1,
"showNotice": false,
"end": false,
"milkProduceGap": 450000,
"detail": {
"showNewGiftPop": false,
"activityId": "5f6fee6f114fbbc8c9935e9c",
"guideStep": 4,
"userNick": "卿卿我我",
"gainCowMilkBottlesTime": "",
"taskInfo": {
"freeReceive": 2,
"foreverLimit": {
"focusShop": [],
"beMember": []
},
"feedReceive": 2
},
"tag": 0,
"reduceMilkDropsCount": 0,
"nextMilkCreateTime": 1601272292257,
"milkDrops": [],
"cowId": "5f715eae0cb733e89283e0a2",
"guideisEnd": true,
"clickCrazyGainGrassTime": "",
"feedInfo": {},
"updateTime": 1601276726110,
"gainCowMilkBottlesTotal": 0,
"clickCrazyGainGrassCount": 0,
"milkWeight": 250,
"_id": "5f715eae52bbded304b20111"
},
"shopUrl": "//market.m.taobao.com/apps/market/shopmember/index.html?wh_weex=true&sellerId=2207623078795&extraInfo=%7B%22source%22%3A%22isvapp%22%2C%22entrance%22%3A%22duiba%22%7D",
"contentArr": [
"中秋节快乐1",
"中秋节快乐2",
"中秋节快乐3"
],
"newerBelongPrizeIsReceived": false,
"isVip": true
},
"success": true,
"message": "成功"
}
{
"success":true,
"code":"0000000000",
"desc":"OK",
"timestamp":1550570639368,
"data":{
"orderId":"883006813674240289",
"submitToken":"d895deb9118f4b938d0b70a3dd2ace19",
"credits":"999999491765",
"unitName":"金币",
"consumerCredits":999999491765
}
}
\ No newline at end of file
{
"success":true,
"code":"0000000000",
"desc":"OK",
"timestamp":1548923950498,
"data":{
"element":{
"success":false,
"isCreditsTypeOpen":false,
"needCredits":"100",
"myCredits":"1123",
"myCreditsLong":1123,
"needCreditsLong":9,
"freeLimit":2,
"status":6,
"freeEmpty":true
},
"lottery":{
"id":null,
"type":"111",
"imgUrl":"//yun.duiba.com.cn/images/201607/73htz55ih9.jpg",
"link":null,
"title":"重复券测试grape",
"itemId":null,
"appItemId":null,
"bonus":null,
"bonusMin":null,
"bonusMax":null,
"needAccount":null,
"appLucky":null,
"tip":null,
"useBtnText":null,
"validate":null,
"couponCode":null,
"couponKey":null,
"stInfoDpmImg":null,
"stInfoDpmClose":null,
"stInfoDpmGoUse":null,
"showUse":null,
"openUrl":null,
"iosDownloadUrl":null,
"androidDownloadUrl":null,
"isDownloadUrl":null,
"confirm":null,
"phaseNumber":null,
"happyCode":null,
"appHidden":true,
"zybangJson":null
},
"exposure":11111,
"creditsInfo":{
"activityId":82567,
"prizeId":4,
"orderNum":null,
"developerBizId":"3029576",
"score":null,
"recordStatus":1,
"errorMsg":null
},
"againTag":null
}
}
\ No newline at end of file
{
"success":true,
"code":"0000000000",
"desc":"OK",
"timestamp":1550646190489,
"data":{
"score":100,
"maxScore":100
}
}
\ No newline at end of file
{
"data": {
"isContinue": true
},
"success": true,
"code": "veniam",
"message": "amet"
}
{"code":"430009","success":false,"message":"只有新会员才能助力哦~"}
{
"success": true,
"message": "ok",
"code": "111111",
"data": {
"_id": "1111",
"openId": "mfk",
"rule": "mfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfkmfk",
"startTime": 1599131034611,
"endTime": 1598585357782,
"activityStatus": 2,
"openPrizeStatus": 2,
"totalScore": 52000001,
"showImage": "https://yun.duiba.com.cn/aurora/assets/70c7fdc45ed8139bdc0a23ac004facc07abf3cfd.jpg"
}
}
{
"data": {
"score": 123456,
"gameTimes": 1,
"isFirstEnterGame": false
},
"success": true,
"code": "1",
"message": "ok"
}
{
"code": "111",
"success": true,
"message": "ok",
"data": {
"showAwardDialog": true,
"prize": {
"id": "id",
"useUrl": "useUrl",
"drawStatus": 1,
"type": 5,
"image": "https://yun.duiba.com.cn/aurora/assets/39c89bfa28c4c022436c23f56547b2995cb2b65c.png",
"name": "name"
},
"rank": {
"score": 0,
"rank": 200
}
}
}
{
"code": "111",
"success": true,
"message": "ok",
"data": {
"list": [
{
"useUrl": "useUrl",
"id": "id1",
"prizeId": "prizeId1",
"type": 4,
"image": "https://yun.duiba.com.cn/aurora/assets/39c89bfa28c4c022436c23f56547b2995cb2b65c.png",
"name": "name1",
"drawStatus": 1,
"addressDetail": "addressDetail",
"rank": "1-2"
},
{
"useUrl": "useUrl",
"id": "id2",
"prizeId": "prizeId2",
"type": 4,
"image": "https://yun.duiba.com.cn/aurora/assets/39c89bfa28c4c022436c23f56547b2995cb2b65c.png",
"name": "name2",
"drawStatus": 1,
"addressDetail": "addressDetail",
"rank": "3-5"
},
{
"useUrl": "useUrl",
"id": "id3",
"prizeId": "prizeId3",
"type": 4,
"image": "https://yun.duiba.com.cn/aurora/assets/39c89bfa28c4c022436c23f56547b2995cb2b65c.png",
"name": "name3",
"drawStatus": 1,
"addressDetail": "addressDetail",
"rank": "6-10"
}
]
}
}
{
"data": {
"rank": 11,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"userNick": "userNick",
"list": [
{
"rank": 1,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 123456,
"userNick": "userNick1"
},
{
"rank": 2,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 12345,
"userNick": "userNick2"
},
{
"rank": 3,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 1234,
"userNick": "userNick3"
},
{
"rank": 4,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 123,
"userNick": "userNick4"
},
{
"rank": 5,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 12,
"userNick": "userNick5"
},
{
"rank": 6,
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"score": 1,
"userNick": "userNick6"
}
],
"score": "66666"
},
"success": true,
"code": "111",
"message": "ok"
}
{
"success": true,
"data": {
"isVip": true,
"url": "https://www.baidu.com/"
}
}
{
"data": {
"gameId": 12345,
"beMember": false,
"isFirstEnterGame": false
},
"success": true,
"code": "123",
"message": "ok"
}
{
"data": {
"prizeInfo": {
"id": "id",
"image": "https://img.alicdn.com/imgextra/i1/2275046294/O1CN01xTeKMI1wMhRux48Y6_!!2275046294-2-miniprogram.png",
"name": "name",
"type": 4
},
"score": 6666,
"rank": 12,
"userNick": "hycv",
"avatar": "esse veniam ut",
"gameTimes": 0,
"maxScore": 1234,
"getScore": 66
},
"success": true,
"code": "1",
"message": "ok"
}
{
"success": true,
"data": {
"avatar": "https://source.unsplash.com/user/erondu/76x76",
"nickName": "我啊是大请问",
"activityId": "string",
"inviteId": "",
"isFollow": true,
"openId": "string",
"firstLoginToday": true,
"newUser": false
}
}
{
"success": false,
"code": "ipsum voluptate est pariatur aliqua",
"message": "commodo ipsum tempor",
"data": "123"
}
\ No newline at end of file
{
"success": false,
"code": "ipsum voluptate est pariatur aliqua",
"message": "commodo ipsum tempor",
"data": "123"
}
\ No newline at end of file
{
"success": true,
"code": "ipsum voluptate est pariatur aliqua",
"message": "commodo ipsum tempor",
"data": "123"
}
\ No newline at end of file
{
"code": null,
"data": {
"creditsUnit": "人民币123123",
"difficulty": 1,
"freeTimes": 0,
"levelInfo": [
{
"name": "D",
"score": 50
},
{
"name": "C",
"score": 100
},
{
"name": "B",
"score": 150
},
{
"name": "A",
"score": 200
},
{
"name": "A+",
"score": 300
},
{
"name": "S",
"score": 500
},
{
"name": "SSS",
"score": 1000
}
],
"music": false,
"spNum": [
{
"num": 200,
"spName": "游戏积分",
"ticketType": "start"
},
{
"num": 150,
"spName": "复活积分",
"ticketType": "resurgence"
},
{
"num": 1,
"spName": "直冲云霄积分",
"ticketType": "fly"
},
{
"num": 8,
"spName": "双倍金币续费积分",
"ticketType": "gold_double_renew"
},
{
"num": 33,
"spName": "三倍金币积分",
"ticketType": "gold_triple"
},
{
"num": 21,
"spName": "金身续费积分",
"ticketType": "invincible_renew"
}
]
},
"message": null,
"success": true
}
\ No newline at end of file
{
"success": true,
"code": "ipsum voluptate est pariatur aliqua",
"message": "commodo ipsum tempor",
"data": {
"startId": "77777",
"scorePreRound": -59955755.34276232
}
}
\ No newline at end of file
{
"success": true,
"code": "ipsum voluptate est pariatur aliqua",
"message": "commodo ipsum tempor",
"data": {
"startId": "77777",
"scorePreRound": 1234,
"firstDouble": false,
"firstInvincible": false
}
}
\ No newline at end of file
{
"success": true,
"code": "sed tempor proident Excepteur in",
"message": "magna incididunt",
"data": {
"prizeId": "sp",
"url": "aliquip veniam",
"name": "xxxxx",
"icon": "//yun.duiba.com.cn/spark/assets/9ff9e1f358db0ea9027edaca04247e62fd52b22d.png"
}
}
\ No newline at end of file
{
"success": true,
"code": "labore qui nulla dolor mollit",
"message": "deserunt"
}
\ No newline at end of file
{
"success": true,
"message": "ut ipsum",
"data": "1"
}
\ No newline at end of file
{
"data": 1,
"success": "true",
"message": "Lorem dolore ea aliquip Duis"
}
\ No newline at end of file
{
"code": "000000",
"data": {
"prizeList": [
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i1/676606897/O1CN01LSRArg20osHsZ0WIr_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 1,
"probability": "",
"openId": "AAGMBAINAMTJSjCbJXOUEPSv",
"updateTime": 1599704766652,
"goodId": "616444374083",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599457433502,
"deleteStatus": 1,
"name": "1111",
"rank": "1-5",
"_id": "5f55c899964f9706aac97635",
"stock": "",
"desc": "12"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i4/676606897/O1CN011wSmP820osHsfbQVt_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 2,
"probability": "",
"updateTime": 1599704766657,
"goodId": "619250976552",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599630352681,
"deleteStatus": 1,
"name": "2222",
"rank": "6-10",
"_id": "5f586c10738989c8b3699c36",
"stock": "",
"desc": "请问"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i2/676606897/O1CN01jSu8pl20osHpoItcH_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 3,
"probability": "",
"updateTime": 1599704766662,
"goodId": "619551785682",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599630352691,
"deleteStatus": 1,
"name": "333",
"rank": "11-15",
"_id": "5f586c10ef5071ef85b121d8",
"stock": "",
"desc": "问问"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i4/676606897/O1CN01052oCs20osHpgeJo1_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 4,
"probability": "",
"updateTime": 1599704766667,
"goodId": "619551785682",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599630352702,
"deleteStatus": 1,
"name": "444",
"rank": "16-25",
"_id": "5f586c10114fbb8f6d936a84",
"stock": "",
"desc": "抬头"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i1/676606897/O1CN01Eomi5d20osHqufhQS_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 5,
"probability": "",
"updateTime": 1599704766671,
"goodId": "619250976552",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599631028489,
"deleteStatus": 1,
"name": "5555",
"rank": "26-190",
"_id": "5f586eb40cb7330c942fa945",
"stock": "",
"desc": "55555"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i3/676606897/O1CN01c5dDdr20osHnlbxH8_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 6,
"probability": "",
"updateTime": 1599704766678,
"goodId": "",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599704598695,
"deleteStatus": 1,
"name": "123",
"rank": "191-192",
"_id": "5f598e16e5c0d7361f94443c",
"stock": "",
"desc": "12"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i4/676606897/O1CN018xPsWm20osHsVvmQ4_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 7,
"probability": "",
"updateTime": 1599704766682,
"goodId": "",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599704598700,
"deleteStatus": 1,
"name": "123",
"rank": "193-194",
"_id": "5f598e1685a7496423364b2c",
"stock": "",
"desc": "123"
},
{
"switchStock": 2,
"image": "https://img.alicdn.com/imgextra/i2/676606897/O1CN01ZfJo7d20osHtzfobK_!!676606897-0-miniprogram.jpg",
"useUrl": "",
"level": 8,
"probability": "",
"updateTime": 1599704766687,
"goodId": "",
"type": 3,
"prizeDataType": 1,
"activityId": "5f55c899964f9706aac97634",
"ename": "",
"credits": "",
"createTime": 1599704598706,
"deleteStatus": 1,
"name": "123",
"rank": "195-196",
"_id": "5f598e1667f1376654eb7d4d",
"stock": "",
"desc": "314"
}
],
"detail": {
"userNick": "金刚猫燕",
"rank": 15,
"totalScore": 190
},
"list": [
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "啊大苏打",
"totalScore": 123123
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "qweqwe",
"totalScore": 123123
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "啊实打实的",
"totalScore": 123123
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "趣味请问",
"totalScore": 123123
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "q123123",
"totalScore": 123123
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "啊大苏打",
"totalScore": 3444
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "啊大苏打",
"totalScore": 54345
},
{
"_id": "ea cupidatat occaecat dolor",
"avatar": "deserunt occaecat proident ex Lorem",
"openId": "pariatur",
"userNick": "啊大苏打",
"totalScore": 5663454
}
]
},
"success": true,
"message": "成功"
}
{
"success": true,
"message": "",
"code": "",
"data": {
"ruleIdList": [
"ru_1",
"ru_2",
"ru_3",
"ru_4"
],
"drawStatus": 12,
"prizeId": "aa",
"gameCounts": 1
}
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": 1234
}
\ No newline at end of file
{
"success": true,
"message": "",
"code": "",
"data": {
"type": 1,
"status": 1,
"prize": {
"prizeId": "sp_1",
"prizeType": 1,
"optionId": "sdhjfhjhjjj",
"optionName": "10元话费",
"optionImg": "https://www.baidu.com/xxoo2.png",
"userRecordId": 1235,
"url": "https://www.baidu.com/order/1235"
}
}
}
\ No newline at end of file
{
"success": true,
"message": "",
"data": "<p class=\"p1\">1、什么人可以参与抽奖?</p><p class=\"p1\">同时持有中信银行借记卡和信用卡的客户,活动期间内预约报名(每个自然月均可报名),完成绑定中信银行借记卡并用中信银行手机银行app对本人绑定的信用卡进行自动还款任务即视为达标获得抽奖资格。达标用户将以短信形式通知抽奖。 </p><p>  </p><p class=\"p1\">2、抽奖的时间是什么时候?</p><p class=\"p1\">报名成功次月10日-15日。每期的抽奖资格当期有效,若满足抽奖资格未在有效期内抽奖,资格不保留。首轮达标客户的抽奖开启时间为:7月10-15日。</p><p>  </p><p class=\"p1\">3、活动说明:</p><p class=\"p1\">1)点击“立即抽奖”按钮,摇奖机开始转动,最终摇奖机中间停留的即为您所中的奖品。</p><p class=\"p1\">2)活动期间,每位客户每个自然月均可报名参与活动,预约报名并完成绑定中信银行借记卡并用中信银行手机银行app对本人绑定的信用卡进行自动还款任务即视为达标获得抽奖资格,可获抽奖资格,每位客户每个自然月最多可获一次抽奖机会,请在抽奖有效期内(报名次月10日—15日)通过短信路径或登录手机银行首页——特色服务——还款抽奖——进入页面抽奖,每期的抽奖资格当期有效,若满足抽奖资格未在有效期内抽奖,资格不保留。</p><p class=\"p1\">3)客户抽中的“10元话费”奖励将在当月30日前直接充值到您预留报名的手机号码中,请注意查收;</p><p class=\"p1\">4)大牌券奖励中奖后客户可在活动页面右上角的【我的奖品】中找到,奖品具体使用规则可在奖品详情页查看,大牌权益奖励兑换及使用将会跳转至权益对应的提供方平台,您填写的信息仅用于奖品或权益发放时使用(如姓名、手机号、地址等)。本活动服务由第三方杭州兑吧网络科技有限公司提供,相关责任将由杭州兑吧网络科技有限公司承担,如有问题请咨询该公司客服。中信银行仅为相关活动提供链接服务,不提供任何形式的担保和承诺。大牌券的领取使用有任何问题请致电兑吧客服专线:400-609-0828;</p><p class=\"p1\">5)为保证活动的公平公正,通过不当手段、利用系统漏洞恶意套取奖励等不当途径参与本活动抽奖的客户,中信银行有权终止该客户参与活动的权利并取消其获奖资格;</p><p class=\"p1\">6)凡参与活动的客户,即视为接受活动所有规则,在法律允许范围内,中信银行保留对本次活动的解释权、随时调整本活动优惠信息、变更活动的权利;</p><p class=\"p1\">7)通过本软件参加的任何商业活动,均与Apple Inc.无关;</p><p><span style=\"font-size:10.5ptpx\">8)本次活动授权杭州兑吧网络科技有限公司提供营销服务,若有相关疑问,请致电兑吧客服专线:400-609-0828。</span></p>"
}
\ No newline at end of file
{}
\ No newline at end of file
This diff is collapsed.
/**
* 到时放到Loader里,增加open类型、headers、参数、等等
* @param options
*/
export function ajax(options: ajaxParameterInt) {
/**
* 默认为GET请求
*/
options.type = options.type || "GET";
/**
* 返回值类型默认为json
*/
options.dataType = options.dataType || 'json';
/**
* 默认为异步请求
*/
options.async = options.async === false ? false : true;
/**
* 对需要传入的参数的处理
*/
var params = getParams(options.data);
var xhr: XMLHttpRequest;
/**
* 创建一个 ajax请求
* W3C标准和IE标准
*/
if (window["XMLHttpRequest"]) {
//W3C标准
xhr = new window["XMLHttpRequest"]();
} else if (window["ActiveXObject"]) {
//@ts-ignore IE标准
xhr = new ActiveXObject('Microsoft.XMLHTTP')
} else {
console.error("当前浏览器不支持XHR请求")
return
}
//返回类型
xhr.responseType = options.dataType;
xhr.onreadystatechange = function () {
if (xhr.readyState == 4) {
var status = xhr.status;
if (status >= 200 && status < 300) {
options.success && options.success(xhr.response);
} else {
options.error && options.error(status || "error");
}
}
};
if (options.type == 'GET') {
xhr.open("GET", options.url + '?' + params, options.async);
xhr.send(null)
} else if (options.type == 'POST') {
/**
*打开请求
*/
xhr.open('POST', options.url, options.async);//待测试,post请求
/**
* POST请求设置请求头
*/
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
if (options.headers) {
for (let key in options.headers) {
xhr.setRequestHeader(key, options.headers[key]);
}
}
/**
* 发送请求参数
*/
xhr.send(params);
}
}
/**
* jsonp模拟,不考虑回调
* @param url
* @param params
*/
export function jsonp(url: string, params: any) {
const src = url + '?' + getParams(params);
const scriptEl = document.createElement('script');
scriptEl.src = src;
scriptEl.onload = function () {//docment考虑改成head
document.body.removeChild(scriptEl);
};
scriptEl.onerror = function () {
document.body.removeChild(scriptEl);
};
document.body.appendChild(scriptEl);
}
/**
* 对象参数的处理
* @param data
* @returns {string}
*/
function getParams(data): string {
if (!data) return "";//没有就返回空字符
var arr = [];
for (var param in data) {
arr.push(encodeURIComponent(param) + '=' + encodeURIComponent(data[param]));
}
//不缓存
arr.push('_=' + Date.now());
return arr.join('&');
}
//基本没用到过cache,先不加
interface ajaxParameterInt {
url: string,
data?: any,
type?: "GET" | "POST",
async?: boolean,
dataType?: 'text' | 'json' | 'arraybuffer',
headers?: any,
success?: (res: any) => void,
error?: (err: any) => void
}
/**
* 对封装好的ajax请求进行调用
* */
// ajax({
// url: "", //请求地址
// type: 'GET', //请求方式
// data: { name: 'zhangsan', age: '23', email: '2372734044@qq.com' }, //请求参数
// dataType: "json", // 返回值类型的设定
// async: false, //是否异步
// headers: {},
// success: function (response) {
// console.log(response); // 此处执行请求成功后的代码
// },
// error: function (status) {
// console.log('状态码为' + status); // 此处为执行成功后的代码
// }
// });
import { destroyWaiting } from "./waitingCtrl";
import PanelCtrl from "./panelCtrl";
import SceneCtrl from "./sceneCtrl";
import { destroyToast } from "./toastCtrl";
import ConfirmPanel from "../../src/common/IConfirmPanel";
export { showToast } from "./toastCtrl";
export * from "./waitingCtrl";
/**
* 展示弹框
* @param panel 弹框类
* @param data 数据
*/
export const showPanel = (panel: any, data?: any) => {
return PanelCtrl.instance.show(panel, data)
}
export const showConfirm = (panel: any, data?: any) => {
const confirmPanel: ConfirmPanel = PanelCtrl.instance.show(panel, data);
return confirmPanel.makePromise();
}
/**
* 关闭所有弹框
*/
export const closeAllPanels = () => {
PanelCtrl.instance.closeAll();
}
/**
* 关闭当前弹框
*/
export const closeCurrentPanel = () => {
PanelCtrl.instance.closeCurrent();
}
/**
* 替换场景
* @param scene
* @param data
*/
export const changeScene = (scene: any, data?: any) => {
SceneCtrl.instance.change(scene, data)
}
/**
* 获取当前场景
*/
export function getCurrentScene(): any {
return SceneCtrl.instance.currentScene
}
/**
* 获取当前弹框
*/
export function getCurrentPanel(): any {
return PanelCtrl.instance.currentPanel
}
/**
* 淘宝小程序的alert
* @param {string} title
* @param {string} content
*/
export const showAlert = (title?: string, content?: string) => {
//@ts-ignore
if (my) {
//@ts-ignore
my.alert({
title: title || "",
content: content || ""
});
} else {
console.log(title, content)
}
}
/**
* 替换setTimeout 因为页面销毁时setTimeout不会停
* 所以干脆用Tween的
* @param {Function} callback
* @param {number} time 毫秒计
*/
export function wait(callback: () => void, time: number): {} {
let obj = {};
FYGE.Tween.get(obj)
.wait(time)
.call(callback)
return obj
}
export function clearWait(obj: {}) {
obj && FYGE.Tween.removeTweens(obj);
}
/**
* 递归清除显示对象里面所有的Tween
* @param obj
* @param isRecursive 默认true,递归移除子级
*/
export function removeTweens(obj, isRecursive: boolean = true) {
if (!obj) return
FYGE.Tween.removeTweens(obj);
if (!isRecursive || !obj.children || !obj.children.length) return
obj.children.forEach(child => {
removeTweens(child)
});
}
/**
* 销毁方法
*/
export function destroyAllCtrls() {
destroyToast();
destroyWaiting();
PanelCtrl.instance.destroy();
SceneCtrl.instance.destroy();
}
import { Panel } from "../views/Panel";
import { layers } from "../views/layers";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
export default class PanelCtrl {
/**
* 父级容器
*/
private _parent: FYGE.Container;
/**
* 半透明黑色背景
*/
private _bg: FYGE.Shape;//FYGE.Graphics;
/**
* 所有的弹框
*/
private stacks: Panel[] = [];
private static _instance: PanelCtrl;
static get instance() {
return PanelCtrl._instance || (PanelCtrl._instance = new PanelCtrl())
}
init(parent: FYGE.Container) {
this._parent = parent;
let bg = new FYGE.Shape();//Graphics()//Shape();
bg.beginFill(0);
bg.drawRect(//引用适配
layers.stageOffsetX - parent.x,
layers.stageOffsetY - parent.y,
layers.stageWidth,
layers.stageHeight
);
bg.endFill();
bg.hitTestByPixel = false;
bg.visible = false;
this._parent.addChild(bg);
this._bg = bg;
}
/**
* 关闭所有弹框
*/
closeAll() {
this.stacks.forEach(e => e.hidePanel());
}
show<T extends Panel>(cls: any, data?: any): T {
showWaiting()
const panel: T = new cls(data);
this.add(panel);
this.stacks.push(panel);
panel.onLoaded = () => {
panel.y = -(1624 - layers.stageHeight >> 1)
hideWaiting();
this.updateView(false);//这里更新不显示动画先,自行判断是否显示
//start只执行一边
panel.start(data);
//如果是最后一个才显示动画
if (panel.visible) panel.showAni();
}
//资源加载失败时
panel.onLoadError = () => {
hideWaiting();
showToast("资源加载失败")
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
}
return panel;
}
private bgAni: "hide" | "show";
private updateView(showPanelAni: boolean = true) {
//没有弹框的时候
if (!this.stacks.length) {
// this._bg.visible = false;
// this._current = null;
// this._parent.visible = false;
if (this._bg.visible) {//原先背景存在时,待测试
this.bgAni = "hide"
FYGE.Tween.removeTweens(this._bg);
FYGE.Tween.get(this._bg)
.to({ alpha: 0 }, 200, FYGE.Ease.cubicOut)
.call(() => {
this._bg.visible = false;
this._current = null;
this._parent.visible = false;
})
}
} else {
//显示弹框层
this._parent.visible = true;
if (this.bgAni == "hide") {//如果正在执行蒙层消失动画,
this.bgAni = "show"
FYGE.Tween.removeTweens(this._bg);
this._bg.alpha = 0.7;
}
//如果首次出现弹框,加个动画
if (this._bg.visible === false) {
this._bg.visible = true;
this._bg.alpha = 0;
FYGE.Tween.get(this._bg).to({ alpha: 0.7 }, 200, FYGE.Ease.cubicOut)
}
}
for (let i = 0; i < this.stacks.length; i++) {
if (i < this.stacks.length - 1) {
this.stacks[i].visible = false;
} else {
this.stacks[i].visible = true;
if (showPanelAni) this.stacks[i].showAni();
this._current = this.stacks[i];
}
}
}
/**
* 添加进父级并添加事件
* @param panel
*/
private add(panel: Panel) {
this._parent.addChild(panel);
panel.addEventListener('onDestroy', this.onPanelHide, this);
}
/**
* 移除
* @param panel
*/
private remove(panel: Panel) {
this._parent.removeChild(panel);
this.stacks = this.stacks.filter(e => e != panel);
}
/**
* 弹框移除时执行
* @param e
*/
private onPanelHide(e: FYGE.Event) {
const panel = e.target as Panel;
panel.removeEventListener('onDestroy', this.onPanelHide, this);
this.remove(panel);
this.updateView();
}
//当前弹框
private _current: Panel;
get currentPanel() {
return this._current
}
/**
* 关闭当前弹框
*/
closeCurrent() {
if (this._current) {
this._current.hidePanel();
// this._current.removeEventListener('onDestroy', this.onPanelHide, this);
// this.remove(this._current);
// this.updateView();
}
}
destroy() {
PanelCtrl._instance = null;
this.stacks = null;
this._current = null;
this._parent = null;
FYGE.Tween.removeTweens(this._bg);
this._bg = null;
}
}
\ No newline at end of file
import { Scene } from "../views/Scene";
import { showWaiting, hideWaiting } from "./waitingCtrl";
import { showToast } from "./toastCtrl";
export default class SceneCtrl {
private _parent: FYGE.Container;
private _currentScene: Scene;
private static _instance: SceneCtrl;
static get instance() {
return SceneCtrl._instance || (SceneCtrl._instance = new SceneCtrl())
}
init(parent: FYGE.Container) {
this._parent = parent;
}
change(cls: any, data?: any) {
//如果是同一个场景,考虑是替换还是return
// if (this._currentScene && this._currentScene instanceof cls) return;//new一个得了,playScene维护太蛋疼,到时看性能吧
let scene: Scene = new cls(data);
scene.visible = false;
showWaiting();
let preScene: Scene = this._currentScene;
scene.onLoaded = () => {
hideWaiting();
scene.showAni(() => {
if (preScene) preScene.destroy();
})
scene.visible = true;
//start里可能处理资源信息,所以在onLoaded后执行
scene.start(data);
}
//加载失败,继续用之前的场景,移除scene
scene.onLoadError = () => {
hideWaiting();
showToast("资源加载失败")
this._currentScene = preScene || null;
this._parent.removeChild(scene);
}
this._currentScene = scene;
this._parent.addChild(scene);
}
get currentScene() {
return this._currentScene
}
destroy() {
SceneCtrl._instance = null;
this._currentScene = null;
this._parent = null;
}
}
\ No newline at end of file
import { layers } from "../views/layers";
import { RES } from "../RES";
let inited = false;
let _toast: Toast;
let _parent: FYGE.Container;
let startY: number
let endY: number
const initToast = () => {
if (!inited) {
inited = true;
_toast = new Toast();
_parent = layers.toastLayer;
_toast.alpha = 0;
_toast.x = layers.stageOffsetX - _parent.x + (layers.stageWidth - _toast.width) / 2;
var h = _toast.height;
var y = layers.stageOffsetY - _parent.y;
startY = y - h;
endY = y + (layers.stageHeight - h) / 2;
}
}
export const showToast = (msg: string) => {
initToast();
_toast.show(msg)
_parent.addChild(_toast);
FYGE.Tween.removeTweens(_toast);
FYGE.Tween.get(_toast)//动画看需求
.set({ y: startY, alpha: 1 })
.to({ y: endY }, 500, FYGE.Ease.quartOut)
.wait(800)
.to({ alpha: 0 }, 300)
.call(() => {
_parent.removeChild(_toast);
})
}
/**
* 对于之前淘宝小程序遇到的问题,需要销毁,否则会出问题
*/
export const destroyToast = () => {
if (inited && _toast && !_toast.destroyed) {
_toast.destroy();
_toast = null;
_parent = null;
inited = false;
}
}
/**
* toast类,不对外导出,适配居中有问题,有时间改
* 自身居中,
*/
class Toast extends FYGE.Container {
msg: FYGE.TextField;
bg: FYGE.Sprite;
PADDING = 40;
constructor() {
super();
this.mouseChildren = false;
this.mouseEnable = false;
var toastBgTexture: FYGE.Texture = RES.getRes("toastBg.png");
this.bg = new FYGE.Sprite(toastBgTexture);
// this.bg.x = (750 - 460) / 2// (layers.stageWidth - this.bg.width) / 2
this.addChild(this.bg);
this.msg = new FYGE.TextField();
this.msg.size = 28;
this.msg.fillColor = "0xffffff";
this.msg.text = "";
this.msg.verticalAlign = FYGE.VERTICAL_ALIGN.MIDDLE;
this.msg.textHeight = toastBgTexture.height;
this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
this.addChild(this.msg)
}
/**
* 显示时调用
* @param msg
*/
show(msg: string) {
this.msg.text = msg;
//文本居中适配
this.msg.x = (this.bg.width - this.msg.textWidth) / 2//(layers.stageWidth - this.msg.textWidth) / 2;
//是否需要根据文本宽度缩放背景
// this.bg.width = Math.min(this.msg.textWidth + this.PADDING * 2, 523);
//背景居中适配,由于上面一行注释,那这行就构造函数里只执行一次吧
// this.bg.x = (layers.stageWidth - this.bg.width) / 2
}
destroy() {
FYGE.Tween.removeTweens(this);
super.destroy();
this.msg = null
this.bg = null;
}
}
\ No newline at end of file
import { RES } from "../RES";
import { layers } from "../views/layers";
import { showAlert } from ".";
let inited = false;
let _waiting: Waiting;
let _parent: FYGE.Container
const initWaiting = () => {
if (!inited) {
inited = true;
const waiting = new Waiting();
_parent = layers.topLayer;
_waiting = waiting;
//居中偏移
var offX = (layers.stageWidth - 160/*_waiting.width*/) / 2;
var offY = (layers.stageHeight - _waiting.height) / 2;
//位置适配
_waiting.x = layers.stageOffsetX - _parent.x + offX;
_waiting.y = layers.stageOffsetY - _parent.y + offY;
//阻止事件用
var bg: FYGE.Graphics = new FYGE.Graphics()
.beginFill(0x000000)
.drawRect(-offX, -offY, layers.stageWidth, layers.stageHeight)
.endFill();
bg.alpha = 0;
_waiting.addChildAt(bg, 0);
}
}
/**
* 显示菊花圈
* @param msg 尽量三个字
*/
export const showWaiting = (msg?: string) => {
initWaiting();
_waiting.show(msg)
_parent.addChild(_waiting);
}
/**
* 隐藏菊花圈
*/
export const hideWaiting = () => {
_parent.removeChild(_waiting);
}
export const destroyWaiting = () => {
if (inited && _waiting && !_waiting.destroyed) {
_waiting.destroy();
_waiting = null;
_parent = null;
inited = false;
}
}
/**
* 菊花圈,有机会重写,应该适应所有场景居中
*/
class Waiting extends FYGE.Container {
msg: FYGE.TextField;
constructor() {
super();
//圆角矩形背景
var rectBgTexture: FYGE.Texture = RES.getRes("waitingBg.png")
var rectBg = new FYGE.Sprite(rectBgTexture);
this.addChild(rectBg);
var rotTexture: FYGE.Texture = RES.getRes("waitingRot.png")
let rot = new FYGE.Sprite(rotTexture);
rot.x = (rectBgTexture.width - rotTexture.width) / 2
rot.y = 47//533;
rot.anchorX = rotTexture.width / 2;
rot.anchorY = rotTexture.height / 2;
this.addChild(rot);
let count = 0;
rot.addEventListener(FYGE.Event.ENTER_FRAME, () => {
count++;
if (count % 30 == 0) rot.rotation += 45;
}, this)
this.msg = new FYGE.TextField();
this.msg.y = 125;
this.msg.textWidth = rectBgTexture.width;
this.msg.textAlign = FYGE.TEXT_ALIGN.CENTER;
this.msg.size = 26
this.msg.fillColor = "#ffffff";
this.addChild(this.msg);
}
show(msg: string = "加载中") {
this.msg.text = msg;
}
destroy() {
super.destroy();
this.msg = null;
}
}
const _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
/**
* base64编码汉字,
* 一般用于链接参数传递,
* 先base64.encode,再encodeURIComponent后带入,取参数时会decodeURIComponent,然后再base64.decode后
* 直接调用Base64.ins
*/
export class Base64 {
// private property
// _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
private static instance: Base64;
public static get ins(): Base64 {
if (!this.instance) {
this.instance = new Base64();
}
return this.instance;
}
constructor() {
}
// public method for encoding
encode(input) {
var output = "";
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
var i = 0;
input = this._utf8_encode(input);
while (i < input.length) {
chr1 = input.charCodeAt(i++);
chr2 = input.charCodeAt(i++);
chr3 = input.charCodeAt(i++);
enc1 = chr1 >> 2;
enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
enc4 = chr3 & 63;
if (isNaN(chr2)) {
enc3 = enc4 = 64;
} else if (isNaN(chr3)) {
enc4 = 64;
}
output = output +
_keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
_keyStr.charAt(enc3) + _keyStr.charAt(enc4);
}
return output;
}
// public method for decoding
decode(input) {
var output = "";
var chr1, chr2, chr3;
var enc1, enc2, enc3, enc4;
var i = 0;
input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
while (i < input.length) {
enc1 = _keyStr.indexOf(input.charAt(i++));
enc2 = _keyStr.indexOf(input.charAt(i++));
enc3 = _keyStr.indexOf(input.charAt(i++));
enc4 = _keyStr.indexOf(input.charAt(i++));
chr1 = (enc1 << 2) | (enc2 >> 4);
chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
chr3 = ((enc3 & 3) << 6) | enc4;
output = output + String.fromCharCode(chr1);
if (enc3 != 64) {
output = output + String.fromCharCode(chr2);
}
if (enc4 != 64) {
output = output + String.fromCharCode(chr3);
}
}
output = this._utf8_decode(output);
return output;
}
// private method for UTF-8 encoding
private _utf8_encode(string) {
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
}
// private method for UTF-8 decoding
private _utf8_decode(utftext) {
var string = "";
var i = 0;
var c = 0;
var c2 = 0;
var c3 = 0
while (i < utftext.length) {
c = utftext.charCodeAt(i);
if (c < 128) {
string += String.fromCharCode(c);
i++;
} else if ((c > 191) && (c < 224)) {
c2 = utftext.charCodeAt(i + 1);
string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
i += 2;
} else {
c2 = utftext.charCodeAt(i + 1);
c3 = utftext.charCodeAt(i + 2);
string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
i += 3;
}
}
return string;
}
}
\ No newline at end of file
/**
* 回收池
*/
export class GPool {
private static pool = {};
/**
* 取出
* @param name
*/
public static takeOut(name: string) {
if (this.pool[name] && this.pool[name].length) {
return this.pool[name].shift();
}
return null;
}
/**
* 回收
* @param name
* @param obj
*/
public static recover(name: string, obj) {
if (!this.pool[name]) {
this.pool[name] = [];
}
this.pool[name].push(obj);
}
}
\ No newline at end of file
/**
* 用到的和业务相关的
* 各种静态方法汇总
*
* 获取修改链接参数
* 获取cookie
* 缓存相关
* 数组相关
*
*/
export class GTool {
/**
* 读取缓存
*/
public static readCache(key: string/*, type: string = 'localStorage'*/) {
//@ts-ignore
return my ? my.getStorageSync({ key: key }).data : localStorage ? localStorage.getItem(key) : null;
// if (!window.localStorage) {
// return false;
// }
// return window[type].getItem(key);
}
/**
* 写缓存
*/
public static writeCache(key: string, value: any = 'true'/*, type: string = 'localStorage'*/) {
//@ts-ignore
my ? my.setStorageSync({ key: key, data: value }) : localStorage && localStorage.setItem(key, value);
// if (!window.localStorage) {
// // trace(Func.replace(SysLang.lang_012, [type]));
// return;
// }
// window[type].setItem(key, value);
}
/**
* 获得cacheKey今日次数
* 第二天归0重新计数
* @param cacheKey
*/
public static returnTodayTimes(cacheKey: string): number {
var year1 = this.readCache("year" + cacheKey);
var month1 = this.readCache("month" + cacheKey);
var day1 = this.readCache("day" + cacheKey);
var date = new Date();
var year2 = date.getFullYear().toString();
var month2 = date.getMonth().toString();
var day2 = date.getDate().toString();
if (this.int(year2) <= this.int(year1)) {
if (this.int(month2) <= this.int(month1)) {
if (this.int(day2) <= this.int(day1)) {
return this.int(this.readCache(cacheKey));
}
}
}
//如果不是同一天了,归0
var today = "0";
this.writeCache("year" + cacheKey, year2);
this.writeCache("month" + cacheKey, month2);
this.writeCache("day" + cacheKey, day2);
this.writeCache(cacheKey, today);
return 0;
}
/**
* 随机,两个参数时是数值范围,比如randomT(1,10),一个参数时是数组
* @param e
* @param n
*/
public static randomT(e, n?) {
return e && "number" == typeof e.length && e.length ? e[Math.floor(Math.random() * e.length)] : ("number" != typeof n && (n = e || 1, e = 0), e + Math.random() * (n - e))
}
/**
* 从数组中移除一个元素
* @param e 元素
* @param arr 数组
*/
public static removeEle(e, arr) {
var index = arr.indexOf(e);
if (index >= 0) {
arr.splice(index, 1)
}
}
/**
* 数组中插入一个数值,按顺序的
* 数组是从小到大的
* @param num
* @param arr
*/
public static insert(num, arr) {
for (var i = arr.length - 1; i >= 0; i--) {
if (num > arr[i]) {
//在arr[i]后加num
arr.splice(i + 1, 0, num);
break
}
}
}
/**
* 获取start到end里的n个整数
* @param start 0
* @param end 19
* @param n 3
*/
public static getRandomNumber(start: number, end: number, n: number): number[] {
var arr = [];
for (var i = 0; i < n; i++) {
var number = Math.floor(Math.random() * (end - start + 1) + start);
if (arr.indexOf(number) < 0) {
arr.push(number);
} else {
i--;
}
}
return arr;
}
/**
* 打乱数字数组,改变原数组
* @param arr
*/
public static disturbNumberArr(arr: number[]) {
arr.sort(function () {
return (0.5 - Math.random());
});
}
public static disturbArr(arr: any[]) {
return arr.sort(function () {
return (0.5 - Math.random());
});
}
/**
* 其实打乱数组取前几个就行
* 随机取数组arr中count个元素,不改变原数组
* @param arr
* @param count
*/
public static getRandomArrayElements(arr: any[], count: number) {
var shuffled = arr.slice(0), i = arr.length, min = i - count, temp, index;
//如果count大于等于数组长度,返回所有数组
if (min <= 0) return shuffled;
if (count <= 0) return [];
//随机排序,然后取出后面的元素
while (i-- > min) {
index = Math.floor((i + 1) * Math.random());
temp = shuffled[index];
shuffled[index] = shuffled[i];
shuffled[i] = temp;
}
return shuffled.slice(min);
}
/**
* 随机取数组arr中count个元素,原数组减少count个
* @param arr
* @param count
*/
public static getRandomArrayElementsEx(arr: any[], count: number): any[] {
//如果count大于等于数组长度,返回所有数组
if (arr.length <= count) return arr.slice();
if (count <= 0) return [];
var arrCopy = arr.slice();
var outArr = [];
while (count--) {
var rand = Math.floor(Math.random() * arrCopy.length);
var ele = arrCopy.splice(rand, 1)[0];
outArr.push(ele);
}
return outArr
}
/**
* 向下取整,或把字符串执行parseInt(字符串转数字取整数部分)
* @param n 数字或字符串
*/
private static int(n: any): number {
return n >> 0;//~~n
};
/**
* emoji正则式
*/
public static emojiReg = /[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF][\u200D|\uFE0F]|[\uD83C|\uD83D|\uD83E][\uDC00-\uDFFF]|[0-9|*|#]\uFE0F\u20E3|[0-9|#]\u20E3|[\u203C-\u3299]\uFE0F\u200D|[\u203C-\u3299]\uFE0F|[\u2122-\u2B55]|\u303D|[\A9|\AE]\u3030|\uA9|\uAE|\u3030/ig
/**
* 在字符串间加空格
* @param str
*/
public static addSpaceInString(str: string) {
if (!str.length || str.length == 1) return str;
var txt = "";
//每个字符后加空格
for (var i = 0; i < str.length - 1; i++) {
txt = txt + str[i] + " ";
}
txt = txt + str[str.length - 1]
return txt
}
/**
* 毫秒剩余时间转成时分秒
* 1小时1分1秒
* @param timeStamp
*/
public static getShiFenMiaoByTimeStamp(timeStamp: number) {
var hours: any = Math.floor((timeStamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes: any = Math.floor((timeStamp % (1000 * 60 * 60)) / (1000 * 60));
// var seconds: any = (timeStamp % (1000 * 60)) / 1000;
var seconds: any = Math.floor((timeStamp % (1000 * 60)) / 1000);
hours = hours < 10 ? ('0' + hours) : hours;
minutes = minutes < 10 ? ('0' + minutes) : minutes;
seconds = seconds < 10 && seconds >= 1 ? ('0' + seconds) : seconds;
// return hours + " :" + minutes + " :" + seconds;
return hours + "小时" + minutes + "分" + seconds + "秒";
}
/**
* 获取字符串真实长度,中文算两个
* @param str
*/
static getRealStringLength(str: string): number {
var realLength = 0, len = str.length, charCode = -1;
for (var i = 0; i < len; i++) {
charCode = str.charCodeAt(i);
if (charCode >= 0 && charCode <= 128) realLength += 1;
else realLength += 2;
}
return realLength;
}
/**
* 切字符串
* @param str
* @param realLength
* @param tailStr
*/
static cutStringAcoRealLength(str: string, limit: number, tailStr: string = "...") {
let length = 0;
let out = "";
for (let i of str) {
let charCode = i.charCodeAt(0);
if (charCode >= 0 && charCode <= 128) length += 1;
else length += 2;
if (length <= limit) {
out = out.concat(i);
} else {
out = out.concat(tailStr);
break;
}
}
return out;
}
}
\ No newline at end of file
/////这里集成一些只有web环境才会用到的方法,链接参数,cookie参数等等
let urlParams: { [key: string]: string | true };
/**
* 获取链接参数
* @param key
*/
export function getUrlParams(key: string): string | true {
if (urlParams) return urlParams[key];
urlParams = {};
let search = window.location.search;
try {
search = top.location.search; //尝试获取顶层的链接
} catch (e) {
}
//获取链接参数
for (let item of search.replace('?', '').split('&')) {
let arr = item.split('=');
urlParams[arr[0]] = arr.length === 1 ? true : decodeURIComponent(arr[1]);
}
return urlParams[key];
}
This diff is collapsed.
///////////////////时间相关的方法放这里
/**
* 判断当前时间是否在指定时间区间内,每日,注意没判断起始时间是否肯定小于结束时间
* @param beginTime 形如"9:30","09:30",起始时间
* @param endTime 形如"21:30",结束时间
*/
export function checkAuditDayTime(beginTime: string, endTime: string): boolean {
return !checkBeforeDayTime(beginTime) && checkBeforeDayTime(endTime)
}
/**
* 判断当前时间是否在给定时间前,每天
* 精确到分,有需要自行改造截取方法和setHours传参
* @param time 形如"11:30","09:30",小时 0(午夜) ~ 23(晚上11点),分0 ~ 59 之间,负数或超出,会进行进制换算
* @returns 返回true表示当前时间小于传入时间,即未到传入时间
*/
export function checkBeforeDayTime(time: string): boolean {
var nowDate = new Date();
var timeDate = new Date(nowDate);
var index = time.lastIndexOf("\:");
var hour = time.substring(0, index);
var minue = time.substring(index + 1, time.length);
timeDate.setHours(+hour, +minue, 0, 0);
return nowDate.getTime() < timeDate.getTime()
}
/**
* 毫秒剩余时间转成时分秒,具体格式自行修改
* 01时01分01秒
* @param timeStamp
*/
export function getShiFenMiaoByTimeStamp(timeStamp: number): string {
var hours: any = Math.floor((timeStamp % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes: any = Math.floor((timeStamp % (1000 * 60 * 60)) / (1000 * 60));
var seconds: any = Math.floor((timeStamp % (1000 * 60)) / 1000);
hours = hours < 10 ? ('0' + hours) : hours;
minutes = minutes < 10 ? ('0' + minutes) : minutes;
seconds = seconds < 10 ? ('0' + seconds) : seconds;
// return hours + ":" + minutes + ":" + seconds;
return hours + "时" + minutes + "分" + seconds + "秒";
}
/**
* 根据时间戳返回各种格式,自行修改,到时加枚举
* @param timeStamp 时间戳
* @return 20190606 09:05:33 2019-06-06 09:05:33 2019/06/06 09:05:33 2019年3月12日10时9分29秒
*/
export function getDateTime(timeStamp: number): string {
function add0(m: number) {
return m < 10 ? '0' + m : m
}
var time = new Date(timeStamp);
var y = time.getFullYear();
var m = time.getMonth() + 1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
// return "" + y + add0(m) + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
// return "" + y + '-' + add0(m) + '-' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
// return "" + y + '/' + add0(m) + '/' + add0(d) + ' ' + add0(h) + ':' + add0(mm) + ':' + add0(s);
return y + "年" + m + '月' + d + '日' + h + '时' + mm + '分' + s + '秒'
}
/**
* 日期格式转时间戳
* 时间格式得用/,ios用-有问题,"2019/06/17 00:00:00",,,,ios也不能直接用Number(new Date())
* @param date "2019/06/17 00:00:00" "2019-06-17 00:00:00"
*/
export function getTimeStampByDate(date: string) {
return new Date(date.replace(/-/g, "/")).getTime();
}
/**
* 快速获取年月日时分秒 "2021-02-01 18:32:32"
* @param timeStamp 不传表示当前
*/
export function getDate(timeStamp: number = Date.now()): string {
//有局限性,但是无妨 19暂时年份不会超
return new Date(timeStamp + 8 * 3600 * 1000).toJSON().substr(0, 19).replace("T", " ");
}
/**
* 判断两个时间戳是否为同一天
* @param time1
* @param time2
*/
export function checkSameDay(time1: number, time2: number): boolean {
return new Date(time1).toDateString() === new Date(time2).toDateString()
}
import { ajax } from "../ajax";
// sdk 不能加crossorign
// <script src="https://res.wx.qq.com/open/js/jweixin-1.2.0.js"></script>
// 小程序分享得用这个
// <script src="https://res.wx.qq.com/open/js/jweixin-1.3.2.js"></script>
/**
* 判断是否是微信环境
*/
export function isWxClient() {
var ua = navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) && ua.match(/MicroMessenger/i)[0] == "micromessenger") {
return true;
}
return false;
};
/**
* 初始化微信分享配置
*/
export function initWxConfig(callback?: (s: boolean) => void, debug: boolean = false) {
if (!isWxClient()) {
callback && callback(false)
return;
}
//微信分享,获取分享签名
ajax({
type: 'GET',
url: '/wechatShare/getShareInfo/v2',
data: { url: window.location.href },//有问题再检查链接//部分链接参数会导致初始化失败,以后中文参数用base,%用自定字符替换
dataType: 'json',
success: function (data) {
if (data.success) {
console.log("微信配置获取:")
window["wx"].config({
debug,
appId: data.wxappid,
timestamp: data.wxtimestamp,
nonceStr: data.wxnonceStr,
signature: data.wxsignature,
jsApiList: ['checkJsApi', 'onMenuShareTimeline', 'onMenuShareAppMessage', 'chooseImage']
});
callback && callback(true)
} else {
callback && callback(false)
}
},
error: function (data) {
callback && callback(false)
}
});
}
/**
* 初始化分享信息
* @param title 标题
* @param desc 描述,朋友圈无
* @param link 主域名一致的链接,且是https
* @param imgUrl 图片必须是https
*/
export function initWxShare(
title: string,
desc: string,
link: string,
imgUrl: string
) {
//执行ready可重新设置分享信息
window["wx"].ready(function () {
window["wx"].onMenuShareTimeline({
title,
link,
imgUrl,
success: function (res) {
}
});
//监听“分享给朋友”按钮点击、自定义分享内容及分享结果接口
window["wx"].onMenuShareAppMessage({
title,
desc,
link,
imgUrl,
success: function (res) {
}
});
})
}
//模拟下$ TODO
// 或者引个zepto
// <script crossorigin="anonymous" src="//yun.duiba.com.cn/db_games/libs/zepto_security_downloadApp.min.js"></script>
//易盾的sdk
// <script type="text/javascript" src="//cstaticdun.126.net/load.min.js"></script> -->
var $ = window["$"]
/**
* @note 极验 - 第三方插件
* @author 张晨辰
* @email zcc@duiba.com.cn
* @create 2017-04-19 12:01:45
* @update 2017-06-28 10:06:00
* @des https://www.163yun.com/help/documents/294963579379175424
* @dependencies <script type="text/javascript" src="//c.dun.163yun.com/js/c.js"></script>
* 2.0 <script src="//cstaticdun.126.net/load.min.js"></script> 用下面这个
*/
let captchaIns;
export function initNECaptcha(options) {
if (!options.captchaId) {
return false;
}
$('body').append('<div class="captcha"><div id="check_wrapper" class="neCaptcha-dialog"></div></div>');
var opts = {
element: '#check_wrapper', // 可以是验证码容器id,也可以是HTMLElement
captchaId: options.captchaId, // 这里填入申请到的验证码id
width: options.width || 270, // 验证码组件显示宽度
mode: options.mode || 'embed',
onVerify: function (err, data) {
if (!err) {
$(".captcha").unbind("click");
$('.captcha').remove();
// data.validate = base64.encode(data.validate);
options.callback && options.callback(data);
}
}
}
window["initNECaptcha"] && window["initNECaptcha"](opts, function (instance) {
captchaIns = instance
$(".captcha").click(function (e) {
if (e.target.className == "captcha") {
if (captchaIns) captchaIns.refresh()
}
});
}, function (err) {
console.log(err, 55655665)
//初始化失败,点击黑色区域重新初始
$(".captcha").click(function (e) {
// if (e.target.className == "captcha") {
$(".captcha").unbind("click");
$('.captcha').remove();
initNECaptcha(options)
// }
});
});
window["loading"] && window["loading"].close();
$('.captcha').show();
};
//例子
initNECaptcha({
captchaId: /*Tools.captchId*/111, //a869bfdfb9bd4cdf88e1ff2f8667a114
callback: function (ret) {
console.log(ret.validate)
}
})
/* 易盾css*/
.captcha {
display: none;
position: fixed;
z-index: 10000;
top: 0;
right: 0;
bottom: 0;
left: 0;
background-color: rgba(0, 0, 0, 0.6);
}
.captcha .neCaptcha-dialog {
background-color: #fff;
box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.35);
-webkit-box-shadow: 0 0 8px 0 rgba(0, 0, 0, 0.35);
position: absolute;
left: 50%;
top: 45%;
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
-o-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
-webkit-transform: translate(-50%, -50%);
width: 270px;
height: 134px;
}
.captcha .neCaptcha-dialog::after {
position: absolute;
content: '单次游戏结束,请拖动滑块提交分数';
width: 100%;
height: 30px;
top: -40px;
left: 0;
text-align: center;
line-height: 30px;
font-size: 16px;
color: #ffff00;
}
.captcha .neCaptcha-dialog::before {
background-color: #fff;
content: '';
display: block;
width: 280px;
height: 144px;
position: absolute;
top: -5px;
left: -5px;
z-index: -1;
}
\ No newline at end of file
import { RES } from "../RES";
/**
* 暂时用列表的接口
*/
export class Item extends FYGE.Container implements FYGE.IScrollListItem {
get skinName(): string { return null };
constructor(data?) {
super();
if (this.skinName) RES.initSkinDisplay(this, this.skinName, this);
/*setTimeout(() => {*/ this.initUi(data); /*})*///考虑是否可以不加延时,加了会有问题,自行调用的updateData会先执行,不加的话继承类里initUi里的属性。。。
}
/**
* 自定义的初始布局方法
* 注意声明的变量会覆盖initUi里赋值的变量,
*/
initUi(data?) {
}
/**
* 自行调用的更新数据方法
*/
updateData(data?) {
}
/**
* 滚动列表的数据更新方法
* @param id
* @param data
*/
initData(id: number, data: any): void {
this.id = id;//这两个直接赋值吧
this.data = data;
this.resetData();
}
id: number;
data: any;
/**
* 滚动列表ScrollList里专用
* 重置item里属性及显示对象属性的方法,
* 在每次initData会调用
*/
resetData() {
}
}
import { RES } from "../RES";
import { removeTweens } from "../ctrls";
/**
*
*/
export class Module extends FYGE.Container {
protected data: any;
constructor(data?: any) {
super();
this.data = data;
this.init();
}
/**
* 初始化资源和皮肤
*/
private init() {
this.preLoadRes().then(
() => {
//添加皮肤配置
if (this.skinName) RES.initSkinDisplay(this, this.skinName, this);
this.initUi();
this.onLoaded && this.onLoaded();
},
() => {
this.onLoadError && this.onLoadError();
}
);
}
/**
* 提前加载的资源
*/
protected preLoadRes() {
return new Promise<void>((resolve, reject) => {
if (this.groupNames && this.groupNames.length) {
var arr: Promise<any>[] = [];
for (var i = 0; i < this.groupNames.length; i++) {
arr.push(RES.loadGroup(this.groupNames[i]))
}
// @ts-ignore
Promise.all(arr).then(resolve, reject)
} else {
resolve()
}
})
}
/**
* 初始化ui
* 子类修改
*/
protected initUi() {
}
/**
* 资源加载完成后执行,用于场景及弹框控制
*/
onLoaded: () => void
/**
* 资源加载失败时执行,用于场景及弹框控制
*/
onLoadError: () => void;
/**
* 可以有多个组
*/
get groupNames(): string[] { return null }
/**
* 皮肤名字
*/
get skinName(): string { return null };
/**
* 在构造函数后执行
*/
start(data?: any) {
this.initEvents();
}
/**
* 添加事件
*/
initEvents(): void {
}
/**
* 移除事件
*/
removeEvents(): void {
}
/**
* 鼠标事件
* @param enable
*/
protected enableMouseEvt(enable: boolean): void {
this.mouseEnable = enable;
this.mouseChildren = enable;
}
/**
* 延时防连点
* @param target
* @param {number} delay
*/
protected btnDelay(target, delay = 2000) {
target.mouseEnable = false;
target.mouseChildren = false;
setTimeout(() => {
target.mouseEnable = true;
target.mouseChildren = true;
}, delay);
}
public destroy(): void {
//以防有些地方用了showAni
removeTweens(this);
// this.data = null;//看情况吧,有时候hidePanel后用了data,注意,还是先去掉吧
//移除事件
this.removeEvents();
//派发销毁事件,主要用于场景及弹框控制
this.dispatchEvent("onDestroy");
super.destroy();
}
}
import { Module } from "./Module";
export class Panel extends Module {
protected isShowing: boolean
showAni() {
if (this.isShowing) return;
this.isShowing = true;
let oriY = this.y || 0;
this.y = -200;
FYGE.Tween.get(this)
.to({y: oriY}, 500, FYGE.Ease.quartOut)
.call(() => {
this.isShowing = false;
})
}
initEvents() {
this.closeBtns.forEach(
btn => {
if (btn) btn.addEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
)
}
removeEvents() {
this.closeBtns.forEach(
btn => {
if (btn) btn.removeEventListener(FYGE.MouseEvent.CLICK, this.hidePanel, this)
}
)
}
/**
* 需要的放入,不重复写关闭按钮事件
*/
protected get closeBtns(): any[] {
return [this['closeBtn']]
}
hidePanel() {
this.destroy();
}
}
import { Module } from "./Module";
export class Scene extends Module {
/**
* 显示动画
* 继承时注意,回调要加
* 因为这种动画基本原场景最好不消失
*/
showAni(callback: Function) {
callback()
}
/**
* 统一更新方法
*/
updateScene() {
}
}
\ No newline at end of file
import PanelCtrl from "../ctrls/panelCtrl";
import SceneCtrl from "../ctrls/sceneCtrl";
/**
* 添加进舞台的所有层级
* 仿白鹭的那套
*/
class Layers extends FYGE.Container {
private _bottomLayer: FYGE.Container;
private _sceneLayer: FYGE.Container;
private _popupLayer: FYGE.Container;
private _toastLayer: FYGE.Container;
private _topLayer: FYGE.Container;
private _shareLayer: FYGE.Container;
init(stage: FYGE.Stage) {
stage.addChild(this);
const arr = [
"_bottomLayer",
"_sceneLayer",
"_popupLayer",
"_toastLayer",
"_topLayer",
"_shareLayer"
];
for (let i = 0; i < arr.length; i++) {
this[arr[i]] = new FYGE.Container();
//有些时候,定宽的时候,部分layer置顶,部分居中,再处理
//为了都置顶和置左,stage的方式永远居中视窗,要么改stage永远左上为00
// this[arr[i]].y = this.stageOffsetY;
//如果定宽这里没必要,肯定是0
// this[arr[i]].x = this.stageOffsetX;//去掉,定高时就居中了
this.addChild(this[arr[i]]);
}
//都以顶部适配
// this.sceneLayer.y = this.stageOffsetY;
// this.popupLayer.y = this.stageOffsetY;
//都以底部适配
// this.sceneLayer.y = -this.stageOffsetY;
// this.popupLayer.y = -this.stageOffsetY;
//这个因为psd弹框不规范
// this.popupLayer.y -= 420 / 2;
this.shareLayer.y = -this.stageOffsetY;
//初始化场景层级
SceneCtrl.instance.init(this.sceneLayer);
//初始化弹框层级
PanelCtrl.instance.init(this.popupLayer);
}
/**
* 底图所在层级,比如统一的背景
*/
get bottomLayer() { return this._bottomLayer }
/**
* 场景
*/
get sceneLayer() { return this._sceneLayer }
/**
* 弹框
*/
get popupLayer() { return this._popupLayer }
/**
* toast所在层级
*/
get toastLayer() { return this._toastLayer }
/**
* 顶层,比如统一标题栏等
*/
get topLayer() { return this._topLayer }
/**
* 分享引导层
*/
get shareLayer() { return this._shareLayer }
/**
* 舞台信息都放在layers里吧
* 舞台可见高度,初始化后才能使用
*/
get stageHeight() {
if (!this.stage) return 0;
return this.stage.viewRect.height;
}
/**
* 舞台可见宽度
*/
get stageWidth() {
if (!this.stage) return 0;
return this.stage.viewRect.width;
}
/**
* 适配方式x两边偏移的量,固定宽度x为0
*/
get stageOffsetX() {
if (!this.stage) return 0;
return this.stage.viewRect.x;
}
get stageOffsetY() {
if (!this.stage) return 0;
return this.stage.viewRect.y;
}
/**
* 舞台中心点位置x
*/
// get stageCenterX(): number {
// return this.stage.viewRect.x + this.stage.viewRect.width >> 1;
// }
/**
* 舞台中心点位置y,layer位置做过偏移的就不对了,所以还是自行算吧
*/
// get stageCenterY(): number {
// return this.stage.viewRect.y + this.stage.viewRect.height >> 1;
// }
}
export const layers = new Layers();
//先执行,在淘宝小程序中重新进入会再次初始化
export function destroyLayers() {
//所有层级移除,init会重新建
layers.removeChildren();
//从父级stage移除自己,init会重新加
if (layers.parent) layers.parent.removeChild(layers)
}
This diff is collapsed.
{
"name": "receive_game",
"version": "1.0.0",
"description": "接红包基础模版",
"main": "released/output.js",
"module": "released/output.module.js",
"scripts": {
"dev": "node rollup.dev.mjs -p 8080",
"test": "cd test && npm run testDev",
"build": "npm run handleRes && node scripts/mergeJson && node scripts/upload && npm run buildTS",
"buildTS": "rollup -c rollup.prod.mjs && node scripts/uploadSingleJs",
"handleLotS": "node scripts/handleLotS",
"handleRes": "node scripts/delRel && node scripts/copyRes && node scripts/createTm && node scripts/textureMerge && node scripts/delTm && node scripts/imageMin",
"copyJs": "node scripts/copyJs",
"flushRes": "node scripts/flushRes",
"psd": "node scripts/psdH && node scripts/flushRes",
"psdSin": "node scripts/psdHSin",
"clearSameImg": "node scripts/clearSameImg && node scripts/flushRes",
"createModule": "node scripts/createModule",
"createAllModule": "node scripts/createAllModule"
},
"devDependencies": {
"@babel/core": "^7.18.2",
"@babel/preset-env": "^7.18.2",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-json": "^4.1.0",
"@rollup/plugin-node-resolve": "^13.1.1",
"@rollup/plugin-typescript": "^8.3.0",
"address": "^1.2.0",
"ali-oss": "^4.11.4",
"chalk": "^2.3.0",
"co": "^4.6.0",
"del": "^2.2.1",
"duiba-utils": "^1.0.9",
"form-data": "^4.0.0",
"fs": "0.0.2",
"glslify": "^7.1.1",
"md5": "^2.3.0",
"pack_textures": "^1.1.9",
"path": "^0.12.7",
"progress": "^2.0.0",
"psd": "^3.2.0",
"readline": "^1.3.0",
"rollup": "^2.61.1",
"rollup-plugin-commonjs": "^10.1.0",
"rollup-plugin-glsl-loader": "^1.0.13",
"rollup-plugin-livereload": "^2.0.5",
"rollup-plugin-progress": "^1.1.2",
"rollup-plugin-serve": "^1.1.0",
"rollup-plugin-terser": "^7.0.2",
"tslint": "^5.9.1",
"typescript": "^4.5.4"
},
"author": "haiyoucuv",
"license": "ISC"
}
{
"type": "activity",
"name": "template"
}
\ No newline at end of file
<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<title>new_game_template</title>
<meta name="viewport"
content="width=device-width,initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no"/>
<meta name="apple-mobile-web-app-capable" content="yes"/>
<meta name="full-screen" content="true"/>
<meta name="screen-orientation" content="portrait"/>
<meta name="x5-fullscreen" content="true"/>
<meta name="360-fullscreen" content="true"/>
<!-- polyfill -->
<script src="//yun.duiba.com.cn/db_games/libs0924/polyfill_220525.js" crossorigin="anonymous"></script>
<!-- 渲染引擎 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/fyge2044.min.js" crossorigin="anonymous"></script>
<!--<script src="libs/fyge.min.js" crossorigin="anonymous"></script>-->
<!-- svga解析库 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/svgaParser.minWeb.js" crossorigin="anonymous"></script>
<!-- 放声音的 -->
<script src="//yun.duiba.com.cn/db_games/libs0924/howler.min.js" crossorigin="anonymous"></script>
<style>
html,
body {
padding: 0;
margin: 0;
border: 0;
width: 100%;
height: 100%;
overflow: hidden;
position: absolute;
background-color: #ffffff;
}
#__loading__ {
position: absolute;
left: 50%;
top: 50%;
margin-left: -45px;
color: #ffffff;
}
#cusEngine {
line-height: 0;
font-size: 0;
position: absolute;
}
#canvas {
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<div id="__loading__">拼命加载中...</div>
<div id="cusEngine">
<canvas id="canvas"></canvas>
</div>
<!-- 帧率检测 -->
<!-- <script src="https://yun.duiba.com.cn/db_games/libs0126/stats.js"></script> -->
<script>
const app = {
checkMember: () => {
return false;
}
};
function getApp() {
return app;
}
// document.oncontextmenu = () => false;
</script>
<script>
var CFG = CFG || {};
CFG.projectId = 'pa525eacc';//线上直接写死
CFG.appID = '76177';//线上直接写死
//TODO我的奖品链接
window["recordUrl"] = "fe071865b.html";
window.addEventListener("load", function () {
//获取canvas
var canvas = document.getElementById("canvas");
canvas.width = document.body.clientWidth * (window.devicePixelRatio || 1)
canvas.height = document.body.clientHeight * (window.devicePixelRatio || 1)
var main = new output.Game(canvas);
main.initWebEvent();
window.stage = main.stage
})
</script>
<!-- 构建的js -->
<script src="//yun.duiba.com.cn/db_games/activity/template/1660209753/output.js" crossorigin="anonymous"></script>
</body>
</html>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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