| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- cc.Class({
- extends: cc.Component,
- properties: {
- },
- onLoad() {
- this.restTime = 12;
- this.currentTime = 0;
- this.player_name = "";
- this.player_gold = 10000;
- this.player_energy = 10001;
- this.player_sex = 0;
- this.game_time = 720; //战斗时间
- },
- start() {
- },
- update(dt) {
- },
- InformationChanges(state, indel, info) {
- if (state == "set") {
- if (indel == 0) {
- this.player_name = info;
- }
- if (indel == 1) {
- this.player_gold = info;
- }
- if (indel == 2) {
- this.player_energy = info;
- }
- if (indel == 3) {
- this.player_sex = info;
- }
- } else if (state == "get") {
- if (indel == 0) {
- return this.player_name;
- }
- if (indel == 1) {
- return this.player_gold;
- }
- if (indel == 2) {
- return this.player_energy;
- }
- if (indel == 3) {
- return this.player_sex;
- }
- }
- },
- //时间减少
- countdown(currentTime) {
- currentTime--;
- if (currentTime <= 0) {
- currentTime = 0;
- }
- return currentTime;
- },
- });
|