Commit 1910cf58 authored by wildfirecode's avatar wildfirecode

Merge branch 'feather-sign' into dev

parents 4bb5a534 831a6ee4
......@@ -478,6 +478,21 @@ export default class MainBase extends eui.UILayer {
})
}
getInviteInfo() {
return new Promise((r) => {
NetManager.ins.getInviteInfo(() => {
r();
})
});
}
getSignConfig() {
return new Promise((r) => {
NetManager.ins.getSignConfig(() => {
r();
})
});
}
getAd() {
return new Promise((r) => {
......@@ -510,6 +525,14 @@ export default class MainBase extends eui.UILayer {
});
}
hbRainBaseInfo() {
return new Promise((r) => {
NetManager.ins.hbRainBaseInfo(async () => {
r();
});
});
}
hcHome() {
return new Promise((r) => {
NetManager.ins.hc_home(() => {
......@@ -536,6 +559,9 @@ export default class MainBase extends eui.UILayer {
this.hc_userInfo(),
this.getBackReward(),
this.hcRedBoobBaseInfo(),
this.getSignConfig(),
this.getInviteInfo(),
this.hbRainBaseInfo(),
]);
//获取分享加体力的shareCode,不影响初始化场景,不进await
NetManager.ins.getUserShareCode(() => { })
......
......@@ -2210,6 +2210,21 @@ export class NetManager extends ABNetManager {
this.send(net);
}
public getSignConfig(callback: Function): void {
const net: INetData = {
name: 'getSignConfig',
uri: window['duiba'] + '/customActivity/happyclear/getSignConfig',
type: 'get',
dataType: 'json',
hideMsg: true,
param: {
activityId: DataManager.ins.customCfgData.actId
},
callback: callback
};
this.send(net);
}
/**
* 获取邀请码
* @param callback
......
......@@ -13,7 +13,7 @@
<e:Image id="steps" source="signicon5_png" x="104" y="57" visible="false"/>
<e:Image id="blood" x="98.04" y="60.35" source="signicon_blood_png" visible="false"/>
<e:Image id="random" x="98.73" y="50.4" source="signicon6_png" visible="false"/>
<e:Image id="quan15" x="95.42" y="56.76" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan15_png" visible="false"/>
<e:Image id="quan" x="95.42" y="53.76" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="" width="76"/>
<e:Image id="quan10" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan10_png" visible="false"/>
<e:Image id="quan23" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan23_png" visible="false"/>
<e:Image id="quan36" x="95" y="56" anchorOffsetX="0" anchorOffsetY="0" height="79.34" source="sign_quan36_png" visible="false"/>
......
......@@ -33,6 +33,10 @@ import TaskCenterIcon from "./icon/TaskCenterIcon";
import HbBombIcon from "./icon/HbBombIcon";
import { createEffect1MovieClip } from "../effect/createEffect1";
import { CodeChannels } from "../panels/ShareCodePanel";
import getIconGroup from "./getIconGroup";
import getSignBtn from "./getSignBtn";
import getAdBtn from "./getAdBtn";
import getInviteBtn from "./getInviteBtn";
let doHelpFlag = false;
// let doScratchHelpFlag = false;
......@@ -179,10 +183,12 @@ export default class MapScene extends Scene {
this.sendInvite();
this.hcRedBoobBaseInfo();
this.updateSignBtn();
this.updateMyInfo();
this.updateAdData();
GDispatcher.dispatchEvent("getInviteInfo"); // 查询邀请信息,控制邀请有礼角标
this.updateIconLayout();
this['avatar'].mask = this['avatarMask'];
if (getBgOn() && MapScene['firstPlayBgTag'] == true) {
......@@ -804,6 +810,7 @@ export default class MapScene extends Scene {
if (!success || !res.data) {
return;
}
const flag = res.data.completeFlag;
switch (true) {
case (flag == 0): // 未完成
......@@ -871,7 +878,19 @@ export default class MapScene extends Scene {
PanelCtrl.instance.show('invite', res.data);
})
}
//1234变化的情况
updateIconLayout() {
const btnList = [];
if (getSignBtn()) btnList.push('signGroup');
if (getInviteBtn()) btnList.push('inviteGroup');
if (getAdBtn()) btnList.push('adBtn');
if (getIconGroup()) btnList.push('activitys');//0不显示,否则显示
btnList.forEach((btnName, index) => {
const btn = this[btnName];
btn.y = 172.57 + index * 150;
});
this['guideInner'].y = this['activitys'].y - 273;
}
//////////////////////////////////////// 邀请有礼角标 //////////////////////////////////////////////
/**
* 查询邀请信息
......@@ -884,6 +903,7 @@ export default class MapScene extends Scene {
if (!success || !res.data) {
return;
}
this.updateIconLayout();
const flag = res.data.completeFlag;
if (this.inviteTimer) {
this.inviteTimer.stop();
......@@ -893,8 +913,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
// this['activitys'].y = 458;
// this['guideInner'].y = 185;
}
NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = true;
......@@ -910,8 +930,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
// this['activitys'].y = 458;
// this['guideInner'].y = 185;
}
this["inviteTipsBg"].visible = true;
this["inviteTips"].visible = true;
......@@ -922,8 +942,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
// this['activitys'].y = 458;
// this['guideInner'].y = 185;
}
NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = false;
......@@ -933,8 +953,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
// this['activitys'].y = 458;
// this['guideInner'].y = 185;
}
NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = true;
......@@ -945,8 +965,8 @@ export default class MapScene extends Scene {
this["inviteGroup"].visible = true;
this["inviteGroup"].touchEnabled = true;
if (!mapAdvert || mapAdvert.enable == false) {
this['activitys'].y = 458;
this['guideInner'].y = 185;
// this['activitys'].y = 458;
// this['guideInner'].y = 185;
}
NetManager.ins.showLog(getlogItem(33));
this["inviteTipsBg"].visible = false;
......@@ -955,13 +975,13 @@ export default class MapScene extends Scene {
case (flag == 6): // 无入口
this["inviteGroup"].visible = false;
this["inviteGroup"].touchEnabled = false;
this['adBtn'].y = 323.76;
// this['adBtn'].y = 323.76;
if (mapAdvert && mapAdvert.enable) {
this['guideInner'].y = 185;
this['activitys'].y = 458;
// this['guideInner'].y = 185;
// this['activitys'].y = 458;
} else {
this['guideInner'].y = 30;
this['activitys'].y = 303.76;
// this['guideInner'].y = 30;
// this['activitys'].y = 303.76;
}
break;
default:
......@@ -1237,6 +1257,15 @@ export default class MapScene extends Scene {
});
})
}
updateSignBtn() {
this['signGroup'].visible = false;
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data && getSignConfig.data.closeStatus) {
this['signGroup'].visible = true;
}
}
}
export const getNick = (nickname, max = 4) => {
if (!nickname) return nickname;
......
import { DataManager } from "../../libs/tw/manager/DataManager";
export default () => {
const hc_advert:any = DataManager.ins.getData('hc_advert').data || {};
let { mapAdvert } = hc_advert;
if (mapAdvert == null)
mapAdvert = { enable: false, advertList: [] }
return mapAdvert.enable;
}
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
export default () => {
let count = 0;
let hc_redBombBaseInfo = DataManager.ins.getData('hc_redBombBaseInfo');
if (hc_redBombBaseInfo.success && hc_redBombBaseInfo.data) {
count++;
}
let hbrain = DataManager.ins.getData(NetName.HBRAIN_BASEINFO);
if (hbrain.success && hbrain.data) {
const data = hbrain.data
if (data.currentSession) {
count++;
} else if (data.nextSession) {
count++;
}
}
return count;
}
\ No newline at end of file
import { NetName } from "../../libs/tw/enum/NetName";
import { DataManager } from "../../libs/tw/manager/DataManager";
export default () => {
const inviteInfo = DataManager.ins.getData(NetName.GET_INVATE_INFO);
if (inviteInfo && inviteInfo.success && inviteInfo.data) {
const flag = inviteInfo.data.completeFlag;
if (flag >= 0 && flag <= 5) return 1
if (flag == 6) return 0;
}
return 0;
}
import { DataManager } from "../../libs/tw/manager/DataManager";
import { NetName } from "../../libs/tw/enum/NetName";
export default () => {
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data)
return getSignConfig.data.closeStatus;
return false;
}
\ No newline at end of file
......@@ -9,51 +9,52 @@ export default class SignItem extends eui.ItemRenderer {
this.skinName = getSkinPath('SignItem');
}
dataChanged(){
this['object'].visible=false;
this['money'].visible=false;
this['hammer'].visible=false;
this['boom'].visible=false;
this['steps'].visible=false;
this['blood'].visible=false;
this['random'].visible=false;
this['quan15'].visible=false;
this['quan58'].visible=false;
this['quan38'].visible=false;
this['btn1'].visible=false;
this['btn2'].visible=false;
this['btn3'].visible=false;
this['btn4'].visible=false;
this['line1'].visible=this.data.index!=6;
this['line2'].visible=!this['line1'].visible;
this['light'].visible=this.data.signed;
this['title'].text = `连续签到${this.data.index+1}天`;
dataChanged() {
this['object'].visible = false;
this['money'].visible = false;
this['hammer'].visible = false;
this['boom'].visible = false;
this['steps'].visible = false;
this['blood'].visible = false;
this['random'].visible = false;
this['btn1'].visible = false;
this['btn2'].visible = false;
this['btn3'].visible = false;
this['btn4'].visible = false;
this['line1'].visible = this.data.index != 6;
this['line2'].visible = !this['line1'].visible;
this['light'].visible = this.data.signed;
this['title'].text = `连续签到${this.data.index + 1}天`;
this['amount'].text = this.data.config.nums;
if(this.data.config.nums<=0)
if (this.data.config.nums <= 0)
this['amount'].text = '';
this[this.data.config.type].visible=true;
this[this.data.config.type].visible = true;
this['btn'+this.data.btn].visible=true;
if(this.data.btn ==1) {
if (this.data.config.type == 'quan')
this['quan'].source = this.data.config.imgurl;
this['btn' + this.data.btn].visible = true;
if (this.data.btn == 1) {
NetManager.ins.showLog(getlogItem(22));
}
console.log(this.data);
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP,()=>{
this.data.func(this.data.index,this)
},this);
this['btn1'].addEventListener(egret.TouchEvent.TOUCH_TAP, () => {
this.data.func(this.data.index, this)
}, this);
}
setSinged(){
this['btn1'].visible=false;
this['btn2'].visible=false;
this['btn3'].visible=false;
this['btn4'].visible=false;
setSinged() {
this['btn1'].visible = false;
this['btn2'].visible = false;
this['btn3'].visible = false;
this['btn4'].visible = false;
this['light'].visible=true;
this['btn2'].visible=true;
this['light'].visible = true;
this['btn2'].visible = true;
}
}
\ No newline at end of file
......@@ -24,36 +24,36 @@ export default class SignPanel extends Panel {
}
this.scroll.viewport.scrollV = todayIndex * 162;
if(todayIndex >=4) {
if (todayIndex >= 4) {
this.scroll.viewport.scrollV = 4 * 162;
}
const tomorrowIndex = todayIndex + 1;
this.list.itemRenderer = SignItem;
const configs = window['signconfigs'];
const func = (data,item:SignItem) => {
const configs = this.getConfigs();
const func = (data, item: SignItem) => {
try {
if (window['getRST']) window['getRST']();
} catch (error) {
console.warn(error)
}
item['btn1'].enabled=false;
NetManager.ins.doSign((s)=>{
item['btn1'].enabled = false;
NetManager.ins.doSign((s) => {
NetManager.ins.clickLog(getlogItem(22));
item['btn1'].enabled=true;
wait(300).then(()=>{
item['btn1'].enabled = true;
wait(300).then(() => {
NetManager.ins.getSignInfo(() => {
SceneCtrl.instance.updateScene();
}, window['signActivityId']);
});
if(s) {
const {customInfo,success} =DataManager.ins.getData('dosign');
if(!success || !customInfo.success || customInfo.prizeType =='none') {
if(customInfo.code==100004) {
if (s) {
const { customInfo, success } = DataManager.ins.getData('dosign');
if (!success || !customInfo.success || customInfo.prizeType == 'none') {
if (customInfo.code == 100004) {
showToast('哎呀,奖励擦肩而过!明天再来试试吧!');
}else {
} else {
showToast('哎呀,奖励擦肩而过!');
}
return;
......@@ -63,14 +63,14 @@ export default class SignPanel extends Panel {
// showToast('签到成功!快去闯关吧~');
// PanelCtrl.instance.show('signPrize');
PanelCtrl.instance.addToShowPanels('signPrize');
wait(200).then(()=>{
wait(200).then(() => {
NetManager.ins.hc_home(() => {
updateMainTimer();
SceneCtrl.instance.updateScene();
}, window['collectRuleId']);
});
}else {
} else {
showToast('哎呀,奖励擦肩而过!');
}
......@@ -112,6 +112,89 @@ export default class SignPanel extends Panel {
// this.showlog();
// this.data.img = DataManager.ins.getData('getPlugOrderStatus').lottery.imgurl;
}
// { nums: '10元宝', type: 'money' },
// { nums: '*1', type: 'hammer' },
// { nums: '30元宝', type: 'money' },
// { nums: '*1', type: 'boom' },
// { nums: '50元宝', type: 'money' },
// { nums: '*1', type: 'steps' },
// { nums: '0.3元', type: 'quan30' }
private getConfigs() {
const getSignConfig = DataManager.ins.getData('getSignConfig');
if (getSignConfig && getSignConfig.data && getSignConfig.data.sixDaysBeforeOptions && getSignConfig.data.theSeventhDayOptions) {
const { sixDaysBeforeOptions, theSeventhDayOptions } = getSignConfig.data;
const result = [];
sixDaysBeforeOptions.forEach(option => { //todo假设按天数排序
//类型 2 次数,3 道具,4 元宝,5其他
const resultItem = this.getResultItem(option);
result.push(resultItem);
});
const notGiftResult = this.isNotGift(theSeventhDayOptions);
if (notGiftResult) {
result.push(this.getResultItem(notGiftResult));
} else {
result.push({ nums: '惊喜礼盒', type: 'object' });
}
return result;
}
console.warn('签到静态配置错误')
}
getResultItem(option) {
const resultItem: any = {};
if (option.categoryType == 2) {
resultItem.nums = `体力*${option.num}`
resultItem.type = 'blood';
}
else if (option.categoryType == 3) {
resultItem.nums = `*1`;
// resultItem.nums = `*${option.num}`;
resultItem.type = this.getPropType(option.propType);
}
else if (option.categoryType == 4) {
resultItem.type = 'money';
resultItem.nums = `${option.maxValue}元宝`;
if (option.maxValue != option.minValue) console.warn('元宝配置错误');
}
else if (option.categoryType >= 5) {
resultItem.nums = `*1`;
resultItem.type = 'quan';
resultItem.imgurl = option.smallImg;
}
return resultItem;
}
isNotGift(theSeventhDayOptions: any[]) {
const results = theSeventhDayOptions.filter(item => item.rate == 100);
let result;
if (results.length == 1) {
result = results[0];
return result;
}else {
console.warn('配置错误');
}
return null;
}
getPropType(type) {
const map = {
'1': 'hammer',
'2': 'steps',
'3': 'boom',
}
return map[type]
}
typeMap() {
return {
'2': 'blood',
// '3': (type2) => { return propsMap[type2] },
'4': 'money',
// '5':{}
}
}
// showlog() {
// NetManager.ins.showLog(getlogItem(17));
// }
......
......@@ -6,6 +6,9 @@ const config = {
'/crecord/getrecord': {
data: './happyclear/getrecord.json'
},
'/customActivity/happyclear/getSignConfig': {
data: './happyclear/getSignConfig.json'
},
'/customActivity/happyclear/hasBackReward': {
data: './happyclear/hasBackReward.json'
},
......
{
"success": true,
"code": "0000000000",
"desc": "OK",
"timestamp": 1583390774876,
"data": {
"closeStatus": true,
"sixDaysBeforeOptions": [
{
"id": null,
"day": 1,
"categoryType": 7,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": null,
"img": "//yun.dui88.com/images/202003/n3exi2tenh.png",
"smallImg": "//yun.dui88.com/images/202003/cfay38i1rl.jpg",
"appItemId": 10361,
"name": "111",
"value": "963"
},
{
"id": null,
"day": 2,
"categoryType": 2,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": 2,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 3,
"categoryType": 4,
"title": null,
"rate": null,
"minValue": 10,
"maxValue": 10,
"coinType": 1,
"realValue": null,
"propType": null,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 4,
"categoryType": 3,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": 2,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 5,
"categoryType": 4,
"title": null,
"rate": null,
"minValue": 10,
"maxValue": 20,
"coinType": 2,
"realValue": null,
"propType": null,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
},
{
"id": null,
"day": 6,
"categoryType": 3,
"title": null,
"rate": null,
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": 2,
"num": null,
"img": null,
"smallImg": null,
"appItemId": null,
"name": null,
"value": null
}
],
"theSeventhDayOptions": [
{
"id": "",
"day": null,
"categoryType": 2,
"title": "1",
"rate": "100",
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": 1,
"img": "",
"smallImg": null,
"appItemId": null,
"name": "",
"value": ""
},
{
"id": "",
"day": null,
"categoryType": 7,
"title": "1122",
"rate": "11",
"minValue": null,
"maxValue": null,
"coinType": null,
"realValue": null,
"propType": null,
"num": null,
"img": "//yun.dui88.com/images/202003/cjusviko1v.png",
"smallImg": "//yun.dui88.com/images/202003/1fcggjz048.jpg",
"appItemId": 10000,
"name": "虚拟",
"value": "fe"
}
]
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment