commit
1db2a0abc6
@ -0,0 +1,50 @@ |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# Fireball Projects |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
/library/ |
||||
/temp/ |
||||
/local/ |
||||
/build/ |
||||
|
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# npm files |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
npm-debug.log |
||||
|
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# Logs and databases |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
*.log |
||||
*.sql |
||||
*.sqlite |
||||
|
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# files for debugger |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
*.sln |
||||
*.pidb |
||||
*.suo |
||||
|
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# OS generated files |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
.DS_Store |
||||
ehthumbs.db |
||||
Thumbs.db |
||||
|
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
# WebStorm files |
||||
#///////////////////////////////////////////////////////////////////////////// |
||||
|
||||
.idea/ |
||||
|
||||
#////////////////////////// |
||||
# VS Code files |
||||
#////////////////////////// |
||||
|
||||
.vscode/ |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "cb928088-c2c5-46f1-95ff-747307593471", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "db51b5f4-a5dd-4a14-868d-e031c8030014", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,20 @@ |
||||
import User from "../User/User"; |
||||
import Common5 from "../../Platform/th/Common5"; |
||||
|
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class DaDianScript { |
||||
public static userEnterDaDian() { |
||||
let dateDadian = User.getDadianListGame() |
||||
let gameName = Common5.selectGameInfo.title2 |
||||
|
||||
console.log(gameName, 'gameName') |
||||
if (!dateDadian[gameName]) { |
||||
User.setDadianListGame(gameName, true) |
||||
Common5.ReportDY("inLevel", gameName + "-玩家"); |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "30739fbe-5469-44d8-adb9-5c7098c5b690", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,71 @@ |
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-12-23 11:46:50 |
||||
* @Description: |
||||
*/ |
||||
|
||||
/**************************************************** |
||||
* cc.Component 的扩展 主要增加初始方法 initView_custom __onInit_custom 和 事件 |
||||
*****************************************************/ |
||||
export default abstract class FMComponentExtend extends cc.Component { |
||||
//标记
|
||||
protected __isInit_custom: boolean = false; |
||||
//回调
|
||||
protected _listenerCallView_custom: FMListener; |
||||
//各个节点自定义事件
|
||||
//@ts-ignore
|
||||
protected abstract EventEnumView_custom: { [key: string]: string; } = {} |
||||
//初始方法
|
||||
protected abstract initView_custom(): void; |
||||
|
||||
|
||||
protected onLoad() { |
||||
this.__onInit_custom(); |
||||
} |
||||
|
||||
/** |
||||
* 外部如果需要里面获取onload中执行的属性,需要在方法执行前调用 |
||||
*/ |
||||
protected __onInit_custom() { |
||||
if (!this.__isInit_custom) { |
||||
this.__isInit_custom = true; |
||||
this.initView_custom(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置监听 |
||||
* @param listener
|
||||
*/ |
||||
public onListenerEventView_custom(listener: FMListener) { |
||||
this._listenerCallView_custom = listener; |
||||
} |
||||
|
||||
/** |
||||
* 发送事件 (接收结构为(Event,Node,Data) ) |
||||
* @param event 事件名 @EventEnumView_custom |
||||
* @param data 数据结构 |
||||
*/ |
||||
protected emitListenerEvent_custom(event: string, data?: any, data2?: any) { |
||||
//console.log("发送 " + event)
|
||||
if (this._listenerCallView_custom) { |
||||
callFM_custom(this._listenerCallView_custom, event, this, data, data2); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 判断view 是否激活 |
||||
*/ |
||||
public isActiveView_custom(): boolean { |
||||
if (cc.isValid(this, true) && this.node.activeInHierarchy) { //没有被销毁 && 在场景中是激活的
|
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
//当该组件被销毁时调用
|
||||
protected onDestroy(): void { |
||||
|
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "415e81e4-0fde-41ed-a968-31c1895b0f4f", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,124 @@ |
||||
/* |
||||
* @Descripttion: 基础view base |
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-21 11:49:25 |
||||
*/ |
||||
|
||||
import { FMListener, callFM_custom } from "../Interface/FMInterface"; |
||||
|
||||
export default abstract class FMViewBase extends cc.Component { |
||||
|
||||
//是否初始化
|
||||
protected _isInit_custom: number = 0; |
||||
|
||||
protected _listenerCallView_custom: FMListener; |
||||
|
||||
//各个节点自定义事件
|
||||
public abstract EventEnumView_custom : {}; |
||||
|
||||
|
||||
//------------------------------------------
|
||||
|
||||
protected onLoad() { |
||||
this._initView_custom(); |
||||
} |
||||
|
||||
//初始view的数据 一般如果需要在onLoad前调用该对象中的方法,则手动调用 此方法来实现数据初始化
|
||||
public _initView_custom(): boolean { |
||||
if (this._isInit_custom != 0) { |
||||
return; |
||||
} |
||||
this._isInit_custom = 1; |
||||
this.initView_custom(); |
||||
this.addEvent_custom(); |
||||
this._isInit_custom = 2; |
||||
return true; |
||||
} |
||||
|
||||
|
||||
//初始view 的相关数据 子类中不需要实现 onLoad
|
||||
protected abstract initView_custom(): void; |
||||
|
||||
//添加事件 会在initView方法后执行
|
||||
protected abstract addEvent_custom(): void; |
||||
|
||||
//移除事件 会在 removeView 或 销毁的时候执行
|
||||
protected abstract removeEvent_custom(): void; |
||||
|
||||
//设置监听
|
||||
public onListenerEventView_custom(listener: FMListener) { |
||||
this._listenerCallView_custom = listener; |
||||
} |
||||
|
||||
//发送事件
|
||||
protected emitListenerEvent_custom(event: string) { |
||||
console.log("发送 " + event) |
||||
if (this._listenerCallView_custom) { |
||||
callFM_custom(this._listenerCallView_custom, event, this); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 移除节点 |
||||
*/ |
||||
public removeView_custom(): void { |
||||
this.onDestroy(); |
||||
this.node.destroy(); |
||||
} |
||||
|
||||
/** |
||||
* 隐藏view |
||||
*/ |
||||
public hideView_custom(): void { |
||||
this.node.active = false; |
||||
} |
||||
|
||||
/** |
||||
* 显示view |
||||
*/ |
||||
public showView_custom(): void { |
||||
this.node.active = true; |
||||
} |
||||
|
||||
/** |
||||
* 判断view 是否激活 |
||||
*/ |
||||
public isActiveView_custom(): boolean { |
||||
if (cc.isValid(this, true) && this.node.activeInHierarchy) { //没有被销毁 && 在场景中是激活的
|
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 显示banner |
||||
*/ |
||||
public showBanner_custom() { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 隐藏banner |
||||
*/ |
||||
public hideBanner_custom() { |
||||
|
||||
} |
||||
|
||||
//当该组件被启用,并且它的节点也激活时
|
||||
protected onEnable(): void { |
||||
|
||||
} |
||||
|
||||
//当该组件被禁用或节点变为无效时调用
|
||||
protected onDisable(): void { |
||||
this.hideBanner_custom(); |
||||
} |
||||
|
||||
//当该组件被销毁时调用
|
||||
protected onDestroy(): void { |
||||
this.removeEvent_custom(); |
||||
this.hideBanner_custom(); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "3b1711d8-a454-4327-b0bc-b84fe79b4f41", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,63 @@ |
||||
import Common5 from "../../Platform/th/Common5"; |
||||
import GameReport from "../Report/ZyZyReport"; |
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class WordGameBaseComponent extends cc.Component { |
||||
startDaDianTime: number; |
||||
jsonData = null |
||||
gameName: string = '' |
||||
start(): void { |
||||
let biaoti = this.node.getChildByName('标题') |
||||
if (biaoti) { |
||||
biaoti.active = false |
||||
} |
||||
if (this.node.getChildByName("tipsBtn")) { |
||||
this.node.getChildByName("tipsBtn").active = false; |
||||
} |
||||
if (this.node.getChildByName("GZTipBtn")) { |
||||
this.node.getChildByName("GZTipBtn").active = false; |
||||
} |
||||
|
||||
|
||||
this.startDaDianTime = new Date().getTime(); |
||||
let title = Common5.gameConfig.zmGameConfig[Common5.selectGameNum].title2; |
||||
console.log("start++++++++++++++++++++++++++++++++++++" + title + ":" + this.startDaDianTime); |
||||
this.gameName = title |
||||
|
||||
} |
||||
|
||||
onDestroy(): void { |
||||
let endDaDianTime = new Date().getTime(); |
||||
let time_ = endDaDianTime - this.startDaDianTime |
||||
let times = Math.floor(time_ / 1000) //秒
|
||||
if (times > 0) { |
||||
let title = this.gameName//Common5.gameConfig.zmGameConfig[Common5.selectGameNum].title2;
|
||||
Common5.ReportDYTime("inLevel", title, times); |
||||
//当前关卡
|
||||
GameReport.StayTimeReport(times, Common5.selectGameInfo.titleUrl) |
||||
console.log("end++++++++++++++++++++++++++++++++++++" + title + ":" + times + "s"); |
||||
} |
||||
} |
||||
|
||||
//改变位置
|
||||
changePosi(curNode) { |
||||
|
||||
let HeadNodeList = curNode.getChildByName('HeadNodeList') |
||||
if (HeadNodeList) { |
||||
let posiX = HeadNodeList.getPosition().x |
||||
let posiY = HeadNodeList.getPosition().y |
||||
HeadNodeList.setPosition(posiX, posiY + 55) |
||||
} |
||||
let chadianIconList = curNode.getChildByName('chadianIconList') |
||||
if (chadianIconList) { |
||||
let posiX = chadianIconList.getPosition().x |
||||
let posiY = chadianIconList.getPosition().y |
||||
chadianIconList.setPosition(posiX, posiY + 55) |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "d9715770-d51a-4527-a434-1df6aa95ca6f", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "09948b85-aa30-46c8-a7b0-9bdb0cb0f43e", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,37 @@ |
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-12-21 14:57:35 |
||||
* @Description:
|
||||
*/ |
||||
import SoundMgr from "../Mgr/SoundMgr"; |
||||
|
||||
const { ccclass, property, menu, disallowMultiple, executionOrder, requireComponent } = cc._decorator; |
||||
|
||||
/** |
||||
* 添加一个按钮,并绑定按钮声音 |
||||
* 如果按钮 transition == cc.Button.Transition.NONE |
||||
* 按钮过渡类型为缩放 |
||||
* 缩放值为0.9 |
||||
*/ |
||||
|
||||
@ccclass |
||||
@requireComponent(cc.Button) |
||||
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
||||
@menu('FM组件/FMButton') |
||||
export class FMButton extends cc.Component { |
||||
|
||||
protected onLoad() { |
||||
let but = this.node.getComponent(cc.Button); |
||||
if (but.transition == cc.Button.Transition.NONE) { |
||||
but.transition = cc.Button.Transition.SCALE; |
||||
but.duration = 0.1; |
||||
but.zoomScale = 0.9; |
||||
} |
||||
this.node.on("click", () => { |
||||
// SoundMgr.playSound_custom("anniu");
|
||||
}, this); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "063f2a1e-56d9-4a79-abfb-8dbe206518b3", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,234 @@ |
||||
import Common5 from "../../Platform/th/Common5"; |
||||
|
||||
const { ccclass, menu, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
@menu('FM组件/FMCircuit') |
||||
export default class FMCircuit extends cc.Component { |
||||
@property({ type: cc.Node, tooltip: "链接节点1" }) |
||||
FMCircuit_node1: cc.Node = null; |
||||
@property({ type: cc.Node, tooltip: "链接节点2" }) |
||||
FMCircuit_node2: cc.Node = null; |
||||
|
||||
/**普通轨道1 */ |
||||
circuit1: cc.Node = null; |
||||
/**转折轨道2 */ |
||||
circuit2: cc.Node = null; |
||||
/**普通轨道3 */ |
||||
circuit3: cc.Node = null; |
||||
/**转折轨道4 */ |
||||
circuit4: cc.Node = null; |
||||
/**普通轨道5 */ |
||||
circuit5: cc.Node = null; |
||||
/**当前是否开通轨道 */ |
||||
opean: boolean = false; |
||||
onLoad() { |
||||
this.circuit1 = this.node.getChildByName("1"); |
||||
this.circuit2 = this.node.getChildByName("2"); |
||||
this.circuit3 = this.node.getChildByName("3"); |
||||
this.circuit4 = this.node.getChildByName("4"); |
||||
this.circuit5 = this.node.getChildByName("5"); |
||||
} |
||||
|
||||
start() { |
||||
this.online(); |
||||
} |
||||
/**线链接 */ |
||||
online() { |
||||
if (this.node.name == "circuit19") { |
||||
console.log() |
||||
} |
||||
let angle = Common5.vectorsToDegress(this.FMCircuit_node1.getPosition().sub(this.FMCircuit_node2.getPosition())); |
||||
let node1 = this.FMCircuit_node1; |
||||
let node2 = this.FMCircuit_node2; |
||||
if (angle > 5 && angle < 90) { |
||||
let hi1 = this.circuit1.height; |
||||
let wi1 = this.circuit1.width; |
||||
let hi2 = this.circuit2.height; |
||||
let wi2 = this.circuit2.width; |
||||
let pos1 = cc.v2(node1.x, node1.y - node1.height / 2); |
||||
let pos2 = cc.v2(node2.x, node2.y + node2.height / 2); |
||||
let height1 = Math.abs(pos2.y - pos1.y); |
||||
let height2 = height1 - hi2; |
||||
let scaleh = height2 / hi1; |
||||
let width1 = Math.abs(pos1.x - pos2.x); |
||||
let width2 = width1 - wi2 * 2 + wi1; |
||||
let scalew = width2 / hi1; |
||||
this.circuit1.angle = 0; |
||||
this.circuit1.height *= scaleh / 2; |
||||
this.circuit1.setPosition(pos1.x, pos1.y - this.circuit1.height / 2); |
||||
this.circuit2.angle = 0; |
||||
this.circuit2.setPosition(pos1.x + wi2 / 2 - this.circuit1.width / 2, this.circuit1.y - this.circuit1.height / 2 - this.circuit2.height / 2); |
||||
this.circuit3.angle = -90; |
||||
this.circuit3.height *= scalew; |
||||
this.circuit3.setPosition(this.circuit2.x + wi2 / 2 + this.circuit3.height / 2, this.circuit2.y - hi2 / 2 + wi1 / 2 + 1); |
||||
this.circuit4.angle = 180; |
||||
this.circuit4.scaleX = 1; |
||||
this.circuit4.setPosition(pos2.x - wi2 / 2 + this.circuit1.width / 2, this.circuit3.y - hi2 / 2 + wi1 / 2 + 1); |
||||
this.circuit5.angle = 0; |
||||
this.circuit5.height *= scaleh / 2; |
||||
this.circuit5.setPosition(pos2.x, pos2.y + this.circuit5.height / 2); |
||||
} else if (angle >= 90) { |
||||
let hi1 = this.circuit1.height; |
||||
let wi1 = this.circuit1.width; |
||||
let hi2 = this.circuit2.height; |
||||
let wi2 = this.circuit2.width; |
||||
let k = node2.y > 0 ? 1 : -1; |
||||
let pos1 = cc.v2(node1.x, node1.y - k * node1.height / 2); |
||||
let pos2 = cc.v2(node2.x, node2.y - k * node2.height / 2); |
||||
let width1 = Math.abs(pos1.x - pos2.x); |
||||
let width2 = width1 - wi2 * 2 + wi1; |
||||
let scalew = width2 / hi1; |
||||
this.circuit1.angle = 0; |
||||
this.circuit1.height *= 1; |
||||
this.circuit1.setPosition(pos1.x, pos1.y - k * (this.circuit1.height / 2)); |
||||
this.circuit2.angle = 90 - 90 * k; |
||||
this.circuit2.scaleX = 1 * k; |
||||
this.circuit2.setPosition(pos1.x + wi2 / 2 - this.circuit1.width / 2, this.circuit1.y - k * (this.circuit1.height / 2) - k * (this.circuit2.height / 2)); |
||||
this.circuit3.angle = -90 * k; |
||||
this.circuit3.height *= scalew; |
||||
this.circuit3.setPosition(this.circuit2.x + wi2 / 2 + this.circuit3.height / 2, this.circuit2.y - k * (hi2 / 2) + k * (wi1 / 2 + 1)); |
||||
this.circuit4.angle = 90 - 90 * k; |
||||
this.circuit4.scaleX = -1 * k; |
||||
this.circuit4.setPosition(pos2.x - wi2 / 2 + this.circuit1.width / 2, this.circuit2.y); |
||||
this.circuit5.angle = 0; |
||||
this.circuit5.height *= 1; |
||||
this.circuit5.setPosition(pos2.x, this.circuit1.y); |
||||
} else { |
||||
let hi1 = this.circuit1.height; |
||||
let wi1 = this.circuit1.width; |
||||
let hi2 = this.circuit2.height; |
||||
let wi2 = this.circuit2.width; |
||||
let pos1 = cc.v2(node1.x, node1.y - node1.height / 2); |
||||
let pos2 = cc.v2(node2.x, node2.y + node2.height / 2); |
||||
let height1 = Math.abs(pos2.y - pos1.y); |
||||
let height2 = height1 - hi2; |
||||
let scaleh = height2 / hi1; |
||||
let width1 = Math.abs(pos1.x - pos2.x); |
||||
let width2 = width1 - wi2 * 2 + wi1; |
||||
let scalew = width2 / hi1; |
||||
this.circuit1.angle = 0; |
||||
this.circuit1.height *= Math.round(scaleh / 2); |
||||
this.circuit1.setPosition(pos1.x, pos1.y - this.circuit1.height / 2); |
||||
this.circuit2.scaleX = -1; |
||||
this.circuit2.setPosition(pos1.x - wi2 / 2 + this.circuit1.width / 2, this.circuit1.y - this.circuit1.height / 2 - this.circuit2.height / 2); |
||||
this.circuit3.angle = 90; |
||||
this.circuit3.height *= scalew; |
||||
this.circuit3.setPosition(this.circuit2.x - wi2 / 2 - this.circuit3.height / 2, this.circuit2.y - hi2 / 2 + wi1 / 2 + 1); |
||||
this.circuit4.angle = -180; |
||||
this.circuit4.scaleX = -1; |
||||
this.circuit4.setPosition(pos2.x + wi2 / 2 - hi1 / 2 - 2, this.circuit3.y - hi2 / 2 + wi1 / 2 + 1); |
||||
this.circuit5.angle = 0; |
||||
this.circuit5.height *= Math.round(scaleh / 2); |
||||
this.circuit5.setPosition(pos2.x, pos2.y + this.circuit5.height / 2); |
||||
} |
||||
} |
||||
/** |
||||
* 显示路线 |
||||
* @param bool true 正序显出 false 倒叙显出 |
||||
*/ |
||||
onShow(bool: boolean) { |
||||
this.opean = true; |
||||
let k = 0; |
||||
let sq = []; |
||||
for (let i = 0; i < this.node.childrenCount; i++) { |
||||
let fade = cc.fadeIn(0.5); |
||||
if (i == this.node.childrenCount - 1) { |
||||
sq.push(cc.sequence(fade, cc.callFunc(() => { |
||||
|
||||
}))) |
||||
} else { |
||||
sq.push(fade); |
||||
} |
||||
} |
||||
// if (bool) {
|
||||
this.node.children.forEach((e) => { |
||||
e.runAction(sq[k]); |
||||
k++; |
||||
}) |
||||
// } else {
|
||||
// for (let index = this.node.childrenCount - 1; index >= 0; index--) {
|
||||
// this.node.children[index].runAction(sq[k]);
|
||||
// k++;
|
||||
// }
|
||||
// }
|
||||
} |
||||
/** |
||||
* 隐藏线路 |
||||
* @param bool true 正序隐藏 false 倒叙隐藏 |
||||
*/ |
||||
onHide(bool: boolean) { |
||||
let k = 0; |
||||
let sq = []; |
||||
for (let i = 0; i < this.node.childrenCount; i++) { |
||||
let fade = cc.fadeOut(0.5); |
||||
if (i == this.node.childrenCount - 1) { |
||||
sq.push(cc.sequence(cc.delayTime(0.1), fade, cc.callFunc(() => { |
||||
this.opean = false; |
||||
}))) |
||||
} else if (i == 0) { |
||||
sq.push(fade); |
||||
} else { |
||||
sq.push(cc.sequence(cc.delayTime(0.1), fade)); |
||||
} |
||||
} |
||||
if (bool) { |
||||
this.node.children.forEach((e) => { |
||||
e.runAction(sq[k]); |
||||
k++; |
||||
}) |
||||
} else { |
||||
for (let index = this.node.childrenCount - 1; index >= 0; index--) { |
||||
this.node.children[index].runAction(sq[k]); |
||||
k++; |
||||
} |
||||
} |
||||
} |
||||
/** |
||||
* 赋值当前透明度 |
||||
* @param opacity
|
||||
*/ |
||||
setopacity(opacity: number) { |
||||
this.node.children.forEach(e => { |
||||
e.opacity = opacity; |
||||
}) |
||||
} |
||||
/**获取当前线路位置 */ |
||||
onPosArry(bool): Array<cc.Vec2> { |
||||
let ary = []; |
||||
if (bool) { |
||||
this.node.children.forEach((e, k) => { |
||||
if (k == 1 || k == 3) { |
||||
let pos = e.convertToWorldSpaceAR(cc.v2(0, 0)) |
||||
ary.push(pos); |
||||
} |
||||
}) |
||||
} else { |
||||
for (let index = this.node.childrenCount - 1; index >= 0; index--) { |
||||
if (index == 1 || index == 3) { |
||||
let pos = this.node.children[index].convertToWorldSpaceAR(cc.v2(0, 0)); |
||||
ary.push(pos); |
||||
} |
||||
|
||||
} |
||||
} |
||||
return ary; |
||||
} |
||||
/** |
||||
* 判断是那条线 |
||||
*/ |
||||
onSetCricuit(node1: cc.Node, node2: cc.Node): boolean { |
||||
let k = 0; |
||||
if (node1 == this.FMCircuit_node1 || node1 == this.FMCircuit_node2) { |
||||
k++; |
||||
} |
||||
if (node2 == this.FMCircuit_node1 || node2 == this.FMCircuit_node2) { |
||||
k++; |
||||
} |
||||
if (this.opean) { |
||||
return false; |
||||
} |
||||
return k == 2; |
||||
} |
||||
// update (dt) {}
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "6eada9d8-4ca7-4909-80d8-11ebd6aa127d", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,128 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-18 13:43:03 |
||||
*/ |
||||
|
||||
import FMViewBase from "../Base/FMViewBase"; |
||||
|
||||
|
||||
/* |
||||
* @Descripttion: 自定义滚动容器的预制体layout |
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-18 13:43:03 |
||||
*/ |
||||
const { ccclass, property, requireComponent, disallowMultiple, menu } = cc._decorator; |
||||
|
||||
|
||||
|
||||
@ccclass |
||||
// @requireComponent(cc.ScrollView)
|
||||
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
||||
//@menu('FM组件/FMItemLayout')
|
||||
export default class FMItemLayout extends FMViewBase { |
||||
|
||||
|
||||
@property({ tooltip: "子节点集合", type: [cc.Node] }) |
||||
protected itemChilds: cc.Node[] = []; |
||||
//自定义标签
|
||||
protected ad_tag_custom: any = null; |
||||
|
||||
protected itemIndex_custom: number = 0; |
||||
|
||||
//获取更新当前item的回调
|
||||
private _fmListenerData_custom: FMListener; |
||||
|
||||
//各个节点自定义事件
|
||||
public EventEnumView_custom: {}; |
||||
|
||||
|
||||
/** |
||||
* 设置广告的自定义标签 |
||||
* @param tag
|
||||
*/ |
||||
public setAdTag_custom(tag: any) { |
||||
this.ad_tag_custom = tag; |
||||
} |
||||
|
||||
protected addEvent_custom(): void { |
||||
|
||||
} |
||||
protected removeEvent_custom(): void { |
||||
|
||||
} |
||||
protected initView_custom(): void { |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 设置监听回调 |
||||
* @param _listener
|
||||
*/ |
||||
public setFMListenerUpdate_custom(_listener: FMListener) { |
||||
this._fmListenerData_custom = _listener; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 当前的index |
||||
* @param id
|
||||
*/ |
||||
public setItemIndex_custom(id: number) { |
||||
this.itemIndex_custom = id; |
||||
if (this._fmListenerData_custom) { |
||||
let childSum = this.itemChilds.length; |
||||
for (let index = 0; index < childSum; index++) { |
||||
let sum = this.itemIndex_custom * childSum + index; |
||||
let data = callFM_custom(this._fmListenerData_custom, sum); |
||||
this.updateDataItemByIndex_custom(data, index); |
||||
} |
||||
|
||||
} |
||||
// console.log("更新第几个 " + id);
|
||||
// (this.itemChilds[0].getChildByName("label").getComponent(cc.Label)).string = id + "";
|
||||
} |
||||
|
||||
/** |
||||
* 更新子节点的数据 |
||||
* @param data 数据 |
||||
* @param childIndex 下标 |
||||
*/ |
||||
protected updateDataItemByIndex_custom(data: any, childIndex: number) { |
||||
LogUtils.log_custom("FMItemLayout -> updateDataItemByIndex -> data", data); |
||||
} |
||||
|
||||
/** |
||||
* 获取当前的下标
|
||||
*/ |
||||
public getItemIndex_custom(): number { |
||||
return this.itemIndex_custom; |
||||
} |
||||
|
||||
public getPointX_custom(): number { |
||||
return this.node.x; |
||||
} |
||||
|
||||
public getPointY_custom(): number { |
||||
return this.node.y; |
||||
} |
||||
|
||||
public setPointX_custom(x: number): void { |
||||
this.node.x = x; |
||||
} |
||||
|
||||
public setPointY_custom(y: number): void { |
||||
this.node.y = y; |
||||
} |
||||
|
||||
/** |
||||
* 获取子节点的个数 |
||||
*/ |
||||
public getItemChildrenCount_custom(): number { |
||||
return this.itemChilds.length; |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "8482af9f-5cf5-46a5-b6b3-bcaa59b46416", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,110 @@ |
||||
import Common5 from "../../Platform/th/Common5"; |
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
export enum Axis { |
||||
PositiveX, // 正 X 轴
|
||||
PositiveY, // 正 Y 轴
|
||||
NegativeX, // 负 X 轴
|
||||
NegativeY, // 负 Y 轴
|
||||
} |
||||
@ccclass |
||||
export default class FMRunCircle extends cc.Component { |
||||
@property({ type: cc.Node, tooltip: '围绕旋转的目标' }) |
||||
public target: cc.Node = null; |
||||
|
||||
@property({ tooltip: '顺时针旋转' }) |
||||
public clockwise: boolean = true; |
||||
|
||||
@property({ tooltip: '旋转一圈花费的时间' }) |
||||
public timePerRound: number = 10; |
||||
|
||||
@property({ tooltip: '是否始终面向目标节点' }) |
||||
public faceToTarget: boolean = false; |
||||
|
||||
@property({ |
||||
type: cc.Enum(Axis), |
||||
tooltip: '面向目标节点的轴:\n- PositiveX:正 X 轴\n- PositiveY:正 Y 轴\n- NegativeX:负 X 轴\n- NegativeY:负 Y 轴', |
||||
visible() { return this.faceToTarget } |
||||
}) |
||||
public faceAxis: Axis = Axis.NegativeY; |
||||
|
||||
@property({ tooltip: '自动开始旋转' }) |
||||
public autoStart: boolean = false; |
||||
|
||||
public angle: number = 0; // 角度
|
||||
|
||||
public radius: number = 0; // 半径
|
||||
|
||||
private isRotating: boolean = false; // 标志位,是否正在旋转
|
||||
start() { |
||||
if (this.autoStart) this.run(); |
||||
} |
||||
/** |
||||
* 开始围绕目标节点旋转 |
||||
* @param target 目标节点 |
||||
* @param clockwise 是否顺时针旋转 |
||||
* @param timePerRound 旋转一圈的时间 |
||||
* @param faceToTarget 是否始终面向目标节点 |
||||
* @param faceAxis 面向目标节点的轴 |
||||
*/ |
||||
public run(target?: cc.Node, clockwise?: boolean, timePerRound?: number, faceToTarget?: boolean, faceAxis?: Axis) { |
||||
if (target) this.target = target; |
||||
if (clockwise) this.clockwise = clockwise; |
||||
if (timePerRound) this.timePerRound = timePerRound; |
||||
if (faceToTarget) this.faceToTarget = faceToTarget; |
||||
if (faceAxis) this.faceAxis = faceAxis; |
||||
if (!this.target) { |
||||
cc.log('No target!'); |
||||
return; |
||||
} |
||||
// 计算初始角度和半径
|
||||
this.angle = this.getAngle(this.target.getPosition(), this.node.getPosition()); |
||||
this.radius = Common5.makeDistance(this.target.getPosition(), this.node.getPosition()); |
||||
// 开始
|
||||
this.isRotating = true; |
||||
} |
||||
/** |
||||
* 获取两点间的角度 |
||||
* @param p1 点1 |
||||
* @param p2 点2 |
||||
*/ |
||||
private getAngle(p1: cc.Vec2, p2: cc.Vec2): number { |
||||
return Math.atan(p2.y - p1.y / p2.x - p1.x); |
||||
} |
||||
update(dt: number) { |
||||
if (!this.isRotating || !this.target) return; |
||||
// 将角度转换为弧度
|
||||
let radian = Math.PI / 180 * this.angle; |
||||
// 更新节点的位置
|
||||
this.node.x = this.target.x + this.radius * Math.cos(radian); |
||||
this.node.y = this.target.y + this.radius * Math.sin(radian); |
||||
// 更新节点的角度
|
||||
if (this.faceToTarget) { |
||||
switch (this.faceAxis) { |
||||
case Axis.PositiveX: |
||||
this.node.angle = this.angle + 180; |
||||
break; |
||||
case Axis.PositiveY: |
||||
this.node.angle = this.angle + 90; |
||||
break; |
||||
case Axis.NegativeX: |
||||
this.node.angle = this.angle; |
||||
break; |
||||
case Axis.NegativeY: |
||||
this.node.angle = this.angle - 90; |
||||
break; |
||||
} |
||||
} |
||||
// 计算下一帧的角度
|
||||
let anglePerFrame = dt * (360 / this.timePerRound); |
||||
if (this.clockwise) this.angle -= anglePerFrame; |
||||
else this.angle += anglePerFrame; |
||||
// 重置角度,避免数值过大
|
||||
if (this.angle >= 360) this.angle %= 360; |
||||
else if (this.angle <= -360) this.angle %= -360; |
||||
} |
||||
public stop() { |
||||
this.isRotating = false; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "07652e65-dbdf-4c3f-a29c-88153ccd0735", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,42 @@ |
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class FMRunFollow extends cc.Component { |
||||
/**所要追随的人 */ |
||||
@property({ type: cc.Node, tooltip: '所要追随的人' }) |
||||
public target: cc.Node = null; |
||||
/**移动速率 */ |
||||
@property({ tooltip: "移动速率" }) |
||||
public speed: number = 10; |
||||
/**自动开始跟随 */ |
||||
@property({ tooltip: "自动开始跟随" }) |
||||
public autoStart: boolean = false; |
||||
/**标志位,是否移动 */ |
||||
private isRun: boolean = false; //
|
||||
// onLoad () {}
|
||||
|
||||
start() { |
||||
if (this.autoStart) this.run(); |
||||
} |
||||
public run() { |
||||
this.isRun = true; |
||||
} |
||||
update(dt: number) { |
||||
if (!this.isRun || !this.target) return; |
||||
let X1 = this.target.x - this.node.x; |
||||
let Y1 = this.target.y - this.node.y; |
||||
let x1 = X1 > 0 ? 1 : -1; |
||||
let y1 = Y1 > 0 ? 1 : -1; |
||||
if (Math.abs(X1) < 10) { |
||||
x1 = 0; |
||||
} |
||||
if (Math.abs(Y1) < 10) { |
||||
y1 = 0; |
||||
} |
||||
this.node.y += y1 * this.speed * dt; |
||||
this.node.x += x1 * this.speed * dt; |
||||
} |
||||
public stop() { |
||||
this.isRun = false; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "4c26f465-4acd-46ad-9d75-eedaf35cff50", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,411 @@ |
||||
/* |
||||
* @Descripttion: 循环滚动容器 只支持竖向滚动或横向滚动, |
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-17 10:32:52 |
||||
*/ |
||||
|
||||
import FMTouchMaskView, { SlideDirection, FMTouchEvent } from "./FMTouchMaskView"; |
||||
import { FMListener, callFM_custom, handleFM_custom } from "../Interface/FMInterface"; |
||||
import Utilit from "../Util/Utilit"; |
||||
import FMItemLayout from "./FMItemLayout"; |
||||
|
||||
const { ccclass, property, requireComponent, disallowMultiple, menu } = cc._decorator; |
||||
|
||||
@ccclass |
||||
// @requireComponent(cc.ScrollView)
|
||||
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
||||
//@menu('FM组件/FMScrollViewLoop')
|
||||
export default class FMScrollViewLoop extends FMTouchMaskView { |
||||
|
||||
//是否自动移动
|
||||
@property() |
||||
private _isAutoMoveType: boolean = true; |
||||
@property({ tooltip: "自动滚动", type: cc.Boolean }) |
||||
set isAutoMoveType(val: boolean) { |
||||
this._isAutoMoveType = val; |
||||
} |
||||
get isAutoMoveType() { return this._isAutoMoveType; } |
||||
|
||||
|
||||
//--------------------------------------
|
||||
//广告标签
|
||||
protected ad_tag_custom: any; |
||||
//更新的回调
|
||||
protected fmListenerUpdateData_custom: FMListener; |
||||
|
||||
//layout list
|
||||
protected arrayAliveListLayout_custom: FMItemLayout[] = [] |
||||
//自由的节点
|
||||
protected arrayFreeListLayout_custom: FMItemLayout[] = [] |
||||
|
||||
//一个屏幕中的layout数量
|
||||
private viewLayoutNum_custom: number = 0; |
||||
//超出的个数
|
||||
private viewLayoutGapNum_custom: number = 3; |
||||
//总共的个数
|
||||
private viewLayoutSum_custom: number = 0; |
||||
|
||||
|
||||
//初始的下标
|
||||
private startIndexItem_custom: number = 0; |
||||
//是否可以更新item相关
|
||||
private isCanUpdateItems_custom: boolean = false; |
||||
//点击了 触发停止
|
||||
private isTouchStop_custom: boolean = false; |
||||
//外部需要控制的是否可以update
|
||||
private _isCanScrollViewLoopUpdate_custom: boolean = true; |
||||
|
||||
|
||||
protected isAutoMoveWayLeftUp_custom: boolean = true;//是否自动移动往左或上 还是右或下
|
||||
//自动移动后等待的时间
|
||||
protected autoMoveWaitTime_custom: number = 60; |
||||
//自动移动的一次的距离格子数量 0不启用
|
||||
protected autoMoveWaitNum_custom: number = 1; |
||||
//移动的数据
|
||||
protected autoMoveSpeed_custom: number = 3; |
||||
//
|
||||
|
||||
//当次移动的距离大小
|
||||
private _nextMoveLength_custom: number = 0; |
||||
//当下需要等待的时间
|
||||
private _waitTimeNum_custom: number = 0; |
||||
private _moveState_custom: number = 0;//0正常移动 1等待
|
||||
|
||||
|
||||
|
||||
protected _init_custom(): boolean { |
||||
if (super._init_custom()) { |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
this.viewLayoutNum_custom = Math.ceil(this.node.width / (this.itemPrefabWidth_custom)); |
||||
} else if (this._slideDirection == SlideDirection.VERTICAL) {//垂直
|
||||
this.viewLayoutNum_custom = Math.ceil(this.node.width / (this.itemPrefabHeight_custom)); |
||||
} |
||||
//创建的个数
|
||||
this.viewLayoutSum_custom = this.viewLayoutNum_custom + this.viewLayoutGapNum_custom * 2 |
||||
|
||||
let pos = 0; |
||||
for (let index = 0; index < this.viewLayoutSum_custom; index++) { |
||||
let layoutScript = this.cloneLayout_custom(); |
||||
let layout = layoutScript.node; |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
layout.x = pos; |
||||
layout.y = 0; |
||||
pos = pos + layout.width; |
||||
} else if (this._slideDirection == SlideDirection.VERTICAL) {//垂直
|
||||
layout.x = 0; |
||||
layout.y = pos; |
||||
pos = pos - layout.height |
||||
} |
||||
this.arrayAliveListLayout_custom.push(layoutScript); |
||||
} |
||||
this.isCanUpdateItems_custom = true; |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
/** |
||||
* 外部调用 |
||||
* @param _listener
|
||||
*/ |
||||
public setFMListenerUpdateItem_custom(_listener: FMListener) { |
||||
this.fmListenerUpdateData_custom = _listener; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 设置自动移动的数据 |
||||
* @param way 方向 |
||||
* @param moveWaitNum 移动的格子 0持续 |
||||
* @param waitTime 移动的格子后停顿的时间 s |
||||
* @param speed 速度 |
||||
*/ |
||||
public setAutoData_custom(way: number, moveWaitNum?: number, waitTime?: number, speed?: number, bgColor?: string) { |
||||
this.isAutoMoveWayLeftUp_custom = way == 0 ? true : false; |
||||
this.autoMoveWaitNum_custom = moveWaitNum ? Math.abs(moveWaitNum) : 0; |
||||
this.autoMoveWaitTime_custom = waitTime ? Math.abs(waitTime) * 60 : 60; |
||||
this.autoMoveSpeed_custom = speed ? Math.abs(speed) : 3; |
||||
if (bgColor) { |
||||
this.node.color = Utilit.colorHex2Rgb_custom(bgColor); |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 是否点击了 |
||||
*/ |
||||
public isTouchStopView_custom() { |
||||
return this.isTouchStop_custom; |
||||
} |
||||
|
||||
/** |
||||
* 外部控制是否update |
||||
*/ |
||||
public setCanScrollViewLoopUpdate_custom(_update: boolean) { |
||||
this._isCanScrollViewLoopUpdate_custom = _update; |
||||
} |
||||
|
||||
/** |
||||
* 设置广告的自定义标签 |
||||
* @param tag
|
||||
*/ |
||||
public setAdTag_custom(tag: any) { |
||||
this.ad_tag_custom = tag; |
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
element.setAdTag_custom(this.ad_tag_custom); |
||||
} |
||||
for (let index = 0; index < this.arrayFreeListLayout_custom.length; index++) { |
||||
const element = this.arrayFreeListLayout_custom[index]; |
||||
element.setAdTag_custom(this.ad_tag_custom); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
//外部初始数据
|
||||
public initUpdateItems_custom() { |
||||
this._init_custom(); |
||||
this.startIndexItem_custom = 0; |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
let pos = - this.itemPrefabWidth_custom * 3; |
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
element.setPointX_custom(pos); |
||||
element.setItemIndex_custom(this.startIndexItem_custom + index); |
||||
pos = pos + this.itemPrefabWidth_custom |
||||
} |
||||
} else { //垂直
|
||||
let pos = this.itemPrefabHeight_custom * 3; |
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
element.setPointY_custom(pos); |
||||
element.setItemIndex_custom(this.startIndexItem_custom + index); |
||||
pos = pos - this.itemPrefabHeight_custom |
||||
} |
||||
} |
||||
this._updateNextLengthTime_custom(); |
||||
} |
||||
|
||||
protected update(dt: number): void { |
||||
if (this.isCanUpdateItems_custom && this._isCanScrollViewLoopUpdate_custom) { |
||||
this.updateScrollingItems_custom(); |
||||
if (this.isAutoMoveType == true) {//判断类型是自动移动类型
|
||||
this._updateAutoMove_custom(); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新子节点的数据内容 |
||||
* @param index 第几个大的 |
||||
* @param childIndex 第几个小的 |
||||
*/ |
||||
protected listenerUpdateInitItem_custom(sum: number) { |
||||
if (this.fmListenerUpdateData_custom) { |
||||
let data = callFM_custom(this.fmListenerUpdateData_custom, sum); |
||||
return data; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 自动移动 |
||||
*/ |
||||
public _updateAutoMove_custom() { |
||||
if (this.isTouchStopView_custom()) { |
||||
return; |
||||
} |
||||
if (this._moveState_custom == 0) { |
||||
if (this.isAutoMoveWayLeftUp_custom) { |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
this.content_custom.x = this.content_custom.x - this.autoMoveSpeed_custom |
||||
} else { |
||||
this.content_custom.y = this.content_custom.y + this.autoMoveSpeed_custom |
||||
} |
||||
} else { |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
this.content_custom.x = this.content_custom.x + this.autoMoveSpeed_custom |
||||
} else { |
||||
this.content_custom.y = this.content_custom.y - this.autoMoveSpeed_custom |
||||
} |
||||
} |
||||
if (this.autoMoveWaitNum_custom > 0) {//0 持续移动
|
||||
this._nextMoveLength_custom = this._nextMoveLength_custom - this.autoMoveSpeed_custom; |
||||
if (this._nextMoveLength_custom <= 0) { |
||||
this._moveState_custom = 1; |
||||
} |
||||
} |
||||
} else { |
||||
this._waitTimeNum_custom = this._waitTimeNum_custom + 1; |
||||
if (this._waitTimeNum_custom >= this.autoMoveWaitTime_custom) { |
||||
this._waitTimeNum_custom = 0; |
||||
this._updateNextLengthTime_custom(); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 消息 |
||||
* @param event
|
||||
*/ |
||||
protected _dispatchEvent_custom(event: FMTouchEvent) { |
||||
if (event == FMTouchEvent.Scrolling) { |
||||
//this.updateScrollingItems();
|
||||
} else if (event == FMTouchEvent.TouchStart) { |
||||
this.isTouchStop_custom = true; |
||||
} else if (event == FMTouchEvent.TouchEnded) { |
||||
this._updateNextLengthTime_custom(); |
||||
this.isTouchStop_custom = false; |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 更新下次移动需要的数据 |
||||
*/ |
||||
protected _updateNextLengthTime_custom() { |
||||
if (this.autoMoveWaitNum_custom > 0) { |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
this._nextMoveLength_custom = this.autoMoveWaitNum_custom * this.itemPrefab.data.width |
||||
if (this.isAutoMoveWayLeftUp_custom) { |
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
let vcx = this.content_custom.x + element.node.x; |
||||
if (vcx > -element.node.width && vcx < 0) { |
||||
this._nextMoveLength_custom = this._nextMoveLength_custom + vcx; |
||||
break; |
||||
} |
||||
} |
||||
} else { |
||||
for (let index = this.arrayAliveListLayout_custom.length - 1; index >= 0; index--) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
let vcx = this.content_custom.x + element.node.x; |
||||
if (vcx < this.node.width + element.node.width && vcx > this.node.width) { |
||||
vcx = vcx - this.node.width; |
||||
this._nextMoveLength_custom = this._nextMoveLength_custom - vcx; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} else {//垂直
|
||||
this._nextMoveLength_custom = this.autoMoveWaitNum_custom * this.itemPrefab.data.height |
||||
if (this.isAutoMoveWayLeftUp_custom) { |
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
let vcy = this.content_custom.y + element.node.y; |
||||
if (vcy < element.node.height && vcy > 0) { |
||||
this._nextMoveLength_custom = this._nextMoveLength_custom - vcy; |
||||
break; |
||||
} |
||||
} |
||||
} else { |
||||
for (let index = this.arrayAliveListLayout_custom.length - 1; index >= 0; index--) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
let vcy = this.content_custom.y + element.node.y - element.node.height; |
||||
if (vcy > -(this.node.height + element.node.height) && vcy < -this.node.height) { |
||||
vcy = vcy + this.node.height; |
||||
this._nextMoveLength_custom = this._nextMoveLength_custom + vcy; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
} |
||||
this._waitTimeNum_custom = 0; |
||||
this._moveState_custom = 0; |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
//更新
|
||||
protected updateScrollingItems_custom() { |
||||
let arrayLive: FMItemLayout[] = [] |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) {//水平
|
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
if (this.content_custom.x + element.getPointX_custom() < - this.itemPrefabWidth_custom * 3) {//左 超过三个标准 移除
|
||||
this.addFreeItem_custom(element); |
||||
} else if (element.getPointX_custom() + this.content_custom.x > this.node.width + this.itemPrefabWidth_custom * 3) { //右 超过三个标准 移除
|
||||
this.addFreeItem_custom(element); |
||||
} else { //中间区域 激活
|
||||
arrayLive.push(element); |
||||
} |
||||
} |
||||
if (arrayLive[0].getPointX_custom() + this.content_custom.x > - this.itemPrefabWidth_custom) {//起始的 低于一个标准 创建一个
|
||||
let element = this.getFreeItem_custom(); |
||||
element.setPointX_custom(arrayLive[0].getPointX_custom() - this.itemPrefabWidth_custom); |
||||
element.setItemIndex_custom(arrayLive[0].getItemIndex_custom() - 1) |
||||
arrayLive.splice(0, 0, element); |
||||
element.node.active = true; |
||||
} |
||||
if (arrayLive[arrayLive.length - 1].getPointX_custom() + this.content_custom.x < + this.node.width + this.itemPrefabWidth_custom) {//结尾的 低于一个标准 创建一个
|
||||
const element = this.getFreeItem_custom() |
||||
element.setPointX_custom(arrayLive[arrayLive.length - 1].getPointX_custom() + this.itemPrefabWidth_custom); |
||||
element.setItemIndex_custom(arrayLive[arrayLive.length - 1].getItemIndex_custom() + 1) |
||||
arrayLive.push(element); |
||||
element.node.active = true; |
||||
} |
||||
} else { //垂直
|
||||
for (let index = 0; index < this.arrayAliveListLayout_custom.length; index++) { |
||||
const element = this.arrayAliveListLayout_custom[index]; |
||||
if (element.getPointY_custom() + this.content_custom.y > this.itemPrefabHeight_custom * 3) {//上 超过三个标准 移除
|
||||
this.addFreeItem_custom(element); |
||||
} else if (element.getPointY_custom() < -(this.content_custom.y + this.node.height + this.itemPrefabHeight_custom * 3)) { //下 超过三个标准 移除
|
||||
this.addFreeItem_custom(element); |
||||
} else { //中间区域 激活
|
||||
arrayLive.push(element); |
||||
} |
||||
} |
||||
if (arrayLive[0].getPointY_custom() + this.content_custom.y <= this.itemPrefabHeight_custom) {//起始的 低于一个标准 创建一个
|
||||
let element = this.getFreeItem_custom(); |
||||
element.setPointY_custom(arrayLive[0].getPointY_custom() + this.itemPrefabHeight_custom); |
||||
element.setItemIndex_custom(arrayLive[0].getItemIndex_custom() - 1) |
||||
arrayLive.splice(0, 0, element); |
||||
element.node.active = true; |
||||
} |
||||
if (arrayLive[arrayLive.length - 1].getPointY_custom() >= -(this.content_custom.y + this.node.height + this.itemPrefabHeight_custom)) {//结尾的 低于一个标准 创建一个
|
||||
const element = this.getFreeItem_custom() |
||||
element.setPointY_custom(arrayLive[arrayLive.length - 1].getPointY_custom() - this.itemPrefabHeight_custom); |
||||
element.setItemIndex_custom(arrayLive[arrayLive.length - 1].getItemIndex_custom() + 1) |
||||
arrayLive.push(element); |
||||
element.node.active = true; |
||||
} |
||||
} |
||||
this.arrayAliveListLayout_custom = arrayLive; |
||||
} |
||||
/** |
||||
* 创建一个 |
||||
*/ |
||||
private cloneLayout_custom(): FMItemLayout { |
||||
let layout = cc.instantiate(this.itemPrefab); |
||||
let script = layout.getComponent(FMItemLayout); |
||||
script.setAdTag_custom(this.ad_tag_custom) |
||||
script.setFMListenerUpdate_custom(handleFM_custom(this.listenerUpdateInitItem_custom, this)); |
||||
this.content_custom.addChild(layout); |
||||
return script; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取一个自由节点 |
||||
*/ |
||||
private getFreeItem_custom(): FMItemLayout { |
||||
let element = this.arrayFreeListLayout_custom.pop() |
||||
if (!element) { |
||||
element = this.cloneLayout_custom(); |
||||
} |
||||
return element; |
||||
} |
||||
|
||||
private addFreeItem_custom(item: FMItemLayout) { |
||||
item.node.active = false; |
||||
this.arrayFreeListLayout_custom.push(item); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "685e8f1b-4634-4635-ac31-2e8cdb90774a", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,144 @@ |
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-12-23 11:48:49 |
||||
* @Description: |
||||
*/ |
||||
|
||||
/**************************************************** |
||||
* spine 的封装 主要支持能在ide中自动播放 |
||||
*****************************************************/ |
||||
const { ccclass, property, menu, disallowMultiple, executionOrder, requireComponent, executeInEditMode, playOnFocus } = cc._decorator; |
||||
@ccclass |
||||
@executeInEditMode |
||||
@playOnFocus |
||||
@menu('FM组件/扩展/FMSkeletonExtend') |
||||
export default class FMSkeletonExtend extends sp.Skeleton { |
||||
|
||||
@property() |
||||
private _isEditorPlay_custom: boolean = true; |
||||
@property({ tooltip: "编辑器中自动播放动作\n勾选状态,在选中节点时,帧率60,否则只有必要时才重绘\n非勾选,不自动播放", type: cc.Boolean }) |
||||
set isEditorPlay(val: boolean) { |
||||
this._isEditorPlay_custom = val; |
||||
if (this._isEditorPlay_custom) { |
||||
// let data = this["_skeleton"]["data"];
|
||||
// let events = data["events"];
|
||||
// let eventsName = this["_N$skeletonData"]["_name"] + "事件集合:"
|
||||
// let eventsInfo = "["
|
||||
// for (let index = 0; index < events.length; index++) {
|
||||
// let name = events[index].name;
|
||||
// let stringValue = events[index].stringValue;
|
||||
// if (stringValue == "") {
|
||||
// stringValue = "\"\""
|
||||
// }
|
||||
// if (index != 0) {
|
||||
// eventsInfo = eventsInfo + ","
|
||||
// }
|
||||
// eventsInfo = eventsInfo + name + ":" + stringValue
|
||||
// }
|
||||
// eventsInfo = eventsInfo + "]"
|
||||
|
||||
// Editor.info(eventsName + eventsInfo)
|
||||
} |
||||
} |
||||
get isEditorPlay() { return this._isEditorPlay_custom; } |
||||
|
||||
|
||||
|
||||
@property() |
||||
private _isEditoAttach_custom: boolean = false; |
||||
@property({ tooltip: "编辑器中生成挂点\n勾选状态,生成挂点 ATTACHED_NODE_TREE\n非勾选,不做操作", type: cc.Boolean }) |
||||
set isEditorAttach(val: boolean) { |
||||
this._isEditoAttach_custom = val; |
||||
if (this._isEditoAttach_custom) { |
||||
this["attachUtil"].generateAllAttachedNodes() |
||||
} |
||||
} |
||||
get isEditorAttach() { return this._isEditoAttach_custom; } |
||||
|
||||
|
||||
|
||||
/** |
||||
* 重写update 修改编辑器模式 |
||||
* @param dt
|
||||
*/ |
||||
protected update(dt: number): void { |
||||
if (CC_EDITOR) { |
||||
if (this.isEditorPlay) { |
||||
CC_EDITOR = false; |
||||
super.update(dt); |
||||
CC_EDITOR = true; |
||||
} |
||||
} else { |
||||
super.update(dt); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 打印spine信息 |
||||
*/ |
||||
public dumpSpineInfo_custom(): void { |
||||
let data = this["_skeleton"]["data"]; |
||||
let animations = data["animations"]; |
||||
let events = data["events"]; |
||||
let skins = data["skins"]; |
||||
|
||||
console.group(`spine : 节点 ${this.name} ,动画 <${this["_N$skeletonData"]["_name"]} >`) |
||||
|
||||
let animationsName = "动作集合:" |
||||
let animationsInfo = "[" |
||||
for (let index = 0; index < animations.length; index++) { |
||||
let name = animations[index].name; |
||||
if (index != 0) { |
||||
animationsInfo = animationsInfo + "," |
||||
} |
||||
animationsInfo = animationsInfo + name; |
||||
} |
||||
animationsInfo = animationsInfo + "]" |
||||
|
||||
let eventsName = "事件集合:" |
||||
let eventsInfo = "[" |
||||
for (let index = 0; index < events.length; index++) { |
||||
let name = events[index].name; |
||||
let stringValue = events[index].stringValue; |
||||
if (stringValue == "") { |
||||
stringValue = "\"\"" |
||||
} |
||||
if (index != 0) { |
||||
eventsInfo = eventsInfo + "," |
||||
} |
||||
eventsInfo = eventsInfo + name + ":" + stringValue |
||||
} |
||||
eventsInfo = eventsInfo + "]" |
||||
|
||||
let skinsName = "皮肤集合:" |
||||
let skinsInfo = "[" |
||||
for (let index = 0; index < skins.length; index++) { |
||||
let name = skins[index].name; |
||||
if (index != 0) { |
||||
skinsInfo = skinsInfo + "," |
||||
} |
||||
skinsInfo = skinsInfo + name |
||||
} |
||||
skinsInfo = skinsInfo + "]" |
||||
|
||||
|
||||
console.log( |
||||
`%c ${animationsName} %c ${animationsInfo} `, |
||||
'background: #35495E;padding: 1px;border-radius: 2px 0 0 2px;color: #fff;', |
||||
'background: #409EFF;padding: 1px;border-radius: 0 2px 2px 0;color: #fff;' |
||||
); |
||||
console.log( |
||||
`%c ${eventsName} %c ${eventsInfo} `, |
||||
'background: #35495E;padding: 1px;border-radius: 2px 0 0 2px;color: #fff;', |
||||
'background: #409EFF;padding: 1px;border-radius: 0 2px 2px 0;color: #fff;' |
||||
); |
||||
console.log( |
||||
`%c ${skinsName} %c ${skinsInfo} `, |
||||
'background: #35495E;padding: 1px;border-radius: 2px 0 0 2px;color: #fff;', |
||||
'background: #409EFF;padding: 1px;border-radius: 0 2px 2px 0;color: #fff;' |
||||
); |
||||
|
||||
console.groupEnd() |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "9e048f6f-72c6-4b42-b71b-2dbf0ba731a6", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,197 @@ |
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-12-23 11:50:28 |
||||
* @Description: |
||||
*/ |
||||
|
||||
import FMSkeletonExtend from "./FMSkeletonExtend"; |
||||
import FMComponentExtend from "../Base/FMComponentExtend"; |
||||
import SoundMgr from "../Mgr/SoundMgr"; |
||||
|
||||
/**************************************************** |
||||
* spine对象的处理 |
||||
*****************************************************/ |
||||
const { ccclass, property, menu, disallowMultiple, executionOrder, requireComponent, executeInEditMode, playOnFocus } = cc._decorator; |
||||
@ccclass |
||||
@requireComponent(FMSkeletonExtend) |
||||
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
||||
@menu('FM组件/FMSpine') |
||||
export default class FMSpine extends FMComponentExtend { |
||||
|
||||
//当前的spine
|
||||
private spine: FMSkeletonExtend; |
||||
//事件的集合
|
||||
private arrayEvent: Array<{ "name": string, "listener": FMListener }> = []; |
||||
|
||||
//槽对应的节点
|
||||
private arraySlotEvent: {} = {}; |
||||
|
||||
protected EventEnumView_custom: { [key: string]: string; } = {}; |
||||
|
||||
protected initView_custom() { |
||||
//事件 监听
|
||||
this.getSpine().setEventListener((trackEntry, event) => { |
||||
let animation = trackEntry.animation; |
||||
let animationName = trackEntry.animation.name; |
||||
let eventName = event.data && event.data.name; |
||||
let eventStringValue = event.stringValue; |
||||
let eventIntValue = event.intValue; |
||||
let eventFloatValue = event.floatValue; |
||||
|
||||
if (eventName == "sound") {//声音事件
|
||||
SoundMgr.playSpineSound_custom(eventStringValue, animationName); |
||||
} |
||||
this.arrayEvent.forEach(element => { |
||||
let name = element.name; |
||||
let listener = element.listener; |
||||
if (name == eventName) { |
||||
callFM_custom(listener, animation, animationName, eventName); |
||||
} |
||||
}); |
||||
}); |
||||
|
||||
//this.spine.dumpSpineInfo_custom();
|
||||
|
||||
//this.getSpine().debugBones = true;
|
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加槽的受影响动作及对应添加的子节点 |
||||
* @param slotName 槽名字 |
||||
* @param arrarAction 所受影响的动作 |
||||
* @param childNode 动作里的自定义子节点 |
||||
*/ |
||||
addSlotByNodeEvent(slotName: string, arrarAction: string[], childNode: cc.Node[]) { |
||||
this.arraySlotEvent[slotName] = { |
||||
"slot": this.getSpine().findSlot(slotName), |
||||
"arrayAction": arrarAction, |
||||
"childNode": childNode |
||||
} |
||||
// console.log(slotName)
|
||||
// console.log(this.getSpine().findSlot(slotName))
|
||||
} |
||||
/** |
||||
* 添加事件监听 |
||||
* @param eventName 事件的名字 |
||||
* @param listener 事件的回调 |
||||
*/ |
||||
addEvent(eventName: string, listener: FMListener) { |
||||
this.arrayEvent.push({ |
||||
"name": eventName, |
||||
"listener": listener |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 移除所有的事件监听 |
||||
*/ |
||||
removeEventAll() { |
||||
this.arrayEvent = []; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 当前播放的动画名称 |
||||
*/ |
||||
animation(): string { |
||||
return this.getSpine().animation |
||||
} |
||||
|
||||
/** |
||||
* 当前骨骼中所有动画的时间缩放率 |
||||
* @param scale
|
||||
*/ |
||||
setTimeScale(scale: number) { |
||||
this.getSpine().timeScale = scale; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取spine对象 |
||||
*/ |
||||
getSpine(): FMSkeletonExtend { |
||||
if (this.spine == null) { |
||||
this.spine = this.node.getComponent(FMSkeletonExtend) |
||||
} |
||||
return this.spine; |
||||
} |
||||
|
||||
update(dt: number) { |
||||
// for (const key in this.arraySlotEvent) {
|
||||
// if (this.arraySlotEvent.hasOwnProperty(key)) {
|
||||
// const element = this.arraySlotEvent[key];
|
||||
// let slot = element.slot
|
||||
// let arrayAction: string[] = element.arrayAction;
|
||||
// let childNode: cc.Node[] = element.childNode;
|
||||
// for (let index = 0; index < arrayAction.length; index++) {
|
||||
// const actionName = arrayAction[index];
|
||||
// if (this.getSpine().animation != actionName) {//不一样
|
||||
// childNode.forEach(element2 => {
|
||||
// element2.active = false;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// for (const key in this.arraySlotEvent) {
|
||||
// if (this.arraySlotEvent.hasOwnProperty(key)) {
|
||||
// const element = this.arraySlotEvent[key];
|
||||
// let slot = element.slot
|
||||
// let arrayAction: string[] = element.arrayAction;
|
||||
// let childNode: cc.Node[] = element.childNode;
|
||||
// for (let index = 0; index < arrayAction.length; index++) {
|
||||
// const actionName = arrayAction[index];
|
||||
// if (this.getSpine().animation == actionName) {//不一样
|
||||
// childNode.forEach(element2 => {
|
||||
// element2.active = true;
|
||||
|
||||
// element2.x = slot.bone.worldX;
|
||||
// element2.y = slot.bone.worldY;
|
||||
// element2.scaleX = slot.bone.scaleX;
|
||||
// element2.scaleY = slot.bone.scaleY;
|
||||
// element2.angle = slot.bone.getWorldRotationX();
|
||||
|
||||
// element2.color = cc.color(slot.color.r * 255, slot.color.g * 255, slot.color.b * 255);
|
||||
// element2.opacity = slot.color.a * 255;
|
||||
// });
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//this.getSpine()
|
||||
// vconsole.min.js:11 `cc.Node.rotationX` is deprecated since v2.1.0, please set `eulerAngles` instead. (`this.node.rotationX = x` -> `this.node.is3DNode = true; this.node.eulerAngles = cc.v3(x, 0, 0)`
|
||||
|
||||
} |
||||
|
||||
/** |
||||
* 设置当前动画。队列中的任何的动画将被清除 |
||||
* @param name 动画名字 |
||||
* @param loop 是否循环 |
||||
* @param trackIndex 队列 |
||||
*/ |
||||
setAnimation(name: string, loop: boolean = false, trackIndex: number = 0) { |
||||
this.getSpine().setAnimation(trackIndex, name, loop); |
||||
} |
||||
|
||||
/** |
||||
* 为所有关键帧设定混合及混合时间(从当前值开始差值)。 |
||||
* @param fromAnimation 开始动作 |
||||
* @param toAnimation 结束动作 |
||||
* @param duration 时间
|
||||
*/ |
||||
setMix(fromAnimation: string, toAnimation: string, duration: number) { |
||||
this.getSpine().setMix(fromAnimation, toAnimation, duration); |
||||
} |
||||
|
||||
/** |
||||
* 按名称查找皮肤,激活该皮肤 |
||||
* @param skinName
|
||||
*/ |
||||
setSkin(skinName: string) { |
||||
this.getSpine().setSkin(skinName); |
||||
} |
||||
|
||||
} |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "4b1a852c-e611-42c6-b75c-25b905334c3d", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,396 @@ |
||||
|
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
import FMItemLayout from "./FMItemLayout"; |
||||
|
||||
|
||||
1./* |
||||
* @Descripttion: 自定义带遮罩的容器,里面包含一个 content节点 |
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-17 16:52:59 |
||||
*/ |
||||
|
||||
const { ccclass, property, requireComponent, disallowMultiple, menu, } = cc._decorator; |
||||
|
||||
const EPSILON = 1e-4; |
||||
//滑动的方向
|
||||
export enum SlideDirection { |
||||
HORIZONTAL = 1,//水平滚动
|
||||
VERTICAL = 2//垂直滚动
|
||||
} |
||||
|
||||
export enum FMTouchEvent { |
||||
TouchStart = "touch_start", |
||||
Scrolling = "scrolling", |
||||
TouchEnded = "touch_ended" |
||||
} |
||||
|
||||
|
||||
|
||||
@ccclass |
||||
@disallowMultiple() //防止多个相同类型(或子类型)的组件被添加到同一个节点
|
||||
//@menu("FM组件/FMTouchMaskView")
|
||||
export default class FMTouchMaskView extends cc.Component { |
||||
|
||||
//layout预制体
|
||||
@property({ tooltip: "layout预制体(0,1)", type: cc.Prefab }) |
||||
public itemPrefab: cc.Prefab = null; |
||||
|
||||
//滑动模式
|
||||
@property() |
||||
protected _slideDirection: SlideDirection = SlideDirection.HORIZONTAL; |
||||
@property({ type: cc.Enum(SlideDirection), tooltip: "滚动方向:\n HORIZONTAL 水平滚动\nVERTICAL垂直滚动" }) |
||||
set slideDirection(val: SlideDirection) { |
||||
this._slideDirection = val; |
||||
} |
||||
get slideDirection() { return this._slideDirection; } |
||||
|
||||
//-----------------------------------
|
||||
|
||||
private _tempPoint_custom = cc.v2(); |
||||
private _tempPrevPoint_custom = cc.v2(); |
||||
private _outOfBoundaryAmount_custom = cc.v2(0, 0); |
||||
private _outOfBoundaryAmountDirty_custom = true; |
||||
//是否初始化过 标签
|
||||
private _inited_custom: boolean = false; |
||||
|
||||
//-------------------------
|
||||
//是否移动
|
||||
protected _touchMoved_custom = false; |
||||
//如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。* 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。
|
||||
protected cancelInnerEvents_custom = true; |
||||
//预制的宽高
|
||||
protected itemPrefabWidth_custom: number = 0; |
||||
protected itemPrefabHeight_custom: number = 0; |
||||
//滚动区域
|
||||
protected content_custom: cc.Node; |
||||
|
||||
//预制体的脚本
|
||||
private scriptItemPrefab_custom: FMItemLayout; |
||||
|
||||
protected onLoad() { |
||||
this._init_custom(); |
||||
} |
||||
|
||||
/** |
||||
* 初始 |
||||
*/ |
||||
protected _init_custom(): boolean { |
||||
if (this._inited_custom) { |
||||
//是否初始化过
|
||||
return false; |
||||
} |
||||
let widget = this.node.getComponent(cc.Widget); |
||||
if (widget) { |
||||
widget.updateAlignment(); |
||||
} |
||||
|
||||
//遮罩
|
||||
let view: cc.Node = new cc.Node(); |
||||
view.anchorX = 0; |
||||
view.anchorY = 1; |
||||
let viewWidget = view.addComponent(cc.Widget); |
||||
viewWidget.top = 0; |
||||
viewWidget.left = 0; |
||||
viewWidget.right = 0; |
||||
viewWidget.bottom = 0; |
||||
viewWidget.isAlignTop = true; |
||||
viewWidget.isAlignLeft = true; |
||||
viewWidget.isAlignRight = true; |
||||
viewWidget.isAlignBottom = true; |
||||
this.node.addChild(view); |
||||
viewWidget.updateAlignment(); |
||||
let mash = view.addComponent(cc.Mask); |
||||
mash.type = cc.Mask.Type.RECT; |
||||
|
||||
//显示面板 滚动节点
|
||||
this.content_custom = new cc.Node(); |
||||
view.addChild(this.content_custom); |
||||
this.content_custom.width = view.width; |
||||
this.content_custom.height = view.height; |
||||
this.content_custom.anchorX = 0; |
||||
this.content_custom.anchorY = 1; |
||||
this.content_custom.x = 0; |
||||
this.content_custom.y = 0; |
||||
|
||||
|
||||
this.itemPrefabWidth_custom = this.itemPrefab.data.width; |
||||
this.itemPrefabHeight_custom = this.itemPrefab.data.height; |
||||
|
||||
this.scriptItemPrefab_custom = this.itemPrefab.data.getComponent(FMItemLayout); |
||||
if (!this.scriptItemPrefab_custom) { |
||||
LogUtils.error_custom("FMTouchMaskView -> _init -> scriptItemPrefab is null"); |
||||
} else { |
||||
if (this.scriptItemPrefab_custom.getItemChildrenCount_custom() == 0) { |
||||
LogUtils.error_custom("FMTouchMaskView -> _init -> scriptItemPrefab item child count ==0"); |
||||
} |
||||
} |
||||
|
||||
this._inited_custom = true; |
||||
return true; |
||||
} |
||||
|
||||
protected _dispatchEvent_custom(name: FMTouchEvent) { |
||||
console.log("FMTouchMaskView -> _dispatchEvent -> name", name); |
||||
} |
||||
|
||||
/** |
||||
* 如果这个属性被设置为 true,那么滚动行为会取消子节点上注册的触摸事件,默认被设置为 true。*
|
||||
* 注意,子节点上的 touchstart 事件仍然会触发,触点移动距离非常短的情况下 touchmove 和 touchend 也不会受影响。 |
||||
* @param inner
|
||||
*/ |
||||
public setCancelInnerEvents_custom(inner: boolean) { |
||||
this.cancelInnerEvents_custom = inner; |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 按下 |
||||
* @param touch |
||||
*/ |
||||
protected handlePressLogic_custom(touch: cc.Touch) { |
||||
this._dispatchEvent_custom(FMTouchEvent.TouchStart); |
||||
} |
||||
|
||||
/** |
||||
* 移动 |
||||
* @param touch |
||||
*/ |
||||
protected handleMoveLogic_custom(touch: cc.Touch) { |
||||
let deltaMove = this.getLocalAxisAlignDelta_custom(touch); |
||||
deltaMove = this.clampDelta_custom(deltaMove); |
||||
let realMove = deltaMove; |
||||
let outOfBoundary = this.getHowMuchOutOfBoundary_custom(realMove); |
||||
realMove = realMove.add(outOfBoundary); |
||||
|
||||
if (realMove.x !== 0 || realMove.y !== 0) { |
||||
this._moveContent_custom(realMove); |
||||
this._dispatchEvent_custom(FMTouchEvent.Scrolling); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 释放 |
||||
* @param touch |
||||
*/ |
||||
protected handleReleaseLogic_custom(touch: cc.Touch) { |
||||
let delta = this.getLocalAxisAlignDelta_custom(touch); |
||||
|
||||
this._dispatchEvent_custom(FMTouchEvent.TouchEnded); |
||||
} |
||||
|
||||
|
||||
private _flattenVectorByDirection_custom(vector) { |
||||
let result = vector; |
||||
result.x = this._slideDirection == SlideDirection.HORIZONTAL ? result.x : 0; |
||||
result.y = this._slideDirection == SlideDirection.VERTICAL ? result.y : 0; |
||||
return result; |
||||
} |
||||
|
||||
private _moveContent_custom(deltaMove) { |
||||
let adjustedMove = this._flattenVectorByDirection_custom(deltaMove); |
||||
let newPosition = this.getContentPosition_custom().add(adjustedMove); |
||||
this.setContentPosition_custom(newPosition); |
||||
} |
||||
|
||||
// Contains node angle calculations
|
||||
private getLocalAxisAlignDelta_custom(touch): cc.Vec2 { |
||||
this.node.convertToNodeSpaceAR(touch.getLocation(), this._tempPoint_custom); |
||||
this.node.convertToNodeSpaceAR(touch.getPreviousLocation(), this._tempPrevPoint_custom); |
||||
return this._tempPoint_custom.sub(this._tempPrevPoint_custom); |
||||
} |
||||
|
||||
//this is for nested scrollview
|
||||
private _hasNestedViewGroup_custom(event: cc.Event.EventTouch, captureListeners) { |
||||
if (event.eventPhase !== cc.Event.CAPTURING_PHASE) return; |
||||
|
||||
if (captureListeners) { |
||||
//captureListeners are arranged from child to parent
|
||||
for (let i = 0; i < captureListeners.length; ++i) { |
||||
let item = captureListeners[i]; |
||||
|
||||
if (this.node === item) { |
||||
if (event.target.getComponent(cc.ViewGroup)) { |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
if (item.getComponent(cc.ViewGroup)) { |
||||
return true; |
||||
} |
||||
} |
||||
} |
||||
return false; |
||||
} |
||||
//This is for Scrollview as children of a Button
|
||||
private _stopPropagationIfTargetIsMe_custom(event) { |
||||
if (event.eventPhase === cc.Event.AT_TARGET && event.target === this.node) { |
||||
event.stopPropagation(); |
||||
} |
||||
} |
||||
|
||||
// touch event handler
|
||||
private _onTouchBegan_custom(event: cc.Event.EventTouch, captureListeners) { |
||||
if (!this.enabledInHierarchy) return; |
||||
if (this._hasNestedViewGroup_custom(event, captureListeners)) return; |
||||
|
||||
let touch = event.touch; |
||||
if (this.content_custom) { |
||||
this.handlePressLogic_custom(touch); |
||||
} |
||||
this._touchMoved_custom = false; |
||||
this._stopPropagationIfTargetIsMe_custom(event); |
||||
} |
||||
|
||||
private _onTouchMoved_custom(event: cc.Event.EventTouch, captureListeners) { |
||||
if (!this.enabledInHierarchy) return; |
||||
if (this._hasNestedViewGroup_custom(event, captureListeners)) return; |
||||
|
||||
let touch = event.touch; |
||||
if (!this.node["_hitTest"](touch.getLocation(), this.node)) {//过滤掉不在区域内移动
|
||||
return; |
||||
} |
||||
|
||||
|
||||
if (this.content_custom) { |
||||
this.handleMoveLogic_custom(touch); |
||||
} |
||||
// Do not prevent touch events in inner nodes
|
||||
|
||||
if (!this.cancelInnerEvents_custom) { |
||||
return; |
||||
} |
||||
|
||||
let deltaMove = touch.getLocation().sub(touch.getStartLocation()); |
||||
//FIXME: touch move delta should be calculated by DPI.
|
||||
if (deltaMove.mag() > 7) { |
||||
if (!this._touchMoved_custom) { |
||||
// && event.target !== this.node
|
||||
// Simulate touch cancel for target node
|
||||
let cancelEvent = new cc.Event.EventTouch( |
||||
event.getTouches(), |
||||
event.bubbles |
||||
); |
||||
cancelEvent.type = cc.Node.EventType.TOUCH_CANCEL; |
||||
cancelEvent.touch = event.touch; |
||||
cancelEvent["simulate"] = true; |
||||
event.target.dispatchEvent(cancelEvent); |
||||
this._touchMoved_custom = true; |
||||
} |
||||
} |
||||
this._stopPropagationIfTargetIsMe_custom(event); |
||||
} |
||||
|
||||
private _onTouchEnded_custom(event: cc.Event.EventTouch, captureListeners) { |
||||
if (!this.enabledInHierarchy) return; |
||||
if (this._hasNestedViewGroup_custom(event, captureListeners)) return; |
||||
|
||||
let touch = event.touch; |
||||
if (this.content_custom) { |
||||
this.handleReleaseLogic_custom(touch); |
||||
} |
||||
if (this._touchMoved_custom) { |
||||
event.stopPropagation(); |
||||
} else { |
||||
this._stopPropagationIfTargetIsMe_custom(event); |
||||
} |
||||
} |
||||
|
||||
private _onTouchCancelled_custom(event, captureListeners) { |
||||
if (!this.enabledInHierarchy) return; |
||||
if (this._hasNestedViewGroup_custom(event, captureListeners)) return; |
||||
|
||||
// Filte touch cancel event send from self
|
||||
if (!event.simulate) { |
||||
let touch = event.touch; |
||||
if (this.content_custom) { |
||||
this.handleReleaseLogic_custom(touch); |
||||
} |
||||
} |
||||
this._stopPropagationIfTargetIsMe_custom(event); |
||||
} |
||||
private clampDelta_custom(delta) { |
||||
if (this._slideDirection == SlideDirection.HORIZONTAL) { |
||||
delta.y = 0; |
||||
} else if (this._slideDirection == SlideDirection.VERTICAL) { |
||||
delta.x = 0; |
||||
} |
||||
|
||||
|
||||
return delta; |
||||
} |
||||
|
||||
|
||||
private getHowMuchOutOfBoundary_custom(addition) { |
||||
addition = addition || cc.v2(0, 0); |
||||
if (addition.fuzzyEquals(cc.v2(0, 0), EPSILON) && !this._outOfBoundaryAmountDirty_custom) { |
||||
return this._outOfBoundaryAmount_custom; |
||||
} |
||||
|
||||
let outOfBoundaryAmount = cc.v2(0, 0); |
||||
if (addition.fuzzyEquals(cc.v2(0, 0), EPSILON)) { |
||||
this._outOfBoundaryAmount_custom = outOfBoundaryAmount; |
||||
this._outOfBoundaryAmountDirty_custom = false; |
||||
} |
||||
|
||||
outOfBoundaryAmount = this.clampDelta_custom(outOfBoundaryAmount); |
||||
|
||||
return outOfBoundaryAmount; |
||||
} |
||||
|
||||
|
||||
private getContentPosition_custom() { |
||||
return this.content_custom.getPosition(); |
||||
} |
||||
private setContentPosition_custom(position) { |
||||
if (position.fuzzyEquals(this.getContentPosition_custom(), EPSILON)) { |
||||
return; |
||||
} |
||||
|
||||
this.content_custom.setPosition(position); |
||||
this._outOfBoundaryAmountDirty_custom = true; |
||||
} |
||||
|
||||
|
||||
onEnable() { |
||||
this._registerEvent_custom(); |
||||
} |
||||
|
||||
onDisable() { |
||||
this._unregisterEvent_custom(); |
||||
} |
||||
|
||||
//private methods
|
||||
private _registerEvent_custom() { |
||||
this.node.on(cc.Node.EventType.TOUCH_START, this._onTouchBegan_custom, this, true); |
||||
this.node.on(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved_custom, this, true); |
||||
this.node.on(cc.Node.EventType.TOUCH_END, this._onTouchEnded_custom, this, true); |
||||
this.node.on( |
||||
cc.Node.EventType.TOUCH_CANCEL, |
||||
this._onTouchCancelled_custom, |
||||
this, |
||||
true |
||||
); |
||||
} |
||||
|
||||
private _unregisterEvent_custom() { |
||||
this.node.off( |
||||
cc.Node.EventType.TOUCH_START, |
||||
this._onTouchBegan_custom, |
||||
this, |
||||
true |
||||
); |
||||
this.node.off(cc.Node.EventType.TOUCH_MOVE, this._onTouchMoved_custom, this, true); |
||||
this.node.off(cc.Node.EventType.TOUCH_END, this._onTouchEnded_custom, this, true); |
||||
this.node.off( |
||||
cc.Node.EventType.TOUCH_CANCEL, |
||||
this._onTouchCancelled_custom, |
||||
this, |
||||
true |
||||
); |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "74f62090-9805-4daa-aacd-bed295f5c76a", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "a5df2832-90fb-4f34-af9f-572ee3c7f5f0", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,47 @@ |
||||
//遮罩实现的进度条,cocos自带的进度条是九宫格缩放的
|
||||
|
||||
const {ccclass, property, menu} = cc._decorator; |
||||
|
||||
@ccclass |
||||
@menu("UI/MaskProgress") |
||||
export default class MaskProgress extends cc.Component { |
||||
|
||||
@property(cc.Node) |
||||
iconFolowed: cc.Node = null; |
||||
|
||||
@property(cc.Label) |
||||
labelProgress: cc.Label = null; |
||||
|
||||
public get progress() |
||||
{ |
||||
return this._progress; |
||||
} |
||||
|
||||
public set progress(value: number) |
||||
{ |
||||
if (this.flag) |
||||
{ |
||||
if (value < 1) this.flag = false; |
||||
return; |
||||
} |
||||
if (value > 1) { value = 1; this.flag = true; } |
||||
this._progress = value; |
||||
if (this.maskNode) |
||||
{ |
||||
this.maskNode.width = Math.floor(value * this.node.width); |
||||
if (this.iconFolowed) this.iconFolowed.x = this.maskNode.x + this.maskNode.width; |
||||
if (this.labelProgress) this.labelProgress.string = Math.floor(value * 100) + "%"; |
||||
} |
||||
} |
||||
|
||||
private _progress: number; |
||||
private maskNode: cc.Node; |
||||
private flag: boolean = false; |
||||
|
||||
onLoad() |
||||
{ |
||||
this.maskNode = this.node.children[0]; |
||||
this.progress = 0; |
||||
if (this.labelProgress) this.labelProgress.string = "0%"; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "2a8d459f-b51b-4a4b-93c6-a78953ed5325", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,516 @@ |
||||
[ |
||||
{ |
||||
"__type__": "cc.Prefab", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"_native": "", |
||||
"data": { |
||||
"__id__": 1 |
||||
}, |
||||
"optimizationPolicy": 0, |
||||
"asyncLoadAssets": false, |
||||
"readonly": false |
||||
}, |
||||
{ |
||||
"__type__": "cc.Node", |
||||
"_name": "maskProgress", |
||||
"_objFlags": 0, |
||||
"_parent": null, |
||||
"_children": [ |
||||
{ |
||||
"__id__": 2 |
||||
}, |
||||
{ |
||||
"__id__": 9 |
||||
} |
||||
], |
||||
"_active": true, |
||||
"_components": [ |
||||
{ |
||||
"__id__": 12 |
||||
}, |
||||
{ |
||||
"__id__": 13 |
||||
}, |
||||
{ |
||||
"__id__": 14 |
||||
} |
||||
], |
||||
"_prefab": { |
||||
"__id__": 15 |
||||
}, |
||||
"_opacity": 255, |
||||
"_color": { |
||||
"__type__": "cc.Color", |
||||
"r": 255, |
||||
"g": 255, |
||||
"b": 255, |
||||
"a": 255 |
||||
}, |
||||
"_contentSize": { |
||||
"__type__": "cc.Size", |
||||
"width": 300, |
||||
"height": 15 |
||||
}, |
||||
"_anchorPoint": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0.5, |
||||
"y": 0.5 |
||||
}, |
||||
"_trs": { |
||||
"__type__": "TypedArray", |
||||
"ctor": "Float64Array", |
||||
"array": [ |
||||
375, |
||||
-367, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
1, |
||||
1, |
||||
1, |
||||
1 |
||||
] |
||||
}, |
||||
"_eulerAngles": { |
||||
"__type__": "cc.Vec3", |
||||
"x": 0, |
||||
"y": 0, |
||||
"z": 0 |
||||
}, |
||||
"_skewX": 0, |
||||
"_skewY": 0, |
||||
"_is3DNode": false, |
||||
"_groupIndex": 0, |
||||
"groupIndex": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Node", |
||||
"_name": "New Node", |
||||
"_objFlags": 0, |
||||
"_parent": { |
||||
"__id__": 1 |
||||
}, |
||||
"_children": [ |
||||
{ |
||||
"__id__": 3 |
||||
} |
||||
], |
||||
"_active": true, |
||||
"_components": [ |
||||
{ |
||||
"__id__": 6 |
||||
}, |
||||
{ |
||||
"__id__": 7 |
||||
} |
||||
], |
||||
"_prefab": { |
||||
"__id__": 8 |
||||
}, |
||||
"_opacity": 255, |
||||
"_color": { |
||||
"__type__": "cc.Color", |
||||
"r": 255, |
||||
"g": 255, |
||||
"b": 255, |
||||
"a": 255 |
||||
}, |
||||
"_contentSize": { |
||||
"__type__": "cc.Size", |
||||
"width": 300, |
||||
"height": 15 |
||||
}, |
||||
"_anchorPoint": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0, |
||||
"y": 0.5 |
||||
}, |
||||
"_trs": { |
||||
"__type__": "TypedArray", |
||||
"ctor": "Float64Array", |
||||
"array": [ |
||||
-150, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
1, |
||||
1, |
||||
1, |
||||
1 |
||||
] |
||||
}, |
||||
"_eulerAngles": { |
||||
"__type__": "cc.Vec3", |
||||
"x": 0, |
||||
"y": 0, |
||||
"z": 0 |
||||
}, |
||||
"_skewX": 0, |
||||
"_skewY": 0, |
||||
"_is3DNode": false, |
||||
"_groupIndex": 0, |
||||
"groupIndex": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Node", |
||||
"_name": "bar", |
||||
"_objFlags": 0, |
||||
"_parent": { |
||||
"__id__": 2 |
||||
}, |
||||
"_children": [], |
||||
"_active": true, |
||||
"_components": [ |
||||
{ |
||||
"__id__": 4 |
||||
} |
||||
], |
||||
"_prefab": { |
||||
"__id__": 5 |
||||
}, |
||||
"_opacity": 255, |
||||
"_color": { |
||||
"__type__": "cc.Color", |
||||
"r": 255, |
||||
"g": 255, |
||||
"b": 255, |
||||
"a": 255 |
||||
}, |
||||
"_contentSize": { |
||||
"__type__": "cc.Size", |
||||
"width": 297.3, |
||||
"height": 15 |
||||
}, |
||||
"_anchorPoint": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0, |
||||
"y": 0.5 |
||||
}, |
||||
"_trs": { |
||||
"__type__": "TypedArray", |
||||
"ctor": "Float64Array", |
||||
"array": [ |
||||
1.362, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
1, |
||||
1, |
||||
1, |
||||
1 |
||||
] |
||||
}, |
||||
"_eulerAngles": { |
||||
"__type__": "cc.Vec3", |
||||
"x": 0, |
||||
"y": 0, |
||||
"z": 0 |
||||
}, |
||||
"_skewX": 0, |
||||
"_skewY": 0, |
||||
"_is3DNode": false, |
||||
"_groupIndex": 0, |
||||
"groupIndex": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Sprite", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 3 |
||||
}, |
||||
"_enabled": true, |
||||
"_materials": [ |
||||
{ |
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" |
||||
} |
||||
], |
||||
"_srcBlendFactor": 770, |
||||
"_dstBlendFactor": 771, |
||||
"_spriteFrame": { |
||||
"__uuid__": "67e68bc9-dad5-4ad9-a2d8-7e03d458e32f" |
||||
}, |
||||
"_type": 1, |
||||
"_sizeMode": 0, |
||||
"_fillType": 0, |
||||
"_fillCenter": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0, |
||||
"y": 0 |
||||
}, |
||||
"_fillStart": 0, |
||||
"_fillRange": 0, |
||||
"_isTrimmedMode": true, |
||||
"_atlas": null, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.PrefabInfo", |
||||
"root": { |
||||
"__id__": 1 |
||||
}, |
||||
"asset": { |
||||
"__id__": 0 |
||||
}, |
||||
"fileId": "66Itlj2ZBBI6EamqhEZ2da", |
||||
"sync": false |
||||
}, |
||||
{ |
||||
"__type__": "cc.Mask", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 2 |
||||
}, |
||||
"_enabled": true, |
||||
"_materials": [ |
||||
{ |
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" |
||||
} |
||||
], |
||||
"_spriteFrame": null, |
||||
"_type": 0, |
||||
"_segments": 64, |
||||
"_N$alphaThreshold": 0, |
||||
"_N$inverted": false, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Widget", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 2 |
||||
}, |
||||
"_enabled": true, |
||||
"alignMode": 1, |
||||
"_target": null, |
||||
"_alignFlags": 8, |
||||
"_left": 0, |
||||
"_right": 0, |
||||
"_top": 0, |
||||
"_bottom": 0, |
||||
"_verticalCenter": 0, |
||||
"_horizontalCenter": 0, |
||||
"_isAbsLeft": true, |
||||
"_isAbsRight": true, |
||||
"_isAbsTop": true, |
||||
"_isAbsBottom": true, |
||||
"_isAbsHorizontalCenter": true, |
||||
"_isAbsVerticalCenter": true, |
||||
"_originalWidth": 0, |
||||
"_originalHeight": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.PrefabInfo", |
||||
"root": { |
||||
"__id__": 1 |
||||
}, |
||||
"asset": { |
||||
"__id__": 0 |
||||
}, |
||||
"fileId": "58Up/p08lBA5gT6ZhxeEWo", |
||||
"sync": false |
||||
}, |
||||
{ |
||||
"__type__": "cc.Node", |
||||
"_name": "New Sprite(Splash)", |
||||
"_objFlags": 0, |
||||
"_parent": { |
||||
"__id__": 1 |
||||
}, |
||||
"_children": [], |
||||
"_active": true, |
||||
"_components": [ |
||||
{ |
||||
"__id__": 10 |
||||
} |
||||
], |
||||
"_prefab": { |
||||
"__id__": 11 |
||||
}, |
||||
"_opacity": 255, |
||||
"_color": { |
||||
"__type__": "cc.Color", |
||||
"r": 154, |
||||
"g": 154, |
||||
"b": 154, |
||||
"a": 255 |
||||
}, |
||||
"_contentSize": { |
||||
"__type__": "cc.Size", |
||||
"width": 30, |
||||
"height": 30 |
||||
}, |
||||
"_anchorPoint": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0.5, |
||||
"y": 0.5 |
||||
}, |
||||
"_trs": { |
||||
"__type__": "TypedArray", |
||||
"ctor": "Float64Array", |
||||
"array": [ |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
0, |
||||
1, |
||||
1, |
||||
1, |
||||
1 |
||||
] |
||||
}, |
||||
"_eulerAngles": { |
||||
"__type__": "cc.Vec3", |
||||
"x": 0, |
||||
"y": 0, |
||||
"z": 0 |
||||
}, |
||||
"_skewX": 0, |
||||
"_skewY": 0, |
||||
"_is3DNode": false, |
||||
"_groupIndex": 0, |
||||
"groupIndex": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Sprite", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 9 |
||||
}, |
||||
"_enabled": true, |
||||
"_materials": [ |
||||
{ |
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" |
||||
} |
||||
], |
||||
"_srcBlendFactor": 770, |
||||
"_dstBlendFactor": 771, |
||||
"_spriteFrame": { |
||||
"__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" |
||||
}, |
||||
"_type": 0, |
||||
"_sizeMode": 0, |
||||
"_fillType": 0, |
||||
"_fillCenter": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0, |
||||
"y": 0 |
||||
}, |
||||
"_fillStart": 0, |
||||
"_fillRange": 0, |
||||
"_isTrimmedMode": true, |
||||
"_atlas": null, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.PrefabInfo", |
||||
"root": { |
||||
"__id__": 1 |
||||
}, |
||||
"asset": { |
||||
"__id__": 0 |
||||
}, |
||||
"fileId": "7asdN+4j1NAroV7VSVDXHL", |
||||
"sync": false |
||||
}, |
||||
{ |
||||
"__type__": "cc.Sprite", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 1 |
||||
}, |
||||
"_enabled": true, |
||||
"_materials": [ |
||||
{ |
||||
"__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" |
||||
} |
||||
], |
||||
"_srcBlendFactor": 770, |
||||
"_dstBlendFactor": 771, |
||||
"_spriteFrame": { |
||||
"__uuid__": "88e79fd5-96b4-4a77-a1f4-312467171014" |
||||
}, |
||||
"_type": 1, |
||||
"_sizeMode": 0, |
||||
"_fillType": 0, |
||||
"_fillCenter": { |
||||
"__type__": "cc.Vec2", |
||||
"x": 0, |
||||
"y": 0 |
||||
}, |
||||
"_fillStart": 0, |
||||
"_fillRange": 0, |
||||
"_isTrimmedMode": true, |
||||
"_atlas": null, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "2a8d4WftRtKS5PGp4lT7VMl", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 1 |
||||
}, |
||||
"_enabled": true, |
||||
"iconFolowed": { |
||||
"__id__": 9 |
||||
}, |
||||
"labelProgress": null, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.Widget", |
||||
"_name": "", |
||||
"_objFlags": 0, |
||||
"node": { |
||||
"__id__": 1 |
||||
}, |
||||
"_enabled": true, |
||||
"alignMode": 1, |
||||
"_target": null, |
||||
"_alignFlags": 16, |
||||
"_left": 0, |
||||
"_right": 0, |
||||
"_top": 0, |
||||
"_bottom": 0, |
||||
"_verticalCenter": 0, |
||||
"_horizontalCenter": 0, |
||||
"_isAbsLeft": true, |
||||
"_isAbsRight": true, |
||||
"_isAbsTop": true, |
||||
"_isAbsBottom": true, |
||||
"_isAbsHorizontalCenter": true, |
||||
"_isAbsVerticalCenter": true, |
||||
"_originalWidth": 0, |
||||
"_originalHeight": 0, |
||||
"_id": "" |
||||
}, |
||||
{ |
||||
"__type__": "cc.PrefabInfo", |
||||
"root": { |
||||
"__id__": 1 |
||||
}, |
||||
"asset": { |
||||
"__id__": 0 |
||||
}, |
||||
"fileId": "", |
||||
"sync": false |
||||
} |
||||
] |
@ -0,0 +1,9 @@ |
||||
{ |
||||
"ver": "1.3.2", |
||||
"uuid": "5052e03d-cf12-40ce-a504-271dc8ee052c", |
||||
"importer": "prefab", |
||||
"optimizationPolicy": "AUTO", |
||||
"asyncLoadAssets": false, |
||||
"readonly": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,15 @@ |
||||
//宽度自适应
|
||||
const {ccclass, property} = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class WidthAdaptor extends cc.Component {
|
||||
|
||||
protected onLoad(): void { |
||||
|
||||
let canvas = cc.Canvas.instance; |
||||
let ratioWidth = cc.visibleRect.width / canvas.designResolution.width; |
||||
if (ratioWidth >= 1) return; |
||||
this.node.scale = ratioWidth * this.node.scale; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "01b77900-68c8-46c1-8cc5-e4794c0016e9", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,14 @@ |
||||
//宽度自适应
|
||||
const {ccclass, property} = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class WidthAdaptor extends cc.Component {
|
||||
|
||||
protected onLoad(): void { |
||||
|
||||
let canvas = cc.Canvas.instance; |
||||
let ratioWidth = cc.visibleRect.width / canvas.designResolution.width; |
||||
this.node.scale = ratioWidth * this.node.scale; |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "e26d5be3-f908-4796-863c-5dd0b7de9bc4", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "e6ea0fe0-7a3d-474e-9fe7-93d6b914c795", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,153 @@ |
||||
|
||||
/** |
||||
* App 相关配置 |
||||
*/ |
||||
export default class AppConfig { |
||||
public static readonly GameName_custom = "";//游戏名称
|
||||
|
||||
|
||||
//是否不使用RYSDK(自己后台) 目前只有在微信平台才能启用,其他平台不无效.
|
||||
//true:强制关闭,不使用自己后台,false 使用系统默认配置
|
||||
public static readonly closeUseRYSDK_custom: boolean = false; |
||||
|
||||
|
||||
//区分微信 qq平台,因为用的都是微信的包,0微信 2qq 需要修改
|
||||
public static readonly isWX_TT_QQ_MiniGame_custom: number = 0; |
||||
|
||||
|
||||
//--设置各自游戏的appId
|
||||
public static readonly TT_APP_ID_custom = "ttad4fdbf23245032202";//抖音 app id
|
||||
public static readonly WX_APP_ID_custom = "ttad4fdbf23245032202";//微信 app id
|
||||
public static readonly QQ_APP_ID_custom = "ttad4fdbf23245032202";//QQ app id
|
||||
public static readonly VIVO_APP_ID_custom = "ttad4fdbf23245032202";//vivo app id
|
||||
public static readonly OPPO_APP_ID_custom = "ttad4fdbf23245032202";//opop app id
|
||||
public static readonly APK_APP_ID_custom = "ttad4fdbf23245032202";//Android app id
|
||||
|
||||
//--设置各自游戏的gameid
|
||||
public static readonly TT_gameid_custom: number = -1; |
||||
public static readonly WX_gameid_custom: number = -1; |
||||
public static readonly QQ_gameid_custom: number = -1; |
||||
public static readonly VIVO_gameid_custom: number = -1; |
||||
public static readonly OPPO_gameid_custom: number = -1; |
||||
public static readonly APK_gameid_custom: number = -1; |
||||
|
||||
|
||||
//--设置各自游戏的 资源服务器地址
|
||||
public static TT_ResServer_custom: string = "https://dy.ioe-times.com/word"; |
||||
public static WX_ResServer_custom: string = "https://dy.ioe-times.com/word";//资源服务器地址
|
||||
public static QQ_ResServer_custom: string = "https://dy.ioe-times.com/word";//资源服务器地址
|
||||
public static VIVO_ResServer_custom: string = "https://dy.ioe-times.com/word";//资源服务器地址
|
||||
public static OPPO_ResServer_custom: string = "https://dy.ioe-times.com/word";//资源服务器地址
|
||||
public static APK_ResServer_custom: string = "";//资源服务器地址
|
||||
|
||||
//--各自游戏的版本
|
||||
public static readonly TT_Versions_custom: string = "0.0.0"; |
||||
public static readonly WX_Versions_custom: string = "1.0.0"; |
||||
public static readonly QQ_Versions_custom: string = "0.0.0"; |
||||
public static readonly VIVO_Versions_custom: string = "0.0.0"; |
||||
public static readonly OPPO_Versions_custom: string = "0.0.0"; |
||||
public static readonly APK_Versions_custom: string = "0.0.0"; |
||||
|
||||
|
||||
//---------shareAd 迁移 广告id
|
||||
public static readonly TT_LoopAdLocationID_custom = -1; |
||||
public static readonly TT_BannerAdLocationID_custom = -1; |
||||
public static readonly TT_InsertAdLocationID_custom = -1; |
||||
public static readonly TT_AniAdLocationID_custom = -1; |
||||
public static readonly TT_HistoryLocationID_custom = -1; |
||||
public static readonly TT_MoreGameLocationID_custom = -1; |
||||
|
||||
public static readonly WX_LoopAdLocationID_custom = "048000b4006ae7d6f733ff25683a5d88"; |
||||
public static readonly WX_BannerAdLocationID_custom = "97731da8c180c7327d6e4a2840257451"; |
||||
public static readonly WX_InsertAdLocationID_custom = -1; |
||||
public static readonly WX_AniAdLocationID_custom = "7fcbd1316e6055e4337fd135834ab3b6"; |
||||
public static readonly WX_HistoryLocationID_custom = -1; |
||||
public static readonly WX_MoreGameLocationID_custom = "897020c5fc9783d7a4f13310b8812246"; |
||||
|
||||
public static readonly QQ_LoopAdLocationID_custom = -1; |
||||
public static readonly QQ_BannerAdLocationID_custom = -1; |
||||
public static readonly QQ_InsertAdLocationID_custom = -1; |
||||
public static readonly QQ_AniAdLocationID_custom = -1; |
||||
public static readonly QQ_HistoryLocationID_custom = -1; |
||||
public static readonly QQ_MoreGameLocationID_custom = -1; |
||||
|
||||
public static readonly VIVO_LoopAdLocationID_custom = -1; |
||||
public static readonly VIVO_BannerAdLocationID_custom = -1; |
||||
public static readonly VIVO_InsertAdLocationID_custom = -1; |
||||
public static readonly VIVO_AniAdLocationID_custom = -1; |
||||
public static readonly VIVO_HistoryLocationID_custom = -1; |
||||
public static readonly VIVO_MoreGameLocationID_custom = -1; |
||||
|
||||
public static readonly OPPO_LoopAdLocationID_custom = -1; |
||||
public static readonly OPPO_BannerAdLocationID_custom = -1; |
||||
public static readonly OPPO_InsertAdLocationID_custom = -1; |
||||
public static readonly OPPO_AniAdLocationID_custom = -1; |
||||
public static readonly OPPO_HistoryLocationID_custom = -1; |
||||
public static readonly OPPO_MoreGameLocationID_custom = -1; |
||||
|
||||
//广告 WXAPI 广告id
|
||||
public static readonly adUnitId_custom = "adunit-eef36f84c44bbdc1" |
||||
public static readonly bannerAdUnitId_custom = "adunit-440e21cc02c0d282" |
||||
public static readonly InsAdUnitId_custom = "adunit-440e21cc02c0d282" |
||||
|
||||
//头条 广告
|
||||
public static readonly tt_adUnitId_custom = "17dif14i521c125g1i" |
||||
public static readonly tt_bannerAdUnitId_custom = "of6a5i4oi6rqecpnp4" |
||||
public static readonly tt_InsAdUnitId_custom = "5kbgf0hn31i82e76rh" |
||||
public static readonly tt_templateId_custom = "" //分享素材id
|
||||
|
||||
public static readonly tt_adUnitIdArr_custom = ['c6290d8qe7tkqnbn6f', '2d4swal32964fe8oni', '2qgjcqoeubc3kkgjst'];//头条视频列表
|
||||
|
||||
//QQ广告
|
||||
public static readonly qq_adUnitId_custom = "5b57820f7aff1c8c238e450d22d468e6" //激励视频Id
|
||||
public static readonly qq_bannerAdUnitId_custom = "4f66f2f5b95a75f49166da22da1e85ae" //banner广告Id
|
||||
public static readonly qq_InsAdUnitId_custom = "341bb8725515401c5c923294ee653a64" //插屏广告Id
|
||||
public static readonly qq_AppBoxId_custom = "f10e0d49ad67e7cfab7c639e517823f8" //盒子广告Id
|
||||
public static readonly qq_blockAdArray_custom = [ |
||||
"b4d20888f606cf0a70cb7c3d071c2d27", |
||||
"9a4ae7e232aacedf11100881c0f428c6", |
||||
"4fa18896b8cab872507bce053a1a3f4e", |
||||
"62daa9df5453871d8130856a528a6f00", |
||||
"fd88d17d217d0f8eec10a05fda088dc1", |
||||
"b9c8f5e3fe77052a693b8b5e351988a6", |
||||
]; |
||||
|
||||
|
||||
|
||||
|
||||
// //需要加载缓存的一些配置 appswitch 会提前加载
|
||||
// public static needLoadConfig = [
|
||||
// //{ url: "/json/appswitch.json" }
|
||||
// // { url: "/json/shop.json" },
|
||||
// // { url: "/json/level.json" },
|
||||
// // { url: "/json/signin.json" }
|
||||
// ]
|
||||
|
||||
//分包 放入对应的分包名字在loading加载,如果需要游戏中加载,这里将不需要配置
|
||||
public static subResArray_custom = ["ZoomGame",'WordGame']; |
||||
|
||||
|
||||
//--设置各自游戏的netconfig state 0=微信,1=头条,2=支付宝,3=百度,4=QQ,5=OPPO,6=APK,7=VIVO)
|
||||
public static readonly TT_state_custom: number = 1; |
||||
public static readonly WX_state_custom: number = 0; |
||||
public static readonly QQ_state_custom: number = 4; |
||||
public static readonly VIVO_state_custom: number = 7; |
||||
public static readonly OPPO_state_custom: number = 5; |
||||
public static readonly BD_state_custom: number = 3; |
||||
public static readonly APK_state_custom: number = 6; |
||||
|
||||
//--AppId state gameid ResServer 会根据各个平台自动配置,这里不需要配置 不需要配置 不需要配置
|
||||
public static AppID_custom: string = ""; |
||||
public static state_custom = 0;//
|
||||
public static gameid_custom: number = 0; |
||||
public static ResServer_custom: string = ""; |
||||
public static Versions_custom: string = "0.0.0"; |
||||
public static LoopAdLocationID_custom: number | string = -1; |
||||
public static BannerAdLocationID_custom: number | string = -1; |
||||
public static InsertAdLocationID_custom: number | string = -1; |
||||
public static AniAdLocationID_custom: number | string = -1; |
||||
public static HistoryLocationID_custom: number | string = -1; |
||||
public static MoreGameLocationID_custom: number | string = -1; |
||||
public static UseRYSDK_custom: boolean = true; |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "b8f676c1-a1e7-4e31-83bc-ef615a7e8483", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,921 @@ |
||||
import AppConfig from "./AppConfig"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
import { FMListener, callFM_custom } from "../Interface/FMInterface"; |
||||
|
||||
|
||||
export class AppSwitchData { |
||||
public version_custom: string = ""; |
||||
public banner_custom: number = 0; |
||||
public wudian_custom: number = 0; |
||||
public debuginfo_custom: number = 0;//debug info 金手指
|
||||
public isNetWorkGame_custom: number = 1;//是否联网游戏 1开启
|
||||
private wudianAvailableTime_custom: object = { |
||||
"0": 0, "1": 0, "2": 0, "3": 0, |
||||
"4": 0, "5": 0, "6": 0, "7": 0, |
||||
"8": 0, "9": 0, "10": 0, "11": 0, |
||||
"12": 0, "13": 0, "14": 0, "15": 0, |
||||
"16": 0, "17": 0, "18": 0, "19": 0, |
||||
"20": 0, "21": 0, "22": 0, "23": 0 |
||||
} |
||||
|
||||
private homePageExportTimeControl_custom: object = { |
||||
"0": 0, "1": 0, "2": 0, "3": 0, |
||||
"4": 0, "5": 0, "6": 0, "7": 0, |
||||
"8": 0, "9": 0, "10": 0, "11": 0, |
||||
"12": 0, "13": 0, "14": 0, "15": 0, |
||||
"16": 0, "17": 0, "18": 0, "19": 0, |
||||
"20": 0, "21": 0, "22": 0, "23": 0 |
||||
} |
||||
/** |
||||
* 得到当前时间开关是否打开 |
||||
*
|
||||
* @readonly |
||||
* @type {boolean} |
||||
* @memberof AppSwitchData |
||||
*/ |
||||
public get wudianTimeAvaliable_custom(): boolean { |
||||
return this.wudianAvailableTime_custom[new Date().getHours()] == 1; |
||||
} |
||||
public get homePageExportIsOpen_custom(): boolean { |
||||
return Number(this.homePageExportTimeControl_custom["" + new Date().getHours()]) == 1; |
||||
} |
||||
public mailiang_custom: number = 1; |
||||
public readonly mailianglist_custom: Array<number> = new Array<number>(); |
||||
public readonly mailiangSceneList_custom: Array<number> = new Array<number>(); |
||||
|
||||
public readonly wxWuDianBanners_custom: Array<string> = new Array<string>(); |
||||
public readonly recreateBannerIDList_custom: Array<string> = new Array<string>(); |
||||
public bannerRecreateTime_custom: number = 5; |
||||
public kuangdianjiange_custom: number = 0; |
||||
|
||||
public btnMoveTimer_custom: number = 1; |
||||
public bannerMoveTimer_custom: number = 0.5; |
||||
public bannerFreshTimer_custom: number = 200; |
||||
public bannerCreateFailNum_custom: number = 3; |
||||
public bannerTodayBannerMax_custom: number = 10; |
||||
|
||||
public adSwitch_custom: number = 1; |
||||
|
||||
public readonly wudianSceneList_custom: Array<number> = new Array<number>(); |
||||
|
||||
public continueBtnDelayTime_custom: number = 2;//Exprot2ViewTemplate 中继续按钮延迟显示的时间
|
||||
public bannerShowTime_custom: number = 30; |
||||
|
||||
public fakeBtn_custom: number = 0; |
||||
|
||||
public popAd_custom: number = 0;//是否启用 Exprot3ViewTemplate,
|
||||
public continueBanner_custom: number = 0;//Exprot2ViewTemplate 是否开启Banner显示
|
||||
public continueBannerShowTime_custom: number = 2;//Exprot2ViewTemplate 中Banner延迟显示的时间
|
||||
public continueBannerHideTime_custom: number = 2;//Exprot2ViewTemplate 中Banner显示后延迟关闭的时间
|
||||
|
||||
public readonly oppocfg_custom = new OPPOCfg(); |
||||
public readonly qqcfg_custom = new QQCfg(); |
||||
public readonly ttcfg_custom = new TTCfg(); |
||||
public readonly vivocfg_custom = new VVcfg(); |
||||
public readonly wxcfg_custom = new WXCfg(); |
||||
public readonly tt2cfg_custom = new TT2Cfg(); |
||||
public readonly cocosWxcfg_custom = new cocosWxcfg(); |
||||
public readonly bdcfg_custom = new BDCfg(); |
||||
public readonly quickgamecfg_custom = new Quickgamecfg(); |
||||
} |
||||
|
||||
export class Quickgamecfg { |
||||
autoExport: number = 0; // 自动导出开关 1开 0 关
|
||||
bigExportColor: string = '416e8d'; //大导出页背景色设置,仅cocos可用
|
||||
bigExportColor_g: string = '416e8d'; //大导出页背景色渐变部分设置,仅cocos可用
|
||||
bigExportBannerType: number = 100; //100 大导出页闪现banner点击后计时概率(0~100)
|
||||
bigExportShowBannerTime: number = 1; //大导出页计时开始后多长时间显示banner
|
||||
bigExportHideBannerTime: number = 2; //大导出页banner显示后,多长时间隐藏
|
||||
hotplayBannerType: number = 100; //好友热玩页面闪现banner点击后计时概率(0~100)
|
||||
hotplayShowBannerTime: number = 1; //好友热玩页面计时开始后多长时间显示banner
|
||||
hotplayHideBannerTime: number = 2; //好友热玩页面banner显示后,多长时间隐藏
|
||||
recommendBannerType: number = 100; //推荐弹窗页面位移误点点击后计时概率(0~100)
|
||||
recommendShowBannerTime: number = 1; //推荐弹窗页面计时开始后多长时间显示banner
|
||||
recommendButMoveTime: number = 0.2; //推荐弹窗页面,banner显示之后多久按钮位移到正常位置
|
||||
endBannerType: number = 100; //结算页面位移误点点击后计时概率(0~100)
|
||||
endShowBannerTime: number = 1; //结算页面计时开始后多长时间显示banner
|
||||
endButMoveTime: number = 0.2; // 0.2 结算页面,banner显示之后多久按钮位移到正常位
|
||||
crazyShowBanner: number[] = [3, 10]; // 3,10 狂点页面,点击多少下时显示banner, 为一个区间,随机,banner显示后,重新随机计算下一次banner显示,均为-1的时候,为关闭banner显示
|
||||
playButVideo: number = 0; // 开始按钮是否播放视频;
|
||||
crazyBannerHideTime: number = 0; //狂点按钮消失时间
|
||||
} |
||||
|
||||
|
||||
|
||||
export class WXCfg { |
||||
kuangdian_custom: number = 1; //狂点是否开启
|
||||
kuangdianBanner_custom: number = 0;//狂点banner是否开启
|
||||
kuangdianLevelSpcacing_custom: number = 0;//狂点间隔
|
||||
ForceSkip_custom: number = 0; // 大导出页强导开关
|
||||
SlideSkip_custom: number = 0; // 滑动导出强导开关
|
||||
tc_ForceSkip_custom: number = 0; //首页弹窗是否强导
|
||||
tc_SlideSkip_custom: number = 0; //首页弹窗是否滑动强导
|
||||
phb_ForceSkip_custom: number = 0; //排行榜是否强导
|
||||
phb_SlideSkip_custom: number = 0; //排行榜是否滑动强导
|
||||
tc_continueBanner_custom: number = 0;//首页弹窗闪现banner
|
||||
MainPop_custom: number = 0; //首页弹窗是否开启
|
||||
hyrw_ForceSkip_custom: number = 0; //好友热玩是否开启强导
|
||||
hyrw_SlideSkip_custom: number = 0; //好友热玩是否开启滑动强导
|
||||
hyrw_continueBanner_custom: number = 0; //好友热玩闪现banner
|
||||
handShow_custom: number = 1; //手指是否显示
|
||||
firstOpen_custom: number = 0; //首次进入游戏强拉视频
|
||||
startVideo_custom: number = 0; //开始游戏强拉视频
|
||||
mainBackBtn_custom: number = 1; //首页返回按钮是否开启
|
||||
mainMoreBtn_custom: number = 1; //首页更多按钮是否开启
|
||||
mainItemBtn_custom: number = 1; //首页菜单按钮是否开启
|
||||
mainExportShow_custom: number = 0; //首页导出是否屏蔽
|
||||
isJumpHotPlay_custom: number = 0; //是否跳转好友热玩
|
||||
moreGameShowLevel_custom: number = 0;//第几关开始弹出更多好玩
|
||||
setUserScan_custom: number = 0; //设置用户屏蔽
|
||||
} |
||||
|
||||
export class OPPOCfg { |
||||
public yuansheng_custom: number = 100; |
||||
public yuanshengSwitch_custom: number = 1; |
||||
public addToDesktop_custom: number = 0; |
||||
public oppoversions_custom: string = ""; |
||||
public btnShowTimer_custom: number = 0; |
||||
public indexAdSwitch_custom: number = 0; |
||||
public endAdSwitch_custom: number = 0; |
||||
public yuansheng2_custom: number = 100; |
||||
public yuanshengSwitch2_custom: number = 1; |
||||
} |
||||
|
||||
export class QQCfg { |
||||
public kuangdianBanner_custom: number = 0; |
||||
public kuangdianBox_custom: number = 0; |
||||
public box_custom: number = 0; |
||||
public weiyi_custom: number = 0; |
||||
public qqversions_custom: string = ""; |
||||
} |
||||
|
||||
export class TTCfg { |
||||
public moreGameSwitch_custom: number = 0; |
||||
public kuangdianBanner_custom: number = 0; |
||||
public luping_custom: number = 0; |
||||
public ttversions_custom: string = ""; |
||||
|
||||
|
||||
public videoGetPowerNum: number = 3; //普通体力视频获取点数
|
||||
public powerRecoverTime: number = 300; //体力恢复时间(s)
|
||||
public fisrtPower: number = 3; //玩家第一次进入游戏的体力值
|
||||
public maxPower: number = 3; //体力值上限
|
||||
public videoFirstGetPowerNum: number = 2; //无限体力第一次视频获取点数
|
||||
public videoSecondGetPowerNum: number = 3; //无限体力第二次视频获取点数
|
||||
|
||||
public videoWxtlPowerNum: number = 2; //
|
||||
public videoUnlockDayNum: number = 2; //
|
||||
} |
||||
|
||||
export class TT2Cfg { |
||||
public startSwitch_custom: number = 0; |
||||
public signInSwitch_custom: number = 0; |
||||
public getSwitch_custom: number = 0; |
||||
public useSwitch_custom: number = 0; |
||||
public reliveSwitch_custom: number = 0; |
||||
public screenCapSwitch_custom: number = 0; |
||||
public boxSwitch_custom: number = 0; |
||||
} |
||||
|
||||
export class VVcfg { |
||||
yuanshengSwitch_custom: number = 1; |
||||
yuansheng_custom: number = 100; |
||||
yuanshengSwitch2_custom: number = 1; |
||||
yuansheng2_custom: number = 100; |
||||
chapingSwitch_custom: number = 1; |
||||
chaping_custom: number = 100; |
||||
addToDesktop_custom: number = 1; |
||||
vivoversions_custom: string = ""; |
||||
btnShowTimer_custom: number = 1; |
||||
} |
||||
export class BDCfg { |
||||
version_custom: string = ""; |
||||
signInSwitch_custom: number = 0; |
||||
taskVideo_custom: number = 1; |
||||
btnDelayTime_custom: number = 0; |
||||
} |
||||
|
||||
//cocos weixin 控制开关
|
||||
export class cocosWxcfg { |
||||
//轮播
|
||||
loopAd = { |
||||
rollWayLeftUp_custom: 0, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3, |
||||
bgColor_custom: "62d5ff" |
||||
}; |
||||
|
||||
|
||||
skinTrial = { |
||||
videoIcon_custom: 0, |
||||
wudian_custom: 0, |
||||
timeClick_custom: 0, |
||||
butMoveTime_custom: 0, |
||||
bannerShowTime_custom: 0, |
||||
bannerHideTime_custom: 0, |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
}; |
||||
revival = { |
||||
videoIcon_custom: 0, |
||||
wudian_custom: 0, |
||||
timeClick_custom: 0, |
||||
butMoveTime_custom: 0, |
||||
bannerShowTime_custom: 0, |
||||
bannerHideTime_custom: 0, |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
}; |
||||
moreGoodGame = { |
||||
bgColor_custom: "3485fb", |
||||
maskColor_custom: "", |
||||
mouseEventIsUp_custom: 0, |
||||
cancelIntercept_custom: 1, |
||||
wudian_custom: 0, |
||||
timeClick_custom: 0, |
||||
butMoveTime_custom: 0, |
||||
bannerShowTime_custom: 0, |
||||
bannerHideTime_custom: 0, |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
|
||||
}; |
||||
bigLoopAd = { |
||||
bgColor_custom: "3485fb", |
||||
maskColor_custom: "", |
||||
wudian_custom: 0, |
||||
timeClick_custom: 0, |
||||
butMoveTime_custom: 0, |
||||
bannerShowTime_custom: 0, |
||||
bannerHideTime_custom: 0, |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
}; |
||||
settlePage = { |
||||
bgColor_custom: "3485fb", |
||||
maskColor_custom: "", |
||||
wudian_custom: 0, |
||||
timeClick_custom: 0, |
||||
butMoveTime_custom: 0, |
||||
bannerShowTime_custom: 0, |
||||
bannerHideTime_custom: 0, |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
}; |
||||
moreGoodGame2 = { |
||||
bgColor_custom: "3485fb", |
||||
maskColor_custom: "", |
||||
butDelayShowTime_custom: 0, |
||||
rollWayLeftUp_custom: 1, |
||||
rollWaitNum_custom: 1, |
||||
rollWaitTime_custom: 1, |
||||
roolSpeed_custom: 3 |
||||
}; |
||||
|
||||
} |
||||
|
||||
export default class AppSwitchConfig { |
||||
protected static _instance_custom: AppSwitchConfig = new AppSwitchConfig(); |
||||
protected readonly _data_custom: Array<AppSwitchData> = new Array<AppSwitchData>(); |
||||
|
||||
public static getInstance_custom(): AppSwitchConfig { |
||||
return AppSwitchConfig._instance_custom |
||||
} |
||||
|
||||
|
||||
public loadLocalJson(json,finish) { |
||||
this._data_custom.length = 0; |
||||
if (json) { |
||||
for (var i = 0; i < json.length; ++i) { |
||||
var row = json[i]; |
||||
var rowData: AppSwitchData = new AppSwitchData(); |
||||
rowData.version_custom = String(row["version"]); |
||||
rowData.banner_custom = Number(row["banner"]); |
||||
rowData.wudian_custom = Number(row["wudian"]); |
||||
rowData.debuginfo_custom = Number(row["debuginfo"]); |
||||
rowData.isNetWorkGame_custom = Number(row["netWorkgame"]);//是否网络登录游戏,数据存本地
|
||||
|
||||
(rowData as any).wudianAvailableTime_custom = Object(row["wudianTime"]); |
||||
(rowData as any).homePageExportTimeControl_custom = Object(row["homePageExportTimeControl"]); |
||||
|
||||
// rowData.mailiang_custom = Number(row["mailiang"]);
|
||||
// var mailianglist = row["mailianglist"];
|
||||
// if (null != mailianglist) {
|
||||
// for (var j = 0; j < mailianglist.length; ++j) {
|
||||
// var flag = Number(mailianglist[j]);
|
||||
// rowData.mailianglist_custom.push(flag);
|
||||
// }
|
||||
// }
|
||||
// var mailiangScenelist = row["mailiangScenelist"];
|
||||
// if (null != mailiangScenelist) {
|
||||
// for (var j = 0; j < mailiangScenelist.length; ++j) {
|
||||
// var sceneValue = Number(mailiangScenelist[j]);
|
||||
// rowData.mailiangSceneList_custom.push(sceneValue);
|
||||
// }
|
||||
// }
|
||||
|
||||
var wxwudianbanners = row["wxwudianbanners"]; |
||||
if (null != wxwudianbanners) { |
||||
for (var j = 0; j < wxwudianbanners.length; ++j) { |
||||
let bannerid = String(wxwudianbanners[j]); |
||||
rowData.wxWuDianBanners_custom.push(bannerid); |
||||
} |
||||
} |
||||
|
||||
var recreateBannerIDList = row["recreateBannerIDList"]; |
||||
if (null != recreateBannerIDList) { |
||||
for (var j = 0; j < recreateBannerIDList.length; ++j) { |
||||
let bannerid = String(recreateBannerIDList[j]); |
||||
rowData.recreateBannerIDList_custom.push(bannerid); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
rowData.bannerRecreateTime_custom = null != row["bannerRecreateTime"] ? Number(row["bannerRecreateTime"]) : rowData.bannerRecreateTime_custom; |
||||
rowData.kuangdianjiange_custom = null != row["kuangdianjiange"] ? Number(row["kuangdianjiange"]) : rowData.kuangdianjiange_custom; |
||||
rowData.btnMoveTimer_custom = Number(row["btnMoveTimer"]); |
||||
rowData.bannerMoveTimer_custom = Number(row["bannerMoveTimer"]); |
||||
rowData.bannerCreateFailNum_custom = Number(row["createFailNum"]); |
||||
rowData.bannerFreshTimer_custom = Number(row["bannerFreshTimer"]); |
||||
rowData.bannerTodayBannerMax_custom = Number(row["todayBannerMax"]); |
||||
|
||||
rowData.adSwitch_custom = Number(row["adSwitch"]); |
||||
|
||||
var wudianSceneList = row["wudianSceneList"]; |
||||
if (null != wudianSceneList) { |
||||
for (var j = 0; j < wudianSceneList.length; ++j) { |
||||
var wudianSceneValue = Number(wudianSceneList[j]); |
||||
rowData.wudianSceneList_custom.push(wudianSceneValue); |
||||
} |
||||
} |
||||
|
||||
rowData.continueBtnDelayTime_custom = Number(row["continueBtnDelayTime"]); |
||||
rowData.bannerShowTime_custom = Number(row["bannerShowTime"]); |
||||
|
||||
rowData.fakeBtn_custom = null != row["fakeBtn"] ? Number(row["fakeBtn"]) : rowData.fakeBtn_custom; |
||||
|
||||
rowData.popAd_custom = null != row["popAd"] ? Number(row["popAd"]) : rowData.popAd_custom; |
||||
rowData.continueBanner_custom = null != row["continueBanner"] ? Number(row["continueBanner"]) : rowData.continueBanner_custom; |
||||
rowData.continueBannerShowTime_custom = null != row["continueBannerShowTime"] ? Number(row["continueBannerShowTime"]) : rowData.continueBannerShowTime_custom; |
||||
rowData.continueBannerHideTime_custom = null != row["continueBannerHideTime"] ? Number(row["continueBannerHideTime"]) : rowData.continueBannerHideTime_custom; |
||||
|
||||
if (null != row["oppocfg"]) { |
||||
let cfg = row["oppocfg"]; |
||||
rowData.oppocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); |
||||
rowData.oppocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); |
||||
rowData.oppocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); |
||||
rowData.oppocfg_custom.oppoversions_custom = String(cfg["oppoversions"]); |
||||
rowData.oppocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); |
||||
rowData.oppocfg_custom.indexAdSwitch_custom = Number(cfg["indexAdSwitch"]); |
||||
rowData.oppocfg_custom.endAdSwitch_custom = Number(cfg["endAdSwitch"]); |
||||
rowData.oppocfg_custom.yuansheng2_custom = null != cfg["yuansheng2"] ? Number(cfg["yuansheng2"]) : rowData.oppocfg_custom.yuansheng2_custom; |
||||
rowData.oppocfg_custom.yuanshengSwitch2_custom = null != cfg["yuanshengSwitch2"] ? Number(cfg["yuanshengSwitch2"]) : rowData.oppocfg_custom.yuanshengSwitch2_custom; |
||||
} |
||||
|
||||
if (null != row["qqcfg"]) { |
||||
let cfg = row["qqcfg"]; |
||||
rowData.qqcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.qqcfg_custom.kuangdianBox_custom = Number(cfg["kuangdianBox"]); |
||||
rowData.qqcfg_custom.box_custom = Number(cfg["box"]); |
||||
rowData.qqcfg_custom.weiyi_custom = Number(cfg["weiyi"]); |
||||
rowData.qqcfg_custom.qqversions_custom = String(cfg["qqversions"]); |
||||
} |
||||
|
||||
if (null != row["ttcfg"]) { |
||||
let cfg = row["ttcfg"]; |
||||
rowData.ttcfg_custom.moreGameSwitch_custom = Number(cfg["moreGameSwitch"]); |
||||
rowData.ttcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.ttcfg_custom.luping_custom = Number(cfg["luping"]); |
||||
rowData.ttcfg_custom.ttversions_custom = String(cfg["ttversions"]); |
||||
|
||||
rowData.ttcfg_custom.videoGetPowerNum = Number(cfg["videoGetPowerNum"]); |
||||
rowData.ttcfg_custom.powerRecoverTime = Number(cfg["powerRecoverTime"]); |
||||
rowData.ttcfg_custom.fisrtPower = Number(cfg["fisrtPower"]); |
||||
rowData.ttcfg_custom.maxPower = Number(cfg["maxPower"]); |
||||
rowData.ttcfg_custom.videoFirstGetPowerNum = Number(cfg["videoFirstGetPowerNum"]); |
||||
rowData.ttcfg_custom.videoSecondGetPowerNum = Number(cfg["videoSecondGetPowerNum"]); |
||||
rowData.ttcfg_custom.videoWxtlPowerNum = Number(cfg["videoWxtlPowerNum"]); |
||||
|
||||
} |
||||
|
||||
if (null != row["tt2cfg"]) { |
||||
let cfg = row["tt2cfg"]; |
||||
rowData.tt2cfg_custom.startSwitch_custom = Number(cfg["startSwitch"]); |
||||
rowData.tt2cfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); |
||||
rowData.tt2cfg_custom.getSwitch_custom = Number(cfg["getSwitch"]); |
||||
rowData.tt2cfg_custom.useSwitch_custom = Number(cfg["useSwitch"]); |
||||
rowData.tt2cfg_custom.reliveSwitch_custom = Number(cfg["reliveSwitch"]); |
||||
rowData.tt2cfg_custom.screenCapSwitch_custom = Number(cfg["screenCapSwitch"]); |
||||
rowData.tt2cfg_custom.boxSwitch_custom = Number(cfg["boxSwitch"]); |
||||
} |
||||
|
||||
if (null != row["vivocfg"]) { |
||||
let cfg = row["vivocfg"]; |
||||
rowData.vivocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); |
||||
rowData.vivocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); |
||||
rowData.vivocfg_custom.yuanshengSwitch2_custom = Number(cfg["yuanshengSwitch2"]); |
||||
rowData.vivocfg_custom.yuansheng2_custom = Number(cfg["yuansheng2"]); |
||||
rowData.vivocfg_custom.chapingSwitch_custom = Number(cfg["chapingSwitch"]); |
||||
rowData.vivocfg_custom.chaping_custom = Number(cfg["chaping"]); |
||||
rowData.vivocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); |
||||
rowData.vivocfg_custom.vivoversions_custom = String(cfg["vivoversions"]); |
||||
rowData.vivocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); |
||||
} |
||||
|
||||
if (null != row["wxcfg"]) { |
||||
let cfg = row["wxcfg"]; |
||||
rowData.wxcfg_custom.kuangdian_custom = Number(cfg["kuangdian"]); |
||||
rowData.wxcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.wxcfg_custom.kuangdianLevelSpcacing_custom = Number(cfg["kuangdianLevelSpcacing"]); |
||||
rowData.wxcfg_custom.ForceSkip_custom = Number(cfg["ForceSkip"]); |
||||
rowData.wxcfg_custom.SlideSkip_custom = Number(cfg["SlideSkip"]); |
||||
rowData.wxcfg_custom.tc_ForceSkip_custom = Number(cfg["tc_ForceSkip"]); |
||||
rowData.wxcfg_custom.tc_SlideSkip_custom = Number(cfg["tc_SlideSkip"]); |
||||
rowData.wxcfg_custom.phb_ForceSkip_custom = Number(cfg["phb_ForceSkip"]); |
||||
rowData.wxcfg_custom.phb_SlideSkip_custom = Number(cfg["phb_SlideSkip"]); |
||||
rowData.wxcfg_custom.tc_continueBanner_custom = Number(cfg["tc_continueBanner"]); |
||||
rowData.wxcfg_custom.MainPop_custom = Number(cfg["MainPop"]); |
||||
rowData.wxcfg_custom.hyrw_ForceSkip_custom = Number(cfg["hyrw_ForceSkip"]); |
||||
rowData.wxcfg_custom.hyrw_SlideSkip_custom = Number(cfg["hyrw_SlideSkip"]); |
||||
rowData.wxcfg_custom.hyrw_continueBanner_custom = Number(cfg["hyrw_continueBanner"]); |
||||
rowData.wxcfg_custom.handShow_custom = Number(cfg["handShow"]); |
||||
rowData.wxcfg_custom.firstOpen_custom = Number(cfg["firstOpen"]); |
||||
rowData.wxcfg_custom.startVideo_custom = Number(cfg["startVideo"]); |
||||
rowData.wxcfg_custom.mainBackBtn_custom = Number(cfg["mainBackBtn"]); |
||||
rowData.wxcfg_custom.mainMoreBtn_custom = Number(cfg["mainMoreBtn"]); |
||||
rowData.wxcfg_custom.mainItemBtn_custom = Number(cfg["mainItemBtn"]); |
||||
rowData.wxcfg_custom.mainExportShow_custom = Number(cfg["mainExportShow"]); |
||||
rowData.wxcfg_custom.isJumpHotPlay_custom = Number(cfg["isJumpHotPlay"]); |
||||
rowData.wxcfg_custom.moreGameShowLevel_custom = Number(cfg["moreGameShowLevel"]); |
||||
rowData.wxcfg_custom.setUserScan_custom = Number(cfg["setUserScan"]); |
||||
} |
||||
|
||||
|
||||
if (null != row["bdcfg"]) { |
||||
let cfg = row["bdcfg"]; |
||||
rowData.bdcfg_custom.btnDelayTime_custom = Number(cfg["btnDelayTime"]); |
||||
rowData.bdcfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); |
||||
rowData.bdcfg_custom.taskVideo_custom = Number(cfg["taskVideo"]); |
||||
rowData.bdcfg_custom.version_custom = String(cfg["version"]) |
||||
} |
||||
|
||||
if (null != row["cocosWxConfig"]) { |
||||
let cfg = row["cocosWxConfig"]; |
||||
|
||||
let loopAd = cfg["loopAd"]; |
||||
let skinTrial = cfg["skinTrial"]; |
||||
let revival = cfg["revival"]; |
||||
let moreGoodGame = cfg["moreGoodGame"]; |
||||
let bigLoopAd = cfg["bigLoopAd"]; |
||||
let settlePage = cfg["settlePage"]; |
||||
let moreGoodGame2 = cfg["moreGoodGame2"]; |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.loopAd) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.loopAd, key)) { |
||||
if (key == "bgColor") { |
||||
rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? String(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? Number(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.skinTrial) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.skinTrial, key)) { |
||||
rowData.cocosWxcfg_custom.skinTrial[key] = skinTrial[key] != null ? Number(skinTrial[key]) : rowData.cocosWxcfg_custom.skinTrial[key]; |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.revival) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.revival, key)) { |
||||
rowData.cocosWxcfg_custom.revival[key] = revival[key] != null ? Number(revival[key]) : rowData.cocosWxcfg_custom.revival[key]; |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.moreGoodGame) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? String(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? Number(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.bigLoopAd) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.bigLoopAd, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? String(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? Number(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.settlePage) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.settlePage, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? String(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? Number(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; |
||||
} |
||||
} |
||||
} |
||||
for (const key in rowData.cocosWxcfg_custom.moreGoodGame2) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame2, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? String(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? Number(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (null != row['quickgamecfg']) { |
||||
let cfg = row["quickgamecfg"]; |
||||
rowData.quickgamecfg_custom.autoExport = Number(cfg["autoExport"]); |
||||
rowData.quickgamecfg_custom.bigExportColor = cfg["bigExportColor"]; |
||||
rowData.quickgamecfg_custom.bigExportColor_g = cfg["bigExportColor_g"]; |
||||
rowData.quickgamecfg_custom.bigExportBannerType = Number(cfg["bigExportBannerType"]); |
||||
rowData.quickgamecfg_custom.bigExportShowBannerTime = Number(cfg["bigExportShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.bigExportHideBannerTime = Number(cfg["bigExportHideBannerTime"]); |
||||
rowData.quickgamecfg_custom.hotplayBannerType = Number(cfg["hotplayBannerType"]); |
||||
rowData.quickgamecfg_custom.hotplayShowBannerTime = Number(cfg["hotplayShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.hotplayHideBannerTime = Number(cfg["hotplayHideBannerTime"]); |
||||
rowData.quickgamecfg_custom.recommendBannerType = Number(cfg["recommendBannerType"]); |
||||
rowData.quickgamecfg_custom.recommendShowBannerTime = Number(cfg["recommendShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.recommendButMoveTime = Number(cfg["recommendButMoveTime"]); |
||||
rowData.quickgamecfg_custom.endBannerType = Number(cfg["endBannerType"]); |
||||
rowData.quickgamecfg_custom.endShowBannerTime = Number(cfg["endShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.endButMoveTime = Number(cfg["endButMoveTime"]); |
||||
rowData.quickgamecfg_custom.playButVideo = cfg["playButVideo"] == null ? 0 : Number(cfg["playButVideo"]); |
||||
rowData.quickgamecfg_custom.crazyBannerHideTime = cfg["crazyBannerHideTime"] == null ? 0 : Number(cfg["crazyBannerHideTime"]); //切出去则不考虑
|
||||
|
||||
let crazyShowString = cfg['crazyShowBanner']; |
||||
if (crazyShowString) { |
||||
let tmp = crazyShowString.split(','); |
||||
rowData.quickgamecfg_custom.crazyShowBanner[0] = Number(tmp[0]); |
||||
rowData.quickgamecfg_custom.crazyShowBanner[1] = Number(tmp[1]); |
||||
} |
||||
} |
||||
|
||||
this._data_custom.push(rowData); |
||||
} |
||||
} |
||||
|
||||
if (finish) { |
||||
finish() |
||||
} |
||||
|
||||
} |
||||
|
||||
|
||||
public loadUrlConfig_custom(finish: FMListener, errorListener: FMListener) { |
||||
if (AppConfig.ResServer_custom == "") { |
||||
LogUtils.warn_custom("没有找到合适的AppswitchConfig 路径"); |
||||
this._data_custom.push(new AppSwitchData()); |
||||
if (finish) { |
||||
callFM_custom(finish) |
||||
} |
||||
return; |
||||
} |
||||
let url = AppConfig.ResServer_custom + "/json/appswitch.json?" + (new Date().getTime()) |
||||
//使用 url 加载远程资源
|
||||
cc.assetManager.loadRemote(url, (err, textAsset: cc.JsonAsset) => { |
||||
//移除缓存
|
||||
if (cc.assetManager.cacheManager) { |
||||
cc.assetManager.cacheManager.removeCache(url); |
||||
} |
||||
|
||||
if (err) { |
||||
LogUtils.error_custom(err); |
||||
this._data_custom.push(new AppSwitchData()); |
||||
if (errorListener) { |
||||
callFM_custom(errorListener) |
||||
} |
||||
return |
||||
} |
||||
|
||||
this._data_custom.length = 0; |
||||
let json = textAsset.json; |
||||
|
||||
LogUtils.log_custom("下载 appswitch.json>>>"); |
||||
LogUtils.log_custom(textAsset); |
||||
|
||||
//json[0].banner = 0
|
||||
|
||||
|
||||
if (json) { |
||||
for (var i = 0; i < json.length; ++i) { |
||||
var row = json[i]; |
||||
var rowData: AppSwitchData = new AppSwitchData(); |
||||
rowData.version_custom = String(row["version"]); |
||||
rowData.banner_custom = Number(row["banner"]); |
||||
rowData.wudian_custom = Number(row["wudian"]); |
||||
rowData.debuginfo_custom = Number(row["debuginfo"]); |
||||
rowData.isNetWorkGame_custom = Number(row["netWorkgame"]);//是否网络登录游戏,数据存本地
|
||||
|
||||
(rowData as any).wudianAvailableTime_custom = Object(row["wudianTime"]); |
||||
(rowData as any).homePageExportTimeControl_custom = Object(row["homePageExportTimeControl"]); |
||||
|
||||
// rowData.mailiang_custom = Number(row["mailiang"]);
|
||||
// var mailianglist = row["mailianglist"];
|
||||
// if (null != mailianglist) {
|
||||
// for (var j = 0; j < mailianglist.length; ++j) {
|
||||
// var flag = Number(mailianglist[j]);
|
||||
// rowData.mailianglist_custom.push(flag);
|
||||
// }
|
||||
// }
|
||||
// var mailiangScenelist = row["mailiangScenelist"];
|
||||
// if (null != mailiangScenelist) {
|
||||
// for (var j = 0; j < mailiangScenelist.length; ++j) {
|
||||
// var sceneValue = Number(mailiangScenelist[j]);
|
||||
// rowData.mailiangSceneList_custom.push(sceneValue);
|
||||
// }
|
||||
// }
|
||||
|
||||
var wxwudianbanners = row["wxwudianbanners"]; |
||||
if (null != wxwudianbanners) { |
||||
for (var j = 0; j < wxwudianbanners.length; ++j) { |
||||
let bannerid = String(wxwudianbanners[j]); |
||||
rowData.wxWuDianBanners_custom.push(bannerid); |
||||
} |
||||
} |
||||
|
||||
var recreateBannerIDList = row["recreateBannerIDList"]; |
||||
if (null != recreateBannerIDList) { |
||||
for (var j = 0; j < recreateBannerIDList.length; ++j) { |
||||
let bannerid = String(recreateBannerIDList[j]); |
||||
rowData.recreateBannerIDList_custom.push(bannerid); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
rowData.bannerRecreateTime_custom = null != row["bannerRecreateTime"] ? Number(row["bannerRecreateTime"]) : rowData.bannerRecreateTime_custom; |
||||
rowData.kuangdianjiange_custom = null != row["kuangdianjiange"] ? Number(row["kuangdianjiange"]) : rowData.kuangdianjiange_custom; |
||||
rowData.btnMoveTimer_custom = Number(row["btnMoveTimer"]); |
||||
rowData.bannerMoveTimer_custom = Number(row["bannerMoveTimer"]); |
||||
rowData.bannerCreateFailNum_custom = Number(row["createFailNum"]); |
||||
rowData.bannerFreshTimer_custom = Number(row["bannerFreshTimer"]); |
||||
rowData.bannerTodayBannerMax_custom = Number(row["todayBannerMax"]); |
||||
|
||||
rowData.adSwitch_custom = Number(row["adSwitch"]); |
||||
|
||||
var wudianSceneList = row["wudianSceneList"]; |
||||
if (null != wudianSceneList) { |
||||
for (var j = 0; j < wudianSceneList.length; ++j) { |
||||
var wudianSceneValue = Number(wudianSceneList[j]); |
||||
rowData.wudianSceneList_custom.push(wudianSceneValue); |
||||
} |
||||
} |
||||
|
||||
rowData.continueBtnDelayTime_custom = Number(row["continueBtnDelayTime"]); |
||||
rowData.bannerShowTime_custom = Number(row["bannerShowTime"]); |
||||
|
||||
rowData.fakeBtn_custom = null != row["fakeBtn"] ? Number(row["fakeBtn"]) : rowData.fakeBtn_custom; |
||||
|
||||
rowData.popAd_custom = null != row["popAd"] ? Number(row["popAd"]) : rowData.popAd_custom; |
||||
rowData.continueBanner_custom = null != row["continueBanner"] ? Number(row["continueBanner"]) : rowData.continueBanner_custom; |
||||
rowData.continueBannerShowTime_custom = null != row["continueBannerShowTime"] ? Number(row["continueBannerShowTime"]) : rowData.continueBannerShowTime_custom; |
||||
rowData.continueBannerHideTime_custom = null != row["continueBannerHideTime"] ? Number(row["continueBannerHideTime"]) : rowData.continueBannerHideTime_custom; |
||||
|
||||
if (null != row["oppocfg"]) { |
||||
let cfg = row["oppocfg"]; |
||||
rowData.oppocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); |
||||
rowData.oppocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); |
||||
rowData.oppocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); |
||||
rowData.oppocfg_custom.oppoversions_custom = String(cfg["oppoversions"]); |
||||
rowData.oppocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); |
||||
rowData.oppocfg_custom.indexAdSwitch_custom = Number(cfg["indexAdSwitch"]); |
||||
rowData.oppocfg_custom.endAdSwitch_custom = Number(cfg["endAdSwitch"]); |
||||
rowData.oppocfg_custom.yuansheng2_custom = null != cfg["yuansheng2"] ? Number(cfg["yuansheng2"]) : rowData.oppocfg_custom.yuansheng2_custom; |
||||
rowData.oppocfg_custom.yuanshengSwitch2_custom = null != cfg["yuanshengSwitch2"] ? Number(cfg["yuanshengSwitch2"]) : rowData.oppocfg_custom.yuanshengSwitch2_custom; |
||||
} |
||||
|
||||
if (null != row["qqcfg"]) { |
||||
let cfg = row["qqcfg"]; |
||||
rowData.qqcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.qqcfg_custom.kuangdianBox_custom = Number(cfg["kuangdianBox"]); |
||||
rowData.qqcfg_custom.box_custom = Number(cfg["box"]); |
||||
rowData.qqcfg_custom.weiyi_custom = Number(cfg["weiyi"]); |
||||
rowData.qqcfg_custom.qqversions_custom = String(cfg["qqversions"]); |
||||
} |
||||
|
||||
if (null != row["ttcfg"]) { |
||||
let cfg = row["ttcfg"]; |
||||
rowData.ttcfg_custom.moreGameSwitch_custom = Number(cfg["moreGameSwitch"]); |
||||
rowData.ttcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.ttcfg_custom.luping_custom = Number(cfg["luping"]); |
||||
rowData.ttcfg_custom.ttversions_custom = String(cfg["ttversions"]); |
||||
|
||||
rowData.ttcfg_custom.videoGetPowerNum = Number(cfg["videoGetPowerNum"]); |
||||
rowData.ttcfg_custom.powerRecoverTime = Number(cfg["powerRecoverTime"]); |
||||
rowData.ttcfg_custom.fisrtPower = Number(cfg["fisrtPower"]); |
||||
rowData.ttcfg_custom.maxPower = Number(cfg["maxPower"]); |
||||
rowData.ttcfg_custom.videoFirstGetPowerNum = Number(cfg["videoFirstGetPowerNum"]); |
||||
rowData.ttcfg_custom.videoSecondGetPowerNum = Number(cfg["videoSecondGetPowerNum"]); |
||||
rowData.ttcfg_custom.videoWxtlPowerNum = Number(cfg["videoWxtlPowerNum"]); |
||||
rowData.ttcfg_custom.videoUnlockDayNum = Number(cfg["videoUnlockDayNum"]); |
||||
|
||||
} |
||||
|
||||
if (null != row["tt2cfg"]) { |
||||
let cfg = row["tt2cfg"]; |
||||
rowData.tt2cfg_custom.startSwitch_custom = Number(cfg["startSwitch"]); |
||||
rowData.tt2cfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); |
||||
rowData.tt2cfg_custom.getSwitch_custom = Number(cfg["getSwitch"]); |
||||
rowData.tt2cfg_custom.useSwitch_custom = Number(cfg["useSwitch"]); |
||||
rowData.tt2cfg_custom.reliveSwitch_custom = Number(cfg["reliveSwitch"]); |
||||
rowData.tt2cfg_custom.screenCapSwitch_custom = Number(cfg["screenCapSwitch"]); |
||||
rowData.tt2cfg_custom.boxSwitch_custom = Number(cfg["boxSwitch"]); |
||||
} |
||||
|
||||
if (null != row["vivocfg"]) { |
||||
let cfg = row["vivocfg"]; |
||||
rowData.vivocfg_custom.yuanshengSwitch_custom = Number(cfg["yuanshengSwitch"]); |
||||
rowData.vivocfg_custom.yuansheng_custom = Number(cfg["yuansheng"]); |
||||
rowData.vivocfg_custom.yuanshengSwitch2_custom = Number(cfg["yuanshengSwitch2"]); |
||||
rowData.vivocfg_custom.yuansheng2_custom = Number(cfg["yuansheng2"]); |
||||
rowData.vivocfg_custom.chapingSwitch_custom = Number(cfg["chapingSwitch"]); |
||||
rowData.vivocfg_custom.chaping_custom = Number(cfg["chaping"]); |
||||
rowData.vivocfg_custom.addToDesktop_custom = Number(cfg["addToDesktop"]); |
||||
rowData.vivocfg_custom.vivoversions_custom = String(cfg["vivoversions"]); |
||||
rowData.vivocfg_custom.btnShowTimer_custom = Number(cfg["btnShowTimer"]); |
||||
} |
||||
|
||||
if (null != row["wxcfg"]) { |
||||
let cfg = row["wxcfg"]; |
||||
rowData.wxcfg_custom.kuangdian_custom = Number(cfg["kuangdian"]); |
||||
rowData.wxcfg_custom.kuangdianBanner_custom = Number(cfg["kuangdianBanner"]); |
||||
rowData.wxcfg_custom.kuangdianLevelSpcacing_custom = Number(cfg["kuangdianLevelSpcacing"]); |
||||
rowData.wxcfg_custom.ForceSkip_custom = Number(cfg["ForceSkip"]); |
||||
rowData.wxcfg_custom.SlideSkip_custom = Number(cfg["SlideSkip"]); |
||||
rowData.wxcfg_custom.tc_ForceSkip_custom = Number(cfg["tc_ForceSkip"]); |
||||
rowData.wxcfg_custom.tc_SlideSkip_custom = Number(cfg["tc_SlideSkip"]); |
||||
rowData.wxcfg_custom.phb_ForceSkip_custom = Number(cfg["phb_ForceSkip"]); |
||||
rowData.wxcfg_custom.phb_SlideSkip_custom = Number(cfg["phb_SlideSkip"]); |
||||
rowData.wxcfg_custom.tc_continueBanner_custom = Number(cfg["tc_continueBanner"]); |
||||
rowData.wxcfg_custom.MainPop_custom = Number(cfg["MainPop"]); |
||||
rowData.wxcfg_custom.hyrw_ForceSkip_custom = Number(cfg["hyrw_ForceSkip"]); |
||||
rowData.wxcfg_custom.hyrw_SlideSkip_custom = Number(cfg["hyrw_SlideSkip"]); |
||||
rowData.wxcfg_custom.hyrw_continueBanner_custom = Number(cfg["hyrw_continueBanner"]); |
||||
rowData.wxcfg_custom.handShow_custom = Number(cfg["handShow"]); |
||||
rowData.wxcfg_custom.firstOpen_custom = Number(cfg["firstOpen"]); |
||||
rowData.wxcfg_custom.startVideo_custom = Number(cfg["startVideo"]); |
||||
rowData.wxcfg_custom.mainBackBtn_custom = Number(cfg["mainBackBtn"]); |
||||
rowData.wxcfg_custom.mainMoreBtn_custom = Number(cfg["mainMoreBtn"]); |
||||
rowData.wxcfg_custom.mainItemBtn_custom = Number(cfg["mainItemBtn"]); |
||||
rowData.wxcfg_custom.mainExportShow_custom = Number(cfg["mainExportShow"]); |
||||
rowData.wxcfg_custom.isJumpHotPlay_custom = Number(cfg["isJumpHotPlay"]); |
||||
rowData.wxcfg_custom.moreGameShowLevel_custom = Number(cfg["moreGameShowLevel"]); |
||||
rowData.wxcfg_custom.setUserScan_custom = Number(cfg["setUserScan"]); |
||||
} |
||||
|
||||
|
||||
if (null != row["bdcfg"]) { |
||||
let cfg = row["bdcfg"]; |
||||
rowData.bdcfg_custom.btnDelayTime_custom = Number(cfg["btnDelayTime"]); |
||||
rowData.bdcfg_custom.signInSwitch_custom = Number(cfg["signInSwitch"]); |
||||
rowData.bdcfg_custom.taskVideo_custom = Number(cfg["taskVideo"]); |
||||
rowData.bdcfg_custom.version_custom = String(cfg["version"]) |
||||
} |
||||
|
||||
if (null != row["cocosWxConfig"]) { |
||||
let cfg = row["cocosWxConfig"]; |
||||
|
||||
let loopAd = cfg["loopAd"]; |
||||
let skinTrial = cfg["skinTrial"]; |
||||
let revival = cfg["revival"]; |
||||
let moreGoodGame = cfg["moreGoodGame"]; |
||||
let bigLoopAd = cfg["bigLoopAd"]; |
||||
let settlePage = cfg["settlePage"]; |
||||
let moreGoodGame2 = cfg["moreGoodGame2"]; |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.loopAd) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.loopAd, key)) { |
||||
if (key == "bgColor") { |
||||
rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? String(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.loopAd[key] = loopAd[key] != null ? Number(loopAd[key]) : rowData.cocosWxcfg_custom.loopAd[key]; |
||||
} |
||||
|
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.skinTrial) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.skinTrial, key)) { |
||||
rowData.cocosWxcfg_custom.skinTrial[key] = skinTrial[key] != null ? Number(skinTrial[key]) : rowData.cocosWxcfg_custom.skinTrial[key]; |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.revival) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.revival, key)) { |
||||
rowData.cocosWxcfg_custom.revival[key] = revival[key] != null ? Number(revival[key]) : rowData.cocosWxcfg_custom.revival[key]; |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.moreGoodGame) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? String(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.moreGoodGame[key] = moreGoodGame[key] != null ? Number(moreGoodGame[key]) : rowData.cocosWxcfg_custom.moreGoodGame[key]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.bigLoopAd) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.bigLoopAd, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? String(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.bigLoopAd[key] = bigLoopAd[key] != null ? Number(bigLoopAd[key]) : rowData.cocosWxcfg_custom.bigLoopAd[key]; |
||||
} |
||||
} |
||||
} |
||||
|
||||
for (const key in rowData.cocosWxcfg_custom.settlePage) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.settlePage, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? String(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.settlePage[key] = settlePage[key] != null ? Number(settlePage[key]) : rowData.cocosWxcfg_custom.settlePage[key]; |
||||
} |
||||
} |
||||
} |
||||
for (const key in rowData.cocosWxcfg_custom.moreGoodGame2) { |
||||
if (Object.prototype.hasOwnProperty.call(rowData.cocosWxcfg_custom.moreGoodGame2, key)) { |
||||
if (key == "bgColor" || key == "maskColor") { |
||||
rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? String(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; |
||||
} else { |
||||
rowData.cocosWxcfg_custom.moreGoodGame2[key] = moreGoodGame2[key] != null ? Number(moreGoodGame2[key]) : rowData.cocosWxcfg_custom.moreGoodGame2[key]; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
|
||||
if (null != row['quickgamecfg']) { |
||||
let cfg = row["quickgamecfg"]; |
||||
rowData.quickgamecfg_custom.autoExport = Number(cfg["autoExport"]); |
||||
rowData.quickgamecfg_custom.bigExportColor = cfg["bigExportColor"]; |
||||
rowData.quickgamecfg_custom.bigExportColor_g = cfg["bigExportColor_g"]; |
||||
rowData.quickgamecfg_custom.bigExportBannerType = Number(cfg["bigExportBannerType"]); |
||||
rowData.quickgamecfg_custom.bigExportShowBannerTime = Number(cfg["bigExportShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.bigExportHideBannerTime = Number(cfg["bigExportHideBannerTime"]); |
||||
rowData.quickgamecfg_custom.hotplayBannerType = Number(cfg["hotplayBannerType"]); |
||||
rowData.quickgamecfg_custom.hotplayShowBannerTime = Number(cfg["hotplayShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.hotplayHideBannerTime = Number(cfg["hotplayHideBannerTime"]); |
||||
rowData.quickgamecfg_custom.recommendBannerType = Number(cfg["recommendBannerType"]); |
||||
rowData.quickgamecfg_custom.recommendShowBannerTime = Number(cfg["recommendShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.recommendButMoveTime = Number(cfg["recommendButMoveTime"]); |
||||
rowData.quickgamecfg_custom.endBannerType = Number(cfg["endBannerType"]); |
||||
rowData.quickgamecfg_custom.endShowBannerTime = Number(cfg["endShowBannerTime"]); |
||||
rowData.quickgamecfg_custom.endButMoveTime = Number(cfg["endButMoveTime"]); |
||||
rowData.quickgamecfg_custom.playButVideo = cfg["playButVideo"] == null ? 0 : Number(cfg["playButVideo"]); |
||||
rowData.quickgamecfg_custom.crazyBannerHideTime = cfg["crazyBannerHideTime"] == null ? 0 : Number(cfg["crazyBannerHideTime"]); //切出去则不考虑
|
||||
|
||||
let crazyShowString = cfg['crazyShowBanner']; |
||||
if (crazyShowString) { |
||||
let tmp = crazyShowString.split(','); |
||||
rowData.quickgamecfg_custom.crazyShowBanner[0] = Number(tmp[0]); |
||||
rowData.quickgamecfg_custom.crazyShowBanner[1] = Number(tmp[1]); |
||||
} |
||||
} |
||||
|
||||
this._data_custom.push(rowData); |
||||
} |
||||
} |
||||
else { |
||||
this._data_custom.push(new AppSwitchData()); |
||||
} |
||||
if (finish) { |
||||
callFM_custom(finish) |
||||
} |
||||
}) |
||||
} |
||||
|
||||
|
||||
public getAppSwitchData_custom(): AppSwitchData { |
||||
return this._data_custom[0]; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "363a2fc4-7d4c-4e8c-b640-254cc4c39d5c", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "394f006f-48af-46ea-828e-61c4d2c23c9c", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,167 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:41 |
||||
*/ |
||||
|
||||
|
||||
/** |
||||
* 事件 相关 |
||||
*/ |
||||
export enum ryw_Event { |
||||
None_custom = 0, |
||||
//导出广告 取消
|
||||
ryw_ADKRQ_ClickQuit_custom = 400, |
||||
ryw_Export3_Dismiss_custom = 401, //关闭导出页
|
||||
|
||||
ryw_App_CloseFirstLoadingView_custom = 500, |
||||
ryw_AD_OnShareAdFail_custom = 501, |
||||
//当界面打开
|
||||
ryw_Game_OnViewOpen_custom = 600,//{view : ViewDef}
|
||||
//当界面关闭
|
||||
ryw_Game_OnViewClose_custom = 601,//{view : ViewDef}
|
||||
//当玩家金币变动
|
||||
ryw_Game_OnUserMoneyChange_custom = 701,//{curr:number,last:number}
|
||||
//当玩家钻石变动
|
||||
ryw_Game_OnUserCrystalChange_custom = 702,//{curr:number,last:number}
|
||||
//当玩家商店解锁
|
||||
ryw_Game_OnUserUnlockedStore_custom = 703,//{unlocked:number}
|
||||
//当关卡开始
|
||||
ryw_Game_OnLevelStart_custom = 1000, |
||||
//当关卡结束
|
||||
ryw_Game_OnLevelComplate_custom = 1001, |
||||
//误点预加载完毕
|
||||
ryw_AD_WudianBanner_LoadComplete_custom = 2217, |
||||
//显示误点Banner
|
||||
ryw_AD_WudianBanner_Show_custom = 2218, |
||||
//影藏误点Banner
|
||||
ryw_AD_WudianBanner_Hide_custom = 2219, |
||||
//预加载Banner
|
||||
ryw_AD_WudianBanner_PreLoad_custom = 2220, |
||||
//当IP屏蔽状态更新
|
||||
ryw_App_OnUpdateIpBlockState_custom = 2221,//{ipBlockFlag : number}
|
||||
//友盟打点
|
||||
ryw_Umeng_custom = 2230, |
||||
|
||||
//平台服务器登录的状态
|
||||
ryw_PlatformLoginState_custom = 2997, |
||||
//自己服务器登录的状态
|
||||
ryw_NetLoginState_custom = 2998, |
||||
//获取用户数据
|
||||
ryw_NetUserDataState_custom = 2999, |
||||
|
||||
//视频播放完成
|
||||
ryw_Video_Finish_custom = 3000, |
||||
//视频播放未完成
|
||||
ryw_Video_UnFinish_custom = 3001, |
||||
//是否播放失败
|
||||
ryw_Video_Error_custom = 3002, |
||||
//设置参数
|
||||
ryw_SET_LIST_PARAM = 3003, |
||||
|
||||
//更新体力
|
||||
updatePhysicalPower = 3004, |
||||
//关闭提示
|
||||
tooltipClose = 3005, |
||||
//关闭提示
|
||||
timeOut = 3006, |
||||
//关闭提示
|
||||
stopEffect = 3007, |
||||
//关闭提示
|
||||
unLockLevel = 3008, |
||||
//关闭提示
|
||||
unLockAllLevelTmp = 3009, |
||||
//确定进入关卡
|
||||
checkInLevel = 3010, |
||||
//停止计时
|
||||
stopTimeTick = 3011, |
||||
//开始计时
|
||||
startTimeTick = 3012, |
||||
//关闭提示
|
||||
unLockAllLevelTmp_fkwz = 3013, |
||||
//关闭提示
|
||||
updateLevel = 3014, |
||||
//看视频开始
|
||||
showAddTimeAd = 9001, |
||||
//加时
|
||||
addTimeSucc = 9002, |
||||
//加时
|
||||
addTimeFail = 9003, |
||||
|
||||
//找茬1209密码
|
||||
Check1209Mima = 9004, |
||||
Check1303Mima = 9005, |
||||
Check1501Mima = 9006, |
||||
//游戏中获取提示视频播放完成
|
||||
ryw_GameScene_ToolTip_AD = 3020, |
||||
//游戏中获取答案视频播放完成
|
||||
ryw_GameScene_Answer_AD = 3021, |
||||
|
||||
|
||||
loadFinish = 3022, |
||||
loadGame = 3023, |
||||
|
||||
|
||||
touchMoveCheck = 3024, |
||||
|
||||
touchChaDianCheck = 3025, |
||||
|
||||
chooseResult = 3026, |
||||
|
||||
unLockAllLevelUpdate = 3027, |
||||
|
||||
GuiZeGameBtnClick = 3028, |
||||
|
||||
NormalTouchMoveCheck = 3029, |
||||
|
||||
openGuizeLayerEvent = 3030, |
||||
|
||||
NormalTouchEndCheck = 3031, |
||||
|
||||
DirectTouchMoveCheck = 3032, |
||||
|
||||
XianSuoPopUpEnd = 3033, |
||||
|
||||
XianSuoHeChengEvent = 3034, |
||||
|
||||
DuiChooseResult = 3035, |
||||
|
||||
itemIconTouchTrue = 3036, |
||||
|
||||
roleNodeTouchCheck = 3037, |
||||
|
||||
itemIconTouchFalse = 3040, |
||||
|
||||
openBGMove = 3038, |
||||
unLockAllLevelUpdate_fkwz = 3039, |
||||
unlockAllTipLevelUpdate = 3040, |
||||
unlockAllTipLevelFinish = 3041, |
||||
|
||||
NormalTouchMoveDirCheck = 3042, |
||||
unlockLevel = 3043, |
||||
|
||||
WordGameRevive = 3044, |
||||
//Tips:在这条添加定义你自己需要的事件,从10000号开始。记得分段分类管理不同类型事件。如果事件有传递参数 "必须" 在事件后面用注释写明事件参数结构。
|
||||
ryw_updateContentShow = 10000, |
||||
game_hide_bottom = 10002, |
||||
game_show_bottom = 10003, |
||||
Game_Fail = 10004, |
||||
Game_Win = 10005, |
||||
game_restart = 10006, |
||||
start_hideWxtlBtn = 10007, |
||||
game_continue = 10008, |
||||
finish_newer = 10009, |
||||
finish_scale = 10010, |
||||
finish_left = 10011, |
||||
finish_game = 10012, |
||||
|
||||
/**检测是否是剧情茬点 */ |
||||
CheckIsChaDian = 550, |
||||
|
||||
/**检测侧边栏是否可用 */ |
||||
CheckCeBianLan = 100010, |
||||
|
||||
/**检测是否从侧边栏进入 */ |
||||
CheckIsEnterFromCeBianLan = 100011, |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "94947a02-a5c7-4667-aa1e-b8a99d3860a8", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,76 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:41 |
||||
*/ |
||||
|
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
|
||||
/** |
||||
* 事件管理 |
||||
*/ |
||||
export default class EventMgr { |
||||
private static eventTarget_custom: cc.EventTarget = new cc.EventTarget(); |
||||
|
||||
|
||||
/** |
||||
* 广播事件 通过事件名发送自定义事件 |
||||
* @param name
|
||||
* @param arg1
|
||||
* @param arg2
|
||||
* @param arg3
|
||||
* @param arg4
|
||||
* @param arg5
|
||||
*/ |
||||
public static emitEvent_custom(name: ryw_Event, arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) { |
||||
// LogUtils.info_custom("广播事件:" + name);
|
||||
this.eventTarget_custom.emit(name + "", arg1, arg2, arg3, arg4, arg5); |
||||
} |
||||
/** |
||||
* 注册事件
|
||||
* 注册事件目标的特定事件类型回调。这种类型的事件应该被 `emit` 触发。 |
||||
* @param name
|
||||
* @param callback
|
||||
* @param target
|
||||
*/ |
||||
public static onEvent_custom(name: ryw_Event, callback: Function, target: any): void { |
||||
this.eventTarget_custom.on(name + "", callback, target); |
||||
} |
||||
|
||||
/** |
||||
* 注册单次事件
|
||||
* 注册事件目标的特定事件类型回调,回调会在第一时间被触发后删除自身。 |
||||
* @param name
|
||||
* @param callback
|
||||
* @param target
|
||||
*/ |
||||
public static onceEvent_custom(name: ryw_Event, callback: (arg1?: any, arg2?: any, arg3?: any, arg4?: any, arg5?: any) => void, target?: any): void { |
||||
this.eventTarget_custom.once(name + "", callback, target); |
||||
} |
||||
|
||||
/** |
||||
* 移除事件注册
|
||||
* 删除之前用同类型,回调,目标或 useCapture 注册的事件监听器,如果只传递 name,将会删除 name 类型的所有事件监听器。 |
||||
* @param name
|
||||
* @param callback
|
||||
* @param target
|
||||
*/ |
||||
public static offEvent_custom(name: ryw_Event, callback?: Function, target?: any): void { |
||||
this.eventTarget_custom.off(name + "", callback, target); |
||||
} |
||||
|
||||
/** |
||||
* 删除当前EventTarget指定目标(target 参数)注册的所有事件监听器。 |
||||
这个函数无法删除当前 EventTarget 的所有事件监听器,也无法删除 target 参数所注册的所有事件监听器。 |
||||
这个函数只能删除 target 参数在当前 EventTarget 上注册的所有事件监听器。 |
||||
* @param target
|
||||
*/ |
||||
public static offTargetEvent_custom(target: any): void { |
||||
this.eventTarget_custom.targetOff(target); |
||||
} |
||||
|
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "f8dfe260-7662-47a3-a6ed-390cdfc19cec", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "b6081078-6158-4679-967f-af58fa3ea1b8", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,39 @@ |
||||
/* |
||||
* @Description:
|
||||
* @Autor: YeeChan |
||||
* @Date: 2019-11-26 14:13:43 |
||||
*/ |
||||
|
||||
/** |
||||
* 事件绑定接口 |
||||
*/ |
||||
export class FMListener { |
||||
callback: Function; //对象回调方法
|
||||
target: any; //对象本身
|
||||
} |
||||
|
||||
/** |
||||
* 添加一个绑定接口 |
||||
* @param callback //对象回调方法
|
||||
* @param target //对象本身
|
||||
* @returns FMListener |
||||
*/ |
||||
export function handleFM_custom(callback: Function, target: any): FMListener { |
||||
return { "target": target, "callback": callback } |
||||
} |
||||
|
||||
/** |
||||
* call一个绑定接口 |
||||
* @param FMListener
|
||||
* @param ...argArray
|
||||
* @returns any |
||||
*/ |
||||
export function callFM_custom(inter: FMListener, ...argArray: any[]): any { |
||||
if (inter && inter.callback) { |
||||
return inter.callback.call(inter.target, ...argArray) |
||||
} |
||||
} |
||||
//导出
|
||||
(<any>window).FMListener = FMListener; |
||||
(<any>window).handleFM_custom = handleFM_custom; |
||||
(<any>window).callFM_custom = callFM_custom; |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "960dd3d6-ea99-425f-bad3-42ec994280a8", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,649 @@ |
||||
import LoadingView from "./View/Logo/LoadingView"; |
||||
import AppPlatform from "./Util/AppPlatform"; |
||||
import AppConfig from "./Config/AppConfig"; |
||||
import AppSwitchConfig from "./Config/AppSwitchConfig"; |
||||
import { LogUtils } from "./Util/LogUtils"; |
||||
import BundleMgr from "./Mgr/BundleMgr"; |
||||
import GameMgr from "./Mgr/GameMgr"; |
||||
import User from "./User/User"; |
||||
import RYSDK from "./RYSDK/RYSDK"; |
||||
import HttpUnit from "./NetWork/HttpUnit"; |
||||
import WudianMgr from "./Mgr/WudianMgr"; |
||||
import DialogLoading from "./View/Logo/DialogLoading"; |
||||
import { UmengMgr } from "./Mgr/UmengMgr"; |
||||
import DebugInfoMgr from "./Mgr/DebugInfoMgr"; |
||||
import EventMgr from "./Event/EventMgr"; |
||||
import { ryw_Event } from "./Event/EventEnum"; |
||||
import Common5 from "../Platform/th/Common5"; |
||||
import CommonDefine from "../Platform/th/CommonDefine"; |
||||
import GameReport from "./Report/ZyZyReport"; |
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
/** |
||||
* 主页场景 |
||||
*/ |
||||
|
||||
@ccclass |
||||
export default class Main extends cc.Component { |
||||
|
||||
public static isBack_custom: boolean = false; //是否从后台回到前台
|
||||
//加载页面
|
||||
@property({ tooltip: "加载页面预支", type: cc.Node }) |
||||
private loadingPrefab: cc.Node = null; |
||||
@property({ tooltip: "登录失败", type: cc.Node }) |
||||
private dialogLoadPrefab: cc.Node = null; |
||||
// @property({ tooltip: "广告预支", type: cc.Prefab })
|
||||
// private adPrefab: cc.Prefab = null;
|
||||
|
||||
//-----------------
|
||||
private loadView_custom: LoadingView; |
||||
private dialogLoading_custom: DialogLoading; |
||||
|
||||
//加载分包的进度最终位置
|
||||
private readonly loadSubpackageTotal_custom: number = 0.8; |
||||
//网络加载的最终位置
|
||||
private readonly loadHttpNetworkTotal_custom: number = 1; |
||||
|
||||
//当前加载的分包下标
|
||||
private subpackageIndex_custom: number = 0; |
||||
//公共的包大小
|
||||
private subpackageSum_custom: number = 0; |
||||
//下一步要到达的进度最大值(0-1)
|
||||
private needProcessNum_custom: number = 0; |
||||
|
||||
//加载的状态 0未开始 1加载正常进度 2加载慢慢速度 3结束,进度条快速完成 4等待加载场景
|
||||
private loadingState_custom: number = 0; |
||||
//速度
|
||||
private loadingSpeed_custom: number = 0; |
||||
|
||||
private isLoadScene: boolean = false; |
||||
|
||||
onLoad() { |
||||
ZYSDK.ZYSDK.initSdk(); |
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
AppConfig.AppID_custom = AppConfig.TT_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.TT_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.TT_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.TT_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.TT_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false; |
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.TT_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.TT_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.TT_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.TT_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.TT_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.TT_MoreGameLocationID_custom; |
||||
|
||||
} else if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
AppConfig.AppID_custom = AppConfig.WX_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.WX_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.WX_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.WX_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.WX_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = true; |
||||
if (AppConfig.closeUseRYSDK_custom) {//强制关闭的情况
|
||||
AppConfig.UseRYSDK_custom = false; |
||||
} |
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.WX_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.WX_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.WX_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.WX_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.WX_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.WX_MoreGameLocationID_custom; |
||||
} else if (AppPlatform.is_QQ_PLAY_custom()) { |
||||
AppConfig.AppID_custom = AppConfig.QQ_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.QQ_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.QQ_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.QQ_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.QQ_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false; |
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.QQ_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.QQ_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.QQ_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.QQ_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.QQ_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.QQ_MoreGameLocationID_custom; |
||||
} else if (AppPlatform.is_OPPO_GAME_custom()) { |
||||
AppConfig.AppID_custom = AppConfig.OPPO_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.OPPO_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.OPPO_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.OPPO_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.OPPO_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false; |
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.OPPO_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.OPPO_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.OPPO_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.OPPO_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.OPPO_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.OPPO_MoreGameLocationID_custom; |
||||
|
||||
} else if (AppPlatform.is_VIVO_GAME_custom()) { |
||||
AppConfig.AppID_custom = AppConfig.VIVO_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.VIVO_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.VIVO_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.VIVO_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.VIVO_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false; |
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.VIVO_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.VIVO_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.VIVO_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.VIVO_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.VIVO_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.VIVO_MoreGameLocationID_custom; |
||||
} else if (AppPlatform.is_Android_custom() || AppPlatform.is_Iphone_custom()) {//android
|
||||
AppConfig.AppID_custom = AppConfig.APK_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.APK_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.APK_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.APK_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.APK_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false; |
||||
|
||||
} else {//其他开发 用微信的
|
||||
AppConfig.AppID_custom = AppConfig.TT_APP_ID_custom; |
||||
AppConfig.state_custom = AppConfig.TT_state_custom; |
||||
AppConfig.gameid_custom = AppConfig.TT_gameid_custom; |
||||
AppConfig.ResServer_custom = AppConfig.TT_ResServer_custom; |
||||
AppConfig.Versions_custom = AppConfig.TT_Versions_custom; |
||||
AppConfig.UseRYSDK_custom = false;//开发模式不支持
|
||||
|
||||
AppConfig.LoopAdLocationID_custom = AppConfig.TT_LoopAdLocationID_custom; |
||||
AppConfig.BannerAdLocationID_custom = AppConfig.TT_BannerAdLocationID_custom; |
||||
AppConfig.InsertAdLocationID_custom = AppConfig.TT_InsertAdLocationID_custom; |
||||
AppConfig.AniAdLocationID_custom = AppConfig.TT_AniAdLocationID_custom; |
||||
AppConfig.HistoryLocationID_custom = AppConfig.TT_HistoryLocationID_custom; |
||||
AppConfig.MoreGameLocationID_custom = AppConfig.TT_MoreGameLocationID_custom; |
||||
} |
||||
//先调用
|
||||
// WudianMgr.UpdateIpBlockState_custom();
|
||||
|
||||
|
||||
|
||||
this.loadView_custom = this.loadingPrefab.getComponent(LoadingView); |
||||
// this.dialogLoading_custom = this.dialogLoadPrefab.getComponent(DialogLoading);
|
||||
// this.dialogLoading_custom.closeView();
|
||||
// this.dialogLoading_custom.onListenerEventView_custom(handleFM_custom((event) => {
|
||||
// if (event == this.dialogLoading_custom.EventEnumView_custom.ClickLoad) {//重新登录
|
||||
// this.login_custom();
|
||||
|
||||
// } else if (event == this.dialogLoading_custom.EventEnumView_custom.ClickVisitor) {//游客登录
|
||||
// this.Login_fail_custom("游客登录");
|
||||
// }
|
||||
// }, this));
|
||||
|
||||
this.subpackageSum_custom = AppConfig.subResArray_custom.length; |
||||
this.loadView_custom.setProcess_custom(0); |
||||
|
||||
Common5.loadConfigLocal_custom(); |
||||
// Common5.loadPassConfig_custom();
|
||||
|
||||
this.loadSubpackage_custom(); |
||||
//加载配置AppSwitchConfig
|
||||
// AppSwitchConfig.getInstance_custom().loadUrlConfig_custom(handleFM_custom(() => {
|
||||
// LogUtils.log_custom("加载 AppSwitchConfig 完成")
|
||||
// Common5.initPowerConfig();
|
||||
// DebugInfoMgr.setDebug_custom();
|
||||
// this.setUserScan_custom();
|
||||
|
||||
// // //实例化广告常驻节点
|
||||
// // if (this.adPrefab) {
|
||||
// // console.log("实例化广告节点");
|
||||
|
||||
// // let ad = cc.instantiate(this.adPrefab);
|
||||
// // cc.game.addPersistRootNode(ad);
|
||||
// // }
|
||||
// }, this), handleFM_custom(() => {
|
||||
// console.log("加载失败。。。")
|
||||
// }, this))
|
||||
|
||||
// 2023 12 16 打开版本检测
|
||||
if(AppPlatform.is_TT_GAME_custom()){ |
||||
|
||||
}else if(AppPlatform.is_WECHAT_GAME_custom()){ |
||||
AppPlatform.checkUpdate_custom(); |
||||
} |
||||
} |
||||
|
||||
start() { |
||||
} |
||||
|
||||
/** |
||||
* 加载分包 |
||||
*/ |
||||
private loadSubpackage_custom() { |
||||
var self = this; |
||||
//有分包没有加载完成
|
||||
if (this.subpackageIndex_custom < this.subpackageSum_custom) { |
||||
let platform = ""; |
||||
let subpackageName = AppConfig.subResArray_custom[this.subpackageIndex_custom]; |
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
platform = "tt"; |
||||
} else if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
platform = "wx"; |
||||
} |
||||
else if (AppPlatform.is_OPPO_GAME_custom()) { |
||||
platform = "qg"; |
||||
} |
||||
else if (AppPlatform.is_QQ_PLAY_custom()) { |
||||
platform = "qq"; |
||||
} |
||||
LogUtils.log_custom("加载分包 " + subpackageName + " platform " + platform); |
||||
|
||||
let proSum = ((this.subpackageIndex_custom + 1) / this.subpackageSum_custom) * self.loadSubpackageTotal_custom; |
||||
this.setStartLoadingPerNum_custom(proSum) |
||||
BundleMgr.loadBundleByName_custom(subpackageName, handleFM_custom((err, bundle) => { |
||||
if (err) { |
||||
console.error(err); |
||||
} else { |
||||
self.subpackageIndex_custom = self.subpackageIndex_custom + 1; |
||||
|
||||
AppPlatform.loadSubpackageFinish_custom(subpackageName); |
||||
// this.scheduleOnce(()=>{
|
||||
// if(!this.isLoadScene){
|
||||
// this.isLoadScene = true
|
||||
// this.onLoadResComplate_custom();//预加载完成 只需要加载完成一个就进入场景 WordGame游戏里面使用
|
||||
// }
|
||||
|
||||
self.loadSubpackage_custom(); |
||||
// },0.5);
|
||||
|
||||
} |
||||
}, this)); |
||||
// }
|
||||
} else {//加载完成了
|
||||
|
||||
this.onLoadResComplate_custom(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置下一个加载步骤可以到的位置 |
||||
* @param preNum
|
||||
*/ |
||||
private setStartLoadingPerNum_custom(preNum: number) { |
||||
this.setLoadingState_custom(1, preNum); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 设置加载的进度状态 |
||||
* @param state
|
||||
*/ |
||||
private setLoadingState_custom(state: number, preNum: number) { |
||||
this.loadingState_custom = state; |
||||
this.needProcessNum_custom = preNum; |
||||
switch (state) { |
||||
case 0: |
||||
break; |
||||
case 1: |
||||
this.loadingSpeed_custom = 1 / 80; |
||||
break; |
||||
case 2: |
||||
this.loadingSpeed_custom = 1 / 200; |
||||
break; |
||||
case 3://下载完成了
|
||||
{ |
||||
let precess = this.loadView_custom.getProcess_custom(); |
||||
let psum = 1 - precess; |
||||
if (psum > 0) { |
||||
this.loadingSpeed_custom = psum / 20; |
||||
} else { |
||||
this.loadingSpeed_custom = 1 / 2; |
||||
} |
||||
|
||||
} |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 假的进度 |
||||
* @param dt
|
||||
*/ |
||||
protected update(dt: number): void { |
||||
if (this.loadView_custom) { |
||||
let precess = this.loadView_custom.getProcess_custom(); |
||||
let nextPrecess = precess + this.loadingSpeed_custom; |
||||
|
||||
switch (this.loadingState_custom) { |
||||
case 0: |
||||
break; |
||||
case 1://正常速度
|
||||
if (nextPrecess >= this.needProcessNum_custom * 0.7) { |
||||
//nextPrecess = this.needProcessNum * 0.7;
|
||||
if (nextPrecess >= this.needProcessNum_custom) { |
||||
nextPrecess = this.needProcessNum_custom; |
||||
} |
||||
//进入慢速度
|
||||
this.setLoadingState_custom(2, this.needProcessNum_custom); |
||||
} |
||||
break; |
||||
case 2://慢速度
|
||||
if (nextPrecess >= this.needProcessNum_custom) { |
||||
nextPrecess = this.needProcessNum_custom; |
||||
} |
||||
break; |
||||
case 3://急速进度
|
||||
if (nextPrecess >= 1) { |
||||
nextPrecess = 1; |
||||
this.loadingState_custom = 4; |
||||
|
||||
} |
||||
break; |
||||
default: |
||||
break; |
||||
} |
||||
|
||||
if (precess != nextPrecess) { |
||||
this.loadView_custom.setProcess_custom(nextPrecess); |
||||
} |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 设置下载全部完成,可以进游戏了 |
||||
*/ |
||||
private setDownloadOver_custom() { |
||||
this.initGame_custom(); |
||||
this.setLoadingState_custom(3, 1); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 登录失败 |
||||
*/ |
||||
private Login_fail_custom(res?: any) { |
||||
console.log("登陆失败!!!" + res); |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_PlatformLoginState_custom, { state: 1, info: "平台登录失败" }) |
||||
if (res) { |
||||
UmengMgr.sendLoginReportInfo_custom("平台登录", 1, "平台登录失败," + res); |
||||
} else { |
||||
UmengMgr.sendLoginReportInfo_custom("平台登录", 1, "平台登录失败"); |
||||
} |
||||
let data = cc.sys.localStorage.getItem("data" + AppConfig.AppID_custom); |
||||
if (data) { |
||||
console.log("ly+++++++++ 有存档"); |
||||
|
||||
User.initiUser_custom(JSON.parse(data)); |
||||
} else { |
||||
console.log("ly+++++++++ 无存档"); |
||||
|
||||
User.initiUser_custom(null); |
||||
} |
||||
this.setDownloadOver_custom(); |
||||
} |
||||
|
||||
/** |
||||
* 各个平台登录成功后 来自己服务器登录 |
||||
* @param code
|
||||
*/ |
||||
private go_Login_custom(code: any) { |
||||
User.code_custom = code |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_PlatformLoginState_custom, { state: 0, info: "平台登录成功" }) |
||||
UmengMgr.sendLoginReportInfo_custom("平台登录", 0, "平台登录成功"); |
||||
console.log("准备登陆自己的平台") |
||||
|
||||
// if (AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().isNetWorkGame_custom != 1) {
|
||||
//存本地
|
||||
let data = cc.sys.localStorage.getItem("data" + AppConfig.AppID_custom); |
||||
if (data) { |
||||
console.log("ly+++++++++ 有存档"); |
||||
|
||||
User.initiUser_custom(JSON.parse(data)); |
||||
} else { |
||||
console.log("ly+++++++++ 无存档"); |
||||
|
||||
User.initiUser_custom(null); |
||||
} |
||||
this.setDownloadOver_custom(); |
||||
// }
|
||||
// else {
|
||||
// //登录公司服务器
|
||||
// this.login_custom();
|
||||
// }
|
||||
|
||||
} |
||||
|
||||
//登录
|
||||
private login_custom() { |
||||
HttpUnit.login_custom((res: any) => { |
||||
if (res.code == 1) { |
||||
LogUtils.log_custom("登陆成功!!!"); |
||||
User.token_custom = res.data.token; |
||||
User.openId_custom = res.data.openid; |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetLoginState_custom, { state: 0, info: "登录成功" }) |
||||
UmengMgr.sendLoginReportInfo_custom("登录", 0, "登录成功"); |
||||
//ALD.aldSendOpenId_custom(User.openId_custom);
|
||||
HttpUnit.getGameData_custom((res: any) => { |
||||
LogUtils.log_custom("获取用户数据成功!!!"); |
||||
if (1 == res.code) { |
||||
User.initiUser_custom(res.data); |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetUserDataState_custom, { state: 0, info: "获取用户数据成功" }) |
||||
UmengMgr.sendLoginReportInfo_custom("用户数据", 0, "获取用户数据成功"); |
||||
} else { |
||||
User.initiUser_custom(null); |
||||
let str = res.code; |
||||
if (res.msg) { |
||||
str = str + ':' + res.msg; |
||||
} |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetUserDataState_custom, { state: 2, info: str }) |
||||
UmengMgr.sendLoginReportInfo_custom("用户数据", 2, "获取用户数据失败,业务异常:" + res.code); |
||||
} |
||||
this.setDownloadOver_custom(); |
||||
}, (res: any) => { |
||||
LogUtils.log_custom("获取用户数据失败!!!"); |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetUserDataState_custom, { state: 1, info: "获取用户数据失败,网络异常或超时" }) |
||||
UmengMgr.sendLoginReportInfo_custom("用户数据", 1, "获取用户数据失败,网络异常或超时"); |
||||
User.token_custom = ""; |
||||
User.openId_custom = ""; |
||||
User.initiUser_custom(null); |
||||
this.setDownloadOver_custom(); |
||||
}) |
||||
} |
||||
else { |
||||
let str = res.code; |
||||
if (res.msg) { |
||||
str = str + ':' + res.msg; |
||||
} |
||||
this.dialogLoading_custom.openView(str); |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetLoginState_custom, { state: 2, info: "登录失败,业务异常:" + res.code }) |
||||
UmengMgr.sendLoginReportInfo_custom("登录", 2, "登录失败,业务异常" + str); |
||||
} |
||||
}, (res: any) => { |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_NetLoginState_custom, { state: 1, info: "登录失败,网络异常或超时" }) |
||||
UmengMgr.sendLoginReportInfo_custom("登录", 1, "登录失败,网络异常或超时"); |
||||
this.dialogLoading_custom.openView(res); |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 分包等相关资源全部加载完成了 |
||||
*/ |
||||
private onLoadResComplate_custom() { |
||||
var self = this; |
||||
this.setStartLoadingPerNum_custom(this.loadHttpNetworkTotal_custom); |
||||
//预加载用到的场景
|
||||
GameMgr.getInstance_custom().preloadScene_custom(); |
||||
AppPlatform.loginPlatform_custom(function (code) { |
||||
self.go_Login_custom(code) |
||||
CommonDefine.loginCode = code; |
||||
|
||||
}, () => { |
||||
self.Login_fail_custom(); |
||||
|
||||
}, () => { |
||||
// console.log("pc登录,数据存本地");
|
||||
//存本地
|
||||
let data = cc.sys.localStorage.getItem("data" + AppConfig.AppID_custom); |
||||
if (data) { |
||||
console.log("ly+++++++++ 有存档"); |
||||
|
||||
User.initiUser_custom(JSON.parse(data)); |
||||
} else { |
||||
console.log("ly+++++++++ 无存档"); |
||||
|
||||
User.initiUser_custom(null); |
||||
} |
||||
|
||||
self.setDownloadOver_custom(); |
||||
}); |
||||
//加载配置AppSwitchConfig
|
||||
GameReport.setLoadingTime((new Date()).getTime()); |
||||
GameReport.init(); |
||||
} |
||||
|
||||
|
||||
|
||||
//初始游戏
|
||||
public initGame_custom() { |
||||
|
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
console.log("小游戏设置转发按钮"); |
||||
window["wx"].showShareMenu({ |
||||
withShareTicket: false, |
||||
success: () => { |
||||
|
||||
}, |
||||
fail: () => { |
||||
|
||||
}, |
||||
complete: () => { |
||||
|
||||
} |
||||
}); |
||||
window["wx"].onShareAppMessage(function () { |
||||
return { |
||||
title: "", |
||||
imageUrl: "" |
||||
} |
||||
}); |
||||
|
||||
window["wx"].onShow(function () { |
||||
console.log('微信 显示在前台'); |
||||
AppPlatform.isBackGameWX = true; |
||||
}); |
||||
|
||||
|
||||
//初始化放到后面
|
||||
let self = this; |
||||
AppPlatform.loginPlatform_custom(function (code) { |
||||
//初始 ry sdk
|
||||
console.log('登陆成功,进行初始化'); |
||||
GameMgr.getInstance_custom().onLoadToWorldScene_custom(); |
||||
if (AppConfig.UseRYSDK_custom) { RYSDK.init_custom(code); } |
||||
}, null) |
||||
} else { |
||||
GameMgr.getInstance_custom().onLoadToWorldScene_custom(); |
||||
} |
||||
|
||||
// this.reportLaunchOptions_custom();
|
||||
|
||||
AppPlatform.initGame_custom(); |
||||
} |
||||
|
||||
/** |
||||
* 开启扫码登录功能 |
||||
*/ |
||||
setUserScan_custom() { |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
|
||||
if (AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wxcfg_custom.setUserScan_custom == 1) { |
||||
AppPlatform.loginPlatform_custom((code) => { |
||||
console.log(">>>>扫码功能:开始请求UserScan..."); |
||||
let isShield = WudianMgr.isEnterBySerach_custom; |
||||
console.log(">>>>扫码功能:当前状态EnterBySerach......" + isShield); |
||||
User.code_custom = code;//临时记录下 不能不写
|
||||
if (!isShield) { |
||||
console.log(">>>>扫码功能:扫码进入的,发送记录"); |
||||
DebugInfoMgr.addDebugInfo_custom("扫码功能:扫码进入的,发送记录"); |
||||
HttpUnit.userScanCode_custom({ |
||||
code: code, |
||||
state: AppConfig.state_custom, |
||||
// gameid: AppConfig.gameid_custom,
|
||||
type: 0, |
||||
scan: 1, |
||||
}, () => { |
||||
console.log(">>>>扫码功能:发送成功send pack success"); |
||||
}, () => { |
||||
console.log(">>>>扫码功能:发送失败send pack fail"); |
||||
}) |
||||
AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom = 0; |
||||
} else { |
||||
DebugInfoMgr.addDebugInfo_custom("扫码功能:正常进入,拉取记录"); |
||||
console.log("扫码功能:正常进入,拉取记录"); |
||||
HttpUnit.userScanCode_custom({ |
||||
code: code, |
||||
state: AppConfig.state_custom, |
||||
// gameid: AppConfig.gameid_custom,
|
||||
type: 1, |
||||
scan: 0, |
||||
}, (result) => { |
||||
if (result.data != null) { |
||||
console.log(">>>>扫码功能:result.data" + result.data); |
||||
if (result.data > 0) { |
||||
console.log(">>>>扫码功能:正常进入,拉取记录,屏蔽扫码人员"); |
||||
DebugInfoMgr.addDebugInfo_custom("扫码功能:正常进入,拉取记录,屏蔽扫码人员"); |
||||
AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom = 0; |
||||
} |
||||
} |
||||
}, (err) => { |
||||
console.log(">>>>扫码功能:获取失败send pack fail"); |
||||
}) |
||||
} |
||||
}, null) |
||||
} |
||||
else { |
||||
console.log(">>>>扫码功能:没有启动"); |
||||
DebugInfoMgr.addDebugInfo_custom("扫码功能:没有启动"); |
||||
} |
||||
} |
||||
} |
||||
/** |
||||
* 获取IP |
||||
*/ |
||||
// private reportLaunchOptions_custom() {
|
||||
// HttpUnit.Getuserip_custom((res) => {
|
||||
// if (1 == res.code) {
|
||||
// console.log("获取玩家ip,地区成功 :", res.data.dqip, res.data.ipxq);
|
||||
// let opt: any = null;
|
||||
// if (AppPlatform.is_WECHAT_GAME_custom()) {
|
||||
|
||||
// opt = AppPlatform.getLaunchOptionsSync_custom();
|
||||
// }
|
||||
// else if (AppPlatform.is_QQ_PLAY_custom()) {
|
||||
// opt = AppPlatform.getLaunchOptionsSync_custom();
|
||||
// }
|
||||
// if (null != opt) {
|
||||
// //ALD.aldSendReportLaunchOptions_custom(opt.scene, res.data.dqip, res.data.ipxq);
|
||||
// UmengMgr.sendReportLaunchOptions_custom(opt.scene, res.data.dqip, res.data.ipxq);
|
||||
// }
|
||||
// }
|
||||
// }, (res) => {
|
||||
// console.log("获取玩家ip,地区失败");
|
||||
// let opt: any = null;
|
||||
// if (AppPlatform.is_WECHAT_GAME_custom()) {
|
||||
// opt = AppPlatform.getLaunchOptionsSync_custom();
|
||||
// }
|
||||
// else if (AppPlatform.is_QQ_PLAY_custom()) {
|
||||
// opt = AppPlatform.getLaunchOptionsSync_custom();
|
||||
// }
|
||||
// if (null != opt) {
|
||||
// //ALD.aldSendReportLaunchOptions_custom(opt.scene, "", "");
|
||||
// UmengMgr.sendReportLaunchOptions_custom(opt.scene, "", "");
|
||||
// }
|
||||
// })
|
||||
// }
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "1cbf7373-b126-40a2-99c4-a43334eb4fe2", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "dd5d3f14-70c2-47d0-afb3-bfa3041bf343", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,81 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
|
||||
import { FMListener, callFM_custom, handleFM_custom } from "../Interface/FMInterface"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
|
||||
/** |
||||
* https://docs.cocos.com/creator/manual/zh/scripting/asset-bundle.html
|
||||
* bundle 管理 增加一些便捷方式 |
||||
* cc.assetManager.loadBundle |
||||
* 或者自己直接操作 Bundle |
||||
*/ |
||||
export default class BundleMgr { |
||||
/** |
||||
* 加载资源包 |
||||
* @param bundleName 资源包名字 |
||||
* @param listener
|
||||
*/ |
||||
public static loadBundleByName_custom(bundleName: string, listener: FMListener) { |
||||
LogUtils.info_custom("加载资源包 " + bundleName); |
||||
cc.assetManager.loadBundle(bundleName, function (err: Error, bundle: cc.AssetManager.Bundle) { |
||||
console.log(bundle) |
||||
callFM_custom(listener, err, bundle); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 获取加载的资源包 |
||||
* @param bundleName
|
||||
*/ |
||||
public static getBundle_custom(bundleName: string): cc.AssetManager.Bundle { |
||||
return cc.assetManager.getBundle(bundleName); |
||||
} |
||||
|
||||
|
||||
/** |
||||
*
|
||||
* 移除加载的资源包 |
||||
* @param bundleName 资源包名 |
||||
* @param releaseAll 是否释放 默认true 释放 |
||||
*/ |
||||
public static removeBundle_custom(bundleName: string, releaseAll: boolean = true) { |
||||
let bundle = this.getBundle_custom(bundleName); |
||||
if (bundle && releaseAll) { |
||||
//释放所有属于 Asset Bundle 的资源
|
||||
bundle.releaseAll(); |
||||
} |
||||
cc.assetManager.removeBundle(bundle); |
||||
} |
||||
|
||||
/** |
||||
* 通过场景名称加载分包中的场景。 |
||||
* @param bundleName 资源包名 |
||||
* @param sceneName 场景 |
||||
* @param listener
|
||||
*/ |
||||
public static runScene_custom(bundleName: string, sceneName: string, listener: FMListener = null) { |
||||
let bundle = this.getBundle_custom(bundleName); |
||||
if (bundle) { |
||||
bundle.loadScene(sceneName, function (error, scene) { |
||||
if (listener) { |
||||
callFM_custom(listener); |
||||
} |
||||
cc.director.runScene(scene); |
||||
}); |
||||
} else { |
||||
this.loadBundleByName_custom(bundleName, handleFM_custom((err: Error, bundle: cc.AssetManager.Bundle) => { |
||||
bundle.loadScene(sceneName, function (error, scene) { |
||||
if (listener) { |
||||
callFM_custom(listener); |
||||
} |
||||
cc.director.runScene(scene); |
||||
}); |
||||
}, this)) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "877a3500-4949-45bb-99cc-ab7357da1e91", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,443 @@ |
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-12-17 20:07:37 |
||||
* @Description: 信息展示 清除存档 |
||||
*/ |
||||
|
||||
import AppConfig from "../Config/AppConfig"; |
||||
import AppSwitchConfig from "../Config/AppSwitchConfig"; |
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
import EventMgr from "../Event/EventMgr"; |
||||
import HttpUnit from "../NetWork/HttpUnit"; |
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
import { DateUtils } from "../Util/DateUtils"; |
||||
import Utilit from "../Util/Utilit"; |
||||
import WudianMgr from "./WudianMgr"; |
||||
|
||||
export default class DebugInfoMgr { |
||||
//debug 根节点
|
||||
private static debugNode_custom: cc.Node = null; |
||||
//展示页面
|
||||
private static debugPanel_custom: cc.Node = null; |
||||
|
||||
private static scrollview_custom: cc.ScrollView = null; |
||||
private static content_custom: cc.Node = null; |
||||
|
||||
//debug 消息集合
|
||||
private static debugInfoList_custom: Array<string> = new Array(); |
||||
private static debugFrameInfoList_custom: Array<string> = new Array(); |
||||
private static debugLabelList_custom: Array<cc.Label> = new Array(); |
||||
private static debugUmengInfoList_custom: { [key: string]: number } = {}; |
||||
|
||||
private static showInfoNode_custom: cc.Node = null; |
||||
private static showInfoLabel_custom: cc.Label = null; |
||||
|
||||
//是否启动了debug模式
|
||||
private static isOpenDebug_custom: boolean = false; |
||||
//是否正常点击
|
||||
private static isOpenStartClick_custom: boolean = false; |
||||
//次数
|
||||
private static touchClickSum_custom: number = 0; |
||||
//间隔时间
|
||||
private static clickTime_custom: number = 0; |
||||
|
||||
//ip屏蔽接口是否调用成功
|
||||
private static isNetIpBlockState_custom: boolean = false; |
||||
|
||||
/** |
||||
* 启动debug |
||||
*/ |
||||
public static setDebug_custom() { |
||||
|
||||
if (AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().debuginfo_custom == 1) { |
||||
this.isOpenDebug_custom = true; |
||||
|
||||
//监听ip屏蔽
|
||||
EventMgr.onEvent_custom(ryw_Event.ryw_App_OnUpdateIpBlockState_custom, () => { |
||||
this.isNetIpBlockState_custom = true; |
||||
if (this.debugPanel_custom.active) { |
||||
this.updateFrameInfo_custom(); |
||||
this.updateItem_custom(); |
||||
} |
||||
}, this); |
||||
|
||||
//平台登录的状态
|
||||
EventMgr.onEvent_custom(ryw_Event.ryw_PlatformLoginState_custom, (tab) => { |
||||
let state_custom = tab.state |
||||
let info_custom = tab.info |
||||
this.addDebugInfo_custom(info_custom); |
||||
}, this); |
||||
//登录的状态
|
||||
EventMgr.onEvent_custom(ryw_Event.ryw_NetLoginState_custom, (tab) => { |
||||
let state_custom = tab.state |
||||
let info_custom = tab.info |
||||
this.addDebugInfo_custom(info_custom); |
||||
}, this); |
||||
//获取用户数据
|
||||
EventMgr.onEvent_custom(ryw_Event.ryw_NetUserDataState_custom, (tab) => { |
||||
let state_custom = tab.state |
||||
let info_custom = tab.info |
||||
this.addDebugInfo_custom(info_custom); |
||||
}, this); |
||||
//友盟打点
|
||||
EventMgr.onEvent_custom(ryw_Event.ryw_Umeng_custom, (tab) => { |
||||
let event = tab.event |
||||
if (this.debugUmengInfoList_custom[event]) { |
||||
this.debugUmengInfoList_custom[event] = this.debugUmengInfoList_custom[event] + 1; |
||||
} else { |
||||
this.debugUmengInfoList_custom[event] = 1; |
||||
} |
||||
this.updateItem_custom(); |
||||
}, this); |
||||
|
||||
let sizeView = cc.view.getVisibleSize(); |
||||
|
||||
let size = cc.view.getFrameSize(); |
||||
// console.log(size)
|
||||
// console.log(sizeView)
|
||||
console.log("启动了debug展示") |
||||
|
||||
//根节点
|
||||
this.debugNode_custom = new cc.Node(); |
||||
cc.game.addPersistRootNode(this.debugNode_custom); |
||||
this.debugNode_custom.width = sizeView.width; |
||||
this.debugNode_custom.height = sizeView.height; |
||||
this.debugNode_custom.anchorX = 0; |
||||
this.debugNode_custom.anchorY = 0; |
||||
this.debugNode_custom.x = 0; |
||||
this.debugNode_custom.y = 0; |
||||
|
||||
let butSize_custom = cc.size(180, 120); |
||||
let butNode_custom = this.createNode_custom(this.debugNode_custom, cc.v2(0, sizeView.height - butSize_custom.height), cc.Color.WHITE); |
||||
butNode_custom.setContentSize(butSize_custom); |
||||
// butNode.addComponent(cc.Sprite).spriteFrame = this.createSpriteFrame_custom(butSize);
|
||||
// this.createLabel_custom(butNode, cc.v2(0, 0), "打开", cc.Color.RED);
|
||||
|
||||
// butNode_custom.on(cc.Node.EventType.TOUCH_START, (touch: cc.Event, event) => { }, this)
|
||||
// butNode_custom["_touchListener"].onTouchBegan = (touch, event) => {
|
||||
// let pos_custom = butNode_custom.convertToNodeSpaceAR(touch.getLocation());
|
||||
// if (pos_custom.x < 0 || pos_custom.y < 0 || pos_custom.x > butSize_custom.width || pos_custom.y > butSize_custom.height) {//超出按钮范围
|
||||
// return;
|
||||
// }
|
||||
// if (!this.isOpenStartClick_custom) {
|
||||
// let time_custom = DateUtils.getNowTime_custom();
|
||||
// //console.log(this.touchClickSum_custom)
|
||||
// if (time_custom - this.clickTime_custom <= 500) {
|
||||
// this.touchClickSum_custom = this.touchClickSum_custom + 1;
|
||||
// if (this.touchClickSum_custom > 10) {
|
||||
// this.isOpenStartClick_custom = true;
|
||||
// }
|
||||
// } else {
|
||||
// this.touchClickSum_custom = 0;
|
||||
// }
|
||||
// this.clickTime_custom = time_custom
|
||||
// } else {
|
||||
// if (!this.debugPanel_custom.active) {
|
||||
// this.updateFrameInfo_custom();
|
||||
// this.updateItem_custom();
|
||||
// this.debugPanel_custom.active = true;
|
||||
// }
|
||||
// }
|
||||
// return true;
|
||||
// };
|
||||
// butNode_custom["_touchListener"].setSwallowTouches(false);
|
||||
|
||||
|
||||
let showSize_custom = cc.size(sizeView.width * 0.98, sizeView.height * 0.7); |
||||
//背景色
|
||||
this.debugPanel_custom = this.createNode_custom(this.debugNode_custom, cc.v2((sizeView.width - showSize_custom.width) / 2, (sizeView.height - showSize_custom.height) / 2), cc.Color.WHITE, showSize_custom); |
||||
this.debugPanel_custom.active = false; |
||||
this.debugPanel_custom.addComponent(cc.Button); |
||||
|
||||
//滚动容器
|
||||
let snode_custom = this.createNode_custom(this.debugPanel_custom, cc.v2(0, 0), cc.Color.GRAY, showSize_custom); |
||||
this.scrollview_custom = snode_custom.addComponent(cc.ScrollView); |
||||
this.scrollview_custom.horizontal = false; |
||||
this.scrollview_custom.vertical = true; |
||||
this.scrollview_custom.inertia = true; |
||||
this.scrollview_custom.brake = 0.75; |
||||
//遮罩
|
||||
let viewMask_custom = this.createNode_custom(snode_custom, cc.v2(0, 0), cc.Color.WHITE); |
||||
viewMask_custom.setContentSize(showSize_custom); |
||||
viewMask_custom.addComponent(cc.Mask) |
||||
viewMask_custom.anchorY = 1; |
||||
viewMask_custom.y = showSize_custom.height; |
||||
//content
|
||||
this.content_custom = this.createNode_custom(viewMask_custom, cc.v2(0, 0), cc.Color.GRAY, showSize_custom); |
||||
this.content_custom.anchorY = 1; |
||||
this.scrollview_custom.content = this.content_custom; |
||||
|
||||
//关闭按钮
|
||||
this.createButton_custom(this.debugPanel_custom, cc.v2(0, showSize_custom.height), "关闭", cc.color(255, 180, 180), cc.Color.RED, cc.size(100, 70), () => { |
||||
this.debugPanel_custom.active = false; |
||||
}); |
||||
//清除缓存按钮
|
||||
this.createButton_custom(this.debugPanel_custom, cc.v2(showSize_custom.width - 170, showSize_custom.height), "清理缓存", cc.color(255, 180, 180), cc.Color.RED, cc.size(170, 70), () => { |
||||
HttpUnit.saveGameData_custom("{}", (res) => { |
||||
if (res.code == 1) { console.log("存档成功") } |
||||
else { console.log("存档失败") } |
||||
}, (res) => { console.log("存档失败") }) |
||||
this.showToast_custom("清理用户数据,并提交!请重启") |
||||
}); |
||||
|
||||
//提示框
|
||||
let cshowToastSize_custom = cc.size(showSize_custom.width * 0.9, 100); |
||||
this.showInfoNode_custom = this.createNode_custom(this.debugNode_custom, cc.v2((sizeView.width) / 2, (sizeView.height) / 2), cc.color(175, 100, 170), cshowToastSize_custom); |
||||
this.showInfoNode_custom.anchorX = 0.5; |
||||
this.showInfoNode_custom.anchorY = 0.5; |
||||
this.showInfoLabel_custom = this.createLabel_custom(this.showInfoNode_custom, cc.v2(0, 0), "", cc.Color.RED).getComponent(cc.Label); |
||||
this.showInfoLabel_custom.node.anchorX = 0.5; |
||||
this.showInfoLabel_custom.node.anchorY = 0.5; |
||||
this.showInfoNode_custom.active = false; |
||||
|
||||
|
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 增加一条需要展示的debug信息 |
||||
* @param info 需要展示的信息 |
||||
*/ |
||||
public static addDebugInfo_custom(info: string) { |
||||
if (this.isOpenDebug_custom) { |
||||
this.debugInfoList_custom.push(info); |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 添加框架的信息 |
||||
*/ |
||||
private static updateFrameInfo_custom() { |
||||
this.debugFrameInfoList_custom = []; |
||||
let addVersion_custom = () => { |
||||
let cur_custom = Utilit.checkVersions_custom(); |
||||
let versionSwitch_custom = "[]" |
||||
if (AppPlatform.is_TT_GAME_custom())//抖音,字节跳动
|
||||
{ |
||||
versionSwitch_custom = "ttcfg:<" + AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().ttcfg_custom.ttversions_custom + ">"; |
||||
} |
||||
else if (AppPlatform.is_OPPO_GAME_custom())//oppo小游戏
|
||||
{ |
||||
versionSwitch_custom = "oppocfg:<" + AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().oppocfg_custom.oppoversions_custom + ">"; |
||||
} |
||||
else if (AppPlatform.is_QQ_PLAY_custom())//qq小游戏
|
||||
{ |
||||
versionSwitch_custom = "qqcfg:<" + AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().qqcfg_custom.qqversions_custom + ">"; |
||||
} |
||||
else if (AppPlatform.is_WECHAT_GAME_custom()) //VIVO 小游戏
|
||||
{ |
||||
versionSwitch_custom = "vivocfg:<" + AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().vivocfg_custom.vivoversions_custom + ">"; |
||||
} |
||||
else//微信小游戏
|
||||
{ |
||||
versionSwitch_custom = "version:<" + AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().version_custom + ">"; |
||||
} |
||||
let str_custom = "游戏名字:[" + AppConfig.GameName_custom + "],gameid:[" + AppConfig.gameid_custom + "]\n"; |
||||
str_custom = str_custom + AppConfig.ResServer_custom + "\n" |
||||
str_custom = str_custom + "本地版本号:[" + AppConfig.Versions_custom + "]\n远端版本号:[" + versionSwitch_custom + "]\n版本比较结果:" + (cur_custom ? "true" : "false"); |
||||
this.debugFrameInfoList_custom.push(str_custom); |
||||
} |
||||
|
||||
let cwudian_custom = () => { |
||||
let mainSwitch_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom == 1; |
||||
let isOpenTime_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianTimeAvaliable_custom; |
||||
let ipnotBlock_custom = WudianMgr.ryw_GetIpBlocked_custom(); |
||||
let launchScene_custom_custom = AppPlatform.getLaunchOptionsSync_custom().scene; |
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
mainSwitch_custom = true; |
||||
isOpenTime_custom = true; |
||||
} |
||||
|
||||
let noEnterBySearch_custom: boolean = true; |
||||
var wudianSceneList_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianSceneList_custom; |
||||
for (let index = 0; index < wudianSceneList_custom.length; index++) { |
||||
var wudianSceneValue_custom = wudianSceneList_custom[index]; |
||||
if (launchScene_custom_custom == wudianSceneValue_custom) { |
||||
noEnterBySearch_custom = false; |
||||
} |
||||
} |
||||
let cwd_custom = mainSwitch_custom && noEnterBySearch_custom && ipnotBlock_custom && isOpenTime_custom; |
||||
|
||||
let str = "ip屏蔽接口调用:" + (this.isNetIpBlockState_custom ? "成功" : "失败") + "\n" |
||||
+ "误点最终结果:[" + (cwd_custom ? "有" : "没有") + "]\n" |
||||
+ "当前场景值:[" + launchScene_custom_custom + "]\n" |
||||
+ "ip没有屏蔽:[" + (ipnotBlock_custom ? "是" : "不是") + "]\n" |
||||
+ "场景没有屏蔽:[" + (noEnterBySearch_custom ? "是" : "不是") + "]\n" |
||||
+ "误点开关:[" + (mainSwitch_custom ? "打开" : "关闭") + "],\n" |
||||
+ "时间开关:[" + (isOpenTime_custom ? "打开" : "关闭") + "]" |
||||
|
||||
this.debugFrameInfoList_custom.push(str); |
||||
} |
||||
|
||||
addVersion_custom(); |
||||
cwudian_custom(); |
||||
} |
||||
|
||||
|
||||
|
||||
/** |
||||
* 设置提示语 |
||||
* @param info
|
||||
*/ |
||||
private static showToast_custom(info: string) { |
||||
cc.Tween.stopAllByTarget(this.showInfoNode_custom); |
||||
this.showInfoLabel_custom.string = info; |
||||
this.showInfoNode_custom.active = true; |
||||
this.showInfoNode_custom.opacity = 0; |
||||
this.showInfoNode_custom.scale = 0.75; |
||||
cc.tween(this.showInfoNode_custom) |
||||
.to(0.25, { opacity: 255, scale: 1 }, { easing: "backOut" }) |
||||
.delay(2) |
||||
.call(() => { |
||||
this.showInfoNode_custom.active = false; |
||||
}) |
||||
.start(); |
||||
} |
||||
|
||||
/** |
||||
* 更新item |
||||
*/ |
||||
private static updateItem_custom() { |
||||
let infoList = []; |
||||
//先加框架的
|
||||
for (let index = 0; index < this.debugFrameInfoList_custom.length; index++) { |
||||
const element_custom = this.debugFrameInfoList_custom[index]; |
||||
infoList.push(element_custom); |
||||
} |
||||
|
||||
let umengInfo = "友盟统计开始:\n" |
||||
for (const key in this.debugUmengInfoList_custom) { |
||||
if (Object.prototype.hasOwnProperty.call(this.debugUmengInfoList_custom, key)) { |
||||
const element = this.debugUmengInfoList_custom[key]; |
||||
umengInfo = "事件:" + umengInfo + key + ",次数: " + element + "\n" |
||||
} |
||||
} |
||||
umengInfo = umengInfo + "友盟统计结束!" |
||||
infoList.push(umengInfo); |
||||
|
||||
//再加自定义的
|
||||
for (let index = 0; index < this.debugInfoList_custom.length; index++) { |
||||
const element_custom = this.debugInfoList_custom[index]; |
||||
infoList.push(element_custom); |
||||
} |
||||
|
||||
|
||||
let sizeInfo = infoList.length; |
||||
let sizeLabel = this.debugLabelList_custom.length; |
||||
let num = sizeInfo - sizeLabel; |
||||
//增加新的
|
||||
if (num > 0) { |
||||
for (let index = 0; index < num; index++) { |
||||
let label = this.createLabel_custom(this.content_custom, cc.v2(0, 0), "", cc.Color.BLACK).getComponent(cc.Label); |
||||
label.node.width = this.content_custom.width; |
||||
label.overflow = cc.Label.Overflow.RESIZE_HEIGHT; |
||||
label.horizontalAlign = cc.Label.HorizontalAlign.LEFT; |
||||
label.node.anchorY = 1; |
||||
this.debugLabelList_custom.push(label); |
||||
} |
||||
} |
||||
//关闭
|
||||
for (let index = 0; index < this.debugLabelList_custom.length; index++) { |
||||
const element_custom = this.debugLabelList_custom[index]; |
||||
element_custom.node.active = false; |
||||
} |
||||
//更新
|
||||
let maxHeight_custom: number = 0; |
||||
let temp_custom: boolean = false; |
||||
for (let index = 0; index < infoList.length; index++) { |
||||
const element_custom = infoList[index]; |
||||
let label = this.debugLabelList_custom[index]; |
||||
label.string = element_custom; |
||||
label.node.y = -maxHeight_custom; |
||||
label.node.active = true; |
||||
label["_forceUpdateRenderData"](); |
||||
maxHeight_custom = maxHeight_custom + label.node.height + 5 |
||||
if (temp_custom) { |
||||
temp_custom = false; |
||||
label.node.color = cc.color(0, 0, 0); |
||||
} else { |
||||
temp_custom = true; |
||||
label.node.color = cc.color(122, 22, 22); |
||||
} |
||||
} |
||||
this.content_custom.height = maxHeight_custom; |
||||
} |
||||
|
||||
/** |
||||
* 创建一个 label |
||||
* @param info
|
||||
* @param color
|
||||
*/ |
||||
private static createLabel_custom(parent: cc.Node, pos: cc.Vec2, info: string, color: cc.Color) { |
||||
let node = this.createNode_custom(parent, pos, color) |
||||
let label = node.addComponent(cc.Label); |
||||
label.fontSize = 30; |
||||
label.lineHeight = 32; |
||||
label.string = info; |
||||
return node; |
||||
} |
||||
|
||||
/** |
||||
* 创建一个 节点 |
||||
* @param color
|
||||
* @param size
|
||||
*/ |
||||
private static createNode_custom(parent: cc.Node, pos: cc.Vec2, color: cc.Color, size?: cc.Size) { |
||||
let node = new cc.Node(); |
||||
if (size) { |
||||
node.setContentSize(size); |
||||
node.addComponent(cc.Sprite).spriteFrame = this.createSpriteFrame_custom(size); |
||||
} |
||||
node.color = color; |
||||
parent.addChild(node); |
||||
node.x = pos.x; |
||||
node.y = pos.y; |
||||
node.anchorX = 0; |
||||
node.anchorY = 0; |
||||
return node; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 创建一个button |
||||
* @param info
|
||||
* @param color
|
||||
* @param labelColor
|
||||
* @param size
|
||||
* @param listener
|
||||
*/ |
||||
private static createButton_custom(parent: cc.Node, pos: cc.Vec2, info: string, color: cc.Color, labelColor: cc.Color, size: cc.Size, listener?: Function) { |
||||
let node = this.createNode_custom(parent, pos, color, size); |
||||
node.addComponent(cc.Button); |
||||
node.color = color; |
||||
if (listener) { |
||||
node.on("click", listener, this); |
||||
} |
||||
this.createLabel_custom(parent, pos, info, labelColor); |
||||
return node; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 创建纯色的spriteframe |
||||
* @param size
|
||||
*/ |
||||
private static createSpriteFrame_custom(size: cc.Size): cc.SpriteFrame { |
||||
let texture = new cc.Texture2D(); |
||||
let spriteFrame = new cc.SpriteFrame(); |
||||
let count = size.width * size.height * 4; |
||||
let imgData = new Uint8Array(count); |
||||
for (let j = 0; j < count; j += 4) { |
||||
imgData[j] = 255; |
||||
imgData[j + 1] = 255; |
||||
imgData[j + 2] = 255; |
||||
imgData[j + 3] = 255; |
||||
} |
||||
texture.initWithData(imgData, cc.Texture2D.PixelFormat.RGBA8888, size.width, size.height); |
||||
spriteFrame.setTexture(texture); |
||||
spriteFrame.setRect(cc.rect(0, 0, size.width, size.height)); |
||||
return spriteFrame; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "0d2f322a-67b2-4933-bf1b-bf712802d90d", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,91 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:40 |
||||
*/ |
||||
|
||||
import User from "../User/User"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
import AppConfig from "../Config/AppConfig"; |
||||
import TTAPI from "../../Platform/tt/TTAPI"; |
||||
import Common5 from "../../Platform/th/Common5"; |
||||
import EventMgr from "../Event/EventMgr"; |
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
|
||||
import { TimerUtils } from "./TimerUtils"; |
||||
import { DateUtils } from "../Util/DateUtils"; |
||||
import GameReport from "../Report/ZyZyReport"; |
||||
|
||||
|
||||
//游戏管理器,游戏代码的入口
|
||||
export default class GameMgr { |
||||
public isFirstLoadAD: boolean = false; |
||||
public isWinner: boolean = false; |
||||
private static _instance_custom: GameMgr = new GameMgr(); |
||||
|
||||
public static getInstance_custom(): GameMgr { |
||||
return GameMgr._instance_custom; |
||||
} |
||||
|
||||
/** |
||||
* 预加载一些场景 在Main.ts中 |
||||
*/ |
||||
public preloadScene_custom() { |
||||
// cc.director.preloadScene("MainScene");
|
||||
// cc.director.preloadScene("FMMainScene");
|
||||
// cc.director.preloadScene("FMGameScene");
|
||||
// cc.director.preloadScene("FMGameSettleWinScene");
|
||||
// cc.director.preloadScene("FMGameSettleFailScene");
|
||||
LogUtils.warn_custom("GameMgr.getInstance().preloadScene_custom这里可以加载需要预加载的场景"); |
||||
} |
||||
|
||||
//在合适的时候 cc.director.preloadScene 预加载你的场景
|
||||
|
||||
/** |
||||
* 登录加载后跳转自己的场景 |
||||
*/ |
||||
public onLoadToWorldScene_custom(level?,callFunc?) { |
||||
// cc.director.loadScene("FMMainScene", function (err, scene) {
|
||||
// console.log("跳转游戏场景 FMMainScene")
|
||||
// });
|
||||
Common5.isBackLevel = level; |
||||
cc.director.loadScene("MainScene", function (err, scene) { |
||||
console.log("跳转游戏场景 MainScene"); |
||||
|
||||
console.log('oldTime',GameReport.getLoadingTime() ) |
||||
console.log('newTime',DateUtils.getNowTime_custom()) |
||||
GameReport.setLoadingFinishTime(DateUtils.getNowTime_custom()) |
||||
GameReport.getUserId() |
||||
|
||||
User.initLevel(); |
||||
TTAPI.onShow((res)=>{ |
||||
//Common5.getSoundFromBundle_custom("ZoomGame", "Sounds/bgm", true);
|
||||
//Common5.playMusic("bg");
|
||||
//该判断为从侧边栏进入游戏
|
||||
if(res.launch_from == 'homepage' && res.location == 'sidebar_card'){ |
||||
Common5.isCeBianLanEnter = true |
||||
EventMgr.emitEvent_custom(ryw_Event.CheckIsEnterFromCeBianLan) |
||||
} |
||||
}) |
||||
//检测侧边栏是否可用
|
||||
TTAPI.checkScene(()=>{ |
||||
EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan, true) |
||||
},()=>{ |
||||
EventMgr.emitEvent_custom(ryw_Event.CheckCeBianLan, false) |
||||
}) |
||||
callFunc && callFunc() |
||||
}); |
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
//游戏存档,合适的时候调用它来保存
|
||||
public saveGameData_custom() { |
||||
//存本地
|
||||
cc.sys.localStorage.setItem("data" + AppConfig.AppID_custom, User.getSaveData_custom()); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "00994331-0cd0-4402-b953-9760b414dc7f", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,42 @@ |
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class PhysicsManager extends cc.Component { |
||||
@property({ tooltip: "是否启动物理引擎" }) |
||||
active: boolean = true; |
||||
@property({ tooltip: "是否显示包围盒" }) |
||||
aabb: boolean = true; |
||||
@property({ tooltip: "是否显示关节链接线" }) |
||||
joint: boolean = true; |
||||
@property({ tooltip: "是否填充形状" }) |
||||
shape: boolean = true; |
||||
@property({ tooltip: "是否开启鼠标关节,可以拖动动态刚体" }) |
||||
mouseJoint: boolean = false; |
||||
@property({tooltip: "重力" }) |
||||
gravity: cc.Vec2 = cc.v2(0, -960); |
||||
onEnable() { |
||||
/**开启或关闭物理系统 */ |
||||
let physicsManager = cc.director.getPhysicsManager(); |
||||
physicsManager.enabled = this.active; |
||||
if (!this.active) return; |
||||
/**设置物理系统重力系统 */ |
||||
physicsManager.gravity = this.gravity; |
||||
/**设置调试标志 */ |
||||
let drawBits = cc.PhysicsManager.DrawBits; |
||||
if (CC_PREVIEW) { |
||||
physicsManager.debugDrawFlags = |
||||
(this.aabb && drawBits.e_aabbBit) | |
||||
(this.shape && drawBits.e_shapeBit) | |
||||
(this.joint && drawBits.e_jointBit); |
||||
} else { |
||||
physicsManager.debugDrawFlags = 0; |
||||
} |
||||
|
||||
} |
||||
onDisable() { |
||||
let physicsManager = cc.director.getPhysicsManager(); |
||||
physicsManager.debugDrawFlags = 0; |
||||
physicsManager.enabled = false; |
||||
} |
||||
// update (dt) {}
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "aec75a4a-7f6e-45c3-8a3a-8ac97ce71c24", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,126 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
|
||||
import AppConfig from "../Config/AppConfig"; |
||||
import HttpUnit, { requestData } from "../NetWork/HttpUnit"; |
||||
import RYAD from "../RYSDK/RYAD"; |
||||
import RYSDK from "../RYSDK/RYSDK"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
|
||||
//任游 运营平台
|
||||
export default class RYPlatformMgr { |
||||
public static readonly urlRYWAdv_custom: string = "https://javasttts.renyouwangluo.cn/api/data/product/2result"//从ry_sdk中迁移过来的 wx
|
||||
|
||||
/** |
||||
* 点击广告 上报 |
||||
* @param adv_id
|
||||
*/ |
||||
public static sendClickAd_custom(adv_id: string) { |
||||
if (AppConfig.UseRYSDK_custom) { |
||||
LogUtils.info_custom("运营上报:点击广告" + adv_id); |
||||
RYSDK.Instance_custom.STAT_custom.reportClickAd_custom(adv_id) |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 点击广告成功 上报 |
||||
* @param adv_id
|
||||
*/ |
||||
public static sendClickAdAllow_custom(adv_id: string) { |
||||
if (AppConfig.UseRYSDK_custom) { |
||||
LogUtils.info_custom("运营上报:点击广告成功 " + adv_id); |
||||
RYSDK.Instance_custom.STAT_custom.reportClickAdAllow_custom(adv_id) |
||||
}; |
||||
} |
||||
|
||||
/** |
||||
* 获取广告数据 |
||||
* @param id
|
||||
* @param complete
|
||||
* @param useLocalRandom
|
||||
*/ |
||||
public static getAD_custom(id: string, complete: Function, useLocalRandom?: boolean): boolean { |
||||
|
||||
if (AppConfig.UseRYSDK_custom) { |
||||
RYSDK.Instance_custom.AD_custom.getAD_custom(id, complete, useLocalRandom); |
||||
return true; |
||||
} |
||||
return false; |
||||
} |
||||
|
||||
|
||||
public static getADList_custom(id: string, complete: Function, useLocalRandom?: boolean) { |
||||
this.getRYWADVData_custom(id, (data) => { |
||||
if (data.result && data.result.list) { |
||||
let datas_custom = data.result.list; |
||||
|
||||
if (true == useLocalRandom) { |
||||
RYAD.sortDatas_custom(datas_custom); |
||||
} |
||||
complete(datas_custom) |
||||
} else { |
||||
LogUtils.networkError_custom("获取到广告数据 为NULL") |
||||
complete(null) |
||||
} |
||||
}, () => { |
||||
LogUtils.networkError_custom("获取到广告数据 为NULL") |
||||
complete(null) |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 获取常规服务器的广告接口 |
||||
* @param locationid
|
||||
* @param onSuccess
|
||||
* @param onFail
|
||||
*/ |
||||
protected static getRYWADVData_custom(locationid, onSuccess: Function, onFail: Function) { |
||||
let timelog = Date.now(); |
||||
var req = new requestData(); |
||||
req.url_custom = this.urlRYWAdv_custom; |
||||
//req.data_custom.gameAppid = AppConfig.AppID_custom;
|
||||
req.data_custom.timelog = timelog; |
||||
req.data_custom.key = locationid; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
|
||||
var completeFunc_custom = (res) => { |
||||
LogUtils.networkLog_custom(res, "http Success") |
||||
if (req.onSuccess_custom) { |
||||
req.onSuccess_custom(res); |
||||
} |
||||
req.onSuccess_custom = null; |
||||
req = null; |
||||
}; |
||||
|
||||
let fail = req.onFail_custom |
||||
var errorFunc_custom = (res) => { |
||||
LogUtils.networkLog_custom(res, "http fail") |
||||
if (fail) { |
||||
fail(res); |
||||
} |
||||
req && (req.onFail_custom = null); |
||||
fail = null; |
||||
req = null; |
||||
}; |
||||
|
||||
let headers = {}; |
||||
headers["Content-Type"] = "application/x-www-form-urlencoded"; |
||||
headers["au"] = "renyou"; |
||||
|
||||
let sendMsg_custom = null |
||||
let para_custom = ""; |
||||
for (const key of Object.keys(req.data_custom)) { |
||||
var value = req.data_custom[key]; |
||||
para_custom += key + "=" + value + "&"; |
||||
} |
||||
sendMsg_custom = para_custom; |
||||
HttpUnit.sendHttpUrl_custom(req, sendMsg_custom, completeFunc_custom, errorFunc_custom, headers); |
||||
} |
||||
} |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "a0d33b55-39ba-42be-8881-579935e52a35", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,51 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
|
||||
/** |
||||
* 远程资源管理 |
||||
* 下载后的 cc.Asset 计数加1后 放入 数组存储,下次直接拿取 |
||||
*/ |
||||
export default class RemoteMgr { |
||||
private static remoteArrayTexture_custom: { [key: string]: cc.Texture2D; } = {} |
||||
|
||||
/** |
||||
* 移除所有已加载的 |
||||
*/ |
||||
public static removeAllRemote_custom() { |
||||
for (let k in this.remoteArrayTexture_custom) { |
||||
this.remoteArrayTexture_custom[k].decRef(); |
||||
} |
||||
this.remoteArrayTexture_custom = {}; |
||||
} |
||||
|
||||
/** |
||||
* 下载远程图片资源,成功后放入数组,计数自增 |
||||
* @param url
|
||||
* @param listener
|
||||
*/ |
||||
public static loadRemote_custom(url: string, listener: FMListener) { |
||||
let texture2D = this.remoteArrayTexture_custom[url]; |
||||
if (texture2D) { |
||||
callFM_custom(listener, null, this.remoteArrayTexture_custom[url]); |
||||
} else { |
||||
cc.assetManager.loadRemote(url, (error, data) => { |
||||
if (error) { |
||||
callFM_custom(listener, error, null); |
||||
return; |
||||
} else { |
||||
if (!this.remoteArrayTexture_custom[url]) { |
||||
//@ts-ignore
|
||||
this.remoteArrayTexture_custom[url] = data; |
||||
this.remoteArrayTexture_custom[url].addRef();//计数+1
|
||||
} |
||||
callFM_custom(listener, null, this.remoteArrayTexture_custom[url]); |
||||
} |
||||
}) |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "fb8ed9c2-030a-400a-93d9-0dc31380023a", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,105 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:40 |
||||
*/ |
||||
|
||||
|
||||
/** |
||||
* 声音管理 |
||||
*/ |
||||
export default class SoundMgr { |
||||
public static readonly soundResPath_custom: string = "Sound/" |
||||
public static readonly soundSpineResPath_custom: string = "Spine/" |
||||
|
||||
//声音开关
|
||||
private static enabled_custom: boolean = true; |
||||
|
||||
//获取声音的开关
|
||||
public static isSoundEnabled_custom() { |
||||
return this.enabled_custom; |
||||
} |
||||
|
||||
|
||||
//设置声音的开关
|
||||
public static setSoundEnabled_custom(enabled: boolean) { |
||||
this.enabled_custom = enabled; |
||||
if (!this.enabled_custom) { |
||||
this.stopMusic_custom(); |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 播放背景音 |
||||
* resources/Sound/aaa.mp3 playBGM("aaa") |
||||
* @param name 具体名字 不带后缀.mp3 |
||||
*/ |
||||
public static playMusic_custom(name: string) { |
||||
if (!this.enabled_custom) |
||||
return; |
||||
let url = this.getSoundUrl_custom(name); |
||||
//播放背景音乐
|
||||
cc.resources.load(url, cc.AudioClip, function (err, clip: cc.AudioClip) { |
||||
if (err) { |
||||
LogUtils.error_custom(err); |
||||
return; |
||||
} |
||||
cc.audioEngine.playMusic(clip, true); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 停止播放背景音乐 |
||||
*/ |
||||
public static stopMusic_custom() { |
||||
cc.audioEngine.stopMusic(); |
||||
} |
||||
|
||||
/** |
||||
* 播放音效 |
||||
* resources/Sound/aaa.mp3 playSound("aaa") |
||||
* @param name 具体名字 不带后缀.mp3 |
||||
*/ |
||||
public static playSound_custom(name: string) { |
||||
if (!this.enabled_custom) { |
||||
return; |
||||
} |
||||
let url = this.getSoundUrl_custom(name); |
||||
//console.log(url)
|
||||
cc.resources.load(url, cc.AudioClip, function (err, clip: cc.AudioClip) { |
||||
if (err) { |
||||
LogUtils.error_custom(err); |
||||
return; |
||||
} |
||||
let audioID_custom = cc.audioEngine.play(clip, false, 1); |
||||
}); |
||||
} |
||||
|
||||
/** |
||||
* 播放spine 自定义声音 |
||||
* @param eventStringValue 文件夹+文件 resources/Spine/123/aaa.mp3 playSoundResources_custom("123/aaa") |
||||
* @param animationName
|
||||
*/ |
||||
public static playSpineSound_custom(eventStringValue: string, animationName: string) { |
||||
if (!this.enabled_custom) { |
||||
return; |
||||
} |
||||
let url = this.soundSpineResPath_custom + animationName; |
||||
//console.log(url)
|
||||
cc.resources.load(url, cc.AudioClip, function (err, clip: cc.AudioClip) { |
||||
if (err) { |
||||
LogUtils.error_custom(err); |
||||
return; |
||||
} |
||||
let audioID_custom = cc.audioEngine.play(clip, false, 1); |
||||
}); |
||||
} |
||||
|
||||
|
||||
|
||||
public static getSoundUrl_custom(name: string): string { |
||||
let url = this.soundResPath_custom + name; |
||||
return url; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "f4408ab5-2a89-4369-b4d7-7ddc1a316310", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,61 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:40 |
||||
*/ |
||||
|
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
|
||||
|
||||
export class StorageReq { |
||||
public key_custom: string = null; |
||||
public data_custom: any = {}; |
||||
public success_custom: () => void = null; |
||||
public fail_custom: () => void = null; |
||||
public complete_custom: () => void = null; |
||||
} |
||||
|
||||
/** |
||||
* 数据本地持久化保存 |
||||
*/ |
||||
export default class StorageMgr { |
||||
|
||||
/** |
||||
* 保存 |
||||
* @param req
|
||||
*/ |
||||
public static setStorage_custom(req: StorageReq) { |
||||
let dataStr: string = JSON.stringify(req.data_custom); |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
window["wx"].setStorage({ |
||||
key: req.key_custom, |
||||
data: dataStr, |
||||
success: req.success_custom, |
||||
fail: req.fail_custom, |
||||
complete: req.complete_custom |
||||
}); |
||||
} else { |
||||
cc.sys.localStorage.setItem(req.key_custom, dataStr); |
||||
} |
||||
|
||||
} |
||||
|
||||
/** |
||||
* 获取 |
||||
* @param key
|
||||
*/ |
||||
public static getStorage_custom(key): any { |
||||
let value = null; |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
try { |
||||
value = window["wx"].getStorageSync(key); |
||||
} catch (e) { |
||||
} |
||||
} else { |
||||
value = cc.sys.localStorage.getItem(key); |
||||
} |
||||
return value; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "6c4ab2f4-7ea5-418a-a8b3-567b9c2809aa", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,95 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
/** |
||||
* Timer工具 |
||||
*/ |
||||
export class TimerUtils { |
||||
|
||||
/** |
||||
* 循环执行 有限次数 |
||||
* @param handler 回调 |
||||
* @param interval 间隔时间 秒 |
||||
* @param repeat 重复次数(实际运行repeat + 1次) |
||||
* @param delay 延迟多少时间后开始执行 秒 |
||||
*/ |
||||
public static loopNum_custom(handler: Function, interval: number, repeat: number, delay: number) { |
||||
return this.schedule_custom(handler, interval, repeat, delay); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 延迟执行一次。 |
||||
* @param handler 回调 |
||||
* @param delayTime 延迟时间 秒 |
||||
*/ |
||||
public static once_custom(handler: Function, delayTime: number = 0) { |
||||
return this.scheduleOnce_custom(handler, delayTime); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 循环执行 一直循环 |
||||
* @param handler 回调 |
||||
* @param intervlTime 间隔时间 秒 值为 0,那么回调函数每一帧都会被调用 |
||||
* @param delay 延迟时间执行 秒 |
||||
*/ |
||||
public static loop_custom(handler: Function, intervlTime: number = 0, delay: number = 0) { |
||||
return this.schedule_custom(handler, intervlTime ? intervlTime : 0.02, cc.macro.REPEAT_FOREVER, delay); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 移除计时器Timer |
||||
* @param handler 回调 |
||||
*/ |
||||
public static removeTimer_custom(handler: Function) { |
||||
this.unschedule_custom(handler); |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 移除所有Timer |
||||
*/ |
||||
public static removeAllTimers_custom() { |
||||
cc.director.getScheduler().unscheduleAllForTarget(this) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 单次调度 |
||||
* @param handler
|
||||
* @param delay
|
||||
*/ |
||||
private static scheduleOnce_custom(handler: Function, delay: number) { |
||||
this.schedule_custom(handler, 0, 0, delay); |
||||
return handler; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* Timer开始调度 |
||||
* @param handler 回调 |
||||
* @param interval 间隔时间 |
||||
* @param repeat 重复次数(实际运行repeat + 1次) |
||||
* @param delay 延迟多少时间后开始执行 |
||||
*/ |
||||
private static schedule_custom(handler: Function, interval: number, repeat: number, delay: number) { |
||||
cc.director.getScheduler().schedule(handler, this, interval, repeat, delay); |
||||
return handler; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 移除调度 |
||||
* @param handler
|
||||
*/ |
||||
private static unschedule_custom(handler: Function) { |
||||
if (!handler) return; |
||||
cc.director.getScheduler().unschedule(handler, this); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "6bf2905c-096b-4ceb-9df6-601cfc3d42f8", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,242 @@ |
||||
|
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
import EventMgr from "../Event/EventMgr"; |
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
|
||||
|
||||
/** |
||||
* 框架的统一事件,游戏事件自行定义在自己代码中,这里只管框架的 |
||||
*/ |
||||
enum StatsFrameWorkEvent { |
||||
|
||||
ReportAdClickSuccess_custom = "ReportAdClickSuccess",//点击广告成功
|
||||
ReportAdClickFail_custom = "ReportAdClickFail",//点击广告失败
|
||||
ReportAdClickStart_custom = "ReportAdClickStart",//点击广告
|
||||
ReportLaunchOptions_custom = "ReportLaunchOptions",//场景值ip
|
||||
LogReportInfo_custom = "LogReportInfo",//上报日志
|
||||
LogReportError_custom = "LogReportError",//上报的异常日志
|
||||
LoginReportInfo_custom = "LoginReportInfo",//登录日志
|
||||
GameEventLVInto_custom = "Event_LVInto", //关卡进入人数 level
|
||||
GameEventLVFinish_custom = 'Event_LVFinish', //完成关卡 level status 关卡状态 字符 win,lose duration
|
||||
|
||||
Event_Commerce_custom = "Event_Commerce",//商业行为
|
||||
Event_Custom_custom = "Event_Custom",//个性事件
|
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
/* |
||||
* @Author: YeeChan |
||||
* @Date: 2020-11-24 19:30:12 |
||||
* @Description: 统计管理器 |
||||
*/ |
||||
export class UmengMgr { |
||||
|
||||
|
||||
|
||||
/** |
||||
* 统计事件 |
||||
* 仅统计事件,无属性时,使用如下方法:StatsMgr.sendEvent("事件ID") |
||||
* 统计带属性的事件时,使用如下方法: |
||||
* StatsMgr.sendEvent('事件ID', { '属性1':'属性值1','属性2':'属性值2' }); // 字符型属性值
|
||||
* StatsMgr.sendEvent('事件ID', { 'PayAmount':6999 });// 数值型属性值
|
||||
* @param event 事件 ID |
||||
* @param params 属性
|
||||
*/ |
||||
public static sendEvent_custom(event: string, params?: { [key: string]: string | number }) { |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
UmengMgr.uma_trackEvent(event, params); |
||||
} else if (AppPlatform.is_Iphone_custom() || AppPlatform.is_Android_custom()) {//ios
|
||||
// FMApp.uma_trackEvent_custom(event, params);
|
||||
} |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_Umeng_custom, { event: event }); |
||||
} |
||||
|
||||
/** |
||||
* 场景值 IP 地区 |
||||
* @param scene
|
||||
* @param dqip
|
||||
* @param ipxq
|
||||
*/ |
||||
public static sendReportLaunchOptions_custom(scene: string, dqip: string, ipxq: string) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.ReportLaunchOptions_custom, { |
||||
"scene": scene, |
||||
"dqip": dqip, |
||||
"ipxq": ipxq, |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 导出 成功 |
||||
* @param title
|
||||
* @param appid
|
||||
*/ |
||||
public static sendReportAdClickSuccess_custom(title: string, appid: string | number) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.ReportAdClickSuccess_custom, { |
||||
"title": title, |
||||
"appid": String(appid) |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 导出 失败 |
||||
* @param title
|
||||
* @param appid
|
||||
*/ |
||||
public static sendReportAdClickFail_custom(title: string, appid: string | number) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.ReportAdClickFail_custom, { |
||||
"title": title, |
||||
"appid": String(appid) |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 点击广告 |
||||
* @param title
|
||||
* @param appid
|
||||
*/ |
||||
public static sendReportAdClickStart_custom(title: string, appid: string | number) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.ReportAdClickStart_custom, { |
||||
"title": title, |
||||
"appid": String(appid) |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 关卡进入统计 |
||||
* @param level 关卡id |
||||
*/ |
||||
public static sendGameEventLvInto_custom(level: string) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.GameEventLVInto_custom, { |
||||
"level": level |
||||
}) |
||||
|
||||
//关卡开始
|
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
window["wx"].uma.stage.onStart({ |
||||
stageId: level + '',//该字段为固定字段不可修改,必传
|
||||
stageName: '第' + level + '关',// 付费金额 (该字段必传) 格式:数值型,number;请注意值格式,传错不能进行金额计算
|
||||
}) |
||||
} |
||||
} |
||||
|
||||
/** |
||||
* 完成关卡的统计 统计 没有胜负的游戏,均提交win |
||||
* @param level 关卡id |
||||
* @param isWin 是否胜利 true/false |
||||
* @param duration 关卡时长(秒) |
||||
* @param custom 自定义参数 |
||||
* isHome:0没有 1返回 |
||||
*
|
||||
*/ |
||||
public static sendGameEventLvFinish_custom(level: string, isWin: boolean, duration: number, custom?: { [key: string]: string | number }) { |
||||
let status = "win"; |
||||
if (!isWin) { |
||||
status = "lose"; |
||||
} |
||||
let params = {}; |
||||
params["level"] = level; |
||||
params["status"] = status; |
||||
params["duration"] = duration; |
||||
if (custom) { |
||||
for (const key in custom) { |
||||
if (Object.prototype.hasOwnProperty.call(custom, key)) { |
||||
const element = custom[key]; |
||||
if (key == "status") { |
||||
if (element) { |
||||
params["status"] = "home"; |
||||
} |
||||
} else { |
||||
params[key] = element; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.GameEventLVFinish_custom, params) |
||||
|
||||
//关卡结束
|
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
let _um_sdu = 0 |
||||
if (duration) { |
||||
_um_sdu = duration * 1000;//秒转毫秒
|
||||
} |
||||
window["wx"].uma.stage.onEnd({ |
||||
stageId: level + '',//该字段为固定字段不可修改,必传
|
||||
stageName: '第' + level + '关',// 付费金额 (该字段必传) 格式:数值型,number;请注意值格式,传错不能进行金额计算
|
||||
event: isWin ? "complete" : "fail",//关卡完成/关卡失败)
|
||||
_um_sdu: _um_sdu //关卡耗时(毫秒)
|
||||
}) |
||||
} |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 商业行为 |
||||
*/ |
||||
public static sendEvent_Commerce_custom(params: { [key: string]: string | number }) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.Event_Commerce_custom, params) |
||||
} |
||||
/** |
||||
* 个性事件 |
||||
*/ |
||||
public static sendEvent_Custom_custom(params: { [key: string]: string | number }) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.Event_Custom_custom, params) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 上报日志 |
||||
* @param info 具体的内容 |
||||
*/ |
||||
public static sendLogReportInfo_custom(info: string) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.LogReportInfo_custom, { |
||||
"info": info |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 上报的异常日志 |
||||
* @param info 具体的内容 |
||||
*/ |
||||
public static sendLogReportError_custom(info: string) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.LogReportError_custom, { |
||||
"info": info |
||||
}) |
||||
} |
||||
|
||||
/** |
||||
* 上报登录日志 |
||||
* @param type 平台登录/登录/用户数据 |
||||
* @param state 0成功,1网络异常,2业务异常 |
||||
* @param info 具体的内容 |
||||
*/ |
||||
public static sendLoginReportInfo_custom(type: string, state: number, info: string) { |
||||
UmengMgr.sendEvent_custom(StatsFrameWorkEvent.LoginReportInfo_custom, { |
||||
"type": type, |
||||
"state": state, |
||||
"info": info, |
||||
}) |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 友盟的统计 |
||||
* @param event
|
||||
* @param params
|
||||
*/ |
||||
private static uma_trackEvent(event: string, params?: { [key: string]: string | number }) { |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) {//需要增加合法域名 https://umini.shujupie.com
|
||||
if (window["wx"].uma) { |
||||
window["wx"].uma.trackEvent(event, params); |
||||
} else { |
||||
LogUtils.error_custom("统计事件 无友盟"); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "8a7aeead-75f8-4182-9bb1-477787d63c97", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,90 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:40 |
||||
*/ |
||||
|
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
|
||||
/** |
||||
* 设备震动相关 |
||||
*/ |
||||
export default class VibrateMgr { |
||||
//开关
|
||||
public static isEnable_custom = true; |
||||
|
||||
//短震动
|
||||
public static vibrateShort_custom(): void { |
||||
if (!VibrateMgr.isEnable_custom) |
||||
return; |
||||
let name = ""; |
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
name = "tt"; |
||||
} else if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
name = "wx"; |
||||
} else if (AppPlatform.is_OPPO_GAME_custom() || AppPlatform.is_VIVO_GAME_custom()) { |
||||
name = "qg"; |
||||
} else if (AppPlatform.is_QQ_PLAY_custom()) { //qq小游戏
|
||||
name = "qq"; |
||||
} |
||||
if (name != "") { |
||||
window[name].vibrateShort(); |
||||
} |
||||
} |
||||
|
||||
//长震动
|
||||
public static vibrateLong_custom(): void { |
||||
if (!VibrateMgr.isEnable_custom) |
||||
return; |
||||
|
||||
let name = ""; |
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
name = "tt"; |
||||
} else if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
name = "wx"; |
||||
} else if (AppPlatform.is_OPPO_GAME_custom() || AppPlatform.is_VIVO_GAME_custom()) { |
||||
name = "qg"; |
||||
} else if (AppPlatform.is_QQ_PLAY_custom()) { //qq小游戏
|
||||
name = "qq"; |
||||
} |
||||
if (name != "") { |
||||
window[name].vibrateLong(); |
||||
} |
||||
} |
||||
|
||||
//定时震动,毫秒
|
||||
public static vibrate_custom(time: number) { |
||||
if (!VibrateMgr.isEnable_custom) { |
||||
return; |
||||
} |
||||
let num = 0; |
||||
let count = time / 15; |
||||
|
||||
let funCall = null; |
||||
funCall = function (cTime: number) { |
||||
setTimeout(() => { |
||||
VibrateMgr.vibrateShort_custom(); |
||||
num++; |
||||
if (num <= count) { |
||||
funCall(cTime); |
||||
} |
||||
}, cTime) |
||||
} |
||||
|
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) {//抖音,字节跳动
|
||||
count = time / 15; |
||||
funCall(16) |
||||
} else if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
count = time / 15; //微信小游戏中震动的时间是15毫秒的整数倍时间,本质是对短震动的封装
|
||||
funCall(16) |
||||
} else if (AppPlatform.is_OPPO_GAME_custom()) { |
||||
count = time / 20; //OPPO小游戏中震动的时间是20毫秒的整数倍时间,本质是对短震动的封装
|
||||
funCall(21) |
||||
} else if (AppPlatform.is_QQ_PLAY_custom()) {//qq小游戏
|
||||
count = time / 20; //OPPO小游戏中震动的时间是20毫秒的整数倍时间,本质是对短震动的封装
|
||||
funCall(21) |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "d1fd0f17-172d-4ae7-819b-14fcfb4019a5", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,187 @@ |
||||
import QQMiniGameAPI from "../../Platform/qq/QQMiniGameAPI"; |
||||
import WXAPI from "../../Platform/weixin/WXAPI"; |
||||
import AppSwitchConfig from "../Config/AppSwitchConfig"; |
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
import EventMgr from "../Event/EventMgr"; |
||||
import HttpUnit from "../NetWork/HttpUnit"; |
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
|
||||
export default class WudianMgr { |
||||
private static ipBlockFlag_custom: number = -1; |
||||
public static ryw_IpBlockFlag_custom(): number { |
||||
return WudianMgr.ipBlockFlag_custom; |
||||
} |
||||
/** |
||||
* 此方法调用很慢,所以要在游戏初始化的时候调用一次此方法 |
||||
*
|
||||
* @static |
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static UpdateIpBlockState_custom(completed?: Function) { |
||||
HttpUnit.GetIpBlock_custom( |
||||
function (res) { |
||||
console.log("调用IpBlock接口成功,结果为:", res); |
||||
WudianMgr.ipBlockFlag_custom = res.code; |
||||
EventMgr.emitEvent_custom(ryw_Event.ryw_App_OnUpdateIpBlockState_custom, { ipBlockFlag: WudianMgr.ipBlockFlag_custom }); |
||||
completed && completed(); |
||||
}, |
||||
()=>{ |
||||
completed && completed(); |
||||
} |
||||
) |
||||
} |
||||
/** |
||||
* IP是否被屏蔽 |
||||
*
|
||||
* @static |
||||
* @returns {boolean}
|
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static ryw_GetIpBlocked_custom(): boolean { |
||||
return WudianMgr.ipBlockFlag_custom == 0; |
||||
} |
||||
// /**
|
||||
// * 得到用户进入的场景值
|
||||
// *
|
||||
// * @static
|
||||
// * @returns {number}
|
||||
// * @memberof WudianMgr
|
||||
// */
|
||||
// public static GetEntryScene_custom(): boolean {
|
||||
// return WXAPI.getLaunchOptionsSync_custom().scene == 1006;
|
||||
// }
|
||||
/** |
||||
* 误点开关是否打开,包括了总开关和分时开关 |
||||
*
|
||||
* @static |
||||
* @returns {boolean}
|
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static ryw_IsSwitchOpen_custom(): boolean { |
||||
let mainSwitch_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom == 1; |
||||
let isOpenTime_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianTimeAvaliable_custom; |
||||
console.log("误点 Flag_custom 状态: ", "总开关:", mainSwitch_custom, "打开时间", isOpenTime_custom); |
||||
return mainSwitch_custom && isOpenTime_custom; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 完全封装好的误点Flag 去掉了IP屏蔽 |
||||
*
|
||||
* @readonly |
||||
* @static |
||||
* @type {boolean} |
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static get wudianFlag_noIpBlock_custom(): boolean { |
||||
let mainSwitch_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom == 1; |
||||
let isOpenTime_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianTimeAvaliable_custom; |
||||
//let ipnotBlock = this.ipBlockFlag_custom == 0;
|
||||
let launchScene_custom = AppPlatform.getLaunchOptionsSync_custom().scene; |
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
mainSwitch_custom = true; |
||||
isOpenTime_custom = true; |
||||
} |
||||
|
||||
let noEnterBySearch_custom: boolean = true; |
||||
let wudianSceneList_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianSceneList_custom; |
||||
for (let i = 0; i < wudianSceneList_custom.length; ++i) { |
||||
var wudianSceneValue = wudianSceneList_custom[i]; |
||||
if (launchScene_custom == wudianSceneValue) { |
||||
noEnterBySearch_custom = false; |
||||
} |
||||
} |
||||
/* 测试功能,等删 */ |
||||
// ipnotBlock = true;
|
||||
console.log("误点 Flag_custom 状态: ", "总开关:", mainSwitch_custom, "场景进入", noEnterBySearch_custom, "打开时间", |
||||
isOpenTime_custom); |
||||
|
||||
return mainSwitch_custom && noEnterBySearch_custom && isOpenTime_custom; |
||||
} |
||||
|
||||
|
||||
/** |
||||
* 完全封装好的误点Flag |
||||
*
|
||||
* @readonly |
||||
* @static |
||||
* @type {boolean} |
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static get wudianFlag_custom(): boolean { |
||||
let mainSwitch_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom == 1; |
||||
let isOpenTime_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianTimeAvaliable_custom; |
||||
let ipnotBlock_custom = this.ipBlockFlag_custom == 0; |
||||
let launchScene_custom = AppPlatform.getLaunchOptionsSync_custom().scene; |
||||
|
||||
if (AppPlatform.is_TT_GAME_custom()) { |
||||
mainSwitch_custom = true; |
||||
isOpenTime_custom = true; |
||||
} |
||||
|
||||
let noEnterBySearch_custom: boolean = true; |
||||
let wudianSceneList_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianSceneList_custom; |
||||
for (let i = 0; i < wudianSceneList_custom.length; ++i) { |
||||
let wudianSceneValue = wudianSceneList_custom[i]; |
||||
if (launchScene_custom == wudianSceneValue) { |
||||
noEnterBySearch_custom = false; |
||||
} |
||||
} |
||||
/* 测试功能,等删 */ |
||||
// ipnotBlock = true;
|
||||
console.log("误点 Flag_custom 状态: ", "总开关:", mainSwitch_custom, "场景进入", noEnterBySearch_custom, "IP未被屏蔽", ipnotBlock_custom, "打开时间", |
||||
isOpenTime_custom); |
||||
|
||||
return mainSwitch_custom && noEnterBySearch_custom && ipnotBlock_custom && isOpenTime_custom; |
||||
} |
||||
/** |
||||
* 没有涉及到定时开关的wudianFlag,自行整合按照时间开关的效果 |
||||
*
|
||||
* @static |
||||
* @returns {boolean}
|
||||
* @memberof WudianMgr |
||||
*/ |
||||
public static get NoTimeWudianFlag_custom(): boolean { |
||||
let mainSwitch_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudian_custom == 1; |
||||
let launchScene_custom = AppPlatform.getLaunchOptionsSync_custom().scene; |
||||
|
||||
let noEnterBySearch_custom: boolean = true; |
||||
let wudianSceneList_custom = AppSwitchConfig.getInstance_custom().getAppSwitchData_custom().wudianSceneList_custom; |
||||
for (let i = 0; i < wudianSceneList_custom.length; ++i) { |
||||
let wudianSceneValue_custom = wudianSceneList_custom[i]; |
||||
if (launchScene_custom == wudianSceneValue_custom) { |
||||
noEnterBySearch_custom = false; |
||||
} |
||||
} |
||||
let ipnotBlock_custom = WudianMgr.ipBlockFlag_custom == 0; |
||||
/* 测试功能,等删 */ |
||||
// ipnotBlock = true;
|
||||
console.log("误点 Flag_custom 状态: ", "总开关:", mainSwitch_custom, "场景进入", noEnterBySearch_custom, "IP未被屏蔽"); |
||||
return mainSwitch_custom && noEnterBySearch_custom && ipnotBlock_custom; |
||||
} |
||||
|
||||
|
||||
public static get isEnterBySerach_custom(): boolean { |
||||
|
||||
let launchScene = null; |
||||
if (AppPlatform.is_WECHAT_GAME_custom()) { |
||||
launchScene = WXAPI.getLaunchOptionsSync_custom().scene; |
||||
} |
||||
else if (AppPlatform.is_QQ_PLAY_custom()) { |
||||
launchScene = QQMiniGameAPI.getLaunchOptionsSync_custom().scene; |
||||
} |
||||
|
||||
let noEnterBySearch: boolean = true; |
||||
var wudianSceneList = [1011, 1012, 1013, 1047] |
||||
for (var i = 0; i < wudianSceneList.length; ++i) { |
||||
var wudianSceneValue = wudianSceneList[i]; |
||||
if (launchScene == wudianSceneValue) { |
||||
noEnterBySearch = false; |
||||
} |
||||
} |
||||
|
||||
console.log("场景进入", noEnterBySearch); |
||||
return noEnterBySearch; |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "84175847-5854-4354-b11d-7ab2cbf2373d", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,15 @@ |
||||
import VibrateMgr from "./VibrateMgr"; |
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class NewClass extends cc.Component { |
||||
onBeginContact(contact: cc.PhysicsContact, selfCollider: cc.PhysicsBoxCollider, otherCollider: cc.PhysicsBoxCollider) { |
||||
if (selfCollider.tag == 4 || selfCollider.tag == 5 || selfCollider.tag == 6 || selfCollider.tag == 7) { |
||||
} else { |
||||
VibrateMgr.vibrateShort_custom(); |
||||
} |
||||
} |
||||
|
||||
// update (dt) {}
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "f1dfe56e-1106-4d96-91b8-b963cda00d88", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,29 @@ |
||||
import { ryw_Event } from "../Event/EventEnum"; |
||||
import EventMgr from "../Event/EventMgr"; |
||||
import VibrateMgr from "./VibrateMgr"; |
||||
|
||||
const { ccclass, property } = cc._decorator; |
||||
|
||||
@ccclass |
||||
export default class daskPhysics extends cc.Component { |
||||
|
||||
// onLoad () {}
|
||||
onBeginContact(contact: cc.PhysicsContact, selfCollider: cc.PhysicsBoxCollider, otherCollider: cc.PhysicsBoxCollider) { |
||||
if (selfCollider.tag == 4 || selfCollider.tag == 5 || selfCollider.tag == 6 || selfCollider.tag == 7) { |
||||
// otherCollider.node.removeComponent(cc.RigidBody);
|
||||
} |
||||
} |
||||
// onEndContact(contact: cc.PhysicsContact, selfCollider: cc.PhysicsBoxCollider, otherCollider: cc.PhysicsBoxCollider) {
|
||||
// if (selfCollider.tag == 4 || selfCollider.tag == 5 || selfCollider.tag == 6 || selfCollider.tag == 7) {
|
||||
// if(otherCollider.node.group == "wolf"){
|
||||
// EventMgr.emitEvent_custom(ryw_Event.sheepHoled, otherCollider.node, selfCollider.offset);
|
||||
// }
|
||||
// // otherCollider.node.removeComponent(cc.RigidBody);
|
||||
// }
|
||||
// }
|
||||
start() { |
||||
|
||||
} |
||||
|
||||
// update (dt) {}
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "8239d7bf-3a9b-4e98-a472-b03f6ba5ed7f", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "e6f70306-a4ff-4bf6-81bd-734590d46f6f", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,30 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:38 |
||||
*/ |
||||
import * as CryptoJS from "./aes.js" |
||||
|
||||
export default class AesTools { |
||||
private static readonly KEY_custom = 'b#63fFJ6AvkK3YT*'; |
||||
private static readonly IV_custom = 'J$f4DU%sNL73M&Go'; |
||||
|
||||
//加密
|
||||
public static encrypt_custom(str: string) { |
||||
var key = CryptoJS.enc.Utf8.parse(AesTools.KEY_custom);// 秘钥
|
||||
var iv = CryptoJS.enc.Utf8.parse(AesTools.IV_custom);//向量iv
|
||||
var encrypted = CryptoJS.AES.encrypt(str, key, { iv: iv, mode: CryptoJS.mode.CBC, padding: CryptoJS.pad.Pkcs7 }); |
||||
return encrypted.toString(); |
||||
} |
||||
|
||||
//解密
|
||||
public static decrypt_custom(str: string) { |
||||
var key = CryptoJS.enc.Utf8.parse(AesTools.KEY_custom);// 秘钥
|
||||
var iv = CryptoJS.enc.Utf8.parse(AesTools.IV_custom);//向量iv
|
||||
var decrypted = CryptoJS.AES.decrypt(str, key, { iv: iv, padding: CryptoJS.pad.Pkcs7 }); |
||||
return decrypted.toString(CryptoJS.enc.Utf8); |
||||
} |
||||
|
||||
|
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "9c8c955e-5ee7-466b-a144-8931bf64f431", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,422 @@ |
||||
import NetConfig from "./NetConfig"; |
||||
import User from "../User/User"; |
||||
import AesTools from "./AesTools"; |
||||
import AppConfig from "../Config/AppConfig"; |
||||
import { LogUtils } from "../Util/LogUtils"; |
||||
import AppPlatform from "../Util/AppPlatform"; |
||||
|
||||
export class requestData { |
||||
public meth_custom: string = "post"; |
||||
public readonly data_custom: any; |
||||
public url_custom: string = ""; |
||||
public onSuccess_custom: Function = null; |
||||
public onFail_custom: Function = null; |
||||
|
||||
constructor() { |
||||
this.data_custom = {}; |
||||
} |
||||
} |
||||
|
||||
export default class HttpUnit { |
||||
|
||||
|
||||
/** |
||||
* 发送 Http 请求 |
||||
* @param req
|
||||
* @param sendMsg
|
||||
* @param completeFunc
|
||||
* @param errorFunc
|
||||
* @param headers
|
||||
*/ |
||||
public static sendHttpUrl_custom(req: requestData, sendMsg: string, completeFunc: Function, errorFunc: Function, headers?: any) { |
||||
let headersTab = headers || {}; //头数据
|
||||
|
||||
|
||||
let xhr: XMLHttpRequest = new XMLHttpRequest(); |
||||
|
||||
//请求过程发生意外的回调
|
||||
xhr.onerror = function (error) { |
||||
LogUtils.networkError_custom("网络请求异常" + error) |
||||
errorFunc("网络请求异常"); |
||||
} |
||||
//超时
|
||||
xhr.ontimeout = function (error) { |
||||
LogUtils.networkError_custom("网络超时" + error) |
||||
errorFunc("网络超时"); |
||||
} |
||||
|
||||
xhr.onreadystatechange = function () { |
||||
/* |
||||
0 UNSENT 代理被创建,但尚未调用 open() 方法。 |
||||
1 OPENED open() 方法已经被调用。 |
||||
2 HEADERS_RECEIVED send() 方法已经被调用,并且头部和状态已经可获得。 |
||||
3 LOADING 下载中; responseText 属性已经包含部分数据。 |
||||
4 DONE 下载操作已完成。 |
||||
*/ |
||||
let readyState = xhr.readyState; |
||||
let status = xhr.status; |
||||
|
||||
if (readyState === 4) { |
||||
if (status >= 200 && status < 300) { |
||||
let responseText = xhr.responseText; |
||||
// LogUtils.networkLog_custom("接收数据:----------------------")
|
||||
// LogUtils.networkLog_custom("接收内容:" + responseText)
|
||||
const response = JSON.parse(responseText); |
||||
completeFunc(response); |
||||
} else { |
||||
let statusText = xhr.statusText; |
||||
// LogUtils.networkError_custom("接收数据异常:----------------------status " + status)
|
||||
// LogUtils.networkLog_custom("接收内容:" + statusText)
|
||||
errorFunc(statusText); |
||||
} |
||||
} |
||||
} |
||||
|
||||
xhr.open(req.meth_custom, req.url_custom, true); |
||||
|
||||
if (headersTab) { |
||||
for (let key in headersTab) { |
||||
xhr.setRequestHeader(key, headersTab[key]); |
||||
} |
||||
} |
||||
|
||||
// LogUtils.networkLog_custom("发送数据:----------------------")
|
||||
// LogUtils.networkLog_custom(req.url_custom + " " + req.meth_custom)
|
||||
// LogUtils.networkLog_custom(sendMsg);
|
||||
// LogUtils.networkLog_custom(JSON.stringify(headers));
|
||||
// LogUtils.networkLog_custom("----------------------")
|
||||
|
||||
xhr.send(sendMsg); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
public static request_custom(req: requestData) { |
||||
if (req.url_custom.indexOf("https://") > -1 || |
||||
req.url_custom.indexOf("http://") > -1) { |
||||
req.url_custom = req.url_custom; |
||||
} else { |
||||
// if (AppPlatform.is_BD_GAME_custom()) {//百度的用test域名
|
||||
// req.url_custom = NetConfig.serverUrl_test_custom + req.url_custom;
|
||||
// }
|
||||
// // else if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// // req.url_custom = NetConfig.php_serverUrl_custom + req.url_custom;
|
||||
// // }
|
||||
// else {
|
||||
req.url_custom = NetConfig.serverUrl_custom + req.url_custom; |
||||
// }
|
||||
} |
||||
|
||||
let completeFunc = (res) => { |
||||
LogUtils.networkLog_custom(res, "http Success") |
||||
if (req.onSuccess_custom) { |
||||
req.onSuccess_custom(res); |
||||
} |
||||
req.onSuccess_custom = null; |
||||
req = null; |
||||
}; |
||||
|
||||
let fail = req.onFail_custom; |
||||
let errorFunc = (res) => { |
||||
LogUtils.networkLog_custom(res, "http fail") |
||||
if (fail) { |
||||
fail(res); |
||||
} |
||||
req && (req.onFail_custom = null); |
||||
fail = null; |
||||
req = null; |
||||
}; |
||||
|
||||
|
||||
|
||||
//let dataStr: string = JSON.stringify(req.data);
|
||||
|
||||
// if (Laya.Browser.onMiniGame || AppConfig.onTTMiniGame) {
|
||||
// req.data.code = User.code;
|
||||
// }
|
||||
// else if (Laya.Browser.onQGMiniGame) //OPPO小游戏
|
||||
// {
|
||||
// req.data.oppotoken = User.code;
|
||||
// }
|
||||
// else if (Laya.Browser.onQQMiniGame) //qq小游戏
|
||||
// {
|
||||
// req.data.code = User.code;
|
||||
// }
|
||||
// else {
|
||||
|
||||
if (AppPlatform.is_OPPO_GAME_custom()) { |
||||
req.data_custom.oppotoken = User.code_custom; |
||||
} else if (AppPlatform.is_Android_custom()) { |
||||
req.data_custom.sbh = User.code_custom; |
||||
} |
||||
|
||||
req.data_custom.code = User.code_custom; |
||||
//}
|
||||
|
||||
|
||||
|
||||
//头文件
|
||||
let time = "time=" + String(Date.now()); |
||||
let headers = {}; |
||||
//headers["Access-Control-Allow-Origin"] = "*";
|
||||
headers["Content-Type"] = "application/json"; |
||||
headers["state"] = AppConfig.state_custom; |
||||
headers["gameid"] = AppConfig.gameid_custom; |
||||
headers["sign"] = AesTools.encrypt_custom(time); |
||||
|
||||
|
||||
if (User.token_custom) { |
||||
headers["token"] = User.token_custom; |
||||
} |
||||
|
||||
//发送数据
|
||||
let sendMsg = null; |
||||
if (req.data_custom) { |
||||
sendMsg = JSON.stringify(req.data_custom) |
||||
} |
||||
this.sendHttpUrl_custom(req, sendMsg, completeFunc, errorFunc, headers); |
||||
} |
||||
|
||||
//todo:这里添加你们和服务器相互的接口
|
||||
public static getServerTime_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.Get_ServerTime_custom; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
//todo:这里添加你们和服务器相互的接口
|
||||
|
||||
public static login_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.Login_custom; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
|
||||
// if (AppPlatform.is_VIVO_GAME_custom()) {//vivo 用php
|
||||
// req.url_custom = NetConfig.php_Login_custom;
|
||||
// }
|
||||
|
||||
|
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
public static saveGameData_custom(gameData: any, onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.SaveGameData_custom; |
||||
// if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// req.url_custom = NetConfig.php_SaveGameData_custom;
|
||||
// }
|
||||
req.data_custom.gameData = gameData; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
public static getGameData_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.GetUser_custom; |
||||
req.onSuccess_custom = onSuccess; |
||||
// if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// req.url_custom = NetConfig.php_GetUser_custom;
|
||||
// let fucSuccess = (res) => {
|
||||
// if (res.data && res.data.gamedata) {//对php的数据做加工
|
||||
// let _cdata = res.data.gamedata;
|
||||
// res.data = _cdata;
|
||||
// }
|
||||
// if (onSuccess) {
|
||||
// onSuccess(res);
|
||||
// }
|
||||
// }
|
||||
// req.onSuccess_custom = fucSuccess;
|
||||
// }
|
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
/** |
||||
* IP屏蔽方法,需要在NetConfig类中设置IpBlock的接口地址 |
||||
* onSuccess方法返回参数的范例为 Object {code: 0, msg: "准一线", time: "1571034447", data: null} |
||||
* @static |
||||
* @memberof HttpUnit |
||||
*/ |
||||
public static GetIpBlock_custom(onSuccess: Function, onFail: Function) { |
||||
if (-1 != AppConfig.gameid_custom) { |
||||
|
||||
console.error("启动新版本的屏蔽系统") |
||||
let url = "https://wxxyx.renyouwangluo.cn/renyou_other_template/ipLogin" |
||||
let headersTab = {}; //头数据
|
||||
let xhr: XMLHttpRequest = new XMLHttpRequest(); |
||||
xhr.timeout = 15000; |
||||
|
||||
//请求过程发生意外的回调
|
||||
xhr.onerror = function (error) { |
||||
LogUtils.networkError_custom("网络请求异常" + error) |
||||
onFail("网络请求异常"); |
||||
} |
||||
//超时
|
||||
xhr.ontimeout = function (error) { |
||||
LogUtils.networkError_custom("网络超时" + error) |
||||
onFail("网络超时"); |
||||
} |
||||
|
||||
xhr.onreadystatechange = function () { |
||||
/* |
||||
0 UNSENT 代理被创建,但尚未调用 open() 方法。 |
||||
1 OPENED open() 方法已经被调用。 |
||||
2 HEADERS_RECEIVED send() 方法已经被调用,并且头部和状态已经可获得。 |
||||
3 LOADING 下载中; responseText 属性已经包含部分数据。 |
||||
4 DONE 下载操作已完成。 |
||||
*/ |
||||
let readyState = xhr.readyState; |
||||
let status = xhr.status; |
||||
|
||||
if (readyState === 4) { |
||||
let tab = { code: 1 } |
||||
if (status >= 200 && status < 300) { |
||||
let responseText = xhr.responseText; |
||||
LogUtils.networkLog_custom("接收数据:----------------------") |
||||
LogUtils.networkLog_custom("接收内容:" + responseText) |
||||
const response = JSON.parse(responseText); |
||||
if (response && response.isBlackIp == 0) {//没有屏蔽
|
||||
tab.code = 0; |
||||
console.error("新版本的屏蔽系统 不屏蔽") |
||||
} else { |
||||
console.error("新版本的屏蔽系统 ", responseText) |
||||
} |
||||
onSuccess(tab); |
||||
} else { |
||||
let statusText = xhr.statusText; |
||||
LogUtils.networkError_custom("接收数据异常:----------------------status " + status) |
||||
LogUtils.networkLog_custom("接收内容:" + statusText) |
||||
onSuccess(tab); |
||||
} |
||||
} |
||||
} |
||||
|
||||
xhr.open("POST", url, true); |
||||
|
||||
if (!headersTab["Content-Type"]) { |
||||
headersTab["Content-Type"] = "application/json"; |
||||
} |
||||
if (headersTab) { |
||||
for (let key in headersTab) { |
||||
xhr.setRequestHeader(key, headersTab[key]); |
||||
} |
||||
} |
||||
//1351
|
||||
let params = { gameId: AppConfig.gameid_custom }; |
||||
// let params = { gameId: 1351 };
|
||||
let sendMsg = JSON.stringify(params); |
||||
xhr.send(sendMsg); |
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
} |
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
public static reportExport_custom(appid: string, game_name: string, onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.reportExport_custom; |
||||
req.data_custom.wbappid = appid; |
||||
req.data_custom.game_name = game_name; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
public static reportImport_custom(appid: string, channel: string, onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.reportImport_custom; |
||||
req.data_custom.wbappid = appid; |
||||
req.data_custom.channel = channel; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
public static Getuserip_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.getuserip_custom; |
||||
// if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// req.url_custom = NetConfig.php_getuserip_custom;
|
||||
// }
|
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
//签到
|
||||
public static SignIn_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.signin_custom; |
||||
// if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// req.url_custom = NetConfig.php_signin_custom;
|
||||
// }
|
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
req.data_custom.type = 1; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
//获取签到状态
|
||||
public static GetSignIn_custom(onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.signin_custom; |
||||
// if (AppPlatform.is_VIVO_GAME_custom() || AppPlatform.is_Android_custom()) {//vivo andorid 用php
|
||||
// req.url_custom = NetConfig.php_signin_custom;
|
||||
// }
|
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
req.data_custom.type = 0; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
|
||||
|
||||
//抖音上报渠道参数
|
||||
public static reportTTLaunchChannel_custom(ak: string, cd: string, bid: string, onSuccess: Function, onFail: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.ttReportLaunchChannel_custom; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
req.data_custom.ak = ak; |
||||
req.data_custom.bid = bid; |
||||
req.data_custom.cd = cd; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
|
||||
/** |
||||
* 扫码屏蔽 |
||||
* @param data
|
||||
* @param onSuccess
|
||||
* @param onFail
|
||||
*/ |
||||
public static userScanCode_custom(data: any, onSuccess?: Function, onFail?: Function) { |
||||
var req = new requestData(); |
||||
req.url_custom = NetConfig.userScanCode_custom; |
||||
req.onSuccess_custom = onSuccess; |
||||
req.onFail_custom = onFail; |
||||
req.data_custom.code = data.code; |
||||
req.data_custom.state = data.state; |
||||
// req.data_custom.gameId = data.gameId;
|
||||
req.data_custom.type = data.type; |
||||
req.data_custom.scan = data.scan; |
||||
HttpUnit.request_custom(req); |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "c40efbbb-3117-45fb-a688-36a2f2b32759", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,28 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-09 18:54:38 |
||||
*/ |
||||
|
||||
/** |
||||
* 网络的相关接口配置 |
||||
*/ |
||||
export default class NetConfig { |
||||
public static readonly serverUrl_custom: string = "https://javaapi.renyouwangluo.cn"; |
||||
//public static readonly serverUrl_test_custom: string = "https://javaapi.test.renyouwangluo.cn";
|
||||
|
||||
public static readonly Login_custom: string = "/api/user/login"; |
||||
public static readonly SaveGameData_custom: string = "/api/user/game/data/write"; |
||||
public static readonly GetUser_custom = "/api/user/game/data/read"; |
||||
/* 用来对IP地址进行屏蔽的接口地址,可以使用接口的返回值让某些广告逻辑在微信的审核地区(广州)发生变化 */ |
||||
public static readonly IpBlock_custom = "/api/user/ip/select"; |
||||
public static readonly reportExport_custom = "/api/share/getwaibuad"; |
||||
public static readonly reportImport_custom = "/api/share/getzjadml"; |
||||
public static readonly getuserip_custom = "/api/user/ip"; |
||||
public static readonly signin_custom = "/api/user/sign";//签到
|
||||
public static readonly Get_ServerTime_custom = "/api/share/gettime"// 服务器当前的时间戳
|
||||
public static readonly userScanCode_custom = "/api/user/scan/code" //上报2
|
||||
//抖音上传统计报告
|
||||
public static readonly ttReportLaunchChannel_custom = "https://javareport.renyouwangluo.cn/api/data/tt/report" |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "96e2f269-b2d1-424d-ba06-f64c157fc3a9", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,101 @@ |
||||
var CryptoJS = CryptoJS || function (u, p) { |
||||
var d = {}, l = d.lib = {}, s = function () { }, t = l.Base = { extend: function (a) { s.prototype = this; var c = new s; a && c.mixIn(a); c.hasOwnProperty("init") || (c.init = function () { c.$super.init.apply(this, arguments) }); c.init.prototype = c; c.$super = this; return c }, create: function () { var a = this.extend(); a.init.apply(a, arguments); return a }, init: function () { }, mixIn: function (a) { for (var c in a) a.hasOwnProperty(c) && (this[c] = a[c]); a.hasOwnProperty("toString") && (this.toString = a.toString) }, clone: function () { return this.init.prototype.extend(this) } }, |
||||
r = l.WordArray = t.extend({ |
||||
init: function (a, c) { a = this.words = a || []; this.sigBytes = c != p ? c : 4 * a.length }, toString: function (a) { return (a || v).stringify(this) }, concat: function (a) { var c = this.words, e = a.words, j = this.sigBytes; a = a.sigBytes; this.clamp(); if (j % 4) for (var k = 0; k < a; k++)c[j + k >>> 2] |= (e[k >>> 2] >>> 24 - 8 * (k % 4) & 255) << 24 - 8 * ((j + k) % 4); else if (65535 < e.length) for (k = 0; k < a; k += 4)c[j + k >>> 2] = e[k >>> 2]; else c.push.apply(c, e); this.sigBytes += a; return this }, clamp: function () { |
||||
var a = this.words, c = this.sigBytes; a[c >>> 2] &= 4294967295 << |
||||
32 - 8 * (c % 4); a.length = u.ceil(c / 4) |
||||
}, clone: function () { var a = t.clone.call(this); a.words = this.words.slice(0); return a }, random: function (a) { for (var c = [], e = 0; e < a; e += 4)c.push(4294967296 * u.random() | 0); return new r.init(c, a) } |
||||
}), w = d.enc = {}, v = w.Hex = { |
||||
stringify: function (a) { var c = a.words; a = a.sigBytes; for (var e = [], j = 0; j < a; j++) { var k = c[j >>> 2] >>> 24 - 8 * (j % 4) & 255; e.push((k >>> 4).toString(16)); e.push((k & 15).toString(16)) } return e.join("") }, parse: function (a) { |
||||
for (var c = a.length, e = [], j = 0; j < c; j += 2)e[j >>> 3] |= parseInt(a.substr(j, |
||||
2), 16) << 24 - 4 * (j % 8); return new r.init(e, c / 2) |
||||
} |
||||
}, b = w.Latin1 = { stringify: function (a) { var c = a.words; a = a.sigBytes; for (var e = [], j = 0; j < a; j++)e.push(String.fromCharCode(c[j >>> 2] >>> 24 - 8 * (j % 4) & 255)); return e.join("") }, parse: function (a) { for (var c = a.length, e = [], j = 0; j < c; j++)e[j >>> 2] |= (a.charCodeAt(j) & 255) << 24 - 8 * (j % 4); return new r.init(e, c) } }, x = w.Utf8 = { stringify: function (a) { try { return decodeURIComponent(escape(b.stringify(a))) } catch (c) { throw Error("Malformed UTF-8 data"); } }, parse: function (a) { return b.parse(unescape(encodeURIComponent(a))) } }, |
||||
q = l.BufferedBlockAlgorithm = t.extend({ |
||||
reset: function () { this._data = new r.init; this._nDataBytes = 0 }, _append: function (a) { "string" == typeof a && (a = x.parse(a)); this._data.concat(a); this._nDataBytes += a.sigBytes }, _process: function (a) { var c = this._data, e = c.words, j = c.sigBytes, k = this.blockSize, b = j / (4 * k), b = a ? u.ceil(b) : u.max((b | 0) - this._minBufferSize, 0); a = b * k; j = u.min(4 * a, j); if (a) { for (var q = 0; q < a; q += k)this._doProcessBlock(e, q); q = e.splice(0, a); c.sigBytes -= j } return new r.init(q, j) }, clone: function () { |
||||
var a = t.clone.call(this); |
||||
a._data = this._data.clone(); return a |
||||
}, _minBufferSize: 0 |
||||
}); l.Hasher = q.extend({ |
||||
cfg: t.extend(), init: function (a) { this.cfg = this.cfg.extend(a); this.reset() }, reset: function () { q.reset.call(this); this._doReset() }, update: function (a) { this._append(a); this._process(); return this }, finalize: function (a) { a && this._append(a); return this._doFinalize() }, blockSize: 16, _createHelper: function (a) { return function (b, e) { return (new a.init(e)).finalize(b) } }, _createHmacHelper: function (a) { |
||||
return function (b, e) { |
||||
return (new n.HMAC.init(a, |
||||
e)).finalize(b) |
||||
} |
||||
} |
||||
}); var n = d.algo = {}; return d |
||||
}(Math); |
||||
(function () { |
||||
var u = CryptoJS, p = u.lib.WordArray; u.enc.Base64 = { |
||||
stringify: function (d) { var l = d.words, p = d.sigBytes, t = this._map; d.clamp(); d = []; for (var r = 0; r < p; r += 3)for (var w = (l[r >>> 2] >>> 24 - 8 * (r % 4) & 255) << 16 | (l[r + 1 >>> 2] >>> 24 - 8 * ((r + 1) % 4) & 255) << 8 | l[r + 2 >>> 2] >>> 24 - 8 * ((r + 2) % 4) & 255, v = 0; 4 > v && r + 0.75 * v < p; v++)d.push(t.charAt(w >>> 6 * (3 - v) & 63)); if (l = t.charAt(64)) for (; d.length % 4;)d.push(l); return d.join("") }, parse: function (d) { |
||||
var l = d.length, s = this._map, t = s.charAt(64); t && (t = d.indexOf(t), -1 != t && (l = t)); for (var t = [], r = 0, w = 0; w < |
||||
l; w++)if (w % 4) { var v = s.indexOf(d.charAt(w - 1)) << 2 * (w % 4), b = s.indexOf(d.charAt(w)) >>> 6 - 2 * (w % 4); t[r >>> 2] |= (v | b) << 24 - 8 * (r % 4); r++ } return p.create(t, r) |
||||
}, _map: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=" |
||||
} |
||||
})(); |
||||
(function (u) { |
||||
function p(b, n, a, c, e, j, k) { b = b + (n & a | ~n & c) + e + k; return (b << j | b >>> 32 - j) + n } function d(b, n, a, c, e, j, k) { b = b + (n & c | a & ~c) + e + k; return (b << j | b >>> 32 - j) + n } function l(b, n, a, c, e, j, k) { b = b + (n ^ a ^ c) + e + k; return (b << j | b >>> 32 - j) + n } function s(b, n, a, c, e, j, k) { b = b + (a ^ (n | ~c)) + e + k; return (b << j | b >>> 32 - j) + n } for (var t = CryptoJS, r = t.lib, w = r.WordArray, v = r.Hasher, r = t.algo, b = [], x = 0; 64 > x; x++)b[x] = 4294967296 * u.abs(u.sin(x + 1)) | 0; r = r.MD5 = v.extend({ |
||||
_doReset: function () { this._hash = new w.init([1732584193, 4023233417, 2562383102, 271733878]) }, |
||||
_doProcessBlock: function (q, n) { |
||||
for (var a = 0; 16 > a; a++) { var c = n + a, e = q[c]; q[c] = (e << 8 | e >>> 24) & 16711935 | (e << 24 | e >>> 8) & 4278255360 } var a = this._hash.words, c = q[n + 0], e = q[n + 1], j = q[n + 2], k = q[n + 3], z = q[n + 4], r = q[n + 5], t = q[n + 6], w = q[n + 7], v = q[n + 8], A = q[n + 9], B = q[n + 10], C = q[n + 11], u = q[n + 12], D = q[n + 13], E = q[n + 14], x = q[n + 15], f = a[0], m = a[1], g = a[2], h = a[3], f = p(f, m, g, h, c, 7, b[0]), h = p(h, f, m, g, e, 12, b[1]), g = p(g, h, f, m, j, 17, b[2]), m = p(m, g, h, f, k, 22, b[3]), f = p(f, m, g, h, z, 7, b[4]), h = p(h, f, m, g, r, 12, b[5]), g = p(g, h, f, m, t, 17, b[6]), m = p(m, g, h, f, w, 22, b[7]), |
||||
f = p(f, m, g, h, v, 7, b[8]), h = p(h, f, m, g, A, 12, b[9]), g = p(g, h, f, m, B, 17, b[10]), m = p(m, g, h, f, C, 22, b[11]), f = p(f, m, g, h, u, 7, b[12]), h = p(h, f, m, g, D, 12, b[13]), g = p(g, h, f, m, E, 17, b[14]), m = p(m, g, h, f, x, 22, b[15]), f = d(f, m, g, h, e, 5, b[16]), h = d(h, f, m, g, t, 9, b[17]), g = d(g, h, f, m, C, 14, b[18]), m = d(m, g, h, f, c, 20, b[19]), f = d(f, m, g, h, r, 5, b[20]), h = d(h, f, m, g, B, 9, b[21]), g = d(g, h, f, m, x, 14, b[22]), m = d(m, g, h, f, z, 20, b[23]), f = d(f, m, g, h, A, 5, b[24]), h = d(h, f, m, g, E, 9, b[25]), g = d(g, h, f, m, k, 14, b[26]), m = d(m, g, h, f, v, 20, b[27]), f = d(f, m, g, h, D, 5, b[28]), h = d(h, f, |
||||
m, g, j, 9, b[29]), g = d(g, h, f, m, w, 14, b[30]), m = d(m, g, h, f, u, 20, b[31]), f = l(f, m, g, h, r, 4, b[32]), h = l(h, f, m, g, v, 11, b[33]), g = l(g, h, f, m, C, 16, b[34]), m = l(m, g, h, f, E, 23, b[35]), f = l(f, m, g, h, e, 4, b[36]), h = l(h, f, m, g, z, 11, b[37]), g = l(g, h, f, m, w, 16, b[38]), m = l(m, g, h, f, B, 23, b[39]), f = l(f, m, g, h, D, 4, b[40]), h = l(h, f, m, g, c, 11, b[41]), g = l(g, h, f, m, k, 16, b[42]), m = l(m, g, h, f, t, 23, b[43]), f = l(f, m, g, h, A, 4, b[44]), h = l(h, f, m, g, u, 11, b[45]), g = l(g, h, f, m, x, 16, b[46]), m = l(m, g, h, f, j, 23, b[47]), f = s(f, m, g, h, c, 6, b[48]), h = s(h, f, m, g, w, 10, b[49]), g = s(g, h, f, m, |
||||
E, 15, b[50]), m = s(m, g, h, f, r, 21, b[51]), f = s(f, m, g, h, u, 6, b[52]), h = s(h, f, m, g, k, 10, b[53]), g = s(g, h, f, m, B, 15, b[54]), m = s(m, g, h, f, e, 21, b[55]), f = s(f, m, g, h, v, 6, b[56]), h = s(h, f, m, g, x, 10, b[57]), g = s(g, h, f, m, t, 15, b[58]), m = s(m, g, h, f, D, 21, b[59]), f = s(f, m, g, h, z, 6, b[60]), h = s(h, f, m, g, C, 10, b[61]), g = s(g, h, f, m, j, 15, b[62]), m = s(m, g, h, f, A, 21, b[63]); a[0] = a[0] + f | 0; a[1] = a[1] + m | 0; a[2] = a[2] + g | 0; a[3] = a[3] + h | 0 |
||||
}, _doFinalize: function () { |
||||
var b = this._data, n = b.words, a = 8 * this._nDataBytes, c = 8 * b.sigBytes; n[c >>> 5] |= 128 << 24 - c % 32; var e = u.floor(a / |
||||
4294967296); n[(c + 64 >>> 9 << 4) + 15] = (e << 8 | e >>> 24) & 16711935 | (e << 24 | e >>> 8) & 4278255360; n[(c + 64 >>> 9 << 4) + 14] = (a << 8 | a >>> 24) & 16711935 | (a << 24 | a >>> 8) & 4278255360; b.sigBytes = 4 * (n.length + 1); this._process(); b = this._hash; n = b.words; for (a = 0; 4 > a; a++)c = n[a], n[a] = (c << 8 | c >>> 24) & 16711935 | (c << 24 | c >>> 8) & 4278255360; return b |
||||
}, clone: function () { var b = v.clone.call(this); b._hash = this._hash.clone(); return b } |
||||
}); t.MD5 = v._createHelper(r); t.HmacMD5 = v._createHmacHelper(r) |
||||
})(Math); |
||||
(function () { |
||||
var u = CryptoJS, p = u.lib, d = p.Base, l = p.WordArray, p = u.algo, s = p.EvpKDF = d.extend({ cfg: d.extend({ keySize: 4, hasher: p.MD5, iterations: 1 }), init: function (d) { this.cfg = this.cfg.extend(d) }, compute: function (d, r) { for (var p = this.cfg, s = p.hasher.create(), b = l.create(), u = b.words, q = p.keySize, p = p.iterations; u.length < q;) { n && s.update(n); var n = s.update(d).finalize(r); s.reset(); for (var a = 1; a < p; a++)n = s.finalize(n), s.reset(); b.concat(n) } b.sigBytes = 4 * q; return b } }); u.EvpKDF = function (d, l, p) { |
||||
return s.create(p).compute(d, |
||||
l) |
||||
} |
||||
})(); |
||||
CryptoJS.lib.Cipher || function (u) { |
||||
var p = CryptoJS, d = p.lib, l = d.Base, s = d.WordArray, t = d.BufferedBlockAlgorithm, r = p.enc.Base64, w = p.algo.EvpKDF, v = d.Cipher = t.extend({ |
||||
cfg: l.extend(), createEncryptor: function (e, a) { return this.create(this._ENC_XFORM_MODE, e, a) }, createDecryptor: function (e, a) { return this.create(this._DEC_XFORM_MODE, e, a) }, init: function (e, a, b) { this.cfg = this.cfg.extend(b); this._xformMode = e; this._key = a; this.reset() }, reset: function () { t.reset.call(this); this._doReset() }, process: function (e) { this._append(e); return this._process() }, |
||||
finalize: function (e) { e && this._append(e); return this._doFinalize() }, keySize: 4, ivSize: 4, _ENC_XFORM_MODE: 1, _DEC_XFORM_MODE: 2, _createHelper: function (e) { return { encrypt: function (b, k, d) { return ("string" == typeof k ? c : a).encrypt(e, b, k, d) }, decrypt: function (b, k, d) { return ("string" == typeof k ? c : a).decrypt(e, b, k, d) } } } |
||||
}); d.StreamCipher = v.extend({ _doFinalize: function () { return this._process(!0) }, blockSize: 1 }); var b = p.mode = {}, x = function (e, a, b) { |
||||
var c = this._iv; c ? this._iv = u : c = this._prevBlock; for (var d = 0; d < b; d++)e[a + d] ^= |
||||
c[d] |
||||
}, q = (d.BlockCipherMode = l.extend({ createEncryptor: function (e, a) { return this.Encryptor.create(e, a) }, createDecryptor: function (e, a) { return this.Decryptor.create(e, a) }, init: function (e, a) { this._cipher = e; this._iv = a } })).extend(); q.Encryptor = q.extend({ processBlock: function (e, a) { var b = this._cipher, c = b.blockSize; x.call(this, e, a, c); b.encryptBlock(e, a); this._prevBlock = e.slice(a, a + c) } }); q.Decryptor = q.extend({ |
||||
processBlock: function (e, a) { |
||||
var b = this._cipher, c = b.blockSize, d = e.slice(a, a + c); b.decryptBlock(e, a); x.call(this, |
||||
e, a, c); this._prevBlock = d |
||||
} |
||||
}); b = b.CBC = q; q = (p.pad = {}).Pkcs7 = { pad: function (a, b) { for (var c = 4 * b, c = c - a.sigBytes % c, d = c << 24 | c << 16 | c << 8 | c, l = [], n = 0; n < c; n += 4)l.push(d); c = s.create(l, c); a.concat(c) }, unpad: function (a) { a.sigBytes -= a.words[a.sigBytes - 1 >>> 2] & 255 } }; d.BlockCipher = v.extend({ |
||||
cfg: v.cfg.extend({ mode: b, padding: q }), reset: function () { |
||||
v.reset.call(this); var a = this.cfg, b = a.iv, a = a.mode; if (this._xformMode == this._ENC_XFORM_MODE) var c = a.createEncryptor; else c = a.createDecryptor, this._minBufferSize = 1; this._mode = c.call(a, |
||||
this, b && b.words) |
||||
}, _doProcessBlock: function (a, b) { this._mode.processBlock(a, b) }, _doFinalize: function () { var a = this.cfg.padding; if (this._xformMode == this._ENC_XFORM_MODE) { a.pad(this._data, this.blockSize); var b = this._process(!0) } else b = this._process(!0), a.unpad(b); return b }, blockSize: 4 |
||||
}); var n = d.CipherParams = l.extend({ init: function (a) { this.mixIn(a) }, toString: function (a) { return (a || this.formatter).stringify(this) } }), b = (p.format = {}).OpenSSL = { |
||||
stringify: function (a) { |
||||
var b = a.ciphertext; a = a.salt; return (a ? s.create([1398893684, |
||||
1701076831]).concat(a).concat(b) : b).toString(r) |
||||
}, parse: function (a) { a = r.parse(a); var b = a.words; if (1398893684 == b[0] && 1701076831 == b[1]) { var c = s.create(b.slice(2, 4)); b.splice(0, 4); a.sigBytes -= 16 } return n.create({ ciphertext: a, salt: c }) } |
||||
}, a = d.SerializableCipher = l.extend({ |
||||
cfg: l.extend({ format: b }), encrypt: function (a, b, c, d) { d = this.cfg.extend(d); var l = a.createEncryptor(c, d); b = l.finalize(b); l = l.cfg; return n.create({ ciphertext: b, key: c, iv: l.iv, algorithm: a, mode: l.mode, padding: l.padding, blockSize: a.blockSize, formatter: d.format }) }, |
||||
decrypt: function (a, b, c, d) { d = this.cfg.extend(d); b = this._parse(b, d.format); return a.createDecryptor(c, d).finalize(b.ciphertext) }, _parse: function (a, b) { return "string" == typeof a ? b.parse(a, this) : a } |
||||
}), p = (p.kdf = {}).OpenSSL = { execute: function (a, b, c, d) { d || (d = s.random(8)); a = w.create({ keySize: b + c }).compute(a, d); c = s.create(a.words.slice(b), 4 * c); a.sigBytes = 4 * b; return n.create({ key: a, iv: c, salt: d }) } }, c = d.PasswordBasedCipher = a.extend({ |
||||
cfg: a.cfg.extend({ kdf: p }), encrypt: function (b, c, d, l) { |
||||
l = this.cfg.extend(l); d = l.kdf.execute(d, |
||||
b.keySize, b.ivSize); l.iv = d.iv; b = a.encrypt.call(this, b, c, d.key, l); b.mixIn(d); return b |
||||
}, decrypt: function (b, c, d, l) { l = this.cfg.extend(l); c = this._parse(c, l.format); d = l.kdf.execute(d, b.keySize, b.ivSize, c.salt); l.iv = d.iv; return a.decrypt.call(this, b, c, d.key, l) } |
||||
}) |
||||
}(); |
||||
(function () { |
||||
for (var u = CryptoJS, p = u.lib.BlockCipher, d = u.algo, l = [], s = [], t = [], r = [], w = [], v = [], b = [], x = [], q = [], n = [], a = [], c = 0; 256 > c; c++)a[c] = 128 > c ? c << 1 : c << 1 ^ 283; for (var e = 0, j = 0, c = 0; 256 > c; c++) { var k = j ^ j << 1 ^ j << 2 ^ j << 3 ^ j << 4, k = k >>> 8 ^ k & 255 ^ 99; l[e] = k; s[k] = e; var z = a[e], F = a[z], G = a[F], y = 257 * a[k] ^ 16843008 * k; t[e] = y << 24 | y >>> 8; r[e] = y << 16 | y >>> 16; w[e] = y << 8 | y >>> 24; v[e] = y; y = 16843009 * G ^ 65537 * F ^ 257 * z ^ 16843008 * e; b[k] = y << 24 | y >>> 8; x[k] = y << 16 | y >>> 16; q[k] = y << 8 | y >>> 24; n[k] = y; e ? (e = z ^ a[a[a[G ^ z]]], j ^= a[a[j]]) : e = j = 1 } var H = [0, 1, 2, 4, 8, |
||||
16, 32, 64, 128, 27, 54], d = d.AES = p.extend({ |
||||
_doReset: function () { |
||||
for (var a = this._key, c = a.words, d = a.sigBytes / 4, a = 4 * ((this._nRounds = d + 6) + 1), e = this._keySchedule = [], j = 0; j < a; j++)if (j < d) e[j] = c[j]; else { var k = e[j - 1]; j % d ? 6 < d && 4 == j % d && (k = l[k >>> 24] << 24 | l[k >>> 16 & 255] << 16 | l[k >>> 8 & 255] << 8 | l[k & 255]) : (k = k << 8 | k >>> 24, k = l[k >>> 24] << 24 | l[k >>> 16 & 255] << 16 | l[k >>> 8 & 255] << 8 | l[k & 255], k ^= H[j / d | 0] << 24); e[j] = e[j - d] ^ k } c = this._invKeySchedule = []; for (d = 0; d < a; d++)j = a - d, k = d % 4 ? e[j] : e[j - 4], c[d] = 4 > d || 4 >= j ? k : b[l[k >>> 24]] ^ x[l[k >>> 16 & 255]] ^ q[l[k >>> |
||||
8 & 255]] ^ n[l[k & 255]] |
||||
}, encryptBlock: function (a, b) { this._doCryptBlock(a, b, this._keySchedule, t, r, w, v, l) }, decryptBlock: function (a, c) { var d = a[c + 1]; a[c + 1] = a[c + 3]; a[c + 3] = d; this._doCryptBlock(a, c, this._invKeySchedule, b, x, q, n, s); d = a[c + 1]; a[c + 1] = a[c + 3]; a[c + 3] = d }, _doCryptBlock: function (a, b, c, d, e, j, l, f) { |
||||
for (var m = this._nRounds, g = a[b] ^ c[0], h = a[b + 1] ^ c[1], k = a[b + 2] ^ c[2], n = a[b + 3] ^ c[3], p = 4, r = 1; r < m; r++)var q = d[g >>> 24] ^ e[h >>> 16 & 255] ^ j[k >>> 8 & 255] ^ l[n & 255] ^ c[p++], s = d[h >>> 24] ^ e[k >>> 16 & 255] ^ j[n >>> 8 & 255] ^ l[g & 255] ^ c[p++], t = |
||||
d[k >>> 24] ^ e[n >>> 16 & 255] ^ j[g >>> 8 & 255] ^ l[h & 255] ^ c[p++], n = d[n >>> 24] ^ e[g >>> 16 & 255] ^ j[h >>> 8 & 255] ^ l[k & 255] ^ c[p++], g = q, h = s, k = t; q = (f[g >>> 24] << 24 | f[h >>> 16 & 255] << 16 | f[k >>> 8 & 255] << 8 | f[n & 255]) ^ c[p++]; s = (f[h >>> 24] << 24 | f[k >>> 16 & 255] << 16 | f[n >>> 8 & 255] << 8 | f[g & 255]) ^ c[p++]; t = (f[k >>> 24] << 24 | f[n >>> 16 & 255] << 16 | f[g >>> 8 & 255] << 8 | f[h & 255]) ^ c[p++]; n = (f[n >>> 24] << 24 | f[g >>> 16 & 255] << 16 | f[h >>> 8 & 255] << 8 | f[k & 255]) ^ c[p++]; a[b] = q; a[b + 1] = s; a[b + 2] = t; a[b + 3] = n |
||||
}, keySize: 8 |
||||
}); u.AES = p._createHelper(d) |
||||
})(); |
||||
|
||||
module.exports = CryptoJS; |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "214e0b18-e43e-4819-a5a7-0fc7be635dfe", |
||||
"importer": "javascript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,13 @@ |
||||
{ |
||||
"ver": "1.1.3", |
||||
"uuid": "d5bebb79-55ee-4533-86bd-3f9a719131b2", |
||||
"importer": "folder", |
||||
"isBundle": false, |
||||
"bundleName": "", |
||||
"priority": 1, |
||||
"compressionType": {}, |
||||
"optimizeHotUpdate": {}, |
||||
"inlineSpriteFrames": {}, |
||||
"isRemoteBundle": {}, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,143 @@ |
||||
import RYSDK from "./RYSDK"; |
||||
|
||||
|
||||
export default class RYAD { |
||||
|
||||
|
||||
//protected _cached_custom = {};
|
||||
public getAD_custom(id: string, complete: Function, useLocalRandom?: boolean) { |
||||
useLocalRandom = null == useLocalRandom ? true : useLocalRandom; |
||||
let self = this; |
||||
let para = |
||||
{ |
||||
adv_key: id, |
||||
success: (data) => { |
||||
console.log("获取到广告数据 RYAD:", data); |
||||
if (200 == data.code) { |
||||
let datas = data.result.list; |
||||
if (datas == null) { |
||||
console.error("获取到广告数据 为NULL") |
||||
} |
||||
if (true == useLocalRandom) { |
||||
RYAD.sortDatas_custom(datas); |
||||
} |
||||
complete(datas) |
||||
} |
||||
else { |
||||
console.error("获取到广告数据 为NULL") |
||||
complete(null) |
||||
} |
||||
}, |
||||
fail: (data) => { |
||||
complete(null) |
||||
}, |
||||
complete: (data) => { |
||||
//complete()
|
||||
}, |
||||
}; |
||||
if (null != RYSDK.Instance_custom.rysdk_custom) { |
||||
RYSDK.Instance_custom.rysdk_custom.ry_GetAdv(para); |
||||
} |
||||
else { |
||||
complete(null); |
||||
} |
||||
} |
||||
|
||||
|
||||
|
||||
public static sortDatas_custom(datas: any): any { |
||||
if (null == datas || 0 == datas.length) |
||||
return []; |
||||
let dataDic: { [appid: string]: any[] } = {}; |
||||
let keys = new Array<string>(); |
||||
for (let i = 0; i < datas.length; ++i) { |
||||
let data = datas[i]; |
||||
if (dataDic[data.appid] == null) { |
||||
dataDic[data.appid] = new Array(); |
||||
dataDic[data.appid].push(data); |
||||
keys.push(data.appid); |
||||
} else { |
||||
dataDic[data.appid].push(data); |
||||
} |
||||
} |
||||
for (let i = 0; i < keys.length; ++i) { |
||||
let key = keys[i]; |
||||
let randomIndex = Math.floor(Math.random() * keys.length); |
||||
let temp = keys[randomIndex]; |
||||
keys[randomIndex] = key; |
||||
keys[i] = temp; |
||||
} |
||||
for (let i = 0; i < keys.length; ++i) { |
||||
let key = keys[i]; |
||||
let dataArray = dataDic[key]; |
||||
for (let j = 0; j < dataArray.length; ++j) { |
||||
let data = dataArray[j]; |
||||
let randomIndex = Math.floor(Math.random() * dataArray.length); |
||||
let temp = dataArray[randomIndex]; |
||||
dataArray[randomIndex] = data; |
||||
dataArray[j] = temp; |
||||
} |
||||
} |
||||
let res = new Array<any>(); |
||||
while (keys.length > 0) { |
||||
if (keys.length == 1) { |
||||
let key = keys[0]; |
||||
let isOk = false; |
||||
let dataArray = dataDic[key]; |
||||
for (let i = 0; i < res.length; ++i) { |
||||
let curData = res[i]; |
||||
let nextData = res[i + 1]; |
||||
if (null != nextData) { |
||||
if (curData.appid != key && nextData.appid != key) { |
||||
let data = dataArray.shift(); |
||||
if (null != data) { |
||||
let f = res.slice(0, i + 1); |
||||
let b = res.slice(i + 1, res.length); |
||||
res = f; |
||||
res.push(data); |
||||
for (let k = 0; k < b.length; ++k) { |
||||
res.push(b[k]); |
||||
} |
||||
} |
||||
isOk = true; |
||||
break; |
||||
} |
||||
} |
||||
else { |
||||
if (curData.appid != key) { |
||||
let data = dataArray.shift(); |
||||
if (null != data) { |
||||
let f = res.slice(0, i + 1); |
||||
let b = res.slice(i + 1, res.length); |
||||
res = f; |
||||
res.push(data); |
||||
for (let k = 0; k < b.length; ++k) { |
||||
res.push(b[k]); |
||||
} |
||||
} |
||||
isOk = true; |
||||
break; |
||||
} |
||||
} |
||||
} |
||||
if (!isOk || dataArray.length <= 0) { |
||||
keys.splice(0, 1); |
||||
} |
||||
} |
||||
else { |
||||
for (let i = 0; i < keys.length; ++i) { |
||||
let key = keys[i]; |
||||
let dataArray = dataDic[key]; |
||||
let data = dataArray.shift(); |
||||
res.push(data); |
||||
if (dataArray.length <= 0) { |
||||
keys.splice(i, 1); |
||||
--i; |
||||
} |
||||
} |
||||
} |
||||
} |
||||
return res; |
||||
} |
||||
} |
||||
|
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "03b2675e-df2f-42c0-a064-62d2f10f8ace", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,54 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
import RYAD from "./RYAD"; |
||||
import RYSTAT from "./RYSTAT"; |
||||
|
||||
export default class RYSDK { |
||||
public static get Instance_custom() { |
||||
if (null == RYSDK._instance_custom) { |
||||
console.error("请先调用 RYSDK.init() 对RYSDK进行初始化!!!!!!"); |
||||
} |
||||
return RYSDK._instance_custom; |
||||
} |
||||
protected static _instance_custom: RYSDK = null; |
||||
|
||||
public static init_custom(code: string) { |
||||
if (null != RYSDK._instance_custom) { |
||||
console.error("请不要重复初始化 RYSDK !!!!!!"); |
||||
return; |
||||
} |
||||
console.log("初始化 RYSDK !!!!!!") |
||||
let ins = new RYSDK(); |
||||
ins._ad_custom = new RYAD(); |
||||
ins._stat_custom = new RYSTAT(); |
||||
RYSDK._instance_custom = ins; |
||||
if (null != window["rysdk"]) { |
||||
window["rysdk"].ry_init(); |
||||
RYSDK._instance_custom._rysdk_custom = window["rysdk"]; |
||||
RYSDK.Instance_custom.STAT_custom.reportInit_custom(); |
||||
RYSDK.Instance_custom.STAT_custom.reportLogin_custom(); |
||||
} |
||||
} |
||||
|
||||
private constructor() { |
||||
|
||||
} |
||||
|
||||
public get AD_custom() { |
||||
return this._ad_custom; |
||||
} |
||||
private _ad_custom: RYAD = null; |
||||
public get STAT_custom() { |
||||
return this._stat_custom; |
||||
} |
||||
private _stat_custom: RYSTAT = null; |
||||
|
||||
public get rysdk_custom() { |
||||
return this._rysdk_custom |
||||
} |
||||
protected _rysdk_custom: any = null; |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "96027819-f7ed-422c-847a-8b98e07a5ac1", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
@ -0,0 +1,82 @@ |
||||
/* |
||||
* @Descripttion:
|
||||
* @version: 1.0.0 |
||||
* @Author: YeeChan |
||||
* @Date: 2020-07-23 16:59:58 |
||||
*/ |
||||
import RYSDK from "./RYSDK"; |
||||
import { TimerUtils } from "../Mgr/TimerUtils"; |
||||
|
||||
export enum RYSTAT_Event { |
||||
RYSTAT_E_INIT_custom = "init", |
||||
RYSTAT_E_LOGIN_custom = "login", |
||||
RYSTAT_E_ENTRY_SOURCE_custom = "entrysource", |
||||
RYSTAT_E_CLICK_AD_custom = "clickad", |
||||
RYSTAT_E_CLICK_ALLOW_custom = "clickad", |
||||
} |
||||
|
||||
export default class RYSTAT { |
||||
public static readonly domain_custom |
||||
|
||||
public SendEvent_custom(event: string, data?: object | string, s?: Function, f?: Function) { |
||||
if (null != RYSDK.Instance_custom.rysdk_custom && null != RYSDK.Instance_custom.rysdk_custom.ry_SendEvent) { |
||||
RYSDK.Instance_custom.rysdk_custom.ry_SendEvent(event, data, null, s, f); |
||||
} |
||||
} |
||||
|
||||
protected reportInitFail_custom() { |
||||
if (null != RYSDK.Instance_custom.rysdk_custom && null != RYSDK.Instance_custom.rysdk_custom.ry_ReportFail) { |
||||
RYSDK.Instance_custom.rysdk_custom.ry_ReportFail(); |
||||
} |
||||
} |
||||
|
||||
public reportInit_custom() { |
||||
let tryCounter = 0; |
||||
let s = () => { console.log("init 上报成功!!"); } |
||||
let f = () => { |
||||
console.log("init 上报失败!!"); |
||||
if (tryCounter >= 10) { |
||||
console.log("init 上报重试次数超过 10次,放弃上报"); |
||||
this.reportInitFail_custom(); |
||||
} |
||||
else { |
||||
++tryCounter; |
||||
TimerUtils.once_custom(() => { |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_INIT_custom, null, s, f); |
||||
console.log("init 第 " + tryCounter + " 次重新上报"); |
||||
}, 5) |
||||
// Laya.timer.once(5000, this, () => {
|
||||
// this.SendEvent(RYSTAT_Event.RYSTAT_E_INIT,null,s,f);
|
||||
// console.log("init 第 " + tryCounter +" 次重新上报");
|
||||
// })
|
||||
} |
||||
} |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_INIT_custom, null, s, f); |
||||
} |
||||
|
||||
public reportLogin_custom() { |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_LOGIN_custom); |
||||
} |
||||
|
||||
public reportEntrySource_custom() { |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_ENTRY_SOURCE_custom); |
||||
} |
||||
|
||||
public reportClickAd_custom(adv_id: string) { |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_CLICK_AD_custom, |
||||
{ |
||||
adv_id: adv_id, |
||||
timelog: Date.now(), |
||||
type: 0 |
||||
}); |
||||
} |
||||
|
||||
public reportClickAdAllow_custom(adv_id: string) { |
||||
this.SendEvent_custom(RYSTAT_Event.RYSTAT_E_CLICK_ALLOW_custom, |
||||
{ |
||||
adv_id: adv_id, |
||||
timelog: Date.now(), |
||||
type: 1 |
||||
}); |
||||
} |
||||
} |
@ -0,0 +1,10 @@ |
||||
{ |
||||
"ver": "1.1.0", |
||||
"uuid": "236c658c-1572-4b9d-9643-5b2706c2cde4", |
||||
"importer": "typescript", |
||||
"isPlugin": false, |
||||
"loadPluginInWeb": true, |
||||
"loadPluginInNative": true, |
||||
"loadPluginInEditor": false, |
||||
"subMetas": {} |
||||
} |
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue