Compare commits
	
		
			No commits in common. "f4bd95e9d1aa773d1c5bb105ac10d9d76b5c3f75" and "75a6cd641553a381216d80781880cb90d1c693a6" have entirely different histories.
		
	
	
		
			f4bd95e9d1
			...
			75a6cd6415
		
	
		
							
								
								
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
							
						
						
									
										
											BIN
										
									
								
								Yosin_Engine.exe
								
								
								
								
							
										
											Binary file not shown.
										
									
								
							|  | @ -154,13 +154,6 @@ class Yosin_EmeStretch extends Yosin_CommonUi { | |||
|         this.Idx = Idx; | ||||
|         base.constructor(X, Y, W, H); | ||||
| 
 | ||||
|         // 创建画布 | ||||
|         local Canvas = CL_CanvasObject(); | ||||
|         // 重设大小并清空 | ||||
|         Canvas.ResizeAndClear( W, H); | ||||
|         // 开始绘制 | ||||
|         Canvas.BeginDraw(); | ||||
| 
 | ||||
|         SpriteList = []; | ||||
|         SpriteList.push(CL_SpriteObject(Path, Idx)); | ||||
|         SpriteList.push(CL_SpriteObject(Path, Idx + 1)); | ||||
|  | @ -186,225 +179,106 @@ class Yosin_EmeStretch extends Yosin_CommonUi { | |||
|         } | ||||
| 
 | ||||
|         foreach(Child in SpriteList) { | ||||
|             // Addchild(Child); | ||||
|             Canvas.DrawSprite(Child); | ||||
|             Addchild(Child); | ||||
|         } | ||||
| 
 | ||||
|         // 结束绘制 | ||||
|         Canvas.EndDraw(); | ||||
|         // 添加画布 | ||||
|         Addchild(Canvas); | ||||
| 
 | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // 九宫格拉伸 | ||||
| function Yosin_NineBoxStretch(X, Y, width, height, path, imgId) { | ||||
| 
 | ||||
| //九宫格拉伸 | ||||
| class Yosin_NineBoxStretch extends Yosin_CommonUi { | ||||
| 
 | ||||
|     constructor(X, Y, W, H, Path, Idx) { | ||||
|         base.constructor(X, Y, W, H); | ||||
|         DrawBackground(W, H, Path, Idx); | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     // 创建画布 | ||||
|     local Canvas = CL_CanvasObject(); | ||||
|     Canvas.SetPosition(X, Y); | ||||
|     // 重设大小并清空 | ||||
|     Canvas.ResizeAndClear(width, height); | ||||
|     // 开始绘制 | ||||
|     Canvas.BeginDraw(); | ||||
| 
 | ||||
|     // 左上角 | ||||
|     // local backgroundTopLeft = CL_SpriteObject(path, imgId); | ||||
|     local backgroundTopLeft = CL_SpriteObject(path, imgId); | ||||
|     // 上边 | ||||
|     local backgroundTop = CL_SpriteObject(path, imgId + 1); | ||||
|     // 右上角 | ||||
|     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); | ||||
|     // 绘制 | ||||
|     function DrawBackground(width, height, path, imgId) { | ||||
| 
 | ||||
| 
 | ||||
|     // 左上角 | ||||
|     Canvas.DrawSprite(backgroundTopLeft); | ||||
| 
 | ||||
|     local TopLeftSize = backgroundTopLeft.GetSize(); | ||||
|     local TopLeftBottom = TopLeftSize.h; | ||||
|     local TopLeftRight = TopLeftSize.w; | ||||
| 
 | ||||
|     // 中间图片大小 | ||||
|     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 backgroundTopLeft = CL_SpriteObject(path, imgId); | ||||
|         // 上边 | ||||
|         local backgroundTop = CL_SpriteObject(path, imgId + 1); | ||||
|         // 右上角 | ||||
|         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); | ||||
| 
 | ||||
| 
 | ||||
|     local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat(); | ||||
|     local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat(); | ||||
|         // 左上角 | ||||
|         backgroundTopLeft.SetPosition(0, 0); | ||||
|         Addchild(backgroundTopLeft); | ||||
| 
 | ||||
|     // 上边 | ||||
|     backgroundTop.SetScale(scaleW, 1); | ||||
|     backgroundTop.SetPosition(TopLeftRight + 1, 0); | ||||
|     Canvas.DrawSprite(backgroundTop); | ||||
|         // 中间图片大小 | ||||
|         local centerImgSize = backgroundCenter.GetSize(); | ||||
|         local centerImgWidth = centerImgSize.w; | ||||
|         local centerImgHeight = centerImgSize.h; | ||||
| 
 | ||||
|     // 右上角 | ||||
|     backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0); | ||||
|     Canvas.DrawSprite(backgroundTopRight); | ||||
|         local centerWidth = width - backgroundTopLeft.GetSize().w - backgroundTopRight.GetSize().w; | ||||
|         local centerHeight = height - backgroundTopLeft.GetSize().h - backgroundBottomLeft.GetSize().h; | ||||
| 
 | ||||
|     // 左边 | ||||
|     backgroundLeft.SetScale(1, scaleH); | ||||
|     backgroundLeft.SetPosition(0, TopLeftBottom + 1); | ||||
|     Canvas.DrawSprite(backgroundLeft); | ||||
| 
 | ||||
|     // 中间 | ||||
|     backgroundCenter.SetScale(scaleW, scaleH); | ||||
|     // Addchild(backgroundCenter); | ||||
|     backgroundCenter.SetPosition(TopLeftRight + 1, backgroundLeft.Y); | ||||
|     Canvas.DrawSprite(backgroundCenter); | ||||
|         local scaleW = (centerWidth - 1).tofloat() / centerImgWidth.tofloat(); | ||||
|         local scaleH = (centerHeight - 1).tofloat() / centerImgHeight.tofloat(); | ||||
| 
 | ||||
|     // 右边 | ||||
|     backgroundRight.SetScale(1, scaleH); | ||||
|     backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y); | ||||
|     Canvas.DrawSprite(backgroundRight); | ||||
|         // 上边 | ||||
|         backgroundTop.SetPosition(backgroundTopLeft.right() + 1, 0); | ||||
|         backgroundTop.SetScale(scaleW, 1); | ||||
|         Addchild(backgroundTop); | ||||
| 
 | ||||
|     // 左下角 | ||||
|     backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h); | ||||
|     Canvas.DrawSprite(backgroundBottomLeft); | ||||
|         // 右上角 | ||||
|         backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0); | ||||
|         Addchild(backgroundTopRight); | ||||
| 
 | ||||
|     // 下边 | ||||
|     backgroundBottom.SetScale(scaleW, 1); | ||||
|     backgroundBottom.SetPosition(TopLeftRight + 1, backgroundBottomLeft.Y); | ||||
|     Canvas.DrawSprite(backgroundBottom); | ||||
|         // 左边 | ||||
|         local backgroundLeft = CL_SpriteObject(path, imgId + 3); | ||||
|         backgroundLeft.SetPosition(0, backgroundTopLeft.bottom() + 1); | ||||
|         backgroundLeft.SetScale(1, scaleH); | ||||
|         Addchild(backgroundLeft); | ||||
| 
 | ||||
