future 1 年間 前
コミット
673e48f0f1

ファイルの差分が大きいため隠しています
+ 192 - 159
assets/resources/ui/car_info.prefab


+ 8 - 8
assets/resources/ui/car_lib.prefab

@@ -106,7 +106,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 814.5,
+      "y": 814.4999999999999,
       "z": 0
     },
     "_lrot": {
@@ -525,7 +525,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 232,
+      "y": 231.9999999999999,
       "z": 0
     },
     "_lrot": {
@@ -3497,7 +3497,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": 340,
+      "y": 339.9999999999999,
       "z": 0
     },
     "_lrot": {
@@ -4801,7 +4801,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 0,
-      "height": 680
+      "height": 679.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -4916,7 +4916,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 680
+      "height": 679.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -5181,7 +5181,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 680
+      "height": 679.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -5344,7 +5344,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 760
+      "height": 759.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -5503,7 +5503,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920
+      "height": 1919.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 4 - 4
assets/resources/ui/car_lib_list_item.prefab

@@ -234,7 +234,7 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": -79.75,
+      "x": -95.75,
       "y": -110,
       "z": 0
     },
@@ -275,7 +275,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 260,
+      "width": 230,
       "height": 50.4
     },
     "_anchorPoint": {
@@ -393,7 +393,7 @@
     },
     "_lpos": {
       "__type__": "cc.Vec3",
-      "x": 136.5,
+      "x": 119.5,
       "y": -110,
       "z": 0
     },
@@ -434,7 +434,7 @@
     },
     "_contentSize": {
       "__type__": "cc.Size",
-      "width": 160,
+      "width": 200,
       "height": 50.4
     },
     "_anchorPoint": {

+ 5 - 5
assets/scene/main.scene

@@ -105,7 +105,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 540,
-      "y": 960.0000000000002,
+      "y": 960,
       "z": 0
     },
     "_lrot": {
@@ -192,7 +192,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1919.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -290,7 +290,7 @@
     "_priority": 0,
     "_fov": 45,
     "_fovAxis": 0,
-    "_orthoHeight": 960.0000000000001,
+    "_orthoHeight": 959.9999999999999,
     "_near": 0,
     "_far": 1000,
     "_color": {
@@ -561,7 +561,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1919.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -867,7 +867,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 1080,
-      "height": 1920.0000000000002
+      "height": 1919.9999999999998
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 15 - 0
assets/script/GameManager.ts

@@ -181,6 +181,20 @@ export class GameManager extends Component {
         },'GET')
     }
 
+    // 背包列表
+    public static requestBagList(stype_id:number, cb) {
+        let opt = {'stype_id':stype_id}
+        http.post(config.API.bag_list, opt, (err,d)=>{
+            if(!err){
+                let nd = JSON.parse(d)
+                if(nd.code === config.status.SUCCESS){
+                    // console.log("bag_list", nd.content)
+                    cb && cb(nd.content)
+                }
+            }
+        })
+    }
+
     // 请求tt侧边栏用户奖励
     public static requestTTSidebarUserReward(status=config.USER_TT_SIDEBAR_REWARD.GET, success_cb, fail_cb=null) {
         if(sys.platform != sys.Platform.BYTEDANCE_MINI_GAME) {
@@ -246,6 +260,7 @@ export class GameManager extends Component {
             }
         })
     }
+
 }
 
 

+ 1 - 0
assets/script/data.ts

