123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/2.4/manual/en/scripting/life-cycle-callbacks.html
- import EventName from "../EventName/EventName";
- import { ButtonLock } from "../GameLogic/Sofa";
- import HTTPS, { NetGet } from "../Template/HTTPS";
- import PopComponet from "../Template/PopComponet";
- import { CollectDetailsType } from "./CollectManger";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class DressUp extends PopComponet {
- @property(cc.SpriteFrame)
- Dress_Sp: cc.SpriteFrame = null
- @property(cc.Sprite)
- image: cc.Sprite = null
- @property(cc.Node)
- Btn: cc.Node = null
- @property(cc.Label)
- Label: cc.Label = null
- @property(cc.Label)
- Name: cc.Label = null
- protected start(): void {
- let d = <CollectDetailsType>this.Options.Data.MyType
- this.image.spriteFrame = this.Options.Data.Sp
- this.Name.string = d.Name
- if (d.IsHold == 1) {
- //拥有
- this.Btn.active = true
- this.image.setMaterial(0, cc.MaterialVariant.createWithBuiltin(cc.Material.BUILTIN_NAME.SPRITE, null))
- this.Label.string = d.Description
- if (d.IsWear == 0) {
- this.Btn.getComponent(cc.Sprite).spriteFrame = this.Dress_Sp
- }
- } else {
- //未拥有
- this.Btn.active = false
- this.image.setMaterial(0, cc.MaterialVariant.createWithBuiltin(cc.Material.BUILTIN_NAME.GRAY_SPRITE, null))
- this.Label.string = d.Condition
- }
- }
- @ButtonLock(1, null)
- Click() {
- let d = <CollectDetailsType>this.Options.Data.MyType
- if (d.IsHold == 1) {
- HTTPS.Instance.get(NetGet.UserWearCollect + d.Id).then((resp) => {
- cc.systemEvent.emit(EventName.CollectSelect, d.Id)
- this.Surpclose()
- })
- }
- }
- }
|