画布新增 DrawSprite 方法

This commit is contained in:
Lenheart 2025-01-08 13:49:58 +08:00
parent 383b43b39b
commit 75a6cd6415
5 changed files with 34 additions and 32 deletions

Binary file not shown.

View File

@ -63,11 +63,17 @@ class CL_CanvasObject extends CL_BaseObject {
} }
//绘制演员 //绘制演员
function DrawActor(Actor, XPos, YPos) { function DrawActor(Actor, XPos = 0, YPos = 0) {
if (!Context) error("请先刷新上下文"); if (!Context) error("请先刷新上下文");
Canvas_DrawActor(this.C_Object, Context, Actor.C_Object, XPos, YPos); Canvas_DrawActor(this.C_Object, Context, Actor.C_Object, XPos, YPos);
} }
//绘制精灵
function DrawSprite(Actor, XPos = 0, YPos = 0) {
if (!Context) error("请先刷新上下文");
Canvas_DrawSprite(this.C_Object, Context, Actor.C_Object, XPos, YPos);
}
//绘制精灵帧 //绘制精灵帧
function DrawSpriteFrame(SpriteFrame, XPos, YPos, Width = null, Height = null) { function DrawSpriteFrame(SpriteFrame, XPos, YPos, Width = null, Height = null) {
if (!Context) error("请先刷新上下文"); if (!Context) error("请先刷新上下文");

View File

@ -621,17 +621,4 @@ class Yosin_Schedule extends Yosin_CommonUi {
BarSprite.SetCropRect(BarSprite.X, BarSprite.Y, barW, barSize.h); BarSprite.SetCropRect(BarSprite.X, BarSprite.Y, barW, barSize.h);
BarSprite.SetSize(barW, barSize.h); BarSprite.SetSize(barW, barSize.h);
} }
}
if (!getroottable().rawin("chongzaiflag")) {
getroottable()["chongzaiflag"] <- true;
} else {
//遍历窗口队列 如果可见则调用Show
for (local i = 0; i< _SYS_WINDOW_LIST_.len(); i++) {
local Window = _SYS_WINDOW_LIST_[i];
Window.Visible = false;
Window.RemoveSelf();
}
TestStage();
} }

View File

@ -60,6 +60,15 @@ class GameItem.EquipmentInfo extends Yosin_Window {
local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]); local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]);
Canvas.DrawSpriteFrame(IconFrame, 7, 7); Canvas.DrawSpriteFrame(IconFrame, 7, 7);
//是否封装
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1;
if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) {
local IconFrame = CL_SpriteObject("sprite/item/iconmark.img", 46);
IconFrame.SetMode(0);
IconFrame.SetPosition(8, 6);
Canvas.DrawSprite(IconFrame);
}
} }
//绘制装备名称 //绘制装备名称
@ -108,12 +117,12 @@ class GameItem.EquipmentInfo extends Yosin_Window {
}); });
Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57); Canvas.DrawActor(MinUseLevelText, 210 - MinUseLevelText.GetSize().w - 6, 57);
//绘制是否封装 如果有主体属性读取 否则一律为封装 //绘制交易类型 如果有主体属性读取 否则一律为封装
local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 0; local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0;
local IsPackageText = FontAssetManager.GenerateNormal(TradeTypeText[IsPackage], false, { local TradeTypeText = FontAssetManager.GenerateNormal(TradeTypeText[TradeType], false, {
color = TradeTypeColor[IsPackage] color = TradeTypeColor[TradeType]
}); });
Canvas.DrawActor(IsPackageText, 210 - IsPackageText.GetSize().w - 6, 73); Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73);
//绘制装备类型 //绘制装备类型
local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], false, { local GroupNameText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.item_group_name_table[Equipment.GroupName], false, {

View File

@ -14,22 +14,22 @@ function TestStage() {
// local Equ = GameItem.Equipment(27675); local Equ = GameItem.Equipment(27675);
// local Window = Equ.GetEquipmentInfoWindow(); local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(100, 80); Window.SetPosition(100, 80);
// Window.ResetFocus(); Window.ResetFocus();
// local Equ = GameItem.Equipment(101020048); local Equ = GameItem.Equipment(101020048);
// local Window = Equ.GetEquipmentInfoWindow(); local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(350, 80); Window.SetPosition(350, 80);
// Window.ResetFocus(); Window.ResetFocus();
// local Equ = GameItem.Equipment(24144); local Equ = GameItem.Equipment(24144);
// local Window = Equ.GetEquipmentInfoWindow(); local Window = Equ.GetEquipmentInfoWindow();
// Window.SetPosition(580, 80); Window.SetPosition(580, 80);
// Window.ResetFocus(); Window.ResetFocus();
local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
// local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20);
// //大背景 // //大背景