123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288 |
- var {UserInformationType, UserInformationRelateOptType, GameNotificationKey, UserIntimacyType} = require('../utils/GameEnum');
- cc.Class({
- extends: cc.Component,
- properties: {
- titleNode: cc.Node,
- titleRichText: cc.RichText,
- homeButton: cc.Button,
- //抢夺、赎身相关操作按钮
- relationButtonNode: cc.Node,
- relationRichText: cc.RichText,
- //安抚按钮
- interactionButtonNode: cc.Node,
- //命令、反抗按钮
- orderButtonNode: cc.Node,
- //培养按钮
- trainButtonNode: cc.Node,
- //抢夺、赎身、签约成功提示
- successNode: cc.Node,
- successTipsNode: cc.Node,
- //背包按钮节点
- packButtonNode: cc.Node,
- //亲密度显示
- intimacyNode: cc.Node,
- intimacyFullNode: cc.Node,
- intimacyLeftNode: cc.Node,
- intimacyRightNode: cc.Node,
- intimacyLabel: cc.Label,
- //插卡按钮节点
- equipCardNode: cc.Node,
- equipCardSprite1: cc.Sprite,
- equipCardSprite2: cc.Sprite,
- equipCardSprite3: cc.Sprite,
- equipCardArray: [cc.SpriteFrame],
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this.titleSprite = this.titleNode.getComponent(cc.Sprite);
- this.successNode.on('touchstart',this.clossSuccessNode,this);
- this.intimacyNode.on('touchend', this.showIntimacyStatus, this);
- },
- start () {
- },
- init() {
- },
- onDisable() {
- this.hideAllFunctionNode();
- this.refreshNoCards();
- },
- // update (dt) {},
- changeTheme(infoRole, hasBoss) {
- this.infoRole = infoRole;
- this.hasBoss = hasBoss;
- switch (this.infoRole) {
- case UserInformationType.Mine:
- this.refreshThemeOfMine();
- break;
- case UserInformationType.Boss:
- this.refreshThemeOfBoss();
- break;
- case UserInformationType.MyArtist:
- this.refreshThemeOfMyArtist();
- break;
- case UserInformationType.OtherArtist:
- this.refreshThemeOfOtherArtist();
- break;
- case UserInformationType.ArtistFree:
- this.refreshThemeOfArtistFree();
- break;
- }
- },
- //隐藏所有功能按钮和节点
- hideAllFunctionNode() {
- this.intimacyNode.active = false;
- this.homeButton.node.active = false;
- this.relationButtonNode.active = false;
- this.interactionButtonNode.active = false;
- this.orderButtonNode.active = false;
- this.trainButtonNode.active = false;
- this.packButtonNode.active = false;
- this.equipCardNode.active = false;
- },
- refreshThemeOfMine () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>我的信息</b></outline>";
- this.hideAllFunctionNode();
- this.packButtonNode.active = true;
- },
- refreshThemeOfBoss () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>我的老板</b></outline>";
- this.relationRichText.string = "<outline color=#2a7019 width=2><b>赎身</b></outline>";
- cc.loader.loadRes('userInformation/userinformation_play_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.interactionButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- cc.loader.loadRes('userInformation/userinformation_revolt_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.orderButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- this.hideAllFunctionNode();
- this.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = true;
- },
- refreshThemeOfMyArtist () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>我的艺人</b></outline>";
- this.relationRichText.string = "<outline color=#2a7019 width=2><b>解雇</b></outline>";
- cc.loader.loadRes('userInformation/userinformation_pacify_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.interactionButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- cc.loader.loadRes('userInformation/userinformation_order_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.orderButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- this.hideAllFunctionNode();
- this.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = true;
- this.trainButtonNode.active = true;
- },
- refreshThemeOfOtherArtist () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>他人艺人</b></outline>";
- this.relationRichText.string = "<outline color=#2a7019 width=2><b>抢夺</b></outline>";
- cc.loader.loadRes('userInformation/userinformation_interact_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.interactionButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- this.hideAllFunctionNode();
- this.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.interactionButtonNode.active = true;
- },
- refreshThemeOfArtistFree () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>自由身</b></outline>";
- this.relationRichText.string = "<outline color=#2a7019 width=2><b>签约</b></outline>";
- cc.loader.loadRes('userInformation/userinformation_interact_button', cc.SpriteFrame, (err, spriteFrame) => {
- this.interactionButtonNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- });
- this.hideAllFunctionNode();
- this.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.interactionButtonNode.active = true;
- },
- hideAllIntimacyNode() {
- this.intimacyFullNode.active = false;
- this.intimacyLeftNode.active = false;
- this.intimacyRightNode.active = false;
- },
- configIntimacyData(interactionInfo) {
- this.hideAllIntimacyNode();
- switch (interactionInfo.heart) {
- case UserIntimacyType.Empty:
- break;
- case UserIntimacyType.Full:
- this.intimacyFullNode.active = true;
- break;
- case UserIntimacyType.Left:
- this.intimacyLeftNode.active = true;
- break;
- case UserIntimacyType.Right:
- this.intimacyRightNode.active = true;
- break;
- }
- this.intimacyLabel.string = "亲密度:"+ interactionInfo.intimacy +"/100";
- },
- clossSuccessNode() {
- this.successNode.active = false;
- },
- showChangeRelationSuccess(spriteFrameString) {
- this.successNode.active = true;
- GameEvent.fire(GameNotificationKey.PlaySuccessAnimation);
- cc.loader.loadRes(spriteFrameString, cc.SpriteFrame, (err, spriteFrame) => {
- this.successTipsNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- this.successTipsNode.active = true;
- });
- },
- showIntimacyStatus() {
- GameEvent.fire(GameNotificationKey.ShowInteraction);
- },
- //抢夺赎身操作按钮刷新
- refreshRelationNode() {
- switch (this.infoRole) {
- case UserInformationType.Mine:
- this.relationButtonNode.active = false;
- break;
- default:
- this.relationButtonNode.active = true;
- break;
- }
- },
- //插卡节点数据显示
- configCardsData(list) {
- switch (this.infoRole) {
- case UserInformationType.Mine:
- if (this.hasBoss == false) {
- this.equipCardNode.active = true;
- } else {
- this.equipCardNode.active = false;
- return;
- }
- break;
- case UserInformationType.MyArtist:
- this.equipCardNode.active = true;
- break;
- default:
- this.equipCardNode.active = false;
- return;
- }
- this.list = list;
- if (list != undefined && list.length > 0) {
- this.refreshNoCards();
- let count = list.length;
- if (count == 1) {
- this.equipCardSprite1.spriteFrame = this.equipCardArray[1];
- this.equipCardSprite2.spriteFrame = this.equipCardArray[0];
- this.equipCardSprite3.spriteFrame = this.equipCardArray[0];
- } else if (count == 2) {
- this.equipCardSprite1.spriteFrame = this.equipCardArray[1];
- this.equipCardSprite2.spriteFrame = this.equipCardArray[1];
- this.equipCardSprite3.spriteFrame = this.equipCardArray[0];
- } else if (count >= 3) {
- this.equipCardSprite1.spriteFrame = this.equipCardArray[1];
- this.equipCardSprite2.spriteFrame = this.equipCardArray[1];
- this.equipCardSprite3.spriteFrame = this.equipCardArray[1];
- }
- } else {
- this.refreshNoCards();
- }
- },
- refreshNoCards() {
- this.equipCardSprite1.spriteFrame = this.equipCardArray[0];
- this.equipCardSprite2.spriteFrame = this.equipCardArray[0];
- this.equipCardSprite3.spriteFrame = this.equipCardArray[0];
- },
- });
|