| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- 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;
- },
- 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;
- },
- });
|