|
@@ -36,14 +36,14 @@ export class car_lib_bottom extends base_ui {
|
|
|
return
|
|
|
}
|
|
|
this.num_current_count -=1
|
|
|
- this.updateNumStatus()
|
|
|
+ this.updateNumStatus(true)
|
|
|
})
|
|
|
this.onButtonListen(this.btn_num_right, ()=>{
|
|
|
if(this.num_current_count>=this.num_total_count) {
|
|
|
return
|
|
|
}
|
|
|
this.num_current_count +=1
|
|
|
- this.updateNumStatus()
|
|
|
+ this.updateNumStatus(true)
|
|
|
})
|
|
|
this.onButtonListen(this.btn_score_sort, ()=>{
|
|
|
this.is_sort_up_status = !this.is_sort_up_status
|
|
@@ -57,14 +57,14 @@ export class car_lib_bottom extends base_ui {
|
|
|
|
|
|
public init(click_item_cb) {
|
|
|
this.m_click_item_cb = click_item_cb
|
|
|
- this.num_current_count = 1
|
|
|
- this.num_total_count = 1
|
|
|
+ this.num_total_count = tools.all_car_page_list.length
|
|
|
|
|
|
- this.data_list = JSON.parse(JSON.stringify(tools.all_car_list))
|
|
|
+ // this.data_list = JSON.parse(JSON.stringify(tools.all_car_list))
|
|
|
+ this.data_list = tools.all_car_page_list[this.getNumCurrentIndex()]
|
|
|
this.updateSortStatus()
|
|
|
this.updateJiesuoStatus()
|
|
|
this.updateNumStatus()
|
|
|
- this.initListContentData()
|
|
|
+ this.reloadListContentData()
|
|
|
|
|
|
let list_content_size = this.list_content.getComponent(UITransform).contentSize
|
|
|
let item_contenteSize = instantiate(this.list_item).getComponent(UITransform).contentSize
|
|
@@ -76,6 +76,14 @@ export class car_lib_bottom extends base_ui {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private getNumCurrentIndex():number {
|
|
|
+ let index = this.num_current_count - 1
|
|
|
+ if(index<0) {
|
|
|
+ index = 0
|
|
|
+ }
|
|
|
+ return index
|
|
|
+ }
|
|
|
+
|
|
|
updateSortStatus(is_load_data:boolean=false) {
|
|
|
if(this.is_sort_up_status) {
|
|
|
this.btn_score_sort.getComponent(Sprite).spriteFrame = this.sf_score_down
|
|
@@ -84,7 +92,7 @@ export class car_lib_bottom extends base_ui {
|
|
|
}
|
|
|
if(is_load_data) {
|
|
|
this.data_list = this.data_list.reverse()
|
|
|
- this.initListContentData()
|
|
|
+ this.reloadListContentData()
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -95,15 +103,19 @@ export class car_lib_bottom extends base_ui {
|
|
|
this.btn_jiesuo.getComponent(Sprite).spriteFrame = this.sf_jiesuo_unselect
|
|
|
}
|
|
|
if(is_load_data) {
|
|
|
- this.initListContentData()
|
|
|
+ this.reloadListContentData()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- updateNumStatus() {
|
|
|
+ updateNumStatus(is_reload_data:boolean=false) {
|
|
|
this.lab_num.getComponent(Label).string = this.num_current_count + '/' + this.num_total_count
|
|
|
+ if(is_reload_data) {
|
|
|
+ this.data_list = tools.all_car_page_list[this.getNumCurrentIndex()]
|
|
|
+ this.reloadListContentData()
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- initListContentData() {
|
|
|
+ reloadListContentData() {
|
|
|
this.list_content.removeAllChildren()
|
|
|
this.current_select_list_item = null
|
|
|
for (let index = 0; index < this.data_list.length; index++) {
|