|
@@ -13,18 +13,18 @@ import {SemePartCfg} from '../../config/SemePartCfg'
|
|
|
import {HttpUrl} from '../../config/HttpUrl'
|
|
|
import {ConstValue} from '../../data/ConstValue'
|
|
|
import List from '../../uiutils/List'
|
|
|
+import {FiveDrawCell} from '../../cell/FiveDrawCell'
|
|
|
+import {ChoosePartCell} from '../../cell/ChoosePartCell'
|
|
|
|
|
|
const {ccclass, property} = cc._decorator
|
|
|
-let drawColor = ['#f04949', '#2c98f2', '#66bb2f', '#ffaf00', '#9b1fec']
|
|
|
@ccclass
|
|
|
@observer
|
|
|
export default class GameOptUI extends BaseUI {
|
|
|
previousNode: cc.Node
|
|
|
nextNode: cc.Node
|
|
|
- dbCell: DrawBoardCell
|
|
|
+ fiveDraw: FiveDrawCell
|
|
|
tempStars: cc.Node[]
|
|
|
- partScrollNode: cc.Node
|
|
|
- partScrollList: List
|
|
|
+ choosePartCell: ChoosePartCell
|
|
|
classLock: cc.Node
|
|
|
fingerTouch: cc.Node
|
|
|
fingerNode: cc.Node
|
|
@@ -35,12 +35,11 @@ export default class GameOptUI extends BaseUI {
|
|
|
protected onLoad() {
|
|
|
this.previousNode = cc.find('btn_previous', this.node)
|
|
|
this.nextNode = cc.find('btn_next', this.node)
|
|
|
- //初始化画板
|
|
|
- this.dbCell = cc.find('dbCell', this.node).getComponent(DrawBoardCell)
|
|
|
- this.dbCell.initDb(1280, 580)
|
|
|
+ //初始化五色画板
|
|
|
+ this.fiveDraw = cc.find('topBtns/allDrawLayout', this.node).getComponent(FiveDrawCell)
|
|
|
+ this.fiveDraw.init(cc.find('dbCell', this.node))
|
|
|
|
|
|
- //默认画板颜色
|
|
|
- this.showColorChoose(0)
|
|
|
+ this.choosePartCell = cc.find('choosePart', this.node).getComponent(ChoosePartCell)
|
|
|
|
|
|
this.classLock = cc.find('classLock', this.node)
|
|
|
|
|
@@ -98,14 +97,12 @@ export default class GameOptUI extends BaseUI {
|
|
|
// 关卡进度星星动画的临时节点
|
|
|
if (this.tempStars) this.tempStars.forEach(value => value.destroy())
|
|
|
this.tempStars = []
|
|
|
- this.partScrollNode = cc.find('choosePart/scrollView', this.node)
|
|
|
- this.partScrollList = this.partScrollNode.getComponent(List)
|
|
|
- this.partScrollList._init()
|
|
|
- this.partScrollList.numItems = allNum
|
|
|
+ this.choosePartCell.initCurPart(Data.game.partID)
|
|
|
+ this.choosePartCell.init(allNum, this, this.partClick, this.canChoosePart)
|
|
|
+
|
|
|
this.setGameDur()
|
|
|
|
|
|
- // 隐藏画板
|
|
|
- this.drawLineClick(null, false)
|
|
|
+ this.fiveDraw.hideDraw()
|
|
|
}
|
|
|
|
|
|
initUI() {
|
|
@@ -148,15 +145,6 @@ export default class GameOptUI extends BaseUI {
|
|
|
}
|
|
|
return true
|
|
|
}
|
|
|
-
|
|
|
- showColorChoose(dbColor) {
|
|
|
- let allDrawLayout = cc.find('topBtns/allDrawLayout', this.node)
|
|
|
- allDrawLayout.children[0].children.forEach((value, i) => {
|
|
|
- if (value.children[0]) value.children[0].active = i == dbColor
|
|
|
- })
|
|
|
- this.dbCell.setDbColor(cc.Color.BLACK.fromHEX(drawColor[dbColor]))
|
|
|
- }
|
|
|
-
|
|
|
setGameDur() {
|
|
|
let gameDur = cc.find('gameDur', this.node)
|
|
|
for (let i = 0; i < 12; i++) {
|
|
@@ -303,11 +291,6 @@ export default class GameOptUI extends BaseUI {
|
|
|
this.fingerNode.x = pos.x
|
|
|
this.fingerNode.y = pos.y
|
|
|
}
|
|
|
- initPartScrollItem(node, index) {
|
|
|
- node.part = index + 1
|
|
|
- ccUtils.setLabel((index + 1).toString(), node, 'lb')
|
|
|
- cc.find('rdBg', node).active = index + 1 == Data.game.partID
|
|
|
- }
|
|
|
// 界面元素通用动作
|
|
|
gameNodeClickAni(node) {
|
|
|
let t = cc.tween
|
|
@@ -422,44 +405,20 @@ export default class GameOptUI extends BaseUI {
|
|
|
if (!this.canChoosePart()) return
|
|
|
Data.game.partID -= 1
|
|
|
this.changeGame()
|
|
|
+ this.choosePartCell.initCurPart(Data.game.partID)
|
|
|
}
|
|
|
|
|
|
nextClick() {
|
|
|
if (!this.canChoosePart()) return
|
|
|
Data.game.partID += 1
|
|
|
this.changeGame()
|
|
|
+ this.choosePartCell.initCurPart(Data.game.partID)
|
|
|
}
|
|
|
|
|
|
titleAudioClick() {
|
|
|
Mgr.audio.playSFX(PathUtils.addGP(Data.game.curPageNum > 0 ? 'audio1' : 'audio'), Data.game.semeBundle)
|
|
|
}
|
|
|
|
|
|
- drawLineClick(e, show?: boolean) {
|
|
|
- let showDraw = !this.dbCell.node.active
|
|
|
- if (show != undefined) {
|
|
|
- this.dbCell.node.active = show
|
|
|
- showDraw = show
|
|
|
- } else {
|
|
|
- this.dbCell.node.active = showDraw
|
|
|
- }
|
|
|
- let allDrawLayout = cc.find('topBtns/allDrawLayout', this.node)
|
|
|
- cc.find('drawlayout', allDrawLayout).active = showDraw
|
|
|
- allDrawLayout.getComponent(cc.Sprite).enabled = showDraw
|
|
|
- }
|
|
|
-
|
|
|
- setColorClick(event, color) {
|
|
|
- let dbColor = parseInt(color) - 1
|
|
|
- this.dbCell.setDbColor(cc.Color.BLACK.fromHEX(drawColor[dbColor]))
|
|
|
- this.showColorChoose(dbColor)
|
|
|
- }
|
|
|
-
|
|
|
- clearColorClick(event, color) {
|
|
|
- this.dbCell.db.clearColor()
|
|
|
- this.scheduleOnce(() => {
|
|
|
- this.dbCell.drawToImg()
|
|
|
- })
|
|
|
- }
|
|
|
-
|
|
|
videoClick() {
|
|
|
Mgr.ui.show(UI.VideoUI)
|
|
|
Mgr.audio.stopBGM()
|
|
@@ -477,14 +436,7 @@ export default class GameOptUI extends BaseUI {
|
|
|
Mgr.ui.show(UI.ClassUI)
|
|
|
}
|
|
|
|
|
|
- choosePartClick() {
|
|
|
- if (!this.canChoosePart()) return
|
|
|
- this.partScrollNode.active = !this.partScrollNode.active
|
|
|
- this.partScrollList.scrollTo(Data.game.partID - 1, 0)
|
|
|
- }
|
|
|
-
|
|
|
partClick(event) {
|
|
|
- this.partScrollNode.active = false
|
|
|
Data.game.partID = event.target.part
|
|
|
this.changeGame()
|
|
|
}
|