|
|
@@ -16,58 +16,48 @@ export class OptionsCtr extends Component {
|
|
|
@property({ type: Sprite })
|
|
|
notSelectedSprite: Sprite = null // 设置你想要的选中背景图
|
|
|
|
|
|
- private votesOrgPos_x:number = -894
|
|
|
+ private votesOrgPos_x: number = -894
|
|
|
private votesWidth = 890
|
|
|
- start() {
|
|
|
-
|
|
|
- }
|
|
|
- resetVotes()
|
|
|
- {
|
|
|
- for(let i=0;i<4;i++)
|
|
|
- {
|
|
|
+ start() {}
|
|
|
+ resetVotes() {
|
|
|
+ for (let i = 0; i < 4; i++) {
|
|
|
const vote: Node = this.optionNodes[i].getChildByName("votes").getChildByName("toupiaojindu")
|
|
|
vote.active = false
|
|
|
- vote.getChildByName('votePannel_particle').active = false
|
|
|
- vote.setPosition(this.votesOrgPos_x,0,0)
|
|
|
+ vote.getChildByName("votePannel_particle").active = false
|
|
|
+ vote.setPosition(this.votesOrgPos_x, 0, 0)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
- showVotes(num: number[] , processCtr: processCtr) {
|
|
|
+ showVotes(num: number[], processCtr: processCtr) {
|
|
|
let index = 0
|
|
|
|
|
|
//获取投票范围,修改合适步长
|
|
|
- let scope:number = 10
|
|
|
+ let scope: number = 10
|
|
|
|
|
|
const maxValue = Math.max(...num)
|
|
|
- if(maxValue > 10 && maxValue < 100)
|
|
|
- {
|
|
|
- scope = 100
|
|
|
- }
|
|
|
- else if(maxValue > 99)
|
|
|
- {
|
|
|
- scope = 1000
|
|
|
- }
|
|
|
+ if (maxValue > 10 && maxValue < 100) {
|
|
|
+ scope = 100
|
|
|
+ } else if (maxValue > 99) {
|
|
|
+ scope = 1000
|
|
|
+ }
|
|
|
|
|
|
- for(let i=0;i<4;i++)
|
|
|
- {
|
|
|
+ for (let i = 0; i < 4; i++) {
|
|
|
const vote: Node = this.optionNodes[i].getChildByName("votes").getChildByName("toupiaojindu")
|
|
|
- if(!vote.active || !vote.getChildByName('votePannel_particle').active )
|
|
|
- {
|
|
|
+ if (!vote.active || !vote.getChildByName("votePannel_particle").active) {
|
|
|
vote.active = true
|
|
|
- vote.getChildByName('votePannel_particle').active = true
|
|
|
+ vote.getChildByName("votePannel_particle").active = true
|
|
|
}
|
|
|
- tween(vote).to(1, {
|
|
|
- position: new Vec3(this.votesOrgPos_x + (this.votesWidth / scope) * num[i], 0, 0)
|
|
|
- })
|
|
|
- .call(()=>{
|
|
|
- if(index ===3)
|
|
|
- {
|
|
|
- processCtr.doneProcessing()
|
|
|
- }
|
|
|
- index++
|
|
|
- })
|
|
|
- .start()
|
|
|
+ tween(vote)
|
|
|
+ .to(1, {
|
|
|
+ position: new Vec3(this.votesOrgPos_x + (this.votesWidth / scope) * num[i], 0, 0)
|
|
|
+ })
|
|
|
+ .call(() => {
|
|
|
+ if (index === 3) {
|
|
|
+ processCtr.doneProcessing()
|
|
|
+ }
|
|
|
+ index++
|
|
|
+ })
|
|
|
+ .start()
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -81,6 +71,7 @@ export class OptionsCtr extends Component {
|
|
|
for (let i = 0; i < 4; i++) {
|
|
|
const nodeLabel = this.optionNodes[i].getChildByName("text_option").getComponent(Label)
|
|
|
nodeLabel.string = ""
|
|
|
+ this.optionNodes[i].getComponent(UIOpacity).opacity = 255
|
|
|
}
|
|
|
|
|
|
tween(this.node.getComponent(UIOpacity))
|
|
|
@@ -126,7 +117,6 @@ export class OptionsCtr extends Component {
|
|
|
spriteComponent.spriteFrame = this.selectedSprite.spriteFrame
|
|
|
}
|
|
|
|
|
|
-
|
|
|
this.selectedAction(optionNode)
|
|
|
} else {
|
|
|
// 这是未被选中的选项
|