From a10e96e83bf2d9ab02549e02c907d71f87bf7751 Mon Sep 17 00:00:00 2001 From: Lenheart <947330670@qq.com> Date: Sat, 14 Dec 2024 21:31:44 +0800 Subject: [PATCH 1/7] =?UTF-8?q?=E6=9B=B4=E6=96=B0GenerateNormal=20?= =?UTF-8?q?=E6=96=87=E5=AD=97=E7=9A=84=20=E5=8F=82=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (cherry picked from commit f430d6af419bbcddca351ddb2de6aefa851fe652) --- sqr/User/Asset/FontAsset.nut | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sqr/User/Asset/FontAsset.nut b/sqr/User/Asset/FontAsset.nut index e91929b..bee34c6 100644 --- a/sqr/User/Asset/FontAsset.nut +++ b/sqr/User/Asset/FontAsset.nut @@ -23,11 +23,9 @@ class _FontAssetManager_ { } //生成普通宋体小字 - function GenerateNormal(text, rgba, stroke) { + function GenerateNormal(text, stroke, style = {}) { //登录按钮文本 - local TextActor = TextActor(0, { - color = rgba - }); + local TextActor = TextActor(0, style); TextActor.SetText(text); if (stroke) TextActor.SetOutline(3.0); From 68068e79ff63ec4d0a47d05f506f36e55460ca11 Mon Sep 17 00:00:00 2001 From: WONIU Date: Sat, 14 Dec 2024 22:20:37 +0800 Subject: [PATCH 2/7] =?UTF-8?q?=E4=B9=9D=E5=AE=AB=E6=A0=BC=E6=8B=89?= =?UTF-8?q?=E4=BC=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/Core/UI_Class/UI_Widget.nut | 88 +++++++++++++++++++++++++++++++++ 1 file changed, 88 insertions(+) diff --git a/sqr/Core/UI_Class/UI_Widget.nut b/sqr/Core/UI_Class/UI_Widget.nut index 5d47d0c..73ed082 100644 --- a/sqr/Core/UI_Class/UI_Widget.nut +++ b/sqr/Core/UI_Class/UI_Widget.nut @@ -185,6 +185,94 @@ class Yosin_EmeStretch extends Yosin_CommonUi { } } + + +//九宫格拉伸 +class Yosin_NineBoxStretch extends Yosin_CommonUi { + + constructor(X, Y, W, H, Path, Idx) { + base.constructor(X, Y, W, H); + DrawBackground( W, H, Path, Idx); + } + + + // 绘制 + function DrawBackground(width, height, path, imgId) { + + local x = 0; + local y = 0; + + // 左上角 + local backgroundTopLeft = CL_SpriteObject(path, imgId); + backgroundTopLeft.SetPosition(x, y); + Addchild(backgroundTopLeft); + // 左上角图片大小 + local cornerImgSize = backgroundTopLeft.GetSize(); + local cornerWidth = cornerImgSize.w; + local cornerHeight = cornerImgSize.h; + + // 中间 + local backgroundCenter = CL_SpriteObject(path, imgId + 4); + backgroundCenter.SetPosition(cornerWidth, y + cornerHeight); + Addchild(backgroundCenter); + // 中间图片大小 + local centerImgSize = backgroundCenter.GetSize(); + local centerWidth = centerImgSize.w; + local centerHeight = centerImgSize.h; + + + local scaleW = (width.tofloat() - cornerWidth.tofloat() * 2.0) / centerWidth.tofloat(); + local scaleH = (height.tofloat() - y.tofloat() - cornerHeight.tofloat()) / centerHeight.tofloat(); + + // 上边 + local backgroundTop = CL_SpriteObject(path, imgId + 1); + backgroundTop.SetPosition(cornerWidth, y); + backgroundTop.SetScale(scaleW, 1); + Addchild(backgroundTop); + + // 右上角 + local backgroundTopRight = CL_SpriteObject(path, imgId + 2); + backgroundTopRight.SetPosition(width - cornerWidth, y); + Addchild(backgroundTopRight); + + // 左边 + local backgroundLeft = CL_SpriteObject(path, imgId + 3); + backgroundLeft.SetPosition(x, y + cornerHeight ); + backgroundLeft.SetScale(1, scaleH); + Addchild(backgroundLeft); + + // 中间 + backgroundCenter.SetScale(scaleW, scaleH); + + // 右边 + local backgroundRight = CL_SpriteObject(path, imgId + 5); + backgroundRight.SetPosition(width - cornerWidth, y + cornerHeight); + backgroundRight.SetScale(1, scaleH); + Addchild(backgroundRight); + + // 左下角 + local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6); + backgroundBottomLeft.SetPosition(x, height - cornerHeight); + Addchild(backgroundBottomLeft); + + // 下边 + local backgroundBottom = CL_SpriteObject(path, imgId + 7); + backgroundBottom.SetPosition(cornerWidth, height - cornerHeight); + backgroundBottom.SetScale( scaleW , 1); + Addchild(backgroundBottom); + + // 右下角 + local backgroundBottomRight = CL_SpriteObject(path, imgId + 8); + backgroundBottomRight.SetPosition(width - cornerWidth, height - cornerHeight); + Addchild(backgroundBottomRight); + + } + +} + + + + //拼接按钮 class Yosin_SplicingButton extends Yosin_CommonUi { //按钮状态 From c7dfe7c994f24d3a7d9ece7414782fa3d240093f Mon Sep 17 00:00:00 2001 From: WONIU Date: Sat, 14 Dec 2024 22:22:42 +0800 Subject: [PATCH 3/7] =?UTF-8?q?=E5=85=AC=E5=91=8A=E6=B6=88=E6=81=AF?= =?UTF-8?q?=E5=BC=B9=E7=AA=97(=E5=8A=A8=E6=80=81=E5=A4=A7=E5=B0=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/SquirrelFileConfig.cfg | 1 + sqr/User/UI/Window/233_HUD_Message.nut | 133 +++++++++++++++++++++++++ sqr/folder-alias.json | 3 + 3 files changed, 137 insertions(+) create mode 100644 sqr/User/UI/Window/233_HUD_Message.nut diff --git a/sqr/SquirrelFileConfig.cfg b/sqr/SquirrelFileConfig.cfg index 37d3433..74b3fff 100644 --- a/sqr/SquirrelFileConfig.cfg +++ b/sqr/SquirrelFileConfig.cfg @@ -66,5 +66,6 @@ sqr/User/UI/Widget/Scroll_Bar.nut sqr/User/UI/Window/0_Login.nut sqr/User/UI/Window/1_Select_Character.nut +sqr/User/UI/Window/233_HUD_Message.nut sqr/User/main.nut \ No newline at end of file diff --git a/sqr/User/UI/Window/233_HUD_Message.nut b/sqr/User/UI/Window/233_HUD_Message.nut new file mode 100644 index 0000000..9030c52 --- /dev/null +++ b/sqr/User/UI/Window/233_HUD_Message.nut @@ -0,0 +1,133 @@ +/* +文件名:233_HUD_Message.nut +路径:User/UI/Window/233_HUD_Message.nut +创建日期:2024-12-14 08:10 +文件用途: 公告或信息弹窗 +*/ + +class HUD_Message extends Yosin_Window { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + BackGroundMusic = null; + + cacheW = 230; + cacheH = 155; + + titleTextActor = null; + messageTextActor = null; + + constructor(gX, gY, message, info = { + // 标题 + title = "公告", + // 水平边距 + horizontalMargin = 20, + // 垂直边距 + verticalMargin = 20, + } ) { + + local title = info.rawin("title") ? info.title : "公告"; + local horizontalMargin = info.rawin("horizontalMargin") ? info.horizontalMargin : 20; + local verticalMargin = info.rawin("verticalMargin") ? info.verticalMargin : 20; + + // 标题 + titleTextActor = FontAssetManager.GenerateNormal(title, true, { + color = sq_RGBA(206, 189, 140, 255), + alignment = TextAlign.Center, + }); + + // 标题动态宽度 + if (titleTextActor.GetSize().w > cacheW - 40) { + cacheW = titleTextActor.GetSize().w + 40; + } + + + // 内容 + messageTextActor = FontAssetManager.GenerateNormal(message, false, { + color = sq_RGBA(206, 189, 140, 255), + alignment = TextAlign.Center, + wrap_width = cacheW - horizontalMargin * 2, + }); + + // 内容动态高度 + local verticalMargin = 50 + verticalMargin * 2; + cacheH = messageTextActor.GetSize().h + verticalMargin; + + print("cacheW:" + cacheW.tostring()); + print("cacheH:" + cacheH.tostring()); + + // 默认构造数据 + base.constructor("公告或信息弹窗" + clock().tostring() , gX, gY, cacheW, cacheH, 20); + + + //注册控件 + RegisterWidget(); + //注册绘制 + RegisterDraw(); + } + + function RegisterWidget() { + //背景 + local background = Yosin_NineBoxStretch(-1, 15, cacheW + 2, cacheH, "sprite/interface/lenheartwindowcommon.img", 97); + AddUIChild(background); + local twoBackground = Yosin_NineBoxStretch(4, 20, cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97); + AddUIChild(twoBackground); + + // 绘制标题背景 + local titleBackground = Yosin_EmeStretch(0, 0, cacheW, 20, "sprite/interface/lenheartwindowcommon.img", 609); + AddUIChild(titleBackground); + + //确认按钮 + local confirmButton = Yosin_BaseButton( cacheW / 2 - 28, cacheH - 15, 56, 24 "sprite/interface/lenheartwindowcommon.img", 12); + confirmButton.OnClick = function(Button) { + this.RemoveSelf(); + }.bindenv(this); + AddUIChild(confirmButton); + + // 绘制标题 + local confirmTextActor = FontAssetManager.GenerateNormal("确认", sq_RGBA(206, 189, 140, 255), true); + confirmTextActor.SetPosition(17, 6); + confirmButton.Addchild(confirmTextActor); + + //关闭按钮 + local closeButton = Yosin_BaseButton( cacheW - 15, 5, 10, 9 "sprite/interface/lenheartwindowcommon.img", 42); + closeButton.OnClick = function(Button) { + this.RemoveSelf(); + }.bindenv(this); + AddUIChild(closeButton); + + + } + + function RegisterDraw() { + + local titleX = cacheW / 2 - titleTextActor.GetSize().w / 2; + // 绘制标题 + titleTextActor.SetPosition( titleX , 2); + Addchild(titleTextActor); + + + local messageX = cacheW / 2 - messageTextActor.GetSize().w / 2; + local messageY = cacheH / 2 - messageTextActor.GetSize().h / 2; + + // 绘制内容 + messageTextActor.SetPosition( messageX , messageY ); + Addchild(messageTextActor); + + } + + + //逻辑入口 + function Proc(Dt) { + + SyncPos(X, Y); + base.Proc(Dt); + } + +} \ No newline at end of file diff --git a/sqr/folder-alias.json b/sqr/folder-alias.json index 5b2926c..1867f3c 100644 --- a/sqr/folder-alias.json +++ b/sqr/folder-alias.json @@ -169,5 +169,8 @@ }, "User/UI/Widget/Drag_Button.nut": { "description": "拖动按钮" + }, + "User/UI/Window/233_HUD_Message.nut": { + "description": "公告弹窗" } } \ No newline at end of file From f33838a2e936952fbbbbad8b2e4cb13edbd825df Mon Sep 17 00:00:00 2001 From: WONIU Date: Sun, 15 Dec 2024 21:37:00 +0800 Subject: [PATCH 4/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/SquirrelFileConfig.cfg | 1 + sqr/User/UI/Window/2_Create_Character.nut | 221 ++++++++++++++++++++++ sqr/folder-alias.json | 3 + 3 files changed, 225 insertions(+) create mode 100644 sqr/User/UI/Window/2_Create_Character.nut diff --git a/sqr/SquirrelFileConfig.cfg b/sqr/SquirrelFileConfig.cfg index 74b3fff..e9798ab 100644 --- a/sqr/SquirrelFileConfig.cfg +++ b/sqr/SquirrelFileConfig.cfg @@ -66,6 +66,7 @@ sqr/User/UI/Widget/Scroll_Bar.nut sqr/User/UI/Window/0_Login.nut sqr/User/UI/Window/1_Select_Character.nut +sqr/User/UI/Window/2_create_Character.nut sqr/User/UI/Window/233_HUD_Message.nut sqr/User/main.nut \ No newline at end of file diff --git a/sqr/User/UI/Window/2_Create_Character.nut b/sqr/User/UI/Window/2_Create_Character.nut new file mode 100644 index 0000000..141c06d --- /dev/null +++ b/sqr/User/UI/Window/2_Create_Character.nut @@ -0,0 +1,221 @@ +/* +文件名:2_create_Character.nut +路径:User/UI/Window/2_create_Character.nut +创建日期:2024-12-15 17:40 +文件用途: 创建角色 +*/ + +class CreateCharacter extends Yosin_Window { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + BackGroundMusic = null; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //注册绘制 + RegisterDraw(); + //注册控件 + RegisterWidget(); + + //播放音乐 + PlayBackgroundMusic(); + } + + function PlayBackgroundMusic() { + + } + + function MusicLogic() { + if (BackGroundMusic == null) return; + if (!BackGroundMusic.IsPlaying()) BackGroundMusic.Play(); + } + + function RegisterWidget() { + //账号输入框 + local AccountInputBox = Yosin_InputBox(752, 240, 200); + AddUIChild(AccountInputBox); + + } + + function RegisterDraw() { + //大背景 + local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 14); + Addchild(BackGround); + + } + + //逻辑入口 + function Proc(Dt) { + MusicLogic(); + + SyncPos(X, Y); + base.Proc(Dt); + } + +} + + +//选择创建基础角色 +class CreateCharacter_SelectBase extends Yosin_Window { + //调试模式 + // DeBugMode = true; + + //不是窗口 + // NoWindow = true; + + //是否可见 + // Visible = false; + + BackGroundMusic = null; + + constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { + base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); + + //注册绘制 + RegisterDraw(); + //注册控件 + RegisterWidget(); + + } + + function PlayBackgroundMusic() { + + } + + function RegisterWidget() { + //账号输入框 + local headButton = HeadButton(0, 0, CHARACTERJOB.SWORDMAN); + AddUIChild(headButton); + + } + + function RegisterDraw() { + //大背景 + local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0); + Addchild(BackGround); + + } + + //逻辑入口 + function Proc(Dt) { + + SyncPos(X, Y); + base.Proc(Dt); + } + +} + + + + + + + + + +//头像按钮 +class HeadButton extends Yosin_CommonUi { + + // 角色名称 + name = ""; + + // 图像id + imageId = 0; + + // 状态 0:普通 1:悬停 2:按下 3:不可用 + state = 0; + spriteState = 0; + + // 角色头像精灵 + CharacterSprite = null; + + // 角色头像覆盖精灵 + CharacterSpriteCover = null; + + constructor(X, Y, jobEnum, state = 0) { + + this.name = name; + this.state = state; + + // 计算图像id + this.imageId = jobEnum * 2 + 3; + + + base.constructor(X, Y, 62, 62); + + // 角色头像 + CharacterSprite = CL_SpriteObject(); + CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId)); + CharacterSprite.SetPosition(0, 0); + Addchild(CharacterSprite); + + CharacterSpriteCover = CL_SpriteObject(); + CharacterSpriteCover.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", state)); + CharacterSprite.SetPosition(0, 0); + Addchild(CharacterSpriteCover); + + ChangeFrame(); + } + + function ChangeFrame() { + if (spriteState == state) return; + print(111); + //不可用 + if (state == 3) { + CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1)); + CharacterSpriteCover.SetVisible(false); + }else{ + CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId)); + CharacterSpriteCover.SetVisible(true) + CharacterSpriteCover.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", state)); + } + + spriteState = state; + } + + function Proc(Dt) { + //不可用 + if (state == 3) { + return; + } else { + //按下 + if (isLBDown) { + state = 2; + } + //悬停 + else if (isInRect) { + if (state == 2) return; + state = 1; + } + //普通 + else { + if (state == 2) return; + state = 0; + } + } + ChangeFrame(); + } +} + + + + + + + + + + + + + + + diff --git a/sqr/folder-alias.json b/sqr/folder-alias.json index 1867f3c..802881f 100644 --- a/sqr/folder-alias.json +++ b/sqr/folder-alias.json @@ -172,5 +172,8 @@ }, "User/UI/Window/233_HUD_Message.nut": { "description": "公告弹窗" + }, + "User/UI/Window/2_Create_Character.nut": { + "description": "创建角色" } } \ No newline at end of file From d0000d2fb917fd1637f63ea2d9715be251804f13 Mon Sep 17 00:00:00 2001 From: WONIU Date: Sun, 15 Dec 2024 21:38:13 +0800 Subject: [PATCH 5/7] =?UTF-8?q?=E8=81=8C=E4=B8=9A=E6=9E=9A=E4=B8=BE?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=B3=A8=E9=87=8A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/User/_ENUM/enum_game.nut | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/sqr/User/_ENUM/enum_game.nut b/sqr/User/_ENUM/enum_game.nut index d8bff0c..0ca3d43 100644 --- a/sqr/User/_ENUM/enum_game.nut +++ b/sqr/User/_ENUM/enum_game.nut @@ -7,24 +7,24 @@ */ //职业枚举表 enum CHARACTERJOB { - SWORDMAN - FIGHTER - GUNNER - MAGE - PRIEST - AT_GUNNER - THIEF - AT_FIGHTER - AT_MAGE - DEMONIC_SWORDMAN - CREATOR_MAGE - AT_SWORDMAN - KNIGHT - DEMONIC_LANCER - AT_PRIEST - GUN_BLADER - ARCHER - MAX + SWORDMAN // 男鬼剑士 + FIGHTER // 女格斗家 + GUNNER // 男神枪手 + MAGE // 女魔法师 + PRIEST // 男圣职者 + AT_GUNNER // 女神枪手 + THIEF // 女暗夜使者 + AT_FIGHTER // 男格斗家 + AT_MAGE // 男魔法师 + DEMONIC_SWORDMAN // 黑暗武士 + CREATOR_MAGE // 缔造者 + AT_SWORDMAN // 女鬼剑士 + KNIGHT // 守护者 + DEMONIC_LANCER // 魔枪士 + AT_PRIEST // 女圣职者 + GUN_BLADER // 枪剑士 + ARCHER // 弓箭手 + MAX // 无 }; //时装枚举类 From 72684885d52d240ac662d4eec7a4c1356cfa7a42 Mon Sep 17 00:00:00 2001 From: WONIU Date: Wed, 18 Dec 2024 07:02:27 +0800 Subject: [PATCH 6/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A7=92=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqr/Core/UI_Class/UI_Widget.nut | 16 +- sqr/User/Stage/TestStage.nut | 4 +- sqr/User/UI/Window/2_Create_Character.nut | 587 +++++++++++++++++++--- sqr/User/_ENUM/enum_game.nut | 2 +- 4 files changed, 523 insertions(+), 86 deletions(-) diff --git a/sqr/Core/UI_Class/UI_Widget.nut b/sqr/Core/UI_Class/UI_Widget.nut index 73ed082..bd64a77 100644 --- a/sqr/Core/UI_Class/UI_Widget.nut +++ b/sqr/Core/UI_Class/UI_Widget.nut @@ -165,17 +165,29 @@ class Yosin_EmeStretch extends Yosin_CommonUi { if (Direction) { local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w); local ScaleRate = ScaleW / SpriteList[1].GetSize().w; + local ScaleRateH = H / SpriteList[1].GetSize().h; + SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0); - SpriteList[1].SetScale(ScaleRate, 1.0); + SpriteList[1].SetScale(ScaleRate, ScaleRateH); SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0); + if (H != SpriteList[1].GetSize().h) { + SpriteList[0].SetScale(1, ScaleRateH); + SpriteList[2].SetScale(1, ScaleRateH); + } } //纵向 else { local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h); local ScaleRate = ScaleH / SpriteList[1].GetSize().h; + local ScaleRateW = H / SpriteList[1].GetSize().w; + SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h); - SpriteList[1].SetScale(1.0, ScaleRate); + SpriteList[1].SetScale(ScaleRateW, ScaleRate); SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH); + if (W != SpriteList[1].GetSize().w) { + SpriteList[0].SetScale(ScaleRateW, ScaleRateH); + SpriteList[2].SetScale(ScaleRateW, ScaleRateH); + } } foreach(Child in SpriteList) { diff --git a/sqr/User/Stage/TestStage.nut b/sqr/User/Stage/TestStage.nut index acdc9e6..e5a8874 100644 --- a/sqr/User/Stage/TestStage.nut +++ b/sqr/User/Stage/TestStage.nut @@ -10,8 +10,8 @@ function TestStage() { T.Enter(); - - local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); + // local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); + local Window = Sq_CreateWindow(_CreateCharacter, "创建角色", 0, 0, 1066, 600, 0); diff --git a/sqr/User/UI/Window/2_Create_Character.nut b/sqr/User/UI/Window/2_Create_Character.nut index 141c06d..0d8800e 100644 --- a/sqr/User/UI/Window/2_Create_Character.nut +++ b/sqr/User/UI/Window/2_Create_Character.nut @@ -5,66 +5,207 @@ 文件用途: 创建角色 */ -class CreateCharacter extends Yosin_Window { - //调试模式 - // DeBugMode = true; +// 底部光动画类型 +enum BottomLightAniType { + light + firedust + dust + aura +} - //不是窗口 - // NoWindow = true; - - //是否可见 - // Visible = false; - - BackGroundMusic = null; - - constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { - base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - - //注册绘制 - RegisterDraw(); - //注册控件 - RegisterWidget(); - - //播放音乐 - PlayBackgroundMusic(); +// 获取职业信息 +function getJobInfo( job ) { + local T = {}; + switch (job) { + case CHARACTERJOB.SWORDMAN: // 男鬼剑士 d + T = { + index = 0, // 索引 + nameIndex = 0, // 名称索引 + ani = BottomLightAniType.dust, + name = "鬼剑士", + info = "借助凝聚在左手上鬼神之力压制敌人的鬼剑士。", // 介绍 + changJob = "剑魂 / 鬼泣 / 狂战士 / 阿修罗" // 转职 + }; + break; + case CHARACTERJOB.FIGHTER: // 女格斗家 d + T = { + index = 1, // 索引 + nameIndex = 1, // 名称索引 + ani = BottomLightAniType.dust, + name = "格斗家", + info = "注重身体各不为的锻炼,并熟练运用它们攻击敌人的武道家。", // 介绍 + changJob = "气功师 / 散打 / 街霸 / 柔道家" // 转职 + }; + break; + case CHARACTERJOB.GUNNER: // 男神枪手 d + T = { + index = 2, // 索引 + nameIndex = 2, // 名称索引 + ani = BottomLightAniType.dust, + name = "神枪手", + info = "生活在天界的神枪手,是善于利用枪械压制敌人的战士。", // 介绍 + changJob = "漫游枪手 / 枪炮师 / 机械师 / 弹药专家 / 合金战士" // 转职 + }; + break; + case CHARACTERJOB.MAGE: // 女魔法师 l + T = { + index = 3, // 索引 + nameIndex = 3, // 名称索引 + ani = BottomLightAniType.light, + name = "魔法师", + info = "善用魔法力量攻击敌人的魔族。", // 介绍 + changJob = "元素师 / 召唤师 / 战斗法师 / 魔道学者 / 小魔女" // 转职 + }; + break; + case CHARACTERJOB.PRIEST: // 男圣职者 l + T = { + index = 4, // 索引 + nameIndex = 4 // 名称索引 + ani = BottomLightAniType.light, + name = "光职者", + info = "心怀正义,为惩恶扬善甘愿接收严苛训练的勇士。", // 介绍 + changJob = "光明骑士 / 蓝拳使者 / 驱魔师 / 惩戒者" // 转职 + }; + break; + case CHARACTERJOB.AT_GUNNER: // 女神枪手 f + T = { + index = 5, // 索引 + nameIndex = 2, // 名称索引 + ani = BottomLightAniType.firedust, + name = "神枪手", + info = "生活在天界的神枪手,是善于利用枪械压制敌人的战士。", // 介绍 + changJob = "漫游枪手 / 枪炮师 / 机械师 / 弹药专家" // 转职 + }; + break; + case CHARACTERJOB.THIEF: // 暗夜使者 a + T = { + index = 6, // 索引 + nameIndex = 5, // 名称索引 + ani = BottomLightAniType.aura, + name = "暗夜使者", + info = "用敏捷身手执行特别人物的暗精灵成员。", // 介绍 + changJob = "暗星 / 黑夜术士 / 忍者 / 影武者" // 转职 + }; + break; + case CHARACTERJOB.AT_FIGHTER: // 男格斗家 f + T = { + index = 7, // 索引 + nameIndex = 1, // 名称索引 + ani = BottomLightAniType.firedust, + name = "格斗家", + info = "注重身体各不为的锻炼,并熟练运用它们攻击敌人的武道家。", // 介绍 + changJob = "气功师 / 散打 / 街霸 / 柔道家" // 转职 + }; + break; + case CHARACTERJOB.AT_MAGE: // 男魔法师 a + T = { + index = 8, // 索引 + nameIndex = 3, // 名称索引 + ani = BottomLightAniType.aura, + name = "魔法师", + info = "善用魔法力量攻击敌人的魔族。", // 介绍 + changJob = "元素爆破师 / 冰洁师 / 猩红法师 / 逐风者 / 次元行者" // 转职 + }; + break; + case CHARACTERJOB.DEMONIC_SWORDMAN: // 黑暗武士 a + T = { + index = 9, // 索引 + nameIndex = 10, // 名称索引 + ani = BottomLightAniType.aura, + name = " 黑暗武士", + info = "跨越时空之门,超越界限之力的剑士。", // 介绍 + changJob = "黑暗武士" // 转职 + }; + break; + case CHARACTERJOB.CREATOR_MAGE: // 缔造者 l + T = { + index = 10, // 索引 + nameIndex = 11, // 名称索引 + ani = BottomLightAniType.light, + name = " 缔造者", + info = "从异次元裂缝中获得强大力量的魔法师。", // 介绍 + changJob = "缔造者" // 转职 + }; + break; + case CHARACTERJOB.AT_SWORDMAN: // 女鬼剑士 d + T = { + index = 11, // 索引 + nameIndex = 0, // 名称索引 + ani = BottomLightAniType.dust, + name = "鬼剑士", + info = "同样拥有鬼手,却能实战不同的魔力。", // 介绍 + changJob = "驭剑士 / 暗殿骑士 / 契魔者 / 流浪武士 / 刃影" // 转职 + }; + break; + case CHARACTERJOB.KNIGHT: // 守护者 l + T = { + index = 12, // 索引 + nameIndex = 6, // 名称索引 + ani = BottomLightAniType.light, + name = "守护者", + info = "穿越各个次元,在战场上驰骋的少女。", // 介绍 + changJob = "精灵骑士 / 混沌魔灵 / 帕拉丁 / 龙骑士" // 转职 + }; + break; + case CHARACTERJOB.DEMONIC_LANCER: // 魔枪士 d + T = { + index = 13, // 索引 + nameIndex = 7, // 名称索引 + ani = BottomLightAniType.dust, + name = "魔枪士", + info = "使用蕴含魔力的长枪,专研枪术的战士。", // 介绍 + changJob = "征战者 / 决战者 / 狩猎者 / 暗枪士" // 转职 + }; + break; + case CHARACTERJOB.AT_PRIEST: // 女圣职者 l + T = { + index = 14, // 索引 + nameIndex = 4, // 名称索引 + ani = BottomLightAniType.light, + name = "光职者", + info = "心怀正义,为惩恶扬善甘愿接收严苛训练的勇士。", // 介绍 + changJob = "光明骑士 / 正义审判者 / 驱魔师 / 除恶者" // 转职 + }; + break; + case CHARACTERJOB.GUN_BLADER: // 枪剑士 d + T = { + index = 15, // 索引 + nameIndex = 8, // 名称索引 + ani = BottomLightAniType.dust, + name = "枪剑士", + info = "执着枪与剑的浪漫的天界人。", // 介绍 + changJob = "暗刃 / 特工 / 战线佣兵 / 源能专家" // 转职 + }; + break; + case CHARACTERJOB.ARCHER: // 弓箭手 l + T = { + index = 16, // 索引 + nameIndex = 9, // 名称索引 + ani = BottomLightAniType.light, + name = "弓箭手", + info = "为了守护家园,携弓箭走上冒险之旅的神界人。", // 介绍 + changJob = "缪斯 / 旅人 / 猎人 / 妖护使" // 转职 + }; + break; + default: + break; } - - function PlayBackgroundMusic() { - - } - - function MusicLogic() { - if (BackGroundMusic == null) return; - if (!BackGroundMusic.IsPlaying()) BackGroundMusic.Play(); - } - - function RegisterWidget() { - //账号输入框 - local AccountInputBox = Yosin_InputBox(752, 240, 200); - AddUIChild(AccountInputBox); - - } - - function RegisterDraw() { - //大背景 - local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 14); - Addchild(BackGround); - - } - - //逻辑入口 - function Proc(Dt) { - MusicLogic(); - - SyncPos(X, Y); - base.Proc(Dt); - } - + return T; } -//选择创建基础角色 -class CreateCharacter_SelectBase extends Yosin_Window { + + + + + +function getJobEnum(index) { + local jobList = [CHARACTERJOB.SWORDMAN, CHARACTERJOB.AT_SWORDMAN, CHARACTERJOB.AT_FIGHTER, CHARACTERJOB.FIGHTER, CHARACTERJOB.GUNNER, CHARACTERJOB.AT_GUNNER, CHARACTERJOB.AT_MAGE, CHARACTERJOB.MAGE, CHARACTERJOB.PRIEST, CHARACTERJOB.AT_PRIEST, CHARACTERJOB.THIEF, CHARACTERJOB.KNIGHT, CHARACTERJOB.DEMONIC_LANCER, CHARACTERJOB.GUN_BLADER, CHARACTERJOB.ARCHER, CHARACTERJOB.DEMONIC_SWORDMAN,CHARACTERJOB.CREATOR_MAGE ]; + return jobList[index]; +} + +//创建角色 +class _CreateCharacter extends Yosin_Window { //调试模式 // DeBugMode = true; @@ -74,7 +215,19 @@ class CreateCharacter_SelectBase extends Yosin_Window { //是否可见 // Visible = false; - BackGroundMusic = null; + BackGround = null; + jobImg = null; + nextJobImg = null; + + infoWidget = null; + + topLightObj = null; + lightAni = null; + dustAni = null; + firedustAni = null; + auraAni = null; + + changJobAniClock = null; constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); @@ -91,17 +244,122 @@ class CreateCharacter_SelectBase extends Yosin_Window { } function RegisterWidget() { - //账号输入框 - local headButton = HeadButton(0, 0, CHARACTERJOB.SWORDMAN); - AddUIChild(headButton); + //头像 + local headList = _CreateCharacter_SelectBaseHeadList(135, 40); + AddUIChild(headList); + headList.OnClick = changJob.bindenv(this); + + // 职业介绍 + infoWidget = _CreateCharacter_SelectBaseInfo(140, 400); + AddUIChild(infoWidget); + infoWidget.SetJob(getJobInfo(CHARACTERJOB.SWORDMAN)); + + // 创建职业 + infoWidget.OnClick = function () { + + }.bindenv(this); } + + // 切换职业 + 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)); + // 切换底部光动画 + + 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(); + } + + + /// 切换职业动画 + function changJobAni() { + if (changJobAniClock == null) return; + + local ani_progress = sq_GetAccel(100, 0, clock() - changJobAniClock, 1000); + + + + if (ani_progress == 0){ + changJobAniClock = null; + } + } + + function RegisterDraw() { //大背景 - local BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0); + BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0); Addchild(BackGround); + + // 人物图片 + jobImg = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 0); + jobImg.SetPosition(0, 0); + Addchild(jobImg); + + // 下一个人物图片 + nextJobImg = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 11); + nextJobImg.SetPosition(500, 0); + Addchild(nextJobImg); + + // 光动画 ui/charactercreate/topdodge.ani + topLightObj = Animation("ui/charactercreate/topdodge.ani"); + topLightObj.SetPosition(0, 0); + Addchild(topLightObj); + + + // 底部光动画 + lightAni = Animation("ui/charactercreate/dust.ani"); + lightAni.SetPosition(0, 0); + // lightAni.SetVisible(false); + Addchild(lightAni); + + firedustAni = Animation("ui/charactercreate/firedust.ani"); + firedustAni.SetPosition(0, 0); + firedustAni.SetVisible(false); + Addchild(firedustAni); + + dustAni = Animation("ui/charactercreate/dust.ani"); + dustAni.SetPosition(0, 0); + dustAni.SetVisible(false); + Addchild(dustAni); + + auraAni = Animation("ui/charactercreate/aura.ani"); + auraAni.SetPosition(0, 0); + auraAni.SetVisible(false); + Addchild(auraAni); + + } //逻辑入口 @@ -109,6 +367,79 @@ class CreateCharacter_SelectBase extends Yosin_Window { SyncPos(X, Y); base.Proc(Dt); + + changJobAni(); + + } + + + + +} + + + +//选择创建基础介绍 +class _CreateCharacter_SelectBaseInfo extends Yosin_Window { + + //是否为独立窗口 + IsIndependent = false; + + icon = null; + name = null; + jobInfo = null; + jobChangeText = null; + + OnClick = null; + + constructor(gX, gY ) { + base.constructor("创建角色职业介绍信息", gX, gY, 278, 600, 0); + + // 职业图标 + icon = CL_SpriteObject("sprite/interface2/charactercreatever2/charactermark.img", 0); + icon.SetPosition(0, 0); + Addchild(icon); + + //职业名称 + name = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 0); + name.SetPosition(55, 10); + Addchild(name); + + // 职业介绍 + jobInfo = FontAssetManager.GenerateNormal("职业介绍", false, { + color = sq_RGBA(194, 160, 53, 255) + }); + jobInfo.SetPosition(0, 52); + Addchild(jobInfo); + + local jobChangeTextY = 52 + jobInfo.GetSize().h + 5; + // 转职 + jobChangeText = FontAssetManager.GenerateNormal("■ 转职:转职名 / 转职名", true, { + color = sq_RGBA(194, 160, 53, 255) + }); + jobChangeText.SetPosition(0, jobChangeTextY); + Addchild(jobChangeText); + + //创建角色按钮 + local createButton = Yosin_EmeStretch(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172); + //点击事件回调 + createButton.OnClick = function(Button) { + if (OnClick) OnClick(); + }.bindenv(this); + // 按钮文本 + local createText = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 12); + createText.SetPosition(42.5, 8); + createButton.Addchild(createText); + AddUIChild(createButton); + + } + + function SetJob(jobInfoMap) { + icon.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/charactermark.img", jobInfoMap.index)); + name.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/charctertitle.img", jobInfoMap.nameIndex)); + jobInfo.SetText(jobInfoMap.info); + jobChangeText.SetText("■ 转职:" + jobInfoMap.changJob); + } } @@ -116,14 +447,73 @@ class CreateCharacter_SelectBase extends Yosin_Window { +//选择创建基础角色头像列表 +class _CreateCharacter_SelectBaseHeadList extends Yosin_Window { + //是否为独立窗口 + IsIndependent = false; + // 点击关闭 + clickOff = false; + OnClick = null; + buttonList = []; + + constructor(gX, gY) { + base.constructor("所有的职业头像", gX, gY, 278, 350, 0); + + local headX = 0; + local headY = 0; + + for (local i = 0; i < 17; i++) { + local jobEnum = getJobEnum(i); + local headButton = HeadButton(headX, headY, jobEnum, getJobInfo(jobEnum).name); + headButton.tag = i; + AddUIChild(headButton); + + buttonList.push(headButton); + headX = headX + 67; + if (i % 4 == 3) { + headX = 0; + headY = headY + 67; + } + } + + // 点击事件回调 + for (local i = 0; i < buttonList.len(); i++) { + + local headButton = buttonList[i]; + + headButton.OnClick = function (b) { + if (clickOff) return; + + for (local t = 0; t < buttonList.len(); t++) { + local button = buttonList[t]; + button.state = 0; + button.ChangeFrame(); + } + headButton.state = 2; + headButton.ChangeFrame(); + + if (OnClick) OnClick(headButton.tag); + + }.bindenv(this); + } + + local button = buttonList[0]; + button.state = 2; + button.ChangeFrame(); + + } + +} //头像按钮 class HeadButton extends Yosin_CommonUi { + DeBugMode = true; + // 角色名称 name = ""; @@ -134,13 +524,22 @@ class HeadButton extends Yosin_CommonUi { state = 0; spriteState = 0; - // 角色头像精灵 - CharacterSprite = null; + tag = 0; - // 角色头像覆盖精灵 - CharacterSpriteCover = null; + // 角色头像 + Character = null; + jobNameText = null; - constructor(X, Y, jobEnum, state = 0) { + // 角色头像覆盖 + CharacterCover = null; + + yellowBox = null; + + blueBox = null; + + + + constructor(X, Y, jobEnum, name, state = 0) { this.name = name; this.state = state; @@ -152,33 +551,59 @@ class HeadButton extends Yosin_CommonUi { base.constructor(X, Y, 62, 62); // 角色头像 - CharacterSprite = CL_SpriteObject(); - CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId)); - CharacterSprite.SetPosition(0, 0); - Addchild(CharacterSprite); + Character = CL_SpriteObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId) + Character.SetPosition(0, 0); + Addchild(Character); - CharacterSpriteCover = CL_SpriteObject(); - CharacterSpriteCover.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", state)); - CharacterSprite.SetPosition(0, 0); - Addchild(CharacterSpriteCover); + // 转职 + jobNameText = FontAssetManager.GenerateNormal(name, true, { + color = sq_RGBA(194, 160, 53, 255) + }); + jobNameText.SetPosition( 31 - jobNameText.GetSize().w / 2 , 45); + Addchild(jobNameText); + + CharacterCover = CL_SpriteObject( "sprite/interface2/charactercreatever2/characterbtn.img", 0) + CharacterCover.SetPosition(0, 0); + Addchild(CharacterCover); + + yellowBox = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 2); + yellowBox.SetPosition(0, 0); + yellowBox.SetVisible(false); + Addchild(yellowBox); + + blueBox = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbtn.img", 1); + blueBox.SetPosition(0, 0); + blueBox.SetVisible(false); + Addchild(blueBox); ChangeFrame(); } function ChangeFrame() { if (spriteState == state) return; - print(111); + spriteState = state; + //不可用 if (state == 3) { - CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1)); - CharacterSpriteCover.SetVisible(false); + Character.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId + 1)); + CharacterCover.SetVisible(false); + yellowBox.SetVisible(false); + blueBox.SetVisible(false); + } else if (state == 2) { + CharacterCover.SetVisible(false); + yellowBox.SetVisible(true); + blueBox.SetVisible(false); + } else if (state == 1) { + CharacterCover.SetVisible(false); + yellowBox.SetVisible(false); + blueBox.SetVisible(true); }else{ - CharacterSprite.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", imageId)); - CharacterSpriteCover.SetVisible(true) - CharacterSpriteCover.SetFrame(CL_SpriteFrameObject( "sprite/interface2/charactercreatever2/characterbtn.img", state)); + CharacterCover.SetVisible(true); + yellowBox.SetVisible(false); + blueBox.SetVisible(false); } - spriteState = state; + } function Proc(Dt) { @@ -188,7 +613,7 @@ class HeadButton extends Yosin_CommonUi { } else { //按下 if (isLBDown) { - state = 2; + // state = 2; } //悬停 else if (isInRect) { diff --git a/sqr/User/_ENUM/enum_game.nut b/sqr/User/_ENUM/enum_game.nut index 0ca3d43..4e6e80b 100644 --- a/sqr/User/_ENUM/enum_game.nut +++ b/sqr/User/_ENUM/enum_game.nut @@ -13,7 +13,7 @@ enum CHARACTERJOB { MAGE // 女魔法师 PRIEST // 男圣职者 AT_GUNNER // 女神枪手 - THIEF // 女暗夜使者 + THIEF // 暗夜使者 AT_FIGHTER // 男格斗家 AT_MAGE // 男魔法师 DEMONIC_SWORDMAN // 黑暗武士 From 0e09a72b8fbc5a980cf8e2fe92d21bcd19ebb388 Mon Sep 17 00:00:00 2001 From: WONIU Date: Wed, 18 Dec 2024 08:54:32 +0800 Subject: [PATCH 7/7] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E8=A7=92=E8=89=B2?= =?UTF-8?q?=E5=AE=8C=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