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CAAC,QAAQ,CAAC,CAAC;YACnI,yBAAW,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QACjE,CAAC;KACJ,CAAA;IAhJG;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;yDAClD;IAE5C;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,CAAC;wDACnD;IAEzC;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,kBAAkB,EAAE,OAAO,EAAE,aAAa,EAAE,CAAC;+DACrD;IAEhD;QADC,QAAQ,CAAC,EAAE,OAAO,EAAE,8DAA8D,EAAE,CAAC;uDAC/B;IAMvD;QADC,QAAQ,CAAC,EAAE,IAAI,EAAE,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,CAAC;uDACjD;IAGhC;QADC,QAAQ;0DACoB;IAlBpB,iBAAiB;QAD7B,OAAO;OACK,iBAAiB,CAmJ7B;IAAD,wBAAC;KAAA;AAnJY,8CAAiB","file":"","sourceRoot":"/","sourcesContent":["import { ResUtils } from \"simba-cc-resutils\";\nimport { DummyColor, DummyLabel, DummySprite } from \"../../common/CCDummyObjects\";\nimport { EventCenter } from \"../event/EventCenter\";\nimport { CooperationClassBase, CooperationItemDataModel } from \"./CooperationClassBase\";\nimport CooperationDataCenter, { SubGameLocation } from \"./CooperationDataCenter\";\nimport CooperationDotMgr from \"./CooperationDotMgr\";\n\n/**cocos合作item组件 */\nconst { ccclass, property } = cc._decorator;\n@ccclass\nexport class CCCooperationItem extends cc.Component {\n\n @property({ type: cc.Sprite, visible: true, displayName: \"iconSprite\", tooltip: \"小游戏icon精灵\" })\n private iconSprite: cc.Sprite = DummySprite;\n @property({ type: cc.Label, visible: true, displayName: \"nameLabel\", tooltip: \"小游戏name标签\" })\n private nameLabel: cc.Label = DummyLabel;\n @property({ type: cc.Label, visible: true, displayName: \"playingUserLabel\", tooltip: \"小游戏多少人正在玩标签\" })\n private playingUserLabel: cc.Label = DummyLabel;\n @property({ tooltip: \"当前游戏所处的位置:主界面(mainUI)、游戏中心列表(gameCenter)、朋友圈列表(momentCenter)\" })\n location: SubGameLocation = SubGameLocation.GameCenter;\n\n private dataModel: CooperationItemDataModel;\n private ossPath: string = CooperationClassBase.COO_OSS_PATH_DEV;\n\n @property({ type: cc.Color, tooltip: \"个性化定制字体颜色\", displayName: \"diyLabelColor\" })\n diyColor: cc.Color = DummyColor;\n\n @property\n useDIYColor: boolean = false;\n\n spr: cc.Sprite;\n\n private _localSFPath: string = \"textures/cooperationItems/\";\n private _localSFArr: string[] = [\n \"dlmhsj\",\n \"fakeprince2\",\n \"feidao\",\n \"huanyuanshi\",\n \"jiawangzi\",\n \"jiujiu\",\n \"lianaiyujing\",\n \"mrqm\",\n \"shanyoufusu\",\n \"shenmiriji\",\n \"sxjsl\",\n \"wodedadao\",\n \"wolianzeida\",\n \"yybs\"\n ];\n\n /***设置release还是dev */\n setRelease(release: boolean = false) {\n this.ossPath = release ? CooperationClassBase.COO_OSS_PATH_RELEASE : CooperationClassBase.COO_OSS_PATH_DEV;\n }\n\n /**设置当前模型所处的位置标识 */\n setLocation(location: SubGameLocation) {\n this.location = location;\n }\n\n /**绑定数据 */\n bindData(data: CooperationItemDataModel) {\n if (!data) {\n return;\n }\n this.dataModel = data;\n this.refreshItem(data);\n }\n\n /**刷新模型 */\n refreshItem(data?: CooperationItemDataModel) {\n if (!data && !this.dataModel) {\n return;\n }\n if (data) {\n this.refreshIcon(data.icon);\n this.refreshName(data.appName);\n this.refreshPlayingUser();\n this.refreshNameColor();\n } else {\n console.error('data is null');\n }\n }\n\n /**刷新icon */\n refreshIcon(icon: string): Promise<any> {\n let spr: cc.Sprite = this.iconSprite;\n let iconName: string = icon.split(\".\")[0];\n let isLocal = this._localSFArr.findIndex((v) => v === iconName) !== (-1);\n let loaclPath = this._localSFPath + iconName;\n return new Promise<any>((resolve, reject) => {\n if (isLocal) {\n ResUtils.loadRes(loaclPath, cc.SpriteFrame).then((sf) => {\n spr.spriteFrame = sf;\n resolve(true);\n });\n } else {\n let path: string = this.ossPath + CooperationDataCenter.getInstance().getCurGameID() + CooperationClassBase.IMG_PATH + icon;\n cc.assetManager.loadRemote(path, (err, sprite) => {\n if (err) {\n reject(err)\n } else {\n spr.spriteFrame = new cc.SpriteFrame(sprite);\n resolve(true)\n }\n });\n }\n })\n }\n\n /**刷新name */\n refreshName(name: string) {\n if (!name || !this.nameLabel) {\n return;\n }\n this.nameLabel.node.active = !!this.dataModel.showAppName;\n this.nameLabel.string = name;\n }\n\n /**设置name的字体颜色 */\n refreshNameColor() {\n if (!this.nameLabel) {\n return;\n }\n let c: cc.Color = cc.color(255, 255, 255);\n if (this.useDIYColor && this.diyColor) {\n c = this.diyColor;\n }\n this.nameLabel.node.color = c;\n if (!this.playingUserLabel) {\n return;\n }\n this.playingUserLabel.node.color = c;\n }\n\n /**刷新正在玩的玩家数量 */\n refreshPlayingUser() {\n if (!this.playingUserLabel) {\n return;\n }\n this.playingUserLabel.node.active = !!this.dataModel.showPlayingUser;\n\n if (!this.dataModel.userMin) this.dataModel.userMin = 0;\n let min = this.dataModel.userMin > 0 ? this.dataModel.userMin : 0;\n\n if (!this.dataModel.userMax) this.dataModel.userMax = 0;\n let max = this.dataModel.userMax > 0 && this.dataModel.userMax > min ? this.dataModel.userMax : min + 100;\n\n let num = Math.ceil(Math.random() * (max - min) + min);\n this.playingUserLabel.string = num.toString() + \"在玩\";\n }\n\n /**Item点击回调 */\n onItemClick() {\n CooperationDotMgr.getInstance().dotClickSubGame(this.dataModel.appId, this.dataModel.appName, this.dataModel.index, this.location);\n EventCenter.OPEN_SUBGAME_BY_APPID.emit(this.dataModel.appId);\n }\n}"]}