future 1 рік тому
батько
коміт
9df19e5d33
1 змінених файлів з 13 додано та 12 видалено
  1. 13 12
      assets/script/run/game_list_view/long_story_list.ts

+ 13 - 12
assets/script/run/game_list_view/long_story_list.ts

@@ -222,10 +222,18 @@ export class long_story_list extends Component {
 
             let update_lock_status = (()=>{
                 let c_index = level_item_page
-                // console.log('c_index=',c_index)
-                // console.log('c_content.children.length=',this.content.children.length)
                 let c_item = this.content.children[c_index]
-                c_item.getComponent(long_story_list_item).updateLockStatus(0,true)
+                let c_data = this.data_list[c_index]
+                if(c_data && c_data.content && c_data.content.list.length>0) {
+                    let first_index = 0
+                    let first_lock_status = c_item.getComponent(long_story_list_item).getLockStatus(first_index)
+                    // console.log('first_lock_status=',first_lock_status)
+                    if(first_lock_status==false) {
+                        c_item.getComponent(long_story_list_item).updateLockStatus(first_index,true)
+                        let level_id = c_data.content.list[first_index].id
+                        gameManager.Singleton.unLockLevel(level_id)
+                    }
+                }
             })
             
             if(this.content.children.length>level_item_page) {
@@ -233,14 +241,7 @@ export class long_story_list extends Component {
             } else {
                 this.requestData(true,(msg:LevelMessage)=>{
                     // console.log('自动解锁加载下一页 msg',msg)
-                    if(msg && msg.content && msg.content.list.length>0) {
-                        let one_data = msg.content.list[0]
-                        let isUnLock = gameManager.Singleton.levleIsUnLock(one_data.id)
-                        if(isUnLock==false) {
-                            // gameManager.Singleton.unLockLevel(one_data.id)
-                            update_lock_status()
-                        }
-                    }
+                    update_lock_status()
                 })
             }
 
@@ -248,8 +249,8 @@ export class long_story_list extends Component {
             let next_level_index = this.cur_long_story_list_item_level_index+1
             let next_level_item_data = this.cur_long_story_list_item.getLevelItemData(next_level_index)
             if(next_level_item_data) {
-                // gameManager.Singleton.unLockLevel(next_level_item_data.id)
                 this.cur_long_story_list_item.updateLockStatus(next_level_index,true)
+                gameManager.Singleton.unLockLevel(next_level_item_data.id)
             }
         }