|     // 右下角 | ||||
|     backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y); | ||||
|     Canvas.DrawSprite(backgroundBottomRight ); | ||||
|         // 中间 | ||||
|         backgroundCenter.SetPosition(backgroundLeft.right() + 1, backgroundLeft.Y); | ||||
|         backgroundCenter.SetScale(scaleW, scaleH); | ||||
|         Addchild(backgroundCenter); | ||||
| 
 | ||||
|     // 结束绘制 | ||||
|     Canvas.EndDraw(); | ||||
|     // 添加画布 | ||||
|     // Addchild(Canvas); | ||||
|         // 右边 | ||||
|         backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y); | ||||
|         backgroundRight.SetScale(1, scaleH); | ||||
|         Addchild(backgroundRight); | ||||
| 
 | ||||
|         // 左下角 | ||||
|         backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h); | ||||
|         Addchild(backgroundBottomLeft); | ||||
| 
 | ||||
|         // 下边 | ||||
|         backgroundBottom.SetPosition(backgroundBottomLeft.right() + 1, backgroundBottomLeft.Y); | ||||
|         backgroundBottom.SetScale(scaleW, 1); | ||||
|         Addchild(backgroundBottom); | ||||
| 
 | ||||
|         // 右下角 | ||||
|         backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y); | ||||
|         Addchild(backgroundBottomRight); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     return Canvas; | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // //九宫格拉伸 | ||||
| // class Yosin_NineBoxStretch extends Yosin_CommonUi { | ||||
| 
 | ||||
| //     constructor(X, Y, W, H, Path, Idx) { | ||||
| //         base.constructor(X, Y, W, H); | ||||
| //         DrawBackground(W, H, Path, Idx); | ||||
| //     } | ||||
| 
 | ||||
| 
 | ||||
| //     // 绘制 | ||||
| //     function DrawBackground(width, height, path, imgId) { | ||||
| 
 | ||||
| 
 | ||||
| //         // 创建画布 | ||||
| //         local Canvas = CL_CanvasObject(); | ||||
| //         // 重设大小并清空 | ||||
| //         Canvas.ResizeAndClear(width, height); | ||||
| //         // 开始绘制 | ||||
| //         Canvas.BeginDraw(); | ||||
| 
 | ||||
| //         // 左上角 | ||||
| //         // local backgroundTopLeft = CL_SpriteObject(path, imgId); | ||||
| //         local backgroundTopLeft = CL_SpriteObject(path, imgId); | ||||
| //         // 上边 | ||||
| //         local backgroundTop = CL_SpriteObject(path, imgId + 1); | ||||
| //         // 右上角 | ||||
| //         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); | ||||
| 
 | ||||
| 
 | ||||
| //         // 左上角 | ||||
| //         Canvas.DrawSprite(backgroundTopLeft); | ||||
| 
 | ||||
| //         local TopLeftSize = backgroundTopLeft.GetSize(); | ||||
| //         local TopLeftBottom = TopLeftSize.h; | ||||
| //         local TopLeftRight = TopLeftSize.w; | ||||
| 
 | ||||
| //         // 中间图片大小 | ||||
| //         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.SetScale(scaleW, 1); | ||||
| //         backgroundTop.SetPosition(TopLeftRight + 1, 0); | ||||
| //         Canvas.DrawSprite(backgroundTop); | ||||
| 
 | ||||
| //         // 右上角 | ||||
| //         backgroundTopRight.SetPosition(width - backgroundTopRight.GetSize().w, 0); | ||||
| //         Canvas.DrawSprite(backgroundTopRight); | ||||
| 
 | ||||
| //         // 左边 | ||||
| //         backgroundLeft.SetScale(1, scaleH); | ||||
| //         backgroundLeft.SetPosition(0, TopLeftBottom + 1); | ||||
| //         Canvas.DrawSprite(backgroundLeft); | ||||
| 
 | ||||
| //         // 中间 | ||||
| //         backgroundCenter.SetScale(scaleW, scaleH); | ||||
| //         // Addchild(backgroundCenter); | ||||
| //         backgroundCenter.SetPosition(TopLeftRight + 1, backgroundLeft.Y); | ||||
| //         Canvas.DrawSprite(backgroundCenter); | ||||
| 
 | ||||
| //         // 右边 | ||||
| //         backgroundRight.SetScale(1, scaleH); | ||||
| //         backgroundRight.SetPosition(width - backgroundRight.GetSize().w, backgroundCenter.Y); | ||||
| //         Canvas.DrawSprite(backgroundRight); | ||||
| 
 | ||||
| //         // 左下角 | ||||
| //         backgroundBottomLeft.SetPosition(0, height - backgroundBottomLeft.GetSize().h); | ||||
| //         Canvas.DrawSprite(backgroundBottomLeft); | ||||
| 
 | ||||
| //         // 下边 | ||||
| //         backgroundBottom.SetScale(scaleW, 1); | ||||
| //         backgroundBottom.SetPosition(TopLeftRight + 1, backgroundBottomLeft.Y); | ||||
| //         Canvas.DrawSprite(backgroundBottom); | ||||
| 
 | ||||
| //         // 右下角 | ||||
| //         backgroundBottomRight.SetPosition(width - backgroundBottomRight.GetSize().w, backgroundBottomLeft.Y); | ||||
| //         Canvas.DrawSprite(backgroundBottomRight ); | ||||
| 
 | ||||
| //         // 结束绘制 | ||||
| //         Canvas.EndDraw(); | ||||
| //         // 添加画布 | ||||
| //         Addchild(Canvas); | ||||
| 
 | ||||
| //     } | ||||
| 
 | ||||
| // } | ||||
| 
 | ||||
