123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- 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,
- },
- // 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(information) {
- this.information = information;
- },
- onDisable() {
- this.relationButtonNode.active = false;
- this.interactionButtonNode.active = false;
- this.orderButtonNode.active = false;
- this.homeButton.node.active = false;
- this.successNode.active = false;
- this.successTipsNode.active = false;
- this.packButtonNode.active = false;
- this.intimacyNode.active = false;
- },
- // update (dt) {},
- changeTheme(infoTheme) {
- this.infoTheme = infoTheme;
- switch (this.infoTheme) {
- 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;
- }
- },
- refreshThemeOfMine () {
- this.titleRichText.string = "<outline color=#690802 width=3><b>我的信息</b></outline>";
- 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 = 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.intimacyNode.active = true;
- this.homeButton.node.active = true;
-
- this.relationButtonNode.active = true;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = true;
- this.trainButtonNode.active = false;
- this.packButtonNode.active = false;
- },
- 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.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.relationButtonNode.active = false;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = true;
- this.trainButtonNode.active = true;
- this.packButtonNode.active = false;
- },
- 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.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.relationButtonNode.active = true;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = false;
- this.trainButtonNode.active = false;
- this.packButtonNode.active = false;
- },
- 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.intimacyNode.active = true;
- this.homeButton.node.active = true;
- this.relationButtonNode.active = true;
- this.interactionButtonNode.active = true;
- this.orderButtonNode.active = false;
- this.trainButtonNode.active = false;
- this.packButtonNode.active = false;
- },
- 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;
- Global.GameEvent.fire(GameNotificationKey.PlaySuccessAnimation);
- cc.loader.loadRes(spriteFrameString, cc.SpriteFrame, (err, spriteFrame) => {
- this.successTipsNode.getComponent(cc.Sprite).spriteFrame = spriteFrame;
- this.successTipsNode.active = true;
- });
- },
- showIntimacyStatus() {
- Global.GameEvent.fire(GameNotificationKey.ShowInteraction);
- }
- });
|