123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- var { UserIntimacyType } = require('../utils/GameEnum');
- cc.Class({
- extends: cc.Component,
- properties: {
- titleRichText: cc.RichText,
- intimacyFullNode: cc.Node,
- intimacyLeftNode: cc.Node,
- intimacyRightNode: cc.Node,
- intimacyLabel: cc.Label,
- userLeftNode: cc.Node,
- leftNicknameRichText: cc.RichText,
- interactionLeftIcon: cc.Sprite,
- userRightNode: cc.Node,
- rightNicknameRichText: cc.RichText,
- interactionRightIcon: cc.Sprite,
-
- okButton: cc.Button,
- remindButton: cc.Button,
-
- intimacyRichText: cc.RichText,
- inviteRichText: cc.RichText,
- },
-
-
- start () {
- },
- init() {
- },
- hideAllIntimacyNode() {
- this.intimacyFullNode.active = false;
- this.intimacyLeftNode.active = false;
- this.intimacyRightNode.active = false;
- if (this.intimacyLabel) {
- this.intimacyLabel.node.active = false;
- }
- },
-
- configIntimacyInfo(interactionInfo, isInfo, isCommon) {
- this.hideAllIntimacyNode();
- this.interactionInfo = interactionInfo;
- if (isInfo) {
- this.configIntimacyInfoShow(isCommon);
- } else {
- this.configIntimacyInfoShare(isCommon);
- }
- let leftIcon = (err, spriteFrame) => {
- this.interactionLeftIcon.spriteFrame = spriteFrame;
- };
- let rightIcon = (err, spriteFrame) => {
- this.interactionRightIcon.spriteFrame = spriteFrame;
- };
- switch (interactionInfo.heart) {
- case UserIntimacyType.Empty:
- cc.loader.loadRes('interaction/interaction_none_icon', cc.SpriteFrame, leftIcon);
- cc.loader.loadRes('interaction/interaction_none_icon', cc.SpriteFrame, rightIcon);
- break;
- case UserIntimacyType.Full:
- this.intimacyFullNode.active = true;
- cc.loader.loadRes('interaction/interaction_ok_icon', cc.SpriteFrame, leftIcon);
- cc.loader.loadRes('interaction/interaction_ok_icon', cc.SpriteFrame, rightIcon);
- break;
- case UserIntimacyType.Left:
- this.intimacyLeftNode.active = true;
- cc.loader.loadRes('interaction/interaction_ok_icon', cc.SpriteFrame, leftIcon);
- cc.loader.loadRes('interaction/interaction_none_icon', cc.SpriteFrame, rightIcon);
- break;
- case UserIntimacyType.Right:
- this.intimacyRightNode.active = true;
- cc.loader.loadRes('interaction/interaction_none_icon', cc.SpriteFrame, leftIcon);
- cc.loader.loadRes('interaction/interaction_ok_icon', cc.SpriteFrame, rightIcon);
- break;
- }
- if (interactionInfo.me) {
- var genderIcon = 'intimacy_female';
- if (interactionInfo.me.gender == 1) {
- genderIcon = 'intimacy_male';
- }
- var nickString = "<img src='" + genderIcon + "' /> " + interactionInfo.me.nick.slice(0,5);
- this.leftNicknameRichText.string = nickString;
- }
- if (interactionInfo.other) {
- var genderIcon = 'intimacy_female';
- if (interactionInfo.other.gender == 1) {
- genderIcon = 'intimacy_male';
- }
- var nickString = "<img src='" + genderIcon + "' /> " + interactionInfo.other.nick.slice(0,5);
- this.rightNicknameRichText.string = nickString;
- }
- },
- configIntimacyInfoShow(isCommon) {
- var titleString = "你们今天还没有进行互动~\n一起互动额外增加<color=#E90000> 5 </>点亲密度~";
- if (isCommon == true) {
- titleString = "你们今天还没有进行互动~";
- }
- switch (this.interactionInfo.heart) {
- case UserIntimacyType.Empty:
- this.okButton.node.active = false;
- this.remindButton.node.active = true;
- break;
- case UserIntimacyType.Full:
- this.intimacyLabel.node.active = true;
- titleString = "你和你的好友都完成了今天的互动\n获得额外的<color=#E90000> 5 </>点亲密度~";
- if (isCommon) {
- titleString = "你和你的好友都完成了今天的互动";
- }
- this.okButton.node.active = true;
- this.remindButton.node.active = false;
- break;
- case UserIntimacyType.Left:
- titleString = "和你的好友一起互动\n额外增加<color=#E90000> 5 </>点亲密度~";
- if (isCommon) {
- titleString = "和你的好友一起互动";
- }
- this.okButton.node.active = false;
- this.remindButton.node.active = true;
- break;
- case UserIntimacyType.Right:
- titleString = "和你的好友一起互动\n额外增加<color=#E90000> 5 </>点亲密度~";
- if (isCommon) {
- titleString = "和你的好友一起互动";
- }
- this.okButton.node.active = true;
- this.remindButton.node.active = false;
- break;
- }
- this.titleRichText.string = titleString;
- },
- configIntimacyInfoShare(isCommon) {
-
- if (isCommon == true) {
- this.intimacyRichText.node.active = false;
-
- } else {
- this.intimacyRichText.node.active = true;
- }
-
- },
-
- });
|