| 1234567891011121314151617181920212223242526272829303132333435363738 |
- // Learn TypeScript:
- // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html
- // Learn Attribute:
- // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
- // Learn life-cycle callbacks:
- // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
- import { MateData } from "../../datas/MateData";
- import MyExtends from "../../tools/MyExtends";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class TalentIconItem extends cc.Component {
- @property(cc.Sprite)
- img: cc.Sprite = null;
- mateid: number = 1;
- talentid: number = 1;
- Init(mateid, talentid) {
- this.mateid = mateid;
- this.talentid = talentid;
- cc.loader.loadRes("xiyou/talent/" + mateid + "-" + talentid, cc.SpriteFrame, (err, res) => {
- if (err) {
- return;
- }
- this.img.spriteFrame = res;
- });
- }
- Click_Btn() {
- //显示详情
- let pos = MyExtends.convetOtherNodeSpaceAR(this.node, cc.find("Canvas"));
- MateData.Ins.DisplayTalentDetaile(this.mateid, this.talentid, pos);
- }
- }
|