69 lines
2.4 KiB
TypeScript
69 lines
2.4 KiB
TypeScript
import { _decorator, Component, EventMouse, Node } from 'cc';
|
|
import { BaseSprite } from '../GlobalScript/CommonComponent/BaseSprite';
|
|
import { NpkImage } from '../Tool/NPKImage';
|
|
import { BaseButton, BaseButtonState } from '../GlobalScript/CommonComponent/BaseButton';
|
|
const { ccclass, property } = _decorator;
|
|
|
|
@ccclass('DiceButtonNode')
|
|
export class DiceButtonNode extends Node {
|
|
|
|
winButtonComponent: BaseButton;
|
|
spaceButtonComponent: BaseButton;
|
|
|
|
constructor(){
|
|
super();
|
|
|
|
const backgroundNode = new Node();
|
|
const bs = backgroundNode.addComponent( BaseSprite );
|
|
bs.updateSpriteFrame(NpkImage.ingame,7);
|
|
this.addChild(backgroundNode);
|
|
|
|
/// 其他获胜条件
|
|
const winButtonNode = new Node();
|
|
this.winButtonComponent = winButtonNode.addComponent( BaseButton );
|
|
this.winButtonComponent.ButtonState = BaseButtonState.Disable;
|
|
this.winButtonComponent.ImgPath = NpkImage.ingame;
|
|
this.winButtonComponent.NormalImgIndex = 58;
|
|
this.winButtonComponent.HoverImgIndex = 59;
|
|
this.winButtonComponent.PressImgIndex = 60;
|
|
this.winButtonComponent.DisableImgIndex = 61;
|
|
|
|
this.addChild(winButtonNode);
|
|
winButtonNode.setPosition(20.5,-123);
|
|
// winButtonNode.on(Node.EventType.MOUSE_UP,this.winOnTouchUp,this);
|
|
|
|
/// space
|
|
const spaceButtonNode = new Node();
|
|
this.spaceButtonComponent = spaceButtonNode.addComponent( BaseButton );
|
|
this.spaceButtonComponent.ButtonState = BaseButtonState.Disable;
|
|
this.spaceButtonComponent.ImgPath = NpkImage.ingame;
|
|
this.spaceButtonComponent.NormalImgIndex = 8;
|
|
this.spaceButtonComponent.HoverImgIndex = 9;
|
|
this.spaceButtonComponent.PressImgIndex = 10;
|
|
this.spaceButtonComponent.DisableImgIndex = 11;
|
|
|
|
this.addChild(spaceButtonNode);
|
|
spaceButtonNode.setPosition(89,-57);
|
|
// spaceButtonNode.on(Node.EventType.MOUSE_DOWN,this.spaceOnTouchDown,this);
|
|
// spaceButtonNode.on(Node.EventType.MOUSE_UP,this.spaceOnTouchUp,this);
|
|
|
|
}
|
|
|
|
winOnTouchUp(event:EventMouse){
|
|
if (event.getButton() != EventMouse.BUTTON_LEFT) return;
|
|
|
|
}
|
|
|
|
spaceOnTouchDown(event:EventMouse){
|
|
if (event.getButton() != EventMouse.BUTTON_LEFT) return;
|
|
|
|
}
|
|
spaceOnTouchUp(event:EventMouse){
|
|
if (event.getButton() != EventMouse.BUTTON_LEFT) return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|