difenduandada
2024-12-31 34abe6963b344c882358274957f4b992456fee40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var ArenaEvent = require("arena_event");
var ArenaConst = require("arena_const");
 
var ArenaChampionModel = cc.Class({
    extends: BaseClass,
    ctor: function () {
    },
 
    properties: {
    },
 
    initConfig: function () {
        this.base_info = null;       // 冠军赛基础信息
        this.role_info = null;       // 个人基础信息
    },
 
    updateChampionBaseInfo: function(data) {
        this.base_info = data;
        gcore.GlobalEvent.fire(ArenaEvent.UpdateChampionBaseInfoEvent, data);
    },
 
    getBaseInfo: function() {
        return this.base_info;
    },
 
    setRoleInfo: function(data) {
        this.role_info = data;
        gcore.GlobalEvent.fire(ArenaEvent.UpdateChampionRoleInfoEvent, data);
    },
 
    getRoleInfo: function(data) {
        return this.role_info
    },
 
    // 获取我的比赛状态
    getMyMatchStatus: function() {
        if (this.base_info && this.role_info) {
            if (this.base_info.step == ArenaConst.champion_step.unopened) { 
                return ArenaConst.champion_my_status.unopened
            } else if (this.base_info.step == ArenaConst.champion_step.score && this.base_info.step_status == ArenaConst.champion_step_status.unopened) { 
                return ArenaConst.champion_my_status.unopened
            } else if (this.role_info.rank === 0) { 
                return ArenaConst.champion_my_status.unjoin
            } else {
                return ArenaConst.champion_my_status.in_match
            }
        }
        return ArenaConst.champion_my_status.unopened;
    },
 
});