12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- import SoundMgr from "../base/SoundMgr";
- cc.Class({
- extends: cc.Component,
- properties: {
- backNode: cc.Node,
- itemPrefab: cc.Node,
- scroNode: cc.Node,
- viewNode: cc.Node,
- conNode: cc.Node,
- recordNode: cc.Node,
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this.adaptor();
- },
- start () {
- this.initItems();
- },
- initItems(){
- this.conNode.removeAllChildren();
- for(let i=0; i < 7; i++){
- let temp = cc.instantiate(this.itemPrefab);
- temp.setParent(this.conNode);
- temp.name = `item${i}`;
- temp.active = true;
- temp.getComponent('ExchangeItem').setInfo(this, 'sss');
- }
- },
- showExchange(hallSceneJs){
- this.hallSceneJs = hallSceneJs;
- this.node.active = true;
- },
- onClickRecord(){
- this.recordNode.active = true;
- },
- adaptor(){ //220
- let backWPos = this.backNode.convertToWorldSpaceAR(cc.v2(0,0));
- let lerp = (backWPos.y -220) * 2;
- this.scroNode.setContentSize(this.scroNode.width, this.scroNode.height + lerp);
- this.viewNode.setContentSize(this.viewNode.width, this.viewNode.height + lerp);
- },
- onClose(){
- SoundMgr.playClick();
- this.node.active = false;
- this.hallSceneJs.showHides(true);
- },
- });
|