FTmpTaskPanel.ts 849 B

12345678910111213141516171819202122232425262728293031323334
  1. import i18n from "../../i18n/i18n";
  2. import CUtil from "../../util/CUtil";
  3. import { __GoodData } from "../data/sdata/SManage";
  4. import FTmpTaskGood from "./FTmpTaskGood";
  5. /**
  6. * 临时道具面板显示
  7. */
  8. const {ccclass, property} = cc._decorator;
  9. @ccclass
  10. export default class FTmpTaskPanel extends cc.Component {
  11. @property(cc.Label)
  12. mName: cc.Label = null;
  13. @property(cc.Label)
  14. mAbout: cc.Label = null;
  15. public time = 0
  16. public show(goodItem:FTmpTaskGood){
  17. this.node.active = true
  18. this.mName.string = i18n.t(goodItem._good.name) + 'X'+goodItem.count
  19. this.mAbout.string = i18n.t(goodItem._good.about)
  20. this.time = CUtil.getNowTime()
  21. }
  22. update (dt) {
  23. let nowTime = CUtil.getNowTime()
  24. if(nowTime - this.time > 2){
  25. this.node.active = false
  26. }
  27. }
  28. }