创建角色完成
This commit is contained in:
parent
6e72ab4310
commit
0e09a72b8f
|
|
@ -216,6 +216,7 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
// Visible = false;
|
// Visible = false;
|
||||||
|
|
||||||
BackGround = null;
|
BackGround = null;
|
||||||
|
headList = null;
|
||||||
jobImg = null;
|
jobImg = null;
|
||||||
nextJobImg = null;
|
nextJobImg = null;
|
||||||
|
|
||||||
|
|
@ -229,6 +230,8 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
changJobAniClock = null;
|
changJobAniClock = null;
|
||||||
|
|
||||||
|
nextJobIndex = null;
|
||||||
|
|
||||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
base.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() {
|
function RegisterWidget() {
|
||||||
//头像
|
//头像
|
||||||
local headList = _CreateCharacter_SelectBaseHeadList(135, 40);
|
headList = _CreateCharacter_SelectBaseHeadList(135, 40);
|
||||||
AddUIChild(headList);
|
AddUIChild(headList);
|
||||||
headList.OnClick = changJob.bindenv(this);
|
headList.OnClick = changJob.bindenv(this);
|
||||||
|
|
||||||
|
|
@ -264,41 +267,44 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
// 切换职业
|
// 切换职业
|
||||||
function changJob(index) {
|
function changJob(index) {
|
||||||
|
|
||||||
|
|
||||||
local jobEnum = getJobEnum(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);
|
nextJobIndex = index;
|
||||||
// 切换介绍
|
// 切换背景
|
||||||
infoWidget.SetJob(getJobInfo(jobEnum));
|
BackGround.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/characterbackground.img", jobEnum));
|
||||||
// 切换底部光动画
|
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum));
|
||||||
|
|
||||||
lightAni.SetVisible(false);
|
local info = getJobInfo(jobEnum);
|
||||||
firedustAni.SetVisible(false);
|
// 切换介绍
|
||||||
dustAni.SetVisible(false);
|
infoWidget.SetJob(getJobInfo(jobEnum));
|
||||||
auraAni.SetVisible(false);
|
// 切换底部光动画
|
||||||
|
|
||||||
switch (info.ani){
|
lightAni.SetVisible(false);
|
||||||
case BottomLightAniType.light:
|
firedustAni.SetVisible(false);
|
||||||
lightAni.SetVisible(true);
|
dustAni.SetVisible(false);
|
||||||
break;
|
auraAni.SetVisible(false);
|
||||||
case BottomLightAniType.firedust:
|
|
||||||
firedustAni.SetVisible(true);
|
switch (info.ani){
|
||||||
case BottomLightAniType.dust:
|
case BottomLightAniType.light:
|
||||||
dustAni.SetVisible(true);
|
lightAni.SetVisible(true);
|
||||||
break;
|
break;
|
||||||
case BottomLightAniType.aura:
|
case BottomLightAniType.firedust:
|
||||||
auraAni.SetVisible(true);
|
firedustAni.SetVisible(true);
|
||||||
break;
|
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() {
|
function changJobAni() {
|
||||||
if (changJobAniClock == null) return;
|
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;
|
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 = CL_SpriteObject("sprite/interface2/charactercreatever2/basecharctertitle.img", 11);
|
||||||
nextJobImg.SetPosition(500, 0);
|
nextJobImg.SetPosition(500, 0);
|
||||||
|
nextJobImg.SetOpacity(0);
|
||||||
Addchild(nextJobImg);
|
Addchild(nextJobImg);
|
||||||
|
|
||||||
// 光动画 ui/charactercreate/topdodge.ani
|
// 光动画 ui/charactercreate/topdodge.ani
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue