diff --git a/Yosin_Engine.exe b/Yosin_Engine.exe index 959f94a..2230b34 100644 Binary files a/Yosin_Engine.exe and b/Yosin_Engine.exe differ diff --git a/sqr/Core/BaseClass/CanvasObject.nut b/sqr/Core/BaseClass/CanvasObject.nut index 69388b8..bf5bc1d 100644 --- a/sqr/Core/BaseClass/CanvasObject.nut +++ b/sqr/Core/BaseClass/CanvasObject.nut @@ -112,4 +112,10 @@ class CL_CanvasObject extends CL_BaseObject { if (!Context) error("请先刷新上下文"); Canvas_DrawRect(Context, X, Y, W, H); } + + //导出精灵帧 + function ExportSpriteFrame() { + local SpriteFrame = CL_SpriteFrameObject(Canvas_ExportSpriteFrame(this.C_Object)); + return SpriteFrame; + } } \ No newline at end of file diff --git a/sqr/Core/Game_Proc/Game_Proc.nut b/sqr/Core/Game_Proc/Game_Proc.nut index 8a44c42..6a0b6de 100644 --- a/sqr/Core/Game_Proc/Game_Proc.nut +++ b/sqr/Core/Game_Proc/Game_Proc.nut @@ -28,4 +28,6 @@ function _Yosin_Game_Logic_(Dt, GameListener) { remove("Yosin_Game_Reloading.Sign"); } } -} \ No newline at end of file +} + +remove("Yosin_Game_Reloading.Sign"); \ No newline at end of file diff --git a/sqr/Core/UI_Class/UI_Widget.nut b/sqr/Core/UI_Class/UI_Widget.nut index aadca80..e610967 100644 --- a/sqr/Core/UI_Class/UI_Widget.nut +++ b/sqr/Core/UI_Class/UI_Widget.nut @@ -293,8 +293,9 @@ function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) { Canvas.EndDraw(); // 添加画布 // Addchild(Canvas); - - return Canvas; + local Sp = CL_SpriteObject(); + Sp.SetFrame(Canvas.ExportSpriteFrame()); + return Sp; } diff --git a/sqr/User/Socket/FunctionalPack.nut b/sqr/User/Socket/FunctionalPack.nut index 0df6ca9..76a70a0 100644 --- a/sqr/User/Socket/FunctionalPack.nut +++ b/sqr/User/Socket/FunctionalPack.nut @@ -7,6 +7,26 @@ //注册功能包 function RegisterFunctionalPack() { + // 选择角色进入游戏回包 + MySocket.RegisterHandler(PACKET_ID.SELECT_CHARACTER_ENTER_GAME_CALLBACK, function(Jso) { + local Info = Jso.charac; + local TownObj = Town(Info.town); + local Charc = GameObject.CreateCharacter(Info.job, Info.equ, true); + Charc.Cid = Info.cid; + TownObj.AddObject(Charc, true); + ClientCharacter = Charc; + }); + + //刷新客户端角色背包数据 + MySocket.RegisterBinaryHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_INVENTORY_DATA_CALLBACK, function(Binary) { + local Pack = Packet(Binary); + local op = Pack.Get_Int(); + //背包大小 + local size = Pack.Get_Int(); + //背包类型 + local type = Pack.Get_Int(); + }); + //城镇中添加角色的回包 MySocket.RegisterBinaryHandler(PACKET_ID.TOWN_ADD_CHARACTER_CALLBACK, function(Binary) { local Pack = Packet(Binary); @@ -38,6 +58,7 @@ function RegisterFunctionalPack() { if (moveflag != DIRECTION.NONE) { Charc.SetMoveFlag(moveflag); } + }); //城镇中移除角色的回包 diff --git a/sqr/User/Stage/LodingStage.nut b/sqr/User/Stage/LodingStage.nut index 1ba3ff7..0676cf5 100644 --- a/sqr/User/Stage/LodingStage.nut +++ b/sqr/User/Stage/LodingStage.nut @@ -27,7 +27,7 @@ function InitGame() { //初始化控制器 _GameController_(); //初始化顶部工具条UI - Sq_CreateWindow(_Top_tool, "窗口顶部工具条", 208, 0, 650, 20, 0); + // Sq_CreateWindow(_Top_tool, "窗口顶部工具条", 208, 0, 650, 20, 0); //预加载 Animation("ui/charactercreate/dust.ani"); diff --git a/sqr/User/Stage/TestStage.nut b/sqr/User/Stage/TestStage.nut index ebd078a..6673542 100644 --- a/sqr/User/Stage/TestStage.nut +++ b/sqr/User/Stage/TestStage.nut @@ -10,11 +10,12 @@ function TestStage() { T.Enter(); - // local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); + local Window = Sq_CreateWindow(_Login_Window, "登录界面窗口", 0, 0, 1066, 600, 0); // local BackGround = CL_SpriteObject("sprite/loding.img", 0); // T.Addchild(BackGround); + // local Equ = GameItem.Equipment(27675); // local Window = Equ.GetEquipmentInfoWindow(); // Window.SetPosition(100, 80); @@ -30,21 +31,21 @@ function TestStage() { // Window.SetPosition(580, 80); // Window.ResetFocus(); + // local TownObj = Town(1); + // local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]); + // TownObj.AddObject(Charc, true); + // ClientCharacter = Charc; - local TownObj = Town(1); - local Charc = GameObject.CreateCharacter(0, [101590007, 27675, 601500060, 601550060, 601560058, 601570053, 601520052, 601500060, 601510059, 601530051, 601540060, 601580023]); - TownObj.AddObject(Charc, true); - ClientCharacter = Charc; - local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); + // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); - Window.equipmentPage.Item.ItemCollection.SetItemList([{ - ItemId = 27675 - }, { - ItemId = 101020048 - }, { - ItemId = 24144 - }]); + // Window.equipmentPage.Item.ItemCollection.SetItemList([{ + // ItemId = 27675 + // }, { + // ItemId = 101020048 + // }, { + // ItemId = 24144 + // }]); // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); // //大背景 diff --git a/sqr/User/UI/Widget/Top_Title.nut b/sqr/User/UI/Widget/Top_Title.nut index 6ac7b3e..9267560 100644 --- a/sqr/User/UI/Widget/Top_Title.nut +++ b/sqr/User/UI/Widget/Top_Title.nut @@ -13,17 +13,17 @@ class Yosin_TopTitle extends Yosin_CommonUi { //内容背景 if (drawBackground) { - local background = Yosin_NineBoxStretch(-1, 15, W + 1, H - 15, "sprite/interface/lenheartwindowcommon.img", 97); + local background = Yosin_NineBoxStretch(0, 15, W + 4, H - 15, "sprite/interface/lenheartwindowcommon.img", 97); Addchild(background); } // 标题背景 - local Background = Yosin_EmeStretch(0, 0, W, 22, "sprite/interface/lenheartwindowcommon.img", 609); + local Background = Yosin_EmeStretch(0, 0, W + 3, 22, "sprite/interface/lenheartwindowcommon.img", 609); Addchild(Background); // 标题亮色背景 local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483); - local scaleW = (W / BackgroundBright.GetSize().w).tofloat(); + local scaleW = (Background.GetSize().w / BackgroundBright.GetSize().w).tofloat(); BackgroundBright.SetScale(scaleW, 1); BackgroundBright.SetPosition(0, 1); Addchild(BackgroundBright); @@ -38,20 +38,6 @@ class Yosin_TopTitle extends Yosin_CommonUi { 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); - } diff --git a/sqr/User/UI/Window/1_Select_Character.nut b/sqr/User/UI/Window/1_Select_Character.nut index b5d3ee6..9108a41 100644 --- a/sqr/User/UI/Window/1_Select_Character.nut +++ b/sqr/User/UI/Window/1_Select_Character.nut @@ -356,15 +356,6 @@ class _Select_Character_Window extends Yosin_Window { - // 选择角色进入游戏回包 - MySocket.RegisterHandler(PACKET_ID.SELECT_CHARACTER_ENTER_GAME_CALLBACK, function(Jso) { - local Info = Jso.charac; - local TownObj = Town(Info.town); - local Charc = GameObject.CreateCharacter(Info.job, Info.equ, true); - Charc.Cid = Info.cid; - TownObj.AddObject(Charc, true); - ClientCharacter = Charc; - }.bindenv(this)); } function Init(gInfo) { @@ -536,7 +527,8 @@ class _Select_Character_Window extends Yosin_Window { //发送进入游戏请求 MySocket.Send(PACKET_ID.SELECT_CHARACTER, { cid = UpCharacterList[CurrentSelectCharacterIdx].Info.cid - }) + }); + }.bindenv(this); AddUIChild(StartButton); } @@ -558,7 +550,7 @@ class _Select_Character_Window extends Yosin_Window { //角色遮罩栏 CharacterMaskBox = Yosin_NineBoxStretch(-4, 320, 1074, 680, "sprite/interface/lenheartwindowcommon.img", 0); - AddUIChild(CharacterMaskBox); + Addchild(CharacterMaskBox); for (local i = 0; i< 7; i++) { diff --git a/sqr/User/UI/Window/233_HUD_Message.nut b/sqr/User/UI/Window/233_HUD_Message.nut index f9e7bd0..8af48f9 100644 --- a/sqr/User/UI/Window/233_HUD_Message.nut +++ b/sqr/User/UI/Window/233_HUD_Message.nut @@ -74,9 +74,9 @@ class _Yosin_MessageBox extends Yosin_Window { function RegisterWidget() { //背景 local background = Yosin_NineBoxStretch(-1, 15, cacheW + 1, cacheH, "sprite/interface/lenheartwindowcommon.img", 97); - AddUIChild(background); + Addchild(background); local twoBackground = Yosin_NineBoxStretch(4, 20, cacheW - 8, cacheH - 36, "sprite/interface/lenheartwindowcommon.img", 97); - AddUIChild(twoBackground); + Addchild(twoBackground); // 绘制标题背景 local titleBackground = Yosin_EmeStretch(0, 0, cacheW, 20, "sprite/interface/lenheartwindowcommon.img", 609); @@ -84,7 +84,7 @@ class _Yosin_MessageBox extends Yosin_Window { local BackgroundBright = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 483); local scaleW = (cacheW / BackgroundBright.GetSize().w).tofloat(); - BackgroundBright.SetScale( scaleW , 1); + BackgroundBright.SetScale(scaleW, 1); Addchild(BackgroundBright); //确认按钮 diff --git a/sqr/User/UI/Window/2_Create_Character.nut b/sqr/User/UI/Window/2_Create_Character.nut index 3fc168d..2238b65 100644 --- a/sqr/User/UI/Window/2_Create_Character.nut +++ b/sqr/User/UI/Window/2_Create_Character.nut @@ -792,11 +792,11 @@ class _create_Character_enterName extends Yosin_Window { //背景 local background = Yosin_NineBoxStretch(-2, 0, 1070, 604, "sprite/interface/lenheartwindowcommon.img", 97); - AddUIChild(background); + Addchild(background); //背景 local background = Yosin_NineBoxStretch(413, 228, 240, 140, "sprite/interface/lenheartwindowcommon.img", 97); - AddUIChild(background); + Addchild(background); // 标题文字 local title = CL_SpriteObject("sprite/interface2/charactercreatever2/charctertitle.img", 13); diff --git a/sqr/User/UI/Window/3_Top_tool.nut b/sqr/User/UI/Window/3_Top_tool.nut index 6d59fb8..5f4d742 100644 --- a/sqr/User/UI/Window/3_Top_tool.nut +++ b/sqr/User/UI/Window/3_Top_tool.nut @@ -33,10 +33,11 @@ class _Top_tool extends Yosin_Window { function RegisterWidget() { local background = Yosin_EmeStretch(0, 0, 650, 20, "sprite/interface/lenheartwindowcommon.img", 612); - AddUIChild(background); + Addchild(background); - local timeBackGround = Yosin_EmeStretch(14, 2, 90, 14, "sprite/interface/lenheartwindowcommon.img", 615); - AddUIChild(timeBackGround); + local timeBackGround = Yosin_EmeStretch(0, 0, 90, 14, "sprite/interface/lenheartwindowcommon.img", 615); + timeBackGround.SetPosition(14, 2); + Addchild(timeBackGround); // 时间 diff --git a/sqr/User/UI/Window/5_Inventory.nut b/sqr/User/UI/Window/5_Inventory.nut index 837238f..e011820 100644 --- a/sqr/User/UI/Window/5_Inventory.nut +++ b/sqr/User/UI/Window/5_Inventory.nut @@ -18,7 +18,8 @@ class _Inventory extends Yosin_Window { local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)"); AddUIChild(title); - local item2 = Yosin_EmeStretch(100, 100, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160); + local item2 = Yosin_EmeStretch(0, 0, 80, 25, "sprite/interface/lenheartwindowcommon.img", 160); + item2.SetPos(100, 100); Addchild(item2); //注册控件 diff --git a/sqr/User/UI/Window/5_Inventory/5_Inventory.nut b/sqr/User/UI/Window/5_Inventory/5_Inventory.nut index 5fc4d5a..177d572 100644 --- a/sqr/User/UI/Window/5_Inventory/5_Inventory.nut +++ b/sqr/User/UI/Window/5_Inventory/5_Inventory.nut @@ -13,14 +13,32 @@ class _Inventory extends Yosin_Window { constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); - local title = Yosin_TopTitle(gWidth, gHeight, "装备栏(I)"); - Addchild(title); + //注册控件 RegisterWidget(); } function RegisterWidget() { + //标题栏 + local title = Yosin_TopTitle(Width, Height, "装备栏(I)"); + Addchild(title); + + //关闭按钮 + local closeBtn = Yosin_BaseButton(Width - 15, 4, 12, 12, "sprite/interface/lenheartwindowcommon.img", 544); + closeBtn.DownSimulateOffset = false; + closeBtn.SetZOrder(1); + closeBtn.OnClick = function(btn) { + print(13123123); + } + AddUIChild(closeBtn); + //置顶按钮 + local topBtn = Yosin_BaseButton(Width - 35, 2, 13, 13, "sprite/interface/lenheartwindowcommon.img", 455); + topBtn.DownSimulateOffset = false; + topBtn.OnClick = function(btn) { + + } + AddUIChild(topBtn); //标题按钮 local titlesBtn = Yosin_RowMoreTitleBtn(5, 22, 252, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160); diff --git a/sqr/User/_ENUM/enum_packet.nut b/sqr/User/_ENUM/enum_packet.nut index 0bb22e6..be9d0e1 100644 --- a/sqr/User/_ENUM/enum_packet.nut +++ b/sqr/User/_ENUM/enum_packet.nut @@ -41,6 +41,8 @@ enum PACKET_ID { CREATE_CHARACTER_CALLBACK = 4 //选择角色进入游戏回包 SELECT_CHARACTER_ENTER_GAME_CALLBACK = 5 + //刷新客户端角色背包数据 + REFRESH_CLIENT_CHARACTER_INVENTORY_DATA_CALLBACK = 6 //城镇移动切换区域回包 CHANGE_TOWN_AREA_CALLBACK = 10001 //城镇添加角色回包