| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import { Color, Component, Sprite, _decorator,Node } from "cc";
- import GameUtils from "../../GameUtils/GameUtils";
- import GameMainPoint from "./GameMainPoint";
- const { ccclass, property } = _decorator;
- @ccclass
- export default class GameMainLine extends Component {
- private _oneLine: GameMainPoint = null
- private _twoLine: GameMainPoint = null
- private _isOK: boolean = false
- private color:number=0;
- resetData(oneLine: GameMainPoint, twoLine: GameMainPoint) {
- this._oneLine = oneLine
- this._twoLine = twoLine
- }
- getOneLine() {
- return this._oneLine
- }
- getTwoLine() {
- return this._twoLine
- }
- //设置线的颜色
- setColor(colorIndex: number) {
- let allColor = [Color.GREEN, Color.YELLOW, Color.RED]
- colorIndex = colorIndex >= 3 ? 2 : colorIndex
- this.color=colorIndex;
- this.node.getComponent(Sprite).color = allColor[colorIndex]
- this._isOK = colorIndex == 0
- //console.log("setColor:"+colorIndex);
- this.AddPointCount();
- }
- getIsOk() {
- return this._isOK
- }
- AddPointCount(){
- this._oneLine.AddColorNum(this.color);
- this._twoLine.AddColorNum(this.color);
- }
- public destroySelf(){
- this.node.destroy();
- }
- }
|