diff --git a/assets/Scene/main.fire b/assets/Scene/main.fire index b483d25..eb2a012 100644 --- a/assets/Scene/main.fire +++ b/assets/Scene/main.fire @@ -73,21 +73,18 @@ }, { "__id__": 5 - }, - { - "__id__": 1254 } ], "_active": true, "_components": [ { - "__id__": 1267 + "__id__": 1254 }, { - "__id__": 1268 + "__id__": 1255 }, { - "__id__": 1269 + "__id__": 1256 } ], "_prefab": null, @@ -2251,6 +2248,7 @@ }, "_enabled": true, "MaxTime": 2, + "IsHaveHoldLine": false, "HoldLine": null, "ProgressBG": null, "ProgressLine": null, @@ -50345,579 +50343,6 @@ "groupIndex": 0, "_id": "a0zByys7FJgJl6GppX9M2X" }, - { - "__type__": "cc.Node", - "_name": "Btn_Reset", - "_objFlags": 0, - "_parent": { - "__id__": 2 - }, - "_children": [ - { - "__id__": 1255 - }, - { - "__id__": 1257 - } - ], - "_active": true, - "_components": [ - { - "__id__": 1262 - }, - { - "__id__": 1263 - }, - { - "__id__": 1264 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 183, - "g": 0, - "b": 0, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 135, - "height": 55 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - -166.208, - 275.308, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "1aSBA1YnZMwK4EhgsXFJDw" - }, - { - "__type__": "cc.Node", - "_name": "Label", - "_objFlags": 512, - "_parent": { - "__id__": 1254 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 1256 - } - ], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 200, - "height": 63 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - 0, - 0, - 0, - 0, - 0, - 0, - 1, - 0.5, - 0.5, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "ea5CXcMFRLmLSQebqsgbpK" - }, - { - "__type__": "cc.Label", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1255 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_string": "比賽結算", - "_N$string": "比賽結算", - "_fontSize": 50, - "_lineHeight": 50, - "_enableWrapText": true, - "_N$file": null, - "_isSystemFontUsed": true, - "_spacingX": 0, - "_batchAsBitmap": false, - "_styleFlags": 1, - "_underlineHeight": 0, - "_N$horizontalAlign": 1, - "_N$verticalAlign": 1, - "_N$fontFamily": "Arial", - "_N$overflow": 0, - "_N$cacheMode": 0, - "_id": "25LNSg3HlDtr6K6OflSxyP" - }, - { - "__type__": "cc.Node", - "_name": "holdLine", - "_objFlags": 512, - "_parent": { - "__id__": 1254 - }, - "_children": [ - { - "__id__": 1258 - }, - { - "__id__": 1260 - } - ], - "_active": true, - "_components": [], - "_prefab": null, - "_opacity": 255, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 0, - "height": 0 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0.5, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - -8.671, - -33.651, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "17f7IX2PhP3J0DAmSnwKSF" - }, - { - "__type__": "cc.Node", - "_name": "bg", - "_objFlags": 0, - "_parent": { - "__id__": 1257 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 1259 - } - ], - "_prefab": null, - "_opacity": 100, - "_color": { - "__type__": "cc.Color", - "r": 167, - "g": 167, - "b": 167, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 120, - "height": 5 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - -50, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "bekv3G8nZFXobLVr4IbF2B" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1258 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" - }, - "_type": 0, - "_sizeMode": 0, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "7b/EzTEG1Ch7tocZHtkkZM" - }, - { - "__type__": "cc.Node", - "_name": "line", - "_objFlags": 0, - "_parent": { - "__id__": 1257 - }, - "_children": [], - "_active": true, - "_components": [ - { - "__id__": 1261 - } - ], - "_prefab": null, - "_opacity": 100, - "_color": { - "__type__": "cc.Color", - "r": 255, - "g": 255, - "b": 255, - "a": 255 - }, - "_contentSize": { - "__type__": "cc.Size", - "width": 120, - "height": 5 - }, - "_anchorPoint": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0.5 - }, - "_trs": { - "__type__": "TypedArray", - "ctor": "Float64Array", - "array": [ - -50, - 0, - 0, - 0, - 0, - 0, - 1, - 1, - 1, - 1 - ] - }, - "_eulerAngles": { - "__type__": "cc.Vec3", - "x": 0, - "y": 0, - "z": 0 - }, - "_skewX": 0, - "_skewY": 0, - "_is3DNode": false, - "_groupIndex": 0, - "groupIndex": 0, - "_id": "66TJnkhk1MBKfyAG+2/yfh" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1260 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "a23235d1-15db-4b95-8439-a2e005bfff91" - }, - "_type": 3, - "_sizeMode": 0, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "7fSz17M21I/Yaj9Xw5oCln" - }, - { - "__type__": "cc.Button", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1254 - }, - "_enabled": true, - "_normalMaterial": null, - "_grayMaterial": null, - "duration": 0.1, - "zoomScale": 0.9, - "clickEvents": [], - "_N$interactable": true, - "_N$enableAutoGrayEffect": false, - "_N$transition": 1, - "transition": 1, - "_N$normalColor": { - "__type__": "cc.Color", - "r": 183, - "g": 0, - "b": 0, - "a": 255 - }, - "_N$pressedColor": { - "__type__": "cc.Color", - "r": 200, - "g": 200, - "b": 200, - "a": 255 - }, - "pressedColor": { - "__type__": "cc.Color", - "r": 200, - "g": 200, - "b": 200, - "a": 255 - }, - "_N$hoverColor": { - "__type__": "cc.Color", - "r": 230, - "g": 230, - "b": 230, - "a": 255 - }, - "hoverColor": { - "__type__": "cc.Color", - "r": 230, - "g": 230, - "b": 230, - "a": 255 - }, - "_N$disabledColor": { - "__type__": "cc.Color", - "r": 120, - "g": 120, - "b": 120, - "a": 200 - }, - "_N$normalSprite": { - "__uuid__": "eacf7329-d93d-41c2-a973-4065b01b6041" - }, - "_N$pressedSprite": null, - "pressedSprite": null, - "_N$hoverSprite": null, - "hoverSprite": null, - "_N$disabledSprite": null, - "_N$target": { - "__id__": 1254 - }, - "_id": "7afqFiP9VMaYy9UM6Of5ph" - }, - { - "__type__": "cc.Sprite", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1254 - }, - "_enabled": true, - "_materials": [ - { - "__uuid__": "eca5d2f2-8ef6-41c2-bbe6-f9c79d09c432" - } - ], - "_srcBlendFactor": 770, - "_dstBlendFactor": 771, - "_spriteFrame": { - "__uuid__": "992fd08c-39b8-4680-b9cc-f7f5a8c07d09" - }, - "_type": 0, - "_sizeMode": 0, - "_fillType": 0, - "_fillCenter": { - "__type__": "cc.Vec2", - "x": 0, - "y": 0 - }, - "_fillStart": 0, - "_fillRange": 0, - "_isTrimmedMode": true, - "_atlas": null, - "_id": "85ZAa6pCVGKofQGy6X/UiS" - }, - { - "__type__": "0d1d5HfnyFLAK2RYSpW387d", - "_name": "", - "_objFlags": 0, - "node": { - "__id__": 1254 - }, - "_enabled": true, - "MaxTime": 1, - "HoldLine": { - "__id__": 1257 - }, - "ProgressBG": { - "__id__": 1259 - }, - "ProgressLine": { - "__id__": 1261 - }, - "OnInvoke": [ - { - "__id__": 1265 - }, - { - "__id__": 1266 - } - ], - "_id": "8e6xzr3wBFU7860ZIq6ksv" - }, - { - "__type__": "cc.ClickEvent", - "target": { - "__id__": 2 - }, - "component": "", - "_componentId": "86aabeOWt1HIYNYd4pc0sNV", - "handler": "Log", - "customEventData": "666" - }, - { - "__type__": "cc.ClickEvent", - "target": null, - "component": "", - "_componentId": "", - "handler": "", - "customEventData": "" - }, { "__type__": "cc.Canvas", "_name": "", diff --git a/assets/Script/Engine/Component/Button/HoldButton.ts b/assets/Script/Engine/Component/Button/HoldButton.ts index 494560d..0196097 100644 --- a/assets/Script/Engine/Component/Button/HoldButton.ts +++ b/assets/Script/Engine/Component/Button/HoldButton.ts @@ -10,13 +10,17 @@ export default class HoldButton extends cc.Component { @property() public MaxTime: number = 2; - @property({ type: cc.Node }) + /** 是否HoldLine */ + @property({ displayName: "是否有HoldLine", tooltip: "是否HoldLine" }) + public IsHaveHoldLine: boolean = false; + + @property({ type: cc.Node, visible(): boolean { return this.IsHaveHoldLine; } }) public HoldLine: cc.Node = null; - @property({ type: cc.Sprite }) + @property({ type: cc.Sprite, visible(): boolean { return this.IsHaveHoldLine; } }) public ProgressBG: cc.Sprite = null; - @property({ type: cc.Sprite }) + @property({ type: cc.Sprite, visible(): boolean { return this.IsHaveHoldLine; } }) public ProgressLine: cc.Sprite = null; @property({ type: [cc.Component.EventHandler] }) @@ -30,8 +34,6 @@ export default class HoldButton extends cc.Component { private _m_pressDeltaTime: number = 0; - private _m_noLineUI: boolean = true; - //#endregion //#region Lifecycle @@ -46,7 +48,7 @@ export default class HoldButton extends cc.Component { if (this._m_isMouseDown) { this._checkHoldAutoStart(dt); } else { - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { this.HoldLine.active = false; } } @@ -71,14 +73,14 @@ export default class HoldButton extends cc.Component { private _checkHoldAutoStart(deltaTime: number): void { this._m_pressDeltaTime += deltaTime; - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { // 蓄能條顯示特效 this.ProgressLine.fillRange = this._m_pressDeltaTime; } if (this._m_pressDeltaTime > this.MaxTime) { this._m_isMouseDown = false; - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { this.HoldLine.active = false; } this._m_pressDeltaTime = 0; @@ -99,8 +101,7 @@ export default class HoldButton extends cc.Component { return; } this._m_isMouseDown = true; - this._m_noLineUI = this.HoldLine == null || this.ProgressBG == null || this.ProgressLine == null; - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { this.HoldLine.active = true; } } @@ -108,7 +109,7 @@ export default class HoldButton extends cc.Component { private _onTouchEnd(event: cc.Event.EventTouch): void { this._m_isMouseDown = false; this._m_pressDeltaTime = 0; - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { this.HoldLine.active = false; } this._checkHoldAutoStart(0); @@ -117,7 +118,7 @@ export default class HoldButton extends cc.Component { private _onTouchCancel(event: cc.Event.EventTouch): void { this._m_isMouseDown = false; this._m_pressDeltaTime = 0; - if (!this._m_noLineUI) { + if (this.IsHaveHoldLine) { this.HoldLine.active = false; } this._checkHoldAutoStart(0);