parent
4a2f6f3caf
commit
97721e04a4
|
|
@ -229,6 +229,7 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
auraAni = null;
|
auraAni = null;
|
||||||
|
|
||||||
changJobAniClock = null;
|
changJobAniClock = null;
|
||||||
|
changNextJobAniClock = null;
|
||||||
|
|
||||||
nextJobIndex = null;
|
nextJobIndex = null;
|
||||||
|
|
||||||
|
|
@ -267,7 +268,7 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
// 切换职业
|
// 切换职业
|
||||||
function changJob(index) {
|
function changJob(index) {
|
||||||
|
if (index == nextJobIndex) return;
|
||||||
|
|
||||||
local jobEnum = getJobEnum(index);
|
local jobEnum = getJobEnum(index);
|
||||||
|
|
||||||
|
|
@ -302,49 +303,87 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
|
|
||||||
// 开始切换动画
|
// 开始切换动画
|
||||||
changJobAniClock = clock();
|
if (changJobAniClock == null) {
|
||||||
// 切换动画中不响应点击
|
changJobAniClock = clock();
|
||||||
headList.clickOff = true;
|
}
|
||||||
|
changNextJobAniClock = clock();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 切换动画控制
|
||||||
|
function changJobAniController(progressBlock, doneBlock, next = true) {
|
||||||
|
|
||||||
/// 切换职业动画
|
if (next) {
|
||||||
function changJobAni() {
|
if (changNextJobAniClock == null) {
|
||||||
if (changJobAniClock == null) return;
|
print("NextNull");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
}else {
|
||||||
|
if (changJobAniClock == null) {
|
||||||
|
print("NUll");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 动画的前90%,快,后10%,慢
|
// 动画的前90%,快,后10%,慢
|
||||||
local ani_progress = Math.sq_GetAccel(0, 100, clock() - changJobAniClock, 0.3, false);
|
local ani_progress = Math.sq_GetAccel(0, 100, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.3, false);
|
||||||
if (ani_progress >= 90){
|
if (ani_progress >= 90){
|
||||||
ani_progress = Math.sq_GetAccel(0, 10, clock() - changJobAniClock, 0.7, false) + 90 ;
|
ani_progress = Math.sq_GetAccel(0, 10, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.7, false) + 90 ;
|
||||||
}
|
}
|
||||||
local x = ani_progress * 5.0;
|
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 );
|
|
||||||
|
|
||||||
// 动画的前90%,透明度进度为50%,后10%,透明度进度为剩下的50%
|
if (progressBlock != null) progressBlock(ani_progress);
|
||||||
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){
|
if (ani_progress >= 100){
|
||||||
|
if (doneBlock != null) doneBlock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// 切换当前职业动画
|
||||||
|
function changCurrnentJobAni() {
|
||||||
|
if (changJobAniClock == null) return;
|
||||||
|
|
||||||
|
changJobAniController(function(ani_progress) {
|
||||||
|
local x = ani_progress * 5.0;
|
||||||
|
jobImg.SetPosition( 0 - x, 0);
|
||||||
|
jobImg.SetOpacity( (100.0 - ani_progress.tofloat()) / 100.0 );
|
||||||
|
}.bindenv(this), function () {
|
||||||
changJobAniClock = null;
|
changJobAniClock = null;
|
||||||
|
}.bindenv(this),false );
|
||||||
|
}
|
||||||
|
|
||||||
|
// 切换职业动画
|
||||||
|
function changNextJobAni() {
|
||||||
|
if (changNextJobAniClock == null) return;
|
||||||
|
|
||||||
|
|
||||||
|
changJobAniController(function(ani_progress) {
|
||||||
|
|
||||||
|
local x = ani_progress * 5.0;
|
||||||
|
nextJobImg.SetPosition(500 - x, 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 );
|
||||||
|
|
||||||
|
}.bindenv(this), function () {
|
||||||
|
changNextJobAniClock = null;
|
||||||
|
|
||||||
local jobEnum = getJobEnum(nextJobIndex);
|
local jobEnum = getJobEnum(nextJobIndex);
|
||||||
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum ));
|
jobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", jobEnum ));
|
||||||
jobImg.SetOpacity(1);
|
jobImg.SetOpacity(1);
|
||||||
jobImg.SetPosition(0, 0);
|
jobImg.SetPosition(0, 0);
|
||||||
|
|
||||||
if (nextJobIndex < 16) {
|
if (nextJobIndex < 16) {
|
||||||
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(nextJobIndex + 1)));
|
nextJobImg.SetFrame(CL_SpriteFrameObject("sprite/interface2/charactercreatever2/basecharctertitle.img", getJobEnum(nextJobIndex + 1)));
|
||||||
nextJobImg.SetOpacity(0);
|
nextJobImg.SetOpacity(0);
|
||||||
nextJobImg.SetPosition(500, 0);
|
nextJobImg.SetPosition(500, 0);
|
||||||
}
|
}
|
||||||
headList.clickOff = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}.bindenv(this) );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
function RegisterDraw() {
|
function RegisterDraw() {
|
||||||
//大背景
|
//大背景
|
||||||
|
|
@ -399,8 +438,8 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
SyncPos(X, Y);
|
SyncPos(X, Y);
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
|
|
||||||
changJobAni();
|
changCurrnentJobAni();
|
||||||
|
changNextJobAni();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -452,7 +491,7 @@ class _CreateCharacter_SelectBaseInfo extends Yosin_Window {
|
||||||
Addchild(jobChangeText);
|
Addchild(jobChangeText);
|
||||||
|
|
||||||
//创建角色按钮
|
//创建角色按钮
|
||||||
local createButton = Yosin_EmeStretch(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172);
|
local createButton = Yosin_SplicingButton(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
createButton.OnClick = function(Button) {
|
createButton.OnClick = function(Button) {
|
||||||
if (OnClick) OnClick();
|
if (OnClick) OnClick();
|
||||||
|
|
@ -460,6 +499,7 @@ class _CreateCharacter_SelectBaseInfo extends Yosin_Window {
|
||||||
// 按钮文本
|
// 按钮文本
|
||||||
local createText = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 12);
|
local createText = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 12);
|
||||||
createText.SetPosition(42.5, 8);
|
createText.SetPosition(42.5, 8);
|
||||||
|
createText.SetZOrder(10000);
|
||||||
createButton.Addchild(createText);
|
createButton.Addchild(createText);
|
||||||
AddUIChild(createButton);
|
AddUIChild(createButton);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue