|
@@ -1,4 +1,4 @@
|
|
-import { _decorator, Component, instantiate, Node, Prefab, ScrollView } from 'cc';
|
|
|
|
|
|
+import { _decorator, Animation, Component, instantiate, Node, Prefab, ScrollView } from 'cc';
|
|
import { LevelInfoMessage, LevelItemData, LevelMessage, LongStoryListData, scene_item_data } from '../../../data/data';
|
|
import { LevelInfoMessage, LevelItemData, LevelMessage, LongStoryListData, scene_item_data } from '../../../data/data';
|
|
import { config } from '../../config';
|
|
import { config } from '../../config';
|
|
import { SdkUtil } from '../../sdkUtil';
|
|
import { SdkUtil } from '../../sdkUtil';
|
|
@@ -32,6 +32,7 @@ export class long_story_list extends Component {
|
|
private is_can_request:boolean = false
|
|
private is_can_request:boolean = false
|
|
private cur_long_story_list_item:long_story_list_item = null
|
|
private cur_long_story_list_item:long_story_list_item = null
|
|
private cur_long_story_list_item_level_index:number = -1
|
|
private cur_long_story_list_item_level_index:number = -1
|
|
|
|
+ private cur_select_level_data:LevelItemData = null
|
|
|
|
|
|
start() {
|
|
start() {
|
|
this.btn_back.on(Node.EventType.TOUCH_END,()=>{
|
|
this.btn_back.on(Node.EventType.TOUCH_END,()=>{
|
|
@@ -74,22 +75,46 @@ export class long_story_list extends Component {
|
|
this.requestData(true)
|
|
this.requestData(true)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ playBackLevelAnimation(is_play:boolean) {
|
|
|
|
+ if(is_play) {
|
|
|
|
+ this.btn_back_level.getComponent(Animation).play()
|
|
|
|
+ } else {
|
|
|
|
+ this.btn_back_level.getComponent(Animation).stop()
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ backGameList() {
|
|
|
|
+ let level_item_data = gameManager.Singleton.getLevelData()
|
|
|
|
+ // console.log('返回游戏列表=',level_item_data)
|
|
|
|
+ if(this.cur_select_level_data && this.cur_select_level_data.id==level_item_data.id) {
|
|
|
|
+ this.playBackLevelAnimation(true)
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
private unInit() {
|
|
private unInit() {
|
|
this.data_list = []
|
|
this.data_list = []
|
|
this.content.removeAllChildren()
|
|
this.content.removeAllChildren()
|
|
this.cur_long_story_list_item = null
|
|
this.cur_long_story_list_item = null
|
|
this.cur_long_story_list_item_level_index = null
|
|
this.cur_long_story_list_item_level_index = null
|
|
|
|
+ this.cur_select_level_data = null
|
|
|
|
+ ClientEvent.off(config.EventRun.BACK_GAME_LIST,this.backGameList.bind(this),this)
|
|
ClientEvent.off(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
ClientEvent.off(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
|
|
+ this.playBackLevelAnimation(false)
|
|
}
|
|
}
|
|
|
|
|
|
private init() {
|
|
private init() {
|
|
ClientEvent.off(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
ClientEvent.off(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
ClientEvent.on(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
ClientEvent.on(config.EventRun.WIN_LATER_AUTO_UNLOCK_NEXT_LEVEL,this.autoUnlockNextLevel.bind(this),this)
|
|
|
|
|
|
|
|
+ ClientEvent.off(config.EventRun.BACK_GAME_LIST,this.backGameList.bind(this),this)
|
|
|
|
+ ClientEvent.on(config.EventRun.BACK_GAME_LIST,this.backGameList.bind(this),this)
|
|
|
|
+
|
|
let cache_page = gameManager.getUserSelectLongStoryPage(this.m_long_story_list_data.id)
|
|
let cache_page = gameManager.getUserSelectLongStoryPage(this.m_long_story_list_data.id)
|
|
// console.log('cache_page=',cache_page)
|
|
// console.log('cache_page=',cache_page)
|
|
this.cur_min_page = cache_page
|
|
this.cur_min_page = cache_page
|
|
this.cur_page = this.cur_min_page
|
|
this.cur_page = this.cur_min_page
|
|
|
|
+
|
|
|
|
+ this.playBackLevelAnimation(true)
|
|
}
|
|
}
|
|
|
|
|
|
initView(data:LongStoryListData, click_back_level_cb, click_item_goto_game_success_cb) {
|
|
initView(data:LongStoryListData, click_back_level_cb, click_item_goto_game_success_cb) {
|
|
@@ -211,6 +236,8 @@ export class long_story_list extends Component {
|
|
gameManager.Singleton.runGame(_data.content.content)
|
|
gameManager.Singleton.runGame(_data.content.content)
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
gameManager.Singleton.hideLoadingLevel()
|
|
gameManager.Singleton.gotoGameLevel()
|
|
gameManager.Singleton.gotoGameLevel()
|
|
|
|
+ this.cur_select_level_data = level_item_data
|
|
|
|
+ this.playBackLevelAnimation(false)
|
|
this.m_click_item_goto_game_success_cb && this.m_click_item_goto_game_success_cb()
|
|
this.m_click_item_goto_game_success_cb && this.m_click_item_goto_game_success_cb()
|
|
})
|
|
})
|
|
} else {
|
|
} else {
|