Compare commits
No commits in common. "052f86d102c2dd863ac7fd12216d0ff9e3789f99" and "4a2f6f3cafb77418e3ad88cfa3ed872866719f53" have entirely different histories.
052f86d102
...
4a2f6f3caf
|
|
@ -1,124 +0,0 @@
|
||||||
/*
|
|
||||||
文件名:UI_Cursor.nut
|
|
||||||
路径:Core/UI_Class/UI_Cursor.nut
|
|
||||||
创建日期:2024-12-18 13:41
|
|
||||||
文件用途:
|
|
||||||
*/
|
|
||||||
class _Yosin_Cursor extends Actor {
|
|
||||||
|
|
||||||
Object = null;
|
|
||||||
|
|
||||||
_Mouse_Click_Flag = null;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
base.constructor();
|
|
||||||
_Mouse_Click_Flag = {};
|
|
||||||
|
|
||||||
getroottable().Yosin_Cursor <- this;
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化
|
|
||||||
function Init() {
|
|
||||||
//鼠标层级高于一切
|
|
||||||
SetZOrder(20000000);
|
|
||||||
_UiObject_.Addchild(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
//更换鼠标指针
|
|
||||||
function Change(Frame) {
|
|
||||||
if (Object) {
|
|
||||||
Removechild(Object);
|
|
||||||
}
|
|
||||||
Object = Frame;
|
|
||||||
Addchild(Frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
//事件
|
|
||||||
function Event(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
|
||||||
switch (MouseState) {
|
|
||||||
//常规或者拖动事件
|
|
||||||
case 0x305: {
|
|
||||||
SetPosition(MousePos_X, MousePos_Y);
|
|
||||||
OnMouseProc(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//左键按下
|
|
||||||
case 0x101: {
|
|
||||||
_Mouse_Click_Flag.LbFlag <- true;
|
|
||||||
OnMouseLbDown(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//左键松开
|
|
||||||
case 0x001: {
|
|
||||||
//左键单击
|
|
||||||
if (_Mouse_Click_Flag.LbFlag == true) {
|
|
||||||
_Mouse_Click_Flag.LbFlag <- false;
|
|
||||||
OnMouseLbClick(MousePos_X, MousePos_Y);
|
|
||||||
}
|
|
||||||
OnMouseLbUp(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//右键按下
|
|
||||||
case 0x102: {
|
|
||||||
_Mouse_Click_Flag.RbFlag <- true;
|
|
||||||
OnMouseRbDown(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//右键松开
|
|
||||||
case 0x002: {
|
|
||||||
//右键单击
|
|
||||||
if (_Mouse_Click_Flag.RbFlag == true) {
|
|
||||||
_Mouse_Click_Flag.RbFlag <- false;
|
|
||||||
OnMouseRbClick(MousePos_X, MousePos_Y);
|
|
||||||
}
|
|
||||||
OnMouseRbUp(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//中键按下
|
|
||||||
case 0x103: {
|
|
||||||
_Mouse_Click_Flag.MbFlag <- true;
|
|
||||||
OnMouseMbDown(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//中键松开
|
|
||||||
case 0x003: {
|
|
||||||
//中键单击
|
|
||||||
if (_Mouse_Click_Flag.MbFlag == true) {
|
|
||||||
_Mouse_Click_Flag.MbFlag <- false;
|
|
||||||
OnMouseMbClick(MousePos_X, MousePos_Y);
|
|
||||||
}
|
|
||||||
OnMouseMbUp(MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
//滚轮事件
|
|
||||||
case 0x406: {
|
|
||||||
OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//鼠标事件回调
|
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标左键按下回调
|
|
||||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标左键单击回调
|
|
||||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标左键弹起回调
|
|
||||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标右键按下回调
|
|
||||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标右键单击回调
|
|
||||||
function OnMouseRbClick(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标右键弹起回调
|
|
||||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标中键按下回调
|
|
||||||
function OnMouseMbDown(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标中键单击回调
|
|
||||||
function OnMouseMbClick(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标中键弹起回调
|
|
||||||
function OnMouseMbUp(MousePos_X, MousePos_Y) {}
|
|
||||||
//鼠标滚轮事件回调
|
|
||||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y) {}
|
|
||||||
}
|
|
||||||
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
文件名:IMouse.nut
|
|
||||||
路径:User/UI/Widget/IMouse.nut
|
|
||||||
创建日期:2024-12-18 14:03
|
|
||||||
文件用途:
|
|
||||||
*/
|
|
||||||
class _IMouse_ extends _Yosin_Cursor {
|
|
||||||
|
|
||||||
NormalC = null;
|
|
||||||
//普通状态0
|
|
||||||
State = 0;
|
|
||||||
Idx = 0;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
NormalC = [];
|
|
||||||
base.constructor();
|
|
||||||
getroottable().IMouse <- this;
|
|
||||||
|
|
||||||
//关闭系统鼠标
|
|
||||||
Sq_ShowCursor(false);
|
|
||||||
|
|
||||||
//调用父类初始化 将自己添加为UI层子对象
|
|
||||||
Init();
|
|
||||||
//初始化所有普通图标
|
|
||||||
InitSprite();
|
|
||||||
|
|
||||||
//更换为0号指针
|
|
||||||
Change(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
//初始化普通鼠标指针
|
|
||||||
function InitSprite() {
|
|
||||||
for (local i = 0; i< 254; i++) {
|
|
||||||
local Sp = CL_SpriteObject("sprite/interface/newstyle/windows/cursor.img", i);
|
|
||||||
NormalC.push(Sp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//更换普通鼠标指针
|
|
||||||
function Change(Idx) {
|
|
||||||
State = 0;
|
|
||||||
this.Idx = Idx;
|
|
||||||
local Sp = NormalC[Idx];
|
|
||||||
base.Change(Sp);
|
|
||||||
}
|
|
||||||
|
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
//按下
|
|
||||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
|
||||||
//普通状态的点击效果
|
|
||||||
if (Idx == 0) {
|
|
||||||
Change(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//抬起
|
|
||||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
|
||||||
//普通状态的点击效果
|
|
||||||
if (Idx == 1) {
|
|
||||||
Change(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -229,7 +229,6 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
auraAni = null;
|
auraAni = null;
|
||||||
|
|
||||||
changJobAniClock = null;
|
changJobAniClock = null;
|
||||||
changNextJobAniClock = null;
|
|
||||||
|
|
||||||
nextJobIndex = null;
|
nextJobIndex = null;
|
||||||
|
|
||||||
|
|
@ -268,7 +267,7 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
// 切换职业
|
// 切换职业
|
||||||
function changJob(index) {
|
function changJob(index) {
|
||||||
if (index == nextJobIndex) return;
|
|
||||||
|
|
||||||
local jobEnum = getJobEnum(index);
|
local jobEnum = getJobEnum(index);
|
||||||
|
|
||||||
|
|
@ -303,88 +302,50 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
|
|
||||||
|
|
||||||
// 开始切换动画
|
// 开始切换动画
|
||||||
if (changJobAniClock == null) {
|
changJobAniClock = clock();
|
||||||
changJobAniClock = clock();
|
// 切换动画中不响应点击
|
||||||
}
|
headList.clickOff = true;
|
||||||
changNextJobAniClock = clock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 切换动画控制
|
|
||||||
function changJobAniController(progressBlock, doneBlock, next = true) {
|
|
||||||
|
|
||||||
if (next) {
|
/// 切换职业动画
|
||||||
if (changNextJobAniClock == null) {
|
function changJobAni() {
|
||||||
print("NextNull");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
}else {
|
|
||||||
if (changJobAniClock == null) {
|
|
||||||
print("NUll");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 动画的前90%,快,后10%,慢
|
|
||||||
local ani_progress = Math.sq_GetAccel(0, 100, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.3, false);
|
|
||||||
if (ani_progress >= 90){
|
|
||||||
ani_progress = Math.sq_GetAccel(0, 10, clock() - (next ? changNextJobAniClock : changJobAniClock), 0.7, false) + 90 ;
|
|
||||||
}
|
|
||||||
local x = ani_progress * 5.0;
|
|
||||||
|
|
||||||
if (progressBlock != null) progressBlock(ani_progress);
|
|
||||||
|
|
||||||
if (ani_progress >= 100){
|
|
||||||
if (doneBlock != null) doneBlock();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// 切换当前职业动画
|
|
||||||
function changCurrnentJobAni() {
|
|
||||||
if (changJobAniClock == null) return;
|
if (changJobAniClock == null) return;
|
||||||
|
|
||||||
changJobAniController(function(ani_progress) {
|
|
||||||
local x = ani_progress * 5.0;
|
|
||||||
jobImg.SetPosition( 0 - x, 0);
|
// 动画的前90%,快,后10%,慢
|
||||||
jobImg.SetOpacity( (100.0 - ani_progress.tofloat()) / 100.0 );
|
local ani_progress = Math.sq_GetAccel(0, 100, clock() - changJobAniClock, 0.3, false);
|
||||||
}.bindenv(this), function () {
|
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 );
|
||||||
|
|
||||||
|
// 动画的前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;
|
||||||
}.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() {
|
||||||
//大背景
|
//大背景
|
||||||
BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0);
|
BackGround = CL_SpriteObject("sprite/interface2/charactercreatever2/characterbackground.img", 0);
|
||||||
|
|
@ -438,8 +399,8 @@ class _CreateCharacter extends Yosin_Window {
|
||||||
SyncPos(X, Y);
|
SyncPos(X, Y);
|
||||||
base.Proc(Dt);
|
base.Proc(Dt);
|
||||||
|
|
||||||
changCurrnentJobAni();
|
changJobAni();
|
||||||
changNextJobAni();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -491,7 +452,7 @@ class _CreateCharacter_SelectBaseInfo extends Yosin_Window {
|
||||||
Addchild(jobChangeText);
|
Addchild(jobChangeText);
|
||||||
|
|
||||||
//创建角色按钮
|
//创建角色按钮
|
||||||
local createButton = Yosin_SplicingButton(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
local createButton = Yosin_EmeStretch(59, jobChangeTextY + 30, 160, 36, "sprite/interface/lenheartwindowcommon.img", 172);
|
||||||
//点击事件回调
|
//点击事件回调
|
||||||
createButton.OnClick = function(Button) {
|
createButton.OnClick = function(Button) {
|
||||||
if (OnClick) OnClick();
|
if (OnClick) OnClick();
|
||||||
|
|
@ -499,7 +460,6 @@ 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