|
@@ -1,20 +1,26 @@
|
|
-import { _decorator, Component, Label, Node, Sprite, Animation } from 'cc';
|
|
|
|
|
|
+import { _decorator, Component, Label, Node, Sprite, Animation, SpriteFrame } from 'cc';
|
|
import { base_ui } from '../../fw/base_ui';
|
|
import { base_ui } from '../../fw/base_ui';
|
|
import { sign_reward_data } from '../../data';
|
|
import { sign_reward_data } from '../../data';
|
|
import { tools } from '../../tools';
|
|
import { tools } from '../../tools';
|
|
import { http } from '../../http';
|
|
import { http } from '../../http';
|
|
import { config } from '../../config';
|
|
import { config } from '../../config';
|
|
import { GameManager } from '../../GameManager';
|
|
import { GameManager } from '../../GameManager';
|
|
|
|
+import { uiManager } from '../../manager/uiManager';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('sign_receive_reward')
|
|
@ccclass('sign_receive_reward')
|
|
export class sign_receive_reward extends base_ui {
|
|
export class sign_receive_reward extends base_ui {
|
|
@property(Node) public_bg:Node = null
|
|
@property(Node) public_bg:Node = null
|
|
|
|
+ @property(Node) img_title:Node = null
|
|
@property(Node) img_icon:Node = null
|
|
@property(Node) img_icon:Node = null
|
|
@property(Node) lab_name:Node = null
|
|
@property(Node) lab_name:Node = null
|
|
@property(Node) lab_count:Node = null
|
|
@property(Node) lab_count:Node = null
|
|
|
|
+ @property(Node) node_btn:Node = null
|
|
@property(Node) btn_receive:Node = null
|
|
@property(Node) btn_receive:Node = null
|
|
@property(Node) btn_double:Node = null
|
|
@property(Node) btn_double:Node = null
|
|
|
|
+
|
|
|
|
+ @property(SpriteFrame) sf_dangrihuode = null
|
|
|
|
+ @property(SpriteFrame) sf_gongxihuode = null
|
|
private m_data:sign_reward_data = null
|
|
private m_data:sign_reward_data = null
|
|
private m_cb = null
|
|
private m_cb = null
|
|
start() {
|
|
start() {
|
|
@@ -35,6 +41,8 @@ export class sign_receive_reward extends base_ui {
|
|
initView(data:sign_reward_data, cb) {
|
|
initView(data:sign_reward_data, cb) {
|
|
this.m_data = data
|
|
this.m_data = data
|
|
this.m_cb = cb
|
|
this.m_cb = cb
|
|
|
|
+ this.img_title.getComponent(Sprite).spriteFrame = this.sf_dangrihuode
|
|
|
|
+ this.node_btn.active = true
|
|
tools.loadRemoteImg(data.icon, (d)=>{
|
|
tools.loadRemoteImg(data.icon, (d)=>{
|
|
this.img_icon.getComponent(Sprite).spriteFrame = d.sf
|
|
this.img_icon.getComponent(Sprite).spriteFrame = d.sf
|
|
})
|
|
})
|
|
@@ -42,7 +50,12 @@ export class sign_receive_reward extends base_ui {
|
|
this.lab_count.getComponent(Label).string = `x${data.quantity}`
|
|
this.lab_count.getComponent(Label).string = `x${data.quantity}`
|
|
}
|
|
}
|
|
|
|
|
|
- public closeSelf() {
|
|
|
|
|
|
+ private showRewardDetails() {
|
|
|
|
+ this.img_title.getComponent(Sprite).spriteFrame = this.sf_gongxihuode
|
|
|
|
+ this.node_btn.active = false
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private closeSelf() {
|
|
this.btn_double.getComponent(Animation).stop()
|
|
this.btn_double.getComponent(Animation).stop()
|
|
this.node.active = false
|
|
this.node.active = false
|
|
}
|
|
}
|
|
@@ -52,12 +65,15 @@ export class sign_receive_reward extends base_ui {
|
|
if(is_double) {
|
|
if(is_double) {
|
|
stype = 2
|
|
stype = 2
|
|
}
|
|
}
|
|
|
|
+ uiManager.Instance().showLoading()
|
|
let opt = {'index':this.m_data.index, 'stype': stype}
|
|
let opt = {'index':this.m_data.index, 'stype': stype}
|
|
http.post(config.API.user_sign, opt, (err,d)=>{
|
|
http.post(config.API.user_sign, opt, (err,d)=>{
|
|
|
|
+ uiManager.Instance().hideLoading()
|
|
if(!err){
|
|
if(!err){
|
|
let nd = JSON.parse(d)
|
|
let nd = JSON.parse(d)
|
|
if(nd.code === config.status.SUCCESS){
|
|
if(nd.code === config.status.SUCCESS){
|
|
// console.log("user_sign", nd.content)
|
|
// console.log("user_sign", nd.content)
|
|
|
|
+ this.showRewardDetails()
|
|
this.m_cb && this.m_cb(this)
|
|
this.m_cb && this.m_cb(this)
|
|
}
|
|
}
|
|
}
|
|
}
|