|
@@ -1,6 +1,6 @@
|
|
|
import { _decorator, Component, Label, Node, Sprite, Animation, SpriteFrame } from 'cc';
|
|
|
import { base_ui } from '../../fw/base_ui';
|
|
|
-import { sign_reward_data } from '../../data';
|
|
|
+import { sign_reward_data, sign_total_reward_data } from '../../data';
|
|
|
import { tools } from '../../tools';
|
|
|
import { http } from '../../http';
|
|
|
import { config } from '../../config';
|
|
@@ -21,7 +21,7 @@ export class sign_receive_reward extends base_ui {
|
|
|
|
|
|
@property(SpriteFrame) sf_dangrihuode = null
|
|
|
@property(SpriteFrame) sf_gongxihuode = null
|
|
|
- private m_data:sign_reward_data = null
|
|
|
+ private m_reward_data:sign_reward_data = null
|
|
|
private m_cb = null
|
|
|
start() {
|
|
|
this.onButtonListen(this.public_bg, ()=>{
|
|
@@ -39,7 +39,7 @@ export class sign_receive_reward extends base_ui {
|
|
|
}
|
|
|
|
|
|
initView(data:sign_reward_data, cb) {
|
|
|
- this.m_data = data
|
|
|
+ this.m_reward_data = data
|
|
|
this.m_cb = cb
|
|
|
this.img_title.getComponent(Sprite).spriteFrame = this.sf_dangrihuode
|
|
|
this.node_btn.active = true
|
|
@@ -47,12 +47,30 @@ export class sign_receive_reward extends base_ui {
|
|
|
this.img_icon.getComponent(Sprite).spriteFrame = d.sf
|
|
|
})
|
|
|
this.lab_name.getComponent(Label).string = data.name
|
|
|
- this.lab_count.getComponent(Label).string = `x${data.quantity}`
|
|
|
+ this.setLabCount(data.quantity)
|
|
|
}
|
|
|
|
|
|
- private showRewardDetails() {
|
|
|
+ initReceiveSuccess(data:sign_total_reward_data) {
|
|
|
this.img_title.getComponent(Sprite).spriteFrame = this.sf_gongxihuode
|
|
|
this.node_btn.active = false
|
|
|
+ tools.loadRemoteImg(data.icon, (d)=>{
|
|
|
+ this.img_icon.getComponent(Sprite).spriteFrame = d.sf
|
|
|
+ })
|
|
|
+ this.lab_name.getComponent(Label).string = data.name
|
|
|
+ this.setLabCount(data.quantity)
|
|
|
+ }
|
|
|
+
|
|
|
+ private setLabCount(count:number) {
|
|
|
+ this.lab_count.getComponent(Label).string = `x${count}`
|
|
|
+ }
|
|
|
+
|
|
|
+ private showRewardDetails(is_double:boolean) {
|
|
|
+ this.img_title.getComponent(Sprite).spriteFrame = this.sf_gongxihuode
|
|
|
+ this.node_btn.active = false
|
|
|
+ if(is_double) {
|
|
|
+ let count = this.m_reward_data.quantity * 2
|
|
|
+ this.setLabCount(count)
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
private closeSelf() {
|
|
@@ -66,14 +84,14 @@ export class sign_receive_reward extends base_ui {
|
|
|
stype = 2
|
|
|
}
|
|
|
uiManager.Instance().showLoading()
|
|
|
- let opt = {'index':this.m_data.index, 'stype': stype}
|
|
|
+ let opt = {'index':this.m_reward_data.index, 'stype': stype}
|
|
|
http.post(config.API.user_sign, opt, (err,d)=>{
|
|
|
uiManager.Instance().hideLoading()
|
|
|
if(!err){
|
|
|
let nd = JSON.parse(d)
|
|
|
if(nd.code === config.status.SUCCESS){
|
|
|
// console.log("user_sign", nd.content)
|
|
|
- this.showRewardDetails()
|
|
|
+ this.showRewardDetails(is_double)
|
|
|
this.m_cb && this.m_cb(this)
|
|
|
}
|
|
|
}
|