|
@@ -1,4 +1,4 @@
|
|
|
-import { _decorator, Component, instantiate, Label, Layout, Node, Prefab, ProgressBar, Sprite, SpriteFrame } from 'cc';
|
|
|
+import { _decorator, Component, Director, director, instantiate, Label, Layout, Node, Prefab, ProgressBar, Sprite, SpriteFrame } from 'cc';
|
|
|
import { config } from '../../config';
|
|
|
import { font_grid_pos, server_han_zi_zhao_bu_tong_data_item } from '../../data/server_play_list_data';
|
|
|
import { gameManager } from '../../gameManager';
|
|
@@ -67,7 +67,7 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
|
})
|
|
|
},this);
|
|
|
if(!PoolManager.instance.isHavePool(this.item_prefab)){
|
|
|
- PoolManager.instance.preloadPool(this.item_prefab,11*15)
|
|
|
+ PoolManager.instance.preloadPool(this.item_prefab,this.m_data.col*this.m_data.row)
|
|
|
}
|
|
|
|
|
|
ClientEvent.on(config.EVENT_MSG.ON_CHANGE_COIN_NUMBER,this.onChangeCoinNumber.bind(this),this);
|
|
@@ -198,10 +198,6 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
|
initGrid(){
|
|
|
this.font_grid.getComponent(Layout).constraintNum = this.m_data.col;
|
|
|
this.lab_coin.getComponent(Label).string = gameManager.get_user_coin()+"";
|
|
|
- for (let index = 0; index < this.font_grid.children.length; index++) {
|
|
|
- const element = this.font_grid.children[index];
|
|
|
- PoolManager.instance.putNode(element);
|
|
|
- }
|
|
|
this.font_grid.removeAllChildren()
|
|
|
this.bottom_pos.removeAllChildren()
|
|
|
this.left_pos.removeAllChildren()
|
|
@@ -214,15 +210,16 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
|
tools.showToast("关卡未配置数据!")
|
|
|
return
|
|
|
}
|
|
|
+
|
|
|
this.answer = JSON.parse(this.m_data.content);
|
|
|
for (let index = 0; index <this.m_data.col*this.m_data.row; index++) {
|
|
|
let col = index%this.m_data.col;
|
|
|
let row = Math.floor(index/this.m_data.col);
|
|
|
- // let item = instantiate(this.item_prefab);
|
|
|
let item = PoolManager.instance.getNode(this.item_prefab,this.font_grid)
|
|
|
item.getComponent(font_grid_item).initView(this.default_img,this.find_img,row,col,this.onGridItemClick.bind(this),this.isRight(row,col));
|
|
|
- // item.parent = this.font_grid;
|
|
|
+
|
|
|
}
|
|
|
+
|
|
|
for (let index = this.m_data.row; index > 0; index--) {
|
|
|
let item = instantiate(this.left_item);
|
|
|
item.parent = this.left_pos;
|