1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- import { _decorator, Component, Label, Node, Sprite } 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';
- const { ccclass, property } = _decorator;
- @ccclass('home_bottom')
- export class home_bottom extends Component {
- @property(Node) btn_up_rank: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
- start() {
- uiManager.Instance().onButtonListen(this.btn_up_rank, ()=>{
- uiManager.Instance().showUi(config.UI.rank)
- })
- uiManager.Instance().onButtonListen(this.btn_wenhao, ()=>{
- uiManager.Instance().showUi(config.UI.ui_gameplay_view)
- })
- uiManager.Instance().onButtonListen(this.btn_gengduo, ()=>{
- uiManager.Instance().showUi(config.UI.rank)
- })
- uiManager.Instance().onButtonListen(this.btn_wuxiancishu, ()=>{
- uiManager.Instance().showUi(config.UI.ui_unLock_view)
- })
- }
- public init() {
- this.lab_week_score.getComponent(Label).string = tools.mine_rank_data.score + ''
- }
-
- 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)
- })
- }
- }
|