|
|
@@ -13,18 +13,36 @@ export default class DrawItem extends cc.Component {
|
|
|
img_hero: cc.Sprite = null;
|
|
|
@property({ type: cc.Sprite, displayName: "图_阵营" })
|
|
|
img_camp: cc.Sprite = null;
|
|
|
-
|
|
|
+
|
|
|
@property({ type: cc.Sprite, displayName: "图_背光" })
|
|
|
img_light: cc.Sprite = null;
|
|
|
@property({ type: cc.Sprite, displayName: "图_背光开" })
|
|
|
img_light_opened: cc.Sprite = null;
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
+ @property({ type: cc.Sprite, displayName: "图_武将背景" })
|
|
|
+ img_bg_hero: cc.Sprite = null;
|
|
|
+ @property({ type: cc.Sprite, displayName: "图_品质框" })
|
|
|
+ img_rect: cc.Sprite = null;
|
|
|
+ @property({ type: cc.Sprite, displayName: "图_名称背板" })
|
|
|
+ img_bg_name: cc.Sprite = null;
|
|
|
+ @property({ type: cc.Label, displayName: "文本_名称" })
|
|
|
+ txt_name: cc.Label = null;
|
|
|
+ @property({ type: cc.Sprite, displayName: "星级数" })
|
|
|
+ stars: cc.Sprite[] = [];
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@property({ type: cc.Node, displayName: "提示_已拥有英雄" })
|
|
|
node_hasHero: cc.Node = null;
|
|
|
-
|
|
|
@property({ type: cc.Label, displayName: "文本_碎片数" })
|
|
|
txt_slice: cc.Label = null;
|
|
|
|
|
|
+ @property({ type: cc.Material, displayName: "材质_正常" })
|
|
|
+ mat_nor: cc.Material = null;
|
|
|
+ @property({ type: cc.Material, displayName: "材质_灰色" })
|
|
|
+ mat_gray: cc.Material = null;
|
|
|
+
|
|
|
isOpened = false;
|
|
|
|
|
|
onLoad() {
|
|
|
@@ -39,9 +57,15 @@ export default class DrawItem extends cc.Component {
|
|
|
this.img_camp.node.active = false;
|
|
|
}
|
|
|
|
|
|
- openDraw(general: GeneralVO) {
|
|
|
+ /**抽卡
|
|
|
+ * @param general 武将
|
|
|
+ * @param type 卡类型 1 单抽 2 十连抽
|
|
|
+ */
|
|
|
+ openDraw(general: GeneralVO, type: number = 1) {
|
|
|
if (this.isOpened) return;
|
|
|
this.isOpened = true;
|
|
|
+ this.img_light.node.active = type == 1;
|
|
|
+ console.log(" General: ",general);
|
|
|
cc.loader.loadRes("module/general/texture/hero_img/" + general.resource, cc.SpriteFrame, (errr, asset) => {
|
|
|
if (errr) {
|
|
|
return;
|
|
|
@@ -63,10 +87,45 @@ export default class DrawItem extends cc.Component {
|
|
|
.start();
|
|
|
});
|
|
|
cc.loader.loadRes("module/general/texture/icon_camp_" + general.camp, cc.SpriteFrame, (errr, asset) => {
|
|
|
- if (errr) {
|
|
|
- return;
|
|
|
- }
|
|
|
+ if (errr) { return; }
|
|
|
this.img_camp.spriteFrame = asset;
|
|
|
});
|
|
|
+ cc.loader.loadRes("module/general/texture/kapai_kuang" + general.color, cc.SpriteFrame, (errr, asset) => {
|
|
|
+ if (errr) { return; }
|
|
|
+ this.img_rect.spriteFrame = asset;
|
|
|
+ });
|
|
|
+ cc.loader.loadRes("module/general/texture/kapai_name" + general.color, cc.SpriteFrame, (errr, asset) => {
|
|
|
+ if (errr) { return; }
|
|
|
+ this.img_bg_name.spriteFrame = asset;
|
|
|
+ });
|
|
|
+ cc.loader.loadRes("module/general/texture/kapi_bg" + general.color, cc.SpriteFrame, (errr, asset) => {
|
|
|
+ if (errr) { return; }
|
|
|
+ this.img_bg_hero.spriteFrame = asset;
|
|
|
+ });
|
|
|
+ if (general.color == 1) {
|
|
|
+ this.img_light_opened.node.active = false;
|
|
|
+ } else {
|
|
|
+ this.img_light_opened.node.active = true;
|
|
|
+ let url = "module/drawRecruit/texture/kapai_guang1"
|
|
|
+ if (general.color == 2) {
|
|
|
+ url = "module/drawRecruit/texture/kapai_guang2"
|
|
|
+ }
|
|
|
+ cc.loader.loadRes(url, cc.SpriteFrame, (errr, asset) => {
|
|
|
+ if (errr) { return; }
|
|
|
+ this.img_light_opened.spriteFrame = asset;
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ this.txt_name.string = general.name;
|
|
|
+ for (let i = 0; i < this.stars.length; i++) {
|
|
|
+ if (general.star >= i + 1) {
|
|
|
+ this.stars[i].setMaterial(0, this.mat_nor);
|
|
|
+ //console.log("Star "+general.star+" Index: "+i);
|
|
|
+ } else {
|
|
|
+ this.stars[i].setMaterial(0, this.mat_gray);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ //碎片判断 是否已拥有该武将
|
|
|
}
|
|
|
}
|