| //拼接按钮 | ||||
| class Yosin_SplicingButton extends Yosin_CommonUi { | ||||
|     //按钮状态 | ||||
|  | @ -678,14 +552,14 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi { | |||
|     btns = null; | ||||
|     tests = null; | ||||
| 
 | ||||
|     constructor(X, Y, W, titles, path, idx, baseWidth = 48) { | ||||
|     constructor(X, Y, titles, path, idx, selectIndex = 0, baseWidth = 34) { | ||||
|         this.tests = titles; | ||||
|         btns = []; | ||||
|         local btnX = 5; | ||||
|         local btnX = 0; | ||||
|         for (local i = 0; i< titles.len(); i++) { | ||||
| 
 | ||||
|             local textW = FontAssetManager.GenerateNormal(titles[i], true).GetSize().w + 10; | ||||
|             local btnW = baseWidth; | ||||
|             local btnW = baseWidth + 10; | ||||
|             btnW = textW > btnW ? textW : btnW; | ||||
| 
 | ||||
|             local titleBtn = Yosin_StretchTitleButton(btnX, 1, btnW, 19, path, idx, titles[i]); | ||||
|  | @ -705,7 +579,7 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi { | |||
|             }; | ||||
| 
 | ||||
|             btns.push(titleBtn); | ||||
|             btnX += btnW; | ||||
|             btnX += btnW + 1; | ||||
|         } | ||||
| 
 | ||||
|         base.constructor(X, Y, btnX, 21); | ||||
|  | @ -716,27 +590,6 @@ class Yosin_RowMoreTitleBtn extends Yosin_CommonUi { | |||
| 
 | ||||
|         btns[0].SetSelect(true); | ||||
| 
 | ||||
|         // 创建画布 | ||||
|         local Canvas = CL_CanvasObject(); | ||||
|         Canvas.SetPosition(0, 19); | ||||
|         // 重设大小并清空 | ||||
|         Canvas.ResizeAndClear(W, 1); | ||||
|         // 设置填充画刷 用于绘制边框和线条 | ||||
|         Canvas.SetFillBrush(sq_RGBA(66, 61, 59, 250)); | ||||
|         // 设置轮廓画刷 用于绘制边框和线条 | ||||
|         Canvas.SetStrokeBrush(sq_RGBA(66, 61, 59, 250)); | ||||
|         // 开始绘制 | ||||
|         Canvas.BeginDraw(); | ||||
| 
 | ||||
|         // 画线段 | ||||
|         Canvas.DrawLine(0, 1, W, 1); | ||||
| 
 | ||||
|         // 结束绘制 | ||||
|         Canvas.EndDraw(); | ||||
|         // 添加画布 | ||||
|         Addchild(Canvas); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -155,57 +155,6 @@ class _AssetManager_ { | |||
|                         if (Ret == "[/elemental property tag]") break; | ||||
|                         DataTable.elemental_property_tag.rawset(Ret, Data.Get()); | ||||
|                     } | ||||
|                 } else if (Pack == "[rarity frame color idx]") { | ||||
|                     DataTable.rarityframe_color_idx <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/rarity frame color idx]") break; | ||||
|                         DataTable.rarityframe_color_idx.push(Ret); | ||||
|                     } | ||||
|                 } else if (Pack == "[rarity name tag]") { | ||||
|                     DataTable.rarity_name_tag <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/rarity name tag]") break; | ||||
|                         DataTable.rarity_name_tag.push(Ret); | ||||
|                     } | ||||
|                 } else if (Pack == "[rarity color]") { | ||||
|                     DataTable.rarity_color <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/rarity color]") break; | ||||
|                         local color = HexStringToInt(Ret); | ||||
|                         DataTable.rarity_color.push(color); | ||||
|                     } | ||||
|                 } else if (Pack == "[percentage text]") { | ||||
|                     DataTable.percentage_text <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/percentage text]") break; | ||||
|                         DataTable.percentage_text.push(Ret); | ||||
|                     } | ||||
|                 } else if (Pack == "[percentage range boundaries]") { | ||||
|                     DataTable.percentage_range_boundaries <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/percentage range boundaries]") break; | ||||
|                         DataTable.percentage_range_boundaries.push(Ret); | ||||
|                     } | ||||
|                 } else if (Pack == "[trade type text]") { | ||||
|                     DataTable.trade_type_text <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/trade type text]") break; | ||||
|                         DataTable.trade_type_text.push(Ret); | ||||
|                     } | ||||
|                 } else if (Pack == "[trade type color]") { | ||||
|                     DataTable.trade_type_color <- []; | ||||
|                     while (true) { | ||||
|                         local Ret = Data.Get(); | ||||
|                         if (Ret == "[/trade type color]") break; | ||||
|                         local color = HexStringToInt(Ret); | ||||
|                         DataTable.trade_type_color.push(color); | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|         }); | ||||
|  |  | |||
|  | @ -6,53 +6,44 @@ | |||
| */ | ||||
| //装备信息标签类(信息类) | ||||
| if (!GameItem.rawin("EquipmentInfoTag")) GameItem.EquipmentInfoTag <- null; | ||||
| //装备图标窗口 | ||||
| class GameItem.EquipmentIcon extends CL_CanvasObject { | ||||
| 
 | ||||
|     constructor(Equipment) { | ||||
|         base.constructor(); | ||||
|         ResizeAndClear(32, 32); | ||||
|         BeginDraw(); | ||||
|         //构造图标 及图标边框 | ||||
|         if (Equipment.Icon) { | ||||
|             //图标 | ||||
|             local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index); | ||||
|             DrawSpriteFrame(Icon, 0, 0); | ||||
| 
 | ||||
|             //是否封装 | ||||
|             local IsPackage = Equipment.Property ? Equipment.Property.IsPackage : 1; | ||||
|             if (IsPackage && (Equipment.Rarity == 2 || Equipment.Rarity == 3)) { | ||||
|                 local IconFrame = CL_SpriteObject("sprite/interface/lenheartwindowcommon.img", 634); | ||||
|                 IconFrame.SetMode(0); | ||||
|                 DrawSprite(IconFrame); | ||||
|             } | ||||
| 
 | ||||
|             //边框 | ||||
|             local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + GameItem.EquipmentInfoTag.rarityframe_color_idx[Equipment.Rarity]); | ||||
|             DrawSpriteFrame(IconFrame, 0, 0); | ||||
|         } | ||||
|         EndDraw(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| //装备信息窗口 | ||||
| class GameItem.EquipmentInfo extends Yosin_Window { | ||||
| 
 | ||||
|     //装备 | ||||
|     Equipment = null; | ||||
|     //画布 | ||||
|     Canvas = null; | ||||
|     //画布实际高度 | ||||
|     RealCanvasHeight = 0; | ||||
|     //稀有度边框颜色对应Idx表 | ||||
|     //白装 蓝装 紫装 粉装 金装 红装 橙装 | ||||
|     RarityFrameColorIdx = [0, 1, 2, 4, 6, 3, 5]; | ||||
|     //稀有度对应名称 | ||||
|     RarityNameTag = ["普通", "高级", "稀有", "神器", "史诗", "勇者", "传说"]; | ||||
|     //稀有度对应颜色 | ||||
|     RarityColor = [0xffffffff, 0xff68d5ed, 0xffb36bff, 0xffff00f0, 0xffffb100, 0xffff6666, 0xffff5500]; | ||||
|     //品级对应的文字显示 | ||||
|     PercentageText = ["最下级", "下级", "中级", "上级", "最上级"]; | ||||
|     // 定义每个品级对应的数值范围边界 | ||||
|     PercentageRangeBoundaries = [20, 40, 60, 80]; | ||||
|     //交易类型对应的文字显示 | ||||
|     TradeTypeText = ["自由交易", "不可交易", "封装", "账号绑定"]; | ||||
|     //交易类型对应的文字颜色 | ||||
|     TradeTypeColor = [0xffffffff, 0xffbb3332, 0xff4ba157, 0xffff5500]; | ||||
|     //装备类型描述 | ||||
|     GroupNameTag = ["武器", "防具", "饰品", "光环"]; | ||||
| 
 | ||||
| 
 | ||||
|     constructor(Equipment) { | ||||
|         this.Equipment = Equipment.weakref(); | ||||
|         base.constructor(clock() + "EquipmentInfo" + Equipment.Idx, 0, 0, 0, 0, 0); | ||||
| 
 | ||||
|         //210 | ||||
|         Init(); | ||||
| 
 | ||||
|         local background = Yosin_NineBoxStretch(0, 0, 208, RealCanvasHeight + 10, "sprite/interface/lenheartwindowcommon.img", 213); | ||||
|         background.SetZOrder(-1); | ||||
|         Addchild(background); | ||||
|         AddUIChild(background); | ||||
|     } | ||||
| 
 | ||||
|     function Init() { | ||||
|  | @ -64,14 +55,26 @@ class GameItem.EquipmentInfo extends Yosin_Window { | |||
| 
 | ||||
|         //构造图标 及图标边框 | ||||
|         if (Equipment.Icon) { | ||||
|             local Icon = GameItem.EquipmentIcon(Equipment); | ||||
|             Canvas.DrawActor(Icon, 7, 7); | ||||
|             local Icon = CL_SpriteFrameObject(Equipment.Icon.path, Equipment.Icon.index); | ||||
|             Canvas.DrawSpriteFrame(Icon, 7, 7); | ||||
| 
 | ||||
|             local IconFrame = CL_SpriteFrameObject("sprite/item/iconmark.img", 62 + RarityFrameColorIdx[Equipment.Rarity]); | ||||
|             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); | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         //绘制装备名称 | ||||
|         if (Equipment.Name.len() > 0) { | ||||
|             local EquName = FontAssetManager.GenerateNormal(Equipment.Name, false, { | ||||
|                 color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity] | ||||
|                 color = RarityColor[Equipment.Rarity] | ||||
|             }); | ||||
|             Canvas.DrawActor(EquName, 41, 7); | ||||
|         } | ||||
|  | @ -97,8 +100,8 @@ class GameItem.EquipmentInfo extends Yosin_Window { | |||
|         Canvas.DrawActor(PercentageGradeText, 6, 41); | ||||
|         Canvas.DrawActor(PercentageText, 130, 41); | ||||
|         //绘制稀有度名称 | ||||
|         local RarityTagName = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.rarity_name_tag[Equipment.Rarity], false, { | ||||
|             color = GameItem.EquipmentInfoTag.rarity_color[Equipment.Rarity] | ||||
|         local RarityTagName = FontAssetManager.GenerateNormal(RarityNameTag[Equipment.Rarity], false, { | ||||
|             color = RarityColor[Equipment.Rarity] | ||||
|         }); | ||||
|         Canvas.DrawActor(RarityTagName, 210 - RarityTagName.GetSize().w - 6, 41); | ||||
| 
 | ||||
|  | @ -116,8 +119,8 @@ class GameItem.EquipmentInfo extends Yosin_Window { | |||
| 
 | ||||
|         //绘制交易类型 如果有主体属性读取 否则一律为封装 | ||||
|         local TradeType = Equipment.Property ? Equipment.Property.TradeType : 0; | ||||
|         local TradeTypeText = FontAssetManager.GenerateNormal(GameItem.EquipmentInfoTag.trade_type_text[TradeType], false, { | ||||
|             color = GameItem.EquipmentInfoTag.trade_type_color[TradeType] | ||||
|         local TradeTypeText = FontAssetManager.GenerateNormal(TradeTypeText[TradeType], false, { | ||||
|             color = TradeTypeColor[TradeType] | ||||
|         }); | ||||
|         Canvas.DrawActor(TradeTypeText, 210 - TradeTypeText.GetSize().w - 6, 73); | ||||
| 
 | ||||
|  | @ -318,31 +321,30 @@ class GameItem.EquipmentInfo extends Yosin_Window { | |||
| 
 | ||||
|     // 根据数值获取对应的品级文字 | ||||
|     function GetPercentageText(num) { | ||||
|         if (num< GameItem.EquipmentInfoTag.percentage_range_boundaries[0]) { | ||||
|             return GameItem.EquipmentInfoTag.percentage_text[0]; | ||||
|         if (num< PercentageRangeBoundaries[0]) { | ||||
|             return PercentageText[0]; | ||||
|         } | ||||
|         for (local i = 0; i< GameItem.EquipmentInfoTag.percentage_range_boundaries.len(); i++) { | ||||
|             if (num <= GameItem.EquipmentInfoTag.percentage_range_boundaries[i]) { | ||||
|                 return GameItem.EquipmentInfoTag.percentage_text[i + 1]; | ||||
|         for (local i = 0; i< PercentageRangeBoundaries.len(); i++) { | ||||
|             if (num <= PercentageRangeBoundaries[i]) { | ||||
|                 return PercentageText[i + 1]; | ||||
|             } | ||||
|         } | ||||
|         return GameItem.EquipmentInfoTag.percentage_text.top(); | ||||
|         return PercentageText.top(); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // 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(); | ||||
| // } | ||||
| 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(); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|  | @ -550,12 +552,11 @@ class GameItem.Equipment extends GameItem.Item { | |||
| 
 | ||||
|     //获取装备信息窗口 | ||||
|     function GetEquipmentInfoWindow() { | ||||
|         return GameItem.EquipmentInfo(this); | ||||
|     } | ||||
|         if (Property) { | ||||
| 
 | ||||
|     //获取装备图标精灵 | ||||
|     function GetEquipmentIconSprite() { | ||||
|         return GameItem.EquipmentIcon(this); | ||||
|         } else { | ||||
|             return GameItem.EquipmentInfo(this); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //穿戴装备回调 | ||||
|  |  | |||
|  | @ -14,30 +14,22 @@ function TestStage() { | |||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     // local Equ = GameItem.Equipment(27675); | ||||
|     // local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     // Window.SetPosition(100, 80); | ||||
|     // Window.ResetFocus(); | ||||
|     local Equ = GameItem.Equipment(27675); | ||||
|     local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     Window.SetPosition(100, 80); | ||||
|     Window.ResetFocus(); | ||||
| 
 | ||||
|     // local Equ = GameItem.Equipment(101020048); | ||||
|     // local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     // Window.SetPosition(350, 80); | ||||
|     // Window.ResetFocus(); | ||||
|     local Equ = GameItem.Equipment(101020048); | ||||
|     local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     Window.SetPosition(350, 80); | ||||
|     Window.ResetFocus(); | ||||
| 
 | ||||
|     // local Equ = GameItem.Equipment(24144); | ||||
|     // local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     // Window.SetPosition(580, 80); | ||||
|     // Window.ResetFocus(); | ||||
|     local Equ = GameItem.Equipment(24144); | ||||
|     local Window = Equ.GetEquipmentInfoWindow(); | ||||
|     Window.SetPosition(580, 80); | ||||
|     Window.ResetFocus(); | ||||
| 
 | ||||
|     local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); | ||||
| 
 | ||||
|     Window.equipmentPage.Item.ItemCollection.SetItemList([{ | ||||
|         ItemId = 27675 | ||||
|     }, { | ||||
|         ItemId = 101020048 | ||||
|     }, { | ||||
|         ItemId = 24144 | ||||
|     }]); | ||||
|     // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); | ||||
| 
 | ||||
|     // local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 257, 555, 20); | ||||
|     // //大背景 | ||||
|  |  | |||
|  | @ -14,7 +14,7 @@ class Yosin_TopTitle extends Yosin_CommonUi { | |||
|         //内容背景 | ||||
|         if (drawBackground) { | ||||
|             local background = Yosin_NineBoxStretch(-1, 15, W + 1, H - 15, "sprite/interface/lenheartwindowcommon.img", 97); | ||||
|             Addchild(background); | ||||
|             AddUIChild(background); | ||||
|         } | ||||
| 
 | ||||
|         // 标题背景 | ||||
|  |  | |||
|  | @ -5,11 +5,9 @@ | |||
| 文件用途: 背包窗口 | ||||
| */ | ||||
| 
 | ||||
| //local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 262, 555, 20); | ||||
| //local Window = Sq_CreateWindow(_Inventory, "背包窗口", 150, 12, 259, 555, 20); | ||||
| class _Inventory extends Yosin_Window { | ||||
| 
 | ||||
|     equipmentPage = null; | ||||
| 
 | ||||
|     constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH) { | ||||
|         base.constructor(gObjectId, gX, gY, gWidth, gHeight, gTitleH); | ||||
| 
 | ||||
|  | @ -23,7 +21,7 @@ class _Inventory extends Yosin_Window { | |||
|     function RegisterWidget() { | ||||
| 
 | ||||
|         //标题按钮 | ||||
|         local titlesBtn = Yosin_RowMoreTitleBtn(5, 22, 252, ["物品栏", "装扮", "宠物", "护石"], "sprite/interface/lenheartwindowcommon.img", 160); | ||||
|         local titlesBtn = Yosin_RowMoreTitleBtn(10, 25, ["物品栏", "装扮", "宠物", "护石"],"sprite/interface/lenheartwindowcommon.img", 160); | ||||
|         AddUIChild(titlesBtn); | ||||
| 
 | ||||
|         titlesBtn.LBDownOnClick = function(btns, index) { | ||||
|  | @ -31,7 +29,8 @@ class _Inventory extends Yosin_Window { | |||
|         }; | ||||
| 
 | ||||
|         //物品栏 装备页 | ||||
|         equipmentPage = Inventory_EquipmentPage(2, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4); | ||||
|         local equipmentPage = Inventory_EquipmentPage( 0, titlesBtn.bottom() + 4, 300, Height - titlesBtn.bottom() - 4); | ||||
|         // local inventoryItem = InventoryItem( 0, titlesBtn.bottom() + 4, 300, 100); | ||||
|         AddUIChild(equipmentPage); | ||||
| 
 | ||||
| 
 | ||||
|  | @ -44,3 +43,4 @@ class _Inventory extends Yosin_Window { | |||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -8,19 +8,17 @@ | |||
| // 背包装备页面 | ||||
| class Inventory_EquipmentPage extends Yosin_CommonUi { | ||||
| 
 | ||||
|     Item = null; | ||||
| 
 | ||||
|     constructor(x, y, w, h) { | ||||
|         base.constructor(x, y, w, h); | ||||
| 
 | ||||
| 
 | ||||
|         // 人物装备 | ||||
|         local charactersEquipment = Inventory_CharactersEquipment(5, 0); | ||||
|         local charactersEquipment = Inventory_CharactersEquipment(0, 0); | ||||
|         AddUIChild(charactersEquipment); | ||||
| 
 | ||||
|         // 物品栏 | ||||
|         Item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom()); | ||||
|         AddUIChild(Item); | ||||
|         local item = InventoryItem(0, charactersEquipment.bottom(), Width, Height - charactersEquipment.bottom()); | ||||
|         AddUIChild(item); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|  | @ -35,8 +33,6 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi { | |||
|     showOtherEquipment = null; | ||||
|     // 允许更换装备 | ||||
|     allowChangeEquipment = null; | ||||
|     // 画布 | ||||
|     Canvas = null; | ||||
| 
 | ||||
|     constructor(x, y) { | ||||
|         local w = 248; | ||||
|  | @ -46,99 +42,53 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi { | |||
|         showOtherEquipment = true; | ||||
|         allowChangeEquipment = true; | ||||
| 
 | ||||
|         // 创建画布 | ||||
|         Canvas = CL_CanvasObject(); | ||||
|         // 重设大小并清空 | ||||
|         Canvas.ResizeAndClear(w, h); | ||||
|         // 设置填充画刷 用于绘制边框和线条 | ||||
|         // Canvas.SetFillBrush(sq_RGBA(59, 56, 57, 250)); | ||||
|         // 设置轮廓画刷 用于绘制边框和线条 | ||||
|         // Canvas.SetStrokeBrush(sq_RGBA(59, 56, 57, 250)); | ||||
|         // 开始绘制 | ||||
|         Canvas.BeginDraw(); | ||||
| 
 | ||||
|         // 绘制背景 | ||||
|         DrawBackground(); | ||||
| 
 | ||||
|         // 结束绘制 | ||||
|         Canvas.EndDraw(); | ||||
|         // 添加画布 | ||||
|         Addchild(Canvas); | ||||
| 
 | ||||
| 
 | ||||
|         AddButton(); | ||||
|         RegisterBackground(); | ||||
|     } | ||||
| 
 | ||||
|     // 添加按钮 | ||||
|     function AddButton() { | ||||
|         // 称号 | ||||
|         local designation = Yosin_BaseButton(2, Height - 30, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 50); | ||||
|         //点击事件回调 | ||||
|         // permutationBtn.OnClick = function(Button) { | ||||
|         // }.bindenv(this); | ||||
|         AddUIChild(designation); | ||||
| 
 | ||||
|         // 增益强化 | ||||
|         local intensify = Yosin_BaseButton(designation.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128); | ||||
|         AddUIChild(intensify); | ||||
|         // 皮肤仓库 | ||||
|         local skin = Yosin_BaseButton(intensify.right() + 2, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 134); | ||||
|         AddUIChild(skin); | ||||
| 
 | ||||
|         // 穿戴中的装备 | ||||
|         local wear = Yosin_BaseButton(Width - 29, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 172); | ||||
|         AddUIChild(wear); | ||||
|         // 装备特性 | ||||
|         local peculiarity = Yosin_BaseButton(wear.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 203); | ||||
|         AddUIChild(peculiarity); | ||||
|         // 未央环境装备 | ||||
|         // local permutationBtn = Yosin_BaseButton(peculiarity.X - 21, designation.Y, 18, 20 "sprite/interface/newstyle/windows/inventory/inventory.img", 128); | ||||
|         // AddUIChild(permutationBtn); | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|     // 背景 | ||||
|     function DrawBackground() { | ||||
| 
 | ||||
|     function RegisterBackground() { | ||||
|         // 背景图 | ||||
|         local bgimg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventorybackground.img", 0); | ||||
|         // 画布绘制背景 | ||||
|         Canvas.DrawSpriteFrame(bgimg, 0, 0); | ||||
|         local bgimg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventorybackground.img", 0); | ||||
|         bgimg.SetPosition(0, 0); | ||||
|         Addchild(bgimg); | ||||
| 
 | ||||
| 
 | ||||
|         // 装备栏背景 | ||||
|         local equipmentBackground = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21); | ||||
|         Canvas.DrawSpriteFrame(equipmentBackground, 5, 5); | ||||
|         local equipmentBackground = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 21); | ||||
|         equipmentBackground.SetPosition(5, 5); | ||||
|         Addchild(equipmentBackground); | ||||
| 
 | ||||
| 
 | ||||
|         // 顶部光线 | ||||
|         local topLight = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178); | ||||
|         Canvas.DrawSpriteFrame(topLight, Width / 2 - topLight.GetSize().w / 2, 0); | ||||
|         local topLight = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 178); | ||||
|         topLight.SetPosition(Width / 2 - topLight.GetSize().w / 2, 0); | ||||
|         Addchild(topLight); | ||||
| 
 | ||||
|         // todo 角色展示 | ||||
| 
 | ||||
|         // 结婚戒指槽位 | ||||
|         local ringSlotBg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0); | ||||
|         Canvas.DrawSpriteFrame(ringSlotBg, Width / 2 - ringSlotBg.GetSize().w / 2, 5); | ||||
|         local ringSlotBg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory_cn.img", 0); | ||||
|         ringSlotBg.SetPosition(Width / 2 - ringSlotBg.GetSize().w / 2, 5); | ||||
|         Addchild(ringSlotBg); | ||||
| 
 | ||||
|         // 首饰 | ||||
|         if (showOtherEquipment) { | ||||
|             // 辅助装备 | ||||
|             local assist = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19); | ||||
|             Canvas.DrawSpriteFrame(assist, 179, 69); | ||||
|             local assist = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 19); | ||||
|             assist.SetPosition(179, 69); | ||||
|             Addchild(assist); | ||||
| 
 | ||||
|             // 耳环 | ||||
|             local earrings = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122); | ||||
|             Canvas.DrawSpriteFrame(earrings, 179, 102); | ||||
|             local earrings = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 122); | ||||
|             earrings.SetPosition(179, 102); | ||||
|             Addchild(earrings); | ||||
| 
 | ||||
|             // 魔法石 | ||||
|             local MagicStone = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20); | ||||
|             Canvas.DrawSpriteFrame(MagicStone, 211, 101); | ||||
|             local MagicStone = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 20); | ||||
|             MagicStone.SetPosition(211, 101); | ||||
|             Addchild(MagicStone); | ||||
| 
 | ||||
|         } | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -150,34 +100,28 @@ class Inventory_CharactersEquipment extends Yosin_CommonUi { | |||
| 
 | ||||
| // 物品栏 | ||||
| class InventoryItem extends Yosin_CommonUi { | ||||
|     ItemCollection = null; | ||||
| 
 | ||||
|     constructor(gX, gY, gWidth, gHeight) { | ||||
|         base.constructor(gX, gY, gWidth, gHeight); | ||||
| 
 | ||||
|         //物品分类按钮 | ||||
|         local itemBtns = Yosin_RowMoreTitleBtn(3, 4, 252, ["装备", "消耗品", "材料", "副职业", "任务"], "sprite/interface/lenheartwindowcommon.img", 160); | ||||
|         local itemBtns = Yosin_RowMoreTitleBtn(10, 4, ["装备", "消耗品", "材料", "任务"], "sprite/interface/lenheartwindowcommon.img", 160); | ||||
|         AddUIChild(itemBtns); | ||||
| 
 | ||||
|         itemBtns.LBDownOnClick = function(btns, index) { | ||||
|             print(index); | ||||
|         }; | ||||
| 
 | ||||
|         // 物品栏边框 | ||||
|         local itemBg = Yosin_NineBoxStretch(2, itemBtns.bottom(), 253, 245, "sprite/interface/lenheartwindowcommon.img", 97); | ||||
|         Addchild(itemBg); | ||||
| 
 | ||||
|         // 物品栏 | ||||
|         ItemCollection = _ItemCollection(itemBg.X + 7, itemBg.Y + 7, 7); | ||||
|         AddUIChild(ItemCollection); | ||||
|         local itemCollection = itemCollection(5, itemBtns.bottom(), 247, 244, 7, 8); | ||||
|         AddUIChild(itemCollection); | ||||
| 
 | ||||
| 
 | ||||
|         local itemBgBottom = itemBg.bottom(); | ||||
|         // 重量 | ||||
|         local weight = FontAssetManager.GenerateNormal("重量", true, { | ||||
|             color = sq_RGBA(160, 132, 75, 255) | ||||
|         }); | ||||
|         weight.SetPosition(ItemCollection.X + 5, itemBgBottom - weight.GetSize().h - 5); | ||||
|         weight.SetPosition(itemCollection.X + 8, itemCollection.bottom() - 25); | ||||
|         Addchild(weight); | ||||
| 
 | ||||
|         // 重量进度条 | ||||
|  | @ -185,118 +129,7 @@ class InventoryItem extends Yosin_CommonUi { | |||
|         weightSchedule.SetPercentage(0.6); | ||||
|         Addchild(weightSchedule); | ||||
| 
 | ||||
|         // 排列按钮 | ||||
|         local permutationBtn = Yosin_BaseButton(itemBg.right() - 30, itemBgBottom - 26, 28, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 73); | ||||
|         AddUIChild(permutationBtn); | ||||
| 
 | ||||
|         // 设置 | ||||
|         local setBtn = Yosin_BaseButton(permutationBtn.X - 20, permutationBtn.Y, 18, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 77); | ||||
|         AddUIChild(setBtn); | ||||
| 
 | ||||
|         // 搜索 | ||||
|         local saerchBtn = Yosin_BaseButton(setBtn.X - 24, permutationBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 94); | ||||
|         AddUIChild(saerchBtn); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         // 复活币 | ||||
|         local moneyItem = MoneyItem(5, itemBgBottom + 3, 3); | ||||
|         AddUIChild(moneyItem); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     function SetItemList(gItemList) { | ||||
|         ItemCollection.SetItemList(gItemList); | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| // 金币相关数值 | ||||
| class MoneyItem extends Yosin_CommonUi { | ||||
| 
 | ||||
|     constructor(x, y, idx) { | ||||
|         local w = 248; | ||||
|         local h = 49; | ||||
|         base.constructor(x, y, w, h); | ||||
| 
 | ||||
|         local txtColor = sq_RGBA(130, 105, 61, 255); | ||||
| 
 | ||||
|         local bg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 27); | ||||
|         Addchild(bg); | ||||
| 
 | ||||
|         // 复活币个数 | ||||
|         local ReviveNum = FontAssetManager.GenerateNormal("23434个", true, { | ||||
|             color = txtColor | ||||
|         }); | ||||
|         ReviveNum.SetPosition(120 - ReviveNum.GetSize().w, 2); | ||||
|         Addchild(ReviveNum); | ||||
| 
 | ||||
| 
 | ||||
|         // 胜利的证明 | ||||
|         local winNum = FontAssetManager.GenerateNormal("23434个", true, { | ||||
|             color = txtColor | ||||
|         }); | ||||
|         winNum.SetPosition(245 - winNum.GetSize().w, 2); | ||||
|         Addchild(winNum); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|         // 商城 | ||||
|         local storeBtn = Yosin_BaseButton(1, 25, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3); | ||||
|         // local storeBtn = Yosin_BaseButton(0, 0, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 3); | ||||
|         //点击事件回调 | ||||
|         // storeBtn.OnClick = function(Button) { | ||||
|         // }.bindenv(this); | ||||
|         AddUIChild(storeBtn); | ||||
| 
 | ||||
| 
 | ||||
|         // 点券 | ||||
|         local storeNum = FontAssetManager.GenerateNormal("23434点券", true, { | ||||
|             color = txtColor | ||||
|         }); | ||||
|         storeNum.SetPosition(120 - storeNum.GetSize().w, 27); | ||||
|         Addchild(storeNum); | ||||
| 
 | ||||
|         // 金币按钮 | ||||
|         local moneyBtn = Yosin_BaseButton(126, storeBtn.Y, 23, 23 "sprite/interface/newstyle/windows/inventory/inventory.img", 7); | ||||
|         //点击事件回调 | ||||
|         // moneyBtn.OnClick = function(Button) { | ||||
|         // }.bindenv(this); | ||||
|         AddUIChild(moneyBtn); | ||||
| 
 | ||||
|         // 金币数量 | ||||
|         local storeNum = FontAssetManager.GenerateNormal("23434金币", true, { | ||||
|             color = txtColor | ||||
|         }); | ||||
|         storeNum.SetPosition(245 - storeNum.GetSize().w, 27); | ||||
|         Addchild(storeNum); | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| 
 | ||||
| // 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(); | ||||
| // } | ||||
|  | @ -4,151 +4,59 @@ | |||
| 创建日期:2025-01-06	13:50 | ||||
| 文件用途: 物品栏 | ||||
| */ | ||||
| //物品槽 | ||||
| class ItemSlot { | ||||
|     X = null; | ||||
|     Y = null; | ||||
| 
 | ||||
|     //物品对象 | ||||
|     Item = null; | ||||
|     //物品对象的图标 | ||||
|     ItemIcon = null; | ||||
|     //物品对象的详细信息窗口 | ||||
|     ItemInfo = null; | ||||
|     //详细信息窗口显示Flag | ||||
|     ItemInfoShowFlag = false; | ||||
| 
 | ||||
|     constructor() { | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     function SyncPos(x, y) { | ||||
|         this.X = x; | ||||
|         this.Y = y; | ||||
|     } | ||||
| 
 | ||||
|     function SetItem(Item) { | ||||
|         this.Item = Item; | ||||
|         this.ItemIcon = this.Item.GetEquipmentIconSprite(); | ||||
|     } | ||||
| 
 | ||||
|     //生成详细信息 | ||||
|     function GenerateInfo() { | ||||
|         this.ItemInfo = this.Item.GetEquipmentInfoWindow(); | ||||
|     } | ||||
| 
 | ||||
|     //显示详细信息 | ||||
|     function ShowInfo(x, y) { | ||||
|         if (!this.ItemInfo) GenerateInfo(); | ||||
|         this.ItemInfoShowFlag = true; | ||||
|         //设置位置 | ||||
|         this.ItemInfo.SetPosition(x, y); | ||||
|         this.ItemInfo.ResetFocus(); | ||||
|     } | ||||
| 
 | ||||
|     //关闭显示详细信息 | ||||
|     function CloseInfo() { | ||||
|         if (this.ItemInfo) { | ||||
|             this.ItemInfoShowFlag = false; | ||||
|             this.ItemInfo.CloseWindow(); | ||||
|         } | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| // 物品栏 | ||||
| class _ItemCollection extends Yosin_CommonUi { | ||||
| class itemCollection extends Yosin_CommonUi { | ||||
| 
 | ||||
|     // 行 | ||||
|     column = null; | ||||
|     // 列 | ||||
|     row = null; | ||||
|     items = null; | ||||
| 
 | ||||
|     // 悬浮时显示的框 | ||||
|     HoverEffect = null; | ||||
|     //行数 | ||||
|     RowNum = null; | ||||
|     //底层画布对象 | ||||
|     BottomCanvas = null; | ||||
|     //顶层画布对象 | ||||
|     TopCanvas = null; | ||||
|     //物品对象List | ||||
|     ItemList = null; | ||||
|     //当前显示详细信息的物品对象 | ||||
|     CurrentShowItem = null; | ||||
|     //当前鼠标指向的位置 | ||||
|     ItemPos = null; | ||||
|     rect = null; | ||||
| 
 | ||||
|     columnNum = null; | ||||
|     rowNum = null; | ||||
| 
 | ||||
|     constructor(x, y, w, h, columnNum, rowNum) { | ||||
|         base.constructor(x, y, w, h); | ||||
|         this.columnNum = columnNum; | ||||
|         this.rowNum = rowNum; | ||||
| 
 | ||||
|         items = []; | ||||
| 
 | ||||
|         local background = Yosin_NineBoxStretch(-3, -3, w + 6, h + 6, "sprite/interface/lenheartwindowcommon.img", 97); | ||||
|         AddUIChild(background); | ||||
| 
 | ||||
| 
 | ||||
|     constructor(x, y, rowNum) { | ||||
|         this.RowNum = rowNum; | ||||
|         //计算实际需要的高度 | ||||
|         local RealH = 30 * rowNum; | ||||
|         base.constructor(x, y, 239, RealH); | ||||
| 
 | ||||
|         //构造相应数量的槽 | ||||
|         ItemList = array(8 * rowNum, null); | ||||
|         local itemX = 4; | ||||
|         local itemY = 3; | ||||
|         for (local i = 0; i< columnNum; i++) { | ||||
|             local cells = []; | ||||
|             for (local i = 0; i< rowNum; i++) { | ||||
|                 local bg = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49); | ||||
|                 bg.SetPosition(itemX, itemY); | ||||
|                 Addchild(bg); | ||||
| 
 | ||||
|         //整体底板 | ||||
|         InitOverallBasePlate(); | ||||
|                 itemX += 30; | ||||
|                 cells.push(bg); | ||||
| 
 | ||||
| 
 | ||||
|         HoverEffect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131); | ||||
|         HoverEffect.SetZOrder(1); | ||||
|         HoverEffect.SetVisible(false); | ||||
|         Addchild(HoverEffect); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
|     //根据高度绘制整体底板 | ||||
|     function InitOverallBasePlate() { | ||||
|         // 创建画布 | ||||
|         BottomCanvas = CL_CanvasObject(); | ||||
|         // 重设大小并清空 | ||||
|         BottomCanvas.ResizeAndClear(239, this.RowNum * 30); | ||||
|         // 开始绘制 | ||||
|         BottomCanvas.BeginDraw(); | ||||
|         foreach(pos, ItemObj in ItemList) { | ||||
|             local XPos = (pos % 8) * 30; | ||||
|             local YPos = (pos / 8) * 30; | ||||
|             local bg = CL_SpriteFrameObject("sprite/interface/newstyle/windows/inventory/inventory.img", 49); | ||||
|             BottomCanvas.DrawSpriteFrame(bg, XPos, YPos); | ||||
|         } | ||||
|         // 结束绘制 | ||||
|         BottomCanvas.EndDraw(); | ||||
|         // 添加画布 | ||||
|         Addchild(BottomCanvas); | ||||
|     } | ||||
| 
 | ||||
|     //设置道具列表 | ||||
|     function SetItemList(gItemList) { | ||||
|         //如果不存在则构造画布 | ||||
|         if (!TopCanvas) { | ||||
|             // 创建画布 | ||||
|             TopCanvas = CL_CanvasObject(); | ||||
|             // 添加画布 | ||||
|             Addchild(TopCanvas); | ||||
|         } | ||||
| 
 | ||||
|         // 重设大小并清空 | ||||
|         TopCanvas.ResizeAndClear(239, this.RowNum * 30); | ||||
|         // 开始绘制 | ||||
|         TopCanvas.BeginDraw(); | ||||
|         //创建道具 | ||||
|         foreach(Index, ItemObject in gItemList) { | ||||
|             local ItemId = ItemObject.ItemId; | ||||
|             //TODO | ||||
|             local Item = GameItem.Equipment(ItemId); | ||||
|             ItemList[Index] = ItemSlot(); | ||||
|             ItemList[Index].SetItem(Item); | ||||
|         } | ||||
| 
 | ||||
|         foreach(pos, ItemObj in ItemList) { | ||||
|             if (ItemObj) { | ||||
|                 local XPos = (pos % 8) * 30; | ||||
|                 local YPos = (pos / 8) * 30; | ||||
|                 ItemObj.ItemIcon.SetPosition(XPos, YPos); | ||||
|                 TopCanvas.DrawSprite(ItemObj.ItemIcon, XPos, YPos); | ||||
|             } | ||||
|             items.push(cells); | ||||
|             itemX = 3; | ||||
|             itemY += 30; | ||||
|         } | ||||
| 
 | ||||
|         // 结束绘制 | ||||
|         TopCanvas.EndDraw(); | ||||
| 
 | ||||
|         rect = CL_SpriteObject("sprite/interface/newstyle/windows/inventory/inventory.img", 131); | ||||
|         rect.SetVisible(false); | ||||
|         Addchild(rect); | ||||
| 
 | ||||
|     } | ||||
| 
 | ||||
| 
 | ||||
|  | @ -163,76 +71,26 @@ class _ItemCollection extends Yosin_CommonUi { | |||
|             local yy = MousePos_Y - WorldPosition.y; | ||||
|             local column = (yy / 30).tointeger(); | ||||
|             local row = (xx / 30).tointeger(); | ||||
|             //指向的项目位置 | ||||
|             local Idx = column * 8 + row; | ||||
|             ItemPos = Idx; | ||||
|             //如果有道具 | ||||
|             if (ItemList[Idx]) { | ||||
|                 //设置透明度 | ||||
|                 HoverEffect.SetOpacity(0.4); | ||||
|                 //如果没有物品信息窗口 | ||||
|                 if (!ItemList[Idx].ItemInfo) { | ||||
|                     ItemList[Idx].GenerateInfo(); | ||||
|                 } | ||||
|                 if (!ItemList[Idx].ItemInfoShowFlag) { | ||||
|                     //关闭上一个显示的对象 | ||||
|                     if (CurrentShowItem) { | ||||
|                         CurrentShowItem.CloseInfo(); | ||||
|                     } | ||||
|                     //显示详细信息 | ||||
|                     ItemList[Idx].ShowInfo(MousePos_X - 50, MousePos_Y - 150); | ||||
|                     //记录当前显示的对象 | ||||
|                     CurrentShowItem = ItemList[Idx]; | ||||
|                 } | ||||
|             } else { | ||||
|                 //关闭上一个显示的对象 | ||||
|                 if (CurrentShowItem) { | ||||
|                     CurrentShowItem.CloseInfo(); | ||||
|                 } | ||||
|                 HoverEffect.SetOpacity(1); | ||||
| 
 | ||||
| 
 | ||||
|             local inRadius = column< columnNum && row< rowNum; | ||||
|             local change = column != this.column || row != this.row; | ||||
|             // 移动到另一个槽 | ||||
|             if (change && inRadius) { | ||||
| 
 | ||||
|                 this.column = column; | ||||
|                 this.row = row; | ||||
| 
 | ||||
|                 rect.SetVisible(true); | ||||
|                 rect.SetPosition(row * 30, column * 30); | ||||
| 
 | ||||
|             } | ||||
|             //设置悬停槽 | ||||
|             HoverEffect.SetVisible(true); | ||||
|             HoverEffect.SetPosition(row * 30, column * 30); | ||||
| 
 | ||||
|         } else { | ||||
|             HoverEffect.SetVisible(false); | ||||
|             //关闭所有详细信息显示 | ||||
|             foreach(ItemObj in ItemList) { | ||||
|                 if (ItemObj && ItemObj.ItemInfoShowFlag) { | ||||
|                     ItemObj.CloseInfo(); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|     //override | ||||
|     //鼠标左键按下回调 | ||||
|     function OnMouseLbDown(MousePos_X, MousePos_Y) { | ||||
|         if (!Visible) return; | ||||
|         base.OnMouseLbDown(MousePos_X, MousePos_Y); | ||||
|         //关闭显示的对象 | ||||
|         if (CurrentShowItem) { | ||||
|             CurrentShowItem.CloseInfo(); | ||||
|         } | ||||
| 
 | ||||
|         if (ItemPos) { | ||||
|             local Item = ItemList[ItemPos]; | ||||
|             ItemList[ItemPos] = null; | ||||
| 
 | ||||
|             this.column = null; | ||||
|             this.row = null; | ||||
|             rect.SetVisible(false); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| 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(); | ||||
| } | ||||
|  | @ -1,3 +0,0 @@ | |||
| equipment/equipmentinfo.etc  装备信息界面的配置 | ||||
| 
 | ||||
| 角色chr文件新增了[default avatar] 的标签用于设置 角色默认装备 | ||||
		Loading…
	
		Reference in New Issue