MagicBoxRewardView.ts 1.0 KB

123456789101112131415161718192021222324252627282930313233
  1. import ViewObject from "../../../main/ViewObject";
  2. import GoodItem from "../../common/GoodItem";
  3. import MagicBoxItem from "./MagicBoxItem";
  4. /**
  5. * 魔盒奖励详细说明
  6. */
  7. const {ccclass, property} = cc._decorator;
  8. @ccclass
  9. export default class MagicBoxRewardView extends ViewObject {
  10. @property(cc.Node)
  11. mContent: cc.Node = null;
  12. @property(cc.Prefab)
  13. mRewardItem: cc.Prefab = null;
  14. public init(boxItem:MagicBoxItem){
  15. let _magicBox = boxItem._magicBox
  16. let rewardList = this.main.sManage.getRewardViews(_magicBox.list)
  17. for (let i = 0; i < rewardList.length; i++) {
  18. const element = rewardList[i];
  19. let node = cc.instantiate(this.mRewardItem)
  20. let goodItem:GoodItem = node.getComponent(GoodItem)
  21. goodItem.initReward(this.main,element)
  22. goodItem.mContrast.node.active = true
  23. goodItem.mContrast.string = element.PR+'%'
  24. node.parent = this.mContent
  25. }
  26. }
  27. }