1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- import { GameViewType } from "../../../main/ViewManage";
- import ViewObject from "../../../main/ViewObject";
- import CMath from "../../../util/CMath";
- import FFCalAttr from "../../data/FFCalAttr";
- import RoleTitleItem from "./RoleTitleItem";
- import TitleInfoView from "./TitleInfoView";
- /**
- * 称号设置界面
- */
- const {ccclass, property} = cc._decorator;
- @ccclass
- export default class RoleTitleView extends ViewObject {
- @property(cc.Node)
- mContent: cc.Node = null;
- @property(cc.Prefab)
- mFrameIcon: cc.Prefab = null;
- @property(cc.Node)
- mContentHas: cc.Node = null;
- @property(TitleInfoView)
- mTitleInfoView: TitleInfoView = null;
- @property(cc.Label)
- mZdl: cc.Label = null;
- public init(){
- let roleIcons = this.main.sManage.getRoleIcon()
- for (let i = 0; i < roleIcons.length; i++) {
- const element = roleIcons[i];
- if(element.type == 3){
- let node = cc.instantiate(this.mFrameIcon)
- let frameIcon = node.getComponent(RoleTitleItem)
- frameIcon.roleIcon = element
- frameIcon.init()
- frameIcon.flushLock(this.main)
- node.parent = this.mContent
- frameIcon.setCallback((ftp:RoleTitleItem)=>{
- this.openInfo(ftp)
- })
- }
- }
- let tif = this.mContent.children[0].getComponent(RoleTitleItem)
-
- this.flush(tif)
- }
- public flush(tif:RoleTitleItem){
- this.mTitleInfoView.init(this.main,tif)
- let data = {
- atk:0,
- def:0,
- hp:0,
- sp:0
- }
- let open = this.main.player.roleIcon.open
- for (let i = 0; i < open.length; i++) {
- const element = open[i];
- if(element >= 400 && element < 400){
- let temp = this.main.sManage.getRoleIconById(element)
- data.atk += temp.atk
- data.def += temp.def
- data.hp += temp.hp
- data.sp += temp.sp
- }
- }
- let zdl = FFCalAttr.getZdl(data)
- this.mZdl.string = ''+zdl
-
- }
- public openInfo(tif:RoleTitleItem){
- this.mTitleInfoView.init(this.main,tif)
-
- }
- }
|