调试角色城镇移动
This commit is contained in:
parent
3e8159c100
commit
9e7cce285a
BIN
Yosin_Engine.exe
BIN
Yosin_Engine.exe
Binary file not shown.
Binary file not shown.
|
|
@ -272,4 +272,14 @@ class CL_BaseObject {
|
|||
function SetRotate(Duration, Rotation) {
|
||||
BaseObject_SetRotate(this.C_Object, Duration, Rotation);
|
||||
}
|
||||
|
||||
//获取右侧的坐标
|
||||
function right() {
|
||||
return X + GetSize().w;
|
||||
}
|
||||
|
||||
//获取底部的坐标
|
||||
function bottom() {
|
||||
return Y + GetSize().h;
|
||||
}
|
||||
}
|
||||
|
|
@ -169,6 +169,20 @@ class Yosin_BaseWindow extends Layer {
|
|||
// gChild.Parent = this;
|
||||
}
|
||||
|
||||
/*
|
||||
* @函数作用: 获取窗口右侧的坐标
|
||||
*/
|
||||
function right() {
|
||||
return X + Width;
|
||||
}
|
||||
|
||||
/*
|
||||
* @函数作用: 获取窗口底部的坐标
|
||||
*/
|
||||
function bottom() {
|
||||
return Y + Height;
|
||||
}
|
||||
|
||||
//开启Debug模式
|
||||
function OpenDeBug() {
|
||||
DeBugSprite = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 257);
|
||||
|
|
|
|||
|
|
@ -161,31 +161,24 @@ class Yosin_EmeStretch extends Yosin_CommonUi {
|
|||
|
||||
//横向
|
||||
if (Direction) {
|
||||
//获取中间部分的宽度
|
||||
local ScaleW = (W - SpriteList[0].GetSize().w - SpriteList[2].GetSize().w);
|
||||
//计算缩放比例
|
||||
local ScaleRate = ScaleW / SpriteList[1].GetSize().w;
|
||||
local ScaleRateH = H / SpriteList[1].GetSize().h;
|
||||
|
||||
//设置位置和缩放
|
||||
SpriteList[1].SetPosition(SpriteList[0].GetSize().w, 0);
|
||||
SpriteList[1].SetScale(ScaleRate, ScaleRateH);
|
||||
|
||||
SpriteList[1].SetScale(ScaleRate, 1.0);
|
||||
SpriteList[2].SetPosition(SpriteList[0].GetSize().w + ScaleW, 0);
|
||||
if (H != SpriteList[1].GetSize().h) {
|
||||
SpriteList[0].SetScale(1, ScaleRateH);
|
||||
SpriteList[2].SetScale(1, ScaleRateH);
|
||||
}
|
||||
}
|
||||
//纵向
|
||||
else {
|
||||
local ScaleH = (H - SpriteList[0].GetSize().h - SpriteList[2].GetSize().h);
|
||||
local ScaleRate = ScaleH / SpriteList[1].GetSize().h;
|
||||
local ScaleRateW = H / SpriteList[1].GetSize().w;
|
||||
|
||||
SpriteList[1].SetPosition(0, SpriteList[0].GetSize().h);
|
||||
SpriteList[1].SetScale(ScaleRateW, ScaleRate);
|
||||
SpriteList[1].SetScale(1.0, ScaleRate);
|
||||
SpriteList[2].SetPosition(0, SpriteList[0].GetSize().h + ScaleH);
|
||||
if (W != SpriteList[1].GetSize().w) {
|
||||
SpriteList[0].SetScale(ScaleRateW, ScaleRateH);
|
||||
SpriteList[2].SetScale(ScaleRateW, ScaleRateH);
|
||||
}
|
||||
}
|
||||
|
||||
foreach(Child in SpriteList) {
|
||||
|
|
@ -209,71 +202,79 @@ class Yosin_NineBoxStretch extends Yosin_CommonUi {
|
|||
// 绘制
|
||||
function DrawBackground(width, height, path, imgId) {
|
||||
|
||||
local x = 0;
|
||||
local y = 0;
|
||||
|
||||
// 左上角
|
||||
local backgroundTopLeft = CL_SpriteObject(path, imgId);
|
||||
backgroundTopLeft.SetPosition(x, y);
|
||||
Addchild(backgroundTopLeft);
|
||||
// 左上角图片大小
|
||||
local cornerImgSize = backgroundTopLeft.GetSize();
|
||||
local cornerWidth = cornerImgSize.w;
|
||||
local cornerHeight = cornerImgSize.h;
|
||||
|
||||
// 中间
|
||||
local backgroundCenter = CL_SpriteObject(path, imgId + 4);
|
||||
backgroundCenter.SetPosition(cornerWidth, y + cornerHeight);
|
||||
Addchild(backgroundCenter);
|
||||
// 中间图片大小
|
||||
local centerImgSize = backgroundCenter.GetSize();
|
||||
local centerWidth = centerImgSize.w;
|
||||
local centerHeight = centerImgSize.h;
|
||||
|
||||
|
||||
local scaleW = (width.tofloat() - cornerWidth.tofloat() * 2.0) / centerWidth.tofloat();
|
||||
local scaleH = (height.tofloat() - y.tofloat() - cornerHeight.tofloat()) / centerHeight.tofloat();
|
||||
|
||||
// 上边
|
||||
local backgroundTop = CL_SpriteObject(path, imgId + 1);
|
||||
backgroundTop.SetPosition(cornerWidth, y);
|
||||
// 右上角
|
||||
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);
|
||||
|
||||
|
||||
// 左上角
|
||||
backgroundTopLeft.SetPosition(0, 0);
|
||||
Addchild(backgroundTopLeft);
|
||||
|
||||
// 中间图片大小
|
||||
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.SetPosition(backgroundTopLeft.right() + 1, 0);
|
||||
backgroundTop.SetScale(scaleW, 1);
|
||||
Addchild(backgroundTop);
|
||||
|
||||
// 右上角
|
||||
local backgroundTopRight = CL_SpriteObject(path, imgId + 2);
|
||||
backgroundTopRight.SetPosition(width - cornerWidth, y);
|
||||
backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0);
|
||||
Addchild(backgroundTopRight);
|
||||
|
||||
// 左边
|
||||
local backgroundLeft = CL_SpriteObject(path, imgId + 3);
|
||||
backgroundLeft.SetPosition(x, y + cornerHeight);
|
||||
backgroundLeft.SetPosition(0, backgroundTopLeft.bottom() + 1);
|
||||
backgroundLeft.SetScale(1, scaleH);
|
||||
Addchild(backgroundLeft);
|
||||
|
||||
// 中间
|
||||
backgroundCenter.SetPosition(backgroundLeft.right() + 1, backgroundLeft.Y);
|
||||
backgroundCenter.SetScale(scaleW, scaleH);
|
||||
Addchild(backgroundCenter);
|
||||
|
||||
// 右边
|
||||
local backgroundRight = CL_SpriteObject(path, imgId + 5);
|
||||
backgroundRight.SetPosition(width - cornerWidth, y + cornerHeight);
|
||||
backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y);
|
||||
backgroundRight.SetScale(1, scaleH);
|
||||
Addchild(backgroundRight);
|
||||
|
||||
// 左下角
|
||||
local backgroundBottomLeft = CL_SpriteObject(path, imgId + 6);
|
||||
backgroundBottomLeft.SetPosition(x, height - cornerHeight);
|
||||
backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h);
|
||||
Addchild(backgroundBottomLeft);
|
||||
|
||||
// 下边
|
||||
local backgroundBottom = CL_SpriteObject(path, imgId + 7);
|
||||
backgroundBottom.SetPosition(cornerWidth, height - cornerHeight);
|
||||
backgroundBottom.SetPosition(backgroundBottomLeft.right() + 1, backgroundBottomLeft.Y);
|
||||
backgroundBottom.SetScale(scaleW, 1);
|
||||
Addchild(backgroundBottom);
|
||||
|
||||
// 右下角
|
||||
local backgroundBottomRight = CL_SpriteObject(path, imgId + 8);
|
||||
backgroundBottomRight.SetPosition(width - cornerWidth, height - cornerHeight);
|
||||
backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y);
|
||||
Addchild(backgroundBottomRight);
|
||||
|
||||
}
|
||||
|
|
@ -309,7 +310,7 @@ class Yosin_SplicingButton extends Yosin_CommonUi {
|
|||
//悬停态
|
||||
SpriteList[1] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 4 : 3), Direction);
|
||||
//按下态
|
||||
SpriteList[2] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 8 : 3), Direction);
|
||||
SpriteList[2] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + (UnavailableFlag ? 8 : 6), Direction);
|
||||
if (UnavailableFlag) {
|
||||
//不可用态
|
||||
SpriteList[3] = Yosin_EmeStretch(0, 0, W, H, Path, Idx + 12, Direction);
|
||||
|
|
@ -357,4 +358,243 @@ class Yosin_SplicingButton extends Yosin_CommonUi {
|
|||
}
|
||||
ChangeFrame();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 窗口顶部标题
|
||||
class Yosin_TopTitle extends Yosin_CommonUi {
|
||||
|
||||
constructor(W, H, title, drawBackground = true) {
|
||||
base.constructor(0, 0, W, H);
|
||||
|
||||
//内容背景
|
||||
if (drawBackground) {
|
||||
local background = Yosin_NineBoxStretch(-1, 15, W + 1, H - 15, "sprite/interface/lenheartwindowcommon.img", 97);
|
||||
AddUIChild(background);
|
||||
}
|
||||
|
||||
// 标题背景
|
||||
local Background = Yosin_EmeStretch(0, 0, W, 22, "sprite/interface/lenheartwindowcommon.img", 609);
|
||||
Addchild(Background);
|
||||
|
||||
// 标题亮色背景
|
||||
local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483);
|
||||
local scaleW = (W / BackgroundBright.GetSize().w).tofloat();
|
||||
BackgroundBright.SetScale(scaleW, 1);
|
||||
Addchild(BackgroundBright);
|
||||
|
||||
|
||||
// 标题
|
||||
local titleTextActor = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = sq_RGBA(206, 189, 140, 255)
|
||||
});
|
||||
local titleX = W / 2 - titleTextActor.GetSize().w / 2;
|
||||
// 绘制标题
|
||||
titleTextActor.SetPosition(titleX, 2);
|
||||
Addchild(titleTextActor);
|
||||
|
||||
local closeBtn = Yosin_BaseButton(W - 20, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544);
|
||||
closeBtn.DownSimulateOffset = false;
|
||||
closeBtn.OnClick = function(btn) {
|
||||
|
||||
}
|
||||
AddUIChild(closeBtn);
|
||||
|
||||
local topBtn = Yosin_BaseButton(W - 40, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455);
|
||||
topBtn.DownSimulateOffset = false;
|
||||
topBtn.OnClick = function(btn) {
|
||||
|
||||
}
|
||||
AddUIChild(topBtn);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 标题按钮
|
||||
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 -= 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 (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_SplicingButton {
|
||||
|
||||
index = null;
|
||||
select = false;
|
||||
cacheSelect = false;
|
||||
LBDownOnClick = null;
|
||||
|
||||
titleText = null;
|
||||
|
||||
constructor(X, Y, W, H, Path, Idx, title, ) {
|
||||
base.constructor(X, Y, W, H, Path, Idx, true, false)
|
||||
|
||||
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(9, 2);
|
||||
Addchild(titleText);
|
||||
|
||||
}
|
||||
|
||||
function Proc(Dt) {
|
||||
if (select) return;
|
||||
|
||||
if (State != 3 && isLBDown) {
|
||||
State = 2;
|
||||
select = true;
|
||||
if (LBDownOnClick != null) {
|
||||
LBDownOnClick(this);
|
||||
}
|
||||
}
|
||||
if (State == 2) {
|
||||
Y -= 1;
|
||||
SyncPos(X, Y);
|
||||
} else if (SpriteState == 2) {
|
||||
Y += 1;
|
||||
SyncPos(X, Y);
|
||||
}
|
||||
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 横向多个标题单选按钮
|
||||
class Yosin_RowMoreTitleBtn extends Yosin_CommonUi {
|
||||
|
||||
LBDownOnClick = null;
|
||||
btns = [];
|
||||
tests = [];
|
||||
|
||||
constructor(X, Y, titles, baseWidth = 44, path = "sprite/interface/lenheartwindowcommon.img", idx = 160) {
|
||||
this.tests = titles;
|
||||
local btnX = 0;
|
||||
for (local i = 0; i< titles.len(); i++) {
|
||||
|
||||
local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 20;
|
||||
local btnW = baseWidth + 20;
|
||||
btnW = textW > btnW ? textW : btnW;
|
||||
|
||||
local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]);
|
||||
titleBtn.index = i;
|
||||
|
||||
titleBtn.LBDownOnClick = function(btn) {
|
||||
btn.Parent.LBDownOnClick(this, btn.index);
|
||||
|
||||
for (local i = 0; i< btn.Parent.btns.len(); i++) {
|
||||
btn.Parent.btns[i].select = false;
|
||||
btn.Parent.btns[i].titleText.SetFillColor(sq_RGBA(130, 114, 84, 255));
|
||||
}
|
||||
|
||||
btn.select = true;
|
||||
btn.Parent.btns[btn.index].titleText.SetFillColor(sq_RGBA(187, 176, 149, 255));
|
||||
|
||||
};
|
||||
|
||||
btns.push(titleBtn);
|
||||
btnX += btnW + 1;
|
||||
}
|
||||
|
||||
base.constructor(X, Y, btnX, 21);
|
||||
|
||||
for (local i = 0; i< btns.len(); i++) {
|
||||
AddUIChild(btns[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -69,6 +69,7 @@ l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectCla
|
|||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Object\ActiveObject\CharacterObjectClass_AI.nut
|
||||
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Socket\Socket.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Socket\Packet.nut
|
||||
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Stage\LodingStage.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\Stage\TestStage.nut
|
||||
|
|
@ -83,6 +84,8 @@ l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\0_Login.nut
|
|||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\1_Select_Character.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\2_create_Character.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\3_Top_tool.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\4_PersonalInfo.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\5_Inventory.nut
|
||||
l:\Yosin_Engine\Yosin&Kiwano_DOF\sqr\User\UI\Window\233_HUD_Message.nut
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ class GameObject.Character extends GameObject.ActiveObject {
|
|||
|
||||
//职业编号
|
||||
Job = 0;
|
||||
//cid
|
||||
Cid = -1;
|
||||
|
||||
//控制器
|
||||
Controller = null;
|
||||
|
|
|
|||
|
|
@ -281,6 +281,18 @@ class Map extends Actor {
|
|||
m_data.npc = Arr;
|
||||
}
|
||||
|
||||
//添加角色的回包
|
||||
function AddCharacterCallBack(Binary) {
|
||||
local Pack = Packet(Binary);
|
||||
|
||||
/*
|
||||
local Charc = GameObject.CreateCharacter(Info.job, Info.equ);
|
||||
local NPCobj = GameObject.NPC(info.id);
|
||||
NPCobj.SetDirection(info.direction);
|
||||
NPCobj.SetPosition(info.xpos, info.ypos, info.zpos);
|
||||
|
||||
*/
|
||||
}
|
||||
|
||||
//添加对象
|
||||
function AddObject(obj, IsPlayer = false) {
|
||||
|
|
@ -307,42 +319,19 @@ class Map extends Actor {
|
|||
}
|
||||
}
|
||||
|
||||
//移动城镇的回包
|
||||
function MoveTownCallBack(Jso) {
|
||||
//我自己的移动城镇添加角色对象
|
||||
local MapObj = GlobalTownManager.TownList[Jso.town].map[Jso.region];
|
||||
MapObj.AddObjectByChangeTown(ClientCharacter, Jso.pos);
|
||||
}
|
||||
|
||||
//移动城镇的添加对象
|
||||
function AddObjectByChangeTown(obj, FromMapobj) {
|
||||
function AddObjectByChangeTown(obj, pos) {
|
||||
//角色对象
|
||||
if (typeof obj == "character") {
|
||||
//如果已经处于某个地图中
|
||||
if (obj.Parent) {
|
||||
obj.Parent.Removechild(obj);
|
||||
}
|
||||
LayerObject.normal.Addchild(obj);
|
||||
//将地图信息写入角色中
|
||||
obj.MySelfMap = this.weakref();
|
||||
//绑定摄像机
|
||||
m_camera.SetFromParent(obj);
|
||||
//获取应该设置的坐标
|
||||
foreach(index, info in m_data.town_movable_area_info) {
|
||||
if (info.town == FromMapobj.m_town && info.area == FromMapobj.m_mapId) {
|
||||
local pos = {
|
||||
x = m_data.town_movable_area[index * 4] + m_data.town_movable_area[index * 4 + 2] / 2,
|
||||
y = m_data.town_movable_area[index * 4 + 1] + m_data.town_movable_area[index * 4 + 3] / 2,
|
||||
z = 0
|
||||
}
|
||||
obj.SetPosition(pos);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//获取当前场景
|
||||
local Stage = sq_GetCurrentStage();
|
||||
if (GlobalTownManager.CurrentTown) {
|
||||
Stage.Removechild(GlobalTownManager.CurrentTown);
|
||||
}
|
||||
Stage.Addchild(this);
|
||||
//添加全局
|
||||
GlobalTownManager.CurrentTown = this.weakref();
|
||||
|
||||
|
||||
//角色原城镇
|
||||
local FromMapobj = obj.MySelfMap;
|
||||
//背景音乐处理
|
||||
BackGroundMusic = {};
|
||||
if (FromMapobj.BackGroundMusic != null) {
|
||||
|
|
@ -366,6 +355,28 @@ class Map extends Actor {
|
|||
}
|
||||
}
|
||||
}
|
||||
//绑定摄像机
|
||||
m_camera.SetFromParent(obj);
|
||||
//获取当前场景
|
||||
local Stage = sq_GetCurrentStage();
|
||||
if (GlobalTownManager.CurrentTown) {
|
||||
Stage.Removechild(GlobalTownManager.CurrentTown);
|
||||
}
|
||||
Stage.Addchild(this);
|
||||
//添加全局
|
||||
GlobalTownManager.CurrentTown = this.weakref();
|
||||
|
||||
|
||||
//如果已经处于某个地图中 则先移除
|
||||
if (obj.Parent) {
|
||||
obj.Parent.Removechild(obj);
|
||||
}
|
||||
//将角色添加到地图的normal图层
|
||||
LayerObject.normal.Addchild(obj);
|
||||
//设置坐标
|
||||
obj.SetPosition(pos);
|
||||
//将地图信息写入角色中
|
||||
obj.MySelfMap = this.weakref();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -402,6 +413,10 @@ class Map extends Actor {
|
|||
m_camera.BackgroundOffset = m_data.background_pos;
|
||||
|
||||
// OpenMovableAreaBorder();
|
||||
|
||||
|
||||
MySocket.RegisterHandler(PACKET_ID.CHANGE_TOWN_AREA_CALLBACK, MoveTownCallBack.bindenv(this));
|
||||
MySocket.RegisterBinaryHandler(PACKET_ID.TOWN_ADD_CHARACTER_CALLBACK, AddCharacterCallBack.bindenv(this));
|
||||
}
|
||||
|
||||
//DEBUG方法
|
||||
|
|
@ -477,13 +492,33 @@ class Map extends Actor {
|
|||
//走进了传送阵
|
||||
if (Index != -1) {
|
||||
if (!obj.TransmitFlag) {
|
||||
//得到传送信息 目标城镇
|
||||
local info = m_data.town_movable_area_info[Index];
|
||||
//这里是未加载的城镇
|
||||
//如果是未加载的城镇 则先构造城镇
|
||||
if (!(GlobalTownManager.TownList.rawin(info.town))) {
|
||||
Town(info.town);
|
||||
}
|
||||
//计算位移过去以后应该设置的位置
|
||||
local MapObj = GlobalTownManager.TownList[info.town].map[info.area];
|
||||
MapObj.AddObjectByChangeTown(obj, this);
|
||||
local movepos = {
|
||||
z = 0
|
||||
};
|
||||
//遍历目标城镇的该区域 查找适当位移位置
|
||||
foreach(index, mapinfo in MapObj.m_data.town_movable_area_info) {
|
||||
if (mapinfo.town == m_town && mapinfo.area == m_mapId) {
|
||||
movepos.x <- MapObj.m_data.town_movable_area[index * 4] + MapObj.m_data.town_movable_area[index * 4 + 2] / 2;
|
||||
movepos.y <- MapObj.m_data.town_movable_area[index * 4 + 1] + MapObj.m_data.town_movable_area[index * 4 + 3] / 2;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//发包移动城镇
|
||||
MySocket.Send(PACKET_ID.CHANGE_TOWN_AREA, {
|
||||
town = info.town,
|
||||
region = info.area,
|
||||
pos = movepos
|
||||
})
|
||||
|
||||
obj.TransmitFlag = true;
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
文件名:Packet.nut
|
||||
路径:User/Socket/Packet.nut
|
||||
创建日期:2025-01-04 22:20
|
||||
文件用途:数据封包类
|
||||
*/
|
||||
class Packet {
|
||||
Data = null;
|
||||
|
||||
constructor(...) {
|
||||
//不传参数时,构造空包
|
||||
if (vargv.len() == 0) {
|
||||
this.Data = blob();
|
||||
}
|
||||
//传入数据流以流的形式构造包
|
||||
else {
|
||||
this.Data = vargv[0];
|
||||
}
|
||||
}
|
||||
|
||||
//字节
|
||||
function Put_Byte(Value) {
|
||||
this.Data.writen('c', Value);
|
||||
}
|
||||
|
||||
//短整型
|
||||
function Put_Short(Value) {
|
||||
this.Data.writen('s', Value);
|
||||
}
|
||||
|
||||
//整型
|
||||
function Put_Int(Value) {
|
||||
this.Data.writen('i', Value);
|
||||
}
|
||||
|
||||
//浮点型
|
||||
function Put_Float(Value) {
|
||||
this.Data.writen('f', Value);
|
||||
}
|
||||
|
||||
//字符串
|
||||
function Put_String(String) {
|
||||
foreach(char in String) {
|
||||
Put_Byte(char);
|
||||
}
|
||||
}
|
||||
|
||||
//字节数组
|
||||
function Put_Binary(BinaryArray) {
|
||||
//流
|
||||
if (typeof BinaryArray == "blob") {
|
||||
this.Data.writeblob(BinaryArray);
|
||||
}
|
||||
//数组
|
||||
else if (typeof BinaryArray == "array") {
|
||||
foreach(byte in BinaryArray) {
|
||||
Put_Byte(byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取字节
|
||||
function Get_Byte() {
|
||||
return this.Data.readn('c');
|
||||
}
|
||||
|
||||
//获取短整型
|
||||
function Get_Short() {
|
||||
return this.Data.readn('s');
|
||||
}
|
||||
|
||||
//获取整型
|
||||
function Get_Int() {
|
||||
return this.Data.readn('i');
|
||||
}
|
||||
|
||||
//获取浮点型
|
||||
function Get_Float() {
|
||||
return this.Data.readn('f');
|
||||
}
|
||||
|
||||
//获取字符串
|
||||
function Get_String(len) {
|
||||
return stream_myreadstring(len);
|
||||
}
|
||||
|
||||
//获取字节数组
|
||||
function Get_Binary(len) {
|
||||
return this.Data.readblob(len);
|
||||
}
|
||||
}
|
||||
|
|
@ -41,7 +41,7 @@ function LoginStage() {
|
|||
local T = CL_StageObject();
|
||||
T.SetName("加载界面舞台");
|
||||
|
||||
local AniTime = 800;
|
||||
local AniTime = 1500;
|
||||
|
||||
//大背景
|
||||
local BackGround = CL_SpriteObject("sprite/loding.img", 0);
|
||||
|
|
@ -51,7 +51,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, 800);
|
||||
Kiwano.SetPosition(1066 / 2, 300);
|
||||
Kiwano.SetUpdateFunc(function(sp, dt) {
|
||||
if (!("time" in sp.Var)) sp.Var.time <- 0;
|
||||
sp.Var.time += dt;
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ function TestStage() {
|
|||
|
||||
local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0);
|
||||
|
||||
|
||||
// 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);
|
||||
|
|
@ -54,15 +54,11 @@ function TestStage() {
|
|||
// name = "测试角色",
|
||||
// job = 0,
|
||||
// equip = [101020037, 601500061, 601550061, 601560059, 601570054, 601520053, 601500061, 601510060, 601530052, 601540061, 601580024, 609590003]
|
||||
// }, {
|
||||
// lv = 90,
|
||||
// name = "测试角色2号",
|
||||
// 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);
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ class Yosin_InputBox extends Yosin_CommonUi {
|
|||
Text_Obj = TextActor(0, {
|
||||
color = 0xFFFFFFFF
|
||||
});
|
||||
Text_Obj.SetPosition(4, 3);
|
||||
Text_Obj.SetPosition(4, 1);
|
||||
Addchild(Text_Obj);
|
||||
|
||||
_Imm_Input_Func_.rawset(C_Object, Imm_Input.bindenv(this));
|
||||
|
|
|
|||
|
|
@ -62,7 +62,6 @@ class _Login_Window extends Yosin_Window {
|
|||
local value = Blob.readn('i');
|
||||
info.equip.append(value);
|
||||
}
|
||||
// print(info);
|
||||
}
|
||||
//关闭登录界面
|
||||
NoticeBox.DestroyWindow();
|
||||
|
|
|
|||
|
|
@ -271,6 +271,10 @@ class _Select_Character_Chr extends Yosin_CommonUi {
|
|||
M_Ypos = MousePos_Y;
|
||||
B_X = X; //原始窗口位置
|
||||
B_Y = Y;
|
||||
//遍历父对象中的所有按钮 修改他们的层级
|
||||
foreach(Button in Parent.UpCharacterList) {
|
||||
Button.SetZOrder(99999);
|
||||
}
|
||||
SetZOrder(100000);
|
||||
}
|
||||
}
|
||||
|
|
@ -347,7 +351,19 @@ class _Select_Character_Window extends Yosin_Window {
|
|||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
UpCharacterList = [];
|
||||
//定义五个空数组
|
||||
UpCharacterList = array(5, null);
|
||||
|
||||
|
||||
|
||||
// 选择角色进入游戏回包
|
||||
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);
|
||||
TownObj.AddObject(Charc, true);
|
||||
ClientCharacter = Charc;
|
||||
}.bindenv(this));
|
||||
}
|
||||
|
||||
function Init(gInfo) {
|
||||
|
|
@ -371,6 +387,39 @@ class _Select_Character_Window extends Yosin_Window {
|
|||
if (!BackGroundMusic.IsPlaying()) BackGroundMusic.Play();
|
||||
}
|
||||
|
||||
function AddUpCharacter(CharacInfo, Index = 5) {
|
||||
//先定义为最大值 如果没有查到空位则不会执行逻辑
|
||||
if (Index == 5) {
|
||||
//遍历获取第一个空位 Info为空也为空
|
||||
foreach(pos, value in UpCharacterList) {
|
||||
if (value == null) {
|
||||
Index = pos;
|
||||
break;
|
||||
}
|
||||
//如果是信息为空的 要先删除原来的再添加
|
||||
if (value.Info == null) {
|
||||
Index = pos;
|
||||
RemoveUIChild(UpCharacterList[pos]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (Index >= 5) return;
|
||||
}
|
||||
|
||||
local Buf = _Select_Character_Chr(184 + (Index * 142), ((Index % 2) ? 13 : 0) + 93, 132, 208);
|
||||
//如果有信息则构造角色
|
||||
if (CharacInfo) {
|
||||
//通过信息构造角色
|
||||
Buf.Init(CharacInfo, Index);
|
||||
AddUIChild(Buf);
|
||||
UpCharacterList[Index] = Buf;
|
||||
} else {
|
||||
Buf.Init(null, Index);
|
||||
AddUIChild(Buf);
|
||||
UpCharacterList[Index] = Buf;
|
||||
}
|
||||
}
|
||||
|
||||
function RegisterWindow() {
|
||||
SettingBackgroundWindow = _Select_Character_SettingBackground_Window("选择角色_设置背景图片窗口", 850, 28, 212, 129, 0);
|
||||
AddUIChild(SettingBackgroundWindow);
|
||||
|
|
@ -386,11 +435,8 @@ class _Select_Character_Window extends Yosin_Window {
|
|||
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);
|
||||
else Buf.Init(null, i);
|
||||
UpCharacterList.push(Buf);
|
||||
AddUIChild(Buf);
|
||||
//如果没有足够的信息则传递null
|
||||
AddUpCharacter((Info.charac.len() > i) ? Info.charac[i] : null, i);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -237,6 +237,9 @@ class _CreateCharacter extends Yosin_Window {
|
|||
|
||||
NoticeBox = null;
|
||||
|
||||
//临时创建角色
|
||||
TempCharacter = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
|
|
@ -247,7 +250,7 @@ class _CreateCharacter extends Yosin_Window {
|
|||
|
||||
|
||||
// 创建角色回包
|
||||
MySocket.RegisterHandler(4, function(Jso) {
|
||||
MySocket.RegisterHandler(PACKET_ID.CREATE_CHARACTER_CALLBACK, function(Jso) {
|
||||
if (NoticeBox) NoticeBox.CloseWindow();
|
||||
if (Jso.type == 0) {
|
||||
// 创建成功.
|
||||
|
|
@ -255,6 +258,9 @@ class _CreateCharacter extends Yosin_Window {
|
|||
NoticeBox.DestroyWindow();
|
||||
DestroyWindow();
|
||||
MySocket.Send(PACKET_ID.QUERY_CHARACTER_LIST, null);
|
||||
|
||||
local Window = Sq_CreateWindow(_Select_Character_Window, "选择角色界面窗口", 0, 0, 1066, 600, 0);
|
||||
Window.AddUpCharacter(TempCharacter);
|
||||
} else {
|
||||
// 创建失败.
|
||||
NoticeBox = _Yosin_MessageBox("创建失败.");
|
||||
|
|
@ -263,9 +269,6 @@ class _CreateCharacter extends Yosin_Window {
|
|||
|
||||
}
|
||||
|
||||
function PlayBackgroundMusic() {
|
||||
|
||||
}
|
||||
|
||||
function RegisterDraw() {
|
||||
//大背景
|
||||
|
|
@ -362,10 +365,16 @@ class _CreateCharacter extends Yosin_Window {
|
|||
// 确定
|
||||
enter.OnClick = function(enterName) {
|
||||
local jobEnum = getJobEnum(jobIndex);
|
||||
MySocket.Send(7, {
|
||||
TempCharacter = {
|
||||
lv = 1,
|
||||
name = enterName,
|
||||
job = jobEnum,
|
||||
})
|
||||
equip = []
|
||||
};
|
||||
MySocket.Send(PACKET_ID.CREATE_CHARACTER, {
|
||||
name = enterName,
|
||||
job = jobEnum,
|
||||
});
|
||||
}.bindenv(this);
|
||||
|
||||
}
|
||||
|
|
@ -814,7 +823,7 @@ class _create_Character_enterName extends Yosin_Window {
|
|||
//点击事件回调
|
||||
checkButton.OnClick = function(Button) {
|
||||
|
||||
MySocket.Send(6, {
|
||||
MySocket.Send(PACKET_ID.NICKNAME_REPEAT_CHECK, {
|
||||
name = nameInputBox.str,
|
||||
})
|
||||
|
||||
|
|
@ -877,7 +886,7 @@ class _create_Character_enterName extends Yosin_Window {
|
|||
|
||||
|
||||
// 昵称重复检查回包
|
||||
MySocket.RegisterHandler(3, function(Jso) {
|
||||
MySocket.RegisterHandler(PACKET_ID.NICKNAME_REPEAT_CHECK_CALLBACK, function(Jso) {
|
||||
if (Parent.NoticeBox) Parent.NoticeBox.CloseWindow();
|
||||
if (Jso.type == 0) {
|
||||
// 可以使用的ID 确认按钮可以使用.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,336 @@
|
|||
/*
|
||||
文件名:4_PersonalInfo.nut
|
||||
路径:User/UI/Window/4_PersonalInfo.nut
|
||||
创建日期:2024-12-26 00:32
|
||||
文件用途: 个人信息
|
||||
*/
|
||||
|
||||
// 个人信息 250, 60, 286, 530
|
||||
class _PersonalInfo extends Yosin_Window {
|
||||
|
||||
roleTitleBtn = null;
|
||||
dressUpTitleBtn = null;
|
||||
stoneTitleBtn = null;
|
||||
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
local title = Yosin_TopTitle(gWidth, gHeight, "个人信息(M)");
|
||||
AddUIChild(title);
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
// 角色按钮
|
||||
roleTitleBtn = titleButton(10, 25, 40, 19, "sprite/interface/lenheartwindowcommon.img", 82, "角色");
|
||||
AddUIChild(roleTitleBtn);
|
||||
// 装扮/宠物按钮
|
||||
dressUpTitleBtn = titleButton(roleTitleBtn.right() + 1, 25, 71, 19, "sprite/interface/lenheartwindowcommon.img", 86, "装扮/宠物");
|
||||
AddUIChild(dressUpTitleBtn);
|
||||
// 护石按钮
|
||||
stoneTitleBtn = titleButton(dressUpTitleBtn.right() + 1, 25, 40, 19, "sprite/interface/lenheartwindowcommon.img", 82, "护石");
|
||||
AddUIChild(stoneTitleBtn);
|
||||
|
||||
roleTitleBtn.LBDownOnClick = function (btn) {
|
||||
titleClick(btn);
|
||||
}.bindenv(this);
|
||||
dressUpTitleBtn.LBDownOnClick = function (btn) {
|
||||
titleClick(btn);
|
||||
}.bindenv(this);
|
||||
stoneTitleBtn.LBDownOnClick = function (btn) {
|
||||
titleClick(btn);
|
||||
}.bindenv(this);
|
||||
|
||||
|
||||
|
||||
// 角色信息
|
||||
local roleInfo = roleInfo("个人角色信息", roleTitleBtn.X, roleTitleBtn.bottom() + 2 );
|
||||
AddUIChild(roleInfo);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function titleClick(btn) {
|
||||
btn.Parent.roleTitleBtn.select = false;
|
||||
btn.Parent.dressUpTitleBtn.select = false;
|
||||
btn.Parent.stoneTitleBtn.select = false;
|
||||
btn.select = true;
|
||||
}
|
||||
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 角色信息
|
||||
class roleInfo extends Yosin_Window {
|
||||
|
||||
//是否为独立窗口
|
||||
IsIndependent = false;
|
||||
|
||||
brown = sq_RGBA(160, 132, 75, 255);
|
||||
green = sq_RGBA(74, 161, 87, 255);
|
||||
|
||||
btn = null;
|
||||
|
||||
constructor(gObjectId, gX, gY) {
|
||||
base.constructor(gObjectId, gX, gY, 266, 355, 0);
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
// 背景
|
||||
local backGround = CL_SpriteObject("sprite/interface2/profile/profile.img", 60);
|
||||
Addchild(backGround);
|
||||
|
||||
// 装备
|
||||
RegisterEquipment();
|
||||
// 名称 等级 其他
|
||||
RegisterNameAndOther();
|
||||
// 属性
|
||||
RegisterPropertyItems();
|
||||
// 底部四个按钮
|
||||
RegisterBottomButton();
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 装备
|
||||
function RegisterEquipment() {
|
||||
// 装备背景
|
||||
local equipmentBackground = CL_SpriteObject("sprite/interface2/profile/profile.img", 14);
|
||||
equipmentBackground.SetPosition(7.5, 8);
|
||||
Addchild(equipmentBackground);
|
||||
|
||||
// 中间装备背景
|
||||
local centerBackground = CL_SpriteObject("sprite/interface2/profile/profile.img", 77);
|
||||
centerBackground.SetPosition( 124 , 10);
|
||||
Addchild(centerBackground);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 名称 等级 其他
|
||||
function RegisterNameAndOther() {
|
||||
// 冒险家名望
|
||||
local adventurerFame = CL_SpriteObject("sprite/interface2/profile/profile_icon.img", 53);
|
||||
adventurerFame.SetPosition(70, 185);
|
||||
Addchild(adventurerFame);
|
||||
|
||||
local adventurerFameText = FontAssetManager.GenerateNormal("冒险家名望", true, {
|
||||
color = brown
|
||||
});
|
||||
adventurerFameText.SetPosition(adventurerFame.right() + 5, adventurerFame.Y);
|
||||
Addchild(adventurerFameText);
|
||||
|
||||
// 冒险家名望数值
|
||||
local adventurerFameNum = FontAssetManager.GenerateNormal("7", true, {
|
||||
color = green
|
||||
});
|
||||
adventurerFameNum.SetPosition(adventurerFameText.right() + 5, adventurerFameText.Y);
|
||||
Addchild(adventurerFameNum);
|
||||
}
|
||||
|
||||
|
||||
|
||||
function RegisterPropertyItems() {
|
||||
// 属性
|
||||
|
||||
// 生命
|
||||
local life = roleInfoPropertyItem(0, 213, 0, "生命", "100");
|
||||
Addchild(life);
|
||||
// 魔法
|
||||
local magic = roleInfoPropertyItem(life.right() + 16, life.Y, 1, "魔法", "100");
|
||||
Addchild(magic);
|
||||
// 物理防御力
|
||||
local physicalDefense = roleInfoPropertyItem(life.X, life.bottom(), 8, "物理防御力", "100", false);
|
||||
Addchild(physicalDefense);
|
||||
// 魔法防御力
|
||||
local magicDefense = roleInfoPropertyItem(physicalDefense.right() + 16, physicalDefense.Y, 9, "魔法防御力", "100");
|
||||
Addchild(magicDefense);
|
||||
|
||||
// 力量
|
||||
local strength = roleInfoPropertyItem(life.X, physicalDefense.bottom(), 2, "力量", "100");
|
||||
Addchild(strength);
|
||||
// 智力
|
||||
local intelligence = roleInfoPropertyItem(strength.right() + 16, strength.Y, 3, "智力", "100");
|
||||
Addchild(intelligence);
|
||||
// 体力
|
||||
local vitality = roleInfoPropertyItem(strength.X, strength.bottom(), 4, "体力", "100");
|
||||
Addchild(vitality);
|
||||
// 精神
|
||||
local spirit = roleInfoPropertyItem(vitality.right() + 16, vitality.Y, 5, "精神", "100");
|
||||
Addchild(spirit);
|
||||
// 物理攻击力
|
||||
local physicalATK = roleInfoPropertyItem(life.X, spirit.bottom(), 6, "物理攻击力", "100");
|
||||
Addchild(physicalATK);
|
||||
// 魔法攻击力
|
||||
local magicATK = roleInfoPropertyItem(physicalATK.right() + 16, physicalATK.Y, 7, "魔法攻击力", "100");
|
||||
Addchild(magicATK);
|
||||
// 物理暴击
|
||||
local physicalCrit = roleInfoPropertyItem(life.X, magicATK.bottom(), 10, "物理暴击", "100");
|
||||
Addchild(physicalCrit);
|
||||
// 魔法暴击
|
||||
local magicCrit = roleInfoPropertyItem(physicalCrit.right() + 16, physicalCrit.Y, 11, "魔法暴击", "100");
|
||||
Addchild(magicCrit);
|
||||
// 独立攻击
|
||||
local independentAttack = roleInfoPropertyItem(life.X, magicCrit.bottom(), 12, "独立攻击", "100");
|
||||
Addchild(independentAttack);
|
||||
|
||||
// 攻击速度
|
||||
local attackSpeed = roleInfoPropertyItem(life.X, independentAttack.bottom(), 13, "攻击速度", "100");
|
||||
Addchild(attackSpeed);
|
||||
// 释放速度
|
||||
local releaseSpeed = roleInfoPropertyItem(attackSpeed.right() + 16, attackSpeed.Y, 14, "释放速度", "100");
|
||||
Addchild(releaseSpeed);
|
||||
// 移动速度
|
||||
local moveSpeed = roleInfoPropertyItem(life.X, releaseSpeed.bottom(), 15, "移动速度", "100");
|
||||
Addchild(moveSpeed);
|
||||
|
||||
// 攻击属性
|
||||
local attackProperty = roleInfoPropertyItem(life.X, moveSpeed.bottom(), 16, "攻击属性", "火(0)/冰(0)/光(0)/暗(0)", true, 260);
|
||||
Addchild(attackProperty);
|
||||
}
|
||||
|
||||
|
||||
// 底部四个按钮
|
||||
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 Yosin_CommonUi {
|
||||
|
||||
// additionReaction 属性是否有加成 加成为绿色 不加成灰色
|
||||
constructor(gX, gY, idx, title, numText, additionReaction = true, width = 120) {
|
||||
base.constructor(gX, gY, width, 18);
|
||||
|
||||
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 icon = CL_SpriteObject("sprite/interface2/profile/profile_icon.img", idx);
|
||||
icon.SetPosition(5, 0);
|
||||
Addchild(icon);
|
||||
|
||||
// 属性名称
|
||||
local property = FontAssetManager.GenerateNormal(title, true, {
|
||||
color = titlecolor
|
||||
});
|
||||
property.SetPosition(icon.right() + 5, icon.Y);
|
||||
Addchild(property);
|
||||
|
||||
// 属性数值
|
||||
local propertyNum = FontAssetManager.GenerateNormal(numText, true, {
|
||||
color = numColor
|
||||
});
|
||||
local numX = width - propertyNum.GetSize().w;
|
||||
propertyNum.SetPosition( numX, icon.Y);
|
||||
Addchild(propertyNum);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
// 其他面板按钮
|
||||
class otherButton extends Yosin_CommonUi {
|
||||
|
||||
// 是否启用按钮
|
||||
enabled = true;
|
||||
// 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";
|
||||
local icon = CL_SpriteObject(path, enabled ? idx : idx +1 );
|
||||
icon.SetPosition(32 - icon.GetSize().w / 2, 45/2 - icon.GetSize().h / 2 + 3 );
|
||||
Addchild(icon);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
文件名:5_Inventory.nut
|
||||
路径:User/UI/Window/5_Inventory.nut
|
||||
创建日期:2025-01-02 12:37
|
||||
文件用途: 背包窗口
|
||||
*/
|
||||
|
||||
class _Inventory extends Yosin_Window {
|
||||
|
||||
item = null;
|
||||
dressUpTitleBtn = null;
|
||||
petTitleBtn = null;
|
||||
stoneTitleBtn = null;
|
||||
|
||||
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
|
||||
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
|
||||
|
||||
local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)");
|
||||
AddUIChild(title);
|
||||
|
||||
local item2 = Yosin_EmeStretch(100, 100, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160);
|
||||
Addchild(item2);
|
||||
|
||||
//注册控件
|
||||
RegisterWidget();
|
||||
}
|
||||
|
||||
function RegisterWidget() {
|
||||
|
||||
//, "装扮", "宠物", "护石"
|
||||
local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["物品栏"]);
|
||||
AddUIChild(titlesBtn);
|
||||
|
||||
titlesBtn.LBDownOnClick = function(btns, index) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
local item = Yosin_SplicingButton(10, 50, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160, true, false);
|
||||
AddUIChild(item);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
//逻辑入口
|
||||
function Proc(Dt) {
|
||||
SyncPos(X, Y);
|
||||
base.Proc(Dt);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -5,12 +5,19 @@
|
|||
文件用途:包ID枚举
|
||||
*/
|
||||
enum PACKET_ID {
|
||||
|
||||
/**** 客户端发包 ***/
|
||||
|
||||
// 登录
|
||||
LOGIN = 1
|
||||
//注册
|
||||
REGISTER = 3
|
||||
//修改密码
|
||||
CHANGE_PASSWORD = 5
|
||||
//昵称重复检查
|
||||
NICKNAME_REPEAT_CHECK = 6
|
||||
//创建角色
|
||||
CREATE_CHARACTER = 7
|
||||
//查询账号中的角色列表
|
||||
QUERY_CHARACTER_LIST = 9
|
||||
//选择角色
|
||||
|
|
@ -18,4 +25,22 @@ enum PACKET_ID {
|
|||
//更换角色位置
|
||||
CHANGE_CHARACTER_POSITION = 10
|
||||
|
||||
|
||||
//城镇移动切换区域
|
||||
CHANGE_TOWN_AREA = 10001
|
||||
|
||||
|
||||
|
||||
/**** 客户端收包 ***/
|
||||
|
||||
//昵称重复检查回包
|
||||
NICKNAME_REPEAT_CHECK_CALLBACK = 3
|
||||
//创建角色回包
|
||||
CREATE_CHARACTER_CALLBACK = 4
|
||||
//选择角色进入游戏回包
|
||||
SELECT_CHARACTER_ENTER_GAME_CALLBACK = 5
|
||||
//城镇移动切换区域回包
|
||||
CHANGE_TOWN_AREA_CALLBACK = 10001
|
||||
//城镇添加角色回包
|
||||
TOWN_ADD_CHARACTER_CALLBACK = 10002
|
||||
}
|
||||
|
|
@ -241,5 +241,14 @@
|
|||
},
|
||||
"User/Object/ActiveObject/NpcObjectClass.nut": {
|
||||
"description": "NPC对象"
|
||||
},
|
||||
"User/UI/Window/5_Inventory.nut": {
|
||||
"description": "背包窗口"
|
||||
},
|
||||
"User/UI/Window/4_PersonalInfo.nut": {
|
||||
"description": "个人信息窗口"
|
||||
},
|
||||
"User/Socket/Packet.nut": {
|
||||
"description": "数据包类"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue