1234567891011121314151617181920212223242526272829303132333435363738394041424344 |
- import { MouseConst } from "./MouseConst";
- import MouseIconDetailItem from "./MouseIconDetailItem";
- import MouseIconView from "./MouseIconView";
- const { ccclass, property } = cc._decorator;
- @ccclass
- export default class MouseIconDetail extends cc.Component {
- @property(MouseIconDetailItem)
- left: MouseIconDetailItem = null;
- @property(MouseIconDetailItem)
- right: MouseIconDetailItem = null;
- @property(cc.Node)
- maskBg: cc.Node = null;
- show(mouseIconView: MouseIconView, iconId: number, col: number, row: number) {
- this.node.active = true;
- this.maskBg.active = true;
- this.left.node.active = false;
- this.right.node.active = false;
- if (row >= MouseConst.GAME_ROW)
- return;
- if (col < 2) { // 左边
- this.left.node.y = MouseConst.IconSize.height * (row - 1);
- this.left.node.x = col == 0 ? -133 : 110;
- this.left.show(iconId, mouseIconView.getIconSpineById(iconId - 1));
- } else { // 右边
- this.right.node.y = MouseConst.IconSize.height * (row - 1);
- this.right.show(iconId, mouseIconView.getIconSpineById(iconId - 1));
- }
- }
- resetView() {
- this.maskBg.active = false;
- this.node.active = false;
- }
- }
|