Compare commits
6 Commits
ee21761519
...
275d66556a
| Author | SHA1 | Date |
|---|---|---|
|
|
275d66556a | |
|
|
223a3d3246 | |
|
|
a055e69606 | |
|
|
85586a714c | |
|
|
a9d9468cb5 | |
|
|
d2077de719 |
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -19,6 +19,10 @@ class Animation extends CL_SpriteObject {
|
|||
CurrentFrame = null;
|
||||
//下帧延迟
|
||||
NextFrameDelay = 9999999;
|
||||
//染色Flag
|
||||
DyeingFlag = false;
|
||||
//插值模式
|
||||
InterpolationFlag = null;
|
||||
//状态机对象(只有存在时才有KeyFlag)
|
||||
StateMachine = null;
|
||||
|
||||
|
|
@ -42,6 +46,14 @@ class Animation extends CL_SpriteObject {
|
|||
OutlineList = null;
|
||||
//当前描边对象
|
||||
CurrentOutline = null;
|
||||
//染色颜色
|
||||
DyeColor = null;
|
||||
//染色帧List
|
||||
DyeFrameList = null;
|
||||
//整体染色
|
||||
DyeAllFlag = false;
|
||||
//裁切数据
|
||||
CropRect = null;
|
||||
|
||||
//附加选项
|
||||
AdditionalOptions = null;
|
||||
|
|
@ -66,6 +78,7 @@ class Animation extends CL_SpriteObject {
|
|||
}
|
||||
//初始化数据
|
||||
InitData(vargv[0]);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -146,6 +159,7 @@ class Animation extends CL_SpriteObject {
|
|||
if (CurrentIndexT == 0) SetSize(SpriteArr[0].GetSize());
|
||||
//记录总帧数
|
||||
TotalFrameIndex = FrameArr.len();
|
||||
DyeFrameList = array(TotalFrameIndex);
|
||||
}
|
||||
|
||||
//被添加时 要刷新一下当前帧
|
||||
|
|
@ -195,6 +209,31 @@ class Animation extends CL_SpriteObject {
|
|||
}
|
||||
}
|
||||
|
||||
//设置整体染色
|
||||
function SetDye(Color, Flag = 0) {
|
||||
foreach(Index, FrameSf in SpriteArr) {
|
||||
local DyeFrame = FrameSf.Dye(Color, Flag);
|
||||
DyeFrameList[Index] = (DyeFrame);
|
||||
}
|
||||
DyeColor = Color;
|
||||
DyeAllFlag = true;
|
||||
}
|
||||
|
||||
//设置裁切
|
||||
function SetCropRect(Parameter1, Parameter2, ...) {
|
||||
if (vargv.len() == 0) {
|
||||
local Point1 = Parameter1;
|
||||
local Point2 = Parameter2;
|
||||
CropRect = [Point1.x, Point1.y, Point2.x, Point2.y];
|
||||
} else if (vargv.len() == 2) {
|
||||
local X1 = Parameter1;
|
||||
local Y1 = Parameter2;
|
||||
local X2 = vargv[0];
|
||||
local Y2 = vargv[1];
|
||||
CropRect = [X1, Y1, X2, Y2];
|
||||
}
|
||||
}
|
||||
|
||||
//添加描边子对象
|
||||
function AddOutlineChild() {
|
||||
//如果有上一个描边对象先移除
|
||||
|
|
@ -216,6 +255,9 @@ class Animation extends CL_SpriteObject {
|
|||
|
||||
//当前帧更换为本帧
|
||||
CurrentFrame = SpriteArr[CurrentFrameIndex];
|
||||
//如果是整体染色 则直接使用染色帧
|
||||
if (DyeAllFlag) CurrentFrame = DyeFrameList[CurrentFrameIndex];
|
||||
CurrentFrame.SetPosition(FrameArr[CurrentFrameIndex].Pos);
|
||||
SetFrame(CurrentFrame);
|
||||
|
||||
local FrameInfo = FrameArr[CurrentFrameIndex];
|
||||
|
|
@ -234,14 +276,129 @@ class Animation extends CL_SpriteObject {
|
|||
SetScale(FlagBuf.IMAGE_RATE.x, FlagBuf.IMAGE_RATE.y);
|
||||
}
|
||||
//线性减淡
|
||||
if ("GRAPHIC_EFFECT_LINEARDODGE" in FrameInfo.Flag) {
|
||||
if ("GRAPHIC_EFFECT_LINEARDODGE" in FlagBuf) {
|
||||
SetMode(0);
|
||||
}
|
||||
//旋转
|
||||
if ("IMAGE_ROTATE" in FlagBuf) {
|
||||
SetRotation(FlagBuf.IMAGE_ROTATE);
|
||||
}
|
||||
//染色 在没有开启整体染色时才执行的逻辑
|
||||
if (!DyeAllFlag) {
|
||||
if ("RGBA" in FlagBuf) {
|
||||
DyeingFlag = true;
|
||||
if (!DyeFrameList[CurrentFrameIndex]) {
|
||||
local RGBA_V = sq_RGBA(FlagBuf.RGBA[0], FlagBuf.RGBA[1], FlagBuf.RGBA[2], FlagBuf.RGBA[3]);
|
||||
DyeFrameList[CurrentFrameIndex] = SpriteArr[CurrentFrameIndex].Dye(RGBA_V);
|
||||
DyeFrameList[CurrentFrameIndex].SetPosition(FrameArr[CurrentFrameIndex].Pos);
|
||||
}
|
||||
CurrentFrame = DyeFrameList[CurrentFrameIndex];
|
||||
SetFrame(CurrentFrame);
|
||||
//设置透明度
|
||||
SetOpacity(FlagBuf.RGBA[3].tofloat() / 250.0);
|
||||
} else {
|
||||
if (DyeingFlag) {
|
||||
DyeingFlag = false;
|
||||
//恢复透明度
|
||||
SetOpacity(1.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
//插值模式
|
||||
if ("INTERPOLATION" in FlagBuf) {
|
||||
//初始化插值数据
|
||||
if (!InterpolationFlag) {
|
||||
InterpolationFlag = [];
|
||||
//旧插值数据
|
||||
InterpolationFlag.push(sq_DeepCopy(FrameArr[CurrentFrameIndex]));
|
||||
//新插值数据
|
||||
InterpolationFlag.push(sq_DeepCopy(FrameArr[CurrentFrameIndex + 1]));
|
||||
}
|
||||
} else {
|
||||
if (InterpolationFlag) {
|
||||
InterpolationFlag = null;
|
||||
}
|
||||
}
|
||||
//如果有描边
|
||||
if (IsOutline) AddOutlineChild();
|
||||
|
||||
//Ani对象的大小同步为精灵帧对象的大小
|
||||
if (CurrentFrame) SetSize(CurrentFrame.GetSize());
|
||||
|
||||
//裁切
|
||||
if (CropRect) {
|
||||
base.SetCropRect(CropRect[0], CropRect[1], CropRect[2], CropRect[3]);
|
||||
//所有子对象裁切
|
||||
foreach(Child in Children) {
|
||||
Child.SetCropRect(CropRect[0], CropRect[1], CropRect[2], CropRect[3]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function InterpolationLogic() {
|
||||
if (!InterpolationFlag) return;
|
||||
//插值倍率
|
||||
local InterRate = Math.getUniformVelocity(0, 100, CurrentIndexT, NextFrameDelay).tofloat() / 100.0;
|
||||
//旧插值数据
|
||||
local OldData = InterpolationFlag[0];
|
||||
//新插值数据
|
||||
local NewData = InterpolationFlag[1];
|
||||
//RGBA插值
|
||||
{
|
||||
local OldRgbaData = [255, 255, 255, 250];
|
||||
local NewRgbaData = [255, 255, 255, 250];
|
||||
if ("RGBA" in OldData.Flag) OldRgbaData = OldData.Flag.RGBA;
|
||||
if ("RGBA" in NewData.Flag) NewRgbaData = NewData.Flag.RGBA;
|
||||
local RgbaData = [
|
||||
OldRgbaData[0] + (NewRgbaData[0] - OldRgbaData[0]) * InterRate,
|
||||
OldRgbaData[1] + (NewRgbaData[1] - OldRgbaData[1]) * InterRate,
|
||||
OldRgbaData[2] + (NewRgbaData[2] - OldRgbaData[2]) * InterRate,
|
||||
OldRgbaData[3] + (NewRgbaData[3] - OldRgbaData[3]) * InterRate
|
||||
];
|
||||
// //设置染色
|
||||
// DyeFrameList[CurrentFrameIndex] = CurrentFrame.Dye(sq_RGBA(RgbaData[0], RgbaData[1], RgbaData[2], RgbaData[3]));
|
||||
// CurrentFrame = DyeFrameList[CurrentFrameIndex];
|
||||
// CurrentFrame.SetPosition(FrameArr[CurrentFrameIndex].Pos);
|
||||
// SetFrame(CurrentFrame);
|
||||
//设置透明度
|
||||
SetOpacity(RgbaData[3].tofloat() / 250.0);
|
||||
};
|
||||
//坐标
|
||||
{
|
||||
local PosData = {
|
||||
x = OldData.Pos.x + (NewData.Pos.x - OldData.Pos.x) * InterRate,
|
||||
y = OldData.Pos.y + (NewData.Pos.y - OldData.Pos.y) * InterRate
|
||||
}
|
||||
CurrentFrame.SetPosition(PosData);
|
||||
SetFrame(CurrentFrame);
|
||||
};
|
||||
//缩放
|
||||
{
|
||||
local OldRateData = {
|
||||
x = 1.0,
|
||||
y = 1.0
|
||||
};
|
||||
local NewRateData = {
|
||||
x = 1.0,
|
||||
y = 1.0
|
||||
};
|
||||
if ("IMAGE_RATE" in OldData.Flag) OldRateData = OldData.Flag.IMAGE_RATE;
|
||||
if ("IMAGE_RATE" in NewData.Flag) NewRateData = NewData.Flag.IMAGE_RATE;
|
||||
local ScaleData = {
|
||||
x = OldRateData.x + (NewRateData.x - OldRateData.x) * InterRate,
|
||||
y = OldRateData.y + (NewRateData.y - OldRateData.y) * InterRate
|
||||
}
|
||||
SetScale(ScaleData);
|
||||
}
|
||||
//旋转
|
||||
{
|
||||
local OldRotateData = 0.0;
|
||||
local NewRotateData = 0.0;
|
||||
if ("IMAGE_ROTATE" in OldData.Flag) OldRotateData = OldData.Flag.IMAGE_ROTATE;
|
||||
if ("IMAGE_ROTATE" in NewData.Flag) NewRotateData = NewData.Flag.IMAGE_ROTATE;
|
||||
local RotateData = OldRotateData + (NewRotateData - OldRotateData) * InterRate;
|
||||
SetRotation(RotateData);
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
|
|
@ -250,7 +407,8 @@ class Animation extends CL_SpriteObject {
|
|||
if (IsUsability) {
|
||||
//累加当前帧时间
|
||||
CurrentIndexT += dt;
|
||||
|
||||
//插值模式判断
|
||||
InterpolationLogic();
|
||||
//当前帧时间 超过 当前帧延迟就需要切换帧了
|
||||
if (CurrentIndexT >= NextFrameDelay) {
|
||||
CurrentIndexT = 0;
|
||||
|
|
|
|||
|
|
@ -167,6 +167,7 @@ function InitPvfAni(Ro) {
|
|||
AttackBox = [],
|
||||
DamageBox = [],
|
||||
Flag = {},
|
||||
Delay = 0,
|
||||
};
|
||||
|
||||
//碰撞框项目数量
|
||||
|
|
|
|||
|
|
@ -33,8 +33,8 @@ class Script {
|
|||
return Asset_GetPvfBinString(C_Object, Key);
|
||||
}
|
||||
|
||||
function GetLoadString(Key) {
|
||||
return Asset_GetPvfLoadString(C_Object, Key);
|
||||
function GetLoadString(Type, Key) {
|
||||
return Asset_GetPvfLoadString(C_Object, Type, Key);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,13 +139,14 @@ class GlobaData {
|
|||
function ResolvingData(IO, Func, Path) {
|
||||
local DataTable = {};
|
||||
DataTable.filepath <- Path;
|
||||
local Type = Path.slice(0, Path.find("/")).tolower();
|
||||
local DataArr = [];
|
||||
local Length = IO.len();
|
||||
if (Length >= 7) {
|
||||
local i = 2;
|
||||
while (true) {
|
||||
if (i< Length && Length - i >= 5) {
|
||||
local str = UnpackData(IO, i);
|
||||
local str = UnpackData(IO, i, Type);
|
||||
i += 5;
|
||||
DataArr.push(str);
|
||||
} else break;
|
||||
|
|
@ -156,7 +157,7 @@ class GlobaData {
|
|||
return null;
|
||||
}
|
||||
|
||||
function UnpackData(IO, i) {
|
||||
function UnpackData(IO, i, Type) {
|
||||
IO.seek(i); //内容指示位
|
||||
local currentByte = IO.readn('c'); //内容指示位
|
||||
local after = IO.GetInt();
|
||||
|
|
@ -168,7 +169,7 @@ class GlobaData {
|
|||
if (!Buf) {
|
||||
Buf = "";
|
||||
} else {
|
||||
Buf = getroottable()._Script_Data_.GetLoadString(Buf);
|
||||
Buf = getroottable()._Script_Data_.GetLoadString(Type, Buf);
|
||||
}
|
||||
return Buf;
|
||||
}
|
||||
|
|
@ -177,7 +178,7 @@ class GlobaData {
|
|||
if (!Buf) {
|
||||
Buf = "";
|
||||
} else {
|
||||
Buf = getroottable()._Script_Data_.GetLoadString(Buf);
|
||||
Buf = getroottable()._Script_Data_.GetLoadString(Type, Buf);
|
||||
}
|
||||
return Buf;
|
||||
}
|
||||
|
|
@ -187,12 +188,11 @@ class GlobaData {
|
|||
return ret;
|
||||
}
|
||||
case 4: {
|
||||
// local Bbuf = blob(4);
|
||||
// Bbuf.writen(after, 'i');
|
||||
// Bbuf.seek(0);
|
||||
// local Buf = Bbuf.readn('f');
|
||||
// out += after + '\t';
|
||||
return after;
|
||||
local Bbuf = blob(4);
|
||||
Bbuf.writen(after, 'i');
|
||||
Bbuf.seek(0);
|
||||
local Buf = Bbuf.readn('f');
|
||||
return Buf.tofloat();
|
||||
}
|
||||
case 6:
|
||||
case 8:
|
||||
|
|
|
|||
|
|
@ -57,12 +57,14 @@ class CL_SpriteObject extends CL_BaseObject {
|
|||
local Point1 = Parameter1;
|
||||
local Point2 = Parameter2;
|
||||
Sprite_SetCropRect(this.C_Object, Point1, Point2);
|
||||
SetSize(Point2.x - Point1.x, Point2.y - Point1.y);
|
||||
} else if (vargv.len() == 2) {
|
||||
local X1 = Parameter1;
|
||||
local Y1 = Parameter2;
|
||||
local X2 = vargv[0];
|
||||
local Y2 = vargv[1];
|
||||
Sprite_SetCropRect(this.C_Object, X1, Y1, X2, Y2);
|
||||
SetSize(X2 - X1, Y2 - Y1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,8 +42,13 @@ class CL_SpriteFrameObject extends CL_BaseObject {
|
|||
}
|
||||
}
|
||||
|
||||
//返回一个画布精灵
|
||||
//创建描边 返回一个画布精灵
|
||||
function CreateOutLine(Color) {
|
||||
return CL_SpriteObject(SpriteFrame_CreateOutLine(this.C_Object, Color));
|
||||
}
|
||||
|
||||
//染色 返回一个精灵帧
|
||||
function Dye(Color, Flag = 0) {
|
||||
return CL_SpriteFrameObject(SpriteFrame_Dye(this.C_Object, Color, Flag));
|
||||
}
|
||||
}
|
||||
|
|
@ -15,6 +15,7 @@ class TextActor extends CL_BaseObject {
|
|||
* @参数 textstyle Map 可选对象:
|
||||
alignment 对其方式
|
||||
wrap_width 自动换行宽度
|
||||
word_wrapping 自动换行模式
|
||||
line_spacing 行间距
|
||||
show_underline 显示下划线
|
||||
show_strikethrough 显示删除线
|
||||
|
|
@ -64,4 +65,33 @@ class TextActor extends CL_BaseObject {
|
|||
function SetFillColor(Color) {
|
||||
TextActor_SetFillColor(this.C_Object, Color);
|
||||
}
|
||||
|
||||
|
||||
//设置坐标
|
||||
function SetPosition(Value, ...) {
|
||||
if (vargv.len() == 0) {
|
||||
X = Value.x;
|
||||
Y = Value.y;
|
||||
} else if (vargv.len() == 1) {
|
||||
X = Value;
|
||||
Y = vargv[0];
|
||||
}
|
||||
X = X.tointeger();
|
||||
Y = Y.tointeger();
|
||||
BaseObject_SetPosition(this.C_Object, X, Y);
|
||||
}
|
||||
//移动坐标
|
||||
function MoveTo(Value, ...) {
|
||||
if (vargv.len() == 0)
|
||||
BaseObject_MoveTo(this.C_Object, Value.tointeger());
|
||||
else if (vargv.len() == 1)
|
||||
BaseObject_MoveTo(this.C_Object, Value.tointeger(), vargv[0].tointeger());
|
||||
}
|
||||
//移动相对坐标
|
||||
function MoveBy(Value, ...) {
|
||||
if (vargv.len() == 0)
|
||||
BaseObject_MoveBy(this.C_Object, Value.tointeger());
|
||||
else if (vargv.len() == 1)
|
||||
BaseObject_MoveBy(this.C_Object, Value.tointeger(), vargv[0].tointeger());
|
||||
}
|
||||
}
|
||||
|
|
@ -45,5 +45,9 @@ function sq_DeepCopy(original) {
|
|||
* @函数作用: 返回颜色的十六进制数
|
||||
*/
|
||||
function sq_RGBA(R, G, B, A) {
|
||||
R = R.tointeger();
|
||||
G = G.tointeger();
|
||||
B = B.tointeger();
|
||||
A = A.tointeger();
|
||||
return (A << 24) + (R << 16) + (G << 8) + B;
|
||||
}
|
||||
|
|
@ -318,6 +318,17 @@ class Math {
|
|||
|
||||
}
|
||||
|
||||
//除以两个值并四舍五入
|
||||
function DivideAndRound(var1, var2) {
|
||||
local ret = var1.tofloat() / var2.tofloat();
|
||||
return Round(ret);
|
||||
}
|
||||
|
||||
//总是舍去
|
||||
function Floor(var) {
|
||||
return var.tointeger();
|
||||
}
|
||||
|
||||
//currentRate 越接近maxRate ,返回值由sv越接近ev
|
||||
function getUniformVelocity(sv, ev, currentRate, maxRate) {
|
||||
|
||||
|
|
@ -345,6 +356,18 @@ class Math {
|
|||
return sv + varyValue * increaseRate;
|
||||
}
|
||||
|
||||
//根据原数值 浮动比例 最终倍率 获得最终值
|
||||
function getFinalValueByFloatRate(originalValue, floatRate, finalRate) {
|
||||
// 计算 Value 的 15%
|
||||
local fifteenPercent = originalValue * 0.15;
|
||||
// 计算浮动范围的下限和上限
|
||||
local lowerBound = originalValue - fifteenPercent;
|
||||
local upperBound = originalValue + fifteenPercent;
|
||||
// 根据 Rate 计算最终值
|
||||
local finalValue = lowerBound + floatRate * (upperBound - lowerBound);
|
||||
return finalValue;
|
||||
}
|
||||
|
||||
|
||||
function Max(a, b) {
|
||||
if (a< b)
|
||||
|
|
|
|||
|
|
@ -21,4 +21,17 @@ class String {
|
|||
}
|
||||
return Path;
|
||||
}
|
||||
|
||||
function ReplaceString(input, pattern, replacement) {
|
||||
local rbuf = typeof pattern == "string" ? regexp(pattern) : pattern;
|
||||
while (true) {
|
||||
local result = rbuf.capture(input);
|
||||
if (!result) break;
|
||||
|
||||
local begin = result[0].begin;
|
||||
local end = result[0].end;
|
||||
input = input.slice(0, begin) + replacement + input.slice(end);
|
||||
}
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
|
@ -231,3 +231,15 @@ enum DashStyle {
|
|||
DashDot ///< 圆角样式
|
||||
DashDotDot ///< 圆角样式
|
||||
};
|
||||
|
||||
/**
|
||||
* \~chinese
|
||||
* @brief 换行模式
|
||||
*/
|
||||
enum TextWordWrapping {
|
||||
WRAPPING_WRAP ///< 在单词边界处换行,这是实现自动换行的常用模式
|
||||
WRAPPING_NO_WRAP ///< 不进行换行,文本将超出布局边界
|
||||
WRAPPING_EMERGENCY_BREAK ///< 在必要时在任意字符处换行,即使不在单词边界
|
||||
WRAPPING_WHOLE_WORD ///< 仅在完整的单词边界处进行换行
|
||||
WRAPPING_CHARACTER ///< 可以在任意字符处进行换行
|
||||
};
|
||||
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
文件名:Timer.nut
|
||||
路径:Core/Timer/Timer.nut
|
||||
创建日期:2025-02-11 23:25
|
||||
文件用途:定时器
|
||||
*/
|
||||
class _Timer_ {
|
||||
Exec_Tree = null;
|
||||
|
||||
constructor() {
|
||||
//执行树
|
||||
Exec_Tree = [];
|
||||
|
||||
//注册Proc
|
||||
_Game_Logic_Func_._Timer_Proc <- Proc.bindenv(this);
|
||||
|
||||
getroottable().Timer <- this;
|
||||
}
|
||||
|
||||
//下帧执行
|
||||
function SetNextFrame(target_func, ...) {
|
||||
local target_arg_list = [];
|
||||
target_arg_list.push(getroottable());
|
||||
for (local i = 0; i< vargv.len(); i++) {
|
||||
target_arg_list.push(vargv[i]);
|
||||
}
|
||||
//设置下一次执行
|
||||
local func_info = [];
|
||||
|
||||
func_info.push(target_func);
|
||||
func_info.push(target_arg_list);
|
||||
Exec_Tree.push(func_info);
|
||||
}
|
||||
|
||||
function Proc(Dt, Lister) {
|
||||
foreach(Info in Exec_Tree) {
|
||||
//函数
|
||||
local func = Info[0];
|
||||
//参数
|
||||
local func_args = Info[1];
|
||||
//执行函数
|
||||
func.acall(func_args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_Timer_();
|
||||
|
|
@ -5,9 +5,9 @@
|
|||
文件用途:UI核心类
|
||||
*/
|
||||
//UI层Actor
|
||||
_UiObject_ <- null;
|
||||
if (!(getroottable().rawin("_UiObject_"))) _UiObject_ <- null;
|
||||
//窗口队列
|
||||
_SYS_WINDOW_LIST_ <- [];
|
||||
if (!(getroottable().rawin("_SYS_WINDOW_LIST_"))) _SYS_WINDOW_LIST_ <- [];
|
||||
//基础窗口类 所有UI类继承与本类
|
||||
class Yosin_BaseWindow extends Layer {
|
||||
//父控件
|
||||
|
|
@ -56,80 +56,80 @@ class Yosin_BaseWindow extends Layer {
|
|||
}
|
||||
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y) {
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标右键弹起回调
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标中键按下回调
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标中键单击回调
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y) {
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标中键弹起回调
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseMbUp(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y) {
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
foreach(Window in UI_Childrens) {
|
||||
Window.OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
||||
Window.OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
}
|
||||
//设置回调事件
|
||||
|
|
@ -329,7 +329,7 @@ class Yosin_Window extends Yosin_BaseWindow {
|
|||
}
|
||||
|
||||
//override
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//设定拖动逻辑
|
||||
if (MoveFlag) {
|
||||
|
|
@ -338,15 +338,15 @@ class Yosin_Window extends Yosin_BaseWindow {
|
|||
Y = B_Y - (M_Ypos - MousePos_Y);
|
||||
}
|
||||
//调用原生方法
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//如果点击事件在窗口内
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) {
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height) && !WindowInteractiveFlag) {
|
||||
if (IsIndependent) ResetFocus();
|
||||
//如果点下去在标题栏
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, TitleH)) {
|
||||
|
|
@ -358,11 +358,11 @@ class Yosin_Window extends Yosin_BaseWindow {
|
|||
}
|
||||
}
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
if (MoveFlag) {
|
||||
MoveFlag = false;
|
||||
|
|
@ -372,28 +372,64 @@ class Yosin_Window extends Yosin_BaseWindow {
|
|||
B_Y = null;
|
||||
}
|
||||
//调用原生方法
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||
base.OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标右键弹起回调
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||
base.OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
||||
base.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标中键按下回调
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标中键弹起回调
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//override
|
||||
//鼠标中键单击回调
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
//调用原生方法
|
||||
base.OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -444,81 +480,82 @@ _Yosin_Cursor();
|
|||
_Yosin_Mouse_Logic_Func_ <- {};
|
||||
//鼠标逻辑入口
|
||||
function _Yosin_Windows_Mouse_Logic_(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||
|
||||
//鼠标逻辑
|
||||
Yosin_Cursor.Event(MouseState, Wheel, MousePos_X, MousePos_Y);
|
||||
//克隆一遍窗口列表
|
||||
local WindowListF = clone(_SYS_WINDOW_LIST_);
|
||||
WindowListF.reverse();
|
||||
|
||||
local WindowInteractiveFlag = false;
|
||||
|
||||
foreach(Window in WindowListF) {
|
||||
if (Window.Visible) {
|
||||
switch (MouseState) {
|
||||
//常规或者拖动事件
|
||||
case 0x305: {
|
||||
Window.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//左键按下
|
||||
case 0x101: {
|
||||
_Mouse_Click_Flag.LbFlag <- true;
|
||||
Window.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//左键松开
|
||||
case 0x001: {
|
||||
//左键单击
|
||||
if (_Mouse_Click_Flag.LbFlag == true) {
|
||||
_Mouse_Click_Flag.LbFlag <- false;
|
||||
Window.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
Window.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
//左键单击
|
||||
case 0x201: {
|
||||
Window.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//右键按下
|
||||
case 0x102: {
|
||||
_Mouse_Click_Flag.RbFlag <- true;
|
||||
Window.OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//右键松开
|
||||
case 0x002: {
|
||||
//右键单击
|
||||
if (_Mouse_Click_Flag.RbFlag == true) {
|
||||
_Mouse_Click_Flag.RbFlag <- false;
|
||||
Window.OnMouseRbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
Window.OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||
//右键单击
|
||||
case 0x202: {
|
||||
Window.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//中键按下
|
||||
case 0x103: {
|
||||
_Mouse_Click_Flag.MbFlag <- true;
|
||||
Window.OnMouseMbDown(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//中键松开
|
||||
case 0x003: {
|
||||
//中键单击
|
||||
if (_Mouse_Click_Flag.MbFlag == true) {
|
||||
_Mouse_Click_Flag.MbFlag <- false;
|
||||
Window.OnMouseMbClick(MousePos_X, MousePos_Y);
|
||||
Window.OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
Window.OnMouseMbUp(MousePos_X, MousePos_Y);
|
||||
//中键单击
|
||||
case 0x203: {
|
||||
Window.OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//滚轮事件
|
||||
case 0x406: {
|
||||
Window.OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
||||
Window.OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) break;
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Window.X, Window.Y, Window.Width, Window.Height)) {
|
||||
WindowInteractiveFlag = Window;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//可注册的除窗口外的其他事件
|
||||
foreach(Func in _Yosin_Mouse_Logic_Func_) {
|
||||
local ret = Func(MouseState, Wheel, MousePos_X, MousePos_Y);
|
||||
local ret = Func(MouseState, Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (ret == true) return;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,14 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
|
||||
_Mouse_Click_Flag = null;
|
||||
|
||||
function _typeof() {
|
||||
return "_Yosin_Cursor";
|
||||
}
|
||||
|
||||
constructor() {
|
||||
base.constructor();
|
||||
_Mouse_Click_Flag = {};
|
||||
SetName("鼠标");
|
||||
|
||||
getroottable().Yosin_Cursor <- this;
|
||||
}
|
||||
|
|
@ -32,17 +37,18 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
|
||||
//事件
|
||||
function Event(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||
local WindowInteractiveFlag = false;
|
||||
switch (MouseState) {
|
||||
//常规或者拖动事件
|
||||
case 0x305: {
|
||||
SetPosition(MousePos_X, MousePos_Y);
|
||||
OnMouseProc(MousePos_X, MousePos_Y);
|
||||
OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//左键按下
|
||||
case 0x101: {
|
||||
_Mouse_Click_Flag.LbFlag <- true;
|
||||
OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//左键松开
|
||||
|
|
@ -50,15 +56,15 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
//左键单击
|
||||
if (_Mouse_Click_Flag.LbFlag == true) {
|
||||
_Mouse_Click_Flag.LbFlag <- false;
|
||||
OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//右键按下
|
||||
case 0x102: {
|
||||
_Mouse_Click_Flag.RbFlag <- true;
|
||||
OnMouseRbDown(MousePos_X, MousePos_Y);
|
||||
OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//右键松开
|
||||
|
|
@ -66,15 +72,15 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
//右键单击
|
||||
if (_Mouse_Click_Flag.RbFlag == true) {
|
||||
_Mouse_Click_Flag.RbFlag <- false;
|
||||
OnMouseRbClick(MousePos_X, MousePos_Y);
|
||||
OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
OnMouseRbUp(MousePos_X, MousePos_Y);
|
||||
OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//中键按下
|
||||
case 0x103: {
|
||||
_Mouse_Click_Flag.MbFlag <- true;
|
||||
OnMouseMbDown(MousePos_X, MousePos_Y);
|
||||
OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//中键松开
|
||||
|
|
@ -82,14 +88,14 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
//中键单击
|
||||
if (_Mouse_Click_Flag.MbFlag == true) {
|
||||
_Mouse_Click_Flag.MbFlag <- false;
|
||||
OnMouseMbClick(MousePos_X, MousePos_Y);
|
||||
OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
OnMouseMbUp(MousePos_X, MousePos_Y);
|
||||
OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
//滚轮事件
|
||||
case 0x406: {
|
||||
OnMouseWheel(Wheel, MousePos_X, MousePos_Y);
|
||||
OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -97,25 +103,25 @@ class _Yosin_Cursor extends CL_SpriteObject {
|
|||
|
||||
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标右键弹起回调
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseRbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标中键按下回调
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseMbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标中键单击回调
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseMbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标中键弹起回调
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y) {}
|
||||
function OnMouseMbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y) {}
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {}
|
||||
}
|
||||
|
|
@ -18,6 +18,8 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
|||
|
||||
OnClick = null;
|
||||
OnClickSound = null;
|
||||
OnClickMoveSound = null;
|
||||
OnClickMoveSoundFlag = false;
|
||||
|
||||
Data = null;
|
||||
|
||||
|
|
@ -35,28 +37,37 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
|||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) isInRect = true;
|
||||
else isInRect = false;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
//如果有配置移动音效
|
||||
if (OnClickMoveSound && !OnClickMoveSoundFlag) {
|
||||
OnClickMoveSoundFlag = true;
|
||||
Sq_PlaySoundEffect(OnClickMoveSound);
|
||||
}
|
||||
isInRect = true;
|
||||
} else {
|
||||
OnClickMoveSoundFlag = false;
|
||||
isInRect = false;
|
||||
}
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
isLBDown = true;
|
||||
}
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
isLBDown = false;
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
if (OnClick) OnClick(this);
|
||||
|
|
@ -65,755 +76,7 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
|||
Sq_PlaySoundEffect(OnClickSound);
|
||||
}
|
||||
}
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//基础按钮
|
||||
class Yosin_BaseButton extends Yosin_CommonUi {
|
||||
//按钮状态
|
||||
State = 0;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
|
||||
Sprite = null;
|
||||
SpriteState = -1;
|
||||
FrameList = null;
|
||||
|
||||
//按下时的模拟偏移
|
||||
DownSimulateOffset = true;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
FrameList = [];
|
||||
Sprite = CL_SpriteObject();
|
||||
// Sprite.ShowBorder(true);
|
||||
Addchild(Sprite);
|
||||
|
||||
for (local i = 0; i< 4; i++) {
|
||||
local Sf = CL_SpriteFrameObject(this.Path, this.Idx + i);
|
||||
FrameList.push(Sf);
|
||||
}
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
//按下时模拟偏移的Flag 如果按下 调整Y坐标向下一个单位
|
||||
if (DownSimulateOffset) {
|
||||
if (State == 2) {
|
||||
Y += 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y -= 1;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
}
|
||||
SpriteState = State;
|
||||
Sprite.SetFrame(FrameList[SpriteState]);
|
||||
Sprite.SetPosition(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
//三分法拉伸
|
||||
// class Yosin_EmeStretch extends Yosin_CommonUi {
|
||||
|
||||
// Path = null;
|
||||
// Idx = null;
|
||||
// //按钮状态
|
||||
// SpriteList = null;
|
||||
|
||||
// constructor(X, Y, W, H, Path, Idx, Direction = true) {
|
||||
// this.Path = Path;
|
||||
// this.Idx = Idx;
|
||||
// base.constructor(X, Y, W, H);
|
||||
|
||||
// // 创建画布
|
||||
// local Canvas = CL_CanvasObject();
|
||||
// // 重设大小并清空
|
||||
// Canvas.ResizeAndClear(W, H);
|
||||
// // 开始绘制
|
||||
// Canvas.BeginDraw();
|
||||
|
||||
// SpriteList = [];
|
||||
// SpriteList.push(CL_SpriteObject(Path, Idx));
|
||||
// SpriteList.push(CL_SpriteObject(Path, Idx + 1));
|
||||
// SpriteList.push(CL_SpriteObject(Path, Idx + 2));
|
||||
|
||||
// //横向
|
||||
// if (Direction) {
|
||||
// local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w);
|
||||
// local ScaleRate = ScaleW / SpriteList[1].GetSize().w;
|
||||
|
||||
// SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0.0);
|
||||
// SpriteList[1].SetScale(ScaleRate, 1.0);
|
||||
// SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0.0);
|
||||
// }
|
||||
// //纵向
|
||||
// else {
|
||||
// local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h);
|
||||
// local ScaleRate = ScaleH / SpriteList[1].GetSize().h;
|
||||
|
||||
// SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
||||
// SpriteList[1].SetScale(1.0, ScaleRate);
|
||||
// SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
||||
// }
|
||||
|
||||
// foreach(Child in SpriteList) {
|
||||
// // Addchild(Child);
|
||||
// Canvas.DrawSprite(Child);
|
||||
// }
|
||||
|
||||
// // 结束绘制
|
||||
// Canvas.EndDraw();
|
||||
// // 添加画布
|
||||
// Addchild(Canvas);
|
||||
|
||||
// }
|
||||
// }
|
||||
|
||||
//三分法拉伸
|
||||
class Yosin_EmeStretch extends CL_CanvasObject {
|
||||
|
||||
Path = null;
|
||||
Idx = null;
|
||||
//按钮状态
|
||||
SpriteList = null;
|
||||
|
||||
constructor(W, H, Path, Idx, Direction = true) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor();
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(W, H);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
SpriteList = [];
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx));
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx + 1));
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx + 2));
|
||||
|
||||
//横向
|
||||
if (Direction) {
|
||||
local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w);
|
||||
local ScaleRate = ScaleW / SpriteList[1].GetSize().w;
|
||||
|
||||
SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0.0);
|
||||
SpriteList[1].SetScale(ScaleRate, 1.0);
|
||||
SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0.0);
|
||||
}
|
||||
//纵向
|
||||
else {
|
||||
local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h);
|
||||
local ScaleRate = ScaleH / SpriteList[1].GetSize().h;
|
||||
|
||||
SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
||||
SpriteList[1].SetScale(1.0, ScaleRate);
|
||||
SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
||||
}
|
||||
|
||||
foreach(Child in SpriteList) {
|
||||
// Addchild(Child);
|
||||
DrawSprite(Child);
|
||||
}
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
// 添加画布
|
||||
// Addchild(Canvas);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//九宫格拉伸
|
||||
function Yosin_NineBoxStretch(width, height, path, imgId) {
|
||||
|
||||
// 创建画布
|
||||
local Canvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(width, height);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
// 左上角
|
||||
// local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
// 上边
|
||||
local backgroundTop = CL_SpriteObject(path, imgId + 1);
|
||||
// 右上角
|
||||
local backgroundTopRight = CL_SpriteObject(path, imgId + 2);
|
||||
// 左边
|
||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||
// 中间
|
||||
local backgroundCenter = CL_SpriteObject(path, imgId + 4);
|
||||
// 右边
|
||||
local backgroundRight = CL_SpriteObject(path, imgId + 5);
|
||||
// 左下角
|
||||
local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6);
|
||||
// 下边
|
||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||
// 右下角
|
||||
local backgroundBottomRight = CL_SpriteObject(path, imgId + 8);
|
||||
|
||||
|
||||
// 左上角
|
||||
Canvas.DrawSprite(backgroundTopLeft);
|
||||
|
||||
local TopLeftSize = backgroundTopLeft.GetSize();
|
||||
local TopLeftBottom = TopLeftSize.h;
|
||||
local TopLeftRight = TopLeftSize.w;
|
||||
|
||||
// 中间图片大小
|
||||
local centerImgSize = backgroundCenter.GetSize();
|
||||
local centerImgWidth = centerImgSize.w;
|
||||
local centerImgHeight = centerImgSize.h;
|
||||
|
||||
local centerWidth = width - backgroundTopLeft.GetSize().w - backgroundTopRight.GetSize().w;
|
||||
local centerHeight = height - backgroundTopLeft.GetSize().h - backgroundBottomLeft.GetSize().h;
|
||||
|
||||
|
||||
local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat();
|
||||
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
|
||||
|
||||
// 上边
|
||||
backgroundTop.SetScale(scaleW, 1);
|
||||
backgroundTop.SetPosition(TopLeftRight, 0);
|
||||
Canvas.DrawSprite(backgroundTop);
|
||||
|
||||
// 右上角
|
||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||
Canvas.DrawSprite(backgroundTopRight);
|
||||
|
||||
// 左边
|
||||
backgroundLeft.SetScale(1, scaleH);
|
||||
backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||
Canvas.DrawSprite(backgroundLeft);
|
||||
|
||||
// 中间
|
||||
backgroundCenter.SetScale(scaleW, scaleH);
|
||||
// Addchild(backgroundCenter);
|
||||
backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||
Canvas.DrawSprite(backgroundCenter);
|
||||
|
||||
// 右边
|
||||
backgroundRight.SetScale(1, scaleH);
|
||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||
Canvas.DrawSprite(backgroundRight);
|
||||
|
||||
// 左下角
|
||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||
Canvas.DrawSprite(backgroundBottomLeft);
|
||||
|
||||
// 下边
|
||||
backgroundBottom.SetScale(scaleW, 1);
|
||||
backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottom);
|
||||
|
||||
// 右下角
|
||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottomRight);
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
// Addchild(Canvas);
|
||||
local Sp = CL_SpriteObject();
|
||||
Sp.SetFrame(Canvas.ExportSpriteFrame());
|
||||
return Sp;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
//九宫格拉伸
|
||||
class Yosin_NineBoxStretch extends CL_CanvasObject {
|
||||
|
||||
constructor( width, height, path, imgId) {
|
||||
base.constructor();
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(width, height);
|
||||
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
// 左上角
|
||||
local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
// 上边
|
||||
local backgroundTop = CL_SpriteObject(path, imgId + 1);
|
||||
// 右上角
|
||||
local backgroundTopRight = CL_SpriteObject(path, imgId + 2);
|
||||
// 左边
|
||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||
// 中间
|
||||
local backgroundCenter = CL_SpriteObject(path, imgId + 4);
|
||||
// 右边
|
||||
local backgroundRight = CL_SpriteObject(path, imgId + 5);
|
||||
// 左下角
|
||||
local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6);
|
||||
// 下边
|
||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||
// 右下角
|
||||
local backgroundBottomRight = CL_SpriteObject(path, imgId + 8);
|
||||
|
||||
|
||||
// 左上角
|
||||
DrawSprite(backgroundTopLeft);
|
||||
|
||||
local TopLeftSize = backgroundTopLeft.GetSize();
|
||||
local TopLeftBottom = TopLeftSize.h;
|
||||
local TopLeftRight = TopLeftSize.w;
|
||||
|
||||
// 中间图片大小
|
||||
local centerImgSize = backgroundCenter.GetSize();
|
||||
local centerImgWidth = centerImgSize.w;
|
||||
local centerImgHeight = centerImgSize.h;
|
||||
|
||||
local centerWidth = width - backgroundTopLeft.GetSize().w - backgroundTopRight.GetSize().w;
|
||||
local centerHeight = height - backgroundTopLeft.GetSize().h - backgroundBottomLeft.GetSize().h;
|
||||
|
||||
|
||||
local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat();
|
||||
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
|
||||
|
||||
// 上边
|
||||
backgroundTop.SetScale(scaleW, 1);
|
||||
backgroundTop.SetPosition(TopLeftRight, 0);
|
||||
DrawSprite(backgroundTop);
|
||||
|
||||
// 右上角
|
||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||
DrawSprite(backgroundTopRight);
|
||||
|
||||
// 左边
|
||||
backgroundLeft.SetScale(1, scaleH);
|
||||
backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||
DrawSprite(backgroundLeft);
|
||||
|
||||
// 中间
|
||||
backgroundCenter.SetScale(scaleW, scaleH);
|
||||
// Addchild(backgroundCenter);
|
||||
backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||
DrawSprite(backgroundCenter);
|
||||
|
||||
// 右边
|
||||
backgroundRight.SetScale(1, scaleH);
|
||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||
DrawSprite(backgroundRight);
|
||||
|
||||
// 左下角
|
||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||
DrawSprite(backgroundBottomLeft);
|
||||
|
||||
// 下边
|
||||
backgroundBottom.SetScale(scaleW, 1);
|
||||
backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||
DrawSprite(backgroundBottom);
|
||||
|
||||
// 右下角
|
||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||
DrawSprite(backgroundBottomRight);
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
|
||||
//拼接按钮
|
||||
class Yosin_SplicingButton extends Yosin_CommonUi {
|
||||
//按钮状态
|
||||
State = 0;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
|
||||
SpriteList = null;
|
||||
SpriteState = -1;
|
||||
FrameList = null;
|
||||
|
||||
//按下时的模拟偏移
|
||||
DownSimulateOffset = true;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, Direction = true, UnavailableFlag = true) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
SpriteList = array(4);
|
||||
|
||||
//普通态
|
||||
SpriteList[0] = Yosin_EmeStretch(W, H, Path, Idx, Direction);
|
||||
//悬停态
|
||||
SpriteList[1] = Yosin_EmeStretch(W, H, Path, Idx + (UnavailableFlag ? 4 : 3), Direction);
|
||||
//按下态
|
||||
SpriteList[2] = Yosin_EmeStretch(W, H, Path, Idx + (UnavailableFlag ? 8 : 6), Direction);
|
||||
if (UnavailableFlag) {
|
||||
//不可用态
|
||||
SpriteList[3] = Yosin_EmeStretch(W, H, Path, Idx + 12, Direction);
|
||||
}
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
//按下时模拟偏移的Flag 如果按下 调整Y坐标向下一个单位
|
||||
if (DownSimulateOffset) {
|
||||
if (State == 2) {
|
||||
Y += 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y -= 1;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
}
|
||||
if (SpriteState != -1) {
|
||||
RemoveUIChild(SpriteList[SpriteState]);
|
||||
}
|
||||
SpriteState = State;
|
||||
Addchild(SpriteList[SpriteState]);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 标题按钮
|
||||
class titleButton extends Yosin_BaseButton {
|
||||
|
||||
index = null;
|
||||
select = false;
|
||||
cacheSelect = false;
|
||||
cacheY = null;
|
||||
|
||||
LBDownOnClick = null;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, title) {
|
||||
base.constructor(X, Y, W, H, Path, Idx);
|
||||
|
||||
cacheY = Y;
|
||||
DownSimulateOffset = false;
|
||||
|
||||
local backText = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = sq_RGBA(130, 114, 84, 255)
|
||||
});
|
||||
backText.SetUpdateFunc(function(Text, Dt) {
|
||||
if (select == cacheSelect) return;
|
||||
if (select) {
|
||||
Text.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
} else {
|
||||
Text.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
cacheSelect = select;
|
||||
})
|
||||
|
||||
backText.SetPosition(9, 2);
|
||||
Addchild(backText);
|
||||
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
if (State == 2) {
|
||||
Y = cacheY - 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y = cacheY;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
SpriteState = State;
|
||||
Sprite.SetFrame(FrameList[SpriteState]);
|
||||
Sprite.SetPosition(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
|
||||
if (select) return;
|
||||
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
select = true;
|
||||
if (LBDownOnClick != null) {
|
||||
LBDownOnClick(this);
|
||||
}
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 拉伸标题按钮
|
||||
class Yosin_StretchTitleButton extends Yosin_CommonUi {
|
||||
|
||||
index = null;
|
||||
//按钮状态
|
||||
State = 0;
|
||||
//ui的当前状态
|
||||
uiState = 0;
|
||||
|
||||
cecheY = null;
|
||||
|
||||
titleText = null;
|
||||
|
||||
SpriteList = null;
|
||||
|
||||
// 鼠标左键按下时的回调
|
||||
LBDownOnClick = null;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, title) {
|
||||
base.constructor(X, Y, W, H)
|
||||
|
||||
cecheY = Y;
|
||||
SpriteList = array(3);
|
||||
|
||||
//普通态
|
||||
SpriteList[0] = Yosin_EmeStretch(W, H, Path, Idx);
|
||||
Addchild(SpriteList[0]);
|
||||
|
||||
//悬停态
|
||||
SpriteList[1] = Yosin_EmeStretch(W, H, Path, Idx + 3);
|
||||
SpriteList[1].SetVisible(false)
|
||||
Addchild(SpriteList[1]);
|
||||
//按下态
|
||||
SpriteList[2] = Yosin_EmeStretch(W, H, Path, Idx + 6);
|
||||
SpriteList[2].SetVisible(false)
|
||||
Addchild(SpriteList[2]);
|
||||
|
||||
// 文字
|
||||
titleText = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = sq_RGBA(130, 114, 84, 255)
|
||||
});
|
||||
titleText.SetUpdateFunc(function(Text, Dt) {
|
||||
if (select == cacheSelect) return;
|
||||
if (select) {
|
||||
Text.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
} else {
|
||||
Text.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
cacheSelect = select;
|
||||
})
|
||||
|
||||
titleText.SetPosition(W / 2 - titleText.GetSize().w / 2, 2);
|
||||
Addchild(titleText);
|
||||
|
||||
}
|
||||
|
||||
// 设置为选中状态
|
||||
function SetSelect(select) {
|
||||
if (select) {
|
||||
State = 2;
|
||||
ChangeFrame();
|
||||
} else {
|
||||
State = 0;
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != uiState) {
|
||||
if (State == 2) {
|
||||
SyncPos(X, cecheY - 1);
|
||||
} else {
|
||||
SyncPos(X, cecheY);
|
||||
}
|
||||
uiState = State;
|
||||
|
||||
for (local i = 0; i< SpriteList.len(); i++) {
|
||||
SpriteList[i].SetVisible(i == uiState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
if (State == 2) return;
|
||||
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
if (LBDownOnClick != null) {
|
||||
LBDownOnClick(this);
|
||||
}
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 横向多个标题单选按钮
|
||||
class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
||||
|
||||
LBDownOnClick = null;
|
||||
btns = null;
|
||||
tests = null;
|
||||
|
||||
constructor(X, Y, W, titles, path, idx, baseWidth = 48) {
|
||||
this.tests = titles;
|
||||
btns = [];
|
||||
local btnX = 5;
|
||||
for (local i = 0; i< titles.len(); i++) {
|
||||
|
||||
local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 10;
|
||||
local btnW = baseWidth;
|
||||
btnW = textW > btnW ? textW : btnW;
|
||||
|
||||
local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]);
|
||||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
LBDownOnClick(btn.Parent, btn.index);
|
||||
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
btns[i].SetSelect(false);
|
||||
btns[i].titleText.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
|
||||
btn.SetSelect(true);
|
||||
btns[btn.index].titleText.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
|
||||
}.bindenv(this);
|
||||
|
||||
btns.push(titleBtn);
|
||||
btnX += btnW;
|
||||
}
|
||||
|
||||
base.constructor(X, Y, btnX, 21);
|
||||
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
AddUIChild(btns[i]);
|
||||
}
|
||||
|
||||
btns[0].SetSelect(true);
|
||||
|
||||
// 创建画布
|
||||
local Canvas = CL_CanvasObject();
|
||||
Canvas.SetPosition(0, 19);
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(W, 1);
|
||||
// 设置填充画刷 用于绘制边框和线条
|
||||
Canvas.SetFillBrush(sq_RGBA(66, 61, 59, 250));
|
||||
// 设置轮廓画刷 用于绘制边框和线条
|
||||
Canvas.SetStrokeBrush(sq_RGBA(66, 61, 59, 250));
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
// 画线段
|
||||
Canvas.DrawLine(0, 1, W, 1);
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(Canvas);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 进度显示
|
||||
class Yosin_Schedule extends Yosin_CommonUi {
|
||||
|
||||
//背景
|
||||
BgSprite = null;
|
||||
//条
|
||||
BarSprite = null;
|
||||
|
||||
// schedule 进度比例0-1
|
||||
constructor(X, Y, W, H, path, idx) {
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
BgSprite = CL_SpriteObject(path, idx + 1);
|
||||
Addchild(BgSprite);
|
||||
|
||||
BarSprite = CL_SpriteObject(path, idx);
|
||||
Addchild(BarSprite);
|
||||
}
|
||||
|
||||
function SetPercentage(Rate) {
|
||||
local barSize = BarSprite.GetSize();
|
||||
local barW = barSize.w * Rate;
|
||||
|
||||
BarSprite.SetCropRect(BarSprite.X, BarSprite.Y, barW, barSize.h);
|
||||
BarSprite.SetSize(barW, barSize.h);
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,12 @@ class _AssetManager_ {
|
|||
CharacterList = null;
|
||||
//角色信息表
|
||||
CharacterInfoList = null;
|
||||
//角色经验表
|
||||
CharacterExptable = null;
|
||||
//技能信息表
|
||||
SkillList = null;
|
||||
//技能树信息表
|
||||
SkillTreeList = null;
|
||||
//地图列表
|
||||
MapList = null;
|
||||
//城镇列表
|
||||
|
|
@ -20,6 +26,28 @@ class _AssetManager_ {
|
|||
StackableList = null;
|
||||
//NPC列表
|
||||
NpcList = null;
|
||||
//NPC商店列表
|
||||
NpcShopList = null;
|
||||
|
||||
|
||||
//杂项配置信息
|
||||
EtcConfig = null;
|
||||
//属性脚本
|
||||
AttributeScript = null;
|
||||
|
||||
function InitTownList() {
|
||||
TownList = ScriptData.GetFileData("town/town.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册城镇列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载城镇List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitMapList() {
|
||||
MapList = ScriptData.GetFileData("map/map.lst", function(DataTable, Data) {
|
||||
|
|
@ -41,6 +69,14 @@ class _AssetManager_ {
|
|||
}
|
||||
if (_DEBUG_) print("加载角色List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
CharacterExptable = ScriptData.GetFileData("character/exptable.tbl", function(DataTable, Data) {
|
||||
local Level = 1;
|
||||
while (!Data.Eof()) {
|
||||
local Exp = Data.Get();
|
||||
DataTable.rawset(Level, Exp.tointeger());
|
||||
Level += 1;
|
||||
}
|
||||
})
|
||||
CharacterInfoList = [];
|
||||
foreach(Index, Path in CharacterList) {
|
||||
if (Index == "filepath") continue;
|
||||
|
|
@ -66,12 +102,6 @@ class _AssetManager_ {
|
|||
DataTable.default_avatar.append(Ret);
|
||||
}
|
||||
}
|
||||
//基础属性
|
||||
else if (Key == "[HP MAX]]" || Key == "[MP MAX]]" || Key == "[physical attack]]" || Key == "[physical defense]]" || Key == "[magical attack]]" || Key == "[magical defense]]" || Key == "[inventory limit]]" || Key == "[MP regen speed]]" || Key == "[move speed]]" || Key == "[attack speed]]" || Key == "[cast speed]]" || Key == "[hit recovery]]" || Key == "[jump power]]" || Key == "[weight]]" || Key == "[jump speed]]") {
|
||||
local RealKey = Key.slice(1, Key.len() - 1);
|
||||
DataTable[RealKey] <- Data.Get().tofloat();
|
||||
|
||||
}
|
||||
//基础Ani
|
||||
else if (Key == "[waiting motion]" || Key == "[move motion]" || Key == "[sit motion]" || Key == "[damage motion 1]" || Key == "[damage motion 2]" || Key == "[down motion]" || Key == "[overturn motion]" || Key == "[jump motion]" || Key == "[jumpattack motion]" || Key == "[rest motion]" || Key == "[throw motion 1-1]" || Key == "[throw motion 1-2]" || Key == "[throw motion 2-1]" || Key == "[throw motion 2-2]" || Key == "[throw motion 3-1]" || Key == "[throw motion 3-2]" || Key == "[throw motion 4-1]" || Key == "[throw motion 4-2]" || Key == "[dash motion]" || Key == "[dashattack motion]" || Key == "[getitem motion]" || Key == "[buff motion]" || Key == "[simple rest motion]" || Key == "[simple move motion]" || Key == "[back motion]") {
|
||||
local RealKey = Key.slice(1, Key.len() - 1);
|
||||
|
|
@ -118,14 +148,99 @@ class _AssetManager_ {
|
|||
DataTable.etc_attack_info.append(dirpath + Ret.tolower());
|
||||
}
|
||||
}
|
||||
//属性
|
||||
else if (Key == "[growtype attribute]") {
|
||||
DataTable.Attribute <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/growtype attribute]") break;
|
||||
local attrtable = ScriptData.GetFileData(Ret, function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//基础属性
|
||||
if (AttributeScript.rawin(Key)) {
|
||||
DataTable[AttributeScript[Key]] <- Data.Get();
|
||||
}
|
||||
//名称
|
||||
else if (Key == "[name]") {
|
||||
DataTable.name <- Data.Get();
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
DataTable.Attribute.push(attrtable);
|
||||
}
|
||||
}
|
||||
}
|
||||
// print(DataTable);
|
||||
if (_DEBUG_) print("初始化角色" + DataTable.job);
|
||||
});
|
||||
}.bindenv(this));
|
||||
CharacterInfoList.push(Info);
|
||||
}
|
||||
}
|
||||
|
||||
function InitSkill() {
|
||||
SkillList = ScriptData.GetFileData("skill/skilllist.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册装备列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, ScriptData.GetFileData("skill/" + Data.Get().tolower(), function(DataTableA, DataA) {
|
||||
while (!DataA.Eof()) {
|
||||
local SkillIndex = DataA.Get();
|
||||
//注册装备列表 路径写入 数据未读取
|
||||
DataTableA.rawset(SkillIndex, DataA.Get());
|
||||
}
|
||||
if (_DEBUG_) print("加载职业技能" + Key + "List完成, 共" + DataTableA.len() + "个");
|
||||
}));
|
||||
}
|
||||
if (_DEBUG_) print("加载技能List完成, 共" + DataTable.len() + "个");
|
||||
})
|
||||
}
|
||||
|
||||
function InitJobSkillTree(Path) {
|
||||
local ConfigBuffer = ScriptData.GetFileData("clientonly/" + Path, function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
if (Key == "[skill info]") {
|
||||
Data.Get();
|
||||
local SkillIndex = Data.Get();
|
||||
DataTable.rawset(SkillIndex, {});
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/skill info]") break;
|
||||
//技能图标位置
|
||||
if (Ret == "[icon pos]") {
|
||||
DataTable[SkillIndex].IconPos <- {
|
||||
x = Data.Get(),
|
||||
y = Data.Get()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
ConfigBuffer.rawdelete("filepath");
|
||||
return ConfigBuffer;
|
||||
}
|
||||
|
||||
function InitSkillTree() {
|
||||
//先读职业技能树list 在读转职职业list
|
||||
SkillTreeList = ScriptData.GetFileData("clientonly/skilltree.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册技能树列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, ScriptData.GetFileData("clientonly/" + Data.Get().tolower(), function(DataTableA, DataA) {
|
||||
while (!DataA.Eof()) {
|
||||
local GrowJob = DataA.Get();
|
||||
local GrowJobSkillTreePath = DataA.Get();
|
||||
local Config = InitJobSkillTree(GrowJobSkillTreePath);
|
||||
DataTableA.rawset(GrowJob, Config);
|
||||
}
|
||||
}.bindenv(this)));
|
||||
}
|
||||
if (_DEBUG_) print("加载技能树List完成, 共" + DataTable.len() + "个职业技能树");
|
||||
}.bindenv(this))
|
||||
}
|
||||
|
||||
function InitEquipmentList() {
|
||||
EquipmentList = ScriptData.GetFileData("equipment/equipment.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
|
|
@ -138,8 +253,55 @@ class _AssetManager_ {
|
|||
}
|
||||
if (_DEBUG_) print("加载装备List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
//顺带初始化装备信息标签tag配置
|
||||
GameItem.EquipmentInfoTag = ScriptData.GetFileData("equipment/equipmentinfo.etc", function(DataTable, Data) {
|
||||
}
|
||||
|
||||
function InitStackableList() {
|
||||
StackableList = ScriptData.GetFileData("stackable/stackable.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册装备列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载消耗品List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitNpcList() {
|
||||
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册NPC列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载NPCList完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitNpcShopList() {
|
||||
NpcShopList = ScriptData.GetFileData("itemshop/itemshop.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册NPC商店列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载NPC商店List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function InitEtcConfig() {
|
||||
//初始化装备信息标签tag配置
|
||||
{
|
||||
EtcConfig.ItemInfoTag <- ScriptData.GetFileData("etc/iteminfo.etc", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Pack = Data.Get();
|
||||
//名称 grade 套装Id 稀有度 最低穿戴登记 重量
|
||||
|
|
@ -212,62 +374,90 @@ class _AssetManager_ {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function InitStackableList() {
|
||||
StackableList = ScriptData.GetFileData("stackable/stackable.lst", function(DataTable, Data) {
|
||||
//初始化NPC功能对应配置
|
||||
{
|
||||
EtcConfig.NpcRole <- ScriptData.GetFileData("etc/npcroleconfig.dat", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册装备列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
local Pack = Data.Get();
|
||||
//名称 grade 套装Id 稀有度 最低穿戴登记 重量
|
||||
if (Pack == "[config]") {
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/config]") break;
|
||||
DataTable[Ret] <- {
|
||||
imgidx = Data.Get(),
|
||||
name = Data.Get(),
|
||||
namecolor = HexStringToInt(Data.Get()),
|
||||
iconpath = Data.Get(),
|
||||
iconidx = Data.Get(),
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (_DEBUG_) print("加载消耗品List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitNpcList() {
|
||||
NpcList = ScriptData.GetFileData("npc/npc.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册NPC列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载NPCList完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
function InitTownList() {
|
||||
TownList = ScriptData.GetFileData("town/town.lst", function(DataTable, Data) {
|
||||
while (!Data.Eof()) {
|
||||
local Key = Data.Get();
|
||||
//注册城镇列表 路径写入 数据未读取
|
||||
DataTable.rawset(Key, {
|
||||
Path = Data.Get(),
|
||||
Data = null
|
||||
});
|
||||
}
|
||||
if (_DEBUG_) print("加载城镇List完成, 共" + DataTable.len() + "个");
|
||||
});
|
||||
}
|
||||
|
||||
constructor() {
|
||||
EtcConfig = {};
|
||||
AttributeScript = {};
|
||||
AttributeScript.rawset("[HP MAX]", "HPMax");
|
||||
AttributeScript.rawset("[MP MAX]", "MPMax");
|
||||
AttributeScript.rawset("[HP regen speed]", "HPRegenSpeed");
|
||||
AttributeScript.rawset("[MP regen speed]", "MPRegenSpeed");
|
||||
AttributeScript.rawset("[jump power]", "JumpPower");
|
||||
AttributeScript.rawset("[hit recovery]", "HitRecovery");
|
||||
AttributeScript.rawset("[stuck]", "Stuck");
|
||||
AttributeScript.rawset("[stuck resistance]", "StuckResistance");
|
||||
AttributeScript.rawset("[physical attack]", "PhysicalAttack");
|
||||
AttributeScript.rawset("[magical attack]", "MagicalAttack");
|
||||
AttributeScript.rawset("[physical defense]", "PhysicalDefense");
|
||||
AttributeScript.rawset("[magical defense]", "MagicalDefense");
|
||||
AttributeScript.rawset("[all elemental attack]", "AllElementalAttack");
|
||||
AttributeScript.rawset("[dark attack]", "DarkAttack");
|
||||
AttributeScript.rawset("[light attack]", "LightAttack");
|
||||
AttributeScript.rawset("[water attack]", "WaterAttack");
|
||||
AttributeScript.rawset("[fire attack]", "FireAttack");
|
||||
AttributeScript.rawset("[equipment physical attack]", "EquipmentPhysicalAttack");
|
||||
AttributeScript.rawset("[equipment magical attack]", "EquipmentMagicalAttack");
|
||||
AttributeScript.rawset("[separate attack]", "SeparateAttack");
|
||||
AttributeScript.rawset("[equipment physical defense]", "EquipmentPhysicalDefense");
|
||||
AttributeScript.rawset("[equipment magical defense]", "EquipmentMagicalDefense");
|
||||
AttributeScript.rawset("[attack speed]", "AttackSpeed");
|
||||
AttributeScript.rawset("[cast speed]", "CastSpeed");
|
||||
AttributeScript.rawset("[move speed]", "MoveSpeed");
|
||||
AttributeScript.rawset("[jump speed]", "JumpSpeed");
|
||||
AttributeScript.rawset("[physical critical hit]", "PhysicalCriticalHit");
|
||||
AttributeScript.rawset("[magical critical hit]", "MagicalCriticalHit");
|
||||
AttributeScript.rawset("[dark resistance]", "DarkResistance");
|
||||
AttributeScript.rawset("[light resistance]", "LightResistance");
|
||||
AttributeScript.rawset("[water resistance]", "WaterResistance");
|
||||
AttributeScript.rawset("[fire resistance]", "FireResistance");
|
||||
AttributeScript.rawset("[elemental property]", "ElementalProperty");
|
||||
|
||||
//初始化城镇列表
|
||||
InitTownList();
|
||||
//初始化地图列表
|
||||
InitMapList();
|
||||
//初始化角色
|
||||
InitCharacter();
|
||||
//初始化技能
|
||||
InitSkill();
|
||||
//初始化技能树
|
||||
InitSkillTree();
|
||||
//初始化装备列表
|
||||
InitEquipmentList();
|
||||
//初始化消耗品列表
|
||||
InitStackableList();
|
||||
//初始化NPC列表
|
||||
InitNpcList();
|
||||
//初始化NPC商店列表
|
||||
InitNpcShopList();
|
||||
|
||||
//初始化杂项配置信息
|
||||
InitEtcConfig();
|
||||
|
||||
|
||||
|
||||
getroottable().AssetManager <- this;
|
||||
|
|
@ -287,11 +477,20 @@ class _AssetManager_ {
|
|||
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
|
||||
while (!Data.Eof()) {
|
||||
local Pack = Data.Get();
|
||||
//名称 grade 套装Id 稀有度 最低穿戴登记 重量 组名 购买价格 出售价格 耐久 名望 四维 所有属强 四属强 双暴 命中 四属抗 属性攻击
|
||||
if (Pack == "[name]" || Pack == "[part set index]" || Pack == "[grade]" || Pack == "[rarity]" || Pack == "[minimum level]" || Pack == "[weight]" || Pack == "[item group name]" || Pack == "[price]" || Pack == "[repair price]" || Pack == "[value]" || Pack == "[durability]" || Pack == "[physical attack]" || Pack == "[magical attack]" || Pack == "[physical defense]" || Pack == "[magical defense]" || Pack == "[all elemental attack]" || Pack == "[dark attack]" || Pack == "[light attack]" || Pack == "[water attack]" || Pack == "[fire attack]" || Pack == "[attack speed]" || Pack == "[cast speed]" || Pack == "[move speed]" || Pack == "[physical critical hit]" || Pack == "[magical critical hit]" || Pack == "[stuck]" || Pack == "[fire resistance]" || Pack == "[dark resistance]" || Pack == "[light resistance]" || Pack == "[water resistance]" || Pack == "[elemental property]" || Pack == "[flavor text]") {
|
||||
//名称 grade 套装Id 稀有度 最低穿戴登记 重量 组名 购买价格 出售价格 耐久 描述
|
||||
if (Pack == "[name]" || Pack == "[part set index]" || Pack == "[grade]" || Pack == "[rarity]" || Pack == "[minimum level]" || Pack == "[weight]" || Pack == "[item group name]" || Pack == "[price]" || Pack == "[repair price]" || Pack == "[value]" || Pack == "[durability]" || Pack == "[flavor text]") {
|
||||
local RealKey = Pack.slice(1, -1);
|
||||
DataTable[RealKey] <- Data.Get();
|
||||
}
|
||||
//属性
|
||||
else if (AttributeScript.rawin(Pack)) {
|
||||
//三攻 和 双防 要读取两个值因为是浮动数组
|
||||
if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]" || Pack == "[equipment physical defense]" || Pack == "[equipment magical defense]") {
|
||||
DataTable[AttributeScript[Pack]] <- [Data.Get(), Data.Get()];
|
||||
} else {
|
||||
DataTable[AttributeScript[Pack]] <- Data.Get();
|
||||
}
|
||||
}
|
||||
//适用角色
|
||||
else if (Pack == "[usable job]") {
|
||||
DataTable.usable_job <- [];
|
||||
|
|
@ -301,10 +500,14 @@ class _AssetManager_ {
|
|||
DataTable.usable_job.append(Ret.slice(1, -1).tolower());
|
||||
}
|
||||
}
|
||||
//读取三攻 和 双防
|
||||
else if (Pack == "[equipment physical attack]" || Pack == "[equipment magical attack]" || Pack == "[separate attack]" || Pack == "[equipment physical defense]" || Pack == "[equipment magical defense]") {
|
||||
local RealKey = Pack.slice(1, -1);
|
||||
DataTable[RealKey] <- [Data.Get(), Data.Get()];
|
||||
//隐藏图层
|
||||
else if (Pack == "[hide layer]") {
|
||||
DataTable.hide_layer <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/hide layer]") break;
|
||||
DataTable.hide_layer.append(Ret);
|
||||
}
|
||||
}
|
||||
//图标
|
||||
else if (Pack == "[icon]") {
|
||||
|
|
@ -334,6 +537,33 @@ class _AssetManager_ {
|
|||
DataTable.aurora_effects.push(T);
|
||||
}
|
||||
}
|
||||
//Expand Ani
|
||||
else if (Pack == "[expand ani]") {
|
||||
if (!(DataTable.rawin("Ani"))) DataTable["Ani"] <- {};
|
||||
local DataBuffer = {};
|
||||
DataBuffer.layer_variation <- [];
|
||||
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/expand ani]") break;
|
||||
if (Ret == "[variation]") {
|
||||
DataBuffer.variation <- [Data.Get(), Data.Get()];
|
||||
} else if (Ret == "[layer variation]") {
|
||||
local InfoBuf = {};
|
||||
InfoBuf.Zorder <- Data.Get();
|
||||
InfoBuf.Path <- Data.Get();
|
||||
DataBuffer.layer_variation.append(InfoBuf);
|
||||
} else if (Ret == "[expand path]") {
|
||||
DataTable["expand_path"] <- Data.Get();
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Job in DataTable.usable_job) {
|
||||
DataTable["Ani"]["Ani_" + Job] <- {};
|
||||
DataTable["Ani"]["Ani_" + Job].variation <- sq_DeepCopy(DataBuffer.variation);
|
||||
DataTable["Ani"]["Ani_" + Job].layer_variation <- sq_DeepCopy(DataBuffer.layer_variation)
|
||||
}
|
||||
}
|
||||
//Ani
|
||||
else if (Pack == "[animation job]") {
|
||||
local Job = Data.Get().slice(1, -1);
|
||||
|
|
@ -360,7 +590,7 @@ class _AssetManager_ {
|
|||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}.bindenv(this));
|
||||
EquipmentList[Idx].Data = m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
|
@ -420,8 +650,6 @@ class _AssetManager_ {
|
|||
return m_data;
|
||||
}
|
||||
|
||||
//Public::
|
||||
|
||||
//获取NPC信息
|
||||
function GetNpc(Idx) {
|
||||
//如果没有这个NPC则返回
|
||||
|
|
@ -437,7 +665,7 @@ class _AssetManager_ {
|
|||
if (Pack == "[small face]" || Pack == "[big face]" || Pack == "[popup face]") {
|
||||
local RealKey = Pack.slice(1, Pack.find(" face")) + "_face";
|
||||
DataTable[RealKey] <- {
|
||||
img = Data.Get().tolower(),
|
||||
img = "sprite/" + Data.Get().tolower(),
|
||||
idx = Data.Get()
|
||||
}
|
||||
} else if (Pack == "[field animation]") {
|
||||
|
|
@ -465,4 +693,172 @@ class _AssetManager_ {
|
|||
NpcList[Idx].Data = m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
||||
//获取NPC商店信息
|
||||
function GetNpcShop(Idx) {
|
||||
//如果没有这个商店则返回
|
||||
if (!(NpcShopList.rawin(Idx))) return;
|
||||
//如果商店数据已经读取过存在了则直接返回
|
||||
if (NpcShopList[Idx].Data) return NpcShopList[Idx].Data;
|
||||
local Path = NpcShopList[Idx].Path;
|
||||
local m_data = ScriptData.GetFileData("itemshop/" + Path, function(DataTable, Data) {
|
||||
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
|
||||
DataTable.PageList <- [];
|
||||
DataTable.PageNameList <- [];
|
||||
while (!Data.Eof()) {
|
||||
local Pack = Data.Get();
|
||||
//商店信息
|
||||
if (Pack == "[page]") {
|
||||
local ItemList = [];
|
||||
DataTable.PageNameList.push(Data.Get());
|
||||
while (true) {
|
||||
local Buffer = Data.Get();
|
||||
if (Buffer == "[/page]") break;
|
||||
local ItemInfo = {};
|
||||
ItemInfo.Id <- Buffer;
|
||||
ItemInfo.Cera <- Data.Get();
|
||||
ItemInfo.CeraPoint <- Data.Get();
|
||||
ItemInfo.Gold <- Data.Get();
|
||||
ItemInfo.Material <- Data.Get();
|
||||
ItemInfo.MaterialCount <- Data.Get();
|
||||
ItemList.push(ItemInfo);
|
||||
}
|
||||
DataTable.PageList.push(ItemList);
|
||||
} else if (Pack == "[name]") {
|
||||
DataTable.name <- Data.Get();
|
||||
}
|
||||
}
|
||||
});
|
||||
NpcList[Idx].Data = m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
||||
//获取技能信息
|
||||
function GetSkill(Job, Idx) {
|
||||
//如果没有这个技能则返回
|
||||
if (!(SkillList.rawin(Job))) return;
|
||||
if (!(SkillList[Job].rawin(Idx))) return;
|
||||
//如果技能数据已经读取过存在了则直接返回
|
||||
if (typeof SkillList[Job][Idx] == "table") return SkillList[Job][Idx];
|
||||
local Path = SkillList[Job][Idx];
|
||||
local m_data = ScriptData.GetFileData("skill/" + Path, function(DataTable, Data) {
|
||||
DataTable.DirPath <- DataTable.filepath.slice(0, DataTable.filepath.lastfind("/") + 1);
|
||||
while (!Data.Eof()) {
|
||||
local Pack = Data.Get();
|
||||
if (Pack == "[command key explain]" || Pack == "[basic explain]" || Pack == "[explain]" || Pack == "[name]" || Pack == "[name2]" || Pack == "[required level]" || Pack == "[required level range]" || Pack == "[skill class]" || Pack == "[maximum level]" || Pack == "[skill fitness second growtype]") {
|
||||
DataTable[Pack.slice(1, -1)] <- Data.Get();
|
||||
}
|
||||
//技能类型
|
||||
else if (Pack == "[type]") {
|
||||
local Type = Data.Get();
|
||||
if (Type == "[active]") {
|
||||
DataTable.type <- 0;
|
||||
} else if (Type == "[passive]") {
|
||||
DataTable.type <- 0;
|
||||
}
|
||||
}
|
||||
//技能消耗道具
|
||||
else if (Pack == "[consume item]") {
|
||||
DataTable.consume_item <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/consume item]") break;
|
||||
DataTable.consume_item.push(Ret);
|
||||
DataTable.consume_item.push(Data.Get());
|
||||
DataTable.consume_item.push(Data.Get());
|
||||
}
|
||||
}
|
||||
//各职业是否可学习
|
||||
else if (Pack == "[skill fitness growtype]") {
|
||||
DataTable.skill_fitness_growtype <- {};
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/skill fitness growtype]") break;
|
||||
DataTable.skill_fitness_growtype.rawset(Ret, true);
|
||||
}
|
||||
}
|
||||
//图标
|
||||
else if (Pack == "[icon]") {
|
||||
DataTable.icon <- {};
|
||||
local Ret = Data.Get();
|
||||
DataTable.icon.path <- "sprite/" + Ret.tolower();
|
||||
Ret = Data.Get();
|
||||
DataTable.icon.index <- Ret.tointeger();
|
||||
}
|
||||
//技能指令
|
||||
else if (Pack == "[command]") {
|
||||
DataTable.command <- [];
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/command]") break;
|
||||
DataTable.command.push(Ret);
|
||||
}
|
||||
}
|
||||
//技能属性
|
||||
else if (Pack == "[level property]") {
|
||||
DataTable.level_property <- {};
|
||||
DataTable.level_property.data <- [];
|
||||
Data.Get();
|
||||
Data.Get();
|
||||
local ExplainBuffer = Data.Get();
|
||||
ExplainBuffer = String.ReplaceString(ExplainBuffer, "<int>", "%d");
|
||||
ExplainBuffer = String.ReplaceString(ExplainBuffer, "<float1>", "%.1f");
|
||||
ExplainBuffer = String.ReplaceString(ExplainBuffer, "<float2>", "%.2f");
|
||||
DataTable.level_property.explain <- ExplainBuffer;
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/level property]") break;
|
||||
DataTable.level_property.data.push(Ret);
|
||||
}
|
||||
}
|
||||
//地下城数据
|
||||
else if (Pack == "[dungeon]") {
|
||||
DataTable.dungeon_data <- {};
|
||||
DataTable.dungeon_data.consume_mp <- 0;
|
||||
while (true) {
|
||||
local Ret = Data.Get();
|
||||
if (Ret == "[/dungeon]") break;
|
||||
if (Ret == "[cool time]") {
|
||||
DataTable.dungeon_data.cooltime <- [Data.Get(), Data.Get()];
|
||||
} else if (Ret == "[consume MP]") {
|
||||
DataTable.dungeon_data.consume_mp <- [Data.Get(), Data.Get()];
|
||||
} else if (Ret == "[casting time]") {
|
||||
DataTable.dungeon_data.casting_time <- [Data.Get(), Data.Get()];
|
||||
} else if (Ret == "[static data]") {
|
||||
DataTable.dungeon_data.static_data <- [];
|
||||
while (true) {
|
||||
local Ret2 = Data.Get();
|
||||
if (Ret2 == "[/static data]") break;
|
||||
DataTable.dungeon_data.static_data.push(Ret2);
|
||||
}
|
||||
} else if (Ret == "[level info]") {
|
||||
local ListCount = Data.Get();
|
||||
DataTable.dungeon_data.level_info <- [];
|
||||
|
||||
while (true) {
|
||||
local Ret2 = Data.Get();
|
||||
if (Ret2 == "[/level info]") break;
|
||||
local ArrBuffer = [Ret2];
|
||||
for (local i = 0; i< ListCount - 1; i++) {
|
||||
ArrBuffer.push(Data.Get());
|
||||
}
|
||||
DataTable.dungeon_data.level_info.push(ArrBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
SkillList[Job][Idx] = m_data;
|
||||
return m_data;
|
||||
}
|
||||
|
||||
//获取指定职业的技能树配置
|
||||
function GetSkillTreeByJob(Job, GrowType) {
|
||||
if (SkillTreeList.rawin(Job) && SkillTreeList[Job].rawin(GrowType)) {
|
||||
return SkillTreeList[Job][GrowType];
|
||||
}
|
||||
error("没有找到指定职业的技能树配置");
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
文件名:AdditionalItems.nut
|
||||
路径:User/Asset/Character/AdditionalItems.nut
|
||||
创建日期:2025-01-26 12:28
|
||||
文件用途:
|
||||
*/
|
||||
class Character_AdditionalItems extends Actor {
|
||||
|
||||
ENUM_RINDRO_JOB_TITLE_HEIGHT = [
|
||||
//男鬼剑士
|
||||
{
|
||||
x = -18,
|
||||
y = -154
|
||||
},
|
||||
//女格斗
|
||||
{
|
||||
x = -18,
|
||||
y = -140
|
||||
},
|
||||
//男神枪手
|
||||
{
|
||||
x = -20,
|
||||
y = -168
|
||||
},
|
||||
//女魔法师
|
||||
{
|
||||
x = -22,
|
||||
y = -126
|
||||
},
|
||||
//男圣职者
|
||||
{
|
||||
x = -22,
|
||||
y = -166
|
||||
},
|
||||
//女神枪手
|
||||
{
|
||||
x = -18,
|
||||
y = -156
|
||||
},
|
||||
//女暗夜使者
|
||||
{
|
||||
x = -20,
|
||||
y = -154
|
||||
},
|
||||
//男格斗家
|
||||
{
|
||||
x = -21,
|
||||
y = -160
|
||||
},
|
||||
//男魔法师
|
||||
{
|
||||
x = -21,
|
||||
y = -140
|
||||
},
|
||||
//黑暗武士
|
||||
{
|
||||
x = -18,
|
||||
y = -154
|
||||
},
|
||||
//缔造者
|
||||
{
|
||||
x = -22,
|
||||
y = -126
|
||||
},
|
||||
];
|
||||
|
||||
//光环
|
||||
AuroraAni = null;
|
||||
//名字
|
||||
Name = null;
|
||||
//聊天气泡
|
||||
ChatObject = null;
|
||||
|
||||
function Init() {
|
||||
//初始化名字
|
||||
InitName();
|
||||
}
|
||||
|
||||
//初始化光环
|
||||
function InitAuroa() {
|
||||
//光环
|
||||
local Info = Parent.aurora;
|
||||
//如果有光环
|
||||
if (AuroraAni) {
|
||||
foreach(Ani in AuroraAni) {
|
||||
Removechild(Ani);
|
||||
}
|
||||
}
|
||||
AuroraAni = [];
|
||||
|
||||
foreach(Effect in Info.Aurora_effects) {
|
||||
local AniBuf = Animation(Effect.path);
|
||||
AuroraAni.append(AniBuf);
|
||||
Addchild(AniBuf);
|
||||
//front
|
||||
if (Effect.type == 1) {
|
||||
AniBuf.SetZOrder(100000);
|
||||
} else {
|
||||
AniBuf.SetZOrder(-100000);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//初始化名字
|
||||
function InitName() {
|
||||
//创建名字对象
|
||||
Name = FontAssetManager.GenerateNormal("", true, {
|
||||
color = sq_RGBA(209, 185, 148, 255),
|
||||
});
|
||||
Name.SetZOrder(80000);
|
||||
Addchild(Name);
|
||||
}
|
||||
|
||||
//设置名字
|
||||
function SetName(gName) {
|
||||
this.Name.SetText(gName);
|
||||
this.Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].x + 19 - (Name.GetSize().w / 2), ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].y + 13);
|
||||
}
|
||||
|
||||
//设置聊天气泡
|
||||
function SetChatBubble(Chat) {
|
||||
//如果有对话气泡没消失先移除
|
||||
if (ChatObject) Removechild(ChatObject);
|
||||
|
||||
ChatObject = Character_ChatBubble(Chat);
|
||||
ChatObject.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].x + 19 - ((ChatObject.RealWidth) / 2), Name.Y - (ChatObject.RealHeight));
|
||||
ChatObject.SetZOrder(80001);
|
||||
Addchild(ChatObject);
|
||||
}
|
||||
}
|
||||
|
|
@ -25,7 +25,7 @@ class Character_Animation extends Actor {
|
|||
//被击后退Ani
|
||||
OverturnAni = null;
|
||||
//跳跃Ani
|
||||
JumoAni = null;
|
||||
JumpAni = null;
|
||||
//跳跃攻击Ani
|
||||
JumpAttackAni = null;
|
||||
//站立Ani
|
||||
|
|
@ -50,165 +50,148 @@ class Character_Animation extends Actor {
|
|||
//普通攻击Ani
|
||||
AttackAni = null;
|
||||
|
||||
//光环
|
||||
AuroraAni = null;
|
||||
SMap = {
|
||||
WaitingAni = "waiting motion",
|
||||
MoveAni = "move motion",
|
||||
SitAni = "sit motion",
|
||||
DamageAni1 = "damage motion 1",
|
||||
DamageAni2 = "damage motion 2",
|
||||
DownAni = "down motion",
|
||||
OverturnAni = "overturn motion",
|
||||
JumpAni = "jump motion",
|
||||
JumpAttackAni = "jumpattack motion",
|
||||
RestAni = "rest motion",
|
||||
ThrowAni1_1 = "throw motion 1-1",
|
||||
ThrowAni1_2 = "throw motion 1-2",
|
||||
ThrowAni2_1 = "throw motion 2-1",
|
||||
ThrowAni2_2 = "throw motion 2-2",
|
||||
ThrowAni3_1 = "throw motion 3-1",
|
||||
ThrowAni3_2 = "throw motion 3-2",
|
||||
ThrowAni4_1 = "throw motion 4-1",
|
||||
ThrowAni4_2 = "throw motion 4-2",
|
||||
DashAni = "dash motion",
|
||||
DashAttackAni = "dashattack motion",
|
||||
GetItemAni = "getitem motion",
|
||||
BuffAni = "buff motion",
|
||||
}
|
||||
|
||||
//名字
|
||||
Name = null;
|
||||
//默认的Ani
|
||||
Default_Avatar = null;
|
||||
|
||||
//隐藏图层
|
||||
HideLayer = null;
|
||||
|
||||
//使用武器装扮
|
||||
UseWeaponAvatar = false;
|
||||
|
||||
ENUM_RINDRO_JOB_TITLE_HEIGHT = [
|
||||
//男鬼剑士
|
||||
{
|
||||
x = -18,
|
||||
y = -154
|
||||
},
|
||||
//女格斗
|
||||
{
|
||||
x = -18,
|
||||
y = -140
|
||||
},
|
||||
//男神枪手
|
||||
{
|
||||
x = -20,
|
||||
y = -168
|
||||
},
|
||||
//女魔法师
|
||||
{
|
||||
x = -22,
|
||||
y = -126
|
||||
},
|
||||
//男圣职者
|
||||
{
|
||||
x = -22,
|
||||
y = -166
|
||||
},
|
||||
//女神枪手
|
||||
{
|
||||
x = -18,
|
||||
y = -156
|
||||
},
|
||||
//女暗夜使者
|
||||
{
|
||||
x = -20,
|
||||
y = -154
|
||||
},
|
||||
//男格斗家
|
||||
{
|
||||
x = -21,
|
||||
y = -160
|
||||
},
|
||||
//男魔法师
|
||||
{
|
||||
x = -21,
|
||||
y = -140
|
||||
},
|
||||
//黑暗武士
|
||||
{
|
||||
x = -18,
|
||||
y = -154
|
||||
},
|
||||
//缔造者
|
||||
{
|
||||
x = -22,
|
||||
y = -126
|
||||
},
|
||||
];
|
||||
|
||||
constructor() {
|
||||
base.constructor();
|
||||
}
|
||||
|
||||
//同步单部位动画
|
||||
function SyncAnimationBySlot(Type, AniObj, Src) {
|
||||
this[AniObj][Type] <- [];
|
||||
//根据Ani路径和格式化数组来创建Ani ImgVariation Ani对应的格式化的数组 | Src Ani路径
|
||||
function CreateAni(ImgVariation, Src) {
|
||||
//拷贝Ani的信息
|
||||
local AniInfo = sq_DeepCopy(ScriptData.GetAni(Src));
|
||||
//构造Ani的处理函数
|
||||
local Ao = {
|
||||
//传递Img的格式化方法
|
||||
ImgFormat = function(ImgPath) {
|
||||
//如果是皮肤这里会是"%04d" 这里要格式化成"%02d%02d"
|
||||
if (ImgPath.find("%04d")) {
|
||||
local Pos = ImgPath.find("%04d");
|
||||
ImgPath = ImgPath.slice(0, Pos) + "%02d%02d" + ImgPath.slice(Pos + 4);
|
||||
}
|
||||
//替换掉Img的索引编号
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
//构造Ani
|
||||
local Ani = Animation(AniInfo, Ao);
|
||||
return Ani;
|
||||
}
|
||||
|
||||
//同步单部位动画 Type 时装的类型名字 "hair" | Src Ani的路径
|
||||
function SyncAnimationBySlot(Type, Src) {
|
||||
//单部位的动画组
|
||||
local AniList = [];
|
||||
//如果有时装就初始化Ani
|
||||
//除了皮肤 在没有的情况下初始化0
|
||||
if (Type == "skin") {
|
||||
if (Type == "skin_avatar") {
|
||||
local variation = [0, 0];
|
||||
//如果存在皮肤就读取variation
|
||||
if (Parent[Type] != null) {
|
||||
//获取对应装备或时装的信息
|
||||
local AvaInfo = Parent[Type];
|
||||
//获取对应职业对应的格式化信息
|
||||
local JobInfo = AvaInfo["Animation_Job"]["Ani_" + Parent.Info["job"]];
|
||||
variation = JobInfo["variation"];
|
||||
}
|
||||
local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src));
|
||||
local Ao = {
|
||||
ImgVariation = variation,
|
||||
ImgFormat = function(ImgPath) {
|
||||
if (ImgVariation[0] > 0) {
|
||||
local Pos = ImgPath.find("%04d");
|
||||
ImgPath = ImgPath.slice(0, Pos) + "%02d%02d" + ImgPath.slice(Pos + 4);
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
} else {
|
||||
return format(ImgPath, ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
local SkinAni = Animation(BufInfo, Ao);
|
||||
local SkinAni = CreateAni(variation, Src);
|
||||
//如果是皮肤Ani 绑定状态机 确保唯一性
|
||||
SkinAni.BindenvStateMachine(Parent.StateMachine);
|
||||
//将Ani类型设置为皮肤
|
||||
SkinAni.Type = "skin";
|
||||
//加入组
|
||||
this[AniObj][Type].append(SkinAni);
|
||||
AniList.append(SkinAni);
|
||||
} else {
|
||||
//先判断类型
|
||||
//先判断 时装类型 角色有没有穿戴这个类型的时装
|
||||
if (Parent[Type] != null) {
|
||||
//获取对应装备或时装的信息
|
||||
local AvaInfo = Parent[Type];
|
||||
if (AvaInfo) {
|
||||
//获取对应职业对应的格式化信息
|
||||
local JobInfo = AvaInfo["Animation_Job"]["Ani_" + Parent.Info["job"]];
|
||||
local variation = JobInfo["variation"];
|
||||
//非皮肤的时装 会有多个层
|
||||
foreach(_index, value in JobInfo["layer_variation"]) {
|
||||
local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/"))));
|
||||
local Ao = {
|
||||
ImgVariation = JobInfo["variation"],
|
||||
ImgFormat = function(ImgPath) {
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
local AniBuf = Animation(BufInfo, Ao);
|
||||
local RealAniPath;
|
||||
//如果有指定Ani Path 就使用指定的Ani Path
|
||||
if (AvaInfo["ExpandPath"]) RealAniPath = AvaInfo["ExpandPath"] + value["Path"] + Src.slice(Src.lastfind("/"));
|
||||
//否则 拼接真实的Ani路径
|
||||
else RealAniPath = AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/"));
|
||||
local AniBuf = CreateAni(variation, RealAniPath);
|
||||
//设置Ani类型
|
||||
AniBuf.Type = Type;
|
||||
//设置Ani的ZOrder
|
||||
AniBuf.SetZOrder(value["Zorder"]);
|
||||
this[AniObj][Type].append(AniBuf);
|
||||
//加入组
|
||||
AniList.append(AniBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return AniList;
|
||||
}
|
||||
|
||||
//读取并设置Ani
|
||||
function ReadAndSetAni(AniObj, Src, SlotType) {
|
||||
//从父对象 也就是角色对象取得Info
|
||||
local Info = Parent.Info;
|
||||
//如果有这个标签Ani则初始化 获取ani路径
|
||||
if (Info.rawin(Src)) Src = Info[Src];
|
||||
else return;
|
||||
|
||||
//如果不存在则构造
|
||||
if (this[AniObj] == null) this[AniObj] = {};
|
||||
|
||||
//如果没有传递装备类型就初始化所有
|
||||
if (!SlotType) {
|
||||
foreach(Type in getconsttable().AvatarType) {
|
||||
SyncAnimationBySlot(Type, AniObj, Src);
|
||||
//根据动画组名称构造AniMap AniObj 角色类的动画组名称 Src Ani代表的标签 “sit motion” SlotType 装备类型
|
||||
function StructureAniMap(Src) {
|
||||
//初始化所有时装部位
|
||||
local AniObjectMap = {};
|
||||
foreach(Type, NString in getconsttable().AvatarType) {
|
||||
local AniList = SyncAnimationBySlot(Type, Src);
|
||||
AniObjectMap[Type] <- AniList;
|
||||
}
|
||||
return AniObjectMap;
|
||||
}
|
||||
//否则只初始化这一件装备的
|
||||
else {
|
||||
|
||||
//切换装备的刷新Ani
|
||||
function RefreshAni(AniObj, Src, SlotType) {
|
||||
//记录当前皮肤Ani的时间 确保唯一性
|
||||
local AniTime = 0;
|
||||
if (this.CurrentAni) AniTime = this.CurrentAni["skin"][0].CurrentIndexT;
|
||||
if (this.CurrentAni) AniTime = this.CurrentAni["skin_avatar"][0].CurrentIndexT;
|
||||
//记录当前皮肤Ani的帧 确保唯一性
|
||||
local AniFrameIndex = 0;
|
||||
if (this.CurrentAni) AniFrameIndex = this.CurrentAni["skin"][0].CurrentFrameIndex;
|
||||
if (this.CurrentAni) AniFrameIndex = this.CurrentAni["skin_avatar"][0].CurrentFrameIndex;
|
||||
|
||||
//如果当前播放Ani是 构造的Ani 则移除 并清空
|
||||
if (this.CurrentAni == this[AniObj]) {
|
||||
foreach(AniBuf in this.CurrentAni[SlotType]) {
|
||||
AniBuf.RemoveSelf();
|
||||
}
|
||||
}
|
||||
SyncAnimationBySlot(SlotType, AniObj, Src);
|
||||
local AniList = SyncAnimationBySlot(SlotType, Src);
|
||||
this[AniObj][SlotType] <- AniList;
|
||||
//如果当前播放Ani是 构造的Ani
|
||||
if (this.CurrentAni == this[AniObj]) {
|
||||
//添加Ani 并设置为当前皮肤Ani的时间
|
||||
|
|
@ -220,168 +203,99 @@ class Character_Animation extends Actor {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function ReadAndSetAttackAni() {
|
||||
local AttackAniArrSrc = Info["attack_motion"];
|
||||
AttackAni = array(AttackAniArrSrc.len());
|
||||
foreach(_Index, Path in AttackAniArrSrc) {
|
||||
local Src = Path;
|
||||
AttackAni[_Index] = [];
|
||||
foreach(Type in getconsttable().AvatarType) {
|
||||
//如果有时装就初始化Ani
|
||||
//除了皮肤 在没有的情况下初始化0
|
||||
if (Type == "skin") {
|
||||
local SkinAni;
|
||||
if (this[Type] == null) {
|
||||
local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src));
|
||||
local Ao = {
|
||||
ImgVariation = [0, 0],
|
||||
ImgFormat = function(ImgPath) {
|
||||
if (ImgVariation[0] > 0) {
|
||||
local Pos = ImgPath.find("%04d");
|
||||
ImgPath = ImgPath.slice(0, Pos) + "%02d%02d" + ImgPath.slice(Pos + 4);
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
} else {
|
||||
return format(ImgPath, ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
SkinAni = Animation(BufInfo, Ao);
|
||||
} else {
|
||||
local AvaInfo = AssetManager.GetEquipment(this[Type]);
|
||||
local JobInfo = AvaInfo["Ani"]["Ani_" + Info["job"]];
|
||||
local BufInfo = sq_DeepCopy(ScriptData.GetAni(Src));
|
||||
local Ao = {
|
||||
ImgVariation = JobInfo["variation"],
|
||||
ImgFormat = function(ImgPath) {
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
SkinAni = Animation(BufInfo, Ao);
|
||||
}
|
||||
//如果是皮肤Ani 绑定状态机 确保唯一性
|
||||
SkinAni.BindenvStateMachine(StateMachine);
|
||||
//将Ani类型设置为皮肤
|
||||
SkinAni.Type = "skin";
|
||||
//加入组
|
||||
AttackAni[_Index].append(SkinAni);
|
||||
} else {
|
||||
if (this[Type] != null) {
|
||||
|
||||
local AvaInfo = AssetManager.GetEquipment(this[Type]);
|
||||
local JobInfo = AvaInfo["Ani"]["Ani_" + Info["job"]];
|
||||
foreach(_index, value in JobInfo["layer_variation"]) {
|
||||
local BufInfo = sq_DeepCopy(ScriptData.GetAni(AvaInfo["DirPath"] + value["Path"] + Src.slice(Src.lastfind("/"))));
|
||||
local Ao = {
|
||||
ImgVariation = JobInfo["variation"],
|
||||
ImgFormat = function(ImgPath) {
|
||||
return format(ImgPath, ImgVariation[0], ImgVariation[1]);
|
||||
}
|
||||
}
|
||||
local AniBuf = Animation(BufInfo, Ao);
|
||||
//设置Ani类型
|
||||
AniBuf.Type = Type;
|
||||
AniBuf.SetZOrder(value["Zorder"]);
|
||||
AttackAni[_Index].append(AniBuf);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//初始化
|
||||
function Init(SlotType = false) {
|
||||
//初始化Ani
|
||||
InitAni(SlotType);
|
||||
//初始化名字
|
||||
InitName();
|
||||
}
|
||||
|
||||
function InitAni(SlotType) {
|
||||
//读取并设置 等待Ani
|
||||
ReadAndSetAni("WaitingAni", "waiting motion", SlotType);
|
||||
//读取并设置 移动Ani
|
||||
ReadAndSetAni("MoveAni", "move motion", SlotType);
|
||||
//读取并设置 蹲下Ani
|
||||
ReadAndSetAni("SitAni", "sit motion", SlotType);
|
||||
//读取并设置 受伤Ani
|
||||
ReadAndSetAni("DamageAni1", "damage motion 1", SlotType);
|
||||
//读取并设置 受伤Ani
|
||||
ReadAndSetAni("DamageAni2", "damage motion 2", SlotType);
|
||||
//读取并设置 倒地Ani
|
||||
ReadAndSetAni("DownAni", "down motion", SlotType);
|
||||
//读取并设置 被击后退Ani
|
||||
ReadAndSetAni("OverturnAni", "overturn motion", SlotType);
|
||||
//读取并设置 跳跃Ani
|
||||
ReadAndSetAni("JumoAni", "jump motion", SlotType);
|
||||
//读取并设置 跳跃攻击Ani
|
||||
ReadAndSetAni("JumpAttackAni", "jumpattack motion", SlotType);
|
||||
//读取并设置 站立Ani
|
||||
ReadAndSetAni("RestAni", "rest motion", SlotType);
|
||||
//读取并设置 引导Ani
|
||||
ReadAndSetAni("ThrowAni1_1", "throw motion 1-1", SlotType);
|
||||
ReadAndSetAni("ThrowAni1_2", "throw motion 1-2", SlotType);
|
||||
ReadAndSetAni("ThrowAni2_1", "throw motion 2-1", SlotType);
|
||||
ReadAndSetAni("ThrowAni2_2", "throw motion 2-2", SlotType);
|
||||
ReadAndSetAni("ThrowAni3_1", "throw motion 3-1", SlotType);
|
||||
ReadAndSetAni("ThrowAni3_2", "throw motion 3-2", SlotType);
|
||||
ReadAndSetAni("ThrowAni4_1", "throw motion 4-1", SlotType);
|
||||
ReadAndSetAni("ThrowAni4_2", "throw motion 4-2", SlotType);
|
||||
//读取并设置 奔跑Ani
|
||||
ReadAndSetAni("DashAni", "dash motion", SlotType);
|
||||
//读取并设置 奔跑攻击Ani
|
||||
ReadAndSetAni("DashAttackAni", "dashattack motion", SlotType);
|
||||
//读取并设置 拾取Ani
|
||||
ReadAndSetAni("GetItemAni", "getitem motion", SlotType);
|
||||
//读取并设置 释放BUFFAni
|
||||
ReadAndSetAni("BuffAni", "buff motion", SlotType);
|
||||
|
||||
//读取并设置 AttackAni
|
||||
// ReadAndSetAttackAni();
|
||||
}
|
||||
|
||||
function InitAuroa() {
|
||||
//光环
|
||||
local Info = Parent.aurora;
|
||||
//如果有光环
|
||||
if (AuroraAni) {
|
||||
foreach(Ani in AuroraAni) {
|
||||
Removechild(Ani);
|
||||
}
|
||||
}
|
||||
AuroraAni = [];
|
||||
|
||||
foreach(Effect in Info.Aurora_effects) {
|
||||
local AniBuf = Animation(Effect.path);
|
||||
AuroraAni.append(AniBuf);
|
||||
Addchild(AniBuf);
|
||||
//front
|
||||
if (Effect.type == 1) {
|
||||
AniBuf.SetZOrder(100000);
|
||||
//遍历所有Ani类型并构造
|
||||
foreach(ChrAniObj, InfoSrc in SMap) {
|
||||
//从父对象 角色对象取得Info 判断其中有没有这个Ani标签 如果有 取得路径
|
||||
if (Parent.Info.rawin(InfoSrc)) InfoSrc = Parent.Info[InfoSrc];
|
||||
else continue;
|
||||
if (!SlotType) {
|
||||
this[ChrAniObj] = StructureAniMap(InfoSrc);
|
||||
} else {
|
||||
AniBuf.SetZOrder(-100000);
|
||||
RefreshAni(ChrAniObj, InfoSrc, SlotType);
|
||||
}
|
||||
}
|
||||
|
||||
//将默认时装类型存储起来 因为脱下时装的时候要恢复默认时装的设定
|
||||
if (!Default_Avatar) {
|
||||
Default_Avatar = {};
|
||||
foreach(EquiId in Parent.Info.default_avatar) {
|
||||
local EquBuffer = GameItem.Equipment(EquiId);
|
||||
Default_Avatar[EquBuffer.SlotType] <- EquBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//初始化名字
|
||||
function InitName() {
|
||||
//创建名字对象
|
||||
Name = FontAssetManager.GenerateNormal("", true, {
|
||||
color = sq_RGBA(209, 185, 148, 255),
|
||||
});
|
||||
Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].x, ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job].y);
|
||||
Name.SetZOrder(80000);
|
||||
Addchild(Name);
|
||||
//构造临时Ani
|
||||
function CreateTempAni(AniName) {
|
||||
local InfoSrc = SMap[AniName];
|
||||
//从父对象 角色对象取得Info 判断其中有没有这个Ani标签 如果有 取得路径
|
||||
if (Parent.Info.rawin(InfoSrc)) InfoSrc = Parent.Info[InfoSrc];
|
||||
else return;
|
||||
local Ani = Actor();
|
||||
foreach(Key, AniGroup in StructureAniMap(InfoSrc)) {
|
||||
//如果是皮肤Ani 则设置Ani的大小
|
||||
if (Key == "skin_avatar") Ani.SetSize(AniGroup[0].GetSize());
|
||||
//如果使用了武器装扮 不加入武器的Ani
|
||||
if (Key == "weapon" && UseWeaponAvatar) continue;
|
||||
foreach(AniObj in AniGroup) {
|
||||
//如果AniObj的ZOrder在隐藏图层中 则隐藏
|
||||
if (HideLayer.rawin(AniObj.GetZOrder())) {
|
||||
|
||||
} else {
|
||||
Ani.Addchild(AniObj);
|
||||
}
|
||||
}
|
||||
}
|
||||
return Ani;
|
||||
}
|
||||
|
||||
//设置名字
|
||||
function SetName(Name) {
|
||||
this.Name.SetText(Name);
|
||||
//处理隐藏图层
|
||||
function HandlingHideLayers() {
|
||||
//遍历全部时装计算隐藏图层
|
||||
HideLayer = {};
|
||||
UseWeaponAvatar = false;
|
||||
foreach(Type, NString in getconsttable().AvatarType) {
|
||||
local Equip = Parent[Type];
|
||||
if (Equip) {
|
||||
//如果装备有隐藏图层 则加入隐藏图层
|
||||
if (Equip.HideLayer) {
|
||||
foreach(layer in Equip.HideLayer) {
|
||||
HideLayer[layer] <- true;
|
||||
}
|
||||
}
|
||||
//如果有佩戴武器装扮
|
||||
if (Type == "weapon_avatar") {
|
||||
UseWeaponAvatar = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
//遍历全部Ani
|
||||
foreach(ChrAniObj, InfoSrc in SMap) {
|
||||
//取得Ani组
|
||||
if (this[ChrAniObj]) {
|
||||
foreach(Key, AniGroup in this[ChrAniObj]) {
|
||||
//如果使用了武器装扮 则隐藏武器Ani
|
||||
if (Key == "weapon" && UseWeaponAvatar) {
|
||||
foreach(AniObj in AniGroup) {
|
||||
AniObj.SetVisible(false);
|
||||
}
|
||||
} else {
|
||||
//遍历Ani组
|
||||
foreach(AniObj in AniGroup) {
|
||||
//如果AniObj的ZOrder在隐藏图层中 则隐藏
|
||||
if (HideLayer.rawin(AniObj.GetZOrder())) {
|
||||
AniObj.SetVisible(false);
|
||||
} else {
|
||||
AniObj.SetVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//设置Ani
|
||||
function SetAnimation(Ani) {
|
||||
|
|
@ -409,4 +323,13 @@ class Character_Animation extends Actor {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
//设置方向
|
||||
function SetDirection(D) {
|
||||
if (D == DIRECTION.RIGHT) {
|
||||
SetScale(fabs(GetScale().x), GetScale().y);
|
||||
} else if (D == DIRECTION.LEFT) {
|
||||
SetScale(-fabs(GetScale().x), GetScale().y);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
文件名:ChatBubble.nut
|
||||
路径:User/Asset/Character/ChatBubble.nut
|
||||
创建日期:2025-01-24 19:04
|
||||
文件用途:聊天气泡
|
||||
*/
|
||||
class Character_ChatBubble extends CL_CanvasObject {
|
||||
|
||||
RealWidth = null;
|
||||
RealHeight = null;
|
||||
|
||||
constructor(Msg) {
|
||||
base.constructor();
|
||||
Init(Msg);
|
||||
}
|
||||
|
||||
function Init(Msg) {
|
||||
//渲染文本
|
||||
local BoxWidth = 0;
|
||||
local Tag = {
|
||||
color = sq_RGBA(255, 255, 255, 250)
|
||||
};
|
||||
if (Msg.len() > 27) {
|
||||
Tag.wrap_width <- 114;
|
||||
BoxWidth = 130;
|
||||
}
|
||||
local Text = FontAssetManager.GenerateNormal(Msg, false, Tag);
|
||||
|
||||
//计算文本大小
|
||||
local TextSize = Text.GetSize();
|
||||
RealWidth = BoxWidth ? BoxWidth : TextSize.w + 18;
|
||||
RealHeight = TextSize.h + 18;
|
||||
//创建背景框 +18是 上下的空隙
|
||||
local Bg = Yosin_NineBoxStretch(RealWidth, RealHeight, "sprite/interface/messageballoon.img", 20);
|
||||
|
||||
//重设大小
|
||||
ResizeAndClear(TextSize.w + 20, TextSize.h + 40);
|
||||
SetFillBrush(sq_RGBA(105, 212, 238, 250));
|
||||
SetStrokeBrush(sq_RGBA(105, 212, 238, 250));
|
||||
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
//绘制背景
|
||||
DrawActor(Bg, 0, 0);
|
||||
//绘制文字
|
||||
DrawActor(Text, 9, 8);
|
||||
// DrawRect(9, 8, TextSize.w + 9, TextSize.h + 8)
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
function OnUpdate(Dt) {
|
||||
base.OnUpdate(Dt);
|
||||
if (ExistingTime >= 4000) {
|
||||
Parent.ChatObject = null;
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,8 @@ class _FontAssetManager_ {
|
|||
function InitFont() {
|
||||
//普通宋体小字
|
||||
// Font.PreLoad("新宋体");
|
||||
Font("宋体", 11.5).Register(0);
|
||||
Font("新宋体", 11.5).Register(0);
|
||||
Font("新宋体", 10).Register(1);
|
||||
}
|
||||
|
||||
constructor() {
|
||||
|
|
@ -24,6 +25,10 @@ class _FontAssetManager_ {
|
|||
|
||||
//生成普通宋体小字
|
||||
function GenerateNormal(text, stroke, style = {}) {
|
||||
//如果有设置换行宽度 则设置默认的自动换行模式
|
||||
if (!(style.rawin("word_wrapping")) && style.rawin("wrap_width")) {
|
||||
style.word_wrapping <- TextWordWrapping.WRAPPING_CHARACTER;
|
||||
}
|
||||
//登录按钮文本
|
||||
local TextActor = TextActor(0, style);
|
||||
TextActor.SetText(text);
|
||||
|
|
@ -31,4 +36,18 @@ class _FontAssetManager_ {
|
|||
TextActor.SetOutline();
|
||||
return TextActor;
|
||||
}
|
||||
|
||||
//生成普通宋体小字
|
||||
function GenerateMini(text, stroke, style = {}) {
|
||||
//如果有设置换行宽度 则设置默认的自动换行模式
|
||||
if (!(style.rawin("word_wrapping")) && style.rawin("wrap_width")) {
|
||||
style.word_wrapping <- TextWordWrapping.WRAPPING_CHARACTER;
|
||||
}
|
||||
//登录按钮文本
|
||||
local TextActor = TextActor(1, style);
|
||||
TextActor.SetText(text);
|
||||
if (stroke)
|
||||
TextActor.SetOutline();
|
||||
return TextActor;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
文件名:Attribute.nut
|
||||
路径:User/Asset/Item/Attribute.nut
|
||||
创建日期:2025-02-10 07:00
|
||||
文件用途:属性类
|
||||
*/
|
||||
class Attribute {
|
||||
//最大生命值
|
||||
HPMax = 0;
|
||||
//最大魔法值
|
||||
MPMax = 0;
|
||||
//生命值回复速度
|
||||
HPRegenSpeed = 0;
|
||||
//魔法值回复速度
|
||||
MPRegenSpeed = 0;
|
||||
//跳跃力
|
||||
JumpPower = 0;
|
||||
//硬直
|
||||
HitRecovery = 0;
|
||||
//命中率
|
||||
Stuck = 0;
|
||||
//闪避率
|
||||
StuckResistance = 0;
|
||||
|
||||
//力量
|
||||
PhysicalAttack = 0;
|
||||
//智力
|
||||
MagicalAttack = 0;
|
||||
//体力
|
||||
PhysicalDefense = 0;
|
||||
//精神
|
||||
MagicalDefense = 0;
|
||||
//所有属强
|
||||
AllElementalAttack = 0;
|
||||
//暗属强
|
||||
DarkAttack = 0;
|
||||
//光属强
|
||||
LightAttack = 0;
|
||||
//水属强
|
||||
WaterAttack = 0;
|
||||
//火属强
|
||||
FireAttack = 0;
|
||||
|
||||
//物理攻击力
|
||||
EquipmentPhysicalAttack = 0;
|
||||
//魔法攻击力
|
||||
EquipmentMagicalAttack = 0;
|
||||
//独立攻击力
|
||||
SeparateAttack = 0;
|
||||
//物理防御力
|
||||
EquipmentPhysicalDefense = 0;
|
||||
//魔法防御力
|
||||
EquipmentMagicalDefense = 0;
|
||||
|
||||
//攻击速度
|
||||
AttackSpeed = 0;
|
||||
//释放速度
|
||||
CastSpeed = 0;
|
||||
//移动速度
|
||||
MoveSpeed = 0;
|
||||
//跳跃速度
|
||||
JumpSpeed = 0;
|
||||
|
||||
//物理暴击率
|
||||
PhysicalCriticalHit = 0;
|
||||
//魔法暴击率
|
||||
MagicalCriticalHit = 0;
|
||||
|
||||
//暗属抗
|
||||
DarkResistance = 0;
|
||||
//光属抗
|
||||
LightResistance = 0;
|
||||
//水属抗
|
||||
WaterResistance = 0;
|
||||
//火属抗
|
||||
FireResistance = 0;
|
||||
|
||||
//属性攻击
|
||||
ElementalProperty = null;
|
||||
|
||||
constructor(Args) {
|
||||
ElementalProperty = [];
|
||||
|
||||
//使用装备构造
|
||||
if (typeof Args == "table") {
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
//普通属性
|
||||
if (Args.rawin(member)) {
|
||||
this[member] = Args[member];
|
||||
}
|
||||
} else {
|
||||
//属性攻击
|
||||
if (Args.rawin(member)) {
|
||||
switch (Args[member]) {
|
||||
case "[dark element]":
|
||||
this[member].push(0);
|
||||
break;
|
||||
case "[light element]":
|
||||
this[member].push(1);
|
||||
break;
|
||||
case "[water element]":
|
||||
this[member].push(2);
|
||||
break;
|
||||
case "[fire element]":
|
||||
this[member].push(3);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//使用角色构造
|
||||
else if (typeof Args == "Game_Character") {
|
||||
local Info = sq_DeepCopy(Args.Info.Attribute[Args.GrowJob]);
|
||||
Info.rawdelete("filepath");
|
||||
foreach(Key, Value in Info) {
|
||||
// print(Value);
|
||||
if (Key == "HPMax" || Key == "MPMax" || Key == "PhysicalAttack" || Key == "MagicalAttack" || Key == "PhysicalDefense" || Key == "MagicalDefense")
|
||||
this[Key] = Value * Args.Level;
|
||||
else {
|
||||
if (this.rawin(Key)) this[Key] = Value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function _typeof() {
|
||||
return "Attribute";
|
||||
}
|
||||
|
||||
|
||||
function _add(other) {
|
||||
if (typeof other != "Attribute") throw "属性运算参数错误";
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
this[member] += other[member];
|
||||
} else {
|
||||
foreach(EleType in other[member]) {
|
||||
local index = this["ElementalProperty"].find(EleType);
|
||||
if (!index) this["ElementalProperty"].push(EleType);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function _sub(other) {
|
||||
if (typeof other != "Attribute") throw "属性运算参数错误";
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
this[member] -= other[member];
|
||||
} else {
|
||||
foreach(EleType in other[member]) {
|
||||
local index = this["ElementalProperty"].find(EleType);
|
||||
if (index) this["ElementalProperty"].remove(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function _mul(other) {
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
this[member] *= other;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function _div(other) {
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
this[member] /= other;
|
||||
}
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function Show() {
|
||||
foreach(member, val in getconsttable().ATTRIBUTE) {
|
||||
if (member != "ElementalProperty") {
|
||||
print(getconsttable().ATTRIBUTE[member] + " : " + this[member]);
|
||||
} else {
|
||||
print(getconsttable().ATTRIBUTE[member] + " : ");
|
||||
print(this[member]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -4,8 +4,6 @@
|
|||
创建日期:2024-12-12 19:03
|
||||
文件用途:
|
||||
*/
|
||||
//装备信息标签类(信息类)
|
||||
if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null;
|
||||
//装备图标窗口
|
||||
class GameItem.EquipmentIcon extends CL_CanvasObject {
|
||||
|
||||
|
|
@ -28,7 +26,7 @@ class GameItem.EquipmentIcon extends CL_CanvasObject {
|
|||
}
|
||||
|
||||
//边框
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Equipment.Rarity]);
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + AssetManager.EtcConfig.ItemInfoTag.rarityframe_color_idx[Equipment.Rarity]);
|
||||
DrawSpriteFrame(IconFrame, 0, 0);
|
||||
}
|
||||
EndDraw();
|
||||
|
|
@ -77,7 +75,7 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
if (Equipment.SeparateLevel > 0) SeparateLevelName = "(" + Equipment.SeparateLevel + ")";
|
||||
if ((Equipment.Upgrade + Equipment.SeparateLevel) > 0) DrawName = UpgradeName + SeparateLevelName + " " + DrawName;
|
||||
local EquName = FontAssetManager.GenerateNormal(DrawName, false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.rarity_color[Equipment.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(EquName, 41, 7);
|
||||
}
|
||||
|
|
@ -103,8 +101,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
Canvas.DrawActor(PercentageGradeText, 6, 41);
|
||||
Canvas.DrawActor(PercentageText, 130, 41);
|
||||
//绘制稀有度名称
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Equipment.Rarity], false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity]
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.rarity_name_tag[Equipment.Rarity], false, {
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.rarity_color[Equipment.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
||||
|
||||
|
|
@ -122,13 +120,13 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||
local TradeType = Equipment.TradeType;
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.trade_type_text[TradeType], false, {
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.trade_type_color[TradeType]
|
||||
});
|
||||
Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
|
||||
|
||||
//绘制装备类型
|
||||
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], false, {
|
||||
local GroupNameText = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.item_group_name_table[Equipment.GroupName], false, {
|
||||
color = sq_RGBA(194, 161, 56, 255)
|
||||
});
|
||||
Canvas.DrawActor(GroupNameText, 210 - GroupNameText.GetSize().w - 6, 89);
|
||||
|
|
@ -187,6 +185,10 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
DrawAttack("EquipmentMagicalAttack", "魔法攻击力");
|
||||
//绘制独立攻击力
|
||||
DrawAttack("SeparateAttack", "独立攻击力");
|
||||
//绘制物理防御力
|
||||
DrawAttack("EquipmentPhysicalDefense", "物理防御力");
|
||||
//绘制魔法防御力
|
||||
DrawAttack("EquipmentMagicalDefense", "魔法防御力");
|
||||
//绘制四维
|
||||
DrawAttribute("PhysicalAttack", "力量");
|
||||
DrawAttribute("MagicalAttack", "智力");
|
||||
|
|
@ -221,8 +223,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
DrawElement("WaterAttack", "水属性强化");
|
||||
|
||||
//绘制属性攻击
|
||||
if (Equipment.ElementalProperty) {
|
||||
local Text = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.elemental_property_tag[Equipment.ElementalProperty], false, {
|
||||
if (Equipment.Attr.ElementalProperty.len() > 0) {
|
||||
local Text = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.elemental_property_tag[Equipment.Attr.ElementalProperty[0].tostring()], false, {
|
||||
color = sq_RGBA(215, 196, 147, 255)
|
||||
});
|
||||
Canvas.DrawActor(Text, 6, RealCanvasHeight);
|
||||
|
|
@ -250,8 +252,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制属强属抗
|
||||
function DrawElement(Type, TypeName) {
|
||||
if (Equipment[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment[Type] >= 0 ? "+" : "-") + Equipment[Type], false, {
|
||||
if (Equipment.Attr[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment.Attr[Type] >= 0 ? "+" : "-") + Equipment.Attr[Type], false, {
|
||||
color = sq_RGBA(215, 196, 147, 255)
|
||||
});
|
||||
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
||||
|
|
@ -261,8 +263,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制命中
|
||||
function DrawStuck(Type, TypeName) {
|
||||
if (Equipment[Type] != 0) {
|
||||
local Value = Equipment[Type];
|
||||
if (Equipment.Attr[Type] != 0) {
|
||||
local Value = Equipment.Attr[Type];
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Value >= 0 ? "+" : "") + Value + "%", false, {
|
||||
color = sq_RGBA(215, 196, 147, 255)
|
||||
});
|
||||
|
|
@ -273,8 +275,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制双爆
|
||||
function DrawCritical(Type, TypeName) {
|
||||
if (Equipment[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment[Type] >= 0 ? "+" : "-") + Equipment[Type] + "%", false, {
|
||||
if (Equipment.Attr[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Equipment.Attr[Type] >= 0 ? "+" : "-") + Equipment.Attr[Type] + "%", false, {
|
||||
color = sq_RGBA(215, 196, 147, 255)
|
||||
});
|
||||
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
||||
|
|
@ -284,8 +286,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制三速
|
||||
function DrawSpeed(Type, TypeName) {
|
||||
if (Equipment[Type] != 0) {
|
||||
local Value = (Equipment[Type].tofloat() * 0.1).tointeger();
|
||||
if (Equipment.Attr[Type] != 0) {
|
||||
local Value = (Equipment.Attr[Type].tofloat() * 0.1).tointeger();
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + (Value >= 0 ? "+" : "-") + Value + "%", false, {
|
||||
color = sq_RGBA(215, 196, 147, 255)
|
||||
});
|
||||
|
|
@ -296,8 +298,8 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制四维
|
||||
function DrawAttribute(Type, TypeName) {
|
||||
if (Equipment[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + Equipment[Type], false, {
|
||||
if (Equipment.Attr[Type] != 0) {
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + Equipment.Attr[Type], false, {
|
||||
color = sq_RGBA(134, 120, 79, 255)
|
||||
});
|
||||
Canvas.DrawActor(AttackText, 6, RealCanvasHeight);
|
||||
|
|
@ -307,18 +309,18 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
//绘制三攻
|
||||
function DrawAttack(Type, TypeName) {
|
||||
if (Equipment[Type] != null) {
|
||||
if (Equipment.Attr[Type]) {
|
||||
local RealValue;
|
||||
//数组为没有百分比计算过的原始数据
|
||||
if (typeof Equipment[Type] == "array") {
|
||||
local MaxValue = Equipment[Type][0];
|
||||
local MinValue = Equipment[Type][1];
|
||||
if (typeof Equipment.Attr[Type] == "array") {
|
||||
local MaxValue = Equipment.Attr[Type][0];
|
||||
local MinValue = Equipment.Attr[Type][1];
|
||||
local Rate = 1.0;
|
||||
RealValue = (MinValue + ((MaxValue - MinValue).tofloat() * Rate).tointeger());
|
||||
}
|
||||
//百分比计算过的数据
|
||||
else if (typeof Equipment[Type] == "integer" || typeof Equipment[Type] == "float") {
|
||||
RealValue = Equipment[Type];
|
||||
else if (typeof Equipment.Attr[Type] == "integer" || typeof Equipment.Attr[Type] == "float") {
|
||||
RealValue = Equipment.Attr[Type];
|
||||
}
|
||||
local AttackText = FontAssetManager.GenerateNormal(TypeName + " " + RealValue, false, {
|
||||
color = sq_RGBA(134, 120, 79, 255)
|
||||
|
|
@ -341,33 +343,20 @@ class GameItem.EquipmentInfo extends Yosin_Window {
|
|||
|
||||
// 根据数值获取对应的品级文字
|
||||
function GetPercentageText(num) {
|
||||
if (num< GameItem.EquipmentInfoTag.percentage_range_boundaries[0]) {
|
||||
return GameItem.EquipmentInfoTag.percentage_text[0];
|
||||
if (num< AssetManager.EtcConfig.ItemInfoTag.percentage_range_boundaries[0]) {
|
||||
return AssetManager.EtcConfig.ItemInfoTag.percentage_text[0];
|
||||
}
|
||||
for (local i = 0; i< GameItem.EquipmentInfoTag.percentage_range_boundaries.len(); i++) {
|
||||
if (num <= GameItem.EquipmentInfoTag.percentage_range_boundaries[i]) {
|
||||
return GameItem.EquipmentInfoTag.percentage_text[i + 1];
|
||||
for (local i = 0; i< AssetManager.EtcConfig.ItemInfoTag.percentage_range_boundaries.len(); i++) {
|
||||
if (num <= AssetManager.EtcConfig.ItemInfoTag.percentage_range_boundaries[i]) {
|
||||
return AssetManager.EtcConfig.ItemInfoTag.percentage_text[i + 1];
|
||||
}
|
||||
}
|
||||
return GameItem.EquipmentInfoTag.percentage_text.top();
|
||||
return AssetManager.EtcConfig.ItemInfoTag.percentage_text.top();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// Window.RemoveSelf();
|
||||
// }
|
||||
// TestStage();
|
||||
// }
|
||||
|
||||
|
||||
|
||||
class GameItem.Equipment extends GameItem.Item {
|
||||
//装备ID
|
||||
|
|
@ -426,68 +415,14 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
DirPath = null;
|
||||
//光环特效
|
||||
Aurora_effects = null;
|
||||
|
||||
//装备属性
|
||||
Property = null;
|
||||
|
||||
//力量
|
||||
PhysicalAttack = 0;
|
||||
//智力
|
||||
MagicalAttack = 0;
|
||||
//体力
|
||||
PhysicalDefense = 0;
|
||||
//精神
|
||||
MagicalDefense = 0;
|
||||
//所有属强
|
||||
AllElementalAttack = 0;
|
||||
//暗属强
|
||||
DarkAttack = 0;
|
||||
//光属强
|
||||
LightAttack = 0;
|
||||
//水属强
|
||||
WaterAttack = 0;
|
||||
//火属强
|
||||
FireAttack = 0;
|
||||
|
||||
//物理攻击力
|
||||
EquipmentPhysicalAttack = 0;
|
||||
//魔法攻击力
|
||||
EquipmentMagicalAttack = 0;
|
||||
//独立攻击力
|
||||
SeparateAttack = 0;
|
||||
//物理防御力
|
||||
EquipmentPhysicalDefense = 0;
|
||||
//魔法防御力
|
||||
EquipmentMagicalDefense = 0;
|
||||
|
||||
//攻击速度
|
||||
AttackSpeed = 0;
|
||||
//释放速度
|
||||
CastSpeed = 0;
|
||||
//移动速度
|
||||
MoveSpeed = 0;
|
||||
|
||||
//物理暴击率
|
||||
PhysicalCriticalHit = 0;
|
||||
//魔法暴击率
|
||||
MagicalCriticalHit = 0;
|
||||
//命中率
|
||||
Stuck = 0;
|
||||
|
||||
//暗属抗
|
||||
DarkResistance = 0;
|
||||
//光属抗
|
||||
LightResistance = 0;
|
||||
//水属抗
|
||||
WaterResistance = 0;
|
||||
//火属抗
|
||||
FireResistance = 0;
|
||||
|
||||
//属性攻击
|
||||
ElementalProperty = null;
|
||||
|
||||
Attr = null;
|
||||
//描述
|
||||
FlavorText = null;
|
||||
//隐藏图层
|
||||
HideLayer = null;
|
||||
//拓展Ani路径
|
||||
ExpandPath = null;
|
||||
|
||||
|
||||
function _typeof() {
|
||||
|
|
@ -528,36 +463,37 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
this.SeparateLevel = Info.EquipSeparate;
|
||||
//装备增幅属性
|
||||
this.EquipIncrease = Info.EquipIncrease;
|
||||
|
||||
//装备力量百分比
|
||||
this.PhysicalAttack *= (Info.EquipPowerPercentage.tofloat() / 100.0);
|
||||
this.Attr.PhysicalAttack *= (Info.EquipPowerPercentage.tofloat() / 100.0);
|
||||
//装备智力百分比
|
||||
this.MagicalAttack *= (Info.EquipIntellectPercentage.tofloat() / 100.0);
|
||||
this.Attr.MagicalAttack *= (Info.EquipIntellectPercentage.tofloat() / 100.0);
|
||||
//装备体力百分比
|
||||
this.PhysicalDefense *= (Info.EquipStaminaPercentage.tofloat() / 100.0);
|
||||
this.Attr.PhysicalDefense *= (Info.EquipStaminaPercentage.tofloat() / 100.0);
|
||||
//装备精神百分比
|
||||
this.MagicalDefense *= (Info.EquipSpiritPercentage.tofloat() / 100.0);
|
||||
this.Attr.MagicalDefense *= (Info.EquipSpiritPercentage.tofloat() / 100.0);
|
||||
|
||||
//装备物理攻击百分比
|
||||
this.EquipmentPhysicalAttack = this.EquipmentPhysicalAttack[0] + ((this.EquipmentPhysicalAttack[1] - this.EquipmentPhysicalAttack[0]) * (Info.EquipPhysicalAttackPercentage.tofloat() / 100.0));
|
||||
if (this.Attr.EquipmentPhysicalAttack) this.Attr.EquipmentPhysicalAttack = this.Attr.EquipmentPhysicalAttack[0] + ((this.Attr.EquipmentPhysicalAttack[1] - this.Attr.EquipmentPhysicalAttack[0]) * (Info.EquipPhysicalAttackPercentage.tofloat() / 100.0));
|
||||
//装备魔法攻击百分比
|
||||
this.EquipmentMagicalAttack = this.EquipmentMagicalAttack[0] + ((this.EquipmentMagicalAttack[1] - this.EquipmentMagicalAttack[0]) * (Info.EquipMagicAttackPercentage.tofloat() / 100.0));
|
||||
if (this.Attr.EquipmentMagicalAttack) this.Attr.EquipmentMagicalAttack = this.Attr.EquipmentMagicalAttack[0] + ((this.Attr.EquipmentMagicalAttack[1] - this.Attr.EquipmentMagicalAttack[0]) * (Info.EquipMagicAttackPercentage.tofloat() / 100.0));
|
||||
//装备独立攻击百分比
|
||||
this.SeparateAttack = this.SeparateAttack[0] + ((this.SeparateAttack[1] - this.SeparateAttack[0]) * (Info.EquipIndependentAttackPercentage.tofloat() / 100.0));
|
||||
if (this.Attr.SeparateAttack) this.Attr.SeparateAttack = this.Attr.SeparateAttack[0] + ((this.Attr.SeparateAttack[1] - this.Attr.SeparateAttack[0]) * (Info.EquipIndependentAttackPercentage.tofloat() / 100.0));
|
||||
//装备物理防御百分比
|
||||
this.EquipmentPhysicalDefense = this.EquipmentPhysicalDefense[0] + ((this.EquipmentPhysicalDefense[1] - this.EquipmentPhysicalDefense[0]) * (Info.EquipPhysicalDefensePercentage.tofloat() / 100.0));
|
||||
if (this.Attr.EquipmentPhysicalDefense) this.Attr.EquipmentPhysicalDefense = this.Attr.EquipmentPhysicalDefense[0] + ((this.Attr.EquipmentPhysicalDefense[1] - this.Attr.EquipmentPhysicalDefense[0]) * (Info.EquipPhysicalDefensePercentage.tofloat() / 100.0));
|
||||
//装备魔法防御百分比
|
||||
this.EquipmentMagicalDefense = this.EquipmentMagicalDefense[0] + ((this.EquipmentMagicalDefense[1] - this.EquipmentMagicalDefense[0]) * (Info.EquipMagicDefensePercentage.tofloat() / 100.0));
|
||||
if (this.Attr.EquipmentMagicalDefense) this.Attr.EquipmentMagicalDefense = this.Attr.EquipmentMagicalDefense[0] + ((this.Attr.EquipmentMagicalDefense[1] - this.Attr.EquipmentMagicalDefense[0]) * (Info.EquipMagicDefensePercentage.tofloat() / 100.0));
|
||||
|
||||
//装备全属强
|
||||
this.AllElementalAttack += Info.EquipAllElementalAttack;
|
||||
if (this.Attr.AllElementalAttack > 0) this.Attr.AllElementalAttack = (this.Attr.AllElementalAttack, 0.15, (Info.EquipAllElementalAttack.tofloat() / 100.0));
|
||||
//装备水属强
|
||||
this.WaterAttack += Info.EquipWaterAttack;
|
||||
if (this.Attr.WaterAttack > 0) this.Attr.WaterAttack = Math.getFinalValueByFloatRate(this.Attr.WaterAttack, 0.15, (Info.EquipWaterAttack.tofloat() / 100.0));
|
||||
//装备火属强
|
||||
this.FireAttack += Info.EquipFireAttack;
|
||||
if (this.Attr.FireAttack > 0) this.Attr.FireAttack = Math.getFinalValueByFloatRate(this.Attr.FireAttack, 0.15, (Info.EquipFireAttack.tofloat() / 100.0));
|
||||
//装备光属强
|
||||
this.LightAttack += Info.EquipLightAttack;
|
||||
if (this.Attr.LightAttack > 0) this.Attr.LightAttack = Math.getFinalValueByFloatRate(this.Attr.LightAttack, 0.15, (Info.EquipLightAttack.tofloat() / 100.0));
|
||||
//装备暗属强
|
||||
this.DarkAttack += Info.EquipDarkAttack;
|
||||
if (this.Attr.DarkAttack > 0) this.Attr.DarkAttack = Math.getFinalValueByFloatRate(this.Attr.DarkAttack, 0.15, (Info.EquipDarkAttack.tofloat() / 100.0));
|
||||
//装备品质
|
||||
this.Percentage = Info.EquipPercentage;
|
||||
//装备再封装次数
|
||||
|
|
@ -575,7 +511,7 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
//如果获取到对应的装备脚本信息
|
||||
if (EquInfo) {
|
||||
//名称
|
||||
if (EquInfo.rawin("name")) Name = EquInfo["name"];
|
||||
if (EquInfo.rawin("name")) Name = strip(EquInfo["name"]);
|
||||
//类型
|
||||
if (EquInfo.rawin("type")) GetRealEquipmentType(EquInfo["type"].path);
|
||||
//最低使用等级
|
||||
|
|
@ -605,48 +541,15 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
if (EquInfo.rawin("Ani")) Animation_Job = EquInfo["Ani"];
|
||||
if (EquInfo.rawin("DirPath")) DirPath = EquInfo["DirPath"];
|
||||
if (EquInfo.rawin("aurora_effects")) Aurora_effects = EquInfo["aurora_effects"];
|
||||
|
||||
//四维
|
||||
if (EquInfo.rawin("physical attack")) PhysicalAttack = EquInfo["physical attack"];
|
||||
if (EquInfo.rawin("magical attack")) MagicalAttack = EquInfo["magical attack"];
|
||||
if (EquInfo.rawin("physical defense")) PhysicalDefense = EquInfo["physical defense"];
|
||||
if (EquInfo.rawin("magical defense")) MagicalDefense = EquInfo["magical defense"];
|
||||
//属强
|
||||
if (EquInfo.rawin("all elemental attack")) AllElementalAttack = EquInfo["all elemental attack"];
|
||||
if (EquInfo.rawin("dark attack")) DarkAttack = EquInfo["dark attack"];
|
||||
if (EquInfo.rawin("light attack")) LightAttack = EquInfo["light attack"];
|
||||
if (EquInfo.rawin("water attack")) WaterAttack = EquInfo["water attack"];
|
||||
if (EquInfo.rawin("fire attack")) FireAttack = EquInfo["fire attack"];
|
||||
//三攻
|
||||
if (EquInfo.rawin("equipment physical attack")) EquipmentPhysicalAttack = EquInfo["equipment physical attack"];
|
||||
else EquipmentPhysicalAttack = [0, 0];
|
||||
if (EquInfo.rawin("equipment magical attack")) EquipmentMagicalAttack = EquInfo["equipment magical attack"];
|
||||
else EquipmentMagicalAttack = [0, 0];
|
||||
if (EquInfo.rawin("separate attack")) SeparateAttack = EquInfo["separate attack"];
|
||||
else SeparateAttack = [0, 0];
|
||||
//物理防御和魔法防御
|
||||
if (EquInfo.rawin("equipment physical defense")) EquipmentPhysicalDefense = EquInfo["equipment physical defense"];
|
||||
else EquipmentPhysicalDefense = [0, 0];
|
||||
if (EquInfo.rawin("equipment magical defense")) EquipmentMagicalDefense = EquInfo["equipment magical defense"];
|
||||
else EquipmentMagicalDefense = [0, 0];
|
||||
//三速
|
||||
if (EquInfo.rawin("attack speed")) AttackSpeed = EquInfo["attack speed"];
|
||||
if (EquInfo.rawin("cast speed")) CastSpeed = EquInfo["cast speed"];
|
||||
if (EquInfo.rawin("move speed")) MoveSpeed = EquInfo["move speed"];
|
||||
//双暴
|
||||
if (EquInfo.rawin("physical critical hit")) PhysicalCriticalHit = EquInfo["physical critical hit"];
|
||||
if (EquInfo.rawin("magical critical hit")) MagicalCriticalHit = EquInfo["magical critical hit"];
|
||||
//命中率
|
||||
if (EquInfo.rawin("stuck")) Stuck = -EquInfo["stuck"];
|
||||
//四属抗
|
||||
if (EquInfo.rawin("dark resistance")) DarkResistance = EquInfo["dark resistance"];
|
||||
if (EquInfo.rawin("light resistance")) LightResistance = EquInfo["light resistance"];
|
||||
if (EquInfo.rawin("water resistance")) WaterResistance = EquInfo["water resistance"];
|
||||
if (EquInfo.rawin("fire resistance")) FireResistance = EquInfo["fire resistance"];
|
||||
//属性攻击
|
||||
if (EquInfo.rawin("elemental property")) ElementalProperty = EquInfo["elemental property"];
|
||||
//描述
|
||||
if (EquInfo.rawin("flavor text")) FlavorText = EquInfo["flavor text"];
|
||||
//隐藏图层
|
||||
if (EquInfo.rawin("hide_layer")) HideLayer = EquInfo["hide_layer"];
|
||||
//拓展Ani路径
|
||||
if (EquInfo.rawin("expand_path")) ExpandPath = EquInfo["expand_path"];
|
||||
|
||||
//属性
|
||||
Attr = Attribute(EquInfo);
|
||||
} else error("没有对应的装备信息");
|
||||
}
|
||||
|
||||
|
|
@ -655,19 +558,27 @@ class GameItem.Equipment extends GameItem.Item {
|
|||
SlotType = AType;
|
||||
Type = BType;
|
||||
}
|
||||
|
||||
//获取真实装备类型
|
||||
function GetRealEquipmentType(EType) {
|
||||
if (EType == "skin avatar") SetRealEquipmentType("skin", "avatar");
|
||||
else if (EType == "weapon") SetRealEquipmentType("weapon", "equipment");
|
||||
else if (EType == "hat avatar") SetRealEquipmentType("hat", "avatar");
|
||||
else if (EType == "hair avatar") SetRealEquipmentType("hair", "avatar");
|
||||
else if (EType == "coat avatar") SetRealEquipmentType("coat", "avatar");
|
||||
else if (EType == "pants avatar") SetRealEquipmentType("pants", "avatar");
|
||||
else if (EType == "waist avatar") SetRealEquipmentType("waist", "avatar");
|
||||
else if (EType == "shoes avatar") SetRealEquipmentType("shoes", "avatar");
|
||||
else if (EType == "breast avatar") SetRealEquipmentType("breast", "avatar");
|
||||
else if (EType == "face avatar") SetRealEquipmentType("face", "avatar");
|
||||
else if (EType == "aurora avatar") SetRealEquipmentType("aurora", "aurora");
|
||||
//时装
|
||||
if (EType == "weapon avatar") SetRealEquipmentType("weapon_avatar", "avatar");
|
||||
else if (EType == "aurora avatar") SetRealEquipmentType("aurora_avatar", "avatar");
|
||||
else if (EType == "hair avatar") SetRealEquipmentType("hair_avatar", "avatar");
|
||||
else if (EType == "hat avatar") SetRealEquipmentType("hat_avatar", "avatar");
|
||||
else if (EType == "face avatar") SetRealEquipmentType("face_avatar", "avatar")
|
||||
else if (EType == "breast avatar") SetRealEquipmentType("breast_avatar", "avatar")
|
||||
else if (EType == "coat avatar") SetRealEquipmentType("coat_avatar", "avatar")
|
||||
else if (EType == "skin avatar") SetRealEquipmentType("skin_avatar", "avatar")
|
||||
else if (EType == "waist avatar") SetRealEquipmentType("waist_avatar", "avatar")
|
||||
else if (EType == "pants avatar") SetRealEquipmentType("pants_avatar", "avatar")
|
||||
else if (EType == "shoes avatar") SetRealEquipmentType("shoes_avatar", "avatar");
|
||||
|
||||
//称号和魔法石
|
||||
else if (EType == "title name") SetRealEquipmentType("title_name", "equipment");
|
||||
else if (EType == "magic stone") SetRealEquipmentType("magic_stone", "equipment");
|
||||
//普通装备
|
||||
else SetRealEquipmentType(EType, "equipment");
|
||||
}
|
||||
|
||||
//穿戴装备回调
|
||||
|
|
|
|||
|
|
@ -11,6 +11,9 @@ class GameItem.Item {
|
|||
return "Item";
|
||||
}
|
||||
|
||||
//在背包中的格子位置
|
||||
PosInKnapsack = -1;
|
||||
|
||||
|
||||
//获取信息窗口
|
||||
function GetInfoWindow() {
|
||||
|
|
@ -33,5 +36,102 @@ class GameItem.Item {
|
|||
error("GameItem::Icon:: 未知物品类型");
|
||||
}
|
||||
|
||||
//public::
|
||||
//通过ID构造物品
|
||||
function ConstructionItemById(Idx) {
|
||||
if (AssetManager.EquipmentList.rawin(Idx)) {
|
||||
return GameItem.Equipment(Idx);
|
||||
} else if (AssetManager.StackableList.rawin(Idx)) {
|
||||
return GameItem.Stackable(Idx);
|
||||
} else {
|
||||
error("没有这个道具编号: " + Idx);
|
||||
}
|
||||
}
|
||||
|
||||
//通过包构造物品
|
||||
function ConstructionItemByPacket(Pack) {
|
||||
local Ret = {};
|
||||
local Type = Pack.Get_Byte();
|
||||
Ret.Pos <- Pack.Get_Short();
|
||||
//装备类型
|
||||
if (Type == 1) {
|
||||
local EquInfo = {
|
||||
//装备ID
|
||||
EquipId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
EquipTradeType = Pack.Get_Byte(),
|
||||
//装备附魔编号
|
||||
EquipEnchant = Pack.Get_Int(),
|
||||
//装备强化等级或增幅等级
|
||||
EquipUpgrade = Pack.Get_Byte(),
|
||||
//装备锻造
|
||||
EquipSeparate = Pack.Get_Byte(),
|
||||
//装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||
EquipIncrease = Pack.Get_Byte(),
|
||||
//装备力量百分比
|
||||
EquipPowerPercentage = Pack.Get_Byte(),
|
||||
//装备智力百分比
|
||||
EquipIntellectPercentage = Pack.Get_Byte(),
|
||||
//装备体力百分比
|
||||
EquipStaminaPercentage = Pack.Get_Byte(),
|
||||
//装备精神百分比
|
||||
EquipSpiritPercentage = Pack.Get_Byte(),
|
||||
//装备物理攻击百分比
|
||||
EquipPhysicalAttackPercentage = Pack.Get_Byte(),
|
||||
//装备魔法攻击百分比
|
||||
EquipMagicAttackPercentage = Pack.Get_Byte(),
|
||||
//装备独立攻击百分比
|
||||
EquipIndependentAttackPercentage = Pack.Get_Byte(),
|
||||
//装备物理防御百分比
|
||||
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
|
||||
//装备魔法防御百分比
|
||||
EquipMagicDefensePercentage = Pack.Get_Byte(),
|
||||
//装备全属强
|
||||
EquipAllElementalAttack = Pack.Get_Byte(),
|
||||
//装备水属强
|
||||
EquipWaterAttack = Pack.Get_Byte(),
|
||||
//装备火属强
|
||||
EquipFireAttack = Pack.Get_Byte(),
|
||||
//装备光属强
|
||||
EquipLightAttack = Pack.Get_Byte(),
|
||||
//装备暗属强
|
||||
EquipDarkAttack = Pack.Get_Byte(),
|
||||
//装备品质
|
||||
EquipPercentage = Pack.Get_Byte(),
|
||||
//装备再封装次数
|
||||
EquipWrapCount = Pack.Get_Byte(),
|
||||
//装备是否封装
|
||||
EquipIsWrap = Pack.Get_Byte(),
|
||||
//耐久度
|
||||
EquipDurability = Pack.Get_Byte(),
|
||||
}
|
||||
Ret.Item <- GameItem.Equipment(EquInfo);
|
||||
}
|
||||
//消耗品类型
|
||||
else if (Type == 2 || Type == 3) {
|
||||
local ItemInfo = {
|
||||
//道具ID
|
||||
ItemId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
ItemTradeType = Pack.Get_Byte(),
|
||||
//道具数量
|
||||
ItemCount = Pack.Get_Int(),
|
||||
}
|
||||
Ret.Item <- GameItem.Stackable(ItemInfo);
|
||||
}
|
||||
//时装类型
|
||||
else if (Type == 4) {
|
||||
local ItemInfo = {
|
||||
//道具ID
|
||||
ItemId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
ItemTradeType = Pack.Get_Byte(),
|
||||
//道具数量
|
||||
ItemCount = Pack.Get_Int(),
|
||||
}
|
||||
Ret.Item <- GameItem.Equipment(ItemInfo.ItemId);
|
||||
}
|
||||
Ret.Item.PosInKnapsack = Ret.Pos;
|
||||
return Ret;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,325 @@
|
|||
/*
|
||||
文件名:Skill.nut
|
||||
路径:User/Asset/Item/Skill.nut
|
||||
创建日期:2025-02-17 17:05
|
||||
文件用途:技能文件
|
||||
*/
|
||||
//技能图标窗口
|
||||
class GameItem.SkillIcon extends CL_CanvasObject {
|
||||
|
||||
constructor(Skill, Flag) {
|
||||
base.constructor();
|
||||
ResizeAndClear(32, 32);
|
||||
BeginDraw();
|
||||
//构造图标 及图标边框
|
||||
if (Skill.Icon) {
|
||||
//图标
|
||||
local Icon = CL_SpriteFrameObject(Skill.Icon.path, Flag ? Skill.Icon.index : Skill.Icon.index + 1);
|
||||
DrawSpriteFrame(Icon, 0, 0);
|
||||
|
||||
//边框
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62);
|
||||
DrawSpriteFrame(IconFrame, 0, 0);
|
||||
}
|
||||
EndDraw();
|
||||
}
|
||||
}
|
||||
//技能信息窗口
|
||||
class GameItem.SkillInfo extends Yosin_Window {
|
||||
//技能
|
||||
Skill = null;
|
||||
//画布
|
||||
Canvas = null;
|
||||
//画布实际高度
|
||||
RealCanvasWidth = 257;
|
||||
RealCanvasHeight = 0;
|
||||
|
||||
constructor(gSkill) {
|
||||
this.Skill = gSkill.weakref();
|
||||
base.constructor(clock() + "SkillInfo" + Skill.Name, 0, 0, 0, 0, 0);
|
||||
|
||||
Init();
|
||||
|
||||
local background = Yosin_NineBoxStretch(RealCanvasWidth, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213);
|
||||
background.SetZOrder(-1);
|
||||
Addchild(background);
|
||||
}
|
||||
|
||||
function Init() {
|
||||
Canvas = CL_CanvasObject();
|
||||
Canvas.ResizeAndClear(RealCanvasWidth, 600);
|
||||
Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
||||
Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
||||
Canvas.BeginDraw();
|
||||
|
||||
local GradeColor = sq_RGBA(194, 161, 56, 250);
|
||||
if (Skill.Grade == 1) GradeColor = sq_RGBA(254, 181, 0, 250);
|
||||
else if (Skill.Grade == 2) GradeColor = sq_RGBA(255, 119, 1, 250);
|
||||
//绘制技能名字
|
||||
local SkillName = FontAssetManager.GenerateNormal(Skill.Name + " Lv " + (Skill.Level + Skill.AddLevel), true, {
|
||||
color = GradeColor
|
||||
});
|
||||
Canvas.DrawActor(SkillName, 5, 7);
|
||||
RealCanvasHeight += SkillName.GetSize().h;
|
||||
|
||||
//绘制技能名字2
|
||||
local SkillName2 = FontAssetManager.GenerateNormal(Skill.Name2, true, {
|
||||
color = GradeColor
|
||||
});
|
||||
Canvas.DrawActor(SkillName2, 5, 22);
|
||||
RealCanvasHeight += SkillName2.GetSize().h;
|
||||
|
||||
//绘制分割线
|
||||
AddSliceLine();
|
||||
|
||||
//绘制技能等级
|
||||
local SkillLevel = FontAssetManager.GenerateNormal("技能等级 : " + Skill.Level + Skill.AddLevel, true, {
|
||||
color = sq_RGBA(135, 119, 80, 250)
|
||||
});
|
||||
Canvas.DrawActor(SkillLevel, 5, RealCanvasHeight);
|
||||
|
||||
//消耗魔法值
|
||||
local CostText = typeof Skill.DungeonSkillData.consume_mp == "array" ? Skill.DungeonSkillData.consume_mp[0] : Skill.DungeonSkillData.consume_mp;
|
||||
local SkillCost = FontAssetManager.GenerateNormal("魔法值 : " + CostText, true, {
|
||||
color = sq_RGBA(82, 206, 254, 250)
|
||||
});
|
||||
Canvas.DrawActor(SkillCost, RealCanvasWidth - SkillCost.GetSize().w - 7, RealCanvasHeight);
|
||||
RealCanvasHeight += SkillLevel.GetSize().h - 2;
|
||||
|
||||
//释放时间
|
||||
local ReleaseTimeText = Skill.DungeonSkillData.rawin("casting_time") ? Skill.DungeonSkillData.casting_time.tofloat() / 1000.0 + " 秒" : "瞬发";
|
||||
local ReleaseTime = FontAssetManager.GenerateNormal("释放时间 : " + ReleaseTimeText, true, {
|
||||
color = sq_RGBA(133, 121, 78, 250)
|
||||
});
|
||||
Canvas.DrawActor(ReleaseTime, 5, RealCanvasHeight);
|
||||
local ConsumeYpos = RealCanvasHeight;
|
||||
RealCanvasHeight += ReleaseTime.GetSize().h - 2;
|
||||
|
||||
//操作指令
|
||||
local Command = FontAssetManager.GenerateNormal(Skill.CommandExplain, true, {
|
||||
color = sq_RGBA(133, 121, 78, 250)
|
||||
});
|
||||
Canvas.DrawActor(Command, 5, RealCanvasHeight);
|
||||
RealCanvasHeight += Command.GetSize().h - 2;
|
||||
|
||||
//技能消耗道具
|
||||
if (Skill.ConsumeItemId) {
|
||||
local ConsumeItemCountText = typeof Skill.ConsumeItemCount == "array" ? Skill.ConsumeItemCount[0] : Skill.ConsumeItemCount;
|
||||
local ConsumeItemCount = FontAssetManager.GenerateNormal("x" + ConsumeItemCountText, true, {
|
||||
color = sq_RGBA(133, 121, 78, 250)
|
||||
});
|
||||
local XposOffset = RealCanvasWidth - ConsumeItemCount.GetSize().w - 6;
|
||||
Canvas.DrawActor(ConsumeItemCount, XposOffset, ConsumeYpos + 16);
|
||||
|
||||
local ConsumeItemIcon = GameItem.Stackable(Skill.ConsumeItemId).GetIconSprite();
|
||||
Canvas.DrawSprite(ConsumeItemIcon, XposOffset - ConsumeItemIcon.GetSize().w, ConsumeYpos + 6);
|
||||
}
|
||||
|
||||
//冷却时间
|
||||
local CoolDownText = Skill.DungeonSkillData.rawin("cooltime") ? (typeof Skill.DungeonSkillData.cooltime == "array" ? Skill.DungeonSkillData.cooltime[0].tofloat() / 1000.0 : Skill.DungeonSkillData.cooltime) + " 秒" : "无";
|
||||
local CoolDown = FontAssetManager.GenerateNormal("冷却时间 : " + CoolDownText, true, {
|
||||
color = sq_RGBA(103, 214, 236, 250)
|
||||
});
|
||||
Canvas.DrawActor(CoolDown, 5, RealCanvasHeight);
|
||||
RealCanvasHeight += CoolDown.GetSize().h - 2;
|
||||
|
||||
//绘制分割线
|
||||
AddSliceLine();
|
||||
|
||||
//技能属性
|
||||
if (Skill.Property) {
|
||||
local SkillPropertyArrCount = Skill.Property.data.len() / 3;
|
||||
//这里直接组装调用格式化的参数
|
||||
local SkillPropertyTextCallList = [this, Skill.Property.explain];
|
||||
for (local i = 0; i< SkillPropertyArrCount; i++) {
|
||||
local ReadType = Skill.Property.data[i * 3];
|
||||
if (ReadType< 0) {
|
||||
//固定伤害
|
||||
if (ReadType == -2) {
|
||||
SkillPropertyTextCallList.push(Skill.GetLevelData(Skill.Property.data[i * 3 + 1]) * (ClientCharacter ? ClientCharacter.Attr.SeparateAttack : 1) * (Skill.Property.data[i * 3 + 2]));
|
||||
}
|
||||
//百分比伤害
|
||||
else {
|
||||
SkillPropertyTextCallList.push(Skill.GetLevelData(Skill.Property.data[i * 3 + 1]) * (Skill.Property.data[i * 3 + 2]));
|
||||
}
|
||||
} else {
|
||||
//静态数据
|
||||
SkillPropertyTextCallList.push(Skill.GetStaticData(Skill.Property.data[i * 3 + 1]) * (Skill.Property.data[i * 3 + 2]));
|
||||
}
|
||||
}
|
||||
local SkillProperty = FontAssetManager.GenerateNormal(format.acall(SkillPropertyTextCallList) true, {
|
||||
color = sq_RGBA(133, 121, 78, 250)
|
||||
});
|
||||
Canvas.DrawActor(SkillProperty, 5, RealCanvasHeight);
|
||||
RealCanvasHeight += SkillProperty.GetSize().h - 2;
|
||||
|
||||
//绘制分割线
|
||||
AddSliceLine();
|
||||
|
||||
//描述
|
||||
local SkillDescription = FontAssetManager.GenerateNormal(Skill.Explain, true, {
|
||||
color = sq_RGBA(133, 121, 78, 250),
|
||||
wrap_width = RealCanvasWidth - 8,
|
||||
});
|
||||
Canvas.DrawActor(SkillDescription, 5, RealCanvasHeight);
|
||||
RealCanvasHeight += SkillDescription.GetSize().h - 2;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Canvas.EndDraw();
|
||||
Addchild(Canvas);
|
||||
}
|
||||
|
||||
//增加分割行
|
||||
function AddSliceLine() {
|
||||
RealCanvasHeight += 9;
|
||||
Canvas.DrawLine(3, RealCanvasHeight, RealCanvasWidth - 4, RealCanvasHeight);
|
||||
RealCanvasHeight += 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class GameItem.Skill {
|
||||
//技能ID
|
||||
Idx = -1;
|
||||
//技能名称
|
||||
Name = "无名称";
|
||||
//技能名称2
|
||||
Name2 = "无名称";
|
||||
//最低学习等级
|
||||
RequiredLevel = 1;
|
||||
//学习等级间隔
|
||||
RequiredLevelRange = 1;
|
||||
//技能品阶
|
||||
Grade = 0;
|
||||
//技能类型
|
||||
Type = 0;
|
||||
//最大等级
|
||||
MaxLevel = 1;
|
||||
//图标
|
||||
Icon = null;
|
||||
//技能可学习职业
|
||||
FitnessGrowType = null;
|
||||
//简易技能描述
|
||||
BasicExplain = null;
|
||||
//技能描述
|
||||
Explain = null;
|
||||
//地下城技能数据
|
||||
DungeonSkillData = null;
|
||||
//操作指令描述
|
||||
CommandExplain = null;
|
||||
//操作指令
|
||||
Command = null;
|
||||
//当前等级
|
||||
Level = 1;
|
||||
//加成等级
|
||||
AddLevel = 0;
|
||||
//技能消耗道具
|
||||
ConsumeItemId = null;
|
||||
ConsumeItemCount = null;
|
||||
//技能属性
|
||||
Property = null;
|
||||
|
||||
|
||||
|
||||
function _typeof() {
|
||||
return "Skill";
|
||||
}
|
||||
|
||||
constructor(...) {
|
||||
DungeonSkillData = {};
|
||||
//直接裸构造
|
||||
if (vargv.len() == 0) {
|
||||
|
||||
}
|
||||
//通过参数构造
|
||||
else if (vargv.len() == 2) {
|
||||
local SkillInfo;
|
||||
//通过ID构造
|
||||
if (typeof vargv[0] == "integer") {
|
||||
SkillInfo = AssetManager.GetSkill(vargv[0], vargv[1]);
|
||||
Idx = vargv[1];
|
||||
ConstructSkillFromScript(SkillInfo);
|
||||
}
|
||||
//通过Table来构造
|
||||
else if (typeof vargv[0] == "table") {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//通过脚本构造
|
||||
function ConstructSkillFromScript(SkillInfo) {
|
||||
//如果获取到对应的技能脚本信息
|
||||
if (SkillInfo) {
|
||||
//名称
|
||||
if (SkillInfo.rawin("name")) Name = strip(SkillInfo["name"]);
|
||||
//名称2
|
||||
if (SkillInfo.rawin("name2")) Name2 = strip(SkillInfo["name2"]);
|
||||
//最低学习等级
|
||||
if (SkillInfo.rawin("required level")) RequiredLevel = SkillInfo["required level"];
|
||||
//技能学习间隔
|
||||
if (SkillInfo.rawin("required level range")) RequiredLevelRange = SkillInfo["required level range"];
|
||||
//技能品阶
|
||||
if (SkillInfo.rawin("skill fitness second growtype")) Grade = SkillInfo["skill fitness second growtype"];
|
||||
//技能类型
|
||||
if (SkillInfo.rawin("type")) Type = SkillInfo["type"];
|
||||
//最大等级
|
||||
if (SkillInfo.rawin("maximum level")) MaxLevel = SkillInfo["maximum level"];
|
||||
//图标
|
||||
if (SkillInfo.rawin("icon")) Icon = SkillInfo["icon"];
|
||||
//技能可学习职业
|
||||
if (SkillInfo.rawin("skill_fitness_growtype")) FitnessGrowType = SkillInfo["skill_fitness_growtype"];
|
||||
//简易技能描述
|
||||
if (SkillInfo.rawin("basic explain")) BasicExplain = SkillInfo["basic explain"];
|
||||
//技能描述
|
||||
if (SkillInfo.rawin("explain")) Explain = SkillInfo["explain"];
|
||||
//地下城技能数据
|
||||
if (SkillInfo.rawin("dungeon_data")) DungeonSkillData = SkillInfo["dungeon_data"];
|
||||
//操作指令描述
|
||||
if (SkillInfo.rawin("command key explain")) CommandExplain = SkillInfo["command key explain"];
|
||||
//操作指令
|
||||
if (SkillInfo.rawin("command")) Command = SkillInfo["command"];
|
||||
//技能消耗道具
|
||||
if (SkillInfo.rawin("consume_item")) {
|
||||
ConsumeItemId = SkillInfo["consume_item"][0];
|
||||
ConsumeItemCount = [SkillInfo["consume_item"][1], SkillInfo["consume_item"][2]]
|
||||
}
|
||||
//技能属性
|
||||
if (SkillInfo.rawin("level_property")) Property = SkillInfo["level_property"];
|
||||
} else error("没有对应的技能信息");
|
||||
}
|
||||
|
||||
|
||||
//获取对应等级的动态数据
|
||||
function GetLevelData(Index, gLevel = -1) {
|
||||
if (gLevel == -1) gLevel = this.Level - 1;
|
||||
if (DungeonSkillData.rawin("level_info")) {
|
||||
if (DungeonSkillData.level_info.len() > gLevel) {
|
||||
return DungeonSkillData["level_info"][gLevel][Index];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//获取技能的静态数据
|
||||
function GetStaticData(Index) {
|
||||
if (DungeonSkillData.rawin("static_data")) {
|
||||
if (DungeonSkillData.static_data.len() > Index) {
|
||||
return DungeonSkillData["static_data"][Index];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//获取技能图标
|
||||
function GetIconSprite(Flag = true) {
|
||||
return GameItem.SkillIcon(this, Flag);
|
||||
}
|
||||
|
||||
//获取信息窗口
|
||||
function GetInfoWindow() {
|
||||
return GameItem.SkillInfo(this);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ class GameItem.StackableIcon extends CL_CanvasObject {
|
|||
DrawSpriteFrame(Icon, 0, 0);
|
||||
|
||||
//边框
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Stackable.Rarity]);
|
||||
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + AssetManager.EtcConfig.ItemInfoTag.rarityframe_color_idx[Stackable.Rarity]);
|
||||
DrawSpriteFrame(IconFrame, 0, 0);
|
||||
|
||||
//数量
|
||||
|
|
@ -68,7 +68,7 @@ class GameItem.StackableInfo extends Yosin_Window {
|
|||
if (Stackable.Name.len() > 0) {
|
||||
local DrawName = Stackable.Name;
|
||||
local EquName = FontAssetManager.GenerateNormal(DrawName, false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Stackable.Rarity]
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.rarity_color[Stackable.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(EquName, 41, 7);
|
||||
}
|
||||
|
|
@ -78,14 +78,14 @@ class GameItem.StackableInfo extends Yosin_Window {
|
|||
|
||||
|
||||
//绘制稀有度名称
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Stackable.Rarity], false, {
|
||||
color = GameItem.EquipmentInfoTag.rarity_color[Stackable.Rarity]
|
||||
local RarityTagName = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.rarity_name_tag[Stackable.Rarity], false, {
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.rarity_color[Stackable.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41);
|
||||
|
||||
//绘制类型
|
||||
local RealGroupName = Stackable.GroupName ? Stackable.GroupName : "cube stuff";
|
||||
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[RealGroupName], false, {
|
||||
local GroupNameText = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.item_group_name_table[RealGroupName], false, {
|
||||
color = sq_RGBA(194, 161, 56, 255)
|
||||
});
|
||||
Canvas.DrawActor(GroupNameText, 6, 41);
|
||||
|
|
@ -97,8 +97,8 @@ class GameItem.StackableInfo extends Yosin_Window {
|
|||
|
||||
//绘制交易类型 如果有主体属性读取 否则一律为封装
|
||||
local TradeType = Stackable.TradeType;
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, {
|
||||
color = GameItem.EquipmentInfoTag.trade_type_color[TradeType]
|
||||
local TradeTypeText = FontAssetManager.GenerateNormal(AssetManager.EtcConfig.ItemInfoTag.trade_type_text[TradeType], false, {
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.trade_type_color[TradeType]
|
||||
});
|
||||
Canvas.DrawActor(TradeTypeText, 6, 60);
|
||||
|
||||
|
|
@ -213,7 +213,7 @@ class GameItem.Stackable extends GameItem.Item {
|
|||
//如果获取到对应的消耗品脚本信息
|
||||
if (StkInfo) {
|
||||
//名称
|
||||
if (StkInfo.rawin("name")) Name = StkInfo["name"];
|
||||
if (StkInfo.rawin("name")) Name = strip(StkInfo["name"]);
|
||||
//类型
|
||||
// if (StkInfo.rawin("type")) GetRealStackableType(StkInfo["type"].path);
|
||||
//最低使用等级
|
||||
|
|
@ -249,16 +249,3 @@ class GameItem.Stackable extends GameItem.Item {
|
|||
TradeType = Info.ItemTradeType;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!getroottable().rawin("chongzaiflag")) {
|
||||
getroottable()["chongzaiflag"] <- true;
|
||||
} else {
|
||||
//遍历窗口队列 如果可见则调用Show
|
||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
local Window = _SYS_WINDOW_LIST_[i];
|
||||
Window.Visible = false;
|
||||
Window.RemoveSelf();
|
||||
}
|
||||
TestStage();
|
||||
}
|
||||
|
|
@ -28,6 +28,20 @@ class _GameController_ extends _Input_ {
|
|||
foreach(Key, Value in getconsttable().CONTROLLER) {
|
||||
this.GameKeyCode.rawset(Key, Value);
|
||||
}
|
||||
|
||||
//注册Esc按钮对所有游戏窗口的操作
|
||||
RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_MENU_SYSTEM__CLOSE_ALL_WINDOW, function(Flag) {
|
||||
//按下的时候
|
||||
if (Flag == 1) {
|
||||
//遍历窗口队列 如果可见则调用Show
|
||||
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
local Window = _SYS_WINDOW_LIST_[i];
|
||||
if (typeof Window == "Game_Window") {
|
||||
Window.OnEsc();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//系统对游戏的输入
|
||||
function SystemInput(Code, Type) {
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class GameObject.ActiveObject extends GameObject.BaseClass {
|
|||
Layer = null;
|
||||
//状态机
|
||||
StateMachine = null;
|
||||
//属性包
|
||||
Attr = null;
|
||||
//状态信息包
|
||||
StateVar = null;
|
||||
//受击框
|
||||
|
|
@ -64,6 +66,12 @@ class GameObject.ActiveObject extends GameObject.BaseClass {
|
|||
StateVar = {};
|
||||
}
|
||||
|
||||
//初始化属性包
|
||||
function InitAttr() {
|
||||
//属性包初始化
|
||||
Attr = Attribute(this);
|
||||
}
|
||||
|
||||
//设置Ani
|
||||
function SetAnimation(Ani) {
|
||||
//如果已经有Ani了
|
||||
|
|
|
|||
|
|
@ -6,50 +6,88 @@
|
|||
*/
|
||||
class GameObject.Character extends GameObject.ActiveObject {
|
||||
|
||||
hair = null; //头部
|
||||
hat = null; //帽子
|
||||
face = null; //脸部
|
||||
breast = null; //胸部
|
||||
//时装
|
||||
weapon_avatar = null; //武器装扮
|
||||
aurora_avatar = null; //光环装扮
|
||||
hair_avatar = null; //头部装扮
|
||||
hat_avatar = null; //帽子装扮
|
||||
face_avatar = null; //脸部装扮
|
||||
breast_avatar = null; //胸部装扮
|
||||
coat_avatar = null; //上衣装扮
|
||||
skin_avatar = null; //皮肤装扮
|
||||
waist_avatar = null; //腰部装扮
|
||||
pants_avatar = null; //下装装扮
|
||||
shoes_avatar = null; //鞋子装扮
|
||||
|
||||
//装备
|
||||
shoulder = null; //护肩
|
||||
coat = null; //上衣
|
||||
skin = null; //皮肤
|
||||
waist = null; //腰部
|
||||
pants = null; //下装
|
||||
waist = null; //腰部
|
||||
shoes = null; //鞋子
|
||||
weapon = null; //武器
|
||||
aurora = null; //光环
|
||||
wrist = null; //手镯
|
||||
amulet = null; //项链
|
||||
ring = null; //戒指
|
||||
title_name = null; //称号
|
||||
support = null; //辅助装备
|
||||
magic_stone = null; //魔法石
|
||||
earring = null; //耳环
|
||||
|
||||
|
||||
//装备
|
||||
Equip = null;
|
||||
|
||||
//动画对象管理器
|
||||
AnimationManager = null;
|
||||
//附加项管理器
|
||||
AdditionalItemsManager = null;
|
||||
|
||||
//传送阵Flag
|
||||
TransmitFlag = false;
|
||||
|
||||
//属性对象
|
||||
Attribute = null;
|
||||
|
||||
//名字
|
||||
Name = "无名字";
|
||||
|
||||
//职业编号
|
||||
Job = 0;
|
||||
//转职职业
|
||||
GrowJob = 0;
|
||||
//cid
|
||||
Cid = -1;
|
||||
//等级
|
||||
Level = 60;
|
||||
//技能点
|
||||
SkillPoint = 0;
|
||||
//经验值
|
||||
Exp = 0;
|
||||
//疲劳值
|
||||
Fatigue = 0;
|
||||
|
||||
//控制器
|
||||
Controller = null;
|
||||
|
||||
|
||||
//当前生命值
|
||||
HP = 0;
|
||||
//当前魔法值
|
||||
MP = 0;
|
||||
|
||||
function _typeof() {
|
||||
return "character";
|
||||
return "Game_Character";
|
||||
}
|
||||
|
||||
|
||||
function Init(Idx) {
|
||||
//初始化装备
|
||||
Equip = {};
|
||||
//初始化动画组
|
||||
CurrentAni = [];
|
||||
//设置职业编号
|
||||
this.Job = Idx;
|
||||
//获取角色职业信息
|
||||
Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
||||
// Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
||||
Info = AssetManager.CharacterInfoList[Idx];
|
||||
base.Init(Info);
|
||||
|
||||
//构造角色动画对象
|
||||
|
|
@ -57,12 +95,16 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
Addchild(AnimationManager);
|
||||
AnimationManager.Init();
|
||||
|
||||
//构造附加项
|
||||
AdditionalItemsManager = Character_AdditionalItems();
|
||||
Addchild(AdditionalItemsManager);
|
||||
AdditionalItemsManager.Init();
|
||||
|
||||
|
||||
foreach(EquId in Info.default_avatar) {
|
||||
local EquObj = GameItem.Equipment(EquId);
|
||||
ChangeEquipment(EquObj);
|
||||
}
|
||||
//构造属性对象
|
||||
// Attribute = AttributeClass();
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -101,35 +143,84 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
}
|
||||
}
|
||||
|
||||
// function OnUpdate(dt) {
|
||||
// //原始逻辑
|
||||
// base.OnUpdate(dt);
|
||||
// }
|
||||
|
||||
//构造临时Ani
|
||||
function CreateTempAni(AniName) {
|
||||
//如果存在动画管理器则设置
|
||||
if (AnimationManager) return AnimationManager.CreateTempAni(AniName);
|
||||
}
|
||||
|
||||
//override
|
||||
//设置Ani
|
||||
function SetAnimation(Ani) {
|
||||
//如果存在动画管理器则设置
|
||||
if (AnimationManager) AnimationManager.SetAnimation(Ani);
|
||||
}
|
||||
|
||||
//切换装备
|
||||
function ChangeEquipment(Equ) {
|
||||
//读取全身装备的角色真实属性
|
||||
function ReadFullEquipAttr() {
|
||||
foreach(Index, EquipObj in Equip) {
|
||||
this.Attr += EquipObj.Attr;
|
||||
}
|
||||
//城镇里给安排满血
|
||||
if (typeof Parent == "townmap") {
|
||||
this.HP = this.Attr.HPMax;
|
||||
this.MP = this.Attr.MPMax;
|
||||
}
|
||||
}
|
||||
|
||||
//脱下装备
|
||||
function UnWearEquipment(Equ) {
|
||||
//脱下装备 如果原来的装备槽位置是空的 这里将会是null 不处理后续逻辑
|
||||
if (!Equ) return;
|
||||
//如果当前装备槽已经有装备则移除
|
||||
if (this[Equ.SlotType]) {
|
||||
//先保存一下原装备的槽类型
|
||||
local ST = Equ.SlotType;
|
||||
this[Equ.SlotType].OnWearEnd();
|
||||
this[Equ.SlotType] = null;
|
||||
//这里做判断 如果槽位类型模型有模型的话 要替换成默认的
|
||||
if (AnimationManager.Default_Avatar.rawin(ST)) {
|
||||
this[ST] = AnimationManager.Default_Avatar[ST];
|
||||
}
|
||||
}
|
||||
|
||||
//如果是武器或者时装则同步动画
|
||||
if (Equ.SlotType == "weapon" || Equ.Type == "avatar") {
|
||||
//变更时装
|
||||
AnimationManager.Init(Equ.SlotType);
|
||||
//处理时装的隐藏图层
|
||||
AnimationManager.HandlingHideLayers();
|
||||
} //光环同步光环动画
|
||||
else if (Equ.Type == "aurora") {
|
||||
AdditionalItemsManager.InitAuroa();
|
||||
}
|
||||
}
|
||||
|
||||
//穿戴装备
|
||||
function WearEquipment(Equ) {
|
||||
//将装备对象赋值给对应装备槽
|
||||
this[Equ.SlotType] = Equ;
|
||||
this[Equ.SlotType].OnWearStart();
|
||||
|
||||
//如果是武器或者时装则同步动画
|
||||
if (Equ.SlotType == "weapon" || Equ.Type == "avatar") {
|
||||
//变更时装
|
||||
AnimationManager.Init(Equ.SlotType);
|
||||
} else if (Equ.Type == "aurora") {
|
||||
AnimationManager.InitAuroa();
|
||||
//处理时装的隐藏图层
|
||||
AnimationManager.HandlingHideLayers();
|
||||
}
|
||||
//光环同步光环动画
|
||||
else if (Equ.Type == "aurora") {
|
||||
AdditionalItemsManager.InitAuroa();
|
||||
}
|
||||
}
|
||||
|
||||
//切换装备
|
||||
function ChangeEquipment(Equ) {
|
||||
//如果当前装备槽已经有装备则移除
|
||||
UnWearEquipment(Equ);
|
||||
//将装备对象赋值给对应装备槽
|
||||
WearEquipment(Equ);
|
||||
}
|
||||
//切换装备列表
|
||||
function ChangeEquipmentList(EquList) {
|
||||
|
|
@ -141,10 +232,15 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
//设置名字
|
||||
function SetName(Name) {
|
||||
this.Name = Name;
|
||||
AnimationManager.SetName(Name);
|
||||
AdditionalItemsManager.SetName(Name);
|
||||
base.SetName(Name);
|
||||
}
|
||||
|
||||
//设置聊天气泡
|
||||
function SetChatBubble(Chat) {
|
||||
AdditionalItemsManager.SetChatBubble(Chat);
|
||||
}
|
||||
|
||||
//是否为客户端玩家
|
||||
function IsClientPlayer() {
|
||||
if (ClientCharacter && this.Cid == ClientCharacter.Cid)
|
||||
|
|
@ -152,6 +248,14 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
return false;
|
||||
}
|
||||
|
||||
//获取经验值
|
||||
function GetExp() {
|
||||
return {
|
||||
current = this.Exp,
|
||||
max = AssetManager.CharacterExptable[this.Level]
|
||||
};
|
||||
}
|
||||
|
||||
//移动速度
|
||||
Move_Speed = 500;
|
||||
//移动Flag
|
||||
|
|
@ -214,8 +318,6 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//更新
|
||||
function OnUpdate(Dt) {
|
||||
base.OnUpdate(Dt);
|
||||
|
|
@ -224,6 +326,25 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
//移动逻辑更新
|
||||
MoveLogic(Dt);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
//ovverride ::
|
||||
//设置方向
|
||||
function SetDirection(D) {
|
||||
base.SetDirection(D);
|
||||
AnimationManager.SetDirection(D);
|
||||
|
||||
// //这里要改变名字和聊天框的朝向 免得反向
|
||||
// if (D) {
|
||||
// if (AnimationManager.Name) AnimationManager.Name.SetScale(1, 1);
|
||||
// if (AnimationManager.ChatBubble) AnimationManager.ChatBubble.SetScale(1, 1);
|
||||
// } else {
|
||||
// if (AnimationManager.Name) AnimationManager.Name.SetScale(-1, 1);
|
||||
// if (AnimationManager.ChatBubble) AnimationManager.ChatBubble.SetScale(-1, 1);
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
//通过职业和装备列表来构造一个角色
|
||||
|
|
@ -251,7 +372,7 @@ GameObject.GetCharacterByCid <- function(cid) {
|
|||
//遍历所有角色
|
||||
foreach(obj in GlobalTownManager.CurrentMap.PlayerList) {
|
||||
//角色对象
|
||||
if (typeof obj == "character" && obj.Cid == cid) {
|
||||
if (typeof obj == "Game_Character" && obj.Cid == cid) {
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ class GameObject.AICharacter extends GameObject.Character {
|
|||
//根据职业构造基础角色 注意这一步会直接重新赋值Info
|
||||
base.Init(Job);
|
||||
|
||||
//加载脚本属性
|
||||
Attribute.Init(ScriptInfo.Attributes, this);
|
||||
}
|
||||
|
||||
//重载装备
|
||||
|
|
@ -65,8 +63,6 @@ class GameObject.AICharacter extends GameObject.Character {
|
|||
//如果有APC的Proc脚本则调用
|
||||
if (getroottable().AiCharacterObjectFunction.rawin("AiCharacterObject_Proc_" + Id))
|
||||
getroottable().AiCharacterObjectFunction["AiCharacterObject_Proc_" + Id](this, dt);
|
||||
//属性更新
|
||||
if (Attribute) Attribute.Proc(this, dt);
|
||||
|
||||
base.OnUpdate(dt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,9 +10,6 @@ class GameObject.Monster extends GameObject.ActiveObject {
|
|||
//怪物Id
|
||||
Id = null;
|
||||
|
||||
//属性表
|
||||
Attribute = null;
|
||||
|
||||
|
||||
function Init(Idx) {
|
||||
Id = Idx;
|
||||
|
|
@ -20,11 +17,6 @@ class GameObject.Monster extends GameObject.ActiveObject {
|
|||
|
||||
base.Init(Info);
|
||||
|
||||
//构造属性对象
|
||||
Attribute = AttributeClass();
|
||||
//加载脚本属性
|
||||
Attribute.Init(Info.Attributes, this);
|
||||
|
||||
//如果存在Atk 初始化所有Atk
|
||||
if ("attackinfo" in Info) {
|
||||
Attackinfo = [];
|
||||
|
|
@ -52,8 +44,6 @@ class GameObject.Monster extends GameObject.ActiveObject {
|
|||
function OnUpdate(dt) {
|
||||
//调用怪物Proc状态
|
||||
getroottable().MonsterObjectFunction["MonsterObject_Proc_" + Id](this, dt);
|
||||
//属性更新
|
||||
if (Attribute) Attribute.Proc(this, dt);
|
||||
//原始逻辑
|
||||
base.OnUpdate(dt);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,6 +23,8 @@ class GameObject.NPC extends GameObject.BaseClass {
|
|||
//是否悬停
|
||||
IsHover = false;
|
||||
|
||||
_Mouse_Click_Flag = false;
|
||||
|
||||
function _typeof() {
|
||||
return "npc";
|
||||
}
|
||||
|
|
@ -63,15 +65,30 @@ class GameObject.NPC extends GameObject.BaseClass {
|
|||
}
|
||||
}
|
||||
|
||||
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//悬停事件
|
||||
if (!IsHover) {
|
||||
if (!IsHover && !WindowInteractiveFlag) {
|
||||
IsHover = true;
|
||||
//设置Ani描边
|
||||
Ani.SetOutline(true, sq_RGBA(155, 255, 0, 250));
|
||||
//设置鼠标
|
||||
IMouse.ChangeActive(120, 4);
|
||||
}
|
||||
|
||||
if (WindowInteractiveFlag) {
|
||||
if (IsHover) {
|
||||
IsHover = false;
|
||||
Ani.SetOutline(false);
|
||||
//设置鼠标
|
||||
IMouse.Change(0);
|
||||
}
|
||||
}
|
||||
|
||||
//判断点击 在没有悬停在任何窗口的情况下
|
||||
if (MouseState == 0x201 && !WindowInteractiveFlag) {
|
||||
_NameSpace_FunctionInteractive._FunctionInteractive.Generator(Id, MousePos_X + 16, MousePos_Y + 16);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function OutMouseLogic() {
|
||||
|
|
@ -84,5 +101,14 @@ class GameObject.NPC extends GameObject.BaseClass {
|
|||
}
|
||||
}
|
||||
|
||||
function OnUpdate(Dt) {
|
||||
// //悬停事件
|
||||
// if (IsHover) {
|
||||
// IsHover = false;
|
||||
// Ani.SetOutline(false);
|
||||
// //设置鼠标
|
||||
// IMouse.Change(0);
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ class Map extends Actor {
|
|||
//添加对象
|
||||
function AddObject(obj, IsPlayer = false) {
|
||||
//角色对象
|
||||
if (typeof obj == "character") {
|
||||
if (typeof obj == "Game_Character") {
|
||||
//如果已经处于某个地图中
|
||||
if (obj.Parent) {
|
||||
obj.Parent.Removechild(obj);
|
||||
|
|
@ -318,7 +318,7 @@ class Map extends Actor {
|
|||
//玩家列表中移除玩家
|
||||
PlayerList.rawdelete(obj.Cid);
|
||||
//角色对象
|
||||
if (typeof obj == "character") {
|
||||
if (typeof obj == "Game_Character") {
|
||||
//将地图信息写入角色中
|
||||
obj.MySelfMap = null;
|
||||
}
|
||||
|
|
@ -328,7 +328,7 @@ class Map extends Actor {
|
|||
function RemoveAllCharacterObject() {
|
||||
foreach(obj in PlayerList) {
|
||||
//角色对象
|
||||
if (typeof obj == "character") {
|
||||
if (typeof obj == "Game_Character") {
|
||||
RemoveObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
@ -337,7 +337,7 @@ class Map extends Actor {
|
|||
//移动城镇的添加对象
|
||||
function AddObjectByChangeTown(obj, pos) {
|
||||
//角色对象
|
||||
if (typeof obj == "character") {
|
||||
if (typeof obj == "Game_Character") {
|
||||
//角色原城镇
|
||||
local FromMapobj = obj.MySelfMap;
|
||||
//清除原城镇里的玩家
|
||||
|
|
@ -442,7 +442,7 @@ class Map extends Actor {
|
|||
}
|
||||
}
|
||||
|
||||
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y) {
|
||||
function OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//判断是人物所在的地图
|
||||
if (ClientCharacter && this.C_Object == ClientCharacter.MySelfMap.C_Object) {
|
||||
local Arr = [];
|
||||
|
|
@ -461,7 +461,7 @@ class Map extends Actor {
|
|||
local Index = Math.PointIsInWhichRectangle(MousePos_X, MousePos_Y, Arr);
|
||||
//有事件发生的NPC对象
|
||||
if (Index != -1) {
|
||||
return m_data.npc[Index].OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y);
|
||||
return m_data.npc[Index].OnMouseLogic(MouseState, Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
} else {
|
||||
foreach(Npcobj in m_data.npc) {
|
||||
Npcobj.OutMouseLogic();
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ class BaseObject extends Actor {
|
|||
Z = vargv[1];
|
||||
base.SetPosition(Value, vargv[0] - vargv[1]);
|
||||
}
|
||||
SetZOrder(Y);
|
||||
SetZOrder(Y.tointeger());
|
||||
}
|
||||
|
||||
//传入坐标 xyz 的table 或者 单独传 xyz
|
||||
|
|
@ -76,7 +76,7 @@ class BaseObject extends Actor {
|
|||
Z = vargv[1];
|
||||
base.MoveTo(Value, vargv[0] - vargv[1]);
|
||||
}
|
||||
SetZOrder(Y);
|
||||
SetZOrder(Y.tointeger());
|
||||
}
|
||||
|
||||
//传入坐标 xyz 的table 或者 单独传 xyz
|
||||
|
|
@ -109,18 +109,13 @@ class BaseObject extends Actor {
|
|||
}
|
||||
Z += vargv[1];
|
||||
}
|
||||
SetZOrder(Y);
|
||||
SetZOrder(Y.tointeger());
|
||||
//如果是客户端玩家 则判断移动城镇
|
||||
if (IsClientPlayer()) MySelfMap.CheckMovableAreaTransmit(this, X, Y);
|
||||
}
|
||||
|
||||
//设置方向
|
||||
function SetDirection(D) {
|
||||
if (D == DIRECTION.RIGHT) {
|
||||
SetScale(fabs(GetScale().x), GetScale().y);
|
||||
} else if (D == DIRECTION.LEFT) {
|
||||
SetScale(-fabs(GetScale().x), GetScale().y);
|
||||
}
|
||||
Direction = D;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,11 +10,25 @@ function RegisterFunctionalPack() {
|
|||
// 选择角色进入游戏回包
|
||||
MySocket.RegisterHandler(PACKET_ID.SELECT_CHARACTER_ENTER_GAME_CALLBACK, function(Jso) {
|
||||
local Info = Jso.charac;
|
||||
|
||||
//构造城镇
|
||||
local TownObj = Town(Info.town);
|
||||
local Charc = GameObject.CreateCharacter(Info.job, Info.equ, true);
|
||||
|
||||
local Charc = GameObject.CreateCharacter(Info.job, [], true);
|
||||
//构造角色
|
||||
{
|
||||
Charc.Cid = Info.cid;
|
||||
Charc.GrowJob = Info.jobEx;
|
||||
Charc.Level = Info.lv;
|
||||
Charc.Exp = Info.exp;
|
||||
Charc.Fatigue = Info.fatigue;
|
||||
Charc.SkillPoint = Info.sp;
|
||||
|
||||
Charc.SetName(Info.name);
|
||||
Charc.InitAttr(); //初始化角色属性
|
||||
TownObj.AddObject(Charc, true);
|
||||
ClientCharacter = Charc;
|
||||
}
|
||||
|
||||
//以下是角色应当初始化的各项东西
|
||||
{
|
||||
|
|
@ -22,46 +36,31 @@ function RegisterFunctionalPack() {
|
|||
if (ClientCharacterInventory) {
|
||||
ClientCharacterInventory.DestroyWindow();
|
||||
}
|
||||
ClientCharacterInventory = _Inventory("背包窗口", 150, 12, 262, 548, 20);
|
||||
ClientCharacterInventory = UISpace_Inventory._Inventory("背包窗口", 634, 20, 262, 548, 20);
|
||||
|
||||
//初始化个人信息
|
||||
if (ClientPersonalInfo) {
|
||||
ClientPersonalInfo.DestroyWindow();
|
||||
}
|
||||
ClientPersonalInfo = UISpace_PersonalInfo._PersonalInfo("个人信息窗口", 150, 35, 286, 530, 20);
|
||||
|
||||
//初始化HUD
|
||||
if (ClientHUD) {
|
||||
ClientHUD.DestroyWindow();
|
||||
}
|
||||
ClientHUD = UISpace_Hud._Hud();
|
||||
ClientHUD.ResetFocus();
|
||||
|
||||
//初始化技能树
|
||||
if (ClientSkillTreeWindow) {
|
||||
ClientSkillTreeWindow.DestroyWindow();
|
||||
}
|
||||
ClientSkillTreeWindow = UISpace_SkillTree._SkillTree("技能树窗口", 135, 4, 796, 524, 20);
|
||||
ClientSkillTreeWindow.Init(Charc.Job, Charc.GrowJob);
|
||||
ClientSkillTreeWindow.ResetFocus();
|
||||
}
|
||||
});
|
||||
|
||||
/*
|
||||
InventorySize : int //背包大小
|
||||
InventoryType : byte //背包类型
|
||||
InventoryItemCount : short //背包道具数量
|
||||
|
||||
|
||||
ItemInfo : Struct //道具信息 结构体
|
||||
{
|
||||
Type : byte //类型
|
||||
// Type 为 1 装备类型
|
||||
{
|
||||
Pos : short //装备位置
|
||||
EquipId : int //装备ID
|
||||
EquipEnchant : int //装备附魔编号
|
||||
EquipUpgrade : byte //装备强化等级或增幅等级
|
||||
EquipSeparate : byte //装备锻造
|
||||
EquipIncrease : byte //装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||
EquipPowerPercentage : byte //装备力量百分比
|
||||
EquipIntellectPercentage : byte //装备智力百分比
|
||||
EquipStaminaPercentage : byte //装备体力百分比
|
||||
EquipSpiritPercentage : byte //装备精神百分比
|
||||
EquipPhysicalAttackPercentage : byte //装备物理攻击百分比
|
||||
EquipMagicAttackPercentage : byte //装备魔法攻击百分比
|
||||
EquipIndependentAttackPercentage : byte //装备独立攻击百分比
|
||||
EquipPhysicalDefensePercentage : byte //装备物理防御百分比
|
||||
EquipMagicDefensePercentage : byte //装备魔法防御百分比
|
||||
EquipWrapCount : byte //装备再封装次数
|
||||
}
|
||||
// Type 为 2 消耗品类型
|
||||
{
|
||||
Pos : short //道具位置
|
||||
ItemId : int //道具ID
|
||||
ItemCount : int //道具数量
|
||||
}
|
||||
}
|
||||
*/
|
||||
//刷新客户端角色背包数据
|
||||
MySocket.RegisterBinaryHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_INVENTORY_DATA_CALLBACK, function(Binary) {
|
||||
local Pack = Packet(Binary);
|
||||
|
|
@ -78,88 +77,146 @@ function RegisterFunctionalPack() {
|
|||
|
||||
//道具数据
|
||||
for (local i = 0; i< InventoryItemCount; i++) {
|
||||
local Type = Pack.Get_Byte();
|
||||
local ItemStruct = GameItem.Item.ConstructionItemByPacket(Pack);
|
||||
ItemList[ItemStruct.Pos] <- ItemStruct.Item;
|
||||
}
|
||||
|
||||
//装备类型
|
||||
if (Type == 1) {
|
||||
local EquInfo = {
|
||||
//装备位置
|
||||
Pos = Pack.Get_Short(),
|
||||
//装备ID
|
||||
EquipId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
EquipTradeType = Pack.Get_Byte(),
|
||||
//装备附魔编号
|
||||
EquipEnchant = Pack.Get_Int(),
|
||||
//装备强化等级或增幅等级
|
||||
EquipUpgrade = Pack.Get_Byte(),
|
||||
//装备锻造
|
||||
EquipSeparate = Pack.Get_Byte(),
|
||||
//装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
|
||||
EquipIncrease = Pack.Get_Byte(),
|
||||
//装备力量百分比
|
||||
EquipPowerPercentage = Pack.Get_Byte(),
|
||||
//装备智力百分比
|
||||
EquipIntellectPercentage = Pack.Get_Byte(),
|
||||
//装备体力百分比
|
||||
EquipStaminaPercentage = Pack.Get_Byte(),
|
||||
//装备精神百分比
|
||||
EquipSpiritPercentage = Pack.Get_Byte(),
|
||||
//装备物理攻击百分比
|
||||
EquipPhysicalAttackPercentage = Pack.Get_Byte(),
|
||||
//装备魔法攻击百分比
|
||||
EquipMagicAttackPercentage = Pack.Get_Byte(),
|
||||
//装备独立攻击百分比
|
||||
EquipIndependentAttackPercentage = Pack.Get_Byte(),
|
||||
//装备物理防御百分比
|
||||
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
|
||||
//装备魔法防御百分比
|
||||
EquipMagicDefensePercentage = Pack.Get_Byte(),
|
||||
//装备全属强
|
||||
EquipAllElementalAttack = Pack.Get_Byte(),
|
||||
//装备水属强
|
||||
EquipWaterAttack = Pack.Get_Byte(),
|
||||
//装备火属强
|
||||
EquipFireAttack = Pack.Get_Byte(),
|
||||
//装备光属强
|
||||
EquipLightAttack = Pack.Get_Byte(),
|
||||
//装备暗属强
|
||||
EquipDarkAttack = Pack.Get_Byte(),
|
||||
//装备品质
|
||||
EquipPercentage = Pack.Get_Byte(),
|
||||
//装备再封装次数
|
||||
EquipWrapCount = Pack.Get_Byte(),
|
||||
//装备是否封装
|
||||
EquipIsWrap = Pack.Get_Byte(),
|
||||
//耐久度
|
||||
EquipDurability = Pack.Get_Byte(),
|
||||
}
|
||||
ItemList[EquInfo.Pos] <- GameItem.Equipment(EquInfo);
|
||||
//装备栏
|
||||
if (InventoryType == 2) {
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionList(0, ItemList);
|
||||
//穿戴栏
|
||||
if (InventoryType == 1) {
|
||||
foreach(Index, EquObj in ItemList) {
|
||||
ClientCharacterInventory.PageList[0].CharactersObject.SetEquipment(Index, EquObj);
|
||||
//给角色赋予穿戴装备
|
||||
if (EquObj) {
|
||||
ClientCharacter.WearEquipment(EquObj);
|
||||
}
|
||||
}
|
||||
//消耗品类型
|
||||
if (Type == 2 || Type == 3) {
|
||||
local ItemInfo = {
|
||||
//道具位置
|
||||
Pos = Pack.Get_Short(),
|
||||
//道具ID
|
||||
ItemId = Pack.Get_Int(),
|
||||
//交易类型
|
||||
ItemTradeType = Pack.Get_Byte(),
|
||||
//道具数量
|
||||
ItemCount = Pack.Get_Int(),
|
||||
//处理完穿戴装备以后,重新计算角色属性
|
||||
ClientCharacter.ReadFullEquipAttr();
|
||||
//刷新一下个人信息
|
||||
ClientPersonalInfo.RefreshPersonalInfo();
|
||||
}
|
||||
ItemList[ItemInfo.Pos] <- GameItem.Stackable(ItemInfo);
|
||||
|
||||
|
||||
//背包栏
|
||||
else if (InventoryType > 1 && InventoryType< 7) {
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionList(InventoryType - 2, ItemList);
|
||||
}
|
||||
//时装穿戴栏
|
||||
else if (InventoryType == 8) {
|
||||
foreach(Index, EquObj in ItemList) {
|
||||
ClientCharacterInventory.PageList[1].CharactersObject.SetEquipment(Index, EquObj);
|
||||
//给角色赋予穿戴装备
|
||||
if (EquObj) {
|
||||
ClientCharacter.WearEquipment(EquObj);
|
||||
}
|
||||
}
|
||||
//刷新背包中的人物Ani
|
||||
ClientCharacterInventory.RefreshRoleAni();
|
||||
//刷新一下个人信息
|
||||
ClientPersonalInfo.RefreshPersonalInfo();
|
||||
}
|
||||
//时装
|
||||
else if (InventoryType == 9) {
|
||||
ClientCharacterInventory.PageList[1].SetItemCollectionList(InventoryType - 9, ItemList);
|
||||
}
|
||||
});
|
||||
|
||||
//刷新客户端角色背包单个槽数据
|
||||
MySocket.RegisterBinaryHandler(PACKET_ID.INVENTORY_ADD_ITEM_CALLBACK, function(Binary) {
|
||||
local Pack = Packet(Binary);
|
||||
local op = Pack.Get_Int();
|
||||
local InventoryType = Pack.Get_Byte(); //背包类型
|
||||
local ItemStruct = GameItem.Item.ConstructionItemByPacket(Pack);
|
||||
//穿戴栏
|
||||
if (InventoryType == 1) {
|
||||
ClientCharacterInventory.PageList[0].CharactersObject.SetEquipment(ItemStruct.Pos, ItemStruct.Item);
|
||||
}
|
||||
//背包栏
|
||||
else if (InventoryType > 1 && InventoryType< 7) {
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionSlot(InventoryType - 2, ItemStruct.Pos, ItemStruct.Item);
|
||||
}
|
||||
//时装
|
||||
else if (InventoryType == 9) {
|
||||
ClientCharacterInventory.PageList[1].SetItemCollectionSlot(InventoryType - 9, ItemStruct.Pos, ItemStruct.Item);
|
||||
}
|
||||
});
|
||||
MySocket.RegisterBinaryHandler(PACKET_ID.INVENTORY_REMOVE_ITEM_CALLBACK, function(Binary) {
|
||||
local Pack = Packet(Binary);
|
||||
local op = Pack.Get_Int();
|
||||
local InventoryType = Pack.Get_Byte(); //背包类型
|
||||
local Pos = Pack.Get_Short();
|
||||
//穿戴栏
|
||||
if (InventoryType == 1) {
|
||||
ClientCharacterInventory.PageList[0].CharactersObject.SetEquipment(Pos, null);
|
||||
}
|
||||
//背包栏
|
||||
else if (InventoryType > 1 && InventoryType< 7) {
|
||||
ClientCharacterInventory.PageList[0].SetItemCollectionSlot(InventoryType - 2, Pos, null);
|
||||
}
|
||||
//时装
|
||||
else if (InventoryType == 9) {
|
||||
ClientCharacterInventory.PageList[1].SetItemCollectionSlot(InventoryType - 9, Pos, null);
|
||||
}
|
||||
});
|
||||
//穿戴装备的回包
|
||||
MySocket.RegisterHandler(PACKET_ID.WEAR_EQUIPMENT_CALLBACK, function(Jso) {
|
||||
//页面ID
|
||||
local PageId = 0;
|
||||
local OldBackpackId = Jso.oldbackpackId;
|
||||
local OldPos = Jso.oldpos;
|
||||
local NewBackpackId = Jso.newbackpackId;
|
||||
//时装页面1
|
||||
if (NewBackpackId == 9) {
|
||||
PageId = 1;
|
||||
NewBackpackId = 0
|
||||
}
|
||||
//装备页面0
|
||||
else {
|
||||
NewBackpackId -= 2
|
||||
}
|
||||
local NewPos = Jso.newpos;
|
||||
|
||||
local OldItem = null;
|
||||
local NewItem = null;
|
||||
if (OldBackpackId) {
|
||||
OldItem = ClientCharacterInventory.PageList[PageId].CharactersObject.EquipmentSlot[OldPos].Item;
|
||||
ClientCharacter.UnWearEquipment(OldItem);
|
||||
}
|
||||
//背包位置可能无装备
|
||||
if (ClientCharacterInventory.PageList[PageId].ItemCollectionList[NewBackpackId].ItemList[NewPos]) {
|
||||
NewItem = ClientCharacterInventory.PageList[PageId].ItemCollectionList[NewBackpackId].ItemList[NewPos].Item;
|
||||
ClientCharacter.WearEquipment(ClientCharacterInventory.PageList[PageId].ItemCollectionList[NewBackpackId].ItemList[NewPos].Item);
|
||||
}
|
||||
|
||||
//设置背包槽里的Item 如果原先有装备就设置那件 如果原先没有 则设置为null
|
||||
ClientCharacterInventory.PageList[PageId].SetItemCollectionSlot(NewBackpackId, NewPos, OldItem);
|
||||
//设置角色装备栏里的Item
|
||||
ClientCharacterInventory.PageList[PageId].CharactersObject.SetEquipment(OldPos, NewItem);
|
||||
//设置个人信息栏里的装备Item
|
||||
if (PageId == 0) ClientPersonalInfo.PageList[PageId].CharactersObject.SetEquipment(OldPos, NewItem);
|
||||
//刷新背包中的人物Ani
|
||||
ClientCharacterInventory.RefreshRoleAni();
|
||||
//处理完穿戴装备以后,重新计算角色属性
|
||||
if (OldItem && PageId == 0) ClientCharacter.Attr -= OldItem.Attr;
|
||||
if (NewItem && PageId == 0) ClientCharacter.Attr += NewItem.Attr;
|
||||
//刷新一下个人信息
|
||||
ClientPersonalInfo.RefreshPersonalInfo();
|
||||
});
|
||||
|
||||
//刷新客户端角色背包点卷代币券信息
|
||||
MySocket.RegisterHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_CERA_DATA_CALLBACK, function(Jso) {
|
||||
ClientCharacterInventory.WalletSet("Cera", Jso.coupon);
|
||||
});
|
||||
|
||||
//刷新客户端角色背包金币信息
|
||||
MySocket.RegisterHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_GOLD_DATA_CALLBACK, function(Jso) {
|
||||
ClientCharacterInventory.WalletSet("Gold", Jso.gold);
|
||||
});
|
||||
|
||||
//刷新客户端角色背包复活币信息
|
||||
MySocket.RegisterHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_REVIVE_DATA_CALLBACK, function(Jso) {
|
||||
ClientCharacterInventory.WalletSet("ReviveCoin", Jso.revive);
|
||||
});
|
||||
|
||||
|
||||
//城镇中添加角色的回包
|
||||
MySocket.RegisterBinaryHandler(PACKET_ID.TOWN_ADD_CHARACTER_CALLBACK, function(Binary) {
|
||||
local Pack = Packet(Binary);
|
||||
|
|
@ -181,6 +238,7 @@ function RegisterFunctionalPack() {
|
|||
//构造角色
|
||||
local Charc = GameObject.CreateCharacter(job, equ);
|
||||
Charc.Cid = cid;
|
||||
Charc.SetName(name);
|
||||
Charc.SetPosition(posx, posy, posz);
|
||||
//从全局地图中找到城镇并添加角色
|
||||
if (GlobalTownManager.CurrentMap) {
|
||||
|
|
@ -201,7 +259,7 @@ function RegisterFunctionalPack() {
|
|||
//遍历所有角色
|
||||
foreach(obj in GlobalTownManager.CurrentMap.PlayerList) {
|
||||
//角色对象
|
||||
if (typeof obj == "character" && obj.Cid == Jso.cid) {
|
||||
if (typeof obj == "Game_Character" && obj.Cid == Jso.cid) {
|
||||
GlobalTownManager.CurrentMap.RemoveObject(obj);
|
||||
}
|
||||
}
|
||||
|
|
@ -230,6 +288,16 @@ function RegisterFunctionalPack() {
|
|||
obj.SetMoveFlag(MoveFlag);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
//注册聊天信息收包
|
||||
MySocket.RegisterHandler(PACKET_ID.SEND_CHAT_MESSAGE_CALLBACK, function(Jso) {
|
||||
ClientChatWindow.PushMsg(Jso);
|
||||
|
||||
//获取角色对象
|
||||
local obj = GameObject.GetCharacterByCid(Jso.cid);
|
||||
if (obj) obj.SetChatBubble(Jso.msg);
|
||||
}.bindenv(this));
|
||||
}
|
||||
|
||||
//城镇包
|
||||
|
|
|
|||
|
|
@ -7,14 +7,15 @@
|
|||
function InitGame() {
|
||||
//初始化Socekt连接
|
||||
MySocket("192.168.200.15", 19003);
|
||||
// MySocket("125.109.36.181", 19003);
|
||||
//注册功能包
|
||||
RegisterFunctionalPack();
|
||||
|
||||
// MySocket("127.0.0.1", 19666);
|
||||
|
||||
//设定全局默认音量
|
||||
_Globa_Audio_Volume_ = 0.001;
|
||||
_Globa_Sound_Volume_ = 0.001;
|
||||
_Globa_Audio_Volume_ = 0.015;
|
||||
_Globa_Sound_Volume_ = 0.015;
|
||||
|
||||
Script();
|
||||
|
||||
|
|
@ -29,7 +30,7 @@ function InitGame() {
|
|||
//初始化顶部工具条UI
|
||||
Sq_CreateWindow(_Top_tool, "窗口顶部工具条", 208, 0, 650, 20, 0);
|
||||
//初始化聊天窗口
|
||||
Sq_CreateWindow(_PlayerChat, "玩家聊天窗口", 1066, 0, 332, 600, 0);
|
||||
Sq_CreateWindow(_PlayerChat, "玩家聊天窗口", 1067, 0, 332, 600, 0);
|
||||
|
||||
//预加载
|
||||
Animation("ui/charactercreate/dust.ani");
|
||||
|
|
@ -56,7 +57,7 @@ function LoginStage() {
|
|||
local Kiwano = CL_SpriteObject("sprite/loding.img", 1);
|
||||
Kiwano.SetAnchor(0.5, 0.5);
|
||||
Kiwano.SetScale(0.35, 0.35);
|
||||
Kiwano.SetPosition(1066 / 2, 300);
|
||||
Kiwano.SetPosition(1067 / 2, 300);
|
||||
Kiwano.SetUpdateFunc(function(sp, dt) {
|
||||
if (!("time" in sp.Var)) sp.Var.time <- 0;
|
||||
sp.Var.time += dt;
|
||||
|
|
@ -68,7 +69,7 @@ function LoginStage() {
|
|||
//Yosin图标
|
||||
local Yosin = CL_SpriteObject("sprite/loding.img", 2);
|
||||
Yosin.SetAnchor(0.5, 0.5);
|
||||
Yosin.SetPosition(1066 / 2, 300);
|
||||
Yosin.SetPosition(1067 / 2, 300);
|
||||
Yosin.SetOpacity(0.0);
|
||||
Yosin.SetUpdateFunc(function(sp, dt) {
|
||||
if (!("time" in sp.Var)) sp.Var.time <- 0;
|
||||
|
|
|
|||
|
|
@ -10,12 +10,83 @@ function TestStage() {
|
|||
T.Enter();
|
||||
|
||||
|
||||
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||
// T.Addchild(BackGround);
|
||||
|
||||
|
||||
// local Window = _NameSpace_FunctionInteractive._FunctionInteractive(2, 300, 200);
|
||||
|
||||
// //创建名字对象
|
||||
// local Name = FontAssetManager.GenerateNormal("", true, {
|
||||
// color = sq_RGBA(209, 185, 148, 255),
|
||||
// });
|
||||
// Name.SetZOrder(80000);
|
||||
// Name.SetPosition(184 + 28.5, 93 + 195);
|
||||
// Name.SetText("1 级 " + "倾泪寒");
|
||||
// T.Addchild(Name);
|
||||
|
||||
// ClientCharacter = GameObject.CreateCharacter(0, []);
|
||||
// ClientCharacter.Level = 95;
|
||||
// ClientCharacter.SkillPoint = 6190;
|
||||
// ClientCharacter.Exp = 1127310010;
|
||||
// ClientCharacter.Fatigue = 50;
|
||||
// ClientCharacter.InitAttr();
|
||||
// Sq_CreateWindow(UISpace_PersonalInfo._PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20);
|
||||
|
||||
// ClientCharacterInventory = Sq_CreateWindow(UISpace_Inventory._Inventory, "背包窗口", 634, 20, 262, 548, 20);
|
||||
|
||||
// local SkillObject = GameItem.Skill(0, 1);
|
||||
// local Icon = SkillObject.GetInfoWindow();
|
||||
// Icon.SetPosition(200, 100);
|
||||
// T.Addchild(Icon);
|
||||
|
||||
|
||||
// local SkillObject2 = GameItem.Skill(0, 86);
|
||||
// local Icon2 = SkillObject2.GetInfoWindow();
|
||||
// Icon2.SetPosition(500, 100);
|
||||
// T.Addchild(Icon2);
|
||||
|
||||
// local SkillObject3 = GameItem.Skill(0, 246);
|
||||
// local Icon3 = SkillObject3.GetInfoWindow();
|
||||
// Icon3.SetPosition(800, 100);
|
||||
// T.Addchild(Icon3);
|
||||
|
||||
// local Window = Sq_CreateWindow(UISpace_SkillTree._SkillTree, "技能树窗口", 135, 4, 796, 524, 20);
|
||||
// Window.Init(0, 0);
|
||||
// local Window = UISpace_Hud._Hud();
|
||||
// Window.ResetFocus();
|
||||
|
||||
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1067, 600, 0);
|
||||
|
||||
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||
// T.Addchild(BackGround);
|
||||
// _QuantityInput(200, 200);
|
||||
// Window.Init(2);
|
||||
|
||||
|
||||
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||
// T.Addchild(BackGround);
|
||||
|
||||
// local Test = Character_ChatBubble("thisistestprojectyoukonwmymi");
|
||||
// Test.SetPosition(300, 200);
|
||||
// T.Addchild(Test);
|
||||
|
||||
|
||||
// local canvas = CL_CanvasObject();
|
||||
// canvas.ResizeAndClear(600, 600);
|
||||
// canvas.BeginDraw();
|
||||
// local Actorobj = Actor();
|
||||
// local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||
// Actorobj.Addchild(BackGround);
|
||||
|
||||
// canvas.DrawActor(Actorobj);
|
||||
// canvas.EndDraw();
|
||||
// T.Addchild(canvas);
|
||||
|
||||
|
||||
//初始化聊天窗口
|
||||
// Sq_CreateWindow(_PlayerChat, "玩家聊天窗口", 1067, 0, 332, 600, 0);
|
||||
|
||||
|
||||
// local Stk = GameItem.Stackable(3037);
|
||||
// Stk.Count = 10;
|
||||
|
|
@ -101,33 +172,8 @@ function TestStage() {
|
|||
// ClientCharacter = Charc;
|
||||
|
||||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
|
||||
|
||||
|
||||
// Window.EquipmentPage.ItemCollection.SetItemList([{
|
||||
// ItemId = 27675
|
||||
// }, {
|
||||
// ItemId = 101020048
|
||||
// }, {
|
||||
// ItemId = 24144
|
||||
// }]);
|
||||
|
||||
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
|
||||
// //大背景
|
||||
// local BackGround = CL_SpriteObject("sprite/map/npc/2019_halloween_blossom_normal.img", 0);
|
||||
// BackGround.SetPosition(300, 150);
|
||||
// BackGround.SetOutline(true);
|
||||
// T.Addchild(BackGround);
|
||||
|
||||
|
||||
// local Fontobj = Font();
|
||||
// local NPCobj = GameObject.NPC(2);
|
||||
// NPCobj.SetPosition(400, 400, 0);
|
||||
// T.Addchild(NPCobj);
|
||||
|
||||
|
||||
|
||||
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1067, 600, 0);
|
||||
// local T = {
|
||||
// loginImg = 1,
|
||||
// charac = [{
|
||||
|
|
@ -171,6 +217,6 @@ function TestStage() {
|
|||
|
||||
// print(ObjectCount);
|
||||
|
||||
// Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
// Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1067, 600, 0);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,600 @@
|
|||
/*
|
||||
文件名:BaseWidget.nut
|
||||
路径:User/UI/Widget/BaseWidget.nut
|
||||
创建日期:2025-02-07 21:37
|
||||
文件用途:
|
||||
*/
|
||||
|
||||
//基础按钮
|
||||
class Yosin_BaseButton extends Yosin_CommonUi {
|
||||
//按钮状态
|
||||
State = 0;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
|
||||
Sprite = null;
|
||||
SpriteState = -1;
|
||||
FrameList = null;
|
||||
|
||||
//按下时的模拟偏移
|
||||
DownSimulateOffset = true;
|
||||
|
||||
OnClickSound = SOUND.CLICK_BUTTON2;
|
||||
OnClickMoveSound = SOUND.CLICK_MOVE;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
FrameList = [];
|
||||
Sprite = CL_SpriteObject();
|
||||
// Sprite.ShowBorder(true);
|
||||
Addchild(Sprite);
|
||||
|
||||
for (local i = 0; i< 4; i++) {
|
||||
local Sf = CL_SpriteFrameObject(this.Path, this.Idx + i);
|
||||
FrameList.push(Sf);
|
||||
}
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
//按下时模拟偏移的Flag 如果按下 调整Y坐标向下一个单位
|
||||
if (DownSimulateOffset) {
|
||||
if (State == 2) {
|
||||
Y += 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y -= 1;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
}
|
||||
SpriteState = State;
|
||||
Sprite.SetFrame(FrameList[SpriteState]);
|
||||
Sprite.SetPosition(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
//三分法拉伸
|
||||
class Yosin_EmeStretch extends CL_CanvasObject {
|
||||
|
||||
Path = null;
|
||||
Idx = null;
|
||||
//按钮状态
|
||||
SpriteList = null;
|
||||
|
||||
constructor(W, H, Path, Idx, Direction = true) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor();
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(W, H);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
SpriteList = [];
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx));
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx + 1));
|
||||
SpriteList.push(CL_SpriteObject(Path, Idx + 2));
|
||||
|
||||
//横向
|
||||
if (Direction) {
|
||||
local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w);
|
||||
local ScaleRate = ScaleW / SpriteList[1].GetSize().w;
|
||||
|
||||
SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0.0);
|
||||
SpriteList[1].SetScale(ScaleRate, 1.0);
|
||||
SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0.0);
|
||||
}
|
||||
//纵向
|
||||
else {
|
||||
local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h);
|
||||
local ScaleRate = ScaleH / SpriteList[1].GetSize().h;
|
||||
|
||||
SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
||||
SpriteList[1].SetScale(1.0, ScaleRate);
|
||||
SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
||||
}
|
||||
|
||||
foreach(Child in SpriteList) {
|
||||
// Addchild(Child);
|
||||
DrawSprite(Child);
|
||||
}
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
// 添加画布
|
||||
// Addchild(Canvas);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//九宫格拉伸
|
||||
function Yosin_NineBoxStretch(width, height, path, imgId) {
|
||||
|
||||
// 创建画布
|
||||
local Canvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(width, height);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
// 左上角
|
||||
// local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
// 上边
|
||||
local backgroundTop = CL_SpriteObject(path, imgId + 1);
|
||||
// 右上角
|
||||
local backgroundTopRight = CL_SpriteObject(path, imgId + 2);
|
||||
// 左边
|
||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||
// 中间
|
||||
local backgroundCenter = CL_SpriteObject(path, imgId + 4);
|
||||
// 右边
|
||||
local backgroundRight = CL_SpriteObject(path, imgId + 5);
|
||||
// 左下角
|
||||
local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6);
|
||||
// 下边
|
||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||
// 右下角
|
||||
local backgroundBottomRight = CL_SpriteObject(path, imgId + 8);
|
||||
|
||||
|
||||
// 左上角
|
||||
Canvas.DrawSprite(backgroundTopLeft);
|
||||
|
||||
local TopLeftSize = backgroundTopLeft.GetSize();
|
||||
local TopLeftBottom = TopLeftSize.h;
|
||||
local TopLeftRight = TopLeftSize.w;
|
||||
|
||||
// 中间图片大小
|
||||
local centerImgSize = backgroundCenter.GetSize();
|
||||
local centerImgWidth = centerImgSize.w;
|
||||
local centerImgHeight = centerImgSize.h;
|
||||
|
||||
local centerWidth = width - backgroundTopLeft.GetSize().w - backgroundTopRight.GetSize().w;
|
||||
local centerHeight = height - backgroundTopLeft.GetSize().h - backgroundBottomLeft.GetSize().h;
|
||||
|
||||
|
||||
local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat();
|
||||
local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat();
|
||||
|
||||
// 上边
|
||||
backgroundTop.SetScale(scaleW, 1);
|
||||
backgroundTop.SetPosition(TopLeftRight, 0);
|
||||
Canvas.DrawSprite(backgroundTop);
|
||||
|
||||
// 右上角
|
||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w - 1, 0);
|
||||
Canvas.DrawSprite(backgroundTopRight);
|
||||
|
||||
// 左边
|
||||
backgroundLeft.SetScale(1, scaleH);
|
||||
backgroundLeft.SetPosition(0, TopLeftBottom);
|
||||
Canvas.DrawSprite(backgroundLeft);
|
||||
|
||||
// 中间
|
||||
backgroundCenter.SetScale(scaleW, scaleH);
|
||||
// Addchild(backgroundCenter);
|
||||
backgroundCenter.SetPosition(TopLeftRight, backgroundLeft.Y);
|
||||
Canvas.DrawSprite(backgroundCenter);
|
||||
|
||||
// 右边
|
||||
backgroundRight.SetScale(1, scaleH);
|
||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w - 1, backgroundCenter.Y);
|
||||
Canvas.DrawSprite(backgroundRight);
|
||||
|
||||
// 左下角
|
||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h - 1);
|
||||
Canvas.DrawSprite(backgroundBottomLeft);
|
||||
|
||||
// 下边
|
||||
backgroundBottom.SetScale(scaleW, 1);
|
||||
backgroundBottom.SetPosition(TopLeftRight, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottom);
|
||||
|
||||
// 右下角
|
||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w - 1, backgroundBottomLeft.Y);
|
||||
Canvas.DrawSprite(backgroundBottomRight);
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
// Addchild(Canvas);
|
||||
local Sp = CL_SpriteObject();
|
||||
Sp.SetFrame(Canvas.ExportSpriteFrame());
|
||||
return Sp;
|
||||
}
|
||||
|
||||
//拼接按钮
|
||||
class Yosin_SplicingButton extends Yosin_CommonUi {
|
||||
//按钮状态
|
||||
State = 0;
|
||||
Path = null;
|
||||
Idx = null;
|
||||
|
||||
SpriteList = null;
|
||||
SpriteState = -1;
|
||||
FrameList = null;
|
||||
|
||||
//按下时的模拟偏移
|
||||
DownSimulateOffset = true;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, Direction = true, UnavailableFlag = true, IsTwoImg = false) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
SpriteList = array(4);
|
||||
|
||||
//普通态
|
||||
SpriteList[0] = Yosin_EmeStretch(W, H, Path, Idx, Direction);
|
||||
//悬停态
|
||||
SpriteList[1] = Yosin_EmeStretch(W, H, Path, Idx + (UnavailableFlag ? 4 : 3), Direction);
|
||||
//按下态
|
||||
SpriteList[2] = Yosin_EmeStretch(W, H, Path, Idx + (IsTwoImg ? 3 : (UnavailableFlag ? 8 : 6)), Direction);
|
||||
if (UnavailableFlag) {
|
||||
//不可用态
|
||||
SpriteList[3] = Yosin_EmeStretch(W, H, Path, Idx + 12, Direction);
|
||||
}
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
//按下时模拟偏移的Flag 如果按下 调整Y坐标向下一个单位
|
||||
if (DownSimulateOffset) {
|
||||
if (State == 2) {
|
||||
Y += 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y -= 1;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
}
|
||||
if (SpriteState != -1) {
|
||||
RemoveUIChild(SpriteList[SpriteState]);
|
||||
}
|
||||
SpriteState = State;
|
||||
Addchild(SpriteList[SpriteState]);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 标题按钮
|
||||
class titleButton extends Yosin_BaseButton {
|
||||
|
||||
index = null;
|
||||
select = false;
|
||||
cacheSelect = false;
|
||||
cacheY = null;
|
||||
|
||||
LBDownOnClick = null;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, title) {
|
||||
base.constructor(X, Y, W, H, Path, Idx);
|
||||
|
||||
cacheY = Y;
|
||||
DownSimulateOffset = false;
|
||||
|
||||
local backText = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = sq_RGBA(130, 114, 84, 255)
|
||||
});
|
||||
backText.SetUpdateFunc(function(Text, Dt) {
|
||||
if (select == cacheSelect) return;
|
||||
if (select) {
|
||||
Text.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
} else {
|
||||
Text.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
cacheSelect = select;
|
||||
})
|
||||
|
||||
backText.SetPosition(9, 2);
|
||||
Addchild(backText);
|
||||
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
if (State == 2) {
|
||||
Y = cacheY - 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y = cacheY;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
SpriteState = State;
|
||||
Sprite.SetFrame(FrameList[SpriteState]);
|
||||
Sprite.SetPosition(0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
|
||||
if (select) return;
|
||||
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
select = true;
|
||||
if (LBDownOnClick != null) {
|
||||
LBDownOnClick(this);
|
||||
}
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 拉伸标题按钮
|
||||
class Yosin_StretchTitleButton extends Yosin_CommonUi {
|
||||
|
||||
index = null;
|
||||
//按钮状态
|
||||
State = 0;
|
||||
//ui的当前状态
|
||||
uiState = 0;
|
||||
|
||||
cecheY = null;
|
||||
|
||||
titleText = null;
|
||||
|
||||
SpriteList = null;
|
||||
|
||||
// 鼠标左键按下时的回调
|
||||
LBDownOnClick = null;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, title) {
|
||||
base.constructor(X, Y, W, H)
|
||||
|
||||
cecheY = Y;
|
||||
SpriteList = array(3);
|
||||
|
||||
//普通态
|
||||
SpriteList[0] = Yosin_EmeStretch(W, H, Path, Idx);
|
||||
Addchild(SpriteList[0]);
|
||||
|
||||
//悬停态
|
||||
SpriteList[1] = Yosin_EmeStretch(W, H, Path, Idx + 3);
|
||||
SpriteList[1].SetVisible(false)
|
||||
Addchild(SpriteList[1]);
|
||||
//按下态
|
||||
SpriteList[2] = Yosin_EmeStretch(W, H, Path, Idx + 6);
|
||||
SpriteList[2].SetVisible(false)
|
||||
Addchild(SpriteList[2]);
|
||||
|
||||
// 文字
|
||||
titleText = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = sq_RGBA(130, 114, 84, 255)
|
||||
});
|
||||
titleText.SetUpdateFunc(function(Text, Dt) {
|
||||
if (select == cacheSelect) return;
|
||||
if (select) {
|
||||
Text.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
} else {
|
||||
Text.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
cacheSelect = select;
|
||||
})
|
||||
|
||||
titleText.SetPosition(W / 2 - titleText.GetSize().w / 2, 2);
|
||||
Addchild(titleText);
|
||||
|
||||
}
|
||||
|
||||
// 设置为选中状态
|
||||
function SetSelect(select) {
|
||||
if (select) {
|
||||
State = 2;
|
||||
ChangeFrame();
|
||||
} else {
|
||||
State = 0;
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != uiState) {
|
||||
if (State == 2) {
|
||||
SyncPos(X, cecheY - 1);
|
||||
} else {
|
||||
SyncPos(X, cecheY);
|
||||
}
|
||||
uiState = State;
|
||||
|
||||
for (local i = 0; i< SpriteList.len(); i++) {
|
||||
SpriteList[i].SetVisible(i == uiState);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
if (State == 2) return;
|
||||
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
if (LBDownOnClick != null) {
|
||||
LBDownOnClick(this);
|
||||
}
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 横向多个标题单选按钮
|
||||
class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
||||
|
||||
LBDownOnClick = null;
|
||||
btns = null;
|
||||
tests = null;
|
||||
|
||||
constructor(X, Y, W, titles, path, idx, baseWidth = 48) {
|
||||
this.tests = titles;
|
||||
btns = [];
|
||||
local btnX = 5;
|
||||
for (local i = 0; i< titles.len(); i++) {
|
||||
|
||||
local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 10;
|
||||
local btnW = baseWidth;
|
||||
btnW = textW > btnW ? textW : btnW;
|
||||
|
||||
local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]);
|
||||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
LBDownOnClick(btn.Parent, btn.index);
|
||||
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
btns[i].SetSelect(false);
|
||||
btns[i].titleText.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
|
||||
btn.SetSelect(true);
|
||||
btns[btn.index].titleText.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
|
||||
}.bindenv(this);
|
||||
|
||||
btns.push(titleBtn);
|
||||
btnX += btnW;
|
||||
}
|
||||
|
||||
base.constructor(X, Y, btnX, 21);
|
||||
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
AddUIChild(btns[i]);
|
||||
}
|
||||
|
||||
btns[0].SetSelect(true);
|
||||
|
||||
// 创建画布
|
||||
local Canvas = CL_CanvasObject();
|
||||
Canvas.SetPosition(0, 19);
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(W, 1);
|
||||
// 设置填充画刷 用于绘制边框和线条
|
||||
Canvas.SetFillBrush(sq_RGBA(66, 61, 59, 250));
|
||||
// 设置轮廓画刷 用于绘制边框和线条
|
||||
Canvas.SetStrokeBrush(sq_RGBA(66, 61, 59, 250));
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
// 画线段
|
||||
Canvas.DrawLine(0, 1, W, 1);
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(Canvas);
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 进度显示
|
||||
class Yosin_Schedule extends Yosin_CommonUi {
|
||||
|
||||
//背景
|
||||
BgSprite = null;
|
||||
//条
|
||||
BarSprite = null;
|
||||
|
||||
// schedule 进度比例0-1
|
||||
constructor(X, Y, W, H, path, idx) {
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
BgSprite = CL_SpriteObject(path, idx + 1);
|
||||
Addchild(BgSprite);
|
||||
|
||||
BarSprite = CL_SpriteObject(path, idx);
|
||||
Addchild(BarSprite);
|
||||
}
|
||||
|
||||
function SetPercentage(Rate) {
|
||||
local barSize = BarSprite.GetSize();
|
||||
local barW = barSize.w * Rate;
|
||||
|
||||
BarSprite.SetCropRect(BarSprite.X, BarSprite.Y, barW, barSize.h);
|
||||
BarSprite.SetSize(barW, barSize.h);
|
||||
}
|
||||
}
|
||||
|
|
@ -32,13 +32,13 @@ class Yosin_DragButton extends Yosin_CommonUi {
|
|||
//侦测值
|
||||
Detect_Value = 0;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, Direction = true, UnavailableFlag = true) {
|
||||
constructor(X, Y, W, H, Path, Idx, Direction = true, UnavailableFlag = true, IsTwoImg = false) {
|
||||
this.Path = Path;
|
||||
this.Idx = Idx;
|
||||
this.Direction = Direction;
|
||||
base.constructor(X, Y, W, H);
|
||||
|
||||
Button = Yosin_SplicingButton(0, 0, W, H, Path, Idx, Direction, UnavailableFlag);
|
||||
Button = Yosin_SplicingButton(0, 0, W, H, Path, Idx, Direction, UnavailableFlag, IsTwoImg);
|
||||
Button.DownSimulateOffset = false;
|
||||
AddUIChild(Button);
|
||||
|
||||
|
|
@ -51,8 +51,8 @@ class Yosin_DragButton extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
if (isInRect) {
|
||||
MoveFlag = true;
|
||||
|
|
@ -64,9 +64,9 @@ class Yosin_DragButton extends Yosin_CommonUi {
|
|||
}
|
||||
|
||||
//override
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
//移动
|
||||
if (MoveFlag) {
|
||||
|
|
@ -95,9 +95,16 @@ class Yosin_DragButton extends Yosin_CommonUi {
|
|||
if (OnChange) OnChange(Value);
|
||||
}
|
||||
|
||||
//设置位置
|
||||
function SetPos(gX, gY) {
|
||||
X = gX;
|
||||
Y = gY;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
MoveFlag = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,9 @@ class _IMouse_ extends _Yosin_Cursor {
|
|||
//动态帧 Timer
|
||||
ActiveFrameTimer = 0;
|
||||
|
||||
//挂载的对象List
|
||||
//拖动的对象
|
||||
DragObj = null;
|
||||
//挂载的精灵
|
||||
AttachObjList = null;
|
||||
|
||||
constructor() {
|
||||
|
|
@ -71,6 +73,7 @@ class _IMouse_ extends _Yosin_Cursor {
|
|||
Object = Obj,
|
||||
ZOrder = Obj.GetZOrder
|
||||
});
|
||||
Obj.SetPosition(-14, -14);
|
||||
Obj.SetZOrder(-1);
|
||||
Addchild(Obj);
|
||||
}
|
||||
|
|
@ -85,12 +88,29 @@ class _IMouse_ extends _Yosin_Cursor {
|
|||
}
|
||||
}
|
||||
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
//添加拖动道具
|
||||
function AddDragObject(Obj) {
|
||||
DragObj = Obj;
|
||||
//挂载图标到鼠标下
|
||||
AttachObjectBottom("Drag", DragObj.ItemIcon);
|
||||
}
|
||||
|
||||
//移除拖动道具
|
||||
function RemoveDragObject() {
|
||||
if (DragObj) {
|
||||
RemoveObject("Drag");
|
||||
local RetObj = DragObj;
|
||||
DragObj = null;
|
||||
return RetObj;
|
||||
}
|
||||
}
|
||||
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
|
||||
}
|
||||
|
||||
//按下
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//普通状态的点击效果
|
||||
if (Idx == 0) {
|
||||
Change(1);
|
||||
|
|
@ -98,7 +118,7 @@ class _IMouse_ extends _Yosin_Cursor {
|
|||
}
|
||||
|
||||
//抬起
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//普通状态的点击效果
|
||||
if (Idx == 1) {
|
||||
Change(0);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ class Yosin_InputBox extends Yosin_CommonUi {
|
|||
}
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
if (OnClick) OnClick(this);
|
||||
|
|
|
|||
|
|
@ -9,30 +9,29 @@ class Yosin_Mininumber extends CL_CanvasObject {
|
|||
|
||||
//图片数字宽度
|
||||
Yosin_Mininumber_NumberWidth = [6, 4, 6, 6, 6, 6, 6, 6, 6, 6];
|
||||
//绘制宽度
|
||||
DrawTextWidth = 0;
|
||||
|
||||
// 构造函数
|
||||
constructor(Number) {
|
||||
|
||||
if (typeof Number != "integer") error("参数错误");
|
||||
local NumberString = Number.tostring();
|
||||
|
||||
base.constructor();
|
||||
SetNumber(Number);
|
||||
}
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
function SetNumber(num) {
|
||||
if (num == null) return;
|
||||
local NumberString = num.tostring();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(NumberString.len() * 6, 10);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
local DrawTextWidth = 0;
|
||||
DrawTextWidth = 0;
|
||||
foreach(value in NumberString) {
|
||||
local realnum = value - 48;
|
||||
DrawSpriteFrame(CL_SpriteFrameObject("sprite/interface/mininumberset.img", realnum), DrawTextWidth, 0);
|
||||
DrawTextWidth += Yosin_Mininumber_NumberWidth[realnum];
|
||||
}
|
||||
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,138 @@
|
|||
/*
|
||||
文件名:NumberInputBox.nut
|
||||
路径:User/UI/Widget/NumberInputBox.nut
|
||||
创建日期:2025-02-07 20:31
|
||||
文件用途:数字输入框
|
||||
*/
|
||||
class Yosin_NumberInputBox extends Yosin_CommonUi {
|
||||
//框背景
|
||||
BoxBackground = null;
|
||||
//文本
|
||||
TextObject = null;
|
||||
Text = "0";
|
||||
//输入光标
|
||||
InputCursor = null;
|
||||
//输入位置
|
||||
InputPos = 0;
|
||||
//是否获取焦点
|
||||
IsFocus = false;
|
||||
|
||||
|
||||
constructor(w, h) {
|
||||
base.constructor(0, 0, w, h);
|
||||
|
||||
//输入框
|
||||
BoxBackground = Yosin_NineBoxStretch(w, h, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
BoxBackground.SetPosition(0, 0);
|
||||
Addchild(BoxBackground);
|
||||
|
||||
//文本
|
||||
TextObject = Yosin_Mininumber(null);
|
||||
TextObject.SetPosition(6, 5);
|
||||
Addchild(TextObject);
|
||||
|
||||
|
||||
//输入光标
|
||||
InputCursor = CreateCursor();
|
||||
InputCursor.SetUpdateFunc(function(Object, Dt) {
|
||||
//处于焦点中执行
|
||||
if (IsFocus) {
|
||||
//光标闪烁逻辑
|
||||
{
|
||||
if (!(Object.Var.rawin("TimeFlag"))) {
|
||||
Object.Var.TimeFlag <- 0;
|
||||
Object.Var.VisibleFlag <- false;
|
||||
}
|
||||
Object.Var.TimeFlag += Dt;
|
||||
if (Object.Var.TimeFlag >= 500) {
|
||||
Object.Var.TimeFlag <- 0;
|
||||
Object.SetVisible(Object.Var.VisibleFlag);
|
||||
Object.Var.VisibleFlag <- !Object.Var.VisibleFlag;
|
||||
}
|
||||
}
|
||||
//同步光标位置逻辑
|
||||
{
|
||||
Object.SetPosition(TextObject.X + TextObject.DrawTextWidth, 4);
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
Addchild(InputCursor);
|
||||
|
||||
_Imm_Input_Func_.rawset(C_Object, Imm_Input.bindenv(this));
|
||||
}
|
||||
|
||||
//判断是否中文字符
|
||||
function IsChineseChar(code) {
|
||||
return (code & 0x80) != 0;
|
||||
}
|
||||
|
||||
//接收文本数据
|
||||
function Imm_Input(str) {
|
||||
if (!this) return -1;
|
||||
if (!IsFocus) return;
|
||||
//退格键
|
||||
if (str == "\b") {
|
||||
if (this.Text.len() > 0) {
|
||||
this.Text = Sq_RemoveStringLast(this.Text);
|
||||
}
|
||||
}
|
||||
//只记录数字
|
||||
else if (regexp("[0-9]").match(str)) {
|
||||
if (this.Text.tointeger()< 9999999999999) {
|
||||
if (this.Text == "0") this.Text = str;
|
||||
else this.Text += str;
|
||||
} else this.Text = "9999999999999";
|
||||
}
|
||||
|
||||
//同步数字数据
|
||||
TextObject.SetNumber(this.Text);
|
||||
//每次设置文本时确保光标显示
|
||||
InputCursor.SetVisible(true);
|
||||
InputCursor.Var.TimeFlag <- 0;
|
||||
InputCursor.Var.VisibleFlag <- false;
|
||||
}
|
||||
|
||||
function CreateCursor() {
|
||||
local Canvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(1, 15);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
Canvas.SetFillBrush(sq_RGBA(255, 255, 255, 250));
|
||||
Canvas.SetStrokeBrush(sq_RGBA(255, 255, 255, 250));
|
||||
Canvas.DrawLine(1, 1, 1, 10);
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
Canvas.SetVisible(false);
|
||||
return Canvas;
|
||||
}
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
SetFocus(true);
|
||||
} else {
|
||||
SetFocus(false);
|
||||
}
|
||||
}
|
||||
|
||||
//设置焦点模式
|
||||
function SetFocus(Flag) {
|
||||
IsFocus = Flag;
|
||||
InputCursor.SetVisible(Flag);
|
||||
Sq_SetImmEnabled(Flag);
|
||||
}
|
||||
|
||||
//设置数字
|
||||
function SetNumber(Number) {
|
||||
if (Number< 0) return;
|
||||
this.Text = Number.tostring();
|
||||
TextObject.SetNumber(this.Text);
|
||||
}
|
||||
//获取数字
|
||||
function GetNumber() {
|
||||
return this.Text.tointeger();
|
||||
}
|
||||
}
|
||||
|
|
@ -8,10 +8,8 @@
|
|||
class Yosin_ScrollBar extends Yosin_CommonUi {
|
||||
//控制器
|
||||
Controller = null;
|
||||
|
||||
//是否焦点
|
||||
IsFocus = false;
|
||||
|
||||
//上按钮
|
||||
UpButton = null;
|
||||
//滚动按钮
|
||||
|
|
@ -19,6 +17,9 @@ class Yosin_ScrollBar extends Yosin_CommonUi {
|
|||
//下按钮
|
||||
DownButton = null;
|
||||
|
||||
//滚动条状态
|
||||
ScrollBarState = true;
|
||||
|
||||
//回调函数
|
||||
OnChange = null;
|
||||
|
||||
|
|
@ -41,7 +42,8 @@ class Yosin_ScrollBar extends Yosin_CommonUi {
|
|||
AddUIChild(UpButton);
|
||||
|
||||
//滚动条
|
||||
ScrollButton = Yosin_DragButton(0, 13, 9, S_H, Path, 184, false, false);
|
||||
ScrollButton = Yosin_DragButton(0, 13, 9, S_H, Path, 184, false, false, true);
|
||||
ScrollButton.OnChange = OnChange;
|
||||
ScrollButton.SetMaxMoveValue(Height - 26);
|
||||
AddUIChild(ScrollButton);
|
||||
|
||||
|
|
@ -57,11 +59,62 @@ class Yosin_ScrollBar extends Yosin_CommonUi {
|
|||
|
||||
function Proc(Dt) {
|
||||
base.Proc(Dt);
|
||||
Controller.CurPos = ScrollButton.Detect_Value;
|
||||
if (ScrollButton) Controller.CurPos = ScrollButton.Detect_Value;
|
||||
}
|
||||
|
||||
//设置滚动条长度
|
||||
function SetScrollBarHeight(height) {
|
||||
if (ScrollButton) {
|
||||
RemoveUIChild(ScrollButton);
|
||||
ScrollButton = null;
|
||||
}
|
||||
SetScrollBarState(true);
|
||||
ScrollButton = Yosin_DragButton(0, 13, 9, height.tointeger(), Path, 184, false, false, true);
|
||||
ScrollButton.OnChange = OnChange;
|
||||
ScrollButton.SetMaxMoveValue(Height - 26);
|
||||
AddUIChild(ScrollButton);
|
||||
}
|
||||
|
||||
//设置滚动条状态
|
||||
function SetScrollBarState(Flag) {
|
||||
if (ScrollBarState == Flag) return;
|
||||
ScrollBarState = Flag;
|
||||
if (!Flag) {
|
||||
UpButton.State = 3;
|
||||
DownButton.State = 3;
|
||||
if (ScrollButton) {
|
||||
RemoveUIChild(ScrollButton);
|
||||
ScrollButton = null;
|
||||
}
|
||||
} else {
|
||||
UpButton.State = 0;
|
||||
DownButton.State = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//设置滚动条数值
|
||||
function SetScrollBarValue(Value) {
|
||||
if (ScrollButton) {
|
||||
ScrollButton.SetPos(0, Value * (ScrollButton.Max_Move_Value - ScrollButton.Height + 13))
|
||||
ScrollButton.DragLogic(Value);
|
||||
}
|
||||
}
|
||||
|
||||
//设置滚动
|
||||
function SetScroll(Flag) {
|
||||
if (ScrollButton) {
|
||||
local Value = Controller.CurPos;
|
||||
if (Flag) Value += 0.1;
|
||||
else Value -= 0.1;
|
||||
if (Value< 0) Value = 0;
|
||||
if (Value > 1) Value = 1;
|
||||
ScrollButton.SetPos(0, Value * (ScrollButton.Max_Move_Value - ScrollButton.Height + 13))
|
||||
ScrollButton.DragLogic(Value);
|
||||
}
|
||||
}
|
||||
|
||||
function SetChangeCallBack(Func) {
|
||||
ScrollButton.OnChange = Func;
|
||||
OnChange = Func;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -66,7 +66,7 @@ class _Login_Window extends Yosin_Window {
|
|||
//关闭登录界面
|
||||
NoticeBox.DestroyWindow();
|
||||
DestroyWindow();
|
||||
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1067, 600, 0);
|
||||
Window.Init(PackInfo);
|
||||
Window.BackGroundMusic = this.BackGroundMusic;
|
||||
}.bindenv(this));
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ class _Select_Character_SettingBackground_Object_Window extends Yosin_CommonUi {
|
|||
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
//必须是在框的范围内
|
||||
if (MousePos_Y > Parent.Y && MousePos_Y<(Parent.Y + Parent.Height)) {
|
||||
|
|
@ -214,7 +214,7 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
Charc.SetAnimation("RestAni");
|
||||
Charc.SetPosition(64, 156, 0);
|
||||
Charc.SetName(Info.lv + " 级 " + Info.name);
|
||||
Charc.AnimationManager.Name.MoveBy(21 - Charc.AnimationManager.Name.GetSize().w / 2, 180);
|
||||
Charc.AdditionalItemsManager.Name.MoveBy(0, 170);
|
||||
Addchild(Charc);
|
||||
}
|
||||
|
||||
|
|
@ -227,8 +227,8 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
RectMask.SetVisible(true);
|
||||
} else {
|
||||
|
|
@ -246,8 +246,8 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
//遍历父对象中的所有按钮 还原其他按钮
|
||||
foreach(Button in Parent.UpCharacterList) {
|
||||
|
|
@ -263,8 +263,8 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
MoveFlag = true;
|
||||
M_Xpos = MousePos_X; //原始鼠标位置数据
|
||||
|
|
@ -281,8 +281,8 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (MoveFlag) {
|
||||
|
||||
MoveFlag = false;
|
||||
|
|
@ -462,7 +462,7 @@ class _Select_Character_Window extends Yosin_Window {
|
|||
color = sq_RGBA(186, 147, 97, 255)
|
||||
});
|
||||
CreateButton.OnClick = function(Button) {
|
||||
local Window = Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
local Window = Sq_CreateWindow(_CreateCharacter, "创建角色界面窗口", 0, 0, 1067, 600, 0);
|
||||
Window.ResetFocus();
|
||||
}.bindenv(this);
|
||||
AddUIChild(CreateButton);
|
||||
|
|
|
|||
|
|
@ -22,6 +22,8 @@ class _Yosin_MessageBox extends Yosin_Window {
|
|||
|
||||
titleTextActor = null;
|
||||
messageTextActor = null;
|
||||
//确认回调函数
|
||||
OnConfirm = null;
|
||||
|
||||
constructor(message, gX = 418, gY = 200, info = {
|
||||
// 标题
|
||||
|
|
@ -74,12 +76,12 @@ class _Yosin_MessageBox extends Yosin_Window {
|
|||
function RegisterWidget() {
|
||||
|
||||
//背景
|
||||
local background = Yosin_NineBoxStretch( cacheW + 1, cacheH, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
local background = Yosin_NineBoxStretch(cacheW + 1, cacheH, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
background.SetPosition(-1, 15);
|
||||
Addchild(background);
|
||||
|
||||
//文字背景
|
||||
local twoBackground = Yosin_NineBoxStretch( cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
local twoBackground = Yosin_NineBoxStretch(cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
twoBackground.SetPosition(4, 20);
|
||||
Addchild(twoBackground);
|
||||
|
||||
|
|
@ -93,7 +95,7 @@ class _Yosin_MessageBox extends Yosin_Window {
|
|||
local BackgroundBrightSize = BackgroundBright.GetSize();
|
||||
local scaleW = (cacheW / BackgroundBrightSize.w).tofloat();
|
||||
BackgroundBright.SetScale(scaleW, 1);
|
||||
BackgroundBright.SetPosition( 0, 1);
|
||||
BackgroundBright.SetPosition(0, 1);
|
||||
Addchild(BackgroundBright);
|
||||
|
||||
//确认按钮
|
||||
|
|
@ -101,11 +103,14 @@ class _Yosin_MessageBox extends Yosin_Window {
|
|||
confirmButton.OnClick = function(Button) {
|
||||
//关闭本窗口
|
||||
DestroyWindow();
|
||||
if (OnConfirm) OnConfirm();
|
||||
}.bindenv(this);
|
||||
AddUIChild(confirmButton);
|
||||
|
||||
// 绘制标题
|
||||
local confirmTextActor = FontAssetManager.GenerateNormal("确认", sq_RGBA(206, 189, 140, 255), true);
|
||||
local confirmTextActor = FontAssetManager.GenerateNormal("确认", true, {
|
||||
color = sq_RGBA(206, 189, 140, 255)
|
||||
});
|
||||
confirmTextActor.SetPosition(17, 6);
|
||||
confirmButton.Addchild(confirmTextActor);
|
||||
|
||||
|
|
@ -137,6 +142,10 @@ class _Yosin_MessageBox extends Yosin_Window {
|
|||
|
||||
}
|
||||
|
||||
//设置确认回调函数
|
||||
function SetOnConfirmFunc(OnConfirm) {
|
||||
this.OnConfirm = OnConfirm;
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,197 @@
|
|||
/*
|
||||
文件名:234_HUD_FuncInter.nut
|
||||
路径:User/UI/Window/234_HUD_FuncInter.nut
|
||||
创建日期:2025-01-29 13:35
|
||||
文件用途:NPC 与 玩家 功能交互
|
||||
*/
|
||||
_NameSpace_FunctionInteractive <- {};
|
||||
class _NameSpace_FunctionInteractive._InteractiveButton extends Yosin_CommonUi {
|
||||
//按钮状态
|
||||
State = 0;
|
||||
Sprite = null;
|
||||
SpriteState = -1;
|
||||
|
||||
Info = null;
|
||||
FramePath = "sprite/interface2/popup_menu/popup_back.img";
|
||||
FrameList = null;
|
||||
RoleTextActor = null;
|
||||
|
||||
Role = null;
|
||||
RoleValue = null;
|
||||
|
||||
|
||||
constructor(RoleName, RoleValue) {
|
||||
this.Role = RoleName;
|
||||
this.RoleValue = RoleValue;
|
||||
base.constructor(0, 0, 100, 21);
|
||||
if (AssetManager.EtcConfig.NpcRole.rawin(RoleName)) {
|
||||
Info = AssetManager.EtcConfig.NpcRole[RoleName];
|
||||
Init();
|
||||
} else {
|
||||
error("NPC 功能交互 功能错误");
|
||||
}
|
||||
}
|
||||
|
||||
function Init() {
|
||||
FrameList = [];
|
||||
//基础态
|
||||
FrameList.push(CL_SpriteFrameObject(this.FramePath, 0));
|
||||
//悬停态
|
||||
FrameList.push(CL_SpriteFrameObject(this.FramePath, Info.imgidx * 2 + 1));
|
||||
//按下态
|
||||
FrameList.push(CL_SpriteFrameObject(this.FramePath, Info.imgidx * 2 + 2));
|
||||
|
||||
Sprite = CL_SpriteObject();
|
||||
Addchild(Sprite);
|
||||
|
||||
//绘制功能图标
|
||||
local RoleIconActor = CL_SpriteObject("sprite/interface2/popup_menu/popup_icon_" + Info.iconpath + ".img", Info.iconidx);
|
||||
RoleIconActor.SetZOrder(1);
|
||||
Addchild(RoleIconActor);
|
||||
|
||||
//功能文本
|
||||
RoleTextActor = FontAssetManager.GenerateNormal(Info.name, true, {
|
||||
color = Info.namecolor
|
||||
});
|
||||
RoleTextActor.SetPosition(18 + (82 - RoleTextActor.GetSize().w) / 2, 1);
|
||||
RoleTextActor.SetZOrder(1);
|
||||
Addchild(RoleTextActor);
|
||||
|
||||
OnClick = function(Btn) {
|
||||
_NameSpace_FunctionInteractive[Role](RoleValue);
|
||||
};
|
||||
}
|
||||
|
||||
function ChangeFrame() {
|
||||
//状态更改 刷新精灵帧
|
||||
if (State != SpriteState) {
|
||||
//按下时 文本下移
|
||||
if (State == 2) {
|
||||
RoleTextActor.MoveBy(0, 1);
|
||||
} else if (SpriteState == 2) {
|
||||
RoleTextActor.MoveBy(0, -1);
|
||||
}
|
||||
SpriteState = State;
|
||||
Sprite.SetFrame(FrameList[SpriteState]);
|
||||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
//窗口主类
|
||||
class _NameSpace_FunctionInteractive._FunctionInteractive extends Yosin_Window {
|
||||
|
||||
NpcInfo = null;
|
||||
|
||||
//顶层窗口
|
||||
IsTop = true;
|
||||
|
||||
//生成器 如果这个窗口开着就刷新一下位置 如果没有就生成一个
|
||||
function Generator(Id, Xpos, Ypos) {
|
||||
local RealId = "NPC交互窗口" + Id;
|
||||
foreach(Index, WindowObj in _SYS_WINDOW_LIST_) {
|
||||
if (WindowObj.ObjectId == RealId) {
|
||||
WindowObj.SetPosition(Xpos, Ypos);
|
||||
WindowObj.ResetFocus();
|
||||
return WindowObj;
|
||||
}
|
||||
}
|
||||
return _NameSpace_FunctionInteractive._FunctionInteractive(Id, Xpos, Ypos);
|
||||
}
|
||||
|
||||
//构造函数
|
||||
constructor(Id, Xpos, Ypos) {
|
||||
//获取npc数据
|
||||
NpcInfo = AssetManager.GetNpc(Id);
|
||||
//获取npc功能数量
|
||||
local NpcFuncCount = NpcInfo.role.len();
|
||||
|
||||
// 默认构造数据 NpcFuncCount 要+1 因为还有他自己的头像
|
||||
base.constructor("NPC交互窗口" + Id, Xpos, Ypos, 100, (NpcFuncCount + 1) * 21, 0);
|
||||
ResetFocus();
|
||||
// OpenDeBug();
|
||||
|
||||
// 初始化窗口
|
||||
InitWindow();
|
||||
}
|
||||
|
||||
// 初始化窗口
|
||||
function InitWindow() {
|
||||
local Header = CL_SpriteObject("sprite/interface2/popup_menu/popup_back.img", 0);
|
||||
Addchild(Header);
|
||||
|
||||
//NPC头像
|
||||
local NpcFace = CL_SpriteObject(NpcInfo["popup_face"].img, NpcInfo["popup_face"].idx);
|
||||
Addchild(NpcFace);
|
||||
|
||||
//NPC名字
|
||||
local NpcNameTextActor = FontAssetManager.GenerateNormal(NpcInfo.name, true, {
|
||||
color = sq_RGBA(231, 199, 156, 250)
|
||||
});
|
||||
NpcNameTextActor.SetPosition(18 + (82 - NpcNameTextActor.GetSize().w) / 2, 1);
|
||||
NpcNameTextActor.SetZOrder(1);
|
||||
Addchild(NpcNameTextActor);
|
||||
|
||||
|
||||
local pos = 1;
|
||||
foreach(Role, Value in NpcInfo.role) {
|
||||
local Buffer = _NameSpace_FunctionInteractive._InteractiveButton(Role, Value);
|
||||
Buffer.SetPosition(0, pos * 21)
|
||||
AddUIChild(Buffer);
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//点到自己 先执行子类Button的事件 在关闭自己
|
||||
base.OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
CloseWindow();
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!WindowInteractiveFlag) base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
else CloseWindow();
|
||||
//没点到自己直接关闭
|
||||
if (!Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, X, Y, Width, Height)) CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//NPC商店回调
|
||||
_NameSpace_FunctionInteractive["item shop"] <- function(Value) {
|
||||
//判断是否生成过
|
||||
foreach(Index, WindowObj in _SYS_WINDOW_LIST_) {
|
||||
if (WindowObj.ObjectId == "NPC商店") {
|
||||
WindowObj.ResetFocus();
|
||||
ClientCharacterInventory.ResetFocus();
|
||||
return;
|
||||
}
|
||||
}
|
||||
//生成窗口
|
||||
local WindowObj = UISpace_NpcShop.Shop("NPC商店", 130, 63, 366, 486, 20);
|
||||
WindowObj.Init(Value);
|
||||
WindowObj.ResetFocus();
|
||||
ClientCharacterInventory.ResetFocus();
|
||||
}
|
||||
|
|
@ -0,0 +1,104 @@
|
|||
/*
|
||||
文件名:235_HUD_QuantityInput.nut
|
||||
路径:User/UI/Window/235_HUD_QuantityInput.nut
|
||||
创建日期:2025-02-07 20:24
|
||||
文件用途:数量输入
|
||||
*/
|
||||
class _QuantityInput extends Yosin_Window {
|
||||
|
||||
InputBox = null;
|
||||
//确认回调函数
|
||||
OnConfirm = null;
|
||||
|
||||
constructor(Xpos, Ypos) {
|
||||
// 默认构造数据
|
||||
base.constructor("数量输入交互窗口" + clock(), Xpos, Ypos, 176, 72, 0);
|
||||
ResetFocus();
|
||||
Init();
|
||||
}
|
||||
|
||||
|
||||
function Init() {
|
||||
//背景
|
||||
local Bg = Yosin_NineBoxStretch(178, 75, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
Addchild(Bg);
|
||||
|
||||
//聊天输入框
|
||||
InputBox = Yosin_NumberInputBox(94, 20);
|
||||
InputBox.SetPosition(43, 16);
|
||||
AddUIChild(InputBox);
|
||||
|
||||
//数量提示文字
|
||||
local TextObject = FontAssetManager.GenerateNormal("数量:", false, {
|
||||
color = sq_RGBA(255, 227, 171, 250)
|
||||
});
|
||||
TextObject.SetPosition(11, 16);
|
||||
Addchild(TextObject);
|
||||
|
||||
//加号按钮
|
||||
local AddButton = Yosin_BaseButton(140, 12, 26, 14, "sprite/interface/lenheartwindowcommon.img", 496);
|
||||
AddButton.DownSimulateOffset = false;
|
||||
AddUIChild(AddButton);
|
||||
AddButton.OnClick = function(btn) {
|
||||
InputBox.SetNumber(InputBox.GetNumber() + 10);
|
||||
InputBox.SetFocus(true);
|
||||
}.bindenv(this);
|
||||
|
||||
//减号按钮
|
||||
local SubButton = Yosin_BaseButton(140, 28, 26, 14, "sprite/interface/lenheartwindowcommon.img", 499);
|
||||
SubButton.DownSimulateOffset = false;
|
||||
AddUIChild(SubButton);
|
||||
SubButton.OnClick = function(btn) {
|
||||
InputBox.SetNumber(InputBox.GetNumber() - 10);
|
||||
InputBox.SetFocus(true);
|
||||
}.bindenv(this);
|
||||
|
||||
//确认按钮
|
||||
local confirmButton = Yosin_BaseButton(28, 42, 56, 24 "sprite/interface/lenheartwindowcommon.img", 12);
|
||||
confirmButton.OnClick = function(Button) {
|
||||
//关闭本窗口
|
||||
DestroyWindow();
|
||||
if (OnConfirm) OnConfirm(InputBox.GetNumber().tointeger());
|
||||
}.bindenv(this);
|
||||
AddUIChild(confirmButton);
|
||||
// 绘制标题
|
||||
local confirmTextActor = FontAssetManager.GenerateNormal("确认", false, {
|
||||
color = sq_RGBA(185, 148, 96, 255)
|
||||
});
|
||||
confirmTextActor.SetPosition(16, 2);
|
||||
confirmButton.Addchild(confirmTextActor);
|
||||
|
||||
//取消按钮
|
||||
local cancelButton = Yosin_BaseButton(88, 42, 56, 24 "sprite/interface/lenheartwindowcommon.img", 12);
|
||||
cancelButton.OnClick = function(Button) {
|
||||
//关闭本窗口
|
||||
DestroyWindow();
|
||||
}.bindenv(this);
|
||||
AddUIChild(cancelButton);
|
||||
// 绘制标题
|
||||
local cancelTextActor = FontAssetManager.GenerateNormal("取消", false, {
|
||||
color = sq_RGBA(185, 148, 96, 255)
|
||||
});
|
||||
cancelTextActor.SetPosition(16, 2);
|
||||
cancelButton.Addchild(cancelTextActor);
|
||||
}
|
||||
|
||||
//设置确认回调函数
|
||||
function SetOnConfirmFunc(OnConfirm) {
|
||||
this.OnConfirm = OnConfirm;
|
||||
}
|
||||
|
||||
//ovverride
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (!Visible) return;
|
||||
if (InputBox.IsFocus) {
|
||||
if (Wheel > 0) {
|
||||
InputBox.SetNumber(InputBox.GetNumber() + 1);
|
||||
} else {
|
||||
InputBox.SetNumber(InputBox.GetNumber() - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -259,7 +259,7 @@ class _CreateCharacter extends Yosin_Window {
|
|||
DestroyWindow();
|
||||
MySocket.Send(PACKET_ID.QUERY_CHARACTER_LIST, null);
|
||||
|
||||
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1067, 600, 0);
|
||||
Window.AddUpCharacter(TempCharacter);
|
||||
} else {
|
||||
// 创建失败.
|
||||
|
|
@ -788,10 +788,10 @@ class _create_Character_enterName extends Yosin_Window {
|
|||
name = null;
|
||||
|
||||
constructor() {
|
||||
base.constructor("输入角色名称", 0, 0, 1066, 600, 0);
|
||||
base.constructor("输入角色名称", 0, 0, 1067, 600, 0);
|
||||
|
||||
//背景
|
||||
local background = Yosin_NineBoxStretch( 240, 140, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
local background = Yosin_NineBoxStretch(240, 140, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
background.SetPosition(413, 228);
|
||||
Addchild(background);
|
||||
|
||||
|
|
|
|||
|
|
@ -32,10 +32,10 @@ class _Top_tool extends Yosin_Window {
|
|||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
local background = Yosin_EmeStretch( 650, 20, "sprite/interface/lenheartwindowcommon.img", 612);
|
||||
local background = Yosin_EmeStretch(650, 20, "sprite/interface/lenheartwindowcommon.img", 612);
|
||||
Addchild(background);
|
||||
|
||||
local timeBackGround = Yosin_EmeStretch( 90, 14, "sprite/interface/lenheartwindowcommon.img", 615);
|
||||
local timeBackGround = Yosin_EmeStretch(90, 14, "sprite/interface/lenheartwindowcommon.img", 615);
|
||||
timeBackGround.SetPosition(14, 2);
|
||||
Addchild(timeBackGround);
|
||||
|
||||
|
|
@ -110,8 +110,8 @@ class _Top_tool extends Yosin_Window {
|
|||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
//设定拖动逻辑
|
||||
if (WindowMoveFlag) {
|
||||
|
|
@ -132,8 +132,8 @@ class _Top_tool extends Yosin_Window {
|
|||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//如果点击事件在窗口内
|
||||
if (Math.IsIntersectRect(Yosin_Cursor.X, Yosin_Cursor.Y, 1, 1, X, Y, Width, Height)) {
|
||||
WindowMoveFlag = true;
|
||||
|
|
@ -149,9 +149,9 @@ class _Top_tool extends Yosin_Window {
|
|||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (WindowMoveFlag) {
|
||||
WindowMoveFlag = false;
|
||||
M_Xpos = null;
|
||||
|
|
|
|||
|
|
@ -5,11 +5,21 @@
|
|||
文件用途: 个人信息窗口
|
||||
*/
|
||||
|
||||
// local infoWindow = Sq_CreateWindow(_PersonalInfo, "个人信息窗口", 250, 60, 286, 530, 20);
|
||||
class _PersonalInfo extends Yosin_Window {
|
||||
//个人信息命名空间
|
||||
UISpace_PersonalInfo <- {};
|
||||
class UISpace_PersonalInfo._PersonalInfo extends Yosin_Window {
|
||||
|
||||
//分页集合 0角色 1装扮 2护石
|
||||
PageList = null;
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
function _typeof() {
|
||||
return "Game_Window";
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
PageList = [];
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
local title = Yosin_TopTitle(gWidth, gHeight, "个人信息(M)");
|
||||
|
|
@ -17,22 +27,49 @@ class _PersonalInfo extends Yosin_Window {
|
|||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
RegisterPage();
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_STATUS_WINDOW, function(Flag) {
|
||||
//按下的时候
|
||||
if (Flag == 1) {
|
||||
//如果窗口已经打开
|
||||
if (this.Visible) {
|
||||
//关闭窗口
|
||||
CloseWindow();
|
||||
} else {
|
||||
//打开窗口
|
||||
ResetFocus();
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
|
||||
// 标题按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, 266, ["角色", "装扮/宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, 266, ["角色", "装扮", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
};
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {};
|
||||
|
||||
//关闭按钮
|
||||
local closeBtn = Yosin_BaseButton(Width - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||
closeBtn.DownSimulateOffset = false;
|
||||
closeBtn.SetZOrder(1);
|
||||
closeBtn.OnClick = function(btn) {
|
||||
CloseWindow();
|
||||
}.bindenv(this);
|
||||
AddUIChild(closeBtn);
|
||||
|
||||
// 角色信息
|
||||
local roleInfo = roleInfoPage(10, titlesBtn.bottom() + 2 );
|
||||
AddUIChild(roleInfo);
|
||||
}
|
||||
|
||||
function RegisterPage() {
|
||||
//角色信息页
|
||||
local RoleInfo = UISpace_PersonalInfo.RoleInfoPage(10, 48);
|
||||
AddUIChild(RoleInfo);
|
||||
PageList.push(RoleInfo);
|
||||
}
|
||||
|
||||
|
||||
//逻辑入口
|
||||
|
|
@ -41,5 +78,16 @@ class _PersonalInfo extends Yosin_Window {
|
|||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//刷新个人信息
|
||||
function RefreshPersonalInfo() {
|
||||
PageList[0].Refresh();
|
||||
PageList[0].CharactersObject.InitCharacter();
|
||||
}
|
||||
|
||||
|
||||
//在Esc按下时
|
||||
function OnEsc() {
|
||||
CloseWindow();
|
||||
}
|
||||
}
|
||||
|
|
@ -1,451 +0,0 @@
|
|||
|
||||
/*
|
||||
文件名:Personalinfo_RoleInfoPage.nut
|
||||
路径:User/UI/Window/4_Personalinfo/Personalinfo_RoleInfoPage.nut
|
||||
创建日期:2025-01-09 13:51
|
||||
文件用途: 个人信息-角色信息页面
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// 角色信息
|
||||
class roleInfoPage extends Yosin_CommonUi {
|
||||
|
||||
brown = sq_RGBA(160, 132, 75, 255);
|
||||
green = sq_RGBA(74, 161, 87, 255);
|
||||
|
||||
Canvas = null;
|
||||
|
||||
constructor(gX, gY) {
|
||||
local w = 266;
|
||||
local h = 465;
|
||||
base.constructor( gX, gY, w, h);
|
||||
|
||||
|
||||
// 创建画布
|
||||
Canvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
// 绘制
|
||||
DrawWidget();
|
||||
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(Canvas);
|
||||
|
||||
|
||||
// 名称变更记录按钮
|
||||
local nameChangeRecordBtn = Yosin_BaseButton(70, 7, 18, 17, "sprite/interface/newstyle/windows/inventory/inventory.img", 106);
|
||||
nameChangeRecordBtn.DownSimulateOffset = false;
|
||||
AddUIChild(nameChangeRecordBtn);
|
||||
|
||||
// 底部四个按钮
|
||||
RegisterBottomButton();
|
||||
}
|
||||
|
||||
function DrawWidget() {
|
||||
// 背景
|
||||
local backGround = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 60);
|
||||
Canvas.DrawSpriteFrame(backGround, 0, 0);
|
||||
|
||||
// 上半部分 装备展示
|
||||
local equipment = Personalinfo_CharactersEquipment();
|
||||
Canvas.DrawSprite(equipment);
|
||||
|
||||
// 名称 等级 其他
|
||||
RegisterNameAndOther();
|
||||
// 属性
|
||||
RegisterPropertyItems();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 名称 等级 其他
|
||||
function RegisterNameAndOther() {
|
||||
|
||||
// 名称
|
||||
local nameY = 130;
|
||||
local name = FontAssetManager.GenerateNormal("账号名称", true, {
|
||||
color = sq_RGBA(161, 240, 163, 255)
|
||||
});
|
||||
Canvas.DrawActor(name, Width / 2 - name.GetSize().w / 2, nameY);
|
||||
// 等级
|
||||
local level = FontAssetManager.GenerateNormal("2级 角色名称", true, {
|
||||
color = green
|
||||
});
|
||||
Canvas.DrawActor(level, Width / 2 - level.GetSize().w / 2, nameY + 15);
|
||||
|
||||
// 角色定位
|
||||
local jobType = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 74);
|
||||
|
||||
// 职业
|
||||
local job = FontAssetManager.GenerateNormal("[剑魂]", true, {
|
||||
color = brown
|
||||
});
|
||||
|
||||
local jobSize = job.GetSize();
|
||||
local iconX = Width / 2 - (jobSize.w + 12) / 2;
|
||||
Canvas.DrawSpriteFrame(jobType, iconX, nameY + 33);
|
||||
Canvas.DrawActor(job, iconX + 12, nameY + 30);
|
||||
|
||||
|
||||
|
||||
|
||||
// 冒险家名望Icon
|
||||
local adventurerFameY = 187;
|
||||
local adventurerFameX = 70;
|
||||
local adventurerFame = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", 53);
|
||||
local adventurerFameRight = adventurerFameX + adventurerFame.GetSize().w;
|
||||
|
||||
Canvas.DrawSpriteFrame(adventurerFame, adventurerFameX, adventurerFameY);
|
||||
|
||||
|
||||
// 冒险家名望
|
||||
local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, {
|
||||
color = brown
|
||||
});
|
||||
local adventurerFameTextRight = adventurerFameRight + 5 + adventurerFameText.GetSize().w;
|
||||
|
||||
Canvas.DrawActor(adventurerFameText, adventurerFameRight + 5, 185);
|
||||
|
||||
// 冒险家名望数值
|
||||
local adventurerFameNum = FontAssetManager.GenerateNormal("7", true, {
|
||||
color = green
|
||||
});
|
||||
Canvas.DrawActor(adventurerFameNum, adventurerFameTextRight + 5, 185);
|
||||
}
|
||||
|
||||
|
||||
// 属性
|
||||
function RegisterPropertyItems() {
|
||||
// 属性
|
||||
|
||||
local leftListX = 0;
|
||||
local rightListX = 132;
|
||||
local rowY = 213;
|
||||
local rowH = 18;
|
||||
|
||||
// 生命
|
||||
local life = roleInfoPropertyItem( 0, "生命", "100");
|
||||
Canvas.DrawSprite(life, leftListX, rowY);
|
||||
// 魔法
|
||||
local magic = roleInfoPropertyItem( 1, "魔法", "100");
|
||||
Canvas.DrawSprite(magic, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理防御力
|
||||
local physicalDefense = roleInfoPropertyItem(8, "物理防御力", "100", false);
|
||||
Canvas.DrawSprite(physicalDefense, leftListX, rowY);
|
||||
|
||||
// 魔法防御力
|
||||
local magicDefense = roleInfoPropertyItem( 9, "魔法防御力", "100");
|
||||
Canvas.DrawSprite(magicDefense, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 力量
|
||||
local strength = roleInfoPropertyItem( 2, "力量", "100");
|
||||
Canvas.DrawSprite(strength, leftListX, rowY);
|
||||
// 智力
|
||||
local intelligence = roleInfoPropertyItem( 3, "智力", "100");
|
||||
Canvas.DrawSprite(intelligence, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 体力
|
||||
local vitality = roleInfoPropertyItem( 4, "体力", "100");
|
||||
Canvas.DrawSprite(vitality, leftListX, rowY);
|
||||
// 精神
|
||||
local spirit = roleInfoPropertyItem( 5, "精神", "100");
|
||||
Canvas.DrawSprite(spirit, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理攻击力
|
||||
local physicalATK = roleInfoPropertyItem( 6, "物理攻击力", "100");
|
||||
Canvas.DrawSprite(physicalATK, leftListX, rowY);
|
||||
// 魔法攻击力
|
||||
local magicATK = roleInfoPropertyItem( 7, "魔法攻击力", "100");
|
||||
Canvas.DrawSprite(magicATK, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理暴击
|
||||
local physicalCrit = roleInfoPropertyItem( 10, "物理暴击", "100");
|
||||
Canvas.DrawSprite(physicalCrit, leftListX, rowY);
|
||||
// 魔法暴击
|
||||
local magicCrit = roleInfoPropertyItem( 11, "魔法暴击", "100");
|
||||
Canvas.DrawSprite(magicCrit, rightListX, rowY);
|
||||
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 独立攻击
|
||||
local independentAttack = roleInfoPropertyItem( 12, "独立攻击", "100");
|
||||
Canvas.DrawSprite(independentAttack, leftListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 攻击速度
|
||||
local attackSpeed = roleInfoPropertyItem(13, "攻击速度", "100");
|
||||
Canvas.DrawSprite(attackSpeed, leftListX, rowY);
|
||||
|
||||
// 释放速度
|
||||
local releaseSpeed = roleInfoPropertyItem( 14, "释放速度", "100");
|
||||
Canvas.DrawSprite(releaseSpeed, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 移动速度
|
||||
local moveSpeed = roleInfoPropertyItem( 15, "移动速度", "100");
|
||||
Canvas.DrawSprite(moveSpeed, leftListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 攻击属性
|
||||
local attackProperty = roleInfoPropertyItem(16, "攻击属性", "火(0)/冰(0)/光(0)/暗(0)", true, 260);
|
||||
Canvas.DrawSprite(attackProperty, leftListX, rowY);
|
||||
}
|
||||
|
||||
|
||||
// 底部四个按钮
|
||||
function RegisterBottomButton() {
|
||||
// 副职业
|
||||
local subJob = otherButton(0, 401, 62, "副职业", false);
|
||||
AddUIChild(subJob);
|
||||
subJob.OnClick = function (btn) {
|
||||
//todo 打开副职业面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separation = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 );
|
||||
separation.SetPosition(subJob.right(), subJob.Y + 7.5);
|
||||
Addchild(separation);
|
||||
|
||||
// 战斗分析
|
||||
local battleAnalysis = otherButton(subJob.right() + 1, subJob.Y, 64, "战斗分析");
|
||||
AddUIChild(battleAnalysis);
|
||||
battleAnalysis.OnClick = function (btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separationOne = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 );
|
||||
separationOne.SetPosition(battleAnalysis.right(), battleAnalysis.Y + 7.5);
|
||||
Addchild(separationOne);
|
||||
|
||||
// 决斗信息 // 根据决斗场等级 显示 sprite/interface2/pvp02/pvprank_icon/tier_icon.img 24
|
||||
local duelInfo = otherButton(battleAnalysis.right() + 1, battleAnalysis.Y, 14, "决斗信息", true);
|
||||
AddUIChild(duelInfo);
|
||||
duelInfo.OnClick = function (btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separationTwo = CL_SpriteObject("sprite/interface2/profile/profile.img", 70 );
|
||||
separationTwo.SetPosition(duelInfo.right(), duelInfo.Y + 7.5);
|
||||
Addchild(separationTwo);
|
||||
|
||||
// 详细信息
|
||||
local detailedInformation = otherButton(duelInfo.right() + 1, duelInfo.Y, 66, "详细信息");
|
||||
AddUIChild(detailedInformation);
|
||||
detailedInformation.OnClick = function (btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 属性项
|
||||
class roleInfoPropertyItem extends CL_CanvasObject {
|
||||
|
||||
// additionReaction 属性是否有加成 加成为绿色 不加成灰色
|
||||
constructor(idx, title, numText, additionReaction = true, width = 125) {
|
||||
local w = width;
|
||||
local h = 18;
|
||||
base.constructor();
|
||||
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, 18);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
local titlecolor = additionReaction ? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
local numColor = additionReaction ? sq_RGBA(75, 161, 85, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
|
||||
local iconX = 5;
|
||||
local icon = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", idx);
|
||||
local iconRight = iconX + icon.GetSize().w;
|
||||
DrawSpriteFrame(icon, iconX, h/ 2 - icon.GetSize().h / 2);
|
||||
|
||||
|
||||
// 属性名称
|
||||
local property = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = titlecolor
|
||||
});
|
||||
DrawActor(property, iconRight + 5, 0);
|
||||
|
||||
// 属性数值
|
||||
local propertyNum = FontAssetManager.GenerateNormal(numText, true, {
|
||||
color = numColor
|
||||
});
|
||||
local numX = w - propertyNum.GetSize().w;
|
||||
DrawActor(propertyNum, numX, 0);
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 其他面板按钮
|
||||
class otherButton extends Yosin_CommonUi {
|
||||
|
||||
// 是否启用按钮
|
||||
enabled = true;
|
||||
|
||||
iconX = null;
|
||||
iconY = null;
|
||||
icon = null;
|
||||
|
||||
// pvp 是否是pvp 按钮
|
||||
constructor(gX, gY, idx, title, pvp = false, enabled = true, ) {
|
||||
base.constructor(gX, gY, 65, 65);
|
||||
|
||||
this.enabled = enabled;
|
||||
|
||||
local titlecolor = enabled? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
// 属性名称
|
||||
local property = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = titlecolor
|
||||
});
|
||||
property.SetPosition( 32 - property.GetSize().w / 2 , 45 );
|
||||
Addchild(property);
|
||||
|
||||
local path = pvp? "sprite/interface2/profile/profile_pvp_icon.img" : "sprite/interface2/profile/profile.img";
|
||||
icon = CL_SpriteObject(path, enabled ? idx : idx +1 );
|
||||
|
||||
iconX = 32 - icon.GetSize().w / 2;
|
||||
iconY = 45 / 2 - icon.GetSize().h / 2 + 3;
|
||||
icon.SetPosition( iconX , iconY );
|
||||
Addchild(icon);
|
||||
|
||||
}
|
||||
|
||||
function Proc(DT) {
|
||||
if (isLBDown){
|
||||
icon.SetPosition( iconX , iconY + 1 );
|
||||
}else{
|
||||
icon.SetPosition( iconX , iconY );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// 上半部分 人物装备穿戴
|
||||
class Personalinfo_CharactersEquipment extends CL_CanvasObject {
|
||||
|
||||
// 展示其他装备
|
||||
showOtherEquipment = null;
|
||||
// 允许更换装备
|
||||
allowChangeEquipment = null;
|
||||
// // 画布
|
||||
// Canvas = null;
|
||||
|
||||
constructor() {
|
||||
local w = 248;
|
||||
local h = 179;
|
||||
base.constructor();
|
||||
|
||||
showOtherEquipment = true;
|
||||
allowChangeEquipment = false;
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, h);
|
||||
// 设置填充画刷 用于绘制边框和线条
|
||||
// Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
||||
// 设置轮廓画刷 用于绘制边框和线条
|
||||
// Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
// 绘制背景
|
||||
DrawBackground(w);
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
|
||||
// 背景
|
||||
function DrawBackground(Width) {
|
||||
|
||||
// 装备栏背景
|
||||
local equipmentBackground = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21);
|
||||
DrawSpriteFrame(equipmentBackground, 5, 5);
|
||||
|
||||
|
||||
// 顶部光线
|
||||
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||
DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||||
|
||||
// todo 角色展示
|
||||
|
||||
// 结婚戒指槽位
|
||||
local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||||
DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||||
|
||||
// todo 根据是否装备 显示装备
|
||||
if (showOtherEquipment) {
|
||||
// 辅助装备
|
||||
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
||||
DrawSpriteFrame(assist, 179, 69);
|
||||
|
||||
// 耳环
|
||||
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
||||
DrawSpriteFrame(earrings, 179, 102);
|
||||
|
||||
// 魔法石
|
||||
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
||||
DrawSpriteFrame(MagicStone, 211, 101);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// Window.RemoveSelf();
|
||||
// }
|
||||
// TestStage();
|
||||
// }
|
||||
|
|
@ -0,0 +1,626 @@
|
|||
/*
|
||||
文件名:RoleInfoPage.nut
|
||||
路径:User/UI/Window/4_Personalinfo/RoleInfoPage.nut
|
||||
创建日期:2025-02-15 02:03
|
||||
文件用途:
|
||||
*/
|
||||
|
||||
|
||||
|
||||
// 角色信息
|
||||
class UISpace_PersonalInfo.RoleInfoPage extends Yosin_CommonUi {
|
||||
|
||||
w = 266;
|
||||
h = 465;
|
||||
|
||||
brown = sq_RGBA(160, 132, 75, 255);
|
||||
green = sq_RGBA(74, 161, 87, 255);
|
||||
|
||||
CanvasObj = null;
|
||||
|
||||
CharactersObject = null;
|
||||
|
||||
constructor(gX, gY) {
|
||||
base.constructor(gX, gY, w, h);
|
||||
|
||||
//背景
|
||||
local BackGround = CL_SpriteObject("sprite/interface2/profile/profile.img", 60);
|
||||
BackGround.SetZOrder(-2);
|
||||
Addchild(BackGround);
|
||||
|
||||
|
||||
// 上半部分 装备展示
|
||||
CharactersObject = UISpace_PersonalInfo.CharactersEquipment();
|
||||
CharactersObject.SetPosition(0, 0);
|
||||
CharactersObject.SetZOrder(-1);
|
||||
AddUIChild(CharactersObject);
|
||||
|
||||
Refresh();
|
||||
|
||||
|
||||
// // 名称变更记录按钮
|
||||
// local nameChangeRecordBtn = Yosin_BaseButton(70, 7, 18, 17, "sprite/interface/newstyle/windows/inventory/inventory.img", 106);
|
||||
// nameChangeRecordBtn.DownSimulateOffset = false;
|
||||
// AddUIChild(nameChangeRecordBtn);
|
||||
|
||||
// 底部四个按钮
|
||||
RegisterBottomButton();
|
||||
}
|
||||
|
||||
//刷新
|
||||
function Refresh() {
|
||||
// 创建画布
|
||||
if (CanvasObj) Removechild(CanvasObj);
|
||||
CanvasObj = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
CanvasObj.ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
CanvasObj.BeginDraw();
|
||||
|
||||
// 绘制
|
||||
DrawWidget();
|
||||
|
||||
// 结束绘制
|
||||
CanvasObj.EndDraw();
|
||||
Addchild(CanvasObj);
|
||||
|
||||
//刷新装备 如果背包对象存在
|
||||
if (ClientCharacterInventory) {
|
||||
local Slot = ClientCharacterInventory.PageList[0].CharactersObject.EquipmentSlot;
|
||||
foreach(Index, SlotObj in Slot) {
|
||||
if (SlotObj.Item) CharactersObject.SetEquipment(Index, SlotObj.Item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function DrawWidget() {
|
||||
// 名称 等级 其他
|
||||
RegisterNameAndOther();
|
||||
// 属性
|
||||
RegisterPropertyItems();
|
||||
|
||||
}
|
||||
|
||||
// 名称 等级 其他
|
||||
function RegisterNameAndOther() {
|
||||
//获取角色
|
||||
local Chr = ClientCharacter ? ClientCharacter : null;
|
||||
if (!Chr) return;
|
||||
|
||||
// 名称
|
||||
local nameY = 130;
|
||||
local name = FontAssetManager.GenerateNormal("暂无冒险团", true, {
|
||||
color = sq_RGBA(161, 240, 163, 255)
|
||||
});
|
||||
CanvasObj.DrawActor(name, Width / 2 - name.GetSize().w / 2, nameY);
|
||||
// 等级
|
||||
local level = FontAssetManager.GenerateNormal(format("%d级 %s", Chr.Level, Chr.Name), true, {
|
||||
color = green
|
||||
});
|
||||
CanvasObj.DrawActor(level, Width / 2 - level.GetSize().w / 2, nameY + 15);
|
||||
|
||||
// 角色定位
|
||||
local jobType = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 74);
|
||||
|
||||
// 职业
|
||||
local job = FontAssetManager.GenerateNormal(format("[%s]", Chr.Info.Attribute[Chr.GrowJob].name), true, {
|
||||
color = brown
|
||||
});
|
||||
|
||||
local jobSize = job.GetSize();
|
||||
local iconX = Width / 2 - (jobSize.w + 12) / 2;
|
||||
|
||||
CanvasObj.DrawSpriteFrame(jobType, iconX, nameY + 33);
|
||||
CanvasObj.DrawActor(job, iconX + 12, nameY + 30);
|
||||
|
||||
|
||||
|
||||
|
||||
// 冒险家名望Icon
|
||||
local adventurerFameY = 187;
|
||||
local adventurerFameX = 70;
|
||||
local adventurerFame = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", 53);
|
||||
local adventurerFameRight = adventurerFameX + adventurerFame.GetSize().w;
|
||||
// print(adventurerFameX);
|
||||
// print(adventurerFameY);
|
||||
|
||||
CanvasObj.DrawSpriteFrame(adventurerFame, adventurerFameX, adventurerFameY);
|
||||
|
||||
|
||||
// 冒险家名望
|
||||
local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, {
|
||||
color = brown
|
||||
});
|
||||
local adventurerFameTextRight = adventurerFameRight + 5 + adventurerFameText.GetSize().w;
|
||||
|
||||
CanvasObj.DrawActor(adventurerFameText, adventurerFameRight + 5, 185);
|
||||
|
||||
// 冒险家名望数值
|
||||
local adventurerFameNum = FontAssetManager.GenerateNormal("0", true, {
|
||||
color = green
|
||||
});
|
||||
CanvasObj.DrawActor(adventurerFameNum, adventurerFameTextRight + 5, 185);
|
||||
}
|
||||
|
||||
|
||||
// 属性
|
||||
function RegisterPropertyItems() {
|
||||
// 属性
|
||||
local leftListX = 0;
|
||||
local rightListX = 132;
|
||||
local rowY = 213;
|
||||
local rowH = 18;
|
||||
|
||||
//获取角色
|
||||
local Chr = ClientCharacter ? ClientCharacter : null;
|
||||
if (!Chr) return;
|
||||
// 生命
|
||||
local life = roleInfoPropertyItem(0, "生命", format("%d/%d", Chr.HP.tointeger(), Chr.Attr.HPMax.tointeger()));
|
||||
CanvasObj.DrawSprite(life, leftListX, rowY);
|
||||
// 魔法
|
||||
local magic = roleInfoPropertyItem(1, "魔法", format("%d/%d", Chr.MP.tointeger(), Chr.Attr.MPMax.tointeger()));
|
||||
CanvasObj.DrawSprite(magic, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理防御力
|
||||
local physicalDefense = roleInfoPropertyItem(8, "物理防御力", format("%d", Chr.Attr.EquipmentPhysicalDefense));
|
||||
CanvasObj.DrawSprite(physicalDefense, leftListX, rowY);
|
||||
|
||||
// 魔法防御力
|
||||
local magicDefense = roleInfoPropertyItem(9, "魔法防御力", format("%d", Chr.Attr.EquipmentMagicalDefense));
|
||||
CanvasObj.DrawSprite(magicDefense, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 力量
|
||||
local strength = roleInfoPropertyItem(2, "力量", format("%d", Chr.Attr.PhysicalAttack));
|
||||
CanvasObj.DrawSprite(strength, leftListX, rowY);
|
||||
// 智力
|
||||
local intelligence = roleInfoPropertyItem(3, "智力", format("%d", Chr.Attr.MagicalAttack));
|
||||
CanvasObj.DrawSprite(intelligence, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 体力
|
||||
local vitality = roleInfoPropertyItem(4, "体力", format("%d", Chr.Attr.PhysicalDefense));
|
||||
CanvasObj.DrawSprite(vitality, leftListX, rowY);
|
||||
// 精神
|
||||
local spirit = roleInfoPropertyItem(5, "精神", format("%d", Chr.Attr.MagicalDefense));
|
||||
CanvasObj.DrawSprite(spirit, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理攻击力
|
||||
local physicalATK = roleInfoPropertyItem(6, "物理攻击力", format("%d", Chr.Attr.EquipmentPhysicalAttack));
|
||||
CanvasObj.DrawSprite(physicalATK, leftListX, rowY);
|
||||
// 魔法攻击力
|
||||
local magicATK = roleInfoPropertyItem(7, "魔法攻击力", format("%d", Chr.Attr.EquipmentMagicalAttack));
|
||||
CanvasObj.DrawSprite(magicATK, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 物理暴击
|
||||
local physicalCrit = roleInfoPropertyItem(10, "物理暴击", format("%d%%", Chr.Attr.PhysicalCriticalHit));
|
||||
CanvasObj.DrawSprite(physicalCrit, leftListX, rowY);
|
||||
// 魔法暴击
|
||||
local magicCrit = roleInfoPropertyItem(11, "魔法暴击", format("%d%%", Chr.Attr.MagicalCriticalHit));
|
||||
CanvasObj.DrawSprite(magicCrit, rightListX, rowY);
|
||||
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 独立攻击
|
||||
local independentAttack = roleInfoPropertyItem(12, "独立攻击", format("%d", Chr.Attr.SeparateAttack));
|
||||
CanvasObj.DrawSprite(independentAttack, leftListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 攻击速度
|
||||
local attackSpeed = roleInfoPropertyItem(13, "攻击速度", format("%.1f%%", Chr.Attr.AttackSpeed.tofloat() / 100.0));
|
||||
CanvasObj.DrawSprite(attackSpeed, leftListX, rowY);
|
||||
|
||||
// 释放速度
|
||||
local releaseSpeed = roleInfoPropertyItem(14, "释放速度", format("%.1f%%", Chr.Attr.CastSpeed.tofloat() / 100.0));
|
||||
CanvasObj.DrawSprite(releaseSpeed, rightListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 移动速度
|
||||
local moveSpeed = roleInfoPropertyItem(15, "移动速度", format("%.1f%%", Chr.Attr.MoveSpeed.tofloat() / 100.0));
|
||||
CanvasObj.DrawSprite(moveSpeed, leftListX, rowY);
|
||||
|
||||
rowY += rowH;
|
||||
|
||||
// 攻击属性
|
||||
local attackProperty = roleInfoPropertyItem(16, "攻击属性", format("火(%d)/冰(%d)/光(%d)/暗(%d)", Chr.Attr.FireAttack, Chr.Attr.WaterAttack, Chr.Attr.LightAttack, Chr.Attr.DarkAttack), true, 260);
|
||||
CanvasObj.DrawSprite(attackProperty, leftListX, rowY);
|
||||
}
|
||||
|
||||
|
||||
// 底部四个按钮
|
||||
function RegisterBottomButton() {
|
||||
// 副职业
|
||||
local subJob = otherButton(0, 401, 62, "副职业", false);
|
||||
AddUIChild(subJob);
|
||||
subJob.OnClick = function(btn) {
|
||||
//todo 打开副职业面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separation = CL_SpriteObject("sprite/interface2/profile/profile.img", 70);
|
||||
separation.SetPosition(subJob.right(), subJob.Y + 7.5);
|
||||
Addchild(separation);
|
||||
|
||||
// 战斗分析
|
||||
local battleAnalysis = otherButton(subJob.right() + 1, subJob.Y, 64, "战斗分析");
|
||||
AddUIChild(battleAnalysis);
|
||||
battleAnalysis.OnClick = function(btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separationOne = CL_SpriteObject("sprite/interface2/profile/profile.img", 70);
|
||||
separationOne.SetPosition(battleAnalysis.right(), battleAnalysis.Y + 7.5);
|
||||
Addchild(separationOne);
|
||||
|
||||
// 决斗信息 // 根据决斗场等级 显示 sprite/interface2/pvp02/pvprank_icon/tier_icon.img 24
|
||||
local duelInfo = otherButton(battleAnalysis.right() + 1, battleAnalysis.Y, 14, "决斗信息", true);
|
||||
AddUIChild(duelInfo);
|
||||
duelInfo.OnClick = function(btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
|
||||
local separationTwo = CL_SpriteObject("sprite/interface2/profile/profile.img", 70);
|
||||
separationTwo.SetPosition(duelInfo.right(), duelInfo.Y + 7.5);
|
||||
Addchild(separationTwo);
|
||||
|
||||
// 详细信息
|
||||
local detailedInformation = otherButton(duelInfo.right() + 1, duelInfo.Y, 66, "详细信息");
|
||||
AddUIChild(detailedInformation);
|
||||
detailedInformation.OnClick = function(btn) {
|
||||
//todo 打开面板
|
||||
print(11111);
|
||||
}.bindenv(this);
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 属性项
|
||||
class roleInfoPropertyItem extends CL_CanvasObject {
|
||||
|
||||
// additionReaction 属性是否有加成 加成为绿色 不加成灰色
|
||||
constructor(idx, title, numText, additionReaction = true, width = 125) {
|
||||
local w = width;
|
||||
local h = 18;
|
||||
base.constructor();
|
||||
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, 18);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
local titlecolor = additionReaction ? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
local numColor = additionReaction ? sq_RGBA(75, 161, 85, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
|
||||
local iconX = 5;
|
||||
local icon = CL_SpriteFrameObject("sprite/interface2/profile/profile_icon.img", idx);
|
||||
local iconRight = iconX + icon.GetSize().w;
|
||||
DrawSpriteFrame(icon, iconX, h / 2 - icon.GetSize().h / 2);
|
||||
|
||||
|
||||
// 属性名称
|
||||
local property = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = titlecolor
|
||||
});
|
||||
DrawActor(property, iconRight + 5, 0);
|
||||
|
||||
// 属性数值
|
||||
local propertyNum = FontAssetManager.GenerateNormal(numText, true, {
|
||||
color = numColor
|
||||
});
|
||||
local numX = w - propertyNum.GetSize().w;
|
||||
DrawActor(propertyNum, numX, 0);
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 其他面板按钮
|
||||
class otherButton extends Yosin_CommonUi {
|
||||
|
||||
// 是否启用按钮
|
||||
enabled = true;
|
||||
|
||||
iconX = null;
|
||||
iconY = null;
|
||||
icon = null;
|
||||
|
||||
// pvp 是否是pvp 按钮
|
||||
constructor(gX, gY, idx, title, pvp = false, enabled = true, ) {
|
||||
base.constructor(gX, gY, 65, 65);
|
||||
|
||||
this.enabled = enabled;
|
||||
|
||||
local titlecolor = enabled ? sq_RGBA(160, 132, 75, 255) : sq_RGBA(79, 79, 79, 255);
|
||||
// 属性名称
|
||||
local property = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = titlecolor
|
||||
});
|
||||
property.SetPosition(32 - property.GetSize().w / 2, 45);
|
||||
Addchild(property);
|
||||
|
||||
local path = pvp ? "sprite/interface2/profile/profile_pvp_icon.img" : "sprite/interface2/profile/profile.img";
|
||||
icon = CL_SpriteObject(path, enabled ? idx : idx + 1);
|
||||
|
||||
iconX = 32 - icon.GetSize().w / 2;
|
||||
iconY = 45 / 2 - icon.GetSize().h / 2 + 3;
|
||||
icon.SetPosition(iconX, iconY);
|
||||
Addchild(icon);
|
||||
|
||||
}
|
||||
|
||||
function Proc(DT) {
|
||||
if (isLBDown) {
|
||||
icon.SetPosition(iconX, iconY + 1);
|
||||
} else {
|
||||
icon.SetPosition(iconX, iconY);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//装备槽
|
||||
class UISpace_PersonalInfo.EquipmentSlot extends Yosin_CommonUi {
|
||||
Pos = null;
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor(gPos) {
|
||||
this.Pos = gPos;
|
||||
base.constructor(0, 0, 28, 28);
|
||||
// OpenDeBug();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
|
||||
if (Item) {
|
||||
this.Item = Item;
|
||||
//如果原先有图标则先移除图标在添加
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
}
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
Addchild(this.ItemIcon);
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
} else {
|
||||
this.Item = null;
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
this.ItemIcon = null;
|
||||
}
|
||||
this.ItemInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!Item) return;
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//如果有道具
|
||||
if (Item) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
if (!ItemInfoShowFlag) {
|
||||
//显示详细信息
|
||||
ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
}
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 上半部分 人物装备穿戴
|
||||
class UISpace_PersonalInfo.CharactersEquipment extends Yosin_CommonUi {
|
||||
|
||||
//背景画布对象
|
||||
CanvasObject = null;
|
||||
//角色显示对象
|
||||
CharacterObject = null;
|
||||
//装备格子槽 0护肩 1上衣 2下装 3腰带 4鞋子 5武器 6手镯 7项链 8戒指 9称号 10辅助装备 11魔法石 12耳环
|
||||
EquipmentSlot = null;
|
||||
EquipmentSlotPos = [
|
||||
[10, 7],
|
||||
[42, 7],
|
||||
[10, 39],
|
||||
[42, 39],
|
||||
[10, 71],
|
||||
[197, 7],
|
||||
[197, 39],
|
||||
[229, 39],
|
||||
[229, 71],
|
||||
[229, 7],
|
||||
[197, 71],
|
||||
[229, 103],
|
||||
[197, 103],
|
||||
];
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
constructor() {
|
||||
base.constructor(0, 0, 264, 179);
|
||||
EquipmentSlot = [];
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 225);
|
||||
HoverEffect.SetMode(0);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
// 绘制背景
|
||||
DrawBackground();
|
||||
// 初始化装备栏
|
||||
InitEquipment();
|
||||
//初始化角色
|
||||
InitCharacter();
|
||||
}
|
||||
|
||||
|
||||
// 背景
|
||||
function DrawBackground() {
|
||||
|
||||
local w = 264;
|
||||
local h = 179;
|
||||
// 创建画布
|
||||
CanvasObject = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
CanvasObject.ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
CanvasObject.BeginDraw();
|
||||
|
||||
// 装备栏背景
|
||||
local equipmentBackground = CL_SpriteFrameObject("sprite/interface2/profile/profile.img", 14);
|
||||
CanvasObject.DrawSpriteFrame(equipmentBackground, 8, 5);
|
||||
|
||||
|
||||
// 顶部光线
|
||||
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||
CanvasObject.DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||||
|
||||
// todo 角色展示
|
||||
|
||||
// // 结婚戒指槽位
|
||||
// local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||||
// DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||||
|
||||
|
||||
// 辅助装备
|
||||
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
||||
CanvasObject.DrawSpriteFrame(assist, 195, 69);
|
||||
|
||||
// 耳环
|
||||
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
||||
CanvasObject.DrawSpriteFrame(earrings, 195, 102);
|
||||
|
||||
// 魔法石
|
||||
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
||||
CanvasObject.DrawSpriteFrame(MagicStone, 227, 101);
|
||||
|
||||
|
||||
|
||||
// 结束绘制
|
||||
CanvasObject.EndDraw();
|
||||
Addchild(CanvasObject);
|
||||
}
|
||||
|
||||
// 初始化装备栏
|
||||
function InitEquipment() {
|
||||
for (local i = 0; i< 13; i++) {
|
||||
local SlotBuffer = UISpace_PersonalInfo.EquipmentSlot(i);
|
||||
SlotBuffer.SetPosition(EquipmentSlotPos[i][0], EquipmentSlotPos[i][1]);
|
||||
AddUIChild(SlotBuffer);
|
||||
EquipmentSlot.push(SlotBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化角色
|
||||
function InitCharacter() {
|
||||
if (!ClientCharacter) return;
|
||||
if (CharacterObject) Removechild(CharacterObject);
|
||||
CharacterObject = ClientCharacter.CreateTempAni("WaitingAni");
|
||||
CharacterObject.SetPosition(200 - CharacterObject.GetSize().w, 260 - CharacterObject.GetSize().h);
|
||||
Addchild(CharacterObject);
|
||||
}
|
||||
|
||||
//设置装备栏装备
|
||||
function SetEquipment(Slot, Equipment) {
|
||||
EquipmentSlot[Slot].SetItem(Equipment);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,16 +4,184 @@
|
|||
创建日期:2025-01-06 14:06
|
||||
文件用途: 背包窗口
|
||||
*/
|
||||
//背包命名空间
|
||||
UISpace_Inventory <- {};
|
||||
|
||||
//主类
|
||||
class UISpace_Inventory._Inventory extends Yosin_Window {
|
||||
|
||||
//分页集合 0装备 1装扮 2宠物
|
||||
PageList = null;
|
||||
//钱包
|
||||
Wallet = null;
|
||||
|
||||
// 物品栏排列按钮
|
||||
PermutationBtn = null;
|
||||
// 物品栏设置按钮
|
||||
SetBtn = null;
|
||||
// 物品栏搜索按钮
|
||||
SaerchBtn = null;
|
||||
|
||||
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
|
||||
itemSetBtnY = 467;
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
function _typeof() {
|
||||
return "Game_Window";
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
PageList = [];
|
||||
//调用父类构造函数
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
//注册背包页面
|
||||
RegisterPage();
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_ITEM_INVENTORY, function(Flag) {
|
||||
//按下的时候
|
||||
if (Flag == 1) {
|
||||
//如果窗口已经打开
|
||||
if (this.Visible) {
|
||||
//关闭窗口
|
||||
CloseWindow();
|
||||
} else {
|
||||
//打开窗口
|
||||
ResetFocus();
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
|
||||
|
||||
// ChangPage(1);
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//标题栏
|
||||
local title = Yosin_TopTitle(Width, Height, "装备栏(I)");
|
||||
Addchild(title);
|
||||
|
||||
//关闭按钮
|
||||
local closeBtn = Yosin_BaseButton(Width - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||
closeBtn.DownSimulateOffset = false;
|
||||
closeBtn.SetZOrder(1);
|
||||
closeBtn.OnClick = function(btn) {
|
||||
CloseWindow();
|
||||
}.bindenv(this);
|
||||
AddUIChild(closeBtn);
|
||||
//置顶按钮
|
||||
local topBtn = Yosin_BaseButton(Width - 35, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455);
|
||||
topBtn.DownSimulateOffset = false;
|
||||
topBtn.OnClick = function(btn) {}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
//分页按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 25, 250, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
ChangPage(index);
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
// 排列按钮
|
||||
PermutationBtn = Yosin_BaseButton(226, 467, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
PermutationBtn.SetZOrder(1);
|
||||
AddUIChild(PermutationBtn);
|
||||
|
||||
// 设置
|
||||
SetBtn = Yosin_BaseButton(PermutationBtn.X - 20, PermutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
SetBtn.SetZOrder(1);
|
||||
AddUIChild(SetBtn);
|
||||
|
||||
// 搜索
|
||||
SaerchBtn = Yosin_BaseButton(SetBtn.X - 24, PermutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
SaerchBtn.SetZOrder(1);
|
||||
AddUIChild(SaerchBtn);
|
||||
|
||||
//钱包类
|
||||
Wallet = UISpace_Inventory.Wallet(7, Height - 55, 248, 49);
|
||||
AddUIChild(Wallet);
|
||||
}
|
||||
|
||||
function RegisterPage() {
|
||||
//物品栏 装备页
|
||||
local EquipmentPage = UISpace_Inventory.EquipmentPage(2, 46, 300, 441);
|
||||
PageList.push(EquipmentPage);
|
||||
AddUIChild(EquipmentPage);
|
||||
|
||||
// 装扮页
|
||||
local DressUpPage = UISpace_Inventory.DressUpPage(4, 46, 300, 441);
|
||||
PageList.push(DressUpPage);
|
||||
AddUIChild(DressUpPage);
|
||||
DressUpPage.SetVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
//类型说明 金币Gold 点券Cera 复活币ReviveCoin 代币券BindCera
|
||||
//钱包操作
|
||||
function WalletGet(Type, Value) {
|
||||
return Wallet[Type];
|
||||
}
|
||||
|
||||
function WalletSet(Type, Value) {
|
||||
Wallet[Type] = Value;
|
||||
}
|
||||
|
||||
//刷新背包中角色的Ani
|
||||
function RefreshRoleAni() {
|
||||
//装备页面的角色
|
||||
PageList[0].CharactersObject.InitCharacter();
|
||||
//装扮页面的角色
|
||||
PageList[1].CharactersObject.InitCharacter();
|
||||
}
|
||||
|
||||
// 切换页面
|
||||
function ChangPage(gIndex) {
|
||||
foreach(Index, Page in PageList) {
|
||||
Page.SetVisible(false);
|
||||
if (gIndex == Index) {
|
||||
Page.SetVisible(true);
|
||||
if (gIndex == 0) {
|
||||
PermutationBtn.MoveBy(0, -23);
|
||||
SetBtn.MoveBy(0, -23);
|
||||
SaerchBtn.MoveBy(0, -23);
|
||||
} else if (gIndex == 1) {
|
||||
PermutationBtn.MoveBy(0, 23);
|
||||
SetBtn.MoveBy(0, 23);
|
||||
SaerchBtn.MoveBy(0, 23);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//在Esc按下时
|
||||
function OnEsc() {
|
||||
CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//钱包类
|
||||
class Inventory_Wallet extends Yosin_CommonUi {
|
||||
class UISpace_Inventory.Wallet extends Yosin_CommonUi {
|
||||
|
||||
//复活币数量
|
||||
ReviveCoinCount = 0;
|
||||
ReviveCoinText = null;
|
||||
//胜利的证明数量
|
||||
WinCoinCount = 0;
|
||||
WinCoinText = null;
|
||||
//代币券数量
|
||||
BindCeraCount = 0;
|
||||
BindCeraText = null;
|
||||
//点卷数量
|
||||
CeraCount = 0;
|
||||
CeraText = null;
|
||||
|
|
@ -30,10 +198,10 @@ class Inventory_Wallet extends Yosin_CommonUi {
|
|||
ReviveCoinText.SetPosition(120 - ReviveCoinText.GetSize().w, 2);
|
||||
break;
|
||||
}
|
||||
case "WinCoin": {
|
||||
WinCoinCount = val;
|
||||
WinCoinText.SetText(WinCoinCount + "个");
|
||||
WinCoinText.SetPosition(245 - WinCoinText.GetSize().w, 2);
|
||||
case "BindCera": {
|
||||
BindCeraCount = val;
|
||||
BindCeraText.SetText(BindCeraCount + "个");
|
||||
BindCeraText.SetPosition(245 - BindCeraText.GetSize().w, 2);
|
||||
break;
|
||||
}
|
||||
case "Cera": {
|
||||
|
|
@ -54,9 +222,28 @@ class Inventory_Wallet extends Yosin_CommonUi {
|
|||
}
|
||||
}
|
||||
|
||||
function _get(idx) {
|
||||
switch (idx) {
|
||||
case "ReviveCoin": {
|
||||
return ReviveCoinCount;
|
||||
}
|
||||
case "BindCera": {
|
||||
return BindCeraCount;
|
||||
}
|
||||
case "Cera": {
|
||||
return CeraCount;
|
||||
}
|
||||
case "Gold": {
|
||||
return GoldCount;
|
||||
}
|
||||
default:
|
||||
throw null;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
constructor(x, y, w, h) {
|
||||
base.constructor(x, y, w, h);
|
||||
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
|
|
@ -76,12 +263,12 @@ class Inventory_Wallet extends Yosin_CommonUi {
|
|||
Addchild(ReviveCoinText);
|
||||
|
||||
|
||||
// 胜利的证明
|
||||
WinCoinText = FontAssetManager.GenerateNormal(WinCoinCount + "个", true, {
|
||||
// 代币券
|
||||
BindCeraText = FontAssetManager.GenerateNormal(BindCeraCount + "个", true, {
|
||||
color = txtColor
|
||||
});
|
||||
WinCoinText.SetPosition(245 - WinCoinText.GetSize().w + bg.X, 2);
|
||||
Addchild(WinCoinText);
|
||||
BindCeraText.SetPosition(245 - BindCeraText.GetSize().w + bg.X, 2);
|
||||
Addchild(BindCeraText);
|
||||
|
||||
|
||||
// 商城
|
||||
|
|
@ -114,140 +301,3 @@ class Inventory_Wallet extends Yosin_CommonUi {
|
|||
Addchild(GoldText);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//主类
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
//分页集合 0装备 1装扮 2宠物
|
||||
PageList = null;
|
||||
//钱包
|
||||
Wallet = null;
|
||||
|
||||
// 物品栏排列按钮
|
||||
permutationBtn = null;
|
||||
// 物品栏设置按钮
|
||||
setBtn = null;
|
||||
// 物品栏搜索按钮
|
||||
saerchBtn = null;
|
||||
|
||||
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
|
||||
itemSetBtnY = 467;
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
PageList = [];
|
||||
//调用父类构造函数
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
|
||||
//注册背包页面
|
||||
RegisterPage();
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_ITEM_INVENTORY, function(Flag) {
|
||||
//抬起的时候
|
||||
if (Flag == 0) {
|
||||
//如果窗口已经打开
|
||||
if (this.Visible) {
|
||||
//关闭窗口
|
||||
CloseWindow();
|
||||
} else {
|
||||
//打开窗口
|
||||
ResetFocus();
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//标题栏
|
||||
local title = Yosin_TopTitle(Width, Height, "装备栏(I)");
|
||||
Addchild(title);
|
||||
|
||||
//关闭按钮
|
||||
local closeBtn = Yosin_BaseButton(Width - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||
closeBtn.DownSimulateOffset = false;
|
||||
closeBtn.SetZOrder(1);
|
||||
closeBtn.OnClick = function(btn) {
|
||||
CloseWindow();
|
||||
}.bindenv(this);
|
||||
AddUIChild(closeBtn);
|
||||
//置顶按钮
|
||||
local topBtn = Yosin_BaseButton(Width - 35, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455);
|
||||
topBtn.DownSimulateOffset = false;
|
||||
topBtn.OnClick = function(btn) {}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
//分页按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 25, 250, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
ChangPage(index);
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
// 排列按钮
|
||||
permutationBtn = Yosin_BaseButton(226, itemSetBtnY, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73);
|
||||
permutationBtn.SetZOrder(1);
|
||||
AddUIChild(permutationBtn);
|
||||
|
||||
// 设置
|
||||
setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77);
|
||||
setBtn.SetZOrder(1);
|
||||
AddUIChild(setBtn);
|
||||
|
||||
// 搜索
|
||||
saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94);
|
||||
saerchBtn.SetZOrder(1);
|
||||
AddUIChild(saerchBtn);
|
||||
|
||||
//钱包类
|
||||
Wallet = Inventory_Wallet(7, Height - 55, 248, 49);
|
||||
AddUIChild(Wallet);
|
||||
}
|
||||
|
||||
function RegisterPage() {
|
||||
//物品栏 装备页
|
||||
local EquipmentPage = Inventory_EquipmentPage(2, 46, 300, 441);
|
||||
PageList.push(EquipmentPage);
|
||||
AddUIChild(EquipmentPage);
|
||||
|
||||
// 装扮页
|
||||
local DressUpPage = Inventory_DressUpPage(4, 46, 300, 441);
|
||||
PageList.push(DressUpPage);
|
||||
AddUIChild(DressUpPage);
|
||||
DressUpPage.SetVisible(false);
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
|
||||
// 切换页面
|
||||
function ChangPage(gIndex) {
|
||||
foreach(Index, Page in PageList) {
|
||||
Page.SetVisible(false);
|
||||
if (gIndex == Index) {
|
||||
Page.SetVisible(true);
|
||||
if (gIndex == 0) {
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY);
|
||||
setBtn.SetPosition(setBtn.X, itemSetBtnY);
|
||||
saerchBtn.SetPosition(saerchBtn.X, itemSetBtnY);
|
||||
} else if (gIndex == 1) {
|
||||
permutationBtn.SetPosition(permutationBtn.X, itemSetBtnY + 28);
|
||||
setBtn.SetPosition(setBtn.X, permutationBtn.Y);
|
||||
saerchBtn.SetPosition(saerchBtn.X, permutationBtn.Y);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,343 @@
|
|||
/*
|
||||
文件名:AvatarCollect.nut
|
||||
路径:User/UI/Window/5_Inventory/AvatarCollect.nut
|
||||
创建日期:2025-02-16 09:07
|
||||
文件用途:装扮物品栏
|
||||
*/
|
||||
//物品槽
|
||||
class UISpace_Inventory.ItemSlot_Avatar {
|
||||
X = null;
|
||||
Y = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor() {
|
||||
|
||||
}
|
||||
|
||||
function SyncPos(x, y) {
|
||||
this.X = x;
|
||||
this.Y = y;
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
this.Item = Item;
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
}
|
||||
|
||||
//生成详细信息
|
||||
function GenerateInfo() {
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// 物品栏
|
||||
class UISpace_Inventory.AvatarCollection extends Yosin_CommonUi {
|
||||
|
||||
//栏位类型
|
||||
Type = null;
|
||||
// 悬浮时显示的框
|
||||
HoverEffect = null;
|
||||
//行数
|
||||
RowNum = null;
|
||||
//底层画布对象
|
||||
BottomCanvas = null;
|
||||
//顶层画布对象
|
||||
TopCanvas = null;
|
||||
//物品对象List
|
||||
ItemList = null;
|
||||
//当前显示详细信息的物品对象
|
||||
CurrentShowItem = null;
|
||||
//当前鼠标指向的位置
|
||||
ItemPos = null;
|
||||
//拖拽物品原来的位置
|
||||
DragItemPos = null;
|
||||
|
||||
|
||||
constructor(x, y, rowNum, type) {
|
||||
this.Type = type;
|
||||
this.RowNum = rowNum;
|
||||
//计算实际需要的高度
|
||||
local RealH = 30 * rowNum;
|
||||
base.constructor(x, y, 239, RealH);
|
||||
|
||||
//构造相应数量的槽
|
||||
ItemList = array(8 * rowNum, null);
|
||||
|
||||
//整体底板
|
||||
InitOverallBasePlate();
|
||||
|
||||
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
}
|
||||
|
||||
//根据高度绘制整体底板
|
||||
function InitOverallBasePlate() {
|
||||
// 创建画布
|
||||
BottomCanvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
BottomCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||
// 开始绘制
|
||||
BottomCanvas.BeginDraw();
|
||||
foreach(pos, ItemObj in ItemList) {
|
||||
local XPos = (pos % 8) * 30;
|
||||
local YPos = (pos / 8) * 30;
|
||||
local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49);
|
||||
BottomCanvas.DrawSpriteFrame(bg, XPos, YPos);
|
||||
}
|
||||
// 结束绘制
|
||||
BottomCanvas.EndDraw();
|
||||
// 添加画布
|
||||
Addchild(BottomCanvas);
|
||||
}
|
||||
|
||||
//设置道具列表
|
||||
function SetItemList(gItemList) {
|
||||
//创建道具
|
||||
foreach(Index, ItemObject in gItemList) {
|
||||
ItemList[Index] = UISpace_Inventory.ItemSlot();
|
||||
ItemList[Index].SetItem(ItemObject);
|
||||
}
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
//设置道具格子
|
||||
function SetItemSlot(Idx, ItemObject) {
|
||||
if (ItemObject == null) {
|
||||
ItemList[Idx] = null;
|
||||
} else {
|
||||
ItemList[Idx] = UISpace_Inventory.ItemSlot();
|
||||
ItemList[Idx].SetItem(ItemObject);
|
||||
SetAddEffect(Idx);
|
||||
}
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
//设置添加特效
|
||||
function SetAddEffect(Idx) {
|
||||
local AddEffect = Animation("ui/inventory/slot.ani");
|
||||
AddEffect.SetPosition((Idx % 8) * 30, (Idx / 8) * 30);
|
||||
AddEffect.SetZOrder(100);
|
||||
AddEffect.SetUpdateFunc(function(Ani, Dt) {
|
||||
if (Ani.IsUsability == false) Ani.RemoveSelf();
|
||||
});
|
||||
Addchild(AddEffect);
|
||||
}
|
||||
|
||||
//刷新道具列表
|
||||
function RefreshItemList() {
|
||||
//如果不存在则构造画布
|
||||
if (!TopCanvas) {
|
||||
// 创建画布
|
||||
TopCanvas = CL_CanvasObject();
|
||||
// 添加画布
|
||||
Addchild(TopCanvas);
|
||||
}
|
||||
// 重设大小并清空
|
||||
TopCanvas.ResizeAndClear(239, this.RowNum * 30);
|
||||
// 开始绘制
|
||||
TopCanvas.BeginDraw();
|
||||
foreach(pos, ItemObj in ItemList) {
|
||||
if (ItemObj) {
|
||||
local XPos = (pos % 8) * 30;
|
||||
local YPos = (pos / 8) * 30;
|
||||
ItemObj.ItemIcon.SetPosition(XPos, YPos);
|
||||
TopCanvas.DrawSprite(ItemObj.ItemIcon, XPos, YPos);
|
||||
}
|
||||
}
|
||||
// 结束绘制
|
||||
TopCanvas.EndDraw();
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
if (isInRect) {
|
||||
local WorldPosition = this.GetWorldPosition();
|
||||
local xx = MousePos_X - WorldPosition.x;
|
||||
local yy = MousePos_Y - WorldPosition.y;
|
||||
local column = (yy / 30).tointeger();
|
||||
//悬停的时候有可能悬停到最下面的最后一条缝 会导致判定行数多了一行 所以这里做限制
|
||||
column = (column <= (RowNum - 1) ? column : (RowNum - 1));
|
||||
local row = (xx / 30).tointeger();
|
||||
//指向的项目位置
|
||||
local Idx = column * 8 + row;
|
||||
ItemPos = Idx;
|
||||
//如果有道具
|
||||
if (ItemList[Idx]) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
//如果没有物品信息窗口
|
||||
if (!ItemList[Idx].ItemInfo) {
|
||||
ItemList[Idx].GenerateInfo();
|
||||
}
|
||||
if (!ItemList[Idx].ItemInfoShowFlag) {
|
||||
//关闭上一个显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
//如果当前没有拖拽物品时才打开详细信息窗口
|
||||
if (!IMouse.DragObj) {
|
||||
//显示详细信息
|
||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemList[Idx].ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
//记录当前显示的对象
|
||||
CurrentShowItem = ItemList[Idx];
|
||||
}
|
||||
}
|
||||
} else {
|
||||
//关闭上一个显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
HoverEffect.SetOpacity(1);
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
HoverEffect.SetPosition(row * 30, column * 30);
|
||||
} else {
|
||||
ItemPos = null;
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
foreach(ItemObj in ItemList) {
|
||||
if (ItemObj && ItemObj.ItemInfoShowFlag) {
|
||||
ItemObj.CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
|
||||
if (ItemPos != null && ItemList[ItemPos]) {
|
||||
//记录拖拽物品
|
||||
IMouse.AddDragObject(ItemList[ItemPos]);
|
||||
//记录拖拽物品原来的位置
|
||||
DragItemPos = ItemPos;
|
||||
//从槽中移除
|
||||
ItemList[ItemPos] = null;
|
||||
//刷新物品列表
|
||||
RefreshItemList();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
if (IMouse.DragObj) {
|
||||
//如果拖动到窗口内部 发包交换位置
|
||||
local WorldPosition = this.GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, WorldPosition.x, WorldPosition.y, Width, Height)) {
|
||||
MySocket.Send(PACKET_ID.INVENTORY_SWAP_ITEM, {
|
||||
oldBaid = 9,
|
||||
newBaid = 9,
|
||||
oldPos = this.DragItemPos,
|
||||
newPos = this.ItemPos,
|
||||
});
|
||||
}
|
||||
|
||||
//移除鼠标上的拖动道具
|
||||
local DragItem = IMouse.RemoveDragObject();
|
||||
//发包完成后先把道具放回去
|
||||
ItemList[DragItemPos] = DragItem;
|
||||
DragItemPos = null;
|
||||
RefreshItemList();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
|
||||
if (ItemPos != null && ItemList[ItemPos]) {
|
||||
//穿戴装备
|
||||
if (this.Type == 0) {
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 9,
|
||||
oldPos = ItemPos
|
||||
});
|
||||
}
|
||||
//使用道具
|
||||
else if (this.Type == 1) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//移动Item逻辑
|
||||
function MoveItem(oldPos, newPos) {
|
||||
//如果这个格子不是空的 要把他放回交换的位置
|
||||
if (ItemList[newPos] != null) {
|
||||
local Temp = ItemList[newPos];
|
||||
ItemList[oldPos] = Temp;
|
||||
}
|
||||
ItemList[newPos] = DragItem;
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -6,9 +6,13 @@
|
|||
*/
|
||||
|
||||
// 背包装扮页面
|
||||
class Inventory_DressUpPage extends Yosin_CommonUi {
|
||||
class UISpace_Inventory.DressUpPage extends Yosin_CommonUi {
|
||||
CharactersObject = null;
|
||||
ItemCollectionList = null;
|
||||
ScrollObject = null;
|
||||
|
||||
constructor(x, y, w, h) {
|
||||
ItemCollectionList = [];
|
||||
base.constructor(x, y, w, h);
|
||||
|
||||
DrawWidget();
|
||||
|
|
@ -17,76 +21,330 @@ class Inventory_DressUpPage extends Yosin_CommonUi {
|
|||
function DrawWidget() {
|
||||
|
||||
// 人物装扮穿戴
|
||||
local CharactersDressUp = Inventory_CharactersDressUp();
|
||||
CharactersDressUp.SetPosition(0, 0);
|
||||
Addchild(CharactersDressUp);
|
||||
CharactersObject = UISpace_Inventory.CharactersDressUp();
|
||||
CharactersObject.SetPosition(0, 0);
|
||||
AddUIChild(CharactersObject);
|
||||
|
||||
// 镶嵌徽章
|
||||
local InsetBadge = Yosin_BaseButton(150, 137, 97, 22, "sprite/interface/newstyle/windows/inventory/inventory.img", 90);
|
||||
AddUIChild(InsetBadge);
|
||||
|
||||
//框背景
|
||||
local itemBg = Yosin_NineBoxStretch(252, 250, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
itemBg.SetOpacity(0.6);
|
||||
itemBg.SetPosition(2, 197);
|
||||
Addchild(itemBg);
|
||||
|
||||
//分页按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(2, 180, 250, ["装扮", "徽章"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(2, 180, 250, ["装扮"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
// titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
|
||||
// };
|
||||
// 物品栏
|
||||
for (local i = 0; i< 1; i++) {
|
||||
local ItemCollection = UISpace_Inventory.AvatarCollection(3, 202, 8, i)
|
||||
AddUIChild(ItemCollection);
|
||||
ItemCollectionList.push(ItemCollection);
|
||||
}
|
||||
|
||||
// 添加按钮
|
||||
function AddBtn() {
|
||||
local ibtn = Yosin_BaseButton();
|
||||
//滚动条
|
||||
ScrollObject = Yosin_ScrollBar(243, 203, 242, 20);
|
||||
ScrollObject.SetScrollBarState(false);
|
||||
ScrollObject.SetChangeCallBack(function(Value) {
|
||||
// MsgTextWindow.SetScrollPos(Value);
|
||||
}.bindenv(this));
|
||||
AddUIChild(ScrollObject);
|
||||
|
||||
}
|
||||
|
||||
|
||||
//设定物品栏列表
|
||||
function SetItemCollectionList(Type, List) {
|
||||
ItemCollectionList[Type].SetItemList(List);
|
||||
}
|
||||
|
||||
//设定物品栏槽
|
||||
function SetItemCollectionSlot(Type, Index, Item) {
|
||||
ItemCollectionList[Type].SetItemSlot(Index, Item);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//装扮
|
||||
class UISpace_Inventory.AvatarSlot extends Yosin_CommonUi {
|
||||
Pos = null;
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor(gPos) {
|
||||
this.Pos = gPos;
|
||||
base.constructor(0, 0, 28, 28);
|
||||
// OpenDeBug();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
|
||||
if (Item) {
|
||||
this.Item = Item;
|
||||
//如果原先有图标则先移除图标在添加
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
}
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
Addchild(this.ItemIcon);
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
} else {
|
||||
this.Item = null;
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
this.ItemIcon = null;
|
||||
}
|
||||
this.ItemInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!Item) return;
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//如果有道具
|
||||
if (Item) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
if (!ItemInfoShowFlag) {
|
||||
//显示详细信息
|
||||
ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
}
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !WindowInteractiveFlag) {
|
||||
//发送脱下装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 8,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 上半部分 人物装扮穿戴
|
||||
class Inventory_CharactersDressUp extends CL_CanvasObject {
|
||||
class UISpace_Inventory.CharactersDressUp extends Yosin_CommonUi {
|
||||
|
||||
//背景画布对象
|
||||
CanvasObject = null;
|
||||
//角色显示对象
|
||||
CharacterObject = null;
|
||||
//0武器装扮 1光环装扮 2头部装扮 3帽子装扮 4脸部装扮 5胸部装扮 6上衣装扮 7皮肤装扮 8腰部装扮 9下装装扮 10鞋装扮
|
||||
EquipmentSlot = null;
|
||||
EquipmentSlotPos = [
|
||||
[117, 32],
|
||||
[117, 66],
|
||||
[150, 32],
|
||||
[183, 32],
|
||||
[216, 32],
|
||||
[150, 66],
|
||||
[183, 66],
|
||||
[216, 66],
|
||||
[150, 100],
|
||||
[183, 100],
|
||||
[216, 100],
|
||||
];
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
constructor() {
|
||||
local w = 254;
|
||||
local h = 178;
|
||||
base.constructor();
|
||||
base.constructor(0, 0, 250, 175);
|
||||
EquipmentSlot = [];
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 225);
|
||||
HoverEffect.SetMode(0);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
// 绘制背景
|
||||
DrawBackground();
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
// 初始化装备栏
|
||||
InitEquipment();
|
||||
//初始化角色
|
||||
InitCharacter();
|
||||
}
|
||||
|
||||
|
||||
// 背景
|
||||
function DrawBackground() {
|
||||
|
||||
local w = 248;
|
||||
local h = 179;
|
||||
// 创建画布
|
||||
CanvasObject = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
CanvasObject.ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
CanvasObject.BeginDraw();
|
||||
// 背景边框
|
||||
local bg = Yosin_NineBoxStretch(254, 178, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
DrawSprite(bg, 0, 0);
|
||||
|
||||
CanvasObject.DrawSprite(bg, 0, 0);
|
||||
// 装备装扮背景
|
||||
local itemBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 11);
|
||||
DrawSpriteFrame(itemBg, 116, 31);
|
||||
|
||||
CanvasObject.DrawSpriteFrame(itemBg, 116, 31);
|
||||
// 魔法阵
|
||||
local MagicLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 179);
|
||||
DrawSpriteFrame(MagicLight, 5, 55);
|
||||
|
||||
CanvasObject.DrawSpriteFrame(MagicLight, 5, 55);
|
||||
// 人物打光
|
||||
local CharacterLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||
DrawSpriteFrame(CharacterLight, -10, 4);
|
||||
CanvasObject.DrawSpriteFrame(CharacterLight, -10, 4);
|
||||
// 结束绘制
|
||||
CanvasObject.EndDraw();
|
||||
Addchild(CanvasObject);
|
||||
}
|
||||
|
||||
// 初始化装备栏
|
||||
function InitEquipment() {
|
||||
for (local i = 0; i< 11; i++) {
|
||||
local SlotBuffer = UISpace_Inventory.AvatarSlot(i);
|
||||
SlotBuffer.SetPosition(EquipmentSlotPos[i][0], EquipmentSlotPos[i][1]);
|
||||
AddUIChild(SlotBuffer);
|
||||
EquipmentSlot.push(SlotBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化角色
|
||||
function InitCharacter() {
|
||||
if (!ClientCharacter) return;
|
||||
if (CharacterObject) Removechild(CharacterObject);
|
||||
CharacterObject = ClientCharacter.CreateTempAni("WaitingAni");
|
||||
CharacterObject.SetPosition(122 - CharacterObject.GetSize().w, 260 - CharacterObject.GetSize().h);
|
||||
Addchild(CharacterObject);
|
||||
}
|
||||
|
||||
//设置装备栏装备
|
||||
function SetEquipment(Slot, Equipment) {
|
||||
EquipmentSlot[Slot].SetItem(Equipment);
|
||||
// //同步到角色对象中 时装暂不赋予属性 并且这里可能会与装备冲突 如果需要拓展 要先解决
|
||||
// ClientCharacter.Equip[Slot] <- Equipment;
|
||||
}
|
||||
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
//如果有拖动道具
|
||||
if (IMouse.DragObj) {
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
}
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
//必须是装备也拖上去的才触发
|
||||
if (ClientCharacterInventory.PageList[0].CurrentItemListPage == 0) {
|
||||
//鼠标上必须有拖拽物品
|
||||
if (IMouse.DragObj) {
|
||||
if (isInRect) {
|
||||
//获取拖动道具在背包中的位置
|
||||
local Pos = IMouse.DragObj.Item.PosInKnapsack;
|
||||
//发送穿戴装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 2,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,12 +6,15 @@
|
|||
*/
|
||||
|
||||
// 背包物品栏页面
|
||||
class Inventory_EquipmentPage extends Yosin_CommonUi {
|
||||
class UISpace_Inventory.EquipmentPage extends Yosin_CommonUi {
|
||||
|
||||
//人物装备
|
||||
CharactersEquipment = null;
|
||||
//物品栏
|
||||
ItemCollection = null;
|
||||
CharactersObject = null;
|
||||
//物品栏List
|
||||
ItemCollectionList = null;
|
||||
//当前物品栏页面
|
||||
CurrentItemListPage = 0;
|
||||
|
||||
//重量进度条
|
||||
WeightSchedule = null;
|
||||
//总可承载重量
|
||||
|
|
@ -24,9 +27,9 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
|
||||
|
||||
// 人物装备
|
||||
CharactersEquipment = Inventory_CharactersEquipment();
|
||||
CharactersEquipment.SetPosition(5, 0);
|
||||
Addchild(CharactersEquipment);
|
||||
CharactersObject = UISpace_Inventory.CharactersEquipment();
|
||||
CharactersObject.SetPosition(5, 0);
|
||||
AddUIChild(CharactersObject);
|
||||
|
||||
// 添加书本按钮
|
||||
AddBookButton();
|
||||
|
|
@ -67,11 +70,12 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
AddUIChild(itemBtns);
|
||||
|
||||
itemBtns.LBDownOnClick = function(btns, index) {
|
||||
foreach(Iindex, ItemCollectionBuffer in ItemCollection) {
|
||||
foreach(Iindex, ItemCollectionListBuffer in ItemCollectionList) {
|
||||
if (Iindex == index) {
|
||||
ItemCollectionBuffer.SetVisible(true);
|
||||
CurrentItemListPage = index;
|
||||
ItemCollectionListBuffer.SetVisible(true);
|
||||
} else {
|
||||
ItemCollectionBuffer.SetVisible(false);
|
||||
ItemCollectionListBuffer.SetVisible(false);
|
||||
}
|
||||
}
|
||||
}.bindenv(this);
|
||||
|
|
@ -82,15 +86,14 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
Addchild(itemBg);
|
||||
|
||||
// 物品栏
|
||||
ItemCollection = [];
|
||||
ItemCollectionList = [];
|
||||
for (local i = 0; i< 5; i++) {
|
||||
local ItemCollectionBuffer = _ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7);
|
||||
ItemCollection.push(ItemCollectionBuffer);
|
||||
AddUIChild(ItemCollectionBuffer);
|
||||
if (i != 0) ItemCollectionBuffer.SetVisible(false);
|
||||
local ItemCollectionListBuffer = UISpace_Inventory.ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7, i);
|
||||
ItemCollectionList.push(ItemCollectionListBuffer);
|
||||
AddUIChild(ItemCollectionListBuffer);
|
||||
if (i != 0) ItemCollectionListBuffer.SetVisible(false);
|
||||
}
|
||||
|
||||
|
||||
local itemBgBottom = itemBg.bottom();
|
||||
// 重量
|
||||
local weight = FontAssetManager.GenerateNormal("重量", true, {
|
||||
|
|
@ -117,86 +120,304 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
|
|||
|
||||
//设定物品栏列表
|
||||
function SetItemCollectionList(Type, List) {
|
||||
ItemCollection[Type].SetItemList(List);
|
||||
ItemCollectionList[Type].SetItemList(List);
|
||||
}
|
||||
|
||||
//设定物品栏槽
|
||||
function SetItemCollectionSlot(Type, Index, Item) {
|
||||
ItemCollectionList[Type].SetItemSlot(Index, Item);
|
||||
}
|
||||
}
|
||||
|
||||
//装备槽
|
||||
class UISpace_Inventory.EquipmentSlot extends Yosin_CommonUi {
|
||||
Pos = null;
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor(gPos) {
|
||||
this.Pos = gPos;
|
||||
base.constructor(0, 0, 28, 28);
|
||||
// OpenDeBug();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
|
||||
if (Item) {
|
||||
this.Item = Item;
|
||||
//如果原先有图标则先移除图标在添加
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
}
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
Addchild(this.ItemIcon);
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
} else {
|
||||
this.Item = null;
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
this.ItemIcon = null;
|
||||
}
|
||||
this.ItemInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!Item) return;
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//如果有道具
|
||||
if (Item) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
if (!ItemInfoShowFlag) {
|
||||
//显示详细信息
|
||||
ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
}
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !WindowInteractiveFlag) {
|
||||
//发送脱下装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 1,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 上半部分 人物装备穿戴
|
||||
class Inventory_CharactersEquipment extends CL_CanvasObject {
|
||||
class UISpace_Inventory.CharactersEquipment extends Yosin_CommonUi {
|
||||
|
||||
//背景画布对象
|
||||
CanvasObject = null;
|
||||
//角色显示对象
|
||||
CharacterObject = null;
|
||||
//装备格子槽 0护肩 1上衣 2下装 3腰带 4鞋子 5武器 6手镯 7项链 8戒指 9称号 10辅助装备 11魔法石 12耳环
|
||||
EquipmentSlot = null;
|
||||
EquipmentSlotPos = [
|
||||
[6, 6],
|
||||
[38, 6],
|
||||
[6, 38],
|
||||
[38, 38],
|
||||
[6, 70],
|
||||
[180, 6],
|
||||
[180, 38],
|
||||
[212, 38],
|
||||
[212, 70],
|
||||
[212, 6],
|
||||
[180, 70],
|
||||
[212, 102],
|
||||
[180, 103],
|
||||
];
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
constructor() {
|
||||
local w = 248;
|
||||
local h = 179;
|
||||
base.constructor();
|
||||
base.constructor(0, 0, 248, 179);
|
||||
EquipmentSlot = [];
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 225);
|
||||
HoverEffect.SetMode(0);
|
||||
HoverEffect.SetZOrder(1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
// 绘制背景
|
||||
DrawBackground(w);
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
DrawBackground();
|
||||
// 初始化装备栏
|
||||
InitEquipment();
|
||||
//初始化角色
|
||||
InitCharacter();
|
||||
}
|
||||
|
||||
|
||||
// 背景
|
||||
function DrawBackground(Width) {
|
||||
|
||||
function DrawBackground() {
|
||||
local w = 248;
|
||||
local h = 179;
|
||||
// 创建画布
|
||||
CanvasObject = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
CanvasObject.ResizeAndClear(w, h);
|
||||
// 开始绘制
|
||||
CanvasObject.BeginDraw();
|
||||
// 背景图
|
||||
local bgimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventorybackground.img", 0);
|
||||
// 画布绘制背景
|
||||
DrawSpriteFrame(bgimg, 0, 0);
|
||||
|
||||
CanvasObject.DrawSpriteFrame(bgimg, 0, 0);
|
||||
// 装备栏背景
|
||||
local equipmentBackground = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21);
|
||||
DrawSpriteFrame(equipmentBackground, 5, 5);
|
||||
|
||||
|
||||
CanvasObject.DrawSpriteFrame(equipmentBackground, 5, 5);
|
||||
// 顶部光线
|
||||
local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178);
|
||||
DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0);
|
||||
|
||||
// todo 角色展示
|
||||
|
||||
CanvasObject.DrawSpriteFrame(topLight, w / 2 - topLight.GetSize().w / 2, 0);
|
||||
// 结婚戒指槽位
|
||||
local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||||
DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||||
|
||||
|
||||
// local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0);
|
||||
// CanvasObject.DrawSpriteFrame(ringSlotBg, w / 2 - ringSlotBg.GetSize().w / 2, 5);
|
||||
// 辅助装备
|
||||
local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19);
|
||||
DrawSpriteFrame(assist, 179, 69);
|
||||
|
||||
CanvasObject.DrawSpriteFrame(assist, 179, 69);
|
||||
// 耳环
|
||||
local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122);
|
||||
DrawSpriteFrame(earrings, 179, 102);
|
||||
|
||||
CanvasObject.DrawSpriteFrame(earrings, 179, 102);
|
||||
// 魔法石
|
||||
local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20);
|
||||
DrawSpriteFrame(MagicStone, 211, 101);
|
||||
CanvasObject.DrawSpriteFrame(MagicStone, 211, 101);
|
||||
// 结束绘制
|
||||
CanvasObject.EndDraw();
|
||||
Addchild(CanvasObject);
|
||||
}
|
||||
|
||||
// 初始化装备栏
|
||||
function InitEquipment() {
|
||||
for (local i = 0; i< 13; i++) {
|
||||
local SlotBuffer = UISpace_Inventory.EquipmentSlot(i);
|
||||
SlotBuffer.SetPosition(EquipmentSlotPos[i][0], EquipmentSlotPos[i][1]);
|
||||
AddUIChild(SlotBuffer);
|
||||
EquipmentSlot.push(SlotBuffer);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化角色
|
||||
function InitCharacter() {
|
||||
if (!ClientCharacter) return;
|
||||
if (CharacterObject) Removechild(CharacterObject);
|
||||
CharacterObject = ClientCharacter.CreateTempAni("WaitingAni");
|
||||
CharacterObject.SetPosition(126, 152);
|
||||
Addchild(CharacterObject);
|
||||
}
|
||||
|
||||
//设置装备栏装备
|
||||
function SetEquipment(Slot, Equipment) {
|
||||
EquipmentSlot[Slot].SetItem(Equipment);
|
||||
//同步到角色对象中
|
||||
ClientCharacter.Equip[Slot] <- Equipment;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
//如果有拖动道具
|
||||
if (IMouse.DragObj) {
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
}
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// Window.RemoveSelf();
|
||||
// }
|
||||
// TestStage();
|
||||
// }
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
//必须是装备也拖上去的才触发
|
||||
if (ClientCharacterInventory.PageList[0].CurrentItemListPage == 0) {
|
||||
//鼠标上必须有拖拽物品
|
||||
if (IMouse.DragObj) {
|
||||
if (isInRect) {
|
||||
//获取拖动道具在背包中的位置
|
||||
local Pos = IMouse.DragObj.Item.PosInKnapsack;
|
||||
//发送穿戴装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 2,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
文件用途: 物品栏
|
||||
*/
|
||||
//物品槽
|
||||
class ItemSlot {
|
||||
class UISpace_Inventory.ItemSlot {
|
||||
X = null;
|
||||
Y = null;
|
||||
|
||||
|
|
@ -41,6 +41,22 @@ class ItemSlot {
|
|||
function ShowInfo(x, y) {
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
|
|
@ -57,8 +73,10 @@ class ItemSlot {
|
|||
|
||||
|
||||
// 物品栏
|
||||
class _ItemCollection extends Yosin_CommonUi {
|
||||
class UISpace_Inventory.ItemCollection extends Yosin_CommonUi {
|
||||
|
||||
//栏位类型
|
||||
Type = null;
|
||||
// 悬浮时显示的框
|
||||
HoverEffect = null;
|
||||
//行数
|
||||
|
|
@ -73,13 +91,12 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
CurrentShowItem = null;
|
||||
//当前鼠标指向的位置
|
||||
ItemPos = null;
|
||||
//拖拽中的物品对象
|
||||
DragItem = null;
|
||||
//拖拽物品原来的位置
|
||||
DragItemPos = null;
|
||||
|
||||
|
||||
constructor(x, y, rowNum) {
|
||||
constructor(x, y, rowNum, type) {
|
||||
this.Type = type;
|
||||
this.RowNum = rowNum;
|
||||
//计算实际需要的高度
|
||||
local RealH = 30 * rowNum;
|
||||
|
|
@ -121,16 +138,37 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
|
||||
//设置道具列表
|
||||
function SetItemList(gItemList) {
|
||||
|
||||
//创建道具
|
||||
foreach(Index, ItemObject in gItemList) {
|
||||
ItemList[Index] = ItemSlot();
|
||||
ItemList[Index] = UISpace_Inventory.ItemSlot();
|
||||
ItemList[Index].SetItem(ItemObject);
|
||||
}
|
||||
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
//设置道具格子
|
||||
function SetItemSlot(Idx, ItemObject) {
|
||||
if (ItemObject == null) {
|
||||
ItemList[Idx] = null;
|
||||
} else {
|
||||
ItemList[Idx] = UISpace_Inventory.ItemSlot();
|
||||
ItemList[Idx].SetItem(ItemObject);
|
||||
SetAddEffect(Idx);
|
||||
}
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
//设置添加特效
|
||||
function SetAddEffect(Idx) {
|
||||
local AddEffect = Animation("ui/inventory/slot.ani");
|
||||
AddEffect.SetPosition((Idx % 8) * 30, (Idx / 8) * 30);
|
||||
AddEffect.SetZOrder(100);
|
||||
AddEffect.SetUpdateFunc(function(Ani, Dt) {
|
||||
if (Ani.IsUsability == false) Ani.RemoveSelf();
|
||||
});
|
||||
Addchild(AddEffect);
|
||||
}
|
||||
|
||||
//刷新道具列表
|
||||
function RefreshItemList() {
|
||||
//如果不存在则构造画布
|
||||
|
|
@ -159,9 +197,9 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
if (isInRect) {
|
||||
local WorldPosition = this.GetWorldPosition();
|
||||
|
|
@ -188,7 +226,7 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
//如果当前没有拖拽物品时才打开详细信息窗口
|
||||
if (!DragItem) {
|
||||
if (!IMouse.DragObj) {
|
||||
//显示详细信息
|
||||
ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemList[Idx].ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
//记录当前显示的对象
|
||||
|
|
@ -219,57 +257,87 @@ class _ItemCollection extends Yosin_CommonUi {
|
|||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
|
||||
if (ItemPos != null && ItemList[ItemPos]) {
|
||||
DragItem = ItemList[ItemPos];
|
||||
//记录拖拽物品
|
||||
IMouse.AddDragObject(ItemList[ItemPos]);
|
||||
//记录拖拽物品原来的位置
|
||||
DragItemPos = ItemPos;
|
||||
//从槽中移除
|
||||
ItemList[ItemPos] = null;
|
||||
local IconBuffer = DragItem.Item.GetIconSprite();
|
||||
IconBuffer.SetPosition(-15, -15);
|
||||
IMouse.AttachObjectBottom("ItemCollectDragItem", IconBuffer);
|
||||
//刷新物品列表
|
||||
RefreshItemList();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键弹起回调
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||
function OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||
base.OnMouseLbUp(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
|
||||
if (DragItem) {
|
||||
//如果这个格子不是空的 要把他放回交换的位置
|
||||
if (ItemList[ItemPos] != null) {
|
||||
local Temp = ItemList[ItemPos];
|
||||
ItemList[DragItemPos] = Temp;
|
||||
DragItemPos = null;
|
||||
if (IMouse.DragObj) {
|
||||
//如果拖动到窗口内部 发包交换位置
|
||||
local WorldPosition = this.GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, WorldPosition.x, WorldPosition.y, Width, Height)) {
|
||||
MySocket.Send(PACKET_ID.INVENTORY_SWAP_ITEM, {
|
||||
oldBaid = this.Type + 2,
|
||||
newBaid = this.Type + 2,
|
||||
oldPos = this.DragItemPos,
|
||||
newPos = this.ItemPos,
|
||||
});
|
||||
}
|
||||
|
||||
ItemList[ItemPos] = DragItem;
|
||||
DragItem = null;
|
||||
IMouse.RemoveObject("ItemCollectDragItem");
|
||||
//移除鼠标上的拖动道具
|
||||
local DragItem = IMouse.RemoveDragObject();
|
||||
//发包完成后先把道具放回去
|
||||
ItemList[DragItemPos] = DragItem;
|
||||
DragItemPos = null;
|
||||
RefreshItemList();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键按下回调
|
||||
function OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseRbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭显示的对象
|
||||
if (CurrentShowItem) {
|
||||
CurrentShowItem.CloseInfo();
|
||||
}
|
||||
|
||||
if (ItemPos != null && ItemList[ItemPos]) {
|
||||
//穿戴装备
|
||||
if (this.Type == 0) {
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 2,
|
||||
oldPos = ItemPos
|
||||
});
|
||||
}
|
||||
//使用道具
|
||||
else if (this.Type == 1) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//移动Item逻辑
|
||||
function MoveItem(oldPos, newPos) {
|
||||
//如果这个格子不是空的 要把他放回交换的位置
|
||||
if (ItemList[newPos] != null) {
|
||||
local Temp = ItemList[newPos];
|
||||
ItemList[oldPos] = Temp;
|
||||
}
|
||||
ItemList[newPos] = DragItem;
|
||||
RefreshItemList();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// Window.RemoveSelf();
|
||||
// }
|
||||
// TestStage();
|
||||
// }
|
||||
|
|
@ -5,161 +5,6 @@
|
|||
文件用途:
|
||||
*/
|
||||
|
||||
//主类
|
||||
class _PlayerChat extends Yosin_Window {
|
||||
|
||||
//是否为顶层窗口
|
||||
IsTop = true;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
local background = PlayerChat_Backgournd();
|
||||
Addchild(background);
|
||||
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
|
||||
// 普通
|
||||
local ordinary = PlayerChat_SplicingButton(6, 206, 53, 20, 8, "普通", sq_RGBA(255, 255, 255, 255));
|
||||
AddUIChild(ordinary);
|
||||
ordinary.LBDownOnClick = function(btn) {
|
||||
print(111);
|
||||
}
|
||||
ordinary.OnTriangleClick = function(btn) {
|
||||
print(222);
|
||||
}
|
||||
|
||||
// 公会
|
||||
local notice = PlayerChat_SplicingButton(60, 206, 53, 20, 47, "公会", sq_RGBA(254, 77, 245, 255));
|
||||
AddUIChild(notice);
|
||||
notice.LBDownOnClick = function(btn) {
|
||||
print(111);
|
||||
}
|
||||
notice.OnTriangleClick = function(btn) {
|
||||
print(222);
|
||||
}
|
||||
|
||||
// 频道
|
||||
local channel = PlayerChat_SplicingButton(114, 206, 53, 20, 48, "频道", sq_RGBA(221, 153, 197, 255));
|
||||
AddUIChild(channel);
|
||||
channel.LBDownOnClick = function(btn) {
|
||||
print(111);
|
||||
}
|
||||
channel.OnTriangleClick = function(btn) {
|
||||
print(222);
|
||||
}
|
||||
|
||||
// 募集
|
||||
local raise = PlayerChat_SplicingButton(168, 206, 53, 20, 49, "募集", sq_RGBA(105, 212, 238, 255));
|
||||
AddUIChild(raise);
|
||||
raise.LBDownOnClick = function(btn) {
|
||||
print(111);
|
||||
}
|
||||
raise.OnTriangleClick = function(btn) {
|
||||
print(222);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 背景
|
||||
class PlayerChat_Backgournd extends CL_CanvasObject {
|
||||
|
||||
constructor() {
|
||||
base.constructor();
|
||||
|
||||
DrawBackground();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 绘制背景
|
||||
function DrawBackground() {
|
||||
|
||||
// 创建画布
|
||||
CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
ResizeAndClear(332, 600);
|
||||
// 开始绘制
|
||||
BeginDraw();
|
||||
|
||||
|
||||
local topLine = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 159);
|
||||
DrawSpriteFrame(topLine, 0, 0);
|
||||
|
||||
local topBg = CL_SpriteObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 160);
|
||||
topBg.SetPosition(0, 2);
|
||||
topBg.SetScale(1, 28);
|
||||
DrawSprite(topBg);
|
||||
|
||||
local bimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 161);
|
||||
DrawSpriteFrame(bimg, 0, 30);
|
||||
|
||||
local bottomBg = CL_SpriteObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 162);
|
||||
bottomBg.SetPosition(0, 561);
|
||||
bottomBg.SetScale(1, 38);
|
||||
DrawSprite(bottomBg);
|
||||
|
||||
local bottomLine = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 163);
|
||||
DrawSpriteFrame(bottomLine, 0, 598);
|
||||
|
||||
// 系统按钮
|
||||
local systemBtnBackground = Yosin_EmeStretch(53, 21, "sprite/interface/lenheartwindowcommon.img", 166);
|
||||
DrawSprite(systemBtnBackground, 6, 15);
|
||||
|
||||
local systemText = FontAssetManager.GenerateNormal("系统", true, {
|
||||
color = sq_RGBA(200, 173, 134, 255)
|
||||
});
|
||||
DrawActor(systemText, 18, 18);
|
||||
|
||||
// 系统
|
||||
local SystemBround = Yosin_NineBoxStretch(321, 72, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
DrawSprite(SystemBround, 6, 35);
|
||||
|
||||
// 喇叭按钮
|
||||
local megaphoneBtnBackground = Yosin_EmeStretch(53, 21, "sprite/interface/lenheartwindowcommon.img", 166);
|
||||
DrawSprite(megaphoneBtnBackground, 6, 109);
|
||||
|
||||
// 喇叭
|
||||
local megaphoneext = FontAssetManager.GenerateNormal("喇叭", true, {
|
||||
color = sq_RGBA(255, 239, 1, 255)
|
||||
});
|
||||
DrawActor(megaphoneext, 18, 112);
|
||||
|
||||
// 喇叭
|
||||
local megaphoneBround = Yosin_NineBoxStretch(321, 72, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
DrawSprite(megaphoneBround, 6, 130);
|
||||
|
||||
// 消息
|
||||
local PlayerChatBround = Yosin_NineBoxStretch(321, 345, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
DrawSprite(PlayerChatBround, 6, 225);
|
||||
|
||||
|
||||
// 结束绘制
|
||||
EndDraw();
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 消息分类按钮
|
||||
class PlayerChat_SplicingButton extends Yosin_CommonUi {
|
||||
|
||||
|
|
@ -170,11 +15,19 @@ class PlayerChat_SplicingButton extends Yosin_CommonUi {
|
|||
SpriteState = -1;
|
||||
FrameList = null;
|
||||
|
||||
select = false;
|
||||
Select = false;
|
||||
cacheY = null;
|
||||
|
||||
//大按钮
|
||||
BigButton = null;
|
||||
//三角按钮
|
||||
TriangleButton = null;
|
||||
|
||||
//左键按下回调
|
||||
LBDown = null;
|
||||
//左键单击回调
|
||||
LBDownOnClick = null;
|
||||
//三角按钮单击回调
|
||||
OnTriangleClick = null;
|
||||
|
||||
|
||||
|
|
@ -187,11 +40,11 @@ class PlayerChat_SplicingButton extends Yosin_CommonUi {
|
|||
Addchild(Sprite);
|
||||
|
||||
for (local i = 0; i< 3; i++) {
|
||||
|
||||
local canvas = Yosin_EmeStretch(W, H, "sprite/interface/lenheartwindowcommon.img", 160 + i * 3);
|
||||
local Sf = canvas.ExportSpriteFrame();
|
||||
FrameList.push(Sf);
|
||||
}
|
||||
ChangeFrame();
|
||||
|
||||
// 文字
|
||||
local Text = FontAssetManager.GenerateNormal(title, true, {
|
||||
|
|
@ -206,18 +59,18 @@ class PlayerChat_SplicingButton extends Yosin_CommonUi {
|
|||
Addchild(triangle);
|
||||
|
||||
// 按钮
|
||||
local bigButton = Yosin_BaseButton(0, 0, W - 15, H, "sprite/interface/lenheartwindowcommon.img", 70);
|
||||
AddUIChild(bigButton);
|
||||
bigButton.OnClick = function(btn) {
|
||||
BigButton = Yosin_BaseButton(0, 0, W - 15, H, "sprite/interface/lenheartwindowcommon.img", 70);
|
||||
AddUIChild(BigButton);
|
||||
BigButton.OnClick = function(btn) {
|
||||
if (LBDownOnClick) {
|
||||
LBDownOnClick(this);
|
||||
};
|
||||
}.bindenv(this);
|
||||
|
||||
// 三角按钮
|
||||
local triangleButton = Yosin_BaseButton(W - 15, 0, 15, H, "sprite/interface/lenheartwindowcommon.img", 70);
|
||||
AddUIChild(triangleButton);
|
||||
triangleButton.OnClick = function(btn) {
|
||||
TriangleButton = Yosin_BaseButton(W - 15, 0, 15, H, "sprite/interface/lenheartwindowcommon.img", 70);
|
||||
AddUIChild(TriangleButton);
|
||||
TriangleButton.OnClick = function(btn) {
|
||||
if (OnTriangleClick) {
|
||||
OnTriangleClick(this);
|
||||
};
|
||||
|
|
@ -241,29 +94,415 @@ class PlayerChat_SplicingButton extends Yosin_CommonUi {
|
|||
}
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
|
||||
if (select) return;
|
||||
|
||||
//不可用
|
||||
if (State == 3) {
|
||||
|
||||
} else {
|
||||
//按下
|
||||
if (isLBDown) {
|
||||
State = 2;
|
||||
select = true;
|
||||
}
|
||||
//悬停
|
||||
else if (isInRect) {
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (Select) return;
|
||||
if (isInRect) {
|
||||
State = 1;
|
||||
}
|
||||
//普通
|
||||
else {
|
||||
} else {
|
||||
State = 0;
|
||||
}
|
||||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isLBDown && !TriangleButton.isInRect) {
|
||||
ChangeSelectState(true);
|
||||
LBDown(this);
|
||||
}
|
||||
}
|
||||
|
||||
//更改选中状态
|
||||
function ChangeSelectState(Flag) {
|
||||
if (Flag) {
|
||||
State = 2;
|
||||
Select = true;
|
||||
ChangeFrame();
|
||||
} else {
|
||||
State = 0;
|
||||
Select = false;
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
class PlayerChat_InputBox extends Yosin_CommonUi {
|
||||
|
||||
//表情按钮
|
||||
EmotionButton = null;
|
||||
//框背景
|
||||
BoxBackground = null;
|
||||
//聊天信息类型
|
||||
ChatType = 0;
|
||||
//文本
|
||||
TextObject = null;
|
||||
Text = "";
|
||||
//输入光标
|
||||
InputCursor = null;
|
||||
//输入位置
|
||||
InputPos = 0;
|
||||
//是否获取焦点
|
||||
IsFocus = false;
|
||||
|
||||
constructor() {
|
||||
base.constructor(0, 0, 321, 28);
|
||||
|
||||
// 按钮
|
||||
EmotionButton = Yosin_BaseButton(0, 0, 24, 24, "sprite/interface/newstyle/windows/chatting/chatting_new.img", 37);
|
||||
EmotionButton.DownSimulateOffset = false;
|
||||
AddUIChild(EmotionButton);
|
||||
EmotionButton.OnClick = function(btn) {
|
||||
|
||||
}.bindenv(this);
|
||||
|
||||
//输入框
|
||||
BoxBackground = Yosin_NineBoxStretch(297, 25, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
BoxBackground.SetPosition(24, 0);
|
||||
Addchild(BoxBackground);
|
||||
|
||||
//文本
|
||||
TextObject = FontAssetManager.GenerateNormal("", false, {
|
||||
color = sq_RGBA(255, 255, 255, 250)
|
||||
});
|
||||
TextObject.SetPosition(28, 3);
|
||||
Addchild(TextObject);
|
||||
|
||||
|
||||
//输入光标
|
||||
InputCursor = CreateCursor();
|
||||
InputCursor.SetUpdateFunc(function(Object, Dt) {
|
||||
//处于焦点中执行
|
||||
if (IsFocus) {
|
||||
//光标闪烁逻辑
|
||||
{
|
||||
if (!(Object.Var.rawin("TimeFlag"))) {
|
||||
Object.Var.TimeFlag <- 0;
|
||||
Object.Var.VisibleFlag <- false;
|
||||
}
|
||||
Object.Var.TimeFlag += Dt;
|
||||
if (Object.Var.TimeFlag >= 500) {
|
||||
Object.Var.TimeFlag <- 0;
|
||||
Object.SetVisible(Object.Var.VisibleFlag);
|
||||
Object.Var.VisibleFlag <- !Object.Var.VisibleFlag;
|
||||
}
|
||||
}
|
||||
//同步光标位置逻辑
|
||||
{
|
||||
Object.SetPosition(TextObject.X + TextObject.GetSize().w, 4);
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
Addchild(InputCursor);
|
||||
|
||||
_Imm_Input_Func_.rawset(C_Object, Imm_Input.bindenv(this));
|
||||
}
|
||||
|
||||
//判断是否中文字符
|
||||
function IsChineseChar(code) {
|
||||
return (code & 0x80) != 0;
|
||||
}
|
||||
|
||||
//接收文本数据
|
||||
function Imm_Input(str) {
|
||||
if (!this) return -1;
|
||||
if (!IsFocus) return;
|
||||
//退格键
|
||||
if (str == "\b") {
|
||||
if (this.Text.len() > 0) {
|
||||
this.Text = Sq_RemoveStringLast(this.Text);
|
||||
}
|
||||
}
|
||||
//换行符去掉
|
||||
else if (str != "\r") this.Text += str;
|
||||
|
||||
//同步文本对象数据
|
||||
TextObject.SetText(this.Text);
|
||||
//每次设置文本时确保光标显示
|
||||
InputCursor.SetVisible(true);
|
||||
InputCursor.Var.TimeFlag <- 0;
|
||||
InputCursor.Var.VisibleFlag <- false;
|
||||
}
|
||||
|
||||
function CreateCursor() {
|
||||
local Canvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Canvas.ResizeAndClear(1, 15);
|
||||
// 开始绘制
|
||||
Canvas.BeginDraw();
|
||||
|
||||
Canvas.SetFillBrush(sq_RGBA(255, 255, 255, 250));
|
||||
Canvas.SetStrokeBrush(sq_RGBA(255, 255, 255, 250));
|
||||
Canvas.DrawLine(1, 1, 1, 15);
|
||||
// 结束绘制
|
||||
Canvas.EndDraw();
|
||||
Canvas.SetVisible(false);
|
||||
return Canvas;
|
||||
}
|
||||
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x, Pos.y, Width, Height)) {
|
||||
SetFocus(true);
|
||||
} else {
|
||||
SetFocus(false);
|
||||
}
|
||||
}
|
||||
|
||||
//设置焦点模式
|
||||
function SetFocus(Flag) {
|
||||
IsFocus = Flag;
|
||||
InputCursor.SetVisible(Flag);
|
||||
Sq_SetImmEnabled(Flag);
|
||||
}
|
||||
|
||||
//回车键回调
|
||||
function OnEnter() {
|
||||
SetFocus(!IsFocus);
|
||||
//发送消息了
|
||||
if (!IsFocus && this.Text.len() > 0) {
|
||||
MySocket.Send(PACKET_ID.SEND_CHAT_MESSAGE, {
|
||||
msg = this.Text,
|
||||
type = this.ChatType
|
||||
});
|
||||
this.Text = "";
|
||||
TextObject.SetText(this.Text);
|
||||
//还原光标位置避免闪烁
|
||||
InputCursor.SetPosition(TextObject.X, 4);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//消息渲染窗口
|
||||
class _PlayerChat_RenderMsg_Window extends Yosin_Window {
|
||||
|
||||
//是否为独立窗口
|
||||
IsIndependent = false;
|
||||
//是否为图层窗口
|
||||
IsLayer = true;
|
||||
//消息文本对象
|
||||
MsgTextObject = null;
|
||||
//文本Y轴偏移量
|
||||
TextYposOffset = 0;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
SetClipRect(0, 0, 321, 534);
|
||||
MsgTextObject = CL_CanvasObject();
|
||||
Addchild(MsgTextObject);
|
||||
}
|
||||
|
||||
//渲染消息
|
||||
function RenderMsg() {
|
||||
MsgTextObject.ResizeAndClear(321, 5000);
|
||||
MsgTextObject.BeginDraw();
|
||||
TextYposOffset = 0;
|
||||
foreach(Index, Msg in Parent.MsgManager) {
|
||||
local Name = FontAssetManager.GenerateNormal(Msg.name + ": ", false, {
|
||||
color = sq_RGBA(255, 255, 255, 255),
|
||||
});
|
||||
MsgTextObject.DrawActor(Name, 0, TextYposOffset);
|
||||
local Text = FontAssetManager.GenerateNormal(Msg.msg, false, {
|
||||
color = sq_RGBA(255, 255, 255, 255),
|
||||
wrap_width = 300 - Name.GetSize().w
|
||||
});
|
||||
MsgTextObject.DrawActor(Text, Name.GetSize().w, TextYposOffset);
|
||||
//绘制完成后增加Y轴的偏移量
|
||||
TextYposOffset += Text.GetSize().h;
|
||||
}
|
||||
if (TextYposOffset > 534) {
|
||||
Parent.ScrollObject.SetScrollBarHeight(534.0 / TextYposOffset.tofloat() * 534.0);
|
||||
}
|
||||
MsgTextObject.EndDraw();
|
||||
}
|
||||
|
||||
//设置滚动位置
|
||||
function SetScrollPos(Rate) {
|
||||
MsgTextObject.SetPosition(0, -(TextYposOffset - 534) * Rate);
|
||||
}
|
||||
}
|
||||
|
||||
//主类
|
||||
class _PlayerChat extends Yosin_Window {
|
||||
|
||||
//是否为顶层窗口
|
||||
IsTop = true;
|
||||
//消息分类按钮List
|
||||
SplicingButtonList = null;
|
||||
//消息管理器
|
||||
MsgManager = null;
|
||||
//消息文本对象
|
||||
MsgTextWindow = null;
|
||||
//聊天输入框
|
||||
InputBox = null;
|
||||
//滚动条
|
||||
ScrollObject = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
SplicingButtonList = [];
|
||||
MsgManager = [];
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
//渲染背景
|
||||
RenderBackground();
|
||||
//注册组件
|
||||
RegisterWidget();
|
||||
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_ENTER, function(Flag) {
|
||||
//抬起的时候
|
||||
if (Flag == 0) {
|
||||
InputBox.OnEnter();
|
||||
}
|
||||
}.bindenv(this));
|
||||
|
||||
getroottable().ClientChatWindow <- this;
|
||||
}
|
||||
|
||||
function RenderBackground() {
|
||||
local Bg = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
Bg.ResizeAndClear(332, 600);
|
||||
// 开始绘制
|
||||
Bg.BeginDraw();
|
||||
local topLine = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 159);
|
||||
Bg.DrawSpriteFrame(topLine, 0, 0);
|
||||
local topBg = CL_SpriteObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 160);
|
||||
topBg.SetPosition(0, 2);
|
||||
topBg.SetScale(1, 28);
|
||||
Bg.DrawSprite(topBg);
|
||||
local bimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 161);
|
||||
Bg.DrawSpriteFrame(bimg, 0, 30);
|
||||
local bottomBg = CL_SpriteObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 162);
|
||||
bottomBg.SetPosition(0, 561);
|
||||
bottomBg.SetScale(1, 38);
|
||||
Bg.DrawSprite(bottomBg);
|
||||
local bottomLine = CL_SpriteFrameObject("sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 163);
|
||||
Bg.DrawSpriteFrame(bottomLine, 0, 598);
|
||||
|
||||
// 消息
|
||||
local PlayerChatBround = Yosin_NineBoxStretch(321, 544, "sprite/interface/newstyle/windows/chatting/chatting_ver4.img", 265);
|
||||
PlayerChatBround.SetPosition(6, 29);
|
||||
Bg.DrawSprite(PlayerChatBround);
|
||||
// 结束绘制
|
||||
Bg.EndDraw();
|
||||
Addchild(Bg);
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
|
||||
// 普通
|
||||
local ordinary = PlayerChat_SplicingButton(6, 10, 53, 20, 8, "普通", sq_RGBA(255, 255, 255, 255));
|
||||
ordinary.ChangeSelectState(true);
|
||||
AddUIChild(ordinary);
|
||||
ordinary.LBDown = function(btn) {
|
||||
ChangeSplicing(0);
|
||||
}.bindenv(this);
|
||||
ordinary.LBDownOnClick = function(btn) {}.bindenv(this);
|
||||
ordinary.OnTriangleClick = function(btn) {}.bindenv(this);
|
||||
SplicingButtonList.push(ordinary);
|
||||
|
||||
// 公会
|
||||
local notice = PlayerChat_SplicingButton(60, 10, 53, 20, 47, "公会", sq_RGBA(254, 77, 245, 255));
|
||||
AddUIChild(notice);
|
||||
notice.LBDown = function(btn) {
|
||||
ChangeSplicing(1);
|
||||
}.bindenv(this);
|
||||
notice.LBDownOnClick = function(btn) {}.bindenv(this);
|
||||
notice.OnTriangleClick = function(btn) {}.bindenv(this);
|
||||
SplicingButtonList.push(notice);
|
||||
|
||||
// 频道
|
||||
local channel = PlayerChat_SplicingButton(114, 10, 53, 20, 48, "频道", sq_RGBA(221, 153, 197, 255));
|
||||
AddUIChild(channel);
|
||||
channel.LBDown = function(btn) {
|
||||
ChangeSplicing(2);
|
||||
}.bindenv(this);
|
||||
channel.LBDownOnClick = function(btn) {}.bindenv(this);
|
||||
channel.OnTriangleClick = function(btn) {}.bindenv(this);
|
||||
SplicingButtonList.push(channel);
|
||||
|
||||
// 募集
|
||||
local raise = PlayerChat_SplicingButton(168, 10, 53, 20, 49, "募集", sq_RGBA(105, 212, 238, 255));
|
||||
AddUIChild(raise);
|
||||
raise.LBDown = function(btn) {
|
||||
ChangeSplicing(3);
|
||||
}.bindenv(this);
|
||||
raise.LBDownOnClick = function(btn) {}.bindenv(this);
|
||||
raise.OnTriangleClick = function(btn) {}.bindenv(this);
|
||||
SplicingButtonList.push(raise);
|
||||
|
||||
//滚动条
|
||||
ScrollObject = Yosin_ScrollBar(315, 32, 537, 20);
|
||||
ScrollObject.SetScrollBarState(false);
|
||||
ScrollObject.SetChangeCallBack(function(Value) {
|
||||
MsgTextWindow.SetScrollPos(Value);
|
||||
}.bindenv(this));
|
||||
AddUIChild(ScrollObject);
|
||||
|
||||
//聊天输入框
|
||||
InputBox = PlayerChat_InputBox();
|
||||
InputBox.SetPosition(6, Height - 28);
|
||||
AddUIChild(InputBox);
|
||||
|
||||
//信息画布窗口
|
||||
MsgTextWindow = _PlayerChat_RenderMsg_Window("聊天信息渲染窗口", 12, 34, 321, 550, 0);
|
||||
MsgTextWindow.SetPosition(12, 34);
|
||||
AddUIChild(MsgTextWindow);
|
||||
}
|
||||
|
||||
function ChangeSplicing(Idx) {
|
||||
foreach(Index, Button in SplicingButtonList) {
|
||||
if (Index == Idx) continue;
|
||||
Button.Select = false;
|
||||
Button.State = 0;
|
||||
Button.ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
//push消息
|
||||
function PushMsg(Msg) {
|
||||
MsgManager.push(Msg);
|
||||
|
||||
local Flag = (ScrollObject.Controller.CurPos >= 0.8) || ScrollObject.ScrollButton == null;
|
||||
//渲染消息
|
||||
MsgTextWindow.RenderMsg();
|
||||
if (Flag) {
|
||||
ScrollObject.SetScrollBarValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标滚轮事件回调
|
||||
function OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseWheel(Wheel, MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
local Pos = GetWorldPosition();
|
||||
if (MousePos_X > Pos.x) {
|
||||
if (Wheel == -1) {
|
||||
ScrollObject.SetScroll(true);
|
||||
}
|
||||
if (Wheel == 1) {
|
||||
ScrollObject.SetScroll(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,375 @@
|
|||
/*
|
||||
文件名:7_Npc_Shop.nut
|
||||
路径:User/UI/Window/7_Npc_Shop.nut
|
||||
创建日期:2025-01-26 18:30
|
||||
文件用途:NPC商店
|
||||
*/
|
||||
|
||||
//NPC商店命名空间
|
||||
UISpace_NpcShop <- {};
|
||||
|
||||
|
||||
class UISpace_NpcShop.Item extends Yosin_CommonUi {
|
||||
//槽位
|
||||
Index = null;
|
||||
//物品
|
||||
Item = null;
|
||||
//物品图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
//物品需求图标
|
||||
ItemRequireIcon = null;
|
||||
//物品需求数量
|
||||
ItemRequireCount = null;
|
||||
//物品需求名称
|
||||
ItemRequireName = null;
|
||||
//信息
|
||||
Info = null;
|
||||
//画布对象
|
||||
Canvas = null;
|
||||
//悬停框
|
||||
HoverBox = null;
|
||||
|
||||
constructor(gIndex, gInfo) {
|
||||
base.constructor(0, 0, 165, 57);
|
||||
this.Index = gIndex;
|
||||
this.Info = gInfo;
|
||||
|
||||
|
||||
InitItem();
|
||||
InitDraw();
|
||||
}
|
||||
|
||||
function InitItem() {
|
||||
//构造道具
|
||||
this.Item = GameItem.Item.ConstructionItemById(Info.Id);
|
||||
//构造图标
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
//构造详细信息窗口
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
this.ItemInfo.SetZOrder(1);
|
||||
//构造需求图标
|
||||
//物品
|
||||
if (this.Info.Material) {
|
||||
|
||||
}
|
||||
//金币
|
||||
else if (this.Info.Gold) {
|
||||
ItemRequireCount = this.Info.Gold;
|
||||
ItemRequireIcon = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 299);
|
||||
ItemRequireName = "金币";
|
||||
}
|
||||
//点卷
|
||||
else if (this.Info.Cera) {
|
||||
ItemRequireName = "点卷";
|
||||
}
|
||||
//代币券
|
||||
else if (this.Info.CeraPoint) {
|
||||
ItemRequireName = "代币券";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function InitDraw() {
|
||||
Canvas = CL_CanvasObject();
|
||||
Addchild(Canvas);
|
||||
Canvas.ResizeAndClear(321, 5000);
|
||||
Canvas.BeginDraw();
|
||||
//绘制背景
|
||||
Canvas.DrawSpriteFrame(CL_SpriteFrameObject("sprite/interface2/ui/shop/shop_slot.img", 0), 0, 0);
|
||||
//绘制图标
|
||||
Canvas.DrawSprite(ItemIcon, 5, 7);
|
||||
//绘制名称
|
||||
local Name = FontAssetManager.GenerateNormal(Item.Name, false, {
|
||||
color = AssetManager.EtcConfig.ItemInfoTag.rarity_color[Item.Rarity]
|
||||
});
|
||||
Canvas.DrawActor(Name, 44, 7);
|
||||
//绘制价格槽
|
||||
local SlotBg = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 391);
|
||||
SlotBg.SetScale(5.2, 1.0);
|
||||
SlotBg.SetPosition(84, 38);
|
||||
Canvas.DrawSprite(SlotBg);
|
||||
//绘制需求道具图标
|
||||
if (ItemRequireIcon) {
|
||||
ItemRequireIcon.SetScale(0.5, 0.5);
|
||||
ItemRequireIcon.SetPosition(142, 38);
|
||||
Canvas.DrawSprite(ItemRequireIcon);
|
||||
}
|
||||
//绘制需求数量
|
||||
if (ItemRequireCount) {
|
||||
local RequireCount = FontAssetManager.GenerateNormal(ItemRequireCount.tostring(), false, {
|
||||
color = sq_RGBA(255, 255, 255, 255) //TODO 这里要计算我是否有足够的道具去购买他 选择是否标红
|
||||
});
|
||||
Canvas.DrawActor(RequireCount, 142 - (RequireCount.GetSize().w), 37);
|
||||
}
|
||||
|
||||
|
||||
Canvas.EndDraw();
|
||||
|
||||
//构造悬停框精灵
|
||||
HoverBox = CL_SpriteObject("sprite/interface2/ui/shop/shop_slot.img", 1);
|
||||
HoverBox.SetMode(0);
|
||||
HoverBox.SetVisible(false);
|
||||
Addchild(HoverBox);
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect) {
|
||||
//没有输入框的时候才会显示悬停框
|
||||
if (!Parent.QuantityInput || Parent.QuantityInput.Visible == false) HoverBox.SetVisible(true);
|
||||
//判断是否有悬停到道具图标
|
||||
local Pos = GetWorldPosition();
|
||||
if (Math.IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Pos.x + 5, Pos.y + 7, 32, 32)) {
|
||||
if (!ItemInfoShowFlag) {
|
||||
ItemInfoShowFlag = true;
|
||||
ItemInfo.SetPosition(MousePos_X + 16, MousePos_Y + 16);
|
||||
ItemInfo.ResetFocus();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
HoverBox.SetVisible(false);
|
||||
if (ItemInfoShowFlag) {
|
||||
ItemInfoShowFlag = false;
|
||||
ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//输入框出来了关闭道具显示信息
|
||||
if (Parent.QuantityInput && Parent.QuantityInput.Visible) {
|
||||
HoverBox.SetVisible(false);
|
||||
if (ItemInfoShowFlag) {
|
||||
ItemInfoShowFlag = false;
|
||||
ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键按下回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭显示的对象
|
||||
if (ItemInfoShowFlag) {
|
||||
ItemInfoShowFlag = false;
|
||||
ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//购买逻辑
|
||||
if (isInRect && !WindowInteractiveFlag) {
|
||||
if (!Parent.QuantityInput) {
|
||||
Parent.QuantityInput = _QuantityInput(MousePos_X - 35, MousePos_Y - 35);
|
||||
} else {
|
||||
Parent.QuantityInput.SetPosition(MousePos_X - 35, MousePos_Y - 35);
|
||||
Parent.QuantityInput.ResetFocus();
|
||||
}
|
||||
Parent.QuantityInput.SetOnConfirmFunc(function(Count) {
|
||||
//设置购买信息
|
||||
Parent.Parent.SetBuyInfo({
|
||||
npcshopId = Parent.Parent.ShopId,
|
||||
shopId = Parent.Type,
|
||||
pos = Index,
|
||||
num = Count
|
||||
});
|
||||
local NoticeBox = _Yosin_MessageBox(format("购买[%s]数量 %d 个\n总购买费用为 %d %s\n您确定要购买吗?", Item.Name, Count, Count * ItemRequireCount, ItemRequireName));
|
||||
NoticeBox.SetOnConfirmFunc(function() {
|
||||
Parent.Parent.SendBuyInfo();
|
||||
}.bindenv(this));
|
||||
}.bindenv(this));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 物品栏
|
||||
class UISpace_NpcShop.ItemCollection extends Yosin_Window {
|
||||
|
||||
//是否为独立窗口
|
||||
IsIndependent = false;
|
||||
//是否为图层窗口
|
||||
IsLayer = true;
|
||||
|
||||
//栏位类型
|
||||
Type = null;
|
||||
|
||||
//信息
|
||||
Info = null;
|
||||
//物品列表
|
||||
ItemList = null;
|
||||
//数量输入框
|
||||
QuantityInput = null;
|
||||
|
||||
|
||||
constructor(x, y, type, gInfo) {
|
||||
this.Type = type;
|
||||
this.Info = gInfo;
|
||||
//计算实际需要的高度
|
||||
base.constructor("商店页面" + type + clock(), x, y, 336, 400, 0);
|
||||
SetClipRect(0, 0, 336, 400);
|
||||
// OpenDeBug();
|
||||
Init();
|
||||
}
|
||||
|
||||
function Init() {
|
||||
ItemList = [];
|
||||
foreach(Index, ItemObject in Info) {
|
||||
local Buffer = UISpace_NpcShop.Item(Index, ItemObject);
|
||||
Buffer.SetPosition(2 + (168 * (Index % 2)), 2 + (61 * (Index / 2)));
|
||||
AddUIChild(Buffer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UISpace_NpcShop.Shop extends Yosin_Window {
|
||||
//商店信息
|
||||
Info = null;
|
||||
//商店ID
|
||||
ShopId = null;
|
||||
//栏
|
||||
ItemCollection = null;
|
||||
//滚动条
|
||||
ScrollObject = null;
|
||||
//购买信息包
|
||||
BuyInfo = null;
|
||||
|
||||
function _typeof() {
|
||||
return "Game_Window";
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
ItemCollection = [];
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
}
|
||||
|
||||
function Init(gShopId) {
|
||||
ShopId = gShopId;
|
||||
//判断NPC是否有商店
|
||||
Info = AssetManager.GetNpcShop(ShopId);
|
||||
if (Info) {
|
||||
local title = Yosin_TopTitle(Width, Height, Info.name);
|
||||
AddUIChild(title);
|
||||
//注册控件
|
||||
} else throw "NPC没有商店";
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
//关闭按钮
|
||||
local closeBtn = Yosin_BaseButton(Width - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||
closeBtn.DownSimulateOffset = false;
|
||||
closeBtn.SetZOrder(1);
|
||||
closeBtn.OnClick = function(btn) {
|
||||
DestroyWindow();
|
||||
}.bindenv(this);
|
||||
AddUIChild(closeBtn);
|
||||
|
||||
//分页按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 30, 354, Info.PageNameList, "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
// ChangPage(index);
|
||||
}.bindenv(this);
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
foreach(Iindex, ItemCollectionBuffer in ItemCollection) {
|
||||
if (Iindex == index) {
|
||||
ItemCollectionBuffer.SetVisible(true);
|
||||
} else {
|
||||
ItemCollectionBuffer.SetVisible(false);
|
||||
}
|
||||
}
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
//底框
|
||||
local Bg = Yosin_NineBoxStretch(353, 407, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
Bg.SetPosition(8, 51);
|
||||
Addchild(Bg);
|
||||
|
||||
//滚动条
|
||||
ScrollObject = Yosin_ScrollBar(347, 55, 400, 20);
|
||||
ScrollObject.SetScrollBarState(false);
|
||||
ScrollObject.SetChangeCallBack(function(Value) {
|
||||
MsgTextWindow.SetScrollPos(Value);
|
||||
}.bindenv(this));
|
||||
AddUIChild(ScrollObject);
|
||||
|
||||
//创建栏位
|
||||
foreach(Index, LInfo in Info.PageList) {
|
||||
local Buffer = UISpace_NpcShop.ItemCollection(10, 53, Index, LInfo);
|
||||
ItemCollection.push(Buffer);
|
||||
AddUIChild(Buffer);
|
||||
if (Index != 0) Buffer.SetVisible(false);
|
||||
}
|
||||
|
||||
//购买按钮
|
||||
local BuyButton = Yosin_SplicingButton(115, 456, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||
//购买按钮文本
|
||||
local BuyTextActor = FontAssetManager.GenerateNormal("购买", false, {
|
||||
color = sq_RGBA(186, 147, 97, 255)
|
||||
});
|
||||
BuyTextActor.SetZOrder(1);
|
||||
BuyTextActor.SetPosition(18, 3);
|
||||
BuyButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
BuyButton.Addchild(BuyTextActor);
|
||||
AddUIChild(BuyButton);
|
||||
|
||||
//出售按钮
|
||||
local SellButton = Yosin_SplicingButton(184, 456, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||
//出售按钮文本
|
||||
local SellTextActor = FontAssetManager.GenerateNormal("出售", false, {
|
||||
color = sq_RGBA(186, 147, 97, 255)
|
||||
});
|
||||
SellTextActor.SetZOrder(1);
|
||||
SellTextActor.SetPosition(18, 3);
|
||||
SellButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
SellButton.Addchild(SellTextActor);
|
||||
AddUIChild(SellButton);
|
||||
}
|
||||
|
||||
//设置购买信息
|
||||
function SetBuyInfo(gTable) {
|
||||
BuyInfo = gTable;
|
||||
}
|
||||
|
||||
//发送购买信息
|
||||
function SendBuyInfo() {
|
||||
if (BuyInfo) {
|
||||
//发送购买信息
|
||||
MySocket.Send(PACKET_ID.BUY_ITEM, BuyInfo);
|
||||
//清空购买信息
|
||||
BuyInfo = null;
|
||||
}
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
//在Esc按下时
|
||||
function OnEsc() {
|
||||
//下帧执行
|
||||
Timer.SetNextFrame(function(Window) {
|
||||
Window.DestroyWindow();
|
||||
}, this);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,322 @@
|
|||
/*
|
||||
文件名:8_SkillTree.nut
|
||||
路径:User/UI/Window/8_SkillTree/8_SkillTree.nut
|
||||
创建日期:2025-02-17 10:03
|
||||
文件用途:技能树
|
||||
*/
|
||||
//个人信息命名空间
|
||||
if (!getroottable().rawin("UISpace_SkillTree")) UISpace_SkillTree <- {};
|
||||
|
||||
//技能对象
|
||||
class UISpace_SkillTree.Skill extends Yosin_CommonUi {
|
||||
//技能
|
||||
Skill = 0;
|
||||
//鼠标悬浮效果
|
||||
HoverEffect = null;
|
||||
|
||||
constructor(x, y, width, height, gSkill) {
|
||||
this.Skill = gSkill;
|
||||
base.constructor(x, y, width, height);
|
||||
// OpenDeBug();
|
||||
|
||||
Init();
|
||||
|
||||
HoverEffect = CL_SpriteObject("sprite/interface2/ui/newskillshop/newskillshop.img", 35);
|
||||
HoverEffect.SetPosition(-1, -1);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
}
|
||||
|
||||
function Init() {
|
||||
//背景
|
||||
local Background = CL_SpriteObject("sprite/interface2/ui/newskillshop/newskillshop.img", 34);
|
||||
Addchild(Background);
|
||||
|
||||
//技能图标
|
||||
local SkillIcon = Skill.GetIconSprite();
|
||||
SkillIcon.SetPosition(4, 4);
|
||||
Addchild(SkillIcon);
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
// if (!ItemInfoShowFlag) {
|
||||
// //显示详细信息
|
||||
// ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
// }
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
// //关闭所有详细信息显示
|
||||
// if (ItemInfoShowFlag) {
|
||||
// CloseInfo();
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//技能树窗口
|
||||
class UISpace_SkillTree.Tree extends Yosin_Window {
|
||||
//是否为独立窗口
|
||||
IsIndependent = false;
|
||||
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
//是否为图层窗口
|
||||
IsLayer = true;
|
||||
|
||||
//技能树信息
|
||||
TreeInfo = null;
|
||||
|
||||
//技能List
|
||||
SkillList = null;
|
||||
|
||||
//滚动条
|
||||
ScrollObject = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
SkillList = [];
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
SetClipRect(0, 0, gWidth, gHeight);
|
||||
// OpenDeBug();
|
||||
|
||||
// 背景
|
||||
local Background = CL_SpriteObject("sprite/interface2/ui/newskillshop/newskillshop.img", 0);
|
||||
Background.SetPosition(1, 0);
|
||||
Addchild(Background);
|
||||
|
||||
//滚动条
|
||||
ScrollObject = Yosin_ScrollBar(gWidth - 10, 1, 400, 20);
|
||||
ScrollObject.SetScrollBarState(false);
|
||||
ScrollObject.SetChangeCallBack(function(Value) {
|
||||
MsgTextWindow.SetScrollPos(Value);
|
||||
}.bindenv(this));
|
||||
AddUIChild(ScrollObject);
|
||||
}
|
||||
|
||||
//通过技能树Config构造
|
||||
function Init(Config) {
|
||||
TreeInfo = Config;
|
||||
|
||||
foreach(SkillIndex, Info in Config) {
|
||||
local SkillBuffer = GameItem.Skill(Parent.Job, SkillIndex);
|
||||
local SkillSlotBuffer = UISpace_SkillTree.Skill(35 + Info.IconPos.x, 10 + Info.IconPos.y, 36, 48, SkillBuffer);
|
||||
SkillList.push(SkillSlotBuffer);
|
||||
AddUIChild(SkillSlotBuffer);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//主类
|
||||
class UISpace_SkillTree._SkillTree extends Yosin_Window {
|
||||
|
||||
//背景画布
|
||||
BackGroundCanvas = null;
|
||||
|
||||
//技能树窗口
|
||||
SkillTreeWindow = null;
|
||||
|
||||
//技能树信息
|
||||
TreeInfo = null;
|
||||
|
||||
//技能点
|
||||
SkillPoint = 11451;
|
||||
|
||||
//职业
|
||||
Job = 0;
|
||||
//转职职业
|
||||
GrowType = 0;
|
||||
|
||||
//是否可见
|
||||
Visible = false;
|
||||
|
||||
function _typeof() {
|
||||
return "Game_Window";
|
||||
}
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
local title = Yosin_TopTitle(gWidth, gHeight, "技能栏(K)");
|
||||
AddUIChild(title);
|
||||
|
||||
RegisterBackGround();
|
||||
RegisterButton();
|
||||
|
||||
|
||||
|
||||
|
||||
// 标题按钮
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(5, 30, Width - 10, ["技能类型I"], "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
|
||||
//注册按键回调事件
|
||||
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_SKILL_WINDOW, function(Flag) {
|
||||
//按下的时候
|
||||
if (Flag == 1) {
|
||||
//如果窗口已经打开
|
||||
if (this.Visible) {
|
||||
//关闭窗口
|
||||
CloseWindow();
|
||||
} else {
|
||||
//打开窗口
|
||||
ResetFocus();
|
||||
}
|
||||
}
|
||||
}.bindenv(this));
|
||||
}
|
||||
|
||||
function RegisterBackGround() {
|
||||
BackGroundCanvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
BackGroundCanvas.ResizeAndClear(Width, Height);
|
||||
BackGroundCanvas.SetFillBrush(sq_RGBA(59, 56, 57, 250));
|
||||
BackGroundCanvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250));
|
||||
// 开始绘制
|
||||
BackGroundCanvas.BeginDraw();
|
||||
|
||||
|
||||
//背景框-左
|
||||
local LeftBox = Yosin_NineBoxStretch(Width - 230, 438, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
LeftBox.SetPosition(5, 52);
|
||||
BackGroundCanvas.DrawActor(LeftBox);
|
||||
|
||||
//技能点背景槽
|
||||
local SkillPointBackgroundSlot = Yosin_NineBoxStretch(Width - 230, 35, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
SkillPointBackgroundSlot.SetPosition(5, 52);
|
||||
BackGroundCanvas.DrawActor(SkillPointBackgroundSlot);
|
||||
|
||||
//技能点文字
|
||||
local SkillPointText = FontAssetManager.GenerateNormal(format("技能点 %d", SkillPoint), true, {
|
||||
color = sq_RGBA(105, 212, 238, 250)
|
||||
});
|
||||
BackGroundCanvas.DrawActor(SkillPointText, 15, 60);
|
||||
|
||||
//背景框-右
|
||||
local RightBox = Yosin_NineBoxStretch(223, 470, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
RightBox.SetPosition(Width - 228, 52);
|
||||
BackGroundCanvas.DrawActor(RightBox);
|
||||
|
||||
|
||||
//右侧文字使用指南背景
|
||||
// local BoxHelpTextBg = CL_SpriteFrameObject("sprite/interface2/ui/newskillshop/newskillshop.img", 10);
|
||||
// BackGroundCanvas.DrawSpriteFrame(BoxHelpTextBg, Width - BoxHelpTextBg.GetSize().w - 5, 52);
|
||||
|
||||
|
||||
//右侧文字使用指南
|
||||
local BoxHelpText = FontAssetManager.GenerateNormal("技能窗口使用指南", true, {
|
||||
color = sq_RGBA(192, 163, 54, 250)
|
||||
});
|
||||
BackGroundCanvas.DrawActor(BoxHelpText, 580, 52);
|
||||
|
||||
// 结束绘制
|
||||
BackGroundCanvas.EndDraw();
|
||||
Addchild(BackGroundCanvas);
|
||||
}
|
||||
|
||||
function RegisterButton() {
|
||||
//初始化按钮
|
||||
local InitButton = Yosin_SplicingButton(444, 58, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||
//创建角色按钮文本
|
||||
local CreateTextActor = FontAssetManager.GenerateNormal("初始化", false, {
|
||||
color = sq_RGBA(186, 147, 97, 255)
|
||||
});
|
||||
InitButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(InitButton);
|
||||
CreateTextActor.SetPosition(11, 3);
|
||||
CreateTextActor.SetZOrder(1);
|
||||
CreateTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||
Text.SetFillColor(sq_RGBA(18, 71, 130, 255));
|
||||
} else if (Text.Parent.State == 0) {
|
||||
Text.SetFillColor(sq_RGBA(186, 147, 97, 255));
|
||||
}
|
||||
})
|
||||
InitButton.Addchild(CreateTextActor);
|
||||
|
||||
//自动加点按钮
|
||||
local AutoAddPointButton = Yosin_SplicingButton(506, 58, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||
//创建角色按钮文本
|
||||
local CreateTextActor = FontAssetManager.GenerateNormal("自动加点", false, {
|
||||
color = sq_RGBA(186, 147, 97, 255)
|
||||
});
|
||||
AutoAddPointButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(AutoAddPointButton);
|
||||
CreateTextActor.SetPosition(6, 3);
|
||||
CreateTextActor.SetZOrder(1);
|
||||
CreateTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||
Text.SetFillColor(sq_RGBA(18, 71, 130, 255));
|
||||
} else if (Text.Parent.State == 0) {
|
||||
Text.SetFillColor(sq_RGBA(186, 147, 97, 255));
|
||||
}
|
||||
})
|
||||
AutoAddPointButton.Addchild(CreateTextActor);
|
||||
}
|
||||
|
||||
//初始化技能树
|
||||
function Init(Job, GrowType) {
|
||||
this.Job = Job;
|
||||
this.GrowType = GrowType;
|
||||
TreeInfo = AssetManager.GetSkillTreeByJob(Job, GrowType);
|
||||
print(TreeInfo);
|
||||
SkillTreeWindow = UISpace_SkillTree.Tree("技能树" + Job + "-" + GrowType, 7, 85, 560, 400, 0);
|
||||
AddUIChild(SkillTreeWindow);
|
||||
SkillTreeWindow.Init(TreeInfo);
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
|
||||
//刷新个人信息
|
||||
function RefreshPersonalInfo() {
|
||||
PageList[0].Refresh();
|
||||
PageList[0].CharactersObject.InitCharacter();
|
||||
}
|
||||
|
||||
|
||||
//在Esc按下时
|
||||
function OnEsc() {
|
||||
CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// if (!getroottable().rawin("chongzaiflag")) {
|
||||
// getroottable()["chongzaiflag"] <- true;
|
||||
// } else {
|
||||
// local BufferList = [];
|
||||
// //遍历窗口队列 如果可见则调用Show
|
||||
// for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
|
||||
// local Window = _SYS_WINDOW_LIST_[i];
|
||||
// Window.Visible = false;
|
||||
// _UiObject_.Removechild(Window);
|
||||
// }
|
||||
// _SYS_WINDOW_LIST_ = [];
|
||||
// _SYS_WINDOW_LIST_.extend(BufferList);
|
||||
|
||||
// //初始化鼠标
|
||||
// _IMouse_();
|
||||
// TestStage();
|
||||
// }
|
||||
|
|
@ -0,0 +1,276 @@
|
|||
/*
|
||||
文件名:9_HUD.nut
|
||||
路径:User/UI/Window/9_HUD/9_HUD.nut
|
||||
创建日期:2025-02-18 05:41
|
||||
文件用途:血槽HUD
|
||||
*/
|
||||
//hud血槽命名空间
|
||||
if (!getroottable().rawin("UISpace_Hud")) UISpace_Hud <- {};
|
||||
//主类
|
||||
class UISpace_Hud._Hud extends Yosin_Window {
|
||||
|
||||
//背景画布
|
||||
BackGroundCanvas = null;
|
||||
//数据画布
|
||||
DataCanvas = null;
|
||||
//物品槽
|
||||
ItemSlotList = null;
|
||||
//技能槽
|
||||
SkillSlotList = null;
|
||||
|
||||
//生命值球
|
||||
HealthBall = null;
|
||||
//魔法值球
|
||||
MagicBall = null;
|
||||
|
||||
constructor() {
|
||||
ItemSlotList = [];
|
||||
SkillSlotList = [];
|
||||
base.constructor("血槽HUD", 0, 525, 1067, 75, 0);
|
||||
|
||||
DrawBackground();
|
||||
//绘制血球
|
||||
DrawBall();
|
||||
//刷新数据
|
||||
RefreshData();
|
||||
//注册按钮
|
||||
RegisterButton();
|
||||
|
||||
//物品槽
|
||||
for (local i = 0; i< 6; i++) {
|
||||
local ItemSlot = UISpace_Hud.ItemSlot(i);
|
||||
ItemSlot.SetPosition(122 + (i * 31), 44);
|
||||
AddUIChild(ItemSlot);
|
||||
local ItemObject = GameItem.Stackable(1110 + i);
|
||||
ItemSlot.SetItem(ItemObject);
|
||||
ItemSlotList.push(ItemSlot);
|
||||
}
|
||||
|
||||
//技能槽
|
||||
for (local i = 0; i< 16; i++) {
|
||||
local SkillSlot = UISpace_Hud.SkillSlot(i / 8, i % 8);
|
||||
SkillSlot.SetPosition(414 + ((i % 8) * 31), 9 + (i / 8 * 31));
|
||||
AddUIChild(SkillSlot);
|
||||
local SkillObject = GameItem.Skill(0, 230 + i);
|
||||
SkillSlot.SetSkill(SkillObject);
|
||||
SkillSlotList.push(SkillSlot);
|
||||
}
|
||||
}
|
||||
|
||||
function DrawBackground() {
|
||||
if (BackGroundCanvas) Removechild(BackGroundCanvas);
|
||||
BackGroundCanvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
BackGroundCanvas.ResizeAndClear(Width, Height);
|
||||
// 开始绘制
|
||||
BackGroundCanvas.BeginDraw();
|
||||
|
||||
//绘制背景
|
||||
local HudBg = CL_SpriteFrameObject("sprite/interface2/hud/hud.img", 0);
|
||||
BackGroundCanvas.DrawSpriteFrame(HudBg, (Width - HudBg.GetSize().w) / 2, 0);
|
||||
|
||||
//绘制消耗品槽
|
||||
for (local i = 0; i< 6; i++) {
|
||||
local Slot = CL_SpriteFrameObject("sprite/interface2/hud/hud.img", 200);
|
||||
BackGroundCanvas.DrawSpriteFrame(Slot, 122 + (i * 31), 44);
|
||||
}
|
||||
|
||||
//绘制疲劳值文字
|
||||
local FatigueSlotText = CL_SpriteFrameObject("sprite/interface2/hud/hud.img", 211);
|
||||
BackGroundCanvas.DrawSpriteFrame(FatigueSlotText, 789, 64);
|
||||
//绘制疲劳槽
|
||||
local FatigueSlot = CL_SpriteFrameObject("sprite/interface2/hud/hud.img", 230);
|
||||
BackGroundCanvas.DrawSpriteFrame(FatigueSlot, 824, 69);
|
||||
|
||||
// 结束绘制
|
||||
BackGroundCanvas.EndDraw();
|
||||
Addchild(BackGroundCanvas);
|
||||
}
|
||||
|
||||
//绘制血球
|
||||
BallSize = null;
|
||||
|
||||
function DrawBall() {
|
||||
if (!HealthBall) {
|
||||
HealthBall = Animation("common/hud/hud_ui/hpmp_vessel.ani");
|
||||
HealthBall.SetPosition(295, 40);
|
||||
HealthBall.SetDye(sq_RGBA(255, 0, 0, 255), 1);
|
||||
Addchild(HealthBall);
|
||||
local Effect = Animation("common/hud/hud_ui/hpmp_vessel.ani");
|
||||
Effect.SetPosition(0, 0);
|
||||
Effect.SetDye(sq_RGBA(255, 0, 0, 255), 1);
|
||||
Effect.SetMode(0);
|
||||
Effect.SetOpacity(0.6);
|
||||
HealthBall.Addchild(Effect);
|
||||
local Effect2 = CL_SpriteObject("sprite/interface2/hud/hud.img", 212);
|
||||
Effect2.SetPosition(295 + 45, 40 - 32);
|
||||
Addchild(Effect2);
|
||||
}
|
||||
if (!MagicBall) {
|
||||
MagicBall = Animation("common/hud/hud_ui/hpmp_vessel.ani");
|
||||
MagicBall.SetPosition(618, 40);
|
||||
MagicBall.SetDye(sq_RGBA(0, 0, 255, 255), 1);
|
||||
Addchild(MagicBall);
|
||||
local Effect = Animation("common/hud/hud_ui/hpmp_vessel.ani");
|
||||
Effect.SetPosition(0, 0);
|
||||
Effect.SetDye(sq_RGBA(0, 0, 255, 255), 1);
|
||||
Effect.SetMode(0);
|
||||
Effect.SetOpacity(0.6);
|
||||
MagicBall.Addchild(Effect);
|
||||
local Effect2 = CL_SpriteObject("sprite/interface2/hud/hud.img", 213);
|
||||
Effect2.SetPosition(618 + 45, 40 - 32);
|
||||
Addchild(Effect2);
|
||||
}
|
||||
BallSize = HealthBall.GetSize();
|
||||
}
|
||||
|
||||
function SetHp(Rate) {
|
||||
local Slice = BallSize.h * (1.0 - Rate);
|
||||
HealthBall.SetCropRect(0, Slice, HealthBall.GetSize().w, BallSize.h);
|
||||
HealthBall.SetPosition(295, 40 + Slice);
|
||||
}
|
||||
|
||||
function SetMp(Rate) {
|
||||
local Slice = BallSize.h * (1.0 - Rate);
|
||||
MagicBall.SetCropRect(0, Slice, MagicBall.GetSize().w, BallSize.h);
|
||||
MagicBall.SetPosition(618, 40 + Slice);
|
||||
}
|
||||
|
||||
function RefreshData() {
|
||||
if (DataCanvas) Removechild(DataCanvas);
|
||||
DataCanvas = CL_CanvasObject();
|
||||
// 重设大小并清空
|
||||
DataCanvas.ResizeAndClear(Width, Height);
|
||||
// 开始绘制
|
||||
DataCanvas.BeginDraw();
|
||||
|
||||
|
||||
//绘制经验槽
|
||||
local ExpSlot = CL_SpriteFrameObject("sprite/interface2/hud/hud.img", 202);
|
||||
DataCanvas.DrawSpriteFrame(ExpSlot, (Width - ExpSlot.GetSize().w) / 2, 58);
|
||||
//人物经验
|
||||
local Exp = ClientCharacter ? ClientCharacter.GetExp() : {
|
||||
current = 100,
|
||||
max = 100
|
||||
};
|
||||
local ExpRate = Exp.current.tofloat() / Exp.max.tofloat();
|
||||
local ExpImgIndex = 60;
|
||||
if (ExpRate< 1) ExpImgIndex = 4;
|
||||
local ExpBar = CL_SpriteObject("sprite/interface2/hud/hud.img", ExpImgIndex);
|
||||
ExpBar.SetPosition(374, 70);
|
||||
ExpBar.SetCropRect(0, 0, ExpBar.GetSize().w * ExpRate, ExpBar.GetSize().h);
|
||||
DataCanvas.DrawSprite(ExpBar);
|
||||
|
||||
//人物等级
|
||||
local Level = ClientCharacter ? ClientCharacter.Level : 1;
|
||||
local LevelText = FontAssetManager.GenerateNormal(Level + "级", true, {
|
||||
color = sq_RGBA(147, 118, 56, 250)
|
||||
});
|
||||
DataCanvas.DrawActor(LevelText, 343 - LevelText.GetSize().w / 2, 60);
|
||||
|
||||
//人物Sp点
|
||||
local SkillPoint = ClientCharacter ? ClientCharacter.SkillPoint : 0;
|
||||
local SkillPointText = FontAssetManager.GenerateMini("SP:" + SkillPoint, true, {
|
||||
color = sq_RGBA(24, 123, 174, 250)
|
||||
});
|
||||
DataCanvas.DrawActor(SkillPointText, 730 - SkillPointText.GetSize().w / 2, 60);
|
||||
|
||||
|
||||
//人物疲劳值
|
||||
local Fatigue = ClientCharacter ? ClientCharacter.Fatigue : 0;
|
||||
local FatigueRate = (156.0 - Fatigue.tofloat()) / 156.0;
|
||||
local FatigueBar = CL_SpriteObject("sprite/interface2/hud/hud.img", 3);
|
||||
FatigueBar.SetPosition(823, 68);
|
||||
FatigueBar.SetCropRect(0, 0, FatigueBar.GetSize().w * FatigueRate, FatigueBar.GetSize().h);
|
||||
DataCanvas.DrawSprite(FatigueBar);
|
||||
//人物疲劳值文字
|
||||
local FatigueText = FontAssetManager.GenerateMini((156 - Fatigue) + "/156", true, {
|
||||
color = sq_RGBA(201, 199, 201, 250)
|
||||
});
|
||||
DataCanvas.DrawActor(FatigueText, 892 - FatigueText.GetSize().w / 2, 62);
|
||||
|
||||
|
||||
// 结束绘制
|
||||
DataCanvas.EndDraw();
|
||||
Addchild(DataCanvas);
|
||||
}
|
||||
|
||||
//商城按钮
|
||||
function RegisterButton() {
|
||||
//商城按钮
|
||||
local LoginButton = Yosin_BaseButton(786, 38, 64, 27, "sprite/interface2/hud/hud.img", 72);
|
||||
//点击事件回调
|
||||
LoginButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(LoginButton);
|
||||
|
||||
//菜单按钮
|
||||
local MenuButton = Yosin_BaseButton(849, 38, 27, 27, "sprite/interface2/hud/hud.img", 68);
|
||||
//点击事件回调
|
||||
MenuButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(MenuButton);
|
||||
|
||||
//个人信息按钮
|
||||
local InfoButton = Yosin_BaseButton(875, 38, 20, 27, "sprite/interface2/hud/hud.img", 5);
|
||||
//点击事件回调
|
||||
InfoButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(InfoButton);
|
||||
|
||||
//背包按钮
|
||||
local BagButton = Yosin_BaseButton(894, 38, 20, 27, "sprite/interface2/hud/hud.img", 8);
|
||||
//点击事件回调
|
||||
BagButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(BagButton);
|
||||
|
||||
//技能按钮
|
||||
local SkillButton = Yosin_BaseButton(913, 38, 20, 27, "sprite/interface2/hud/hud.img", 14);
|
||||
//点击事件回调
|
||||
SkillButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(SkillButton);
|
||||
|
||||
//任务按钮
|
||||
local TaskButton = Yosin_BaseButton(932, 38, 20, 27, "sprite/interface2/hud/hud.img", 11);
|
||||
//点击事件回调
|
||||
TaskButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(TaskButton);
|
||||
|
||||
//拍卖行按钮
|
||||
local AuctionButton = Yosin_BaseButton(951, 38, 20, 27, "sprite/interface2/hud/hud.img", 17);
|
||||
//点击事件回调
|
||||
AuctionButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(AuctionButton);
|
||||
|
||||
//拓展技能按钮
|
||||
local ExtendSkillButton = Yosin_BaseButton(400, 7, 17, 34, "sprite/interface2/hud/hud.img", 193);
|
||||
//点击事件回调
|
||||
ExtendSkillButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(ExtendSkillButton);
|
||||
|
||||
//切换技能按钮
|
||||
local SwitchSkillButton = Yosin_BaseButton(400, 37, 17, 34, "sprite/interface2/hud/hud.img", 52);
|
||||
//点击事件回调
|
||||
SwitchSkillButton.OnClick = function(Button) {
|
||||
|
||||
}.bindenv(this);
|
||||
AddUIChild(SwitchSkillButton);
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
文件名:ItemSlot.nut
|
||||
路径:User/UI/Window/9_HUD/ItemSlot.nut
|
||||
创建日期:2025-02-18 07:36
|
||||
文件用途:HUD血槽的物品槽
|
||||
*/
|
||||
class UISpace_Hud.ItemSlot extends Yosin_CommonUi {
|
||||
Pos = null;
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
//物品对象
|
||||
Item = null;
|
||||
//物品对象的图标
|
||||
ItemIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
ItemInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
ItemInfoShowFlag = false;
|
||||
|
||||
constructor(gPos) {
|
||||
this.Pos = gPos;
|
||||
base.constructor(0, 0, 28, 28);
|
||||
// OpenDeBug();
|
||||
|
||||
//角标绘制
|
||||
local CornerMarkerDrawing = CL_SpriteObject("sprite/interface/keyshortcut.img", 46 + gPos);
|
||||
CornerMarkerDrawing.SetZOrder(9);
|
||||
Addchild(CornerMarkerDrawing);
|
||||
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetPosition(1, 1);
|
||||
HoverEffect.SetZOrder(10);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
|
||||
}
|
||||
|
||||
function SetItem(Item) {
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
|
||||
if (Item) {
|
||||
this.Item = Item;
|
||||
//如果原先有图标则先移除图标在添加
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
}
|
||||
this.ItemIcon = this.Item.GetIconSprite();
|
||||
Addchild(this.ItemIcon);
|
||||
this.ItemInfo = this.Item.GetInfoWindow();
|
||||
} else {
|
||||
this.Item = null;
|
||||
if (this.ItemIcon) {
|
||||
Removechild(this.ItemIcon);
|
||||
this.ItemIcon = null;
|
||||
}
|
||||
this.ItemInfo = null;
|
||||
}
|
||||
this.ItemIcon.SetPosition(1, 1);
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!Item) return;
|
||||
if (!this.ItemInfo) GenerateInfo();
|
||||
this.ItemInfoShowFlag = true;
|
||||
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.ItemInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
|
||||
//设置位置
|
||||
this.ItemInfo.SetPosition(x, y);
|
||||
this.ItemInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.ItemInfo) {
|
||||
this.ItemInfoShowFlag = false;
|
||||
this.ItemInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//如果有道具
|
||||
if (Item) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
if (!ItemInfoShowFlag) {
|
||||
//显示详细信息
|
||||
ShowInfo(MousePos_X - 50, MousePos_Y - ((ItemInfo.RealCanvasHeight + 10) / 2));
|
||||
}
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !WindowInteractiveFlag) {
|
||||
//发送脱下装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 8,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭所有详细信息显示
|
||||
if (ItemInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,163 @@
|
|||
/*
|
||||
文件名:SkillSlot.nut
|
||||
路径:User/UI/Window/9_HUD/SkillSlot.nut
|
||||
创建日期:2025-02-18 07:51
|
||||
文件用途:HUD血槽的技能槽
|
||||
*/
|
||||
class UISpace_Hud.SkillSlot extends Yosin_CommonUi {
|
||||
Type = null;
|
||||
Pos = null;
|
||||
|
||||
|
||||
//悬停特效
|
||||
HoverEffect = null;
|
||||
|
||||
//物品对象
|
||||
Skill = null;
|
||||
//物品对象的图标
|
||||
SkillIcon = null;
|
||||
//物品对象的详细信息窗口
|
||||
SkillInfo = null;
|
||||
//详细信息窗口显示Flag
|
||||
SkillInfoShowFlag = false;
|
||||
|
||||
constructor(gType, gPos) {
|
||||
this.Type = gType;
|
||||
this.Pos = gPos;
|
||||
base.constructor(0, 0, 28, 28);
|
||||
|
||||
local KeyValue;
|
||||
if (gType == 0) {
|
||||
if (gPos == 0) KeyValue = getconsttable().CONTROLLER["OPTION_HOTKEY_SKILL"];
|
||||
else KeyValue = getconsttable().CONTROLLER["OPTION_HOTKEY_EXSKILL" + gPos];
|
||||
|
||||
} else if (gType == 1) {
|
||||
if (gPos == 0) KeyValue = getconsttable().CONTROLLER["OPTION_HOTKEY_ATTACK"];
|
||||
else KeyValue = getconsttable().CONTROLLER["OPTION_HOTKEY_QUICK_SKILL" + gPos];
|
||||
}
|
||||
//角标绘制
|
||||
local CornerMarkerDrawing = CL_SpriteObject("sprite/interface/keyshortcut.img", (KeyValue <= 10) ? KeyValue : 40 + KeyValue);
|
||||
CornerMarkerDrawing.SetZOrder(9);
|
||||
Addchild(CornerMarkerDrawing);
|
||||
|
||||
// OpenDeBug();
|
||||
HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131);
|
||||
HoverEffect.SetPosition(1, 1);
|
||||
HoverEffect.SetZOrder(10);
|
||||
HoverEffect.SetVisible(false);
|
||||
Addchild(HoverEffect);
|
||||
}
|
||||
|
||||
function SetSkill(Skill) {
|
||||
//关闭所有详细信息显示
|
||||
if (SkillInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
|
||||
if (Skill) {
|
||||
this.Skill = Skill;
|
||||
//如果原先有图标则先移除图标在添加
|
||||
if (this.SkillIcon) {
|
||||
Removechild(this.SkillIcon);
|
||||
}
|
||||
this.SkillIcon = this.Skill.GetIconSprite();
|
||||
Addchild(this.SkillIcon);
|
||||
this.SkillInfo = this.Skill.GetInfoWindow();
|
||||
} else {
|
||||
this.Skill = null;
|
||||
if (this.SkillIcon) {
|
||||
Removechild(this.SkillIcon);
|
||||
this.SkillIcon = null;
|
||||
}
|
||||
this.SkillInfo = null;
|
||||
}
|
||||
this.SkillIcon.SetPosition(1, 1);
|
||||
}
|
||||
|
||||
//显示详细信息
|
||||
function ShowInfo(x, y) {
|
||||
if (!Skill) return;
|
||||
if (!this.SkillInfo) GenerateInfo();
|
||||
this.SkillInfoShowFlag = true;
|
||||
|
||||
// 获取信息框尺寸
|
||||
local infoW = 211;
|
||||
local infoH = this.SkillInfo.RealCanvasHeight;
|
||||
|
||||
// X轴边界修正
|
||||
if (x< 0) {
|
||||
x = 0;
|
||||
} else if (x + infoW > 1067) {
|
||||
x = 1067 - infoW;
|
||||
}
|
||||
// Y轴边界修正
|
||||
if (y< 0) {
|
||||
y = 0;
|
||||
} else if (y + infoH > 600) {
|
||||
y = 600 - infoH;
|
||||
}
|
||||
|
||||
//设置位置
|
||||
this.SkillInfo.SetPosition(x, y);
|
||||
this.SkillInfo.ResetFocus();
|
||||
}
|
||||
|
||||
//关闭显示详细信息
|
||||
function CloseInfo() {
|
||||
if (this.SkillInfo) {
|
||||
this.SkillInfoShowFlag = false;
|
||||
this.SkillInfo.CloseWindow();
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标事件回调
|
||||
function OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
if (!Visible) return;
|
||||
base.OnMouseProc(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !IMouse.DragObj && !WindowInteractiveFlag) {
|
||||
//如果有道具
|
||||
if (Skill) {
|
||||
//设置透明度
|
||||
HoverEffect.SetOpacity(0.4);
|
||||
if (!SkillInfoShowFlag) {
|
||||
//显示详细信息
|
||||
ShowInfo(MousePos_X - 50, MousePos_Y - ((SkillInfo.RealCanvasHeight + 10) / 2));
|
||||
}
|
||||
}
|
||||
//设置悬停槽
|
||||
HoverEffect.SetVisible(true);
|
||||
} else {
|
||||
HoverEffect.SetVisible(false);
|
||||
//关闭所有详细信息显示
|
||||
if (SkillInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标右键单击回调
|
||||
function OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseRbClick(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
if (isInRect && !WindowInteractiveFlag) {
|
||||
//发送脱下装备包
|
||||
MySocket.Send(PACKET_ID.WEAR_EQUIPMENT, {
|
||||
backpackId = 8,
|
||||
oldPos = Pos
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//override
|
||||
//鼠标左键单击回调
|
||||
function OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag) {
|
||||
//调用原生方法
|
||||
base.OnMouseLbDown(MousePos_X, MousePos_Y, WindowInteractiveFlag);
|
||||
//关闭所有详细信息显示
|
||||
if (SkillInfoShowFlag) {
|
||||
CloseInfo();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -29,16 +29,60 @@ enum CHARACTERJOB {
|
|||
|
||||
//时装枚举类
|
||||
enum AvatarType {
|
||||
hair = "hair" //头部
|
||||
hat = "hat" //帽子
|
||||
face = "face" //脸部
|
||||
breast = "breast" //胸部
|
||||
coat = "coat" //上衣
|
||||
skin = "skin" //皮肤
|
||||
waist = "waist" //腰部
|
||||
pants = "pants" //下装
|
||||
shoes = "shoes" //鞋子
|
||||
weapon = "weapon" //武器
|
||||
weapon_avatar = "武器装扮"
|
||||
aurora_avatar = "光环装扮"
|
||||
hair_avatar = "头部装扮"
|
||||
hat_avatar = "帽子装扮"
|
||||
face_avatar = "脸部装扮"
|
||||
breast_avatar = "胸部装扮"
|
||||
coat_avatar = "上衣装扮"
|
||||
skin_avatar = "皮肤装扮"
|
||||
waist_avatar = "腰部装扮"
|
||||
pants_avatar = "下装装扮"
|
||||
shoes_avatar = "鞋子装扮"
|
||||
weapon = "武器"
|
||||
}
|
||||
|
||||
//属性枚举表
|
||||
enum ATTRIBUTE {
|
||||
HPMax = "最大生命值"
|
||||
MPMax = "最大魔法值"
|
||||
HPRegenSpeed = "生命值回复速度"
|
||||
MPRegenSpeed = "魔法值回复速度"
|
||||
JumpPower = "跳跃力"
|
||||
HitRecovery = "硬直"
|
||||
Stuck = "命中率"
|
||||
StuckResistance = "闪避率"
|
||||
|
||||
PhysicalAttack = "力量"
|
||||
MagicalAttack = "智力"
|
||||
PhysicalDefense = "体力"
|
||||
MagicalDefense = "精神"
|
||||
AllElementalAttack = "所有属强"
|
||||
DarkAttack = "暗属强"
|
||||
LightAttack = "光属强"
|
||||
WaterAttack = "水属强"
|
||||
FireAttack = "火属强"
|
||||
|
||||
EquipmentPhysicalAttack = "物理攻击力"
|
||||
EquipmentMagicalAttack = "魔法攻击力"
|
||||
SeparateAttack = "独立攻击力"
|
||||
EquipmentPhysicalDefense = "物理防御力"
|
||||
EquipmentMagicalDefense = "魔法防御力"
|
||||
|
||||
AttackSpeed = "攻击速度"
|
||||
CastSpeed = "释放速度"
|
||||
MoveSpeed = "移动速度"
|
||||
JumpSpeed = "跳跃速度"
|
||||
|
||||
PhysicalCriticalHit = "物理暴击率"
|
||||
MagicalCriticalHit = "魔法暴击率"
|
||||
|
||||
DarkResistance = "暗属抗"
|
||||
LightResistance = "光属抗"
|
||||
WaterResistance = "水属抗"
|
||||
FireResistance = "火属抗"
|
||||
ElementalProperty = "属性攻击"
|
||||
}
|
||||
|
||||
//控制器枚举
|
||||
|
|
@ -48,13 +92,13 @@ enum CONTROLLER {
|
|||
OPTION_HOTKEY_MOVE_LEFT = 2 // 移动键 左
|
||||
OPTION_HOTKEY_MOVE_DOWN = 4 // 移动键 下
|
||||
OPTION_HOTKEY_MOVE_RIGHT = 3 // 移动键 右
|
||||
OPTION_HOTKEY_ATTACK = 4 // 攻击键
|
||||
OPTION_HOTKEY_JUMP = 5 // 跳跃键
|
||||
OPTION_HOTKEY_SKILL = 6 // 快捷技能键
|
||||
OPTION_HOTKEY_ATTACK = 38 // 攻击键
|
||||
OPTION_HOTKEY_ENTER = 5 // 回车键
|
||||
OPTION_HOTKEY_SKILL = 40 // 快捷技能键
|
||||
OPTION_HOTKEY_SKILL2 = 7 // Buff技能键
|
||||
OPTION_HOTKEY_CREATURE_SKILL = 8 // 宠物技能键
|
||||
OPTION_HOTKEY_STATUS_WINDOW = 9 // (M)
|
||||
OPTION_HOTKEY_SKILL_WINDOW = 10 // (K)
|
||||
OPTION_HOTKEY_STATUS_WINDOW = 27 // (M)
|
||||
OPTION_HOTKEY_SKILL_WINDOW = 25 // (K)
|
||||
OPTION_HOTKEY_ITEM_INVENTORY = 23 // (I)
|
||||
OPTION_HOTKEY_OPTION_WINDOW = 12 // (O)
|
||||
OPTION_HOTKEY_NORMAL_QUEST_WINDOW = 13 // (Q)
|
||||
|
|
@ -64,18 +108,20 @@ enum CONTROLLER {
|
|||
OPTION_HOTKEY_CREATURE_WINDOW = 17 // (Y)
|
||||
OPTION_HOTKEY_TOOLTIP_ = 18 // 庸삥뮢弱붹솱 ?わ읂??R)
|
||||
OPTION_HOTKEY_EPIC_QUEST_WINDOW = 19 // (W)
|
||||
OPTION_HOTKEY_QUICK_SKILL1 = 20 // ?띌돱 ?쀧뀥(A, S, D, F, G, H)
|
||||
OPTION_HOTKEY_QUICK_SKILL2 = 21
|
||||
OPTION_HOTKEY_QUICK_SKILL3 = 22
|
||||
OPTION_HOTKEY_QUICK_SKILL4 = 23
|
||||
OPTION_HOTKEY_QUICK_SKILL5 = 24
|
||||
OPTION_HOTKEY_QUICK_SKILL6 = 25
|
||||
OPTION_HOTKEY_EXSKILL1 = 26 // ?멩퐤?띌돱 ?쀧뀥(F1 - F6)
|
||||
OPTION_HOTKEY_EXSKILL2 = 27
|
||||
OPTION_HOTKEY_EXSKILL3 = 28
|
||||
OPTION_HOTKEY_EXSKILL4 = 29
|
||||
OPTION_HOTKEY_EXSKILL5 = 30
|
||||
OPTION_HOTKEY_EXSKILL6 = 31
|
||||
OPTION_HOTKEY_QUICK_SKILL1 = 15 // ?띌돱 ?쀧뀥(A, S, D, F, G, H, ctrl)
|
||||
OPTION_HOTKEY_QUICK_SKILL2 = 33
|
||||
OPTION_HOTKEY_QUICK_SKILL3 = 18
|
||||
OPTION_HOTKEY_QUICK_SKILL4 = 20
|
||||
OPTION_HOTKEY_QUICK_SKILL5 = 21
|
||||
OPTION_HOTKEY_QUICK_SKILL6 = 22
|
||||
OPTION_HOTKEY_QUICK_SKILL7 = 8
|
||||
OPTION_HOTKEY_EXSKILL1 = 31 // ?멩퐤?띌돱 ?쀧뀥(QWERTY)
|
||||
OPTION_HOTKEY_EXSKILL2 = 37
|
||||
OPTION_HOTKEY_EXSKILL3 = 19
|
||||
OPTION_HOTKEY_EXSKILL4 = 32
|
||||
OPTION_HOTKEY_EXSKILL5 = 34
|
||||
OPTION_HOTKEY_EXSKILL6 = 39
|
||||
OPTION_HOTKEY_EXSKILL7 = 10
|
||||
OPTION_HOTKEY_ITEM_QUICKSLOT1 = 32 // 爺닸¨?????쀧뀥(1 - 6)
|
||||
OPTION_HOTKEY_ITEM_QUICKSLOT2 = 33
|
||||
OPTION_HOTKEY_ITEM_QUICKSLOT3 = 34
|
||||
|
|
@ -92,7 +138,7 @@ enum CONTROLLER {
|
|||
OPTION_HOTKEY_MENU_COMMUNITY = 45 // ?닷뿽?뽳썙 瑥→솺(8)
|
||||
OPTION_HOTKEY_MENU_CONTENTS = 46 // ?잒샇??瑥→솺(9)
|
||||
OPTION_HOTKEY_MENU_SERVICE = 47 // ?껆뼁??瑥→솺(0)
|
||||
OPTION_HOTKEY_MENU_SYSTEM__CLOSE_ALL_WINDOW = 48 // 壅낁땶?뷸츐??Esc)
|
||||
OPTION_HOTKEY_MENU_SYSTEM__CLOSE_ALL_WINDOW = 7 // 壅낁땶?뷸츐??Esc)
|
||||
OPTION_HOTKEY_PVP = 49 // 恙든삮逆?P)
|
||||
OPTION_HOTKEY_RECOMMEND_USER = 50 // 瓮룩뙢玲뺟뙼([)
|
||||
OPTION_HOTKEY_PARTY_MATCHING = 51 // ?뷂썙烏숃뒭(])
|
||||
|
|
|
|||
|
|
@ -335,4 +335,7 @@ enum SOUND {
|
|||
CLICK_BUTTON2 = "sounds/UI/click2.ogg"
|
||||
CLICK_BUTTON3 = "sounds/UI/click3.ogg"
|
||||
CLICK_BUTTON4 = "sounds/UI/click4.ogg"
|
||||
CLICK_MOVE = "sounds/UI/click_move.ogg"
|
||||
CHAT_MESSAGE = "sounds/UI/chat.ogg" //来消息的声音
|
||||
|
||||
}
|
||||
|
|
@ -20,6 +20,8 @@ enum PACKET_ID {
|
|||
CREATE_CHARACTER = 7
|
||||
//查询账号中的角色列表
|
||||
QUERY_CHARACTER_LIST = 9
|
||||
//背包道具位置交换
|
||||
INVENTORY_SWAP_ITEM = 13
|
||||
//选择角色
|
||||
SELECT_CHARACTER = 11
|
||||
//更换角色位置
|
||||
|
|
@ -31,6 +33,13 @@ enum PACKET_ID {
|
|||
//城镇中角色移动
|
||||
TOWN_CHARACTER_MOVE = 10004
|
||||
|
||||
//发送聊天消息
|
||||
SEND_CHAT_MESSAGE = 15
|
||||
//购买项目
|
||||
BUY_ITEM = 16
|
||||
//穿戴装备
|
||||
WEAR_EQUIPMENT = 17
|
||||
|
||||
|
||||
|
||||
/**** 客户端收包 ***/
|
||||
|
|
@ -43,6 +52,20 @@ enum PACKET_ID {
|
|||
SELECT_CHARACTER_ENTER_GAME_CALLBACK = 5
|
||||
//刷新客户端角色背包数据
|
||||
REFRESH_CLIENT_CHARACTER_INVENTORY_DATA_CALLBACK = 6
|
||||
//添加Item到背包
|
||||
INVENTORY_ADD_ITEM_CALLBACK = 7
|
||||
//删除Item到背包
|
||||
INVENTORY_REMOVE_ITEM_CALLBACK = 8
|
||||
//背包道具位置交换
|
||||
INVENTORY_SWAP_ITEM_CALLBACK = 10
|
||||
//刷新客户端角色点卷代币券信息
|
||||
REFRESH_CLIENT_CHARACTER_CERA_DATA_CALLBACK = 11
|
||||
//刷新客户端角色金币信息
|
||||
REFRESH_CLIENT_CHARACTER_GOLD_DATA_CALLBACK = 12
|
||||
//刷新客户端角色复活币信息
|
||||
REFRESH_CLIENT_CHARACTER_REVIVE_DATA_CALLBACK = 13
|
||||
//穿戴装备回包
|
||||
WEAR_EQUIPMENT_CALLBACK = 14
|
||||
//城镇移动切换区域回包
|
||||
CHANGE_TOWN_AREA_CALLBACK = 10001
|
||||
//城镇添加角色回包
|
||||
|
|
@ -51,4 +74,6 @@ enum PACKET_ID {
|
|||
TOWN_REMOVE_CHARACTER_CALLBACK = 10003
|
||||
//城镇中角色移动的回包
|
||||
TOWN_CHARACTER_MOVE_CALLBACK = 10004
|
||||
//聊天消息回包
|
||||
SEND_CHAT_MESSAGE_CALLBACK = 9
|
||||
}
|
||||
|
|
@ -5,7 +5,15 @@
|
|||
文件用途:全局对象
|
||||
*/
|
||||
|
||||
//客户端聊天窗口
|
||||
ClientChatWindow <- null;
|
||||
//客户端角色对象
|
||||
ClientCharacter <- null;
|
||||
//客户端角色的背包
|
||||
ClientCharacterInventory <- null;
|
||||
//客户端角色的个人信息
|
||||
ClientPersonalInfo <- null;
|
||||
//客户端角色的HUD
|
||||
ClientHUD <- null;
|
||||
//客户端角色的技能树窗口
|
||||
ClientSkillTreeWindow <- null;
|
||||
|
|
@ -14,7 +14,7 @@ function main(args) {
|
|||
local Game = GameWindow();
|
||||
Game.title = "Yosin & Kiwano";
|
||||
Game.bg_color = [255.0, 255.0, 255.0, 255.0];
|
||||
Game.size = [1066 + 332, 600];
|
||||
Game.size = [1067 + 332, 600];
|
||||
Game.v_sync = false;
|
||||
Game.frame_interval = 10000;
|
||||
Game.debug_mode = true;
|
||||
|
|
|
|||
|
|
@ -292,5 +292,41 @@
|
|||
},
|
||||
"User/UI/Window/6_PlayerChat.nut": {
|
||||
"description": "聊天消息窗口"
|
||||
},
|
||||
"User/UI/Window/7_Town_Chat_Msg.nut": {
|
||||
"description": "城镇聊天气泡"
|
||||
},
|
||||
"User/Asset/Character/ChatBubble.nut": {
|
||||
"description": "聊天气泡"
|
||||
},
|
||||
"User/Asset/Character/AdditionalItems.nut": {
|
||||
"description": "附加项"
|
||||
},
|
||||
"User/UI/Window/7_Npc_Shop.nut": {
|
||||
"description": "NPC商店"
|
||||
},
|
||||
"User/UI/Window/234_HUD_FuncInter.nut": {
|
||||
"description": "功能交互"
|
||||
},
|
||||
"User/UI/Window/235_HUD_QuantityInput.nut": {
|
||||
"description": "数量输入"
|
||||
},
|
||||
"User/UI/Widget/NumberInputBox.nut": {
|
||||
"description": "数字输入框"
|
||||
},
|
||||
"User/UI/Widget/BaseWidget.nut": {
|
||||
"description": "基础控件"
|
||||
},
|
||||
"Core/Timer": {
|
||||
"description": "定时器类"
|
||||
},
|
||||
"User/UI/Window/5_Inventory/ItemACollect.nut": {
|
||||
"description": "装扮物品栏"
|
||||
},
|
||||
"User/UI/Window/5_Inventory/AvatarCollect.nut": {
|
||||
"description": "装扮物品栏"
|
||||
},
|
||||
"User/UI/Window/8_SkillTree": {
|
||||
"description": "技能树"
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,3 @@
|
|||
equipment/equipmentinfo.etc 装备信息界面的配置
|
||||
etc/iteminfo.etc 装备和道具信息界面的配置
|
||||
|
||||
角色chr文件新增了[default avatar] 的标签用于设置 角色默认装备
|
||||
Loading…
Reference in New Issue