12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
- import { uiManager } from '../../manager/uiManager';
- import { config } from '../../config';
- import { user_info_view } from '../user_info_view';
- import { home_bottom_rank_item } from './home_bottom_rank_item';
- import { GameManager } from '../../GameManager';
- import { tools } from '../../tools';
- import { home_honor } from './home_honor';
- import { home_bottom_countdown } from './home_bottom_countdown';
- import { unLock_view } from '../unLock_view';
- import { userDataManager } from '../../manager/userDataManager';
- const { ccclass, property } = _decorator;
- @ccclass('home_bottom')
- export class home_bottom extends Component {
- @property(Node) img_honor:Node = null
- @property(Node) btn_wenhao:Node = null
- @property(Node) btn_gengduo:Node = null
- @property(Node) rank1_node:Node = null
- @property(Node) rank2_node:Node = null
- @property(Node) rank3_node:Node = null
- @property(Node) lab_week_score:Node = null
- @property(Node) btn_wuxiancishu:Node = null
- @property(Node) countdown_node:Node = null
- start() {
- uiManager.Instance().onButtonListen(this.btn_wenhao, ()=>{
- uiManager.Instance().showUi(config.UI.ui_gameplay_view)
- })
- uiManager.Instance().onButtonListen(this.btn_gengduo, ()=>{
- this.node.parent.active = false
- uiManager.Instance().showUi(config.UI.rank, null, ()=>{
- this.node.parent.active = true
- })
- })
- uiManager.Instance().onButtonListen(this.btn_wuxiancishu, ()=>{
- if(userDataManager.getUserIsFreeAds()) {
- return
- }
- uiManager.Instance().showUi(config.UI.ui_unLock_view, null, (node:Node)=>{
- node.getComponent(unLock_view).initView((v:unLock_view)=>{
- v.closeSelf()
- this.reloadCountdown()
- })
- })
- })
- }
- public init() {
- this.reloadWeekScore()
- this.reloadHonorData()
- this.reloadCountdown()
- this.reloadCountryRankData()
- }
- public reloadWeekScore() {
- this.lab_week_score.getComponent(Label).string = tools.mine_rank_data.score + ''
- }
- private reloadHonorData() {
- this.img_honor.getComponent(home_honor).initView()
- }
- private reloadCountdown() {
- this.countdown_node.getComponent(home_bottom_countdown).startTime()
- }
-
- public reloadCountryRankData(){
- GameManager.requestRankList(0, (d_content)=>{
- if(d_content.length>0) {
- let rank_data = d_content[0]
- this.rank1_node.getComponent(home_bottom_rank_item).initView(rank_data, this.onClickRankGotoUserInfo.bind(this))
- } else if(d_content.length>1) {
- let rank_data = d_content[1]
- this.rank2_node.getComponent(home_bottom_rank_item).initView(rank_data, this.onClickRankGotoUserInfo.bind(this))
- } else if(d_content.length>2) {
- let rank_data = d_content[2]
- this.rank3_node.getComponent(home_bottom_rank_item).initView(rank_data, this.onClickRankGotoUserInfo.bind(this))
- }
- })
- }
- private onClickRankGotoUserInfo(item:home_bottom_rank_item) {
- let data = item.getData()
- if(data == null) {
- return
- }
- uiManager.Instance().showUi(config.UI.ui_user_info_view, null, (node:Node)=>{
- node.getComponent(user_info_view).initView(data)
- })
- }
- }
|