@@ -137,6 +137,7 @@ export class car_item_data{
     public stype:number = car_type.score;  // 0:分数车 1:碎片兑换
     public attribute:car_item_attribute_data = new car_item_attribute_data() //属性
     public background_cover:string = "";
+    public temp_bag_list_item_data:bag_list_item_data = null //临时背包列表数据(车库背包碎片)
 }
 
 export class car_item_attribute_data {

+ 13 - 0
assets/script/manager/dataManager.ts

@@ -60,6 +60,19 @@ export class dataManager  {
         return car_item
     }
 
+    // 用户列车表中有车
+    public static userCarListHavCar(car_id:number):boolean {
+      let on_car = false
+      for (let index = 0; index < userDataManager.user_car_list.car_list.length; index++) {
+        const element = userDataManager.user_car_list.car_list[index];
+        if(element==car_id) {
+          on_car = true
+          break
+        }
+      }
+      return on_car
+    }
+
     // 获取游戏结束提示索引
     public static getGameEndPrompt(score:number):number {
       let cur_index = -1

+ 5 - 10
assets/script/ui/bag/bag.ts

@@ -5,6 +5,7 @@ import { config } from '../../config';
 import { bag_list_item_data, bag_type_item_data } from '../../data';
 import { bag_type_item } from './bag_type_item';
 import { bag_list_page } from './bag_list_page';
+import { GameManager } from '../../GameManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('bag')
@@ -72,16 +73,10 @@ export class bag extends Component {
     }
 
     private requestContentList() {
-        let opt = {'stype_id':this.cur_type_item.getData().id}
-        http.post(config.API.bag_list, opt, (err,d)=>{
-            if(!err){
-                let nd = JSON.parse(d)
-                if(nd.code === config.status.SUCCESS){
-                    // console.log("bag_list", nd.content)
-                    this.data_list = nd.content
-                    this.loadListView()                    
-                }
-            }
+        let id = this.cur_type_item.getData().id
+        GameManager.requestBagList(id, (d_list)=>{
+            this.data_list = d_list
+            this.loadListView()
         })
     }
 

+ 9 - 0
assets/script/ui/car_info.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "1.2.0",
+  "importer": "directory",
+  "imported": true,
+  "uuid": "52b1b905-9c9d-4d23-a063-adc2385a662d",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 0 - 114
assets/script/ui/car_info.ts

@@ -1,114 +0,0 @@
-import { _decorator, Component, Label, Node, Sprite } from 'cc';
-import { base_ui } from '../fw/base_ui';
-import { car_item_data, car_type } from '../data';
-import { imageCacheManager } from '../manager/imageCacheManager';
-import { userDataManager } from '../manager/userDataManager';
-const { ccclass, property } = _decorator;
-
-@ccclass('car_info')
-export class car_info extends base_ui {
-    @property(Node) btn_close:Node = null
-    @property(Node) lab_xiangcha_score:Node = null
-    @property(Node) img_car:Node = null
-    @property(Node) lab_car_name:Node = null
-    @property(Node) lab_score:Node = null
-
-    @property(Node) img_suo:Node = null
-
-    @property(Node) node_chongci:Node = null
-    @property(Node) lab_chongci:Node = null
-
-    @property(Node) node_qiyou:Node = null
-    @property(Node) lab_qiyou:Node = null
-
-    @property(Node) node_dunpai:Node = null
-    @property(Node) lab_dunpai:Node = null
-
-    @property(Node) node_xingxing:Node = null
-    @property(Node) lab_xingxing:Node = null
-
-    @property(Node) node_citie:Node = null
-    @property(Node) lab_citie:Node = null
-
-    @property(Node) lab_no_shuxing:Node = null
-
-    start() {
-        this.onButtonListen(this.btn_close, ()=>{
-            this.close()
-        })
-    }
-
-    initView(data:car_item_data, is_jiesuo:boolean) {
-        if(is_jiesuo) {
-            this.img_suo.active = false
-            this.lab_car_name.active = false
-            this.lab_xiangcha_score.getComponent(Label).string = data.name
-        } else {
-            if(data.stype==car_type.score) {
-                let xiangcha_score = data.unlock_points - userDataManager.user_car_list.max_integral
-                if(xiangcha_score<0) {
-                    xiangcha_score = 0
-                }
-                this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 分`
-            } else {
-                let xiangcha_score = 100
-                this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 碎片`
-            }
-            this.img_suo.active = true
-            this.lab_car_name.active = true
-            this.lab_car_name.getComponent(Label).string = data.name
-        }
-        
-        this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.id)
-
-        if(data.stype==car_type.score) {
-            this.lab_score.getComponent(Label).string = data.unlock_points + '分解锁'
-        } else {            
-            this.lab_score.getComponent(Label).string = `已集齐 ${0} / ${data.unlock_points}`
-        }
-
-        let count = 0
-        if(data.attribute.k_sprint_cd<=0) { 
-            this.node_chongci.active = false 
-        } else {
-            count+=1
-            this.lab_chongci.getComponent(Label).string = `+${data.attribute.k_sprint_cd}秒`
-        }
-
-        if(data.attribute.k_oil_number<=0) { 
-            this.node_qiyou.active = false 
-        } else {
-            count+=1
-            this.lab_qiyou.getComponent(Label).string = `+${data.attribute.k_oil_number}桶`
-        }
-
-        if(data.attribute.n_shield_cd==0) { 
-            this.node_dunpai.active = false 
-        } else {
-            count+=1
-            this.lab_dunpai.getComponent(Label).string = `+${data.attribute.n_shield_cd}秒`
-        }
-
-        if(data.attribute.n_star_cd==0) { 
-            this.node_xingxing.active = false 
-        } else {
-            count+=1
-            this.lab_xingxing.getComponent(Label).string = `+${data.attribute.n_star_cd}秒`
-        }
-
-        if(data.attribute.n_magnet_cd==0) { 
-            this.node_citie.active = false 
-        } else {
-            count+=1
-            this.lab_citie.getComponent(Label).string = `+${data.attribute.n_magnet_cd}秒`
-        }
-
-        if(count==0) {
-            this.lab_no_shuxing.active = true
-        } else {
-            this.lab_no_shuxing.active = false
-        }
-
-    }
-}
-

+ 147 - 0
assets/script/ui/car_info/car_info.ts

@@ -0,0 +1,147 @@
+import { _decorator, Component, Label, Node, Sprite } from 'cc';
+import { base_ui } from '../../fw/base_ui';
+import { car_item_data, car_type } from '../../data';
+import { imageCacheManager } from '../../manager/imageCacheManager';
+import { userDataManager } from '../../manager/userDataManager';
+import { car_info_shuxing } from './car_info_shuxing';
+import { dataManager } from '../../manager/dataManager';
+const { ccclass, property } = _decorator;
+
+@ccclass('car_info')
+export class car_info extends base_ui {
+    @property(Node) public_bg:Node = null
+    @property(Node) btn_close:Node = null
+    @property(Node) lab_xiangcha_score:Node = null
+    @property(Node) img_car:Node = null
+    @property(Node) lab_car_name:Node = null
+    @property(Node) lab_score:Node = null
+
+    @property(Node) img_suo:Node = null
+    @property(Node) shuxing_info:Node = null
+
+    @property(Node) operate_btn_node:Node = null
+    @property(Node) btn_zhuangbei:Node = null
+    @property(Node) btn_duihuang:Node = null
+
+    @property(Node) get_suipian_node:Node = null
+    @property(Node) btn_look_video:Node = null
+    @property(Node) btn_share:Node = null
+
+    private m_data:car_item_data = null
+    private m_zhuangbei_cb = null
+    private m_duihuan_cb = null
+    private m_look_video_cb = null
+    private m_share_cb = null
+
+    start() {
+        this.onButtonListen(this.public_bg, ()=>{
+            this.close()
+        })
+        this.onButtonListen(this.btn_close, ()=>{
+            this.close()
+        })
+        this.onButtonListen(this.btn_zhuangbei, ()=>{
+            this.close()
+            this.m_zhuangbei_cb && this.m_zhuangbei_cb(this)
+        })
+        this.onButtonListen(this.btn_duihuang, ()=>{
+            this.close()
+            this.m_duihuan_cb && this.m_duihuan_cb(this)
+        })
+        this.onButtonListen(this.btn_look_video, ()=>{
+            this.m_look_video_cb && this.m_look_video_cb(this)
+        })
+        this.onButtonListen(this.btn_share, ()=>{
+            this.m_share_cb && this.m_share_cb(this)
+        })
+    }
+
+    public initView(data:car_item_data, is_jiesuo:boolean) {
+        this.m_data = data
+        if(is_jiesuo) {
+            this.img_suo.active = false
+            this.lab_car_name.active = false
+            this.lab_xiangcha_score.getComponent(Label).string = data.name
+            this.lab_score.getComponent(Label).string = userDataManager.user_data.license_code
+        } else {
+            if(data.stype==car_type.score) {
+                let xiangcha_score = data.unlock_points - userDataManager.user_car_list.max_integral
+                if(xiangcha_score<0) {
+                    xiangcha_score = 0
+                }
+                this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 分`
+                this.lab_score.getComponent(Label).string = data.unlock_points + '分解锁'
+            } else {
+                let cur_count = data.temp_bag_list_item_data.quantity
+                let xiangcha_score = data.unlock_points - cur_count
+                if(xiangcha_score<0) {
+                    xiangcha_score = 0
+                }
+                this.lab_xiangcha_score.getComponent(Label).string = `距离解锁还差 ${xiangcha_score} 碎片`
+                this.lab_score.getComponent(Label).string = `已集齐 ${cur_count} / ${data.unlock_points}碎片`
+            }
+            this.img_suo.active = true
+            this.lab_car_name.active = true
+            this.lab_car_name.getComponent(Label).string = data.name
+        }
+        
+        this.img_car.getComponent(Sprite).spriteFrame = imageCacheManager.getRankCarImageById(data.id)
+
+        this.shuxing_info.getComponent(car_info_shuxing).initView(data)
+
+        this.operate_btn_node.active = false
+        this.get_suipian_node.active = false
+        if(is_jiesuo) {
+            this.showOperateNode(true)
+            if(userDataManager.user_car_list.default_car_id==data.id) {
+                this.btn_zhuangbei.active = false
+            } else {
+                this.btn_zhuangbei.active = true
+            }
+            this.btn_duihuang.active = false
+        } else {
+            if(data.stype==car_type.suipian) {
+                if(dataManager.userCarListHavCar(data.id)) {
+                    this.showOperateNode(true)
+                    this.btn_zhuangbei.active = true
+                    this.btn_duihuang.active = false
+                } else {
+                    let cur_count = data.temp_bag_list_item_data.quantity
+                    if(cur_count-data.unlock_points>=0) {
+                        this.showOperateNode(true)
+                        this.btn_zhuangbei.active = false
+                        this.btn_duihuang.active = true
+                    } else {
+                        // 看视频/分享 碎片
+                        this.showOperateNode(false)
+                    }
+                }
+            }
+        }
+    }
+
+    public initOperateNodeCallback(zhuangbei_cb, duihuan_cb) {
+        this.m_zhuangbei_cb = zhuangbei_cb
+        this.m_duihuan_cb = duihuan_cb
+    }
+
+    public initGetSuipianNodeCallback(look_video_cb, share_cb) {
+        this.m_look_video_cb = look_video_cb
+        this.m_share_cb = share_cb
+    }
+
+    public getData():car_item_data {
+        return this.m_data
+    }
+
+    private showOperateNode(is_show:boolean) {
+        if(is_show) {
+            this.operate_btn_node.active = true
+            this.get_suipian_node.active = false
+        } else {
+            this.operate_btn_node.active = false
+            this.get_suipian_node.active = true
+        }
+    }
+}
+

+ 0 - 0
assets/script/ui/car_info.ts.meta → assets/script/ui/car_info/car_info.ts.meta


+ 68 - 0
assets/script/ui/car_info/car_info_shuxing.ts

@@ -0,0 +1,68 @@
+import { _decorator, Component, Label, Node } from 'cc';
+import { car_item_data } from '../../data';
+const { ccclass, property } = _decorator;
+
+@ccclass('car_info_shuxing')
+export class car_info_shuxing extends Component {
+    @property(Node) node_chongci:Node = null
+    @property(Node) lab_chongci:Node = null
+
+    @property(Node) node_qiyou:Node = null
+    @property(Node) lab_qiyou:Node = null
+
+    @property(Node) node_dunpai:Node = null
+    @property(Node) lab_dunpai:Node = null
+
+    @property(Node) node_xingxing:Node = null
+    @property(Node) lab_xingxing:Node = null
+
+    @property(Node) node_citie:Node = null
+    @property(Node) lab_citie:Node = null
+
+    @property(Node) lab_no_shuxing:Node = null
+
+    initView(data:car_item_data) {
+        let count = 0
+        if(data.attribute.k_sprint_cd<=0) { 
+            this.node_chongci.active = false 
+        } else {
+            count+=1
+            this.lab_chongci.getComponent(Label).string = `+${data.attribute.k_sprint_cd}秒`
+        }
+
+        if(data.attribute.k_oil_number<=0) { 
+            this.node_qiyou.active = false 
+        } else {
+            count+=1
+            this.lab_qiyou.getComponent(Label).string = `+${data.attribute.k_oil_number}桶`
+        }
+
+        if(data.attribute.n_shield_cd==0) { 
+            this.node_dunpai.active = false 
+        } else {
+            count+=1
+            this.lab_dunpai.getComponent(Label).string = `+${data.attribute.n_shield_cd}秒`
+        }
+
+        if(data.attribute.n_star_cd==0) { 
+            this.node_xingxing.active = false 
+        } else {
+            count+=1
+            this.lab_xingxing.getComponent(Label).string = `+${data.attribute.n_star_cd}秒`
+        }
+
+        if(data.attribute.n_magnet_cd==0) { 
+            this.node_citie.active = false 
+        } else {
+            count+=1
+            this.lab_citie.getComponent(Label).string = `+${data.attribute.n_magnet_cd}秒`
+        }
+
+        if(count==0) {
+            this.lab_no_shuxing.active = true
+        } else {
+            this.lab_no_shuxing.active = false
+        }
+    }
+}
+

+ 9 - 0
assets/script/ui/car_info/car_info_shuxing.ts.meta

@@ -0,0 +1,9 @@
+{
+  "ver": "4.0.23",
+  "importer": "typescript",
+  "imported": true,
+  "uuid": "785e648c-6ea2-4fdb-a313-d3421d69b726",
+  "files": [],
+  "subMetas": {},
+  "userData": {}
+}

+ 55 - 25
assets/script/ui/car_lib/car_lib_bottom.ts

@@ -5,7 +5,9 @@ import { car_lib_list_item } from './car_lib_list_item';
 import { car_lib_page_item } from './car_lib_page_item';
 import { uiManager } from '../../manager/uiManager';
 import { config } from '../../config';
-import { car_info } from '../car_info';
+import { GameManager } from '../../GameManager';
+import { bag_type } from '../../data';
+import { car_info } from '../car_info/car_info';
 const { ccclass, property } = _decorator;
 
 @ccclass('car_lib_bottom')
@@ -51,12 +53,16 @@ export class car_lib_bottom extends base_ui {
         this.num_total_count = tools.all_car_page_list.length
         this.updateNumStatus()
 
-        for (let index = 0; index < this.num_total_count; index++) {
-            let page = instantiate(this.pageView_page_item)
-            let data_list = tools.all_car_page_list[index]
-            page.getComponent(car_lib_page_item).init(this.pageView, index,data_list, this.onSelectedItem.bind(this), this.onClickListItem.bind(this))
-            this.pageView.getComponent(PageView).addPage(page)
-        }
+        let id = bag_type.car_suipian
+        GameManager.requestBagList(id, (car_suipian_list)=>{
+            // console.log('car_suipian_list=',car_suipian_list)
+            for (let index = 0; index < this.num_total_count; index++) {
+                let page = instantiate(this.pageView_page_item)
+                let data_list = tools.all_car_page_list[index]
+                page.getComponent(car_lib_page_item).init(this.pageView, index,data_list, car_suipian_list, this.onSelectedItem.bind(this), this.onClickListItem.bind(this))
+                this.pageView.getComponent(PageView).addPage(page)
+            }
+        })
     }
 
     private getNumCurrentIndex():number {
@@ -81,28 +87,52 @@ export class car_lib_bottom extends base_ui {
     }
 
     private onClickListItem(page_item:car_lib_page_item,list_item:car_lib_list_item) {
-        if(this.current_select_list_item!=null) {
-            if(this.current_select_list_item.getData().id == list_item.getData().id) {
-                return
-            }
-        }
+        uiManager.Instance().showUi(config.UI.ui_car_info, null, (node:Node)=>{
+            let car_info_component = node.getComponent(car_info)
+            car_info_component.initView(list_item.getData(),list_item.getIsJiesuo())
+            car_info_component.initOperateNodeCallback((v:car_info)=>{
+                // 装备
+                if(this.current_select_list_item!=null) {
+                    this.current_select_list_item.setUnselectedStatus()
+                }
+                list_item.setSelectedStatus()
+                this.current_select_list_item = list_item
         
-        if(list_item.getIsJiesuo()==false) {
-            uiManager.Instance().showUi(config.UI.ui_car_info, null, (node:Node)=>{
-                node.getComponent(car_info).initView(list_item.getData(),list_item.getIsJiesuo())
+                if(this.m_click_item_cb!=null) {
+                    this.m_click_item_cb(list_item)
+                }
+            },(v:car_info)=>{
+                // 兑换
             })
-            return
-        }
+            car_info_component.initGetSuipianNodeCallback((v:car_info)=>{
+                // 看视频
+            }, (v:car_info)=>{
+                // 分享
+            })
+        })
 
-        if(this.current_select_list_item!=null) {
-            this.current_select_list_item.setUnselectedStatus()
-        }
-        list_item.setSelectedStatus()
-        this.current_select_list_item = list_item
+        // if(this.current_select_list_item!=null) {
+        //     if(this.current_select_list_item.getData().id == list_item.getData().id) {
+        //         return
+        //     }
+        // }
+        
+        // if(list_item.getIsJiesuo()==false) {
+        //     uiManager.Instance().showUi(config.UI.ui_car_info, null, (node:Node)=>{
+        //         node.getComponent(car_info).initView(list_item.getData(),list_item.getIsJiesuo())
+        //     })
+        //     return
+        // }
 
-        if(this.m_click_item_cb!=null) {
-            this.m_click_item_cb(list_item)
-        }
+        // if(this.current_select_list_item!=null) {
+        //     this.current_select_list_item.setUnselectedStatus()
+        // }
+        // list_item.setSelectedStatus()
+        // this.current_select_list_item = list_item
+
+        // if(this.m_click_item_cb!=null) {
+        //     this.m_click_item_cb(list_item)
+        // }
     }
 }
 

+ 2 - 2
assets/script/ui/car_lib/car_lib_list_item.ts

@@ -1,7 +1,6 @@
 import { _decorator, Component, Label, Node, Sprite, SpriteFrame } from 'cc';
 import { car_item_data, car_type } from '../../data';
 import { uiManager } from '../../manager/uiManager';
-import { GameManager } from '../../GameManager';
 import { dataManager } from '../../manager/dataManager';
 const { ccclass, property } = _decorator;
 
@@ -36,7 +35,8 @@ export class car_lib_list_item extends Component {
             this.lab_car_score.getComponent(Label).string = data.unlock_points + '分'
             this.img_kuang.active = false
         } else {
-            this.lab_car_score.getComponent(Label).string = data.unlock_points + '碎片'
+            let string = `${data.temp_bag_list_item_data.quantity}/${data.unlock_points}碎片`
+            this.lab_car_score.getComponent(Label).string = string
             this.img_kuang.active = true
         }
     }

+ 36 - 3
assets/script/ui/car_lib/car_lib_page_item.ts

@@ -1,7 +1,8 @@
 import { _decorator, Component, EventTouch, instantiate, Layout, Node, PageView, Prefab, UITransform, Vec2 } from 'cc';
-import { car_item_data } from '../../data';
+import { bag_list_item_data, car_item_data, car_type } from '../../data';
 import { userDataManager } from '../../manager/userDataManager';
 import { car_lib_list_item } from './car_lib_list_item';
+import { dataManager } from '../../manager/dataManager';
 const { ccclass, property } = _decorator;
 
 @ccclass('car_lib_page_item')
@@ -76,7 +77,7 @@ export class car_lib_page_item extends Component {
         }
     }
 
-    init(pageView, index, data_list:car_item_data[], selected_cb, click_cb) {
+    init(pageView, index, data_list:car_item_data[], bag_car_suipian_list, selected_cb, click_cb) {
         this.m_pageView = pageView
         this.m_index = index
         this.m_data_list = data_list
@@ -84,16 +85,48 @@ export class car_lib_page_item extends Component {
         this.list_content.removeAllChildren()
         for (let index = 0; index < data_list.length; index++) {
             const element = data_list[index];
-            let is_jiesuo = userDataManager.user_car_list.car_list.some(obj => obj === element.id)
+            // 是否解锁
+            var is_jiesuo = false
+
+            // 汽车碎片逻辑
+            if(element.stype==car_type.suipian) {
+                if(dataManager.userCarListHavCar(element.id)) {
+                    let on_bag = false
+                    for (let i = 0; i < bag_car_suipian_list.length; i++) {
+                        const i_e:bag_list_item_data = bag_car_suipian_list[i];
+                        if(i_e.car_id==element.id) {
+                            element.temp_bag_list_item_data = i_e
+                            // bag_car_suipian_list.splice(i,1)
+                            on_bag = true   
+                            if(i_e.quantity>=element.unlock_points) {
+                                is_jiesuo = true
+                            }
+                            break
+                        }
+                    }
+                    if(on_bag==false) { //不在背包中,补充一个空的
+                        element.temp_bag_list_item_data = new bag_list_item_data
+                    }
+                } else {  //不在用户车列表中,补充一个空的
+                    element.temp_bag_list_item_data = new bag_list_item_data
+                    // if(element.id==16) { element.temp_bag_list_item_data.quantity = 300} //用于测试
+                }
+            }
+
+            // 业务逻辑
             let item = instantiate(this.list_item)
             item.parent = this.list_content
             let item_component = item.getComponent(car_lib_list_item)
             item_component.initView(element, index, this.onClickListItem.bind(this))
+            if(element.stype==car_type.score) {
+                is_jiesuo = userDataManager.user_car_list.car_list.some(obj => obj === element.id)  
+            } 
             if(is_jiesuo) {
                 item_component.setJiesuoSelectedStatus()
             } else {
                 item_component.setJiesuoUnselectedStatus()
             }
+            
             if(userDataManager.user_car_list.default_car_id == element.id) {
                 item_component.setSelectedStatus()
                 if(selected_cb) { selected_cb(this, item_component) }

BIN
assets/texture/ui/public/public_share.png


+ 134 - 0
assets/texture/ui/public/public_share.png.meta

@@ -0,0 +1,134 @@
+{
+  "ver": "1.0.26",
+  "importer": "image",
+  "imported": true,
+  "uuid": "62511f87-ae12-42b6-8497-619af81aa9da",
+  "files": [
+    ".json",
+    ".png"
+  ],
+  "subMetas": {
+    "6c48a": {
+      "importer": "texture",
+      "uuid": "62511f87-ae12-42b6-8497-619af81aa9da@6c48a",
+      "displayName": "public_share",
+      "id": "6c48a",
+      "name": "texture",
+      "userData": {
+        "wrapModeS": "clamp-to-edge",
+        "wrapModeT": "clamp-to-edge",
+        "imageUuidOrDatabaseUri": "62511f87-ae12-42b6-8497-619af81aa9da",
+        "isUuid": true,
+        "visible": false,
+        "minfilter": "linear",
+        "magfilter": "linear",
+        "mipfilter": "none",
+        "anisotropy": 0
+      },
+      "ver": "1.0.22",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    },
+    "f9941": {
+      "importer": "sprite-frame",
+      "uuid": "62511f87-ae12-42b6-8497-619af81aa9da@f9941",
+      "displayName": "public_share",
+      "id": "f9941",
+      "name": "spriteFrame",
+      "userData": {
+        "trimType": "auto",
+        "trimThreshold": 1,
+        "rotated": false,
+        "offsetX": 0,
+        "offsetY": 0,
+        "trimX": 0,
+        "trimY": 0,
+        "width": 66,
+        "height": 62,
+        "rawWidth": 66,
+        "rawHeight": 62,
+        "borderTop": 0,
+        "borderBottom": 0,
+        "borderLeft": 0,
+        "borderRight": 0,
+        "packable": true,
+        "pixelsToUnit": 100,
+        "pivotX": 0.5,
+        "pivotY": 0.5,
+        "meshType": 0,
+        "vertices": {
+          "rawPosition": [
+            -33,
+            -31,
+            0,
+            33,
+            -31,
+            0,
+            -33,
+            31,
+            0,
+            33,
+            31,
+            0
+          ],
+          "indexes": [
+            0,
+            1,
+            2,
+            2,
+            1,
+            3
+          ],
+          "uv": [
+            0,
+            62,
+            66,
+            62,
+            0,
+            0,
+            66,
+            0
+          ],
+          "nuv": [
+            0,
+            0,
+            1,
+            0,
+            0,
+            1,
+            1,
+            1
+          ],
+          "minPos": [
+            -33,
+            -31,
+            0
+          ],
+          "maxPos": [
+            33,
+            31,
+            0
+          ]
+        },
+        "isUuid": true,
+        "imageUuidOrDatabaseUri": "62511f87-ae12-42b6-8497-619af81aa9da@6c48a",
+        "atlasUuid": ""
+      },
+      "ver": "1.0.12",
+      "imported": true,
+      "files": [
+        ".json"
+      ],
+      "subMetas": {}
+    }
+  },
+  "userData": {
+    "type": "sprite-frame",
+    "hasAlpha": true,
+    "fixAlphaTransparencyArtifacts": false,
+    "redirect": "62511f87-ae12-42b6-8497-619af81aa9da@f9941"
+  }
+}

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません