future 1 жил өмнө
parent
commit
3ee560f0e5

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 525 - 105
assets/resources/ui/home.prefab


+ 4 - 4
assets/scene/main.scene

@@ -192,7 +192,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -290,7 +290,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 959.9999999999999,
+    "_orthoHeight": 960,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -561,7 +561,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -867,7 +867,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1919.9999999999998
+      "height": 1920
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 14 - 0
assets/script/GameManager.ts

@@ -225,6 +225,20 @@ export class GameManager extends Component {
         })
     }
 
+    // 设置用户已读小红点
+    public static requestUserSetReadRedDot(stype:number, cb) {
+        let opt = {'stype': stype}
+        http.post(config.API.user_up_red_dot, opt, (err,d)=>{
+            if(!err){
+                let nd = JSON.parse(d)
+                if(nd.code === config.status.SUCCESS){
+                    // console.log("设置小红点", nd.content)
+                    cb && cb()
+                }
+            }
+        })
+    }
+
     // 请求tt侧边栏用户奖励
     public static requestTTSidebarUserReward(status=config.USER_TT_SIDEBAR_REWARD.GET, success_cb, fail_cb=null) {
         if(sys.platform != sys.Platform.BYTEDANCE_MINI_GAME) {

+ 11 - 1
assets/script/config.ts

@@ -44,6 +44,8 @@ export class config  {
         sign_list:"/snake/user/sign_list",              //签到列表
         user_sign:"/snake/user/sign",                   //用户签到
         user_total_receive:"/snake/user/total_receive", //用户累计签到领取
+        user_red_dot:"/snake/user/red_dot",
+        user_up_red_dot:"/snake/user/up_red_dot",
     }
     public static STATIC_API = {
         sysconfig : "/snakestatic/sysconfig.json",
@@ -141,8 +143,11 @@ export class config  {
         UPDATE_USER_DEFAULT_CAR:"update_user_default_car",
         GAME_OVER_SETTLE_ACCOUNT:"game_over_settle_account",
         UPDATE_USER_INFO:"update_user_info",
+        UPDATE_SIGN_RED_DOT_STATUS:"update_sign_red_dot_status",
+        UPDATE_MAIL_RED_DOT_STATUS:"update_mail_red_dot_status",
+        UPDATE_ANNOUNCEMENT_RED_DOT_STATUS:"update_announcement_red_dot_status",
     }
-
+    
     public static EVENT_TYPE = {
         MSG_GUANGBO_RANK:"msg_guangbo_rank",
     }
@@ -190,6 +195,11 @@ export class config  {
         GET: 0,       //获取
         SYNC: 1,      //同步
     }
+
+    public static RED_DOT_TYPE = {
+        mail:1,           //邮件
+        announcement:2,   //公告
+    }
 }
 
 

+ 6 - 0
assets/script/data.ts

@@ -127,6 +127,12 @@ export class user_free_ads_data{
     public is_look_video_infinite_count_reward:boolean = false //是否看广告的无限次数奖励
 }
 
+export class user_red_dot_data {
+    public mail_red_dot:number = 0       //邮件 0:没有 1:红点 
+    public bulletin_red_dot:number = 0   //公告 0:没有 1:红点 
+    public sign_red_dot:number = 0       //签到 0:没有 1:红点 
+}
+
 export enum car_type {
     score = 0,
     suipian = 1,

+ 2 - 1
assets/script/tools.ts

@@ -1,6 +1,6 @@
 import { _decorator, assetManager, Component, ImageAsset, instantiate, Label, Node, Prefab, resources, SpriteFrame, sys, Texture2D } from 'cc';
 import { config } from './config';
-import { car_item_data, edit_game_config_data, model_item_data, rankData, sysConfig, userData } from './data';
+import { car_item_data, edit_game_config_data, model_item_data, rankData, sysConfig, user_red_dot_data, userData } from './data';
 import { game } from './game/game';
 import { Util } from './util';
 const { ccclass, property } = _decorator;
@@ -15,6 +15,7 @@ export class tools  {
     public static all_car_list:car_item_data[] =[]
     public static all_car_map:Map<number,car_item_data> = new Map
     public static all_car_page_list = []
+    public static user_red_dot_data:user_red_dot_data = new user_red_dot_data
     public static init(n:Node){
         tools.parent = n
     }

+ 21 - 2
assets/script/ui/home/home.ts

@@ -9,6 +9,7 @@ import { config } from '../../config';
 import { userDataManager } from '../../manager/userDataManager';
 import { user_results } from '../../data';
 import { GameManager } from '../../GameManager';
+import { home_modules } from './home_modules';
 const { ccclass, property } = _decorator;
 
 @ccclass('home')
@@ -16,6 +17,7 @@ export class home extends Component {
     @property(Node) home_car:Node = null
     @property(Node) top:Node = null
     @property(Node) bottom:Node = null
+    @property(Node) modules:Node = null
     @property(Node) btn_start_game:Node = null
 
     protected start(): void {
@@ -27,13 +29,17 @@ export class home extends Component {
                 this.node.parent.active = false
             })
         })
+        
+        ClientEvent.on(config.UI_EVENT.GAME_OVER_SETTLE_ACCOUNT,this.onGameOverSettleAccount.bind(this),this)
         ClientEvent.on(config.UI_EVENT.GET_NEW_CAR,this.onGetNewCar.bind(this),this)
         ClientEvent.on(config.UI_EVENT.UPDATE_USER_DEFAULT_CAR,this.onUpdateUserDefaultCar.bind(this),this)
-        ClientEvent.on(config.UI_EVENT.GAME_OVER_SETTLE_ACCOUNT,this.onGameOverSettleAccount.bind(this),this)
         ClientEvent.on(config.EVENT_TYPE.MSG_GUANGBO_RANK,this.onMsgGuangboRank.bind(this),this)
         ClientEvent.on(config.UI_EVENT.UPDATE_USER_INFO,this.onUpdateUserInfo.bind(this),this)
+        ClientEvent.on(config.UI_EVENT.UPDATE_SIGN_RED_DOT_STATUS,this.onUpdateSignRedDotStatus.bind(this),this)
+        ClientEvent.on(config.UI_EVENT.UPDATE_MAIL_RED_DOT_STATUS,this.onUpdateMailRedDotStatus.bind(this),this)
+        ClientEvent.on(config.UI_EVENT.UPDATE_ANNOUNCEMENT_RED_DOT_STATUS,this.onUpdateAnnouncementRedDotStatus.bind(this),this)
     }
-
+    
     onGameOverSettleAccount(res:user_results){
         // 更新本周分数、荣誉
         tools.mine_rank_data.score = res.max_integral
@@ -82,10 +88,23 @@ export class home extends Component {
         this.top.getComponent(home_top).reloadUserInfo()
     }
 
+    onUpdateSignRedDotStatus(is_show:boolean) {
+        this.modules.getComponent(home_modules).showRedDotQiandao(is_show)
+    }
+
+    onUpdateMailRedDotStatus(is_show:boolean) {
+        this.modules.getComponent(home_modules).showRedDotYoujian(is_show)
+    }
+
+    onUpdateAnnouncementRedDotStatus(is_show:boolean) {
+        this.modules.getComponent(home_modules).showRedDotGonggao(is_show)
+    }
+
     public init(){
         this.top.getComponent(home_top).init()
         this.home_car.getComponent(home_car).updateCar()
         this.bottom.getComponent(home_bottom).init()
+        this.modules.getComponent(home_modules).init()
     }
 }
 

+ 31 - 0
assets/script/ui/home/home_modules.ts

@@ -2,6 +2,8 @@ import { _decorator, Component, Node, Animation } from 'cc';
 import { base_ui } from '../../fw/base_ui';
 import { uiManager } from '../../manager/uiManager';
 import { config } from '../../config';
+import { home_modules_more } from './home_modules_more';
+import { tools } from '../../tools';
 const { ccclass, property } = _decorator;
 
 @ccclass('home_modules')
@@ -12,6 +14,9 @@ export class home_modules extends base_ui {
     @property(Node) btn_beibao:Node = null
     @property(Node) node_gengduo:Node = null
 
+    @property(Node) img_dot_qiandao:Node = null
+    @property(Node) img_dot_gengduo:Node = null
+
     start() {
         this.onButtonListen(this.btn_qiandao, ()=>{
             uiManager.Instance().showUi(config.UI.ui_sign_view)
@@ -36,6 +41,13 @@ export class home_modules extends base_ui {
         this.startAnimation()
     }
 
+    public init() {
+        let data = tools.user_red_dot_data
+        this.showRedDotQiandao(data.sign_red_dot==1?true:false)
+        this.showRedDotYoujian(data.mail_red_dot==1?true:false)
+        this.showRedDotGonggao(data.bulletin_red_dot==1?true:false)
+    }
+
     private startAnimation() {
         setTimeout(()=>{
             this.btn_qiandao.getComponent(Animation).play()
@@ -44,5 +56,24 @@ export class home_modules extends base_ui {
             this.btn_beibao.getComponent(Animation).play()
         },200)
     }
+    
+    public showRedDotQiandao(is_show:boolean) {
+        this.img_dot_qiandao.active = is_show
+    }
+
+    public showRedDotYoujian(is_show:boolean) {
+        this.node_gengduo.getComponent(home_modules_more).showRedDotYoujian(is_show)
+        this.checkRedDotMore()
+    }
+
+    public showRedDotGonggao(is_show:boolean) {
+        this.node_gengduo.getComponent(home_modules_more).showRedDotGonggao(is_show)
+        this.checkRedDotMore()
+    }
+
+    private checkRedDotMore() {
+       let is_show = this.node_gengduo.getComponent(home_modules_more).getDotAllShow()
+       this.img_dot_gengduo.active = is_show
+    }
 }
 

+ 20 - 0
assets/script/ui/home/home_modules_more.ts

@@ -10,6 +10,10 @@ export class home_modules_more extends base_ui {
     @property(Node) btn_gonggao:Node = null
     @property(Node) btn_fankui:Node = null
     @property(Node) btn_shezhi:Node = null
+
+    @property(Node) img_dot_youjian:Node = null
+    @property(Node) img_dot_gonggao:Node = null
+
     start() {
         this.onButtonListen(this.btn_youjian, ()=>{
             uiManager.Instance().showUi(config.UI.ui_mailbox)
@@ -24,6 +28,22 @@ export class home_modules_more extends base_ui {
             uiManager.Instance().showUi(config.UI.ui_setting)
         })
     }
+
+    public showRedDotYoujian(is_show:boolean) {
+        this.img_dot_youjian.active = is_show
+    }
+
+    public showRedDotGonggao(is_show:boolean) {
+        this.img_dot_gonggao.active = is_show
+    }
+
+    public getDotAllShow():boolean {
+        let is_show = false
+        if(this.img_dot_gonggao.active && this.img_dot_gonggao.active) {
+            return true
+        }
+        return is_show
+    }
     
 }
 

+ 23 - 0
assets/script/ui/loading_view.ts

@@ -96,6 +96,12 @@ export class loading_view extends Component {
                     })
                     break
                 case 0.7:
+                    this.m_pause_status = true
+                    this.initUserRedDotData(()=>{
+                        this.m_pause_status = false
+                    })
+                    break
+                case 0.8:
                     this.m_pause_status = true
                     imageCacheManager.start_cache(()=>{
                         this.m_pause_status = false
@@ -276,5 +282,22 @@ export class loading_view extends Component {
         })
     }
 
+    private initUserRedDotData(cb) {
+        http.post(config.API.user_red_dot, null, (err,d)=>{
+            if(!err){
+                let data = JSON.parse(d)
+                if(data.code===config.status.SUCCESS){
+                    tools.user_red_dot_data = data.content
+                    // console.log("tools.user_red_dot_data",tools.user_red_dot_data)
+                    if(cb!=null) {
+                        cb()
+                    }
+                }
+            }else{
+                console.log("init userRedDotData err",err)
+            }
+        },'GET')
+    }
+
 }
 

+ 1 - 1
assets/script/ui/sign_view/sign_total_reward.ts

@@ -20,7 +20,7 @@ export class sign_total_reward extends Component {
     initView(total_number:number, data_list:sign_total_reward_data[], cb) {
         this.m_cb = cb
         this.content.removeAllChildren()
-        let curr_day = total_number  // 模拟
+        let curr_day = total_number 
         for (let i = 0; i < 7; i++) {
             let is_hav = false
             for (let index = 0; index < data_list.length; index++) {

+ 25 - 2
assets/script/ui/sign_view/sign_view.ts

@@ -7,6 +7,7 @@ import { sign_total_reward } from './sign_total_reward';
 import { sign_reward_data, sign_total_reward_data } from '../../data';
 import { sign_receive_reward } from './sign_receive_reward';
 import { GameManager } from '../../GameManager';
+import { ClientEvent } from '../../lib/clientEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('sign_view')
@@ -36,7 +37,7 @@ export class sign_view extends base_ui {
         })
     }
 
-    private requestSignListData() {
+    private requestSignListData(cb=null) {
         http.post(config.API.sign_list,null,(err,d)=>{
             if(!err){
                 let nd = JSON.parse(d)
@@ -45,6 +46,7 @@ export class sign_view extends base_ui {
                     let total_sign_number = nd.content.total_sign_number
                     this.reward_node.getComponent(sign_reward).initView(nd.content.sign_reward_list,this.onRewardCallBack.bind(this),this.onClickRewardItem.bind(this))
                     this.total_reward_node.getComponent(sign_total_reward).initView(total_sign_number, nd.content.sign_total_reward_list,this.onClickTotalRewardItem.bind(this))
+                    cb && cb(nd.content)
                 }
             }
         },'GET')
@@ -93,9 +95,30 @@ export class sign_view extends base_ui {
     private showReceiveReward(data:sign_reward_data) {
         this.receive_reward.active = true
         this.receive_reward.getComponent(sign_receive_reward).initView(data, (v:sign_receive_reward)=>{
-            this.requestSignListData()
+            this.requestSignListData((data)=>{
+                this.checkSignAll(data)
+            })
         })
     }
 
+    private checkSignAll(data) {
+        let list:sign_reward_data[] = data.sign_reward_list
+        let is_sign_all = true
+        for (let index = 0; index < list.length; index++) {
+            const element = list[index];
+            if(element.current_sign_status==0&&element.repair_sign_status==1)  {
+                is_sign_all = false
+                break
+            }
+            if(element.current_sign_status==1&&element.receive_status==0) {
+                is_sign_all = false
+                break
+            }
+        }
+        if(is_sign_all) {
+            ClientEvent.dispatchEvent(config.UI_EVENT.UPDATE_SIGN_RED_DOT_STATUS,false)
+        }
+    }
+
 }
 

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно