|
|
@@ -2,7 +2,7 @@ import { BasicType, YTAvoid } from 'basic'
|
|
|
import { DiaLogPageEnum, DiaLogParam } from 'basic/src/main/ets/models/YTDiaLogModel'
|
|
|
import { HistoryApis } from '../../Apis/HistoryApis'
|
|
|
import { HistoryEventDetail } from '../../model/Index'
|
|
|
-import { BubbleStorage } from '../../model/Storage'
|
|
|
+import { BubbleStorage, StabilityStorage } from '../../model/Storage'
|
|
|
import { NumberKeyBoard, NumberKeyBoardStyle } from './NumberKeyboard'
|
|
|
import { YtDatePicker } from './YtDatePicker'
|
|
|
import { _YtHeader } from './_YtHeader'
|
|
|
@@ -18,6 +18,7 @@ export function getBuilder(param: DiaLogParam, onBack: (ans?: ESObject) => void)
|
|
|
else if (param.pageEnum == DiaLogPageEnum.TextInput) InputComp({onBack: onBack, param: param.param})
|
|
|
else if (param.pageEnum == DiaLogPageEnum.HistoryToday) HistoryToday({onBack: onBack, param: param.param})
|
|
|
else if (param.pageEnum == DiaLogPageEnum.BubbleSetting) BubbleSetting({onBack: onBack, param: param.param})
|
|
|
+ else if (param.pageEnum == DiaLogPageEnum.GameOver) GameOver({onBack: onBack, param: param.param})
|
|
|
}
|
|
|
|
|
|
// 底部菜单
|
|
|
@@ -368,6 +369,19 @@ struct BubbleSetting{
|
|
|
@Param @Require param: BasicType
|
|
|
|
|
|
@Local bubbleConnect: BubbleStorage = AppStorageV2.connect(BubbleStorage, () => new BubbleStorage())!
|
|
|
+ @Local stabilityStorage: StabilityStorage = AppStorageV2.connect(StabilityStorage, () => new StabilityStorage())!
|
|
|
+ @Local forEach: Array<string> = []
|
|
|
+ @Local isBubble: boolean = true
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.isBubble = this.param.isShowClose ?? true
|
|
|
+ if(this.isBubble) {
|
|
|
+ this.forEach = ['气泡出现频率', '气泡消失时间']
|
|
|
+ } else {
|
|
|
+ this.forEach = ['水平最大偏移', '竖直最大偏移', '训练时间']
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
build() {
|
|
|
Column({space: 9}){
|
|
|
@@ -382,53 +396,136 @@ struct BubbleSetting{
|
|
|
.padding({right: 14, top: 10, bottom: 10})
|
|
|
|
|
|
Column({space: 25}){
|
|
|
- ForEach(['气泡出现频率', '气泡消失时间'], (item: string, index) => {
|
|
|
- Row({space: 15}){
|
|
|
+ ForEach(this.forEach, (item: string, index) => {
|
|
|
+ Row(){
|
|
|
Text(`${item}:`)
|
|
|
.fontSize(16)
|
|
|
.fontWeight(500)
|
|
|
.fontColor('#FF333333')
|
|
|
|
|
|
Row({space: 12}){
|
|
|
- TextInput({text: `${index == 0 ? this.bubbleConnect.bubbleFrequency : this.bubbleConnect.bubbleDisappearTime}`})
|
|
|
- .width(45)
|
|
|
- .height(30)
|
|
|
- .padding(0)
|
|
|
- .maxLength(3)
|
|
|
- .borderRadius(5)
|
|
|
- .type(InputType.Number)
|
|
|
- .textAlign(TextAlign.Center)
|
|
|
- .border({width: 1, color: '#FFFFA001'})
|
|
|
- .onChange((text: string) => {
|
|
|
- if(text){
|
|
|
- let num = parseInt(text) || 1
|
|
|
- if(index == 0){
|
|
|
- this.bubbleConnect.bubbleFrequency = num
|
|
|
- }else{
|
|
|
- this.bubbleConnect.bubbleDisappearTime = num
|
|
|
+ if(this.isBubble) {
|
|
|
+ TextInput({text: `${index == 0 ? this.bubbleConnect.bubbleFrequency : this.bubbleConnect.bubbleDisappearTime}`})
|
|
|
+ .width(45)
|
|
|
+ .height(30)
|
|
|
+ .padding(0)
|
|
|
+ .maxLength(2)
|
|
|
+ .borderRadius(5)
|
|
|
+ .type(InputType.Number)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .border({width: 1, color: '#FFFFA001'})
|
|
|
+ .onChange((text: string) => {
|
|
|
+ if(text){
|
|
|
+ let num = parseInt(text) || 1
|
|
|
+ if(index == 0){
|
|
|
+ this.bubbleConnect.bubbleFrequency = num
|
|
|
+ }else{
|
|
|
+ this.bubbleConnect.bubbleDisappearTime = num
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+ Text('s')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor('#FF333333')
|
|
|
+ } else {
|
|
|
+ TextInput({text: `${index == 0 ? this.stabilityStorage.horizontalMaxOffset : index == 1 ? this.stabilityStorage.verticalMaxOffset : this.stabilityStorage.trainingTime}`})
|
|
|
+ .width(45)
|
|
|
+ .height(30)
|
|
|
+ .padding(0)
|
|
|
+ .maxLength(2)
|
|
|
+ .borderRadius(5)
|
|
|
+ .type(InputType.Number)
|
|
|
+ .textAlign(TextAlign.Center)
|
|
|
+ .border({width: 1, color: '#FFFFA001'})
|
|
|
+ .onChange((text: string) => {
|
|
|
+ if(text){
|
|
|
+ let num = parseInt(text) || 1
|
|
|
+ if(index == 0){
|
|
|
+ this.stabilityStorage.horizontalMaxOffset = Math.min(num, 40)
|
|
|
+ }else if(index == 1){
|
|
|
+ this.stabilityStorage.verticalMaxOffset = Math.min(num, 100)
|
|
|
+ } else {
|
|
|
+ this.stabilityStorage.trainingTime = num
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
- })
|
|
|
+ })
|
|
|
|
|
|
- Text('s')
|
|
|
- .fontSize(16)
|
|
|
- .fontWeight(500)
|
|
|
- .fontColor('#FF333333')
|
|
|
+ Text(index == 2 ? 's' : '°')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor('#FF333333')
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+ .width("100%")
|
|
|
+ .padding({left: 51, right: 51})
|
|
|
+ .justifyContent(FlexAlign.SpaceBetween)
|
|
|
})
|
|
|
+
|
|
|
+ if(this.isBubble) {
|
|
|
+ Text('气泡最多存在 10 个')
|
|
|
+ .fontSize(12)
|
|
|
+ }
|
|
|
}
|
|
|
.width("100%")
|
|
|
.alignItems(HorizontalAlign.Center)
|
|
|
}
|
|
|
.width(294)
|
|
|
- .height(163)
|
|
|
.borderRadius(20)
|
|
|
+ .padding({bottom: 26})
|
|
|
.backgroundColor(Color.White)
|
|
|
.justifyContent(FlexAlign.Start)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+@ComponentV2
|
|
|
+struct GameOver{
|
|
|
+ @Event onBack: (ans?:ESObject) => void
|
|
|
+ @Param @Require param: BasicType
|
|
|
+
|
|
|
+ @Local isWin: boolean = true
|
|
|
+
|
|
|
+ aboutToAppear(): void {
|
|
|
+ this.isWin = this.param.isShowClose ?? true
|
|
|
+ }
|
|
|
+
|
|
|
+ build() {
|
|
|
+ Column({space: 9}){
|
|
|
+ Row(){
|
|
|
+ Image(this.isWin ? $r("app.media.icon_win") : $r("app.media.icon_fail"))
|
|
|
+ .width(175)
|
|
|
+ .height(105)
|
|
|
+ }
|
|
|
+ .width("100%")
|
|
|
+ .position({y: -53})
|
|
|
+ .justifyContent(FlexAlign.Center)
|
|
|
+
|
|
|
+ Text(this.isWin ? '稳定性训练成功' : '稳定性训练失败')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ .fontColor(Color.Black)
|
|
|
+ .padding({top: 67, bottom: 46})
|
|
|
+
|
|
|
+ Row(){
|
|
|
+ Text(this.isWin ? '太棒了' : '继续努力')
|
|
|
+ .fontSize(16)
|
|
|
+ .fontWeight(500)
|
|
|
+ }
|
|
|
+ .borderRadius(8)
|
|
|
+ .padding({left: 41, top: 16, right: 41, bottom: 16})
|
|
|
+ .linearGradient({colors: [['#FFCC00', 0], ['#FF9F02', 1]], angle: 90})
|
|
|
+ .onClick(() => { this.onBack() })
|
|
|
+ }
|
|
|
+ .width(294)
|
|
|
+ .borderRadius(20)
|
|
|
+ .padding({bottom: 30})
|
|
|
+ .backgroundColor(Color.White)
|
|
|
+ .justifyContent(FlexAlign.Start)
|
|
|
+ .alignItems(HorizontalAlign.Center)
|
|
|
+ }
|
|
|
+}
|
|
|
|
|
|
|
|
|
|