创建角色完成

This commit is contained in:
WONIU 2024-12-18 08:54:32 +08:00
parent 6e72ab4310
commit 0e09a72b8f
1 changed files with 63 additions and 32 deletions

View File

@ -216,6 +216,7 @@ class _CreateCharacter extends Yosin_Window {
// Visible = false;
BackGround = null;
headList = null;
jobImg = null;
nextJobImg = null;
@ -229,6 +230,8 @@ class _CreateCharacter extends Yosin_Window {
changJobAniClock = null;
nextJobIndex = null;
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
@ -245,7 +248,7 @@ class _CreateCharacter extends Yosin_Window {
function RegisterWidget() {
//头像
local headList = _CreateCharacter_SelectBaseHeadList(135, 40);
headList = _CreateCharacter_SelectBaseHeadList(135, 40);
AddUIChild(headList);
headList.OnClick = changJob.bindenv(this);
@ -264,41 +267,44 @@ class _CreateCharacter extends Yosin_Window {
// 切换职业
function changJob(index) {
local jobEnum = getJobEnum(index);
// 切换背景
BackGround.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbackground.img", jobEnum));
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum ));
if (index + 1 < 17){
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(index + 1)));
}
local info = getJobInfo(jobEnum);
// 切换介绍
infoWidget.SetJob(getJobInfo(jobEnum));
// 切换底部光动画
nextJobIndex = index;
// 切换背景
BackGround.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbackground.img", jobEnum));
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum));
lightAni.SetVisible(false);
firedustAni.SetVisible(false);
dustAni.SetVisible(false);
auraAni.SetVisible(false);
local info = getJobInfo(jobEnum);
// 切换介绍
infoWidget.SetJob(getJobInfo(jobEnum));
// 切换底部光动画
switch (info.ani){
case BottomLightAniType.light:
lightAni.SetVisible(true);
break;
case BottomLightAniType.firedust:
firedustAni.SetVisible(true);
case BottomLightAniType.dust:
dustAni.SetVisible(true);
break;
case BottomLightAniType.aura:
auraAni.SetVisible(true);
break;
}
lightAni.SetVisible(false);
firedustAni.SetVisible(false);
dustAni.SetVisible(false);
auraAni.SetVisible(false);
switch (info.ani){
case BottomLightAniType.light:
lightAni.SetVisible(true);
break;
case BottomLightAniType.firedust:
firedustAni.SetVisible(true);
case BottomLightAniType.dust:
dustAni.SetVisible(true);
break;
case BottomLightAniType.aura:
auraAni.SetVisible(true);
break;
}
// 开始切换动画
changJobAniClock = clock();
// 开始切换动画
changJobAniClock = clock();
// 切换动画中不响应点击
headList.clickOff = true;
}
@ -306,12 +312,36 @@ class _CreateCharacter extends Yosin_Window {
function changJobAni() {
if (changJobAniClock == null) return;
local ani_progress = sq_GetAccel(100, 0, clock() - changJobAniClock, 1000);
// 动画的前90%后10%,慢
local ani_progress = Math.sq_GetAccel(0, 100, clock() - changJobAniClock, 0.3, false);
if (ani_progress >= 90){
ani_progress = Math.sq_GetAccel(0, 10, clock() - changJobAniClock, 0.7, false) + 90 ;
}
local x = ani_progress * 5.0;
jobImg.SetPosition( 0 - x, 0);
nextJobImg.SetPosition(500 - x, 0);
jobImg.SetOpacity( (100.0 - ani_progress.tofloat()) / 100.0 );
if (ani_progress == 0){
// 动画的前90%透明度进度为50%后10%透明度进度为剩下的50%
local opacity = ani_progress.tofloat() / 180.0;
if (opacity > 0.5) opacity = (ani_progress.tofloat() - 90.0) / 20.0 + 0.5;
nextJobImg.SetOpacity( opacity );
if (ani_progress >= 100){
changJobAniClock = null;
local jobEnum = getJobEnum(nextJobIndex);
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum ));
jobImg.SetOpacity(1);
jobImg.SetPosition(0, 0);
if (nextJobIndex < 16) {
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(nextJobIndex + 1)));
nextJobImg.SetOpacity(0);
nextJobImg.SetPosition(500, 0);
}
headList.clickOff = false;
}
}
@ -330,6 +360,7 @@ class _CreateCharacter extends Yosin_Window {
// 下一个人物图片
nextJobImg = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 11);
nextJobImg.SetPosition(500, 0);
nextJobImg.SetOpacity(0);
Addchild(nextJobImg);
// 光动画 ui/charactercreate/topdodge.ani