wujia hace 6 meses
padre
commit
0bf7526773

+ 2 - 2
assets/package/prefab/login/MainUI.prefab

@@ -3144,7 +3144,7 @@
   },
   {
     "__type__": "cc.Node",
-    "_name": "Node.Territory",
+    "_name": "Node.Mail",
     "_objFlags": 0,
     "__editorExtras__": {},
     "_parent": {
@@ -3564,7 +3564,7 @@
     "component": "",
     "_componentId": "333725l60NGX4XNYAWfdTV2",
     "handler": "onTouchButton",
-    "customEventData": "Territory"
+    "customEventData": "MailMain"
   },
   {
     "__type__": "cc.PrefabInfo",

+ 2 - 2
assets/script/framework/config/LayerConf.ts

@@ -31,6 +31,6 @@ export let Layer_Conf: { [key: number]: LayerConf } = {
     [ViewID.TowerUI]: { bundle: "package", url: "prefab/ui/tower/tower", type: LayerType.Game, anim: false },
     [ViewID.ZombieUI]: { bundle: "package", url: "prefab/ui/tower/zombie", type: LayerType.Game, anim: false },
 
-    [ViewID.MailMain]: { bundle: "sub_bundle", url: "mail/prefab/MailMain", type: LayerType.UI, anim: false },
-    [ViewID.MailDetail]: { bundle: "sub_bundle", url: "mail/prefab/MailDetail", type: LayerType.UI, anim: false },
+    [ViewID.MailMain]: { bundle: "mail", url: "prefab/MailMain", type: LayerType.UI, anim: false },
+    [ViewID.MailDetail]: { bundle: "mail", url: "prefab/MailDetail", type: LayerType.UI, anim: false },
 };

+ 20 - 14
assets/script/game/common/InterfaceAddEnum.ts

@@ -1,18 +1,24 @@
 //公共结构体和枚举
 
-export enum ScrollViewEventMap{
-    "scroll-to-top"= 0,
-    "scroll-to-bottom"= 1,
-    "scroll-to-left"= 2,
-    "scroll-to-right"= 3,
-    "scrolling"= 4,
-    "bounce-bottom"= 6,
-    "bounce-left"= 7,
-    "bounce-right"= 8,
-    "bounce-top"= 5,
-    "scroll-ended"= 9,
-    "touch-up"= 10,
-    "scroll-ended-with-threshold"= 11,
-    "scroll-began"= 12,
+export enum ScrollViewEventMap {
+    "scroll-to-top" = 0,
+    "scroll-to-bottom" = 1,
+    "scroll-to-left" = 2,
+    "scroll-to-right" = 3,
+    "scrolling" = 4,
+    "bounce-bottom" = 6,
+    "bounce-left" = 7,
+    "bounce-right" = 8,
+    "bounce-top" = 5,
+    "scroll-ended" = 9,
+    "touch-up" = 10,
+    "scroll-ended-with-threshold" = 11,
+    "scroll-began" = 12,
+}
+
+// /** 公告 */
+export interface BulletinEnum {
+    content: string,       //公告内容
+    img: null        //公告图片;可空
 }
 

+ 4 - 0
assets/script/game/common/LoginManager.ts

@@ -10,6 +10,7 @@ import { HttpUtil } from "./HttpUtil";
 import { NetManager, NetMgr } from "./NetManager";
 import { md5 } from "../../framework/storage/Md5";
 import { TimeUtil } from "../../framework/util/TimeUtil";
+import { MailData } from "../data/MailData";
 
 
 const Macro = {
@@ -294,6 +295,9 @@ export class LoginManager {
                     } else {
                         postData.back()
                     }
+                    if (resp.data.get_mails) {
+                        MailData.setData(resp.data.get_mails)
+                    }
                     if (resp.data.have_pay) {
                         if (!resp.data.pay_notify) {
                             this.sendPost('user', 'get_cash', (data) => {

+ 2 - 1
assets/script/game/data/GameEvent.ts

@@ -9,8 +9,9 @@ let event = {
 	User_Guide_Finish: "User_Guide_Finish",                             //新手引导完毕
 	Net_Reconnect_Success: "Net_Reconnect_Success",                     //网络重连成功
 
-	BombUpdate: "BombUpdate",										 //炸弹更新
+	BombUpdate: "BombUpdate",										 	//炸弹更新
 
+	MailUpdate: "MailUpdate",											//邮件操作更新
 }
 
 export let GameEvent = event;

+ 6 - 6
assets/script/game/data/MailData.ts

@@ -4,8 +4,8 @@ interface Mail {
     id: string;
     sys: number;
     expire: string;
-    read: string;
-    awards?: any[];
+    read: string;//读取状态
+    awards: any;//奖励附件
 }
 
 class Data {
@@ -71,9 +71,9 @@ class Data {
 
         for (const key in this._mails) {
             const v = this._mails[key];
-            if (parseInt(v.expire, 10) >= nowTime) {
+            // if (parseInt(v.expire, 10) >= nowTime) {
                 mailList.push(v);
-            }
+            // }
         }
 
         mailList.sort((a, b) => {
@@ -156,7 +156,7 @@ class Data {
     }
 
     getMailText(content: any, isTitle: boolean): string {
-        const jsonData = content;
+        let jsonData = content;
         let text: string;
 
         // if (isTitle) {
@@ -185,7 +185,7 @@ class Data {
         //             }
         //         }
 
-                return text;
+                // return text;
             // } else {
                 return content;
             // }

+ 3 - 3
assets/script/game/ui/login/Bulletin.ts

@@ -19,8 +19,8 @@ export class Bulletin extends BaseView {
 	@property({ type: RichText, tooltip: "公告内容" })
 	msgTx: RichText = null;
 
-	private data:BulletinEnum;
-	
+	private data:BulletinEnum = null;
+
 	protected onLoad() {
 		super.onLoad();
 		this.closeTips.string = StringUtil.getLanguageData('点击空白关闭');
@@ -45,7 +45,7 @@ export class Bulletin extends BaseView {
 	onOpen(data:BulletinEnum) {
 		this.data = data;
 
-		this.msgTx.string = this.data.content;
+		this.msgTx.string = data.content;
 
 		if (this.data.img){
 			this.load('package', 'texture/login/bulletin_img/spriteFrame', SpriteFrame, (res: SpriteFrame) => {

+ 1 - 0
assets/script/game/ui/login/MainUI.ts

@@ -119,6 +119,7 @@ export class MainUI extends BaseView {
 			this.openGameUI = str;
 
 			if (!this.GameUI[str]) {
+				console.log(str);
 				Framework.layer.open(Number(ViewID[str]), () => {
 					console.log(str);
 					// let onBgFrame = this.Node[this.openGameUI].parent.getComponent(Sprite).spriteFrame;

+ 128 - 4
assets/script/game/ui/mail/MailDetail.ts

@@ -1,19 +1,96 @@
-import { _decorator, Node } from 'cc';
+import { _decorator, instantiate, Label, Node, Prefab, RichText, ScrollView, tween, UIOpacity, v3 } from 'cc';
 import { BaseView } from '../../../framework/layer/BaseView';
+import { Framework } from '../../../framework/Framework';
+import { StringUtil } from '../../../framework/util/StringUtil';
+import { ViewID } from '../../../framework/config/LayerConf';
+import { GameEvent } from '../../data/GameEvent';
+import { MailData } from '../../data/MailData';
+import { LoginMgr } from '../../common/LoginManager';
+import List from '../../../framework/list/List';
+import { CommonItem } from '../common/CommonItem';
 const { ccclass, property } = _decorator;
 
 @ccclass('MailDetail')
 export class MailDetail extends BaseView {
-    onLoad() {
+	@property({ type: Label, tooltip: "关闭提示" })
+	closeTips: Label = null;
+
+	@property({ type: Label, tooltip: "标题" })
+	titleTx: Label = null;
+
+	@property({ type: Label, tooltip: "发件人标题" })
+	fromTitle: Label = null;
+
+	@property({ type: Label, tooltip: "发件人文字" })
+	fromTx: Label = null;
+
+	@property({ type: Label, tooltip: "主题标题" })
+	captionTitle: Label = null;
+
+	@property({ type: Label, tooltip: "主题文字" })
+	captionTx: Label = null;
+
+	@property({ type: Label, tooltip: "邮件时间" })
+	timeTx: Label = null;
+
+	@property({ type: RichText, tooltip: "邮件内容" })
+	msgTx: RichText = null;
+
+	@property({ type: Node, tooltip: "附件背景" })
+	awardsBg: Node = null;
+
+	@property({ type: List, tooltip: "附件容器" })
+	awardsSv: List = null;
+
+	@property({ type: Label, tooltip: "附件标题" })
+	awardsTitle: Label = null;
+
+	@property({ type: Node, tooltip: "附件领取标记" })
+	getTips: Node = null;
+
+	@property({ type: Node, tooltip: "领取按钮" })
+	getBtn: Node = null;
+
+	@property({ type: Label, tooltip: "领取按钮文字" })
+	getBtnTx: Label = null;
+
+	@property({ type: Node, tooltip: "删除按钮" })
+	delBtn: Node = null;
+
+	@property({ type: Label, tooltip: "删除按钮文字" })
+	delBtnTx: Label = null;
+
+	private data = null;
+	onLoad() {
 		super.onLoad();
+		this.closeTips.string = StringUtil.getLanguageData('点击空白关闭');
+		this.titleTx.string = StringUtil.getLanguageData('邮件详情');
+		this.fromTitle.string = StringUtil.getLanguageData('来自');
+		this.captionTitle.string = StringUtil.getLanguageData('主题');
+		this.awardsTitle.string = StringUtil.getLanguageData('附件');
+		this.getTips.getComponent(Label).string = StringUtil.getLanguageData('附件已领取');
+		this.getBtnTx.string = StringUtil.getLanguageData('领取附件');
+		this.delBtnTx.string = StringUtil.getLanguageData('删除邮件');
+		let twinkle = (node)=>{
+			tween(this.closeTips.getComponent(UIOpacity)).to(1.2, { opacity: 10 })
+				.call(() => {
+					tween(this.closeTips.getComponent(UIOpacity)).to(1, { opacity: 255 })
+						.call(() => {
+							twinkle(this.closeTips);
+						}).start()
+				}).start()
+		}
+		twinkle(this.closeTips);
 	}
 
 	onDestroy() {
 		super.onDestroy();
 	}
 
-	onOpen() {
-
+	onOpen(data) {
+		console.log('============= detail open', data)
+		this.data = data;
+		this.updateUI();
 	}
 
 	onClose() {
@@ -29,8 +106,55 @@ export class MailDetail extends BaseView {
 	}
 
 	private onTouchButton(event: Event, customStr) {
+		let target: any = event.target;
+		if (target.name == 'mask') {
+			Framework.layer.close(this);
+
+		} else if (target.name == 'del_btn') {
+			LoginMgr.sendPost('user', 'batch_del_mail', (data) => {
+				console.log(data);
+				MailData.removeMail(data.del_mails);
+				Framework.event.fireEvent(GameEvent.MailUpdate);
+			}, { ids: [this.data.id] })
 
+		} else if (target.name == 'get_btn') {
+			LoginMgr.sendPost('user', 'read_mail', (data) => {
+				console.log(data);
+				MailData.setMailReadById(this.data.id)
+				Framework.event.fireEvent(GameEvent.MailUpdate);
+				Framework.layer.open(ViewID.MailDetail, null, this.data);
+			}, { id: this.data.id })
+		}
+
+	}
+
+	private updateUI() {
+		this.captionTx.string = MailData.getMailText(this.data.title, true);
+		let context = MailData.getMailText(this.data.content, false)
+		this.msgTx.string = `<b>${StringUtil.getLanguageData(context)}</b>`;
+
+		if (this.data.award && this.data.award.size > 0) {
+			this.awardsBg.active = true;
+			this.awardsSv.numItems = this.data.award.size;
+			if (Number(this.data.read) == 1) {
+				this.getBtn.active = false;
+				this.delBtn.active = true;
+				this.getTips.active = false;
+			} else {
+				this.getBtn.active = true;
+				this.delBtn.active = false;
+				this.getTips.active = false;
+			}
+		} else {
+			this.awardsBg.active = false;
+			this.getBtn.active = false;
+			this.delBtn.active = true;
+			this.getTips.active = false;
+		}
+	}
 
+	onEventList(item, idx) {
+		item.getComponent(CommonItem).refreshItem(this.data.award[idx]);
 	}
 }
 

+ 14 - 19
assets/script/game/ui/mail/MailItem.ts

@@ -4,7 +4,8 @@ import { StringUtil } from '../../../framework/util/StringUtil';
 import { MailData } from '../../data/MailData';
 import { Framework } from '../../../framework/Framework';
 import { ViewID } from '../../../framework/config/LayerConf';
-import { LoginManager } from '../../common/LoginManager';
+import { LoginMgr } from '../../common/LoginManager';
+import { GameEvent } from '../../data/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('MailItem')
@@ -43,7 +44,7 @@ export class MailItem extends ResKeeper {
 	refreshItem(data) {
 		this.data = data;
 
-		this.titleTx.string = data.title;
+		this.titleTx.string = MailData.getMailText(data.title,true);
 
 		this.maskImg.active = false;
 		this.readIco.active = false;
@@ -53,6 +54,7 @@ export class MailItem extends ResKeeper {
 		let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
 		let D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + '';
 		this.timeTx.string = Y + M + D;
+
 		if (data.award && data.award.size > 0) {
 			this.awardTips.active = false;
 			let showAward = MailData.getShowAward(data.id)
@@ -62,7 +64,7 @@ export class MailItem extends ResKeeper {
 			} else {
 				this.awardBg.active = true;
 				this.awardNode.active = false;
-				this.load('sub_bundle', 'mail/texture/mail_3/', SpriteFrame, (res: SpriteFrame) => {
+				this.load('mail', 'texture/mail_3/spriteFrame', SpriteFrame, (res: SpriteFrame) => {
 					this.awardBg.getComponent(Sprite).spriteFrame = res;
 				})
 			}
@@ -70,7 +72,7 @@ export class MailItem extends ResKeeper {
 			this.awardBg.active = true;
 			this.awardNode.active = false;
 			this.awardTips.active = false;
-			this.load('sub_bundle', 'mail/texture/mail_3', SpriteFrame, (res: SpriteFrame) => {
+			this.load('mail', 'texture/mail_3/spriteFrame', SpriteFrame, (res: SpriteFrame) => {
 				this.awardBg.getComponent(Sprite).spriteFrame = res;
 			})
 		}
@@ -81,7 +83,7 @@ export class MailItem extends ResKeeper {
 			this.awardTips.active = false;
 			this.readIco.active = true;
 			this.maskImg.active = true;
-			this.load('sub_bundle', 'mail/texture/mail_2', SpriteFrame, (res: SpriteFrame) => {
+			this.load('mail', 'texture/mail_2/spriteFrame', SpriteFrame, (res: SpriteFrame) => {
 				this.awardBg.getComponent(Sprite).spriteFrame = res;
 			})
 		}
@@ -99,27 +101,20 @@ export class MailItem extends ResKeeper {
 		let target: any = event.target;
 		if (target.name == 'bg') {
 			if (this.data.read == 1) {
+				console.log('=============== aa')
 				Framework.layer.open(ViewID.MailDetail, null, this.data);
 				return;
 			}
 			if (this.data.award && this.data.award.size > 0) {
+				console.log('=============== bb')
 				Framework.layer.open(ViewID.MailDetail, null, this.data);
 			} else {
-				// LoginManager.sendPost('user', 'read_mail', (data) => {
-				// 	// console.log(data);
-				// 	if (data.awards) {
-						
-				// 	}
-				// 	if (data.equip) {
-						
-				// 	}
-				// 	if (data.gem) {
-						
-				// 	}
-				// 	MailData.setMailReadById(data.id)
-
+				LoginMgr.sendPost('user', 'read_mail', (data) => {
+					console.log(data);
+					MailData.setMailReadById(data.id)
+					// Framework.event.fireEvent(GameEvent.MailUpdate);
 					Framework.layer.open(ViewID.MailDetail, null, this.data);
-				// }, { id: this.data.id })
+				}, { id: this.data.id })
 			}
 		}
 	}

+ 59 - 2
assets/script/game/ui/mail/MailMain.ts

@@ -1,4 +1,4 @@
-import { _decorator, Component, Label, Node } from 'cc';
+import { _decorator, Component, Label, Node, tween, UIOpacity } from 'cc';
 import { BaseView } from '../../../framework/layer/BaseView';
 import { MailItem } from './MailItem';
 import { StringUtil } from '../../../framework/util/StringUtil';
@@ -6,6 +6,7 @@ import { MailData } from '../../data/MailData';
 import { GlobalConf } from '../../config/GlobalConf';
 import List from '../../../framework/list/List';
 import { Framework } from '../../../framework/Framework';
+import { LoginMgr } from '../../common/LoginManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('MailMain')
@@ -48,6 +49,16 @@ export class MailMain extends BaseView {
 		this.noneTx.string = StringUtil.getLanguageData('当前空空如也哦~');
 		this.delAutoBtnTx.string = StringUtil.getLanguageData('一键删除');
 		this.getAutoBtnTx.string = StringUtil.getLanguageData('一键领取');
+		let twinkle = (node)=>{
+			tween(this.closeTips.getComponent(UIOpacity)).to(1.2, { opacity: 10 })
+				.call(() => {
+					tween(this.closeTips.getComponent(UIOpacity)).to(1, { opacity: 255 })
+						.call(() => {
+							twinkle(this.closeTips);
+						}).start()
+				}).start()
+		}
+		twinkle(this.closeTips);
 	}
 
 	onDestroy() {
@@ -57,6 +68,10 @@ export class MailMain extends BaseView {
 	onOpen() {
 		this.updateMainPanel();
 		this.updateMailNum();
+		Framework.event.addEvent("MailUpdate", () => {
+			this.updateMainPanel();
+			this.updateMailNum();
+        }, this);
 	}
 
 	onClose() {
@@ -75,10 +90,52 @@ export class MailMain extends BaseView {
 		let target: any = event.target;
 		if (target.name == 'mask') {
 			Framework.layer.close(this);
+
 		} else if (target.name == 'auto_del_btn') {
+			let ids = [];
+			let list = MailData.orderMail();
+			for (const v of list) {
+				if (Number(v.read) == 1) {
+					ids.push(v.id);
+				}
+			}
+
+			if (ids.length <= 0) {
+				Framework.tips.setTips(StringUtil.getLanguageData('暂无可删邮件!'));
+				return
+			}
+
+			LoginMgr.sendPost('user', 'batch_del_mail', (data) => {
+				console.log(data);
+				MailData.removeMail(data.del_mails);
+				this.updateMainPanel();
+				this.updateMailNum();
+			}, { ids: ids })
 
 		} else if (target.name == 'auto_get_btn') {
-
+			let ids = [];
+			let list = MailData.orderMail();
+
+			for (const v of list) {
+				if (Number(v.read) == 0 && v.awards && v.awards.size > 0) {
+					ids.push(v.id);
+				}
+			}
+			if (ids.length <= 0) {
+				Framework.tips.setTips(StringUtil.getLanguageData('暂无可领邮件!'));
+				return
+			}
+			LoginMgr.sendPost('user', 'batch_mail_awards', (data) => {
+				console.log(data);
+				for (const key in data.read_mails) {
+					if (Object.prototype.hasOwnProperty.call(data.read_mails, key)) {
+						const element = data.read_mails[key];
+						MailData.setMailReadById(key);
+						this.updateMainPanel();
+						this.updateMailNum();
+					}
+				}
+			}, { ids: ids })
 		}
 	}
 

La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 176 - 154
assets/sub_bundle/mail/prefab/MailDetail.prefab


La diferencia del archivo ha sido suprimido porque es demasiado grande
+ 179 - 157
assets/sub_bundle/mail/prefab/MailMain.prefab


+ 6 - 6
settings/v2/packages/information.json

@@ -4,19 +4,19 @@
     "customSplash": {
       "id": "customSplash",
       "label": "customSplash",
-      "enable": false,
+      "enable": true,
       "customSplash": {
-        "complete": false,
-        "form": "https://creator-api.cocos.com/api/form/show?"
+        "complete": true,
+        "form": "https://creator-api.cocos.com/api/form/show?sid=61fc1e00c14e22fd278f2d1609e9096d"
       }
     },
     "removeSplash": {
       "id": "removeSplash",
       "label": "removeSplash",
-      "enable": false,
+      "enable": true,
       "removeSplash": {
-        "complete": false,
-        "form": "https://creator-api.cocos.com/api/form/show?"
+        "complete": true,
+        "form": "https://creator-api.cocos.com/api/form/show?sid=61fc1e00c14e22fd278f2d1609e9096d"
       }
     }
   }

Algunos archivos no se mostraron porque demasiados archivos cambiaron en este cambio