更新注册事件
This commit is contained in:
parent
a05cd8dc91
commit
94b52d3151
|
|
@ -46,6 +46,7 @@ export default class GameManager extends cc.Component {
|
||||||
load4: boolean = false;
|
load4: boolean = false;
|
||||||
load5: boolean = false;
|
load5: boolean = false;
|
||||||
load6: boolean = false;
|
load6: boolean = false;
|
||||||
|
register_time: number = 0;
|
||||||
scheduleCallback: any;
|
scheduleCallback: any;
|
||||||
timeNumber: number;
|
timeNumber: number;
|
||||||
nowTime: number;
|
nowTime: number;
|
||||||
|
|
@ -56,6 +57,7 @@ export default class GameManager extends cc.Component {
|
||||||
onLoad() {
|
onLoad() {
|
||||||
|
|
||||||
window.initMgr();
|
window.initMgr();
|
||||||
|
this.register_time = 0;
|
||||||
this.timeNumber = 2;
|
this.timeNumber = 2;
|
||||||
// cc.director.preloadScene("HomeScene", (err, asset) => {
|
// cc.director.preloadScene("HomeScene", (err, asset) => {
|
||||||
// });
|
// });
|
||||||
|
|
@ -269,21 +271,14 @@ export default class GameManager extends cc.Component {
|
||||||
cc.fx.GameConfig.GM_INFO.useravaterkuang = data.data.useravatarIcon;
|
cc.fx.GameConfig.GM_INFO.useravaterkuang = data.data.useravatarIcon;
|
||||||
cc.fx.GameConfig.GM_INFO.useravaterkuang = "kuang_" + (parseInt(cc.fx.GameConfig.GM_INFO.useravaterkuang) + 1);
|
cc.fx.GameConfig.GM_INFO.useravaterkuang = "kuang_" + (parseInt(cc.fx.GameConfig.GM_INFO.useravaterkuang) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.data.register_time) {
|
if (data.data.register_time) {
|
||||||
const timestamp2 = Date.now();
|
this.register_time = data.data.register_time;
|
||||||
|
console.log("注册时间:", data.data.register_time);
|
||||||
cc.fx.GameConfig.GM_INFO.firstTime = data.data.register_time;
|
cc.fx.GameConfig.GM_INFO.firstTime = data.data.register_time;
|
||||||
console.log("注册时间:", cc.fx.GameConfig.GM_INFO.firstTime);
|
|
||||||
if (data.register_time) {
|
} else {
|
||||||
console.log("是否是服务器中的新用户", data.isFirst, "发送setOnce");
|
let time = Date.now();
|
||||||
let time = data.register_time;
|
this.register_time = time;
|
||||||
if (time == undefined || time == null) {
|
|
||||||
time = timestamp2;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
MiniGameSdk.API.shushu_userSet(time);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.data.task) {
|
if (data.data.task) {
|
||||||
|
|
@ -504,6 +499,7 @@ export default class GameManager extends cc.Component {
|
||||||
this.setFirstInfo();
|
this.setFirstInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//无论是不是新用户,以防新用户第一次退出了 没有isFirst但是没发送setonce注册,统一走一遍
|
//无论是不是新用户,以防新用户第一次退出了 没有isFirst但是没发送setonce注册,统一走一遍
|
||||||
|
|
||||||
this.load3 = true;
|
this.load3 = true;
|
||||||
|
|
@ -671,14 +667,15 @@ export default class GameManager extends cc.Component {
|
||||||
|
|
||||||
//第一次进游戏用户处理信息
|
//第一次进游戏用户处理信息
|
||||||
setFirstInfo() {
|
setFirstInfo() {
|
||||||
// console.log("————————发送注册事件");
|
|
||||||
const time = cc.fx.GameTool.formatDate(new Date());
|
const time = cc.fx.GameTool.formatDate(new Date());
|
||||||
let data = {
|
let data = {
|
||||||
register_time: time, // 注册时间
|
register_time: time, // 注册时间
|
||||||
}
|
}
|
||||||
// console.log("注册时间:", time);
|
|
||||||
cc.fx.GameTool.shushu_Track("register", data);
|
cc.fx.GameTool.shushu_Track("register", data);
|
||||||
MiniGameSdk.API.shushu_SetSuperProperties(time, false);
|
MiniGameSdk.API.shushu_SetSuperProperties(time, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
/** 主循环,判断是否各项加载完成进入游戏 */
|
/** 主循环,判断是否各项加载完成进入游戏 */
|
||||||
update(dt) {
|
update(dt) {
|
||||||
|
|
@ -687,6 +684,7 @@ export default class GameManager extends cc.Component {
|
||||||
MiniGameSdk.API.shushu_Login();
|
MiniGameSdk.API.shushu_Login();
|
||||||
MiniGameSdk.API.yinli_Init();
|
MiniGameSdk.API.yinli_Init();
|
||||||
MiniGameSdk.API.yinli_Login();
|
MiniGameSdk.API.yinli_Login();
|
||||||
|
if (this.register_time != 0) MiniGameSdk.API.shushu_userSet(this.register_time);
|
||||||
this.startGame();
|
this.startGame();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -821,7 +821,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.addMoveFloor();
|
this.addMoveFloor();
|
||||||
}, delayTime);
|
}, delayTime);
|
||||||
}
|
}
|
||||||
console.log("创建完成", this.change_Block);
|
// console.log("创建完成", this.change_Block);
|
||||||
if (this.change_Block == true) {
|
if (this.change_Block == true) {
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
this.addChangeBlock();
|
this.addChangeBlock();
|
||||||
|
|
@ -2255,6 +2255,14 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
changeColorWall() {
|
||||||
|
for (let i = 0; i < this.wallArray.length; i++) {
|
||||||
|
if (this.wallArray[i].getComponent("Wall").colorArray.length > 0) {
|
||||||
|
this.wallArray[i].getComponent("Wall").changeColorWall();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//检测方块和门中间有没有夹杂其他块
|
//检测方块和门中间有没有夹杂其他块
|
||||||
detectingBlock(direction, posX, posY, blocks) {
|
detectingBlock(direction, posX, posY, blocks) {
|
||||||
let jg = true;
|
let jg = true;
|
||||||
|
|
@ -3004,29 +3012,29 @@ export default class MapConroler extends cc.Component {
|
||||||
if (blockInfo.floorMove != undefined) {
|
if (blockInfo.floorMove != undefined) {
|
||||||
if (blockInfo.floorMove == true) {
|
if (blockInfo.floorMove == true) {
|
||||||
if (this.teamBlocks.length == 0) {
|
if (this.teamBlocks.length == 0) {
|
||||||
console.log("放入一个移动地板块1");
|
|
||||||
this.teamBlocks.push(this.blocks2[i]);
|
this.teamBlocks.push(this.blocks2[i]);
|
||||||
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束1");
|
// console.log("结束1");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (blockInfo.floor == this.teamBlocks[0].getComponent("Block").block_Info.floor) {
|
if (blockInfo.floor == this.teamBlocks[0].getComponent("Block").block_Info.floor) {
|
||||||
this.teamBlocks.push(this.blocks2[i]);
|
this.teamBlocks.push(this.blocks2[i]);
|
||||||
console.log("放入一个移动地板块2");
|
// console.log("放入一个移动地板块2");
|
||||||
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束2");
|
// console.log("结束2");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("结束3")
|
// console.log("结束3")
|
||||||
this.removeFloor(false);
|
this.removeFloor(false);
|
||||||
this.teamBlocks.push(this.blocks2[i]);
|
this.teamBlocks.push(this.blocks2[i]);
|
||||||
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
this.blocks2[i].getComponent("Block").setTeamBlocks(this.teamBlocks);
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束4");
|
// console.log("结束4");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3034,21 +3042,21 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束5");
|
// console.log("结束5");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束6");
|
// console.log("结束6");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (i == (this.blocks2.length - 1)) {
|
if (i == (this.blocks2.length - 1)) {
|
||||||
console.log("结束7");
|
// console.log("结束7");
|
||||||
this.removeFloor(true);
|
this.removeFloor(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -3057,7 +3065,7 @@ export default class MapConroler extends cc.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
removeFloor(type) {
|
removeFloor(type) {
|
||||||
console.log("结束__________");
|
// console.log("结束__________");
|
||||||
if (type == true) {
|
if (type == true) {
|
||||||
this.blocks2 = [];
|
this.blocks2 = [];
|
||||||
}
|
}
|
||||||
|
|
@ -3269,6 +3277,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.changeLongAndShortWall();//改变长短门以及长短变色门
|
this.changeLongAndShortWall();//改变长短门以及长短变色门
|
||||||
this.changeBlockLock(); //改变开关方块
|
this.changeBlockLock(); //改变开关方块
|
||||||
this.changeBlockColor(null);//改变变色块
|
this.changeBlockColor(null);//改变变色块
|
||||||
|
this.changeColorWall();
|
||||||
}
|
}
|
||||||
else if (data.type == "revolving") {
|
else if (data.type == "revolving") {
|
||||||
this.changeLockWall();
|
this.changeLockWall();
|
||||||
|
|
@ -3277,6 +3286,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.changeLongAndShortWall();
|
this.changeLongAndShortWall();
|
||||||
this.changeBlockLock();
|
this.changeBlockLock();
|
||||||
this.changeBlockColor(null);//改变变色块
|
this.changeBlockColor(null);//改变变色块
|
||||||
|
this.changeColorWall();
|
||||||
}
|
}
|
||||||
else if (data.type == "longAndShort") {
|
else if (data.type == "longAndShort") {
|
||||||
this.changeLockWall();
|
this.changeLockWall();
|
||||||
|
|
@ -3285,6 +3295,7 @@ export default class MapConroler extends cc.Component {
|
||||||
this.changeLongAndShortWall();
|
this.changeLongAndShortWall();
|
||||||
this.changeBlockLock();
|
this.changeBlockLock();
|
||||||
this.changeBlockColor(null);//改变变色块
|
this.changeBlockColor(null);//改变变色块
|
||||||
|
this.changeColorWall();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1590,7 +1590,7 @@ export namespace MiniGameSdk {
|
||||||
static shushu_userSet(time) {
|
static shushu_userSet(time) {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||||
// console.log("设置用户注册属性");
|
console.log("_______________设置用户注册属性", time);
|
||||||
API._ta.userSet({ register_time: time });
|
API._ta.userSet({ register_time: time });
|
||||||
API._ta.userSetOnce({ uid: cc.fx.GameConfig.GM_INFO.userId.toString() });
|
API._ta.userSetOnce({ uid: cc.fx.GameConfig.GM_INFO.userId.toString() });
|
||||||
}
|
}
|
||||||
|
|
@ -1600,7 +1600,7 @@ export namespace MiniGameSdk {
|
||||||
//@ts-ignore
|
//@ts-ignore
|
||||||
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
if ((typeof wx !== 'undefined' && wx !== null) || (typeof tt !== 'undefined' && tt !== null)) {
|
||||||
// console.log("上传金币和关卡信息给数数")
|
// console.log("上传金币和关卡信息给数数")
|
||||||
API._ta.userSet({ current_level: (cc.fx.GameConfig.GM_INFO.level + 1) });
|
API._ta.userSet({ current_level: (cc.fx.GameConfig.GM_INFO.level) });
|
||||||
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
|
API._ta.userSet({ current_coin: cc.fx.GameConfig.GM_INFO.coin });
|
||||||
API._ta.userSet({ uid: cc.fx.GameConfig.GM_INFO.userId });
|
API._ta.userSet({ uid: cc.fx.GameConfig.GM_INFO.userId });
|
||||||
}
|
}
|
||||||
|
|
@ -1638,6 +1638,7 @@ export namespace MiniGameSdk {
|
||||||
user_id: cc.fx.GameConfig.GM_INFO.userId, //用户id
|
user_id: cc.fx.GameConfig.GM_INFO.userId, //用户id
|
||||||
pay_user: pay_user
|
pay_user: pay_user
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
if (pay_user != null && pay_user != false) {
|
if (pay_user != null && pay_user != false) {
|
||||||
// console.log("设置用户公共属性支付:————————————", pay_user);
|
// console.log("设置用户公共属性支付:————————————", pay_user);
|
||||||
|
|
|
||||||
|
|
@ -717,7 +717,6 @@ export default class Wall extends cc.Component {
|
||||||
if (this.colorArray.length <= 2) {
|
if (this.colorArray.length <= 2) {
|
||||||
for (let i = 0; i < this.colorStartArray.length; i++) {
|
for (let i = 0; i < this.colorStartArray.length; i++) {
|
||||||
this.colorArray.push(this.colorStartArray[i]);
|
this.colorArray.push(this.colorStartArray[i]);
|
||||||
console.log("将颜色放入数组:", this.colorStartArray[i])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -808,7 +807,6 @@ export default class Wall extends cc.Component {
|
||||||
if (this.colorArray.length <= 2) {
|
if (this.colorArray.length <= 2) {
|
||||||
for (let i = 0; i < this.colorStartArray.length; i++) {
|
for (let i = 0; i < this.colorStartArray.length; i++) {
|
||||||
this.colorArray.push(this.colorStartArray[i]);
|
this.colorArray.push(this.colorStartArray[i]);
|
||||||
// console.log("将颜色放入数组:", this.colorStartArray[i])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (type == true) this.updateColor();
|
if (type == true) this.updateColor();
|
||||||
|
|
|
||||||
|
|
@ -1247,6 +1247,18 @@ var GameTool = {
|
||||||
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}.${milliseconds}`;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
formatDate2(date: Date | number): string {
|
||||||
|
const d = typeof date === 'number' ? new Date(date) : date;
|
||||||
|
const year = d.getFullYear();
|
||||||
|
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||||||
|
const day = String(d.getDate()).padStart(2, '0');
|
||||||
|
const hours = String(d.getHours()).padStart(2, '0');
|
||||||
|
const minutes = String(d.getMinutes()).padStart(2, '0');
|
||||||
|
const seconds = String(d.getSeconds()).padStart(2, '0');
|
||||||
|
|
||||||
|
return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
|
||||||
|
},
|
||||||
|
|
||||||
//获取时间戳
|
//获取时间戳
|
||||||
getTime() {
|
getTime() {
|
||||||
const timestamp = (new Date().getTime())
|
const timestamp = (new Date().getTime())
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user