no message
This commit is contained in:
parent
c1da9e8a6b
commit
978818789a
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
|
|
@ -6,6 +6,8 @@
|
||||||
*/
|
*/
|
||||||
class CL_BaseObject {
|
class CL_BaseObject {
|
||||||
|
|
||||||
|
X = 0;
|
||||||
|
Y = 0;
|
||||||
//父对象
|
//父对象
|
||||||
Parent = null;
|
Parent = null;
|
||||||
//子对象数组
|
//子对象数组
|
||||||
|
|
@ -187,10 +189,15 @@ class CL_BaseObject {
|
||||||
}
|
}
|
||||||
//设置坐标
|
//设置坐标
|
||||||
function SetPosition(Value, ...) {
|
function SetPosition(Value, ...) {
|
||||||
if (vargv.len() == 0)
|
if (vargv.len() == 0) {
|
||||||
|
X = Value.x;
|
||||||
|
Y = Value.y;
|
||||||
BaseObject_SetPosition(this.C_Object, Value);
|
BaseObject_SetPosition(this.C_Object, Value);
|
||||||
else if (vargv.len() == 1)
|
} else if (vargv.len() == 1) {
|
||||||
|
X = Value;
|
||||||
|
Y = vargv[0];
|
||||||
BaseObject_SetPosition(this.C_Object, Value, vargv[0]);
|
BaseObject_SetPosition(this.C_Object, Value, vargv[0]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//移动坐标
|
//移动坐标
|
||||||
function MoveTo(Value, ...) {
|
function MoveTo(Value, ...) {
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,44 @@
|
||||||
*/
|
*/
|
||||||
class TextActor extends CL_BaseObject {
|
class TextActor extends CL_BaseObject {
|
||||||
|
|
||||||
|
//不需要Update函数
|
||||||
|
NoUpdate = true;
|
||||||
|
|
||||||
|
OutlineChild = null;
|
||||||
|
Strokeoffsets = [{
|
||||||
|
x = 1,
|
||||||
|
y = 0
|
||||||
|
}, // 右
|
||||||
|
{
|
||||||
|
x = 1,
|
||||||
|
y = 1
|
||||||
|
}, // 右上
|
||||||
|
{
|
||||||
|
x = 0,
|
||||||
|
y = 1
|
||||||
|
}, // 上
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = 1
|
||||||
|
}, // 左上
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = 0
|
||||||
|
}, // 左
|
||||||
|
{
|
||||||
|
x = -1,
|
||||||
|
y = -1
|
||||||
|
}, // 左下
|
||||||
|
{
|
||||||
|
x = 0,
|
||||||
|
y = -1
|
||||||
|
}, // 下
|
||||||
|
{
|
||||||
|
x = 1,
|
||||||
|
y = -1
|
||||||
|
} // 右下
|
||||||
|
];
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @函数作用: 构造文本精灵
|
* @函数作用: 构造文本精灵
|
||||||
* @参数 font 可传入全局font Id 或 传入 font对象
|
* @参数 font 可传入全局font Id 或 传入 font对象
|
||||||
|
|
@ -37,6 +75,11 @@ class TextActor extends CL_BaseObject {
|
||||||
//设置文本内容
|
//设置文本内容
|
||||||
function SetText(str) {
|
function SetText(str) {
|
||||||
TextActor_SetText(this.C_Object, str);
|
TextActor_SetText(this.C_Object, str);
|
||||||
|
if (OutlineChild) {
|
||||||
|
foreach(obj in OutlineChild) {
|
||||||
|
obj.SetText(str);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//设置描边
|
//设置描边
|
||||||
|
|
@ -44,6 +87,19 @@ class TextActor extends CL_BaseObject {
|
||||||
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
|
TextActor_SetOutLine(this.C_Object, width, color, cap, line_join, dash);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// //设置描边
|
||||||
|
// function SetOutline(style) {
|
||||||
|
// OutlineChild = [];
|
||||||
|
// for (local i = 0; i< 8; i++) {
|
||||||
|
// style.color = 0xff000000;
|
||||||
|
// local buf = FontAssetManager.GenerateNormal("", false, style);
|
||||||
|
// buf.SetPosition(Strokeoffsets[i]);
|
||||||
|
// buf.SetZOrder(-1);
|
||||||
|
// OutlineChild.push(buf);
|
||||||
|
// Addchild(buf);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
//设置填充颜色
|
//设置填充颜色
|
||||||
function SetFillColor(Color) {
|
function SetFillColor(Color) {
|
||||||
TextActor_SetFillColor(this.C_Object, Color);
|
TextActor_SetFillColor(this.C_Object, Color);
|
||||||
|
|
|
||||||
|
|
@ -25,6 +25,13 @@ class Yosin_BaseWindow extends Layer {
|
||||||
Y = null;
|
Y = null;
|
||||||
B_Y = null;
|
B_Y = null;
|
||||||
|
|
||||||
|
//宽度
|
||||||
|
Width = null;
|
||||||
|
//高度
|
||||||
|
Height = null;
|
||||||
|
//调试模式显示精灵
|
||||||
|
DeBugSprite = null;
|
||||||
|
|
||||||
function _typeof() {
|
function _typeof() {
|
||||||
return "Yosin_BaseWindow";
|
return "Yosin_BaseWindow";
|
||||||
}
|
}
|
||||||
|
|
@ -159,6 +166,15 @@ class Yosin_BaseWindow extends Layer {
|
||||||
Removechild(gChild);
|
Removechild(gChild);
|
||||||
// gChild.Parent = this;
|
// gChild.Parent = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//开启Debug模式
|
||||||
|
function OpenDeBug() {
|
||||||
|
DeBugSprite = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 257);
|
||||||
|
DeBugSprite.SetSize(Width, Height);
|
||||||
|
DeBugSprite.SetZOrder(300000);
|
||||||
|
DeBugSprite.SetOpacity(0.35);
|
||||||
|
Addchild(DeBugSprite);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -166,15 +182,9 @@ class Yosin_BaseWindow extends Layer {
|
||||||
class Yosin_Window extends Yosin_BaseWindow {
|
class Yosin_Window extends Yosin_BaseWindow {
|
||||||
//窗口名称
|
//窗口名称
|
||||||
ObjectId = null;
|
ObjectId = null;
|
||||||
//宽度
|
|
||||||
Width = null;
|
|
||||||
//高度
|
|
||||||
Height = null;
|
|
||||||
//标题高度
|
//标题高度
|
||||||
TitleH = null;
|
TitleH = null;
|
||||||
|
|
||||||
//调试模式
|
|
||||||
DeBugMode = false;
|
|
||||||
//鼠标相对位置
|
//鼠标相对位置
|
||||||
M_Xpos = null;
|
M_Xpos = null;
|
||||||
M_Ypos = null;
|
M_Ypos = null;
|
||||||
|
|
@ -272,11 +282,6 @@ class Yosin_Window extends Yosin_BaseWindow {
|
||||||
this.DestroyFlag = true;
|
this.DestroyFlag = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
//开启Debug模式
|
|
||||||
function OpenDeBug() {
|
|
||||||
ShowBorder(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
//override
|
//override
|
||||||
function OnMouseProc(MousePos_X, MousePos_Y) {
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
if (!Visible) return;
|
if (!Visible) return;
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ class Yosin_CommonUi extends Yosin_BaseWindow {
|
||||||
|
|
||||||
Localtion_X = 0;
|
Localtion_X = 0;
|
||||||
Localtion_Y = 0;
|
Localtion_Y = 0;
|
||||||
Width = null;
|
|
||||||
Height = null;
|
|
||||||
|
|
||||||
isLBDown = false;
|
isLBDown = false;
|
||||||
//是否悬停
|
//是否悬停
|
||||||
|
|
@ -192,7 +190,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
constructor(X, Y, W, H, Path, Idx) {
|
constructor(X, Y, W, H, Path, Idx) {
|
||||||
base.constructor(X, Y, W, H);
|
base.constructor(X, Y, W, H);
|
||||||
DrawBackground( W, H, Path, Idx);
|
DrawBackground(W, H, Path, Idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -237,7 +235,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
|
|
||||||
// 左边
|
// 左边
|
||||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||||
backgroundLeft.SetPosition(x, y + cornerHeight );
|
backgroundLeft.SetPosition(x, y + cornerHeight);
|
||||||
backgroundLeft.SetScale(1, scaleH);
|
backgroundLeft.SetScale(1, scaleH);
|
||||||
Addchild(backgroundLeft);
|
Addchild(backgroundLeft);
|
||||||
|
|
||||||
|
|
@ -258,7 +256,7 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
||||||
// 下边
|
// 下边
|
||||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||||
backgroundBottom.SetPosition(cornerWidth, height - cornerHeight);
|
backgroundBottom.SetPosition(cornerWidth, height - cornerHeight);
|
||||||
backgroundBottom.SetScale( scaleW , 1);
|
backgroundBottom.SetScale(scaleW, 1);
|
||||||
Addchild(backgroundBottom);
|
Addchild(backgroundBottom);
|
||||||
|
|
||||||
// 右下角
|
// 右下角
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ sqr/User/Stage/TestStage.nut
|
||||||
sqr/User/UI/Widget/InputBox.nut
|
sqr/User/UI/Widget/InputBox.nut
|
||||||
sqr/User/UI/Widget/Drag_Button.nut
|
sqr/User/UI/Widget/Drag_Button.nut
|
||||||
sqr/User/UI/Widget/Scroll_Bar.nut
|
sqr/User/UI/Widget/Scroll_Bar.nut
|
||||||
|
sqr/User/UI/Widget/Text_Button.nut
|
||||||
|
|
||||||
sqr/User/UI/Window/0_Login.nut
|
sqr/User/UI/Window/0_Login.nut
|
||||||
sqr/User/UI/Window/1_Select_Character.nut
|
sqr/User/UI/Window/1_Select_Character.nut
|
||||||
|
|
|
||||||
|
|
@ -53,9 +53,69 @@ class Character_Animation extends Actor {
|
||||||
//光环
|
//光环
|
||||||
AuroraAni = null;
|
AuroraAni = null;
|
||||||
|
|
||||||
|
//名字
|
||||||
|
Name = null;
|
||||||
|
|
||||||
|
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() {
|
constructor() {
|
||||||
base.constructor();
|
base.constructor();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//同步单部位动画
|
//同步单部位动画
|
||||||
|
|
@ -233,6 +293,13 @@ class Character_Animation extends Actor {
|
||||||
|
|
||||||
//初始化
|
//初始化
|
||||||
function Init(SlotType = false) {
|
function Init(SlotType = false) {
|
||||||
|
//初始化Ani
|
||||||
|
InitAni(SlotType);
|
||||||
|
//初始化名字
|
||||||
|
InitName();
|
||||||
|
}
|
||||||
|
|
||||||
|
function InitAni(SlotType) {
|
||||||
//读取并设置 等待Ani
|
//读取并设置 等待Ani
|
||||||
ReadAndSetAni("WaitingAni", "waiting motion", SlotType);
|
ReadAndSetAni("WaitingAni", "waiting motion", SlotType);
|
||||||
//读取并设置 移动Ani
|
//读取并设置 移动Ani
|
||||||
|
|
@ -299,6 +366,23 @@ class Character_Animation extends Actor {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//初始化名字
|
||||||
|
function InitName() {
|
||||||
|
//创建名字对象
|
||||||
|
Name = FontAssetManager.GenerateNormal("", false, {
|
||||||
|
color = sq_RGBA(209, 185, 148, 255),
|
||||||
|
alignment = TextAlign.Center
|
||||||
|
});
|
||||||
|
Name.SetPosition(ENUM_RINDRO_JOB_TITLE_HEIGHT[Parent.Job]);
|
||||||
|
Name.SetZOrder(80000);
|
||||||
|
Addchild(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设置名字
|
||||||
|
function SetName(Name) {
|
||||||
|
this.Name.SetText(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
//设置Ani
|
//设置Ani
|
||||||
function SetAnimation(Ani) {
|
function SetAnimation(Ani) {
|
||||||
|
|
|
||||||
|
|
@ -24,10 +24,18 @@ class GameObject.Character extends GameObject.ActiveObject {
|
||||||
//属性对象
|
//属性对象
|
||||||
Attribute = null;
|
Attribute = null;
|
||||||
|
|
||||||
|
//名字
|
||||||
|
Name = "无名字";
|
||||||
|
|
||||||
|
//职业编号
|
||||||
|
Job = 0;
|
||||||
|
|
||||||
|
|
||||||
function Init(Idx) {
|
function Init(Idx) {
|
||||||
//初始化动画组
|
//初始化动画组
|
||||||
CurrentAni = [];
|
CurrentAni = [];
|
||||||
|
//设置职业编号
|
||||||
|
this.Job = Idx;
|
||||||
//获取角色职业信息
|
//获取角色职业信息
|
||||||
Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
Info = sq_DeepCopy(AssetManager.CharacterInfoList[Idx]);
|
||||||
base.Init(Info);
|
base.Init(Info);
|
||||||
|
|
@ -111,6 +119,13 @@ class GameObject.Character extends GameObject.ActiveObject {
|
||||||
ChangeEquipment(Equ);
|
ChangeEquipment(Equ);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//设置名字
|
||||||
|
function SetName(Name) {
|
||||||
|
this.Name = Name;
|
||||||
|
AnimationManager.SetName(Name);
|
||||||
|
base.SetName(Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//通过职业和装备列表来构造一个角色
|
//通过职业和装备列表来构造一个角色
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ function TestStage() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
// local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -51,27 +51,51 @@ function TestStage() {
|
||||||
// MapObj.Addchild(Charc);
|
// MapObj.Addchild(Charc);
|
||||||
|
|
||||||
|
|
||||||
// local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||||
// local T = {
|
local T = {
|
||||||
// loginImg = 1,
|
loginImg = 1,
|
||||||
// charac = [{
|
charac = [{
|
||||||
// job = 0,
|
lv = 90,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
name = "测试角色1",
|
||||||
// }, {
|
job = 0,
|
||||||
// job = 0,
|
equip = [101020001, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
}, {
|
||||||
// }, {
|
lv = 90,
|
||||||
// job = 0,
|
name = "测试角色2",
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
job = 0,
|
||||||
// }, {
|
equip = [101020023, 601500059, 601550059, 601560057, 601570052, 601520051, 601500059, 601510058, 601530050, 601540059, 601580022, 609590003]
|
||||||
// job = 0,
|
}, {
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
lv = 90,
|
||||||
// }, {
|
name = "测试角色3",
|
||||||
// job = 0,
|
job = 0,
|
||||||
// equip = [601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]
|
equip = [101020026, 601500058, 601550058, 601560056, 601570051, 601520050, 601500058, 601510057, 601530049, 601540058, 601580021, 609590003]
|
||||||
// }]
|
}, {
|
||||||
// };
|
lv = 90,
|
||||||
// Window.Init(T);
|
name = "测试角色4",
|
||||||
|
job = 0,
|
||||||
|
equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
|
||||||
|
}, {
|
||||||
|
lv = 90,
|
||||||
|
name = "测试角色5",
|
||||||
|
job = 0,
|
||||||
|
equip = [601020007, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023, 609590003]
|
||||||
|
}]
|
||||||
|
};
|
||||||
|
Window.Init(T);
|
||||||
|
|
||||||
|
// local Actorobj = Actor();
|
||||||
|
// Actorobj.ShowBorder(true);
|
||||||
|
// Actorobj.SetSize(1500, 100);
|
||||||
|
// local Name = FontAssetManager.GenerateNormal("是的呢参加考试你打", true, {
|
||||||
|
// color = sq_RGBA(209, 185, 148, 255),
|
||||||
|
// alignment = TextAlign.Center,
|
||||||
|
// wrap_width = 50
|
||||||
|
// });
|
||||||
|
// Name.ShowBorder(true);
|
||||||
|
// Name.SetSize(1500, 100);
|
||||||
|
// Name.SetPosition(200, 200);
|
||||||
|
// Actorobj.Addchild(Name);
|
||||||
|
// T.Addchild(Actorobj);
|
||||||
|
|
||||||
// print(ObjectCount);
|
// print(ObjectCount);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,8 @@ class _Login_Window extends Yosin_Window {
|
||||||
local value = Blob.readn('i');
|
local value = Blob.readn('i');
|
||||||
info.equip.append(value);
|
info.equip.append(value);
|
||||||
}
|
}
|
||||||
|
// print(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
//关闭登录界面
|
//关闭登录界面
|
||||||
NoticeBox.CloseWindow();
|
NoticeBox.CloseWindow();
|
||||||
CloseWindow();
|
CloseWindow();
|
||||||
|
|
|
||||||
|
|
@ -153,31 +153,158 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
||||||
IsIndependent = false;
|
IsIndependent = false;
|
||||||
|
|
||||||
Info = null;
|
Info = null;
|
||||||
|
Idx = null;
|
||||||
|
|
||||||
|
//悬停框
|
||||||
|
RectMask = null;
|
||||||
|
//选中框
|
||||||
|
SelectMask = null;
|
||||||
|
//选中状态
|
||||||
|
SelectFlag = false;
|
||||||
|
|
||||||
|
//鼠标相对位置
|
||||||
|
M_Xpos = null;
|
||||||
|
M_Ypos = null;
|
||||||
|
//移动Flag
|
||||||
|
MoveFlag = false;
|
||||||
|
//鼠标移动位置
|
||||||
|
M_Move_Xpos = 0;
|
||||||
|
M_Move_Ypos = 0;
|
||||||
|
|
||||||
|
|
||||||
constructor(gX, gY, gWidth, gHeight) {
|
constructor(gX, gY, gWidth, gHeight) {
|
||||||
base.constructor(gX, gY, gWidth, gHeight);
|
base.constructor(gX, gY, gWidth, gHeight);
|
||||||
RegisterDraw();
|
RegisterDraw();
|
||||||
|
|
||||||
|
// OpenDeBug();
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init(Info) {
|
function Init(Info, Idx) {
|
||||||
this.Info = Info;
|
this.Info = Info;
|
||||||
|
this.Idx = Idx;
|
||||||
RegisterCharac();
|
RegisterCharac();
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterDraw() {
|
function RegisterDraw() {
|
||||||
|
//魔法阵
|
||||||
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
||||||
|
Magic.SetPosition(3, 136);
|
||||||
Addchild(Magic);
|
Addchild(Magic);
|
||||||
|
|
||||||
|
//悬停框
|
||||||
|
RectMask = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 1);
|
||||||
|
RectMask.SetMode(0);
|
||||||
|
RectMask.SetPosition(3, 0);
|
||||||
|
RectMask.SetVisible(false);
|
||||||
|
Addchild(RectMask);
|
||||||
|
|
||||||
|
//选中框
|
||||||
|
SelectMask = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 1);
|
||||||
|
SelectMask.SetMode(0);
|
||||||
|
SelectMask.SetPosition(3, 0);
|
||||||
|
SelectMask.SetVisible(false);
|
||||||
|
Addchild(SelectMask);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function RegisterCharac() {
|
function RegisterCharac() {
|
||||||
local Charc = GameObject.CreateCharacter(Info.job, Info.equip);
|
local Charc = GameObject.CreateCharacter(Info.job, Info.equip);
|
||||||
Charc.SetAnimation("RestAni");
|
Charc.SetAnimation("RestAni");
|
||||||
Charc.SetPosition(48, 12, 0);
|
Charc.SetPosition(64, 156, 0);
|
||||||
|
Charc.SetName(Info.lv + "级 " + Info.name);
|
||||||
|
Charc.AnimationManager.Name.MoveBy(0, 180);
|
||||||
Addchild(Charc);
|
Addchild(Charc);
|
||||||
// print(Charc.AnimationManager.Children.len());
|
// print(Charc.AnimationManager.Children.len());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function SetIdxPosition(Idx) {
|
||||||
|
this.Idx = Idx;
|
||||||
|
SetPosition(184 + (Idx * 142), ((Idx % 2) ? 13 : 0) + 93)
|
||||||
|
SelectMask.SetVisible(false);
|
||||||
|
SelectFlag = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标事件回调
|
||||||
|
function OnMouseProc(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseProc(MousePos_X, MousePos_Y);
|
||||||
|
if (isInRect) {
|
||||||
|
RectMask.SetVisible(true);
|
||||||
|
} else {
|
||||||
|
RectMask.SetVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
//设定拖动逻辑
|
||||||
|
if (MoveFlag) {
|
||||||
|
M_Move_Xpos = B_X - (M_Xpos - MousePos_X);
|
||||||
|
M_Move_Ypos = B_Y - (M_Ypos - MousePos_Y);
|
||||||
|
//左键拖动
|
||||||
|
SetPosition(M_Move_Xpos, M_Move_Ypos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键单击回调
|
||||||
|
function OnMouseLbClick(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseLbClick(MousePos_X, MousePos_Y);
|
||||||
|
if (isInRect) {
|
||||||
|
//遍历父对象中的所有按钮 还原其他按钮
|
||||||
|
foreach(Button in Parent.UpCharacterList) {
|
||||||
|
Button.SelectMask.SetVisible(false);
|
||||||
|
Button.SelectFlag = false;
|
||||||
|
}
|
||||||
|
//设置自身选中状态
|
||||||
|
SelectMask.SetVisible(true);
|
||||||
|
SelectFlag = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键按下回调
|
||||||
|
function OnMouseLbDown(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseLbDown(MousePos_X, MousePos_Y);
|
||||||
|
if (isInRect) {
|
||||||
|
MoveFlag = true;
|
||||||
|
M_Xpos = MousePos_X; //原始鼠标位置数据
|
||||||
|
M_Ypos = MousePos_Y;
|
||||||
|
B_X = X; //原始窗口位置
|
||||||
|
B_Y = Y;
|
||||||
|
SetZOrder(100000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//override
|
||||||
|
//鼠标左键弹起回调
|
||||||
|
function OnMouseLbUp(MousePos_X, MousePos_Y) {
|
||||||
|
base.OnMouseLbUp(MousePos_X, MousePos_Y);
|
||||||
|
if (MoveFlag) {
|
||||||
|
|
||||||
|
MoveFlag = false;
|
||||||
|
M_Xpos = null;
|
||||||
|
M_Ypos = null;
|
||||||
|
B_X = null;
|
||||||
|
B_Y = null;
|
||||||
|
|
||||||
|
//有移动才走替换位置逻辑
|
||||||
|
if (M_Move_Xpos != 0 || M_Move_Ypos != 0) {
|
||||||
|
//遍历父对象中的所有按钮 还原其他按钮
|
||||||
|
foreach(Button in Parent.UpCharacterList) {
|
||||||
|
if (Button.isInRect) {
|
||||||
|
//记录自身原本位置
|
||||||
|
local OldIdx = this.Idx;
|
||||||
|
//设置自身到达位置
|
||||||
|
SetIdxPosition(Button.Idx);
|
||||||
|
//设置对方的位置
|
||||||
|
Button.SetIdxPosition(OldIdx);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
M_Move_Xpos = M_Move_Ypos = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _Select_Character_Window extends Yosin_Window {
|
class _Select_Character_Window extends Yosin_Window {
|
||||||
//调试模式
|
//调试模式
|
||||||
// DeBugMode = true;
|
// DeBugMode = true;
|
||||||
|
|
@ -198,12 +325,16 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
//角色遮罩栏
|
//角色遮罩栏
|
||||||
CharacterMaskBox = null;
|
CharacterMaskBox = null;
|
||||||
|
|
||||||
|
//上排角色对象
|
||||||
|
UpCharacterList = null;
|
||||||
|
|
||||||
//信息
|
//信息
|
||||||
Info = null;
|
Info = null;
|
||||||
|
|
||||||
|
|
||||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||||
|
UpCharacterList = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
function Init(gInfo) {
|
function Init(gInfo) {
|
||||||
|
|
@ -243,8 +374,16 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
|
|
||||||
//角色对象
|
//角色对象
|
||||||
for (local i = 0; i< 5; i++) {
|
for (local i = 0; i< 5; i++) {
|
||||||
local Buf = _Select_Character_Chr(190 + (i * 144), ((i % 2) ? 15 : 0) + 225, 126, 208);
|
//选中框
|
||||||
if (i< Info.charac.len()) Buf.Init(Info.charac[i]);
|
local CharBg = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 4);
|
||||||
|
CharBg.SetMode(0);
|
||||||
|
CharBg.SetPosition(184 + (i * 142) + 3, ((i % 2) ? 13 : 0) + 93);
|
||||||
|
CharBg.SetZOrder(-10);
|
||||||
|
Addchild(CharBg);
|
||||||
|
|
||||||
|
local Buf = _Select_Character_Chr(184 + (i * 142), ((i % 2) ? 13 : 0) + 93, 132, 208);
|
||||||
|
if (i< Info.charac.len()) Buf.Init(Info.charac[i], i);
|
||||||
|
UpCharacterList.push(Buf);
|
||||||
AddUIChild(Buf);
|
AddUIChild(Buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -257,20 +396,84 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
SettingBackgroundWindow.SetVisible(!SettingBackgroundWindow.Visible)
|
SettingBackgroundWindow.SetVisible(!SettingBackgroundWindow.Visible)
|
||||||
}.bindenv(this);
|
}.bindenv(this);
|
||||||
AddUIChild(SettingButton);
|
AddUIChild(SettingButton);
|
||||||
//登录按钮文本
|
//背景设置按钮文本
|
||||||
local LoginTextActor = FontAssetManager.GenerateNormal("背景设置", true, {
|
local BgSettingTextActor = FontAssetManager.GenerateNormal("背景设置", true, {
|
||||||
color = sq_RGBA(221, 197, 147, 255)
|
color = sq_RGBA(221, 197, 147, 255)
|
||||||
});
|
});
|
||||||
LoginTextActor.SetPosition(23, 3);
|
BgSettingTextActor.SetPosition(23, 3);
|
||||||
LoginTextActor.SetUpdateFunc(function(Text, Dt) {
|
BgSettingTextActor.SetUpdateFunc(function(Text, Dt) {
|
||||||
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
if (Text.Parent.State == 1 || Text.Parent.State == 2) {
|
||||||
Text.SetFillColor(sq_RGBA(255, 255, 184, 255));
|
Text.SetFillColor(sq_RGBA(255, 255, 184, 255));
|
||||||
} else if (Text.Parent.State == 0) {
|
} else if (Text.Parent.State == 0) {
|
||||||
Text.SetFillColor(sq_RGBA(221, 197, 147, 255));
|
Text.SetFillColor(sq_RGBA(221, 197, 147, 255));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
SettingButton.Addchild(LoginTextActor);
|
SettingButton.Addchild(BgSettingTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//创建角色按钮
|
||||||
|
local CreateButton = Yosin_SplicingButton(316, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//创建角色按钮文本
|
||||||
|
local CreateTextActor = FontAssetManager.GenerateNormal("创建角色", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
AddUIChild(CreateButton);
|
||||||
|
CreateTextActor.SetPosition(6, 5);
|
||||||
|
CreateTextActor.SetZOrder(100000);
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
CreateButton.Addchild(CreateTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//删除角色按钮
|
||||||
|
local DeleteButton = Yosin_SplicingButton(384, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//删除角色按钮文本
|
||||||
|
local DeleteTextActor = FontAssetManager.GenerateNormal(" 删除", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
AddUIChild(DeleteButton);
|
||||||
|
DeleteTextActor.SetPosition(6, 5);
|
||||||
|
DeleteTextActor.SetZOrder(100000);
|
||||||
|
DeleteTextActor.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));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
DeleteButton.Addchild(DeleteTextActor);
|
||||||
|
|
||||||
|
//结束游戏按钮
|
||||||
|
local CloseButton = Yosin_SplicingButton(702, 560, 59, 24 "sprite/interface/lenheartwindowcommon.img", 172, true, false);
|
||||||
|
//结束游戏按钮文本
|
||||||
|
local CloseTextActor = FontAssetManager.GenerateNormal("结束游戏", false, {
|
||||||
|
color = sq_RGBA(186, 147, 97, 255)
|
||||||
|
});
|
||||||
|
AddUIChild(CloseButton);
|
||||||
|
CloseTextActor.SetPosition(6, 5);
|
||||||
|
CloseTextActor.SetZOrder(100000);
|
||||||
|
CloseTextActor.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));
|
||||||
|
}
|
||||||
|
})
|
||||||
|
CloseButton.Addchild(CloseTextActor);
|
||||||
|
|
||||||
|
|
||||||
|
//开始游戏按钮
|
||||||
|
local StartButton = Yosin_BaseButton(475, 546, 118, 47 "sprite/interface2/selectcharacter/selectcharacter.img", 7);
|
||||||
|
//点击事件回调
|
||||||
|
StartButton.OnClick = function(Button) {
|
||||||
|
print(123123123);
|
||||||
|
}.bindenv(this);
|
||||||
|
AddUIChild(StartButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
//切换背景
|
//切换背景
|
||||||
|
|
@ -289,10 +492,23 @@ class _Select_Character_Window extends Yosin_Window {
|
||||||
ChangeBackground(Info.loginImg);
|
ChangeBackground(Info.loginImg);
|
||||||
|
|
||||||
//角色遮罩栏
|
//角色遮罩栏
|
||||||
CharacterMaskBox = Yosin_NineBoxStretch(-4, 330, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
CharacterMaskBox = Yosin_NineBoxStretch(-4, 320, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0);
|
||||||
AddUIChild(CharacterMaskBox);
|
AddUIChild(CharacterMaskBox);
|
||||||
|
|
||||||
|
|
||||||
|
for (local i = 0; i< 7; i++) {
|
||||||
|
//魔法阵
|
||||||
|
local Magic = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 10);
|
||||||
|
Magic.SetPosition(54 + (i * 142), 146);
|
||||||
|
CharacterMaskBox.Addchild(Magic);
|
||||||
|
|
||||||
|
//锁框
|
||||||
|
local LockBox = CL_SpriteObject("sprite/interface2/selectcharacter_ver2/selectcharacter.img", 16);
|
||||||
|
LockBox.SetPosition(54 + (i * 142), 10);
|
||||||
|
CharacterMaskBox.Addchild(LockBox);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,6 @@ function main(args) {
|
||||||
Game.size = [1066, 600];
|
Game.size = [1066, 600];
|
||||||
Game.v_sync = false;
|
Game.v_sync = false;
|
||||||
Game.frame_interval = 10000;
|
Game.frame_interval = 10000;
|
||||||
Game.debug_mode = true;
|
// Game.debug_mode = true;
|
||||||
Game.Run(LoginStage);
|
Game.Run(LoginStage);
|
||||||
}
|
}
|
||||||
|
|
@ -175,5 +175,8 @@
|
||||||
},
|
},
|
||||||
"User/UI/Window/1_Select_Character.nut": {
|
"User/UI/Window/1_Select_Character.nut": {
|
||||||
"description": "选择角色界面"
|
"description": "选择角色界面"
|
||||||
|
},
|
||||||
|
"User/UI/Widget/Text_Button.nut": {
|
||||||
|
"description": "文本按钮"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue