| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104 |
- // Learn cc.Class:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/class.html
- // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/class.html
- // Learn Attribute:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/reference/attributes.html
- // - [English] http://docs.cocos2d-x.org/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - [Chinese] https://docs.cocos.com/creator/manual/zh/scripting/life-cycle-callbacks.html
- // - [English] https://www.cocos2d-x.org/docs/creator/manual/en/scripting/life-cycle-callbacks.html
- cc.Class({
- extends: cc.Component,
- properties: {
- upLeft: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- upRight: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- downLeft: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- downRight: {
- default: null,
- type: cc.Node,
- serializable: true,
- },
- villageUpLeft: {
- default: null,
- tip: "村长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- villageUpRight: {
- default: null,
- tip: "村长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- villageDownLeft: {
- default: null,
- tip: "村长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- villageDownRight: {
- default: null,
- tip: "村长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- mayorUpLeft: {
- default: null,
- tip: "镇长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- mayorUpRight: {
- default: null,
- tip: "镇长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- mayorDownLeft: {
- default: null,
- tip: "镇长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- mayorDownRight: {
- default: null,
- tip: "镇长图片",
- type: cc.SpriteFrame,
- serializable: true,
- },
- },
- /**
- * 设置面板信息
- */
- setInfo(context) {
- let { type } = context;
- if (type == "village") {
- this.upLeft.getComponent(cc.Sprite).spriteFrame = this.villageUpLeft;
- this.upRight.getComponent(cc.Sprite).spriteFrame = this.villageUpRight;
- this.downLeft.getComponent(cc.Sprite).spriteFrame = this.villageDownLeft;
- this.downRight.getComponent(cc.Sprite).spriteFrame = this.villageDownRight;
- }else if(type == "mayor"){
- this.upLeft.getComponent(cc.Sprite).spriteFrame = this.mayorUpLeft;
- this.upRight.getComponent(cc.Sprite).spriteFrame = this.mayorUpRight;
- this.downLeft.getComponent(cc.Sprite).spriteFrame = this.mayorDownLeft;
- this.downRight.getComponent(cc.Sprite).spriteFrame = this.mayorDownRight;
- }
- },
- });
|