This commit is contained in:
PC-20230316NUNE\Administrator
2024-01-06 19:18:02 +08:00
parent 7d5ce58e5e
commit 6be5ebf5ea
35 changed files with 43174 additions and 450 deletions

View File

@@ -0,0 +1,57 @@
import { _decorator, Component, Node } from 'cc';
import { JNPageView } from '../../../../../extensions/ngame/assets/ngame/util/components/pageview/JNPageView';
import { Button } from 'cc';
import { tween } from 'cc';
import { Widget } from 'cc';
import { UITransform } from 'cc';
const { ccclass, property } = _decorator;
@ccclass('MainControl')
export class MainControl extends Component {
@property(Button)
leftButton:Button;
@property(Button)
rightButton:Button;
onLoad(){
this.onUpdateView();
}
onUpdateView(){
let pageIndex = this.getComponent(JNPageView).getCurrentPageIndex() - 1;
if(pageIndex){
tween(this.leftButton.getComponent(Widget))
.to(.3,{left:-this.leftButton.getComponent(UITransform).width})
.start();
tween(this.rightButton.getComponent(Widget))
.to(.3,{right:0})
.start();
}else{
tween(this.leftButton.getComponent(Widget))
.to(.3,{left:0})
.start();
tween(this.rightButton.getComponent(Widget))
.to(.3,{right:-this.rightButton.getComponent(UITransform).width})
.start();
}
}
//下一页
onClickRight(){
this.getComponent(JNPageView).setCurrentPageIndex(1);
this.onUpdateView();
}
//上一页
onClickLeft(){
this.getComponent(JNPageView).setCurrentPageIndex(0);
this.onUpdateView();
}
}

View File

@@ -0,0 +1,9 @@
{
"ver": "4.0.23",
"importer": "typescript",
"imported": true,
"uuid": "00caacaa-5016-4f56-8ff0-a6ebeb991e96",
"files": [],
"subMetas": {},
"userData": {}
}