From 0e09a72b8fbc5a980cf8e2fe92d21bcd19ebb388 Mon Sep 17 00:00:00 2001 From: WONIU Date: Wed, 18 Dec 2024 08:54:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A7=92=E8=89=B2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/User/UI/Window/2_Create_Character.nut | 95 +++++++++++++++-------- 1 file changed, 63 insertions(+), 32 deletions(-) diff --git a/sqr/User/UI/Window/2_Create_Character.nut b/sqr/User/UI/Window/2_Create_Character.nut index 0d8800e..6a1e722 100644 --- a/sqr/User/UI/Window/2_Create_Character.nut +++ b/sqr/User/UI/Window/2_Create_Character.nut @@ -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