Merge remote-tracking branch 'origin/dong' into yi

# Conflicts:
#	sqr/User/UI/Window/5_Inventory/5_Inventory.nut
This commit is contained in:
WONIU 2025-01-12 16:41:55 +08:00
commit 16b819f68b
10 changed files with 205 additions and 41 deletions

View File

@ -29,5 +29,8 @@ function _Yosin_Game_Logic_(Dt, GameListener) {
}
}
}
try {
remove("Yosin_Game_Reloading.Sign");
} catch (exception) {
remove("Yosin_Game_Reloading.Sign");
}

View File

@ -255,6 +255,7 @@ class Yosin_Window extends Yosin_BaseWindow {
//切换到最上层窗口 即得到焦点时 全局窗口才调用 子窗口请不要调用此函数
function ResetFocus() {
this.Visible = true;
SetVisible(true);
//遍历全局窗口数组将自己移除重新添加在末尾
foreach(Index, WindowObj in _SYS_WINDOW_LIST_) {
WindowObj.SetZOrder(10000000 + Index + (WindowObj.IsTop ? 10000000 : 0));
@ -402,7 +403,7 @@ function Sq_CreateWindow(ClassName, gObjectId, gX, gY, gWidth, gHeight, gTitleH)
//窗口逻辑入口 C回调
function _Yosin_Windows_Logic_(Dt, Ui_Layer) {
_UiObject_ = Actor(Ui_Layer);
if (!_UiObject_) _UiObject_ = Actor(Ui_Layer);
//遍历窗口队列 如果可见则调用Show
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
local Window = _SYS_WINDOW_LIST_[i];

View File

@ -39,12 +39,9 @@ class _GameController_ extends _Input_ {
this.KeyCode[Code] = Status;
//只遍历有回调的键码
foreach(Code, Callback in GameKeyCodeCallback) {
//是否按下传递不同指令
if (GetGameKeyCode(Code)) {
Callback(true);
} else {
Callback(false);
foreach(RCode, Callback in GameKeyCodeCallback) {
if (RCode == Code) {
Callback(Status);
}
}
}

View File

@ -15,16 +15,123 @@ function RegisterFunctionalPack() {
Charc.Cid = Info.cid;
TownObj.AddObject(Charc, true);
ClientCharacter = Charc;
//以下是角色应当初始化的各项东西
{
//初始化背包
if (ClientCharacterInventory) {
ClientCharacterInventory.DestroyWindow();
}
ClientCharacterInventory = _Inventory("背包窗口", 150, 12, 262, 548, 20);
}
});
/*
InventorySize : int //背包大小
InventoryType : byte //背包类型
InventoryItemCount : short //背包道具数量
ItemInfo : Struct //道具信息 结构体
{
Type : byte //类型
// Type 为 1 装备类型
{
Pos : short //装备位置
EquipId : int //装备ID
EquipEnchant : int //装备附魔编号
EquipUpgrade : byte //装备强化等级或增幅等级
EquipSeparate : byte //装备锻造
EquipIncrease : byte //装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
EquipPowerPercentage : byte //装备力量百分比
EquipIntellectPercentage : byte //装备智力百分比
EquipStaminaPercentage : byte //装备体力百分比
EquipSpiritPercentage : byte //装备精神百分比
EquipPhysicalAttackPercentage : byte //装备物理攻击百分比
EquipMagicAttackPercentage : byte //装备魔法攻击百分比
EquipIndependentAttackPercentage : byte //装备独立攻击百分比
EquipPhysicalDefensePercentage : byte //装备物理防御百分比
EquipMagicDefensePercentage : byte //装备魔法防御百分比
EquipWrapCount : byte //装备再封装次数
}
// Type 为 2 消耗品类型
{
Pos : short //道具位置
ItemId : int //道具ID
ItemCount : int //道具数量
}
}
*/
//刷新客户端角色背包数据
MySocket.RegisterBinaryHandler(PACKET_ID.REFRESH_CLIENT_CHARACTER_INVENTORY_DATA_CALLBACK, function(Binary) {
local Pack = Packet(Binary);
local op = Pack.Get_Int();
//背包大小
local size = Pack.Get_Int();
local InventorySize = Pack.Get_Int();
//背包类型
local type = Pack.Get_Int();
local InventoryType = Pack.Get_Byte();
//背包道具数量
local InventoryItemCount = Pack.Get_Int();
//项目List
local ItemList = [];
//道具数据
for (local i = 0; i< InventoryItemCount; i++) {
local Type = Pack.Get_Byte();
//装备类型
if (Type == 1) {
local EquInfo = {
//装备位置
Pos = Pack.Get_Short(),
//装备ID
EquipId = Pack.Get_Int(),
//装备附魔编号
EquipEnchant = Pack.Get_Int(),
//装备强化等级或增幅等级
EquipUpgrade = Pack.Get_Byte(),
//装备锻造
EquipSeparate = Pack.Get_Byte(),
//装备增幅属性 0 无 1 力量 2 智力 3 体力 4 精神
EquipIncrease = Pack.Get_Byte(),
//装备力量百分比
EquipPowerPercentage = Pack.Get_Byte(),
//装备智力百分比
EquipIntellectPercentage = Pack.Get_Byte(),
//装备体力百分比
EquipStaminaPercentage = Pack.Get_Byte(),
//装备精神百分比
EquipSpiritPercentage = Pack.Get_Byte(),
//装备物理攻击百分比
EquipPhysicalAttackPercentage = Pack.Get_Byte(),
//装备魔法攻击百分比
EquipMagicAttackPercentage = Pack.Get_Byte(),
//装备独立攻击百分比
EquipIndependentAttackPercentage = Pack.Get_Byte(),
//装备物理防御百分比
EquipPhysicalDefensePercentage = Pack.Get_Byte(),
//装备魔法防御百分比
EquipMagicDefensePercentage = Pack.Get_Byte(),
//装备再封装次数
EquipWrapCount = Pack.Get_Byte(),
}
ItemList.push(EquInfo);
print("构造装备");
}
//消耗品类型
if (Type == 2) {
local ItemInfo = {
//道具位置
Pos = Pack.Get_Short(),
//道具ID
ItemId = Pack.Get_Int(),
//道具数量
ItemCount = Pack.Get_Int(),
}
ItemList.push(ItemInfo);
}
}
});
//城镇中添加角色的回包

View File

@ -31,15 +31,15 @@ function TestStage() {
// Window.SetPosition(580, 80);
// Window.ResetFocus();
// local TownObj = Town(1);
// local TownObj = Town(2);
// 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, 548, 20);
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
// Window.equipmentPage.Item.ItemCollection.SetItemList([{
// Window.equipmentPage.ItemCollection.SetItemList([{
// ItemId = 27675
// }, {
// ItemId = 101020048

View File

@ -86,10 +86,12 @@ class _Login_Window extends Yosin_Window {
function RegisterWidget() {
//账号输入框
AccountInputBox = Yosin_InputBox(752, 240, 200);
AccountInputBox.str = "1"; //TODO 临时账户
AddUIChild(AccountInputBox);
//密码输入框
PasswordInputBox = Yosin_InputBox(752, 280, 200);
PasswordInputBox.str = "1"; //TODO 临时账户
AddUIChild(PasswordInputBox);
//登录按钮

View File

@ -4,9 +4,9 @@
创建日期:2025-01-06 14:06
文件用途: 背包窗口
*/
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 548, 20);
//主类
class _Inventory extends Yosin_Window {
<<<<<<< HEAD
// 装备页
equipmentPage = null;
@ -25,15 +25,39 @@ class _Inventory extends Yosin_Window {
// 物品栏排列搜索按钮 在显示物品栏页 时的Y坐标
itemSetBtnY = 467;
=======
//物品栏
EquipmentPage = null;
//是否可见
Visible = false;
>>>>>>> origin/dong
constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) {
base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH);
<<<<<<< HEAD
PageIndex = 1;
uiPageIndex = 1;
=======
>>>>>>> origin/dong
//注册控件
RegisterWidget();
//注册按键回调事件
Input.RegisterGameKeyCode(CONTROLLER.OPTION_HOTKEY_ITEM_INVENTORY, function(Flag) {
//抬起的时候
if (Flag == 0) {
//如果窗口已经打开
if (this.Visible) {
//关闭窗口
CloseWindow();
} else {
//打开窗口
ResetFocus();
}
}
}.bindenv(this));
}
function RegisterWidget() {
@ -46,7 +70,7 @@ class _Inventory extends Yosin_Window {
closeBtn.DownSimulateOffset = false;
closeBtn.SetZOrder(1);
closeBtn.OnClick = function(btn) {
print(13123123);
CloseWindow();
}
AddUIChild(closeBtn);
//置顶按钮
@ -66,10 +90,18 @@ class _Inventory extends Yosin_Window {
btns.Parent.PageIndex = index;
};
<<<<<<< HEAD
//物品栏 装备页
equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
AddUIChild(equipmentPage);
equipmentPage.SetVisible(false);
=======
//物品栏
EquipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom(), 300, 441);
AddUIChild(EquipmentPage);
>>>>>>> origin/dong
// 装扮页
DressUpPage = Inventory_DressUpPage(4, titlesBtn.bottom(), 300, 441);
@ -110,7 +142,7 @@ class _Inventory extends Yosin_Window {
local ReviveNum = FontAssetManager.GenerateNormal("23434个", true, {
color = txtColor
});
ReviveNum.SetPosition(120 - ReviveNum.GetSize().w + bg.X , bg.Y + 2);
ReviveNum.SetPosition(120 - ReviveNum.GetSize().w + bg.X, bg.Y + 2);
Addchild(ReviveNum);
@ -118,13 +150,13 @@ class _Inventory extends Yosin_Window {
local winNum = FontAssetManager.GenerateNormal("23434个", true, {
color = txtColor
});
winNum.SetPosition(245 - winNum.GetSize().w + bg.X, bg.Y + 2);
winNum.SetPosition(245 - winNum.GetSize().w + bg.X, bg.Y + 2);
Addchild(winNum);
// 商城
local storeBtn = Yosin_BaseButton(1 + bg.X, bg.Y + 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
local storeBtn = Yosin_BaseButton(1 + bg.X, bg.Y + 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3);
//点击事件回调
// storeBtn.OnClick = function(Button) {
// }.bindenv(this);
@ -135,7 +167,7 @@ class _Inventory extends Yosin_Window {
local storeNum = FontAssetManager.GenerateNormal("23434点券", true, {
color = txtColor
});
storeNum.SetPosition( bg.X + 120 - storeNum.GetSize().w , bg.Y + 27);
storeNum.SetPosition(bg.X + 120 - storeNum.GetSize().w, bg.Y + 27);
Addchild(storeNum);
// 金币按钮
@ -149,7 +181,7 @@ class _Inventory extends Yosin_Window {
local storeNum = FontAssetManager.GenerateNormal("23434金币", true, {
color = txtColor
});
storeNum.SetPosition( bg.X + 245 - storeNum.GetSize().w, bg.Y + 27);
storeNum.SetPosition(bg.X + 245 - storeNum.GetSize().w, bg.Y + 27);
Addchild(storeNum);
}

View File

@ -2,31 +2,37 @@
文件名:Inventory_EquipmentPage.nut
路径:User/UI/Window/5_Inventory/Inventory_EquipmentPage.nut
创建日期:2025-01-06 13:50
文件用途: 背包装备页面
文件用途: 背包物品栏页面
*/
// 背包装备页面
// 背包物品栏页面
class Inventory_EquipmentPage extends Yosin_CommonUi {
// Item = null;
//人物装备
CharactersEquipment = null;
//物品栏
ItemCollection = null;
//重量进度条
WeightSchedule = null;
//总可承载重量
TotalLoadCapacity = 1.0;
//当前承载重量
CurrentLoadCapacity = 0.0;
constructor(x, y, w, h) {
base.constructor(x, y, w, h);
// 人物装备
local charactersEquipment = Inventory_CharactersEquipment();
charactersEquipment.SetPosition(5, 0);
Addchild(charactersEquipment);
CharactersEquipment = Inventory_CharactersEquipment();
CharactersEquipment.SetPosition(5, 0);
Addchild(CharactersEquipment);
// 添加书本按钮
AddBookButton();
// 物品栏
AddItem();
}
@ -34,9 +40,6 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
function AddBookButton() {
// 称号
local designation = Yosin_BaseButton(7, 145, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50);
//点击事件回调
// permutationBtn.OnClick = function(Button) {
// }.bindenv(this);
AddUIChild(designation);
// 增益强化
@ -73,8 +76,11 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
Addchild(itemBg);
// 物品栏
ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7);
AddUIChild(ItemCollection);
ItemCollection = [];
for (local i = 0; i< 5; i++) {
ItemCollection.push(_ItemCollection(itemBg.X + 7, itemBg.Y + 3, 7));
}
AddUIChild(ItemCollection[0]);
local itemBgBottom = itemBg.bottom();
@ -82,14 +88,28 @@ class Inventory_EquipmentPage extends Yosin_CommonUi {
local weight = FontAssetManager.GenerateNormal("重量", true, {
color = sq_RGBA(160, 132, 75, 255)
});
weight.SetPosition(ItemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5);
weight.SetPosition(12, itemBgBottom - weight.GetSize().h - 5);
Addchild(weight);
// 重量进度条
local weightSchedule = Yosin_Schedule(weight.right() + 2, weight.Y + 4, 125, 10, "sprite/interface/newstyle/windows/inventory/inventory.img", 1);
weightSchedule.SetPercentage(0.6);
Addchild(weightSchedule);
WeightSchedule = Yosin_Schedule(weight.right() + 2, weight.Y + 4, 125, 10, "sprite/interface/newstyle/windows/inventory/inventory.img", 1);
WeightSchedule.SetPercentage(0.0);
Addchild(WeightSchedule);
}
//刷新重量进度
function RefreshWeightProgress() {
WeightSchedule.SetPercentage(CurrentLoadCapacity / TotalLoadCapacity);
}
//设定总可承载重量
function SetTotalLoadCapacity(capacity) {
TotalLoadCapacity = capacity;
}
//设定物品栏列表
function SetItemCollectionList(Type, List) {
ItemCollection[Type].SetItemList(List);
}
}

View File

@ -55,7 +55,7 @@ enum CONTROLLER {
OPTION_HOTKEY_CREATURE_SKILL = 8 // 宠物技能键
OPTION_HOTKEY_STATUS_WINDOW = 9 // (M)
OPTION_HOTKEY_SKILL_WINDOW = 10 // (K)
OPTION_HOTKEY_ITEM_INVENTORY = 11 // (I)
OPTION_HOTKEY_ITEM_INVENTORY = 23 // (I)
OPTION_HOTKEY_OPTION_WINDOW = 12 // (O)
OPTION_HOTKEY_NORMAL_QUEST_WINDOW = 13 // (Q)
OPTION_HOTKEY_AVATAR_INVENTORY = 14 // (U)

View File

@ -7,3 +7,5 @@
//客户端角色对象
ClientCharacter <- null;
//客户端角色的背包
ClientCharacterInventory <- null;