|
@@ -11,6 +11,7 @@ import { ClientEvent } from '../../framework/clientEvent';
|
|
import { AudioManager } from '../../framework/audioManager';
|
|
import { AudioManager } from '../../framework/audioManager';
|
|
import { pause } from '../../dialog/pause';
|
|
import { pause } from '../../dialog/pause';
|
|
import { Util } from '../../framework/util';
|
|
import { Util } from '../../framework/util';
|
|
|
|
+import { PoolManager } from '../../framework/poolManager';
|
|
const { ccclass, property } = _decorator;
|
|
const { ccclass, property } = _decorator;
|
|
|
|
|
|
@ccclass('view_game_play_han_zi_zhao_bu_tong')
|
|
@ccclass('view_game_play_han_zi_zhao_bu_tong')
|
|
@@ -65,6 +66,10 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
})
|
|
})
|
|
})
|
|
})
|
|
},this);
|
|
},this);
|
|
|
|
+ if(!PoolManager.instance.isHavePool(this.item_prefab)){
|
|
|
|
+ PoolManager.instance.preloadPool(this.item_prefab,11*15)
|
|
|
|
+ }
|
|
|
|
+
|
|
ClientEvent.on(config.EVENT_MSG.ON_CHANGE_COIN_NUMBER,this.onChangeCoinNumber.bind(this),this);
|
|
ClientEvent.on(config.EVENT_MSG.ON_CHANGE_COIN_NUMBER,this.onChangeCoinNumber.bind(this),this);
|
|
}
|
|
}
|
|
protected onDestroy(): void {
|
|
protected onDestroy(): void {
|
|
@@ -193,6 +198,10 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
initGrid(){
|
|
initGrid(){
|
|
this.font_grid.getComponent(Layout).constraintNum = this.m_data.col;
|
|
this.font_grid.getComponent(Layout).constraintNum = this.m_data.col;
|
|
this.lab_coin.getComponent(Label).string = gameManager.get_user_coin()+"";
|
|
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.font_grid.removeAllChildren()
|
|
this.bottom_pos.removeAllChildren()
|
|
this.bottom_pos.removeAllChildren()
|
|
this.left_pos.removeAllChildren()
|
|
this.left_pos.removeAllChildren()
|
|
@@ -209,9 +218,10 @@ export class view_game_play_han_zi_zhao_bu_tong extends Component {
|
|
for (let index = 0; index <this.m_data.col*this.m_data.row; index++) {
|
|
for (let index = 0; index <this.m_data.col*this.m_data.row; index++) {
|
|
let col = index%this.m_data.col;
|
|
let col = index%this.m_data.col;
|
|
let row = Math.floor(index/this.m_data.col);
|
|
let row = Math.floor(index/this.m_data.col);
|
|
- let item = instantiate(this.item_prefab);
|
|
|
|
|
|
+ // 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.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;
|
|
|
|
|
|
+ // item.parent = this.font_grid;
|
|
}
|
|
}
|
|
for (let index = this.m_data.row; index > 0; index--) {
|
|
for (let index = this.m_data.row; index > 0; index--) {
|
|
let item = instantiate(this.left_item);
|
|
let item = instantiate(this.left_item);
|