Commit 6d367c3d authored by Tt's avatar Tt

修改按钮事件

parent 3ab9a267
No preview for this file type
This diff is collapsed.
......@@ -32,7 +32,7 @@ export default class SceneComponent extends MyCocosSceneComponent {
initData() {
this.speed = 30
}
initView() {}
initView() { }
initEvent() {
let bottom_megaphone = pg.view.find(this, 'layer_game/bg/bottom_megaphone')
// 底部海螺点击事件
......@@ -44,10 +44,10 @@ export default class SceneComponent extends MyCocosSceneComponent {
// 开始海螺从底部升起
let btn = cc.tween(bottom_megaphone)
btn.to(1.5, { y: -438 })
.call(() => {
// 海螺第一次从底部升起后自动制造气泡一次
this.create_bubbles()
})
.call(() => {
// 海螺第一次从底部升起后自动制造气泡一次
this.create_bubbles()
})
btn.start()
}
// 制造气泡
......@@ -56,42 +56,42 @@ export default class SceneComponent extends MyCocosSceneComponent {
let layer_paopao = pg.view.find(this, 'layer_game/bg/layer_paopao')
let paoaoParent = pg.view.find(this, 'layer_game/bg/paopao')
let newPaoPao = cc.instantiate(paoaoParent)
pg.view.touchOn(newPaoPao, this.touchPaoPao, this)
let paopao = newPaoPao.getChildByName("bubble")
let broken = newPaoPao.getChildByName("bubble_broken")
let btn = cc.tween(bottom_megaphone)
layer_paopao.addChild(newPaoPao)
btn.to(0.1, { x: -5 }).to(0.1, { x: 0 }).to(0.1, { x: 5 }).to(0.1, { x: 0 })
btn.to(0.1, { x: -5 }).to(0.1, { x: 0 }).to(0.1, { x: 5 }).to(0.1, { x: 0 })
.call(() => {
newPaoPao.x = 135
newPaoPao.y = -450
paopao.width = 70
paopao.height = 70
newPaoPao.opacity = 0
pg.view.visible(newPaoPao, true)
pg.view.visible(broken, false)
// 点击泡泡
pg.view.touchOn(newPaoPao, this.touchPaoPao, this)
cc.tween(newPaoPao).to(0.8, {opacity: 255}).call(() => {
let positionY = Math.floor(Math.random()*300)
let positionX = this.getPositionX()
cc.tween(newPaoPao).to(positionY/this.speed, {x: positionX, y: positionY, scale: 3}).call(() => {
if(newPaoPao.y < cc.winSize.height + 105) {
cc.tween(newPaoPao).to((750-newPaoPao.y)/this.speed, {y: cc.winSize.height + 105}).call(() => {
newPaoPao.destroy()
}).start()
}
.call(() => {
newPaoPao.x = 135
newPaoPao.y = -450
paopao.width = 70
paopao.height = 70
newPaoPao.opacity = 0
pg.view.visible(newPaoPao, true)
pg.view.visible(broken, false)
// 点击泡泡
cc.tween(newPaoPao).to(0.8, { opacity: 255 }).call(() => {
let positionY = Math.floor(Math.random() * 300)
let positionX = this.getPositionX()
cc.tween(newPaoPao).to(positionY / this.speed, { x: positionX, y: positionY, scale: 3 }).call(() => {
if (newPaoPao.y < cc.winSize.height + 105) {
cc.tween(newPaoPao).to((750 - newPaoPao.y) / this.speed, { y: cc.winSize.height + 105 }).call(() => {
newPaoPao.destroy()
}).start()
}
}).start()
}).start()
}).start()
})
})
btn.start()
}
getPositionX() {
if(Math.random() < 0.5) {
return - Math.floor(Math.random()*900)
if (Math.random() < 0.5) {
return - Math.floor(Math.random() * 900)
} else {
return Math.floor(Math.random()*900)
return Math.floor(Math.random() * 900)
}
}
// 点击泡泡
......
......@@ -76,10 +76,10 @@
<div class="model-content">
<div style="padding: 10px;background-color: #fff;">
<div class="border-dashed" style="margin: 20px;width: 1000px;">
<!-- <div class="border-dashed" style="margin: 20px;width: 1000px;">
<span style="font-size: 20px;">标题: </span>
<input type="text" nz-input [(ngModel)]="item.title" (blur)="save()">
<!-- <span style="font-size: 20px;">题目说明: </span>
<span style="font-size: 20px;">题目说明: </span>
<input type="text" nz-input [(ngModel)]="item.questionText" (blur)="save()">
<span style="font-size: 20px;">题目说明音频: </span>
<div style="display:flex ;">
......@@ -90,23 +90,23 @@
<div style="margin: 5px">
<span>{{ item.audioName}}</span>
</div>
</div> -->
</div>
</div>
<div class="border-dashed" style="margin: 20px;width: 1000px;">
<div style="font-size: 20px;">游戏模式: </div>
<nz-radio-group [(ngModel)]="item.recordFlag" (ngModelChange)="save()">
<nz-radio-group [(ngModel)]="item.onlineFlg" (ngModelChange)="save()">
<label nz-radio [nzValue]="true">
<span [style]="{color:item.recordFlag==true ? '#169BD5':'#000'}">录音模式</span>
<span [style]="{color:item.onlineFlg==true ? '#169BD5':'#000'}">联机版</span>
</label>
<label nz-radio [nzValue]="false">
<span [style]="{color:item.recordFlag==false ? '#169BD5':'#000'}">听音模式</span>
<span [style]="{color:item.onlineFlg==false ? '#169BD5':'#000'}">单机版</span>
</label>
</nz-radio-group>
</div>
<!-- <div class="border-dashed" style="margin: 20px;width: 1000px;">
<div class="border-dashed" style="margin: 20px;width: 1000px;">
<div class="word-input-title">
<div>
<span>游戏背景音乐: </span>
......@@ -135,12 +135,12 @@
<div *ngFor="let question of item.questions; let i = index">
<div style="display: flex;margin-top: 20px;">
<div class="border-solid" style="min-width: 1000px;">
<!-- <div class="word-type-title">
<div class="word-type-title">
题目{{i+1}}
</div> -->
</div>
<!-- <div>
<div>
<div class="word-type-option-title" style="margin-top:10px;">题目音频:</div>
<div style="display:flex ;">
<div>
......@@ -152,7 +152,7 @@
<span>{{ question.audioName}}</span>
</div>
</div>
</div> -->
</div>
<!-- <div style="margin-top:20px">
<div class="word-type-option-title">倒计时: </div>
......@@ -162,39 +162,33 @@
<div class="word-type-option-title" style="margin-top:20px;">
题目内容:
选项内容:
</div>
<div *ngFor="let option of question.options; let j = index">
<div style="display: flex;margin-top:20px">
<div class="option-title">
题目{{j+1}}
选项{{j+1}}
</div>
<div class="option-content" style="padding: 15px 30px;">
<!-- <div style="margin:-15px -30px;width: calc(100%+60px);height: 40px;padding:10px 20px;" [style]="{
<div style="margin:-15px -30px;width: calc(100%+60px);height: 40px;padding:10px 20px;" [style]="{
backgroundColor: option.right ?'#169BD5':'#eee'}">
<label nz-checkbox [(ngModel)]="option.right" (ngModelChange)="save()"
[style]="{color: option.right ?'#fff':'#000'}">正确答案</label>
</div> -->
</div>
<div style="margin-top: 20px;">
<div class="word-type-option-title">
类型:
选项类型:
</div>
<div style="margin-top: 5px;">
<nz-radio-group [(ngModel)]="option.type" (ngModelChange)="ngChange(i,j)">
<label nz-radio nzValue="img">
<span [style]="{color:option.type=='img' ? '#169BD5':'#000'}">图片</span>
</label>
<label nz-radio nzValue="img_txt">
<span [style]="{color:option.type=='img_txt' ? '#169BD5':'#000'}">图片+文本</span>
</label>
<label nz-radio nzValue="img_audio">
<span [style]="{color:option.type=='img_audio' ? '#169BD5':'#000'}">图片+音频</span>
</label>
<label nz-radio nzValue="img_txt_audio">
<span [style]="{color:option.type=='img_txt_audio' ? '#169BD5':'#000'}">图片+文本+音频</span>
<label nz-radio nzValue="txt">
<span [style]="{color:option.type=='txt' ? '#169BD5':'#000'}">文字</span>
</label>
</nz-radio-group>
</div>
......@@ -202,7 +196,7 @@
<div style="margin-top: 25px;">
<div class="option-img">
<div style="width: 200px;">
<div *ngIf="option.type=='img'" style="width: 200px;">
<span style="font-size: 20px;">图片:</span>
<app-upload-image-with-preview [picUrl]="option.image"
(imageUploaded)="onImageUploadSuccess($event, 'image',option)">
......@@ -210,13 +204,13 @@
</div>
</div>
<div class="option-text">
<div *ngIf="option.type=='img_txt'|| option.type=='img_txt_audio' " style="width: 200px">
<div *ngIf="option.type=='txt'" style="width: 200px">
<span style="font-size: 20px;">文本</span>
<input type="text" nz-input [(ngModel)]="option.text" (blur)="save()">
</div>
</div>
<div class="option-audio" *ngIf="option.type=='img_audio' || option.type=='img_txt_audio'">
<!-- <div class="option-audio">
<span style="font-size: 20px;">选项音频:</span>
<div style="display: flex">
<div>
......@@ -230,37 +224,33 @@
</span>
</div>
</div>
</div>
<div class="option-time" *ngIf="item.recordFlag==true">
<div class="word-type-option-title">录音倒计时: </div>
<input type="number" nz-input [(ngModel)]="option.duration" (blur)="save()">
<span style="font-size: 20px;">录音文本</span>
<input type="text" nz-input [(ngModel)]="option.content" (blur)="save()">
</div>
</div> -->
<!-- <div class="option-time">
</div> -->
</div>
</div>
<div class="option-btns">
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeoption(i,j)">删除题目</button>
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removeoption(i,j)">删除选项</button>
<button class="btn-blue" style="margin-top: 10px;" nz-button nzType="default" nzDanger
(click)="copyOption(i,j)">复制题目</button>
(click)="copyOption(i,j)">复制选项</button>
</div>
</div>
</div>
<div style="margin-left: 69px;margin-top: 15px;">
<button class="btn-blue" nz-button nzType="default" nzDanger (click)="addoption(i)">+增加题目</button>
<button class="btn-blue" nz-button nzType="default" nzDanger (click)="addoption(i)">+增加选项</button>
</div>
</div>
<div style="margin:0 20px">
<!-- <button class="btn-red" nz-button nzType="default" nzDanger (click)="removequestion(i)">删除题目</button> -->
<button class="btn-red" nz-button nzType="default" nzDanger (click)="removequestion(i)">删除题目</button>
</div>
</div>
</div>
<!-- <button class="btn-blue" style="margin-top:10px;width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
(click)="addquestion()">+增加题目</button> -->
<button class="btn-blue" style="margin-top:10px;width: 1000px; height: 50px;" nz-button nzType="default" nzDanger
(click)="addquestion()">+增加题目</button>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment