UI新增滚动条 成就系统完成分离
This commit is contained in:
parent
d71fc5c822
commit
920015e323
|
|
@ -736,6 +736,7 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
|
||||||
TopCallBackFunc = null;
|
TopCallBackFunc = null;
|
||||||
|
|
||||||
Data = null;
|
Data = null;
|
||||||
|
DeBugMode = false;
|
||||||
|
|
||||||
constructor(x, y, width, height) {
|
constructor(x, y, width, height) {
|
||||||
this.Localtion_X = x;
|
this.Localtion_X = x;
|
||||||
|
|
@ -792,7 +793,13 @@ class LenheartNewUI_CommonUi extends LenheartNewUI_BaseWindow {
|
||||||
|
|
||||||
function TopShow(obj) {
|
function TopShow(obj) {
|
||||||
if (TopCallBackFunc) TopCallBackFunc(obj, this);
|
if (TopCallBackFunc) TopCallBackFunc(obj, this);
|
||||||
|
if (DeBugMode) DeBug(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function DeBug(obj) {
|
||||||
|
sq_DrawBox(X, Y, Width, Height, 0xffffffff);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LenheartNewUI_BaseButton extends LenheartNewUI_CommonUi {
|
class LenheartNewUI_BaseButton extends LenheartNewUI_CommonUi {
|
||||||
|
|
@ -1196,3 +1203,210 @@ class LenheartNewUI_TabbarsText extends LenheartNewUI_Tabbars {
|
||||||
L_sq_DrawCode(TextStr, X + TextXoffset, SY + 2, Color, 0, 1);
|
L_sq_DrawCode(TextStr, X + TextXoffset, SY + 2, Color, 0, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Yosin_DragButton extends LenheartNewUI_CommonUi {
|
||||||
|
State = 0;
|
||||||
|
DHeight = null; // 改为高度
|
||||||
|
Path = "interface/lenheartwindowcommon.img";
|
||||||
|
Idx = 172;
|
||||||
|
FillHeight = 2; // 改为填充高度
|
||||||
|
FirstHeight = 7; // 改为首节高度
|
||||||
|
Width = 9; // 固定宽度,垂直按钮宽度通常是固定的
|
||||||
|
Visible = true;
|
||||||
|
DeBugMode = false;
|
||||||
|
|
||||||
|
BasePos = null;
|
||||||
|
MoveFlag = false;
|
||||||
|
//鼠标相对位置
|
||||||
|
M_Xpos = null;
|
||||||
|
M_Ypos = null;
|
||||||
|
B_X = null;
|
||||||
|
B_Y = null;
|
||||||
|
Move_Value = 0;
|
||||||
|
Max_Move_Value = 0;
|
||||||
|
|
||||||
|
CurrentMovePosY = 0;
|
||||||
|
|
||||||
|
//当前滚动值
|
||||||
|
CurrentScrollValue = 0.0;
|
||||||
|
|
||||||
|
OnChange = null;
|
||||||
|
|
||||||
|
constructor(X, Y, H) {
|
||||||
|
this.DHeight = H;
|
||||||
|
LenheartNewUI_CommonUi.constructor(X, Y, Width, H + 7 * 2); // 宽度固定,高度动态
|
||||||
|
|
||||||
|
BasePos = {
|
||||||
|
x = X,
|
||||||
|
y = Y
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetFrame(gPath, gIdx) {
|
||||||
|
if (gPath) Path = gPath;
|
||||||
|
Idx = gIdx;
|
||||||
|
}
|
||||||
|
|
||||||
|
function Show(obj) {
|
||||||
|
//不可用
|
||||||
|
if (State == 8) {
|
||||||
|
L_sq_Draw3Image_Vertical(X + 1, Y, this.DHeight, Path, Idx + 9, FillHeight, FirstHeight);
|
||||||
|
} else {
|
||||||
|
//按下
|
||||||
|
if (isLBDown) {
|
||||||
|
L_sq_Draw3Image_Vertical(X, Y + 1, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight);
|
||||||
|
}
|
||||||
|
//悬停
|
||||||
|
else if (isInRect) {
|
||||||
|
L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight);
|
||||||
|
}
|
||||||
|
//普通
|
||||||
|
else {
|
||||||
|
L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx, FillHeight, FirstHeight);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//鼠标左键按下回调
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||||
|
LenheartNewUI_CommonUi.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||||
|
|
||||||
|
if (isInRect) {
|
||||||
|
MoveFlag = true;
|
||||||
|
M_Xpos = MousePos_X; //原始鼠标位置数据
|
||||||
|
M_Ypos = MousePos_Y;
|
||||||
|
B_X = X; //原始窗口位置
|
||||||
|
B_Y = Y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//鼠标事件回调
|
||||||
|
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
|
||||||
|
LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
||||||
|
|
||||||
|
//移动
|
||||||
|
if (MoveFlag) {
|
||||||
|
Move_Value = MousePos_Y - M_Ypos + CurrentMovePosY;
|
||||||
|
if (Move_Value > 0 && Move_Value <= Max_Move_Value) {
|
||||||
|
Y = (Move_Value);
|
||||||
|
Localtion_Y = (BasePos.y + Move_Value);
|
||||||
|
if (OnChange) {
|
||||||
|
local Rate = Move_Value.tofloat() / Max_Move_Value.tofloat();
|
||||||
|
CurrentScrollValue = format("%.2f", Rate).tofloat();
|
||||||
|
OnChange(CurrentScrollValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
LenheartNewUI_CommonUi.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
MoveFlag = false;
|
||||||
|
if (Move_Value< 0) Move_Value = 0;
|
||||||
|
if (Move_Value > Max_Move_Value) Move_Value = Max_Move_Value;
|
||||||
|
CurrentMovePosY = Move_Value; //记录当前移动位置
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置最大移动值
|
||||||
|
function SetMaxMoveValue(Value) {
|
||||||
|
Max_Move_Value = Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置滚动回调函数
|
||||||
|
function SetOnChange(OnChange) {
|
||||||
|
this.OnChange = OnChange;
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置滚动步进
|
||||||
|
function SetStep(Step) {
|
||||||
|
// 计算新的移动值
|
||||||
|
local newValue = CurrentMovePosY + (Step * Max_Move_Value).tointeger();
|
||||||
|
|
||||||
|
// 边界检查
|
||||||
|
if (newValue< 0) newValue = 0;
|
||||||
|
if (newValue > Max_Move_Value) newValue = Max_Move_Value;
|
||||||
|
|
||||||
|
// 更新位置
|
||||||
|
Move_Value = newValue;
|
||||||
|
CurrentMovePosY = newValue;
|
||||||
|
Localtion_Y = BasePos.y + newValue;
|
||||||
|
// 更新并回调滚动值
|
||||||
|
if (OnChange) {
|
||||||
|
local Rate = Move_Value.tofloat() / Max_Move_Value.tofloat();
|
||||||
|
CurrentScrollValue = format("%.2f", Rate).tofloat();
|
||||||
|
OnChange(CurrentScrollValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
class Yosin_ScrollBar {
|
||||||
|
|
||||||
|
//上按钮
|
||||||
|
UpButton = null;
|
||||||
|
//下按钮
|
||||||
|
DownButton = null;
|
||||||
|
//滑动按钮
|
||||||
|
ScrollButton = null;
|
||||||
|
//点击时步进的Y轴值
|
||||||
|
Step = 0.0;
|
||||||
|
|
||||||
|
Parent = null;
|
||||||
|
|
||||||
|
constructor(X, Y, H, Sbtn_H) {
|
||||||
|
|
||||||
|
|
||||||
|
ScrollButton = Yosin_DragButton(X, Y + 13, Sbtn_H);
|
||||||
|
ScrollButton.SetFrame("interface/lenheartwindowcommon.img", 184);
|
||||||
|
//减去按钮高度 加滚动条长度加滚动条上下拼接长度15 加滚动条最大高度
|
||||||
|
ScrollButton.SetMaxMoveValue(H - 26 - ScrollButton.Height);
|
||||||
|
|
||||||
|
UpButton = LenheartNewUI_BaseButton(X, Y, 9, 13, "interface/lenheartwindowcommon.img", 16);
|
||||||
|
UpButton.OnClick = function() {
|
||||||
|
DoStep(-1);
|
||||||
|
}.bindenv(this);
|
||||||
|
|
||||||
|
DownButton = LenheartNewUI_BaseButton(X, Y + H - 13, 9, 13, "interface/lenheartwindowcommon.img", 22);
|
||||||
|
DownButton.OnClick = function() {
|
||||||
|
DoStep(1);
|
||||||
|
}.bindenv(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
function DoStep(Flag) {
|
||||||
|
ScrollButton.SetStep(Step * Flag);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetParent(Ui) {
|
||||||
|
Parent = Ui;
|
||||||
|
Ui.AddChild(UpButton);
|
||||||
|
Ui.AddChild(ScrollButton);
|
||||||
|
Ui.AddChild(DownButton);
|
||||||
|
}
|
||||||
|
|
||||||
|
function RemoveSelf() {
|
||||||
|
for (local i = 0; i< Parent.Childrens.len(); i++) {
|
||||||
|
local obj = Parent.Childrens[i];
|
||||||
|
if (obj == UpButton || obj == ScrollButton || obj == DownButton) {
|
||||||
|
Parent.Childrens.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetDebugModel(Flag) {
|
||||||
|
UpButton.DeBugMode = Flag;
|
||||||
|
ScrollButton.DeBugMode = Flag;
|
||||||
|
DownButton.DeBugMode = Flag;
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetOnChange(Func) {
|
||||||
|
ScrollButton.SetOnChange(Func);
|
||||||
|
}
|
||||||
|
|
||||||
|
function SetStep(value) {
|
||||||
|
Step = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -5,276 +5,13 @@
|
||||||
文件用途:成就系统
|
文件用途:成就系统
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
class Achievement_TypeButton extends LenheartNewUI_BaseButton {
|
||||||
|
|
||||||
class Yosin_DragButton extends LenheartNewUI_CommonUi {
|
function _typeof() {
|
||||||
State = 0;
|
return "Achievement_TypeButton";
|
||||||
BaseIdx = 29;
|
|
||||||
DHeight = null; // 改为高度
|
|
||||||
Path = "interface/lenheartwindowcommon.img";
|
|
||||||
Idx = 172;
|
|
||||||
FillHeight = 2; // 改为填充高度
|
|
||||||
FirstHeight = 7; // 改为首节高度
|
|
||||||
Width = 9; // 固定宽度,垂直按钮宽度通常是固定的
|
|
||||||
Visible = true;
|
|
||||||
DeBugMode = false;
|
|
||||||
|
|
||||||
BasePos = null;
|
|
||||||
MoveFlag = false;
|
|
||||||
//鼠标相对位置
|
|
||||||
M_Xpos = null;
|
|
||||||
M_Ypos = null;
|
|
||||||
B_X = null;
|
|
||||||
B_Y = null;
|
|
||||||
Move_Value = 0;
|
|
||||||
Max_Move_Value = 0;
|
|
||||||
|
|
||||||
CurrentMovePosY = 0;
|
|
||||||
|
|
||||||
constructor(X, Y, H) {
|
|
||||||
this.DHeight = H;
|
|
||||||
LenheartNewUI_CommonUi.constructor(X, Y, Width, H + 7 * 2); // 宽度固定,高度动态
|
|
||||||
|
|
||||||
BasePos = {
|
|
||||||
x = X,
|
|
||||||
y = Y
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function SetFrame(gPath, gIdx) {
|
|
||||||
if (gPath) Path = gPath;
|
|
||||||
Idx = gIdx;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Show(obj) {
|
|
||||||
//不可用
|
|
||||||
if (State == 8) {
|
|
||||||
L_sq_Draw3Image_Vertical(X + 1, Y, this.DHeight, Path, Idx + 9, FillHeight, FirstHeight);
|
|
||||||
} else {
|
|
||||||
//按下
|
|
||||||
if (isLBDown) {
|
|
||||||
L_sq_Draw3Image_Vertical(X, Y + 1, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight);
|
|
||||||
}
|
|
||||||
//悬停
|
|
||||||
else if (isInRect) {
|
|
||||||
L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx + 3, FillHeight, FirstHeight);
|
|
||||||
}
|
|
||||||
//普通
|
|
||||||
else {
|
|
||||||
L_sq_Draw3Image_Vertical(X, Y, this.DHeight, Path, Idx, FillHeight, FirstHeight);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//鼠标左键按下回调
|
|
||||||
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
|
||||||
LenheartNewUI_CommonUi.OnMouseLbDown(MousePos_X, MousePos_Y);
|
|
||||||
|
|
||||||
if (isInRect) {
|
|
||||||
MoveFlag = true;
|
|
||||||
M_Xpos = MousePos_X; //原始鼠标位置数据
|
|
||||||
M_Ypos = MousePos_Y;
|
|
||||||
B_X = X; //原始窗口位置
|
|
||||||
B_Y = Y;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//鼠标事件回调
|
|
||||||
function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
|
|
||||||
LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
|
||||||
|
|
||||||
//移动
|
|
||||||
if (MoveFlag) {
|
|
||||||
Move_Value = MousePos_Y - M_Ypos + CurrentMovePosY;
|
|
||||||
print(Move_Value);
|
|
||||||
if ( Move_Value <= (Max_Move_Value - Height + BasePos.y)) {
|
|
||||||
Y = (Move_Value);
|
|
||||||
Localtion_Y = (BasePos.y + Move_Value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//鼠标左键弹起回调
|
|
||||||
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
|
||||||
LenheartNewUI_CommonUi.OnMouseLbUp(MousePos_X, MousePos_Y);
|
|
||||||
MoveFlag = false;
|
|
||||||
CurrentMovePosY = Move_Value; //记录当前移动位置
|
|
||||||
}
|
|
||||||
|
|
||||||
//设置最大移动值
|
|
||||||
function SetMaxMoveValue(Value) {
|
|
||||||
Max_Move_Value = Value;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// class Yosin_DragButton extends LenheartNewUI_CommonUi {
|
|
||||||
// //路径
|
|
||||||
// Path = "";
|
|
||||||
// //索引
|
|
||||||
// Idx = 0;
|
|
||||||
// //方向
|
|
||||||
// Direction = false;
|
|
||||||
|
|
||||||
// //按钮
|
|
||||||
// Button = null;
|
|
||||||
|
|
||||||
// //变动位置回调函数
|
|
||||||
// OnChange = null;
|
|
||||||
|
|
||||||
// //鼠标相对位置
|
|
||||||
// M_Xpos = null;
|
|
||||||
// M_Ypos = null;
|
|
||||||
// //未移动时的初始坐标
|
|
||||||
// BasePos = null;
|
|
||||||
// //移动Flag
|
|
||||||
// MoveFlag = false;
|
|
||||||
// //最大移动值
|
|
||||||
// Max_Move_Value = 0;
|
|
||||||
// //移动值
|
|
||||||
// Move_Value = 0;
|
|
||||||
// //侦测值
|
|
||||||
// Detect_Value = 0;
|
|
||||||
|
|
||||||
// B_X = null;
|
|
||||||
// B_Y = null;
|
|
||||||
|
|
||||||
// Visible = true;
|
|
||||||
// DeBugMode = false;
|
|
||||||
|
|
||||||
// constructor(X, Y, S_H, H) {
|
|
||||||
// Childrens = [];
|
|
||||||
// this.Path = Path;
|
|
||||||
// this.Idx = Idx;
|
|
||||||
// LenheartNewUI_CommonUi.constructor(X, Y, 9, H);
|
|
||||||
|
|
||||||
// Button = LenheartNewUI_VerticalButton(X, Y, S_H);
|
|
||||||
// Button.SetFrame("interface/lenheartwindowcommon.img", 184);
|
|
||||||
// AddChild(Button);
|
|
||||||
|
|
||||||
|
|
||||||
// BasePos = {
|
|
||||||
// x = X,
|
|
||||||
// y = Y
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //生成DT
|
|
||||||
// function GenerateDt() {
|
|
||||||
// try {
|
|
||||||
// local CurT = L_Getmicroseconds();
|
|
||||||
// Duration = (CurT - DurationFlag);
|
|
||||||
// DurationFlag = CurT;
|
|
||||||
// } catch (exception) {
|
|
||||||
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function DeBug(obj) {
|
|
||||||
// sq_DrawBox(X, Y, Width, Height, 0xffffffff);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// function Show(obj) {
|
|
||||||
// LenheartNewUI_Windows.Show(obj);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //同步坐标
|
|
||||||
// function SyncPos(X, Y) {
|
|
||||||
// this.X = X;
|
|
||||||
// this.Y = Y;
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.SyncPos(X, Y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// //鼠标事件回调
|
|
||||||
// function OnMouseProc(Flag, MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
|
||||||
|
|
||||||
// if (sq_IsIntersectRect(MousePos_X, MousePos_Y, 1, 1, Parent.X + Button.Localtion_X , Parent.Y + Button.Localtion_Y, Width, Height)){
|
|
||||||
// isInRect = true;
|
|
||||||
// }
|
|
||||||
// else isInRect = false;
|
|
||||||
|
|
||||||
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseProc(Flag, MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
// //移动
|
|
||||||
// if (MoveFlag) {
|
|
||||||
// //左键拖动
|
|
||||||
// if (Direction) {
|
|
||||||
// Move_Value = B_X + (MousePos_X - M_Xpos);
|
|
||||||
// if (!(Move_Value >= (0 + BasePos.x) && Move_Value <= (Max_Move_Value - Width + BasePos.x))) {
|
|
||||||
// X = Move_Value;
|
|
||||||
// // DragLogic((Move_Value - Localtion_X).tofloat() / (Max_Move_Value - Width + BasePos.x - Localtion_X).tofloat());
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// Move_Value = B_Y + (MousePos_Y - M_Ypos);
|
|
||||||
// if (Move_Value >= (0 + BasePos.y) && Move_Value <= (Max_Move_Value - Height + BasePos.y)) {
|
|
||||||
// Y = (Move_Value);
|
|
||||||
// Button.Localtion_Y = (Move_Value);
|
|
||||||
// // DragLogic((Move_Value - Localtion_Y).tofloat() / (Max_Move_Value - Height + BasePos.y - Localtion_Y).tofloat());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// SyncPos(X, Y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //鼠标左键按下回调
|
|
||||||
// function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseLbDown(MousePos_X, MousePos_Y);
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseLbDown(MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (isInRect) {
|
|
||||||
// MoveFlag = true;
|
|
||||||
// M_Xpos = MousePos_X; //原始鼠标位置数据
|
|
||||||
// M_Ypos = MousePos_Y;
|
|
||||||
// B_X = X; //原始窗口位置
|
|
||||||
// B_Y = Y;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //鼠标左键弹起回调
|
|
||||||
// function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseLbUp(MousePos_X, MousePos_Y);
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseLbUp(MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// MoveFlag = false;
|
|
||||||
// }
|
|
||||||
// //鼠标右键按下回调
|
|
||||||
// function OnMouseRbDown(MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseRbDown(MousePos_X, MousePos_Y);
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseRbDown(MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //鼠标右键弹起回调
|
|
||||||
// function OnMouseRbUp(MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseRbUp(MousePos_X, MousePos_Y);
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseRbUp(MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //鼠标滚轮时间回调
|
|
||||||
// function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
|
||||||
// LenheartNewUI_CommonUi.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
|
||||||
// foreach(Window in Childrens) {
|
|
||||||
// Window.OnMouseWheel(Flag, MousePos_X, MousePos_Y);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //设置最大移动值
|
|
||||||
// function SetMaxMoveValue(Value) {
|
|
||||||
// Max_Move_Value = Value;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
class AchievementC extends LenheartNewUI_Windows {
|
class AchievementC extends LenheartNewUI_Windows {
|
||||||
//调试模式
|
//调试模式
|
||||||
// DeBugMode = true;
|
// DeBugMode = true;
|
||||||
|
|
@ -305,6 +42,18 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
|
|
||||||
EventWindow = null;
|
EventWindow = null;
|
||||||
|
|
||||||
|
//左侧滚动条对象
|
||||||
|
LeftScrollBar = null;
|
||||||
|
//左侧滚轮值
|
||||||
|
LeftScrollRate = 0;
|
||||||
|
LeftScrollValue = 400;
|
||||||
|
|
||||||
|
//右侧滚动条对象
|
||||||
|
RightScrollBar = null;
|
||||||
|
//右侧滚轮值
|
||||||
|
RightScrollRate = 0;
|
||||||
|
RightScrollValue = 400;
|
||||||
|
|
||||||
//查询成就回包
|
//查询成就回包
|
||||||
function OnQueryAchievementBack(Chunk) {
|
function OnQueryAchievementBack(Chunk) {
|
||||||
local Jso = Json.Decode(Chunk);
|
local Jso = Json.Decode(Chunk);
|
||||||
|
|
@ -346,10 +95,35 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
|
EtcInfo = Rindro_Script.GetFileData("etc/th_plugin/etc.etc", function(DataTable, Data) {
|
||||||
|
while (!Data.Eof()) {
|
||||||
|
local Str = Data.Get();
|
||||||
|
if (Str == "[window pos]") {
|
||||||
|
DataTable.window_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
} else if (Str == "[clicp pos]") {
|
||||||
|
DataTable.clicp_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
} else if (Str == "[clicp2 pos]") {
|
||||||
|
DataTable.clicp_pos2 <- [Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
}else if (Str == "[closebutton pos]") {
|
||||||
|
DataTable.closebutton_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
} else if (Str == "[left scroll bar]") {
|
||||||
|
DataTable.left_scroll_bar_info <- [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
} else if (Str == "[right scroll bar]") {
|
||||||
|
DataTable.right_scroll_bar_info <- [];
|
||||||
|
while (true) {
|
||||||
|
local buf = Data.Get();
|
||||||
|
if (buf == "[/right scroll bar]") break;
|
||||||
|
local Arr = [buf,Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
|
DataTable.right_scroll_bar_info.append(Arr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}.bindenv(this));
|
||||||
|
|
||||||
Childrens = [];
|
Childrens = [];
|
||||||
InitButtonConfig();
|
InitButtonConfig();
|
||||||
//注册控件
|
//注册控件
|
||||||
RegisterWidget();
|
RegisterWidget(true);
|
||||||
|
|
||||||
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
LenheartNewUI_Windows.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
Pack_Control.rawset(20091002, OnQueryAchievementBack.bindenv(this));
|
Pack_Control.rawset(20091002, OnQueryAchievementBack.bindenv(this));
|
||||||
|
|
@ -372,10 +146,17 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
}
|
}
|
||||||
|
|
||||||
function InitAchievement() {
|
function InitAchievement() {
|
||||||
Childrens = [];
|
for (local i = 0; i< Childrens.len(); i++) {
|
||||||
ScrollValueMax = 0;
|
if (typeof Childrens[i] == "Achievement_TypeButton") {
|
||||||
RegisterWidget();
|
Childrens.remove(i);
|
||||||
|
i--;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//这里要手动移除右边的滚动条
|
||||||
|
if (RightScrollBar) RightScrollBar.RemoveSelf();
|
||||||
|
|
||||||
|
ScrollValueMax = 0;
|
||||||
|
RegisterWidget(false);
|
||||||
|
|
||||||
if (Info.len() > Page) {
|
if (Info.len() > Page) {
|
||||||
//绘制成就
|
//绘制成就
|
||||||
|
|
@ -383,6 +164,14 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
if (InfoObj.Pos.y - 320 > ScrollValueMax) ScrollValueMax = InfoObj.Pos.y - 320;
|
if (InfoObj.Pos.y - 320 > ScrollValueMax) ScrollValueMax = InfoObj.Pos.y - 320;
|
||||||
DrawAItem(InfoObj);
|
DrawAItem(InfoObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RightScrollValue = EtcInfo.right_scroll_bar_info[Page][4];
|
||||||
|
RightScrollBar = Yosin_ScrollBar(EtcInfo.right_scroll_bar_info[Page][0], EtcInfo.right_scroll_bar_info[Page][1], EtcInfo.right_scroll_bar_info[Page][2], EtcInfo.right_scroll_bar_info[Page][3]);
|
||||||
|
RightScrollBar.SetParent(this);
|
||||||
|
RightScrollBar.SetStep(EtcInfo.right_scroll_bar_info[Page][5].tofloat() / 100.0);
|
||||||
|
RightScrollBar.SetOnChange(function(Rate) {
|
||||||
|
ScrollValue = (Rate * RightScrollValue).tointeger();
|
||||||
|
}.bindenv(this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -513,26 +302,40 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function RegisterWidget() {
|
function RegisterWidget(Flag) {
|
||||||
|
if (!Flag) {
|
||||||
//类型按钮
|
//类型按钮
|
||||||
for (local i = 0; i< ButtonInfo.len(); i++) {
|
for (local i = 0; i< ButtonInfo.len(); i++) {
|
||||||
local Config = ButtonInfo[i];
|
local Config = ButtonInfo[i];
|
||||||
local TypeButton = LenheartNewUI_BaseButton(Config.Pos.x, Config.Pos.y, Config.Size.x, Config.Size.y, Config.Icon.Path, Config.Icon.Idx);
|
local TypeButton = Achievement_TypeButton(Config.Pos.x, Config.Pos.y, Config.Size.x, Config.Size.y, Config.Icon.Path, Config.Icon.Idx);
|
||||||
TypeButton.Data = i;
|
TypeButton.Data = {
|
||||||
|
id = i,
|
||||||
|
BasePosY = Config.Pos.y,
|
||||||
|
};
|
||||||
TypeButton.OnClickEx = function(Button) {
|
TypeButton.OnClickEx = function(Button) {
|
||||||
Page = Button.Data;
|
if (Button.Localtion_Y <= EtcInfo.clicp_pos[1]) return;
|
||||||
|
Page = Button.Data.id;
|
||||||
InitAchievement();
|
InitAchievement();
|
||||||
QueryAchievement();
|
QueryAchievement();
|
||||||
}.bindenv(this);
|
}.bindenv(this);
|
||||||
|
TypeButton.SetCallBackFunc(function(Btn) {
|
||||||
|
Btn.Localtion_Y = (Btn.Data.BasePosY - LeftScrollRate * LeftScrollValue).tointeger();
|
||||||
|
}.bindenv(this));
|
||||||
Childrens.append(TypeButton);
|
Childrens.append(TypeButton);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// local TestButton = Yosin_DragButton(50, 120, 10);
|
//只有第一次的时候注册进度条
|
||||||
// TestButton.SetFrame("interface/lenheartwindowcommon.img", 184);
|
if (Flag) {
|
||||||
// TestButton.SetMaxMoveValue(400);
|
LeftScrollValue = EtcInfo.left_scroll_bar_info[4];
|
||||||
// AddChild(TestButton);
|
LeftScrollBar = Yosin_ScrollBar(EtcInfo.left_scroll_bar_info[0], EtcInfo.left_scroll_bar_info[1], EtcInfo.left_scroll_bar_info[2], EtcInfo.left_scroll_bar_info[3]);
|
||||||
// Childrens.append(TestButton);
|
LeftScrollBar.SetParent(this);
|
||||||
|
LeftScrollBar.SetStep(EtcInfo.left_scroll_bar_info[5].tofloat() / 100.0);
|
||||||
|
LeftScrollBar.SetOnChange(function(Rate) {
|
||||||
|
LeftScrollRate = Rate;
|
||||||
|
}.bindenv(this));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//绘制主界面
|
//绘制主界面
|
||||||
|
|
@ -564,14 +367,21 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
|
|
||||||
function Show(obj) {
|
function Show(obj) {
|
||||||
DrawMain(obj);
|
DrawMain(obj);
|
||||||
|
// setClip(X + EtcInfo.clicp_pos[0], Y + EtcInfo.clicp_pos[1], X + EtcInfo.clicp_pos[2], Y + EtcInfo.clicp_pos[3]);
|
||||||
|
//左侧裁切
|
||||||
setClip(X + EtcInfo.clicp_pos[0], Y + EtcInfo.clicp_pos[1], X + EtcInfo.clicp_pos[2], Y + EtcInfo.clicp_pos[3]);
|
setClip(X + EtcInfo.clicp_pos[0], Y + EtcInfo.clicp_pos[1], X + EtcInfo.clicp_pos[2], Y + EtcInfo.clicp_pos[3]);
|
||||||
LenheartNewUI_Windows.Show(obj);
|
LenheartNewUI_Windows.Show(obj);
|
||||||
releaseClip(); //裁切结束
|
releaseClip(); //裁切结束
|
||||||
|
|
||||||
|
//右侧裁切
|
||||||
|
setClip(X + EtcInfo.clicp_pos2[0], Y + EtcInfo.clicp_pos2[1], X + EtcInfo.clicp_pos2[2], Y + EtcInfo.clicp_pos2[3]);
|
||||||
|
LenheartNewUI_Windows.Show(obj);
|
||||||
|
releaseClip(); //裁切结束
|
||||||
DrawInfo();
|
DrawInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
function DrawAItem(InfoObj) {
|
function DrawAItem(InfoObj) {
|
||||||
local Button = LenheartNewUI_BaseButton(InfoObj.Pos.x, InfoObj.Pos.y, InfoObj.Size.x, InfoObj.Size.y, InfoObj.Icon.Path, InfoObj.Icon.Idx);
|
local Button = Achievement_TypeButton(InfoObj.Pos.x, InfoObj.Pos.y, InfoObj.Size.x, InfoObj.Size.y, InfoObj.Icon.Path, InfoObj.Icon.Idx);
|
||||||
Button.Data = InfoObj;
|
Button.Data = InfoObj;
|
||||||
Button.SetCallBackFunc(function(Button) {
|
Button.SetCallBackFunc(function(Button) {
|
||||||
local InfoObj = Button.Data;
|
local InfoObj = Button.Data;
|
||||||
|
|
@ -627,12 +437,19 @@ class AchievementC extends LenheartNewUI_Windows {
|
||||||
//鼠标滚轮事件回调
|
//鼠标滚轮事件回调
|
||||||
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
function OnMouseWheel(Flag, MousePos_X, MousePos_Y) {
|
||||||
|
|
||||||
|
if (MousePos_X > (X + 205)) {
|
||||||
|
// if (Flag) {
|
||||||
|
// if (ScrollValue > 0) ScrollValue -= 35;
|
||||||
|
|
||||||
if (Flag) {
|
// }
|
||||||
if (ScrollValue > 0) ScrollValue -= 35;
|
// if (!Flag) {
|
||||||
}
|
// if (ScrollValue< ScrollValueMax) ScrollValue += 35;
|
||||||
if (!Flag) {
|
// }
|
||||||
if (ScrollValue< ScrollValueMax) ScrollValue += 35;
|
if (Flag) RightScrollBar.DoStep(-1);
|
||||||
|
if (!Flag) RightScrollBar.DoStep(1);
|
||||||
|
} else {
|
||||||
|
if (Flag) LeftScrollBar.DoStep(-1);
|
||||||
|
if (!Flag) LeftScrollBar.DoStep(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
//调用原生方法
|
//调用原生方法
|
||||||
|
|
@ -673,17 +490,12 @@ function Lenheart_Achievement_Fun(obj) {
|
||||||
local Str = Data.Get();
|
local Str = Data.Get();
|
||||||
if (Str == "[window pos]") {
|
if (Str == "[window pos]") {
|
||||||
DataTable.window_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
DataTable.window_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
||||||
} else if (Str == "[clicp pos]") {
|
|
||||||
DataTable.clicp_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
|
||||||
} else if (Str == "[closebutton pos]") {
|
|
||||||
DataTable.closebutton_pos <- [Data.Get(), Data.Get(), Data.Get(), Data.Get()];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}.bindenv(this));
|
}.bindenv(this));
|
||||||
local window_Info = Info.window_pos;
|
local window_Info = Info.window_pos;
|
||||||
|
|
||||||
local Win = LenheartNewUI_CreateWindow(AchievementC, "成就系统窗口", window_Info[0], window_Info[1], window_Info[2], window_Info[3], window_Info[4]);
|
local Win = LenheartNewUI_CreateWindow(AchievementC, "成就系统窗口", window_Info[0], window_Info[1], window_Info[2], window_Info[3], window_Info[4]);
|
||||||
Win.EtcInfo = Info;
|
|
||||||
EventList_Obj.AddEvent("成就系统", 118, Win);
|
EventList_Obj.AddEvent("成就系统", 118, Win);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue