CWDG论坛-专业魔兽插件's Archiver

temptemp 发表于 2008-8-7 15:11

我给默认包包+了1个按钮 结果导致战斗不能开包

我给默认包包+了1个按钮 结果导致战斗不能开包函数被band什么原因
代码如下
--local btn = CreateFrame("Button", "aa", ContainerFrame1, SecureActionButtonTemplate");

--aa:SetNormalTexture("Interface\\Icons\\Spell_Holy_Redemption")
--    aa:SetAttribute("type","macro")
--    aa:SetAttribute("macrotext","/cast 分解")

--aa:SetHeight(20);
--aa:SetWidth(20);
--aa:SetPoint("TOPLEFT", ContainerFrame1, "TOPLEFT", 50, -10    );
--aa:Show()
什么错误导致的污染呢
openallbag()不能用了 导致fubar_bag 不能战斗中点开包包
加这个按钮原因 只是因为要经常分解东西 又不想把分解 技能放到 动作条上 放在包的框体上方便很多

Kurax 发表于 2008-8-7 18:51

安全模板不容许在战斗中进行 修改 显示 隐藏 移动 等操作

kurapica 发表于 2008-8-7 22:37

同时,安全控件的parent也会被禁止类似操作。。所以,你无法打开背包了。Parent改成UIParent好了。没必要用ContainerFrame1,最好加上写战斗判断之类。总之就是个麻烦。

temptemp 发表于 2008-8-8 11:58

但是好象类似 jpack的插件 也是在包 框题那里+了个整理按钮的

kurapica 发表于 2008-8-8 13:08

整理不是技能,所以那个就是普通的按钮。

temptemp 发表于 2008-8-8 16:13

看来没办法实现了?

kurapica 发表于 2008-8-8 20:45

也不是。。最简单的一种方法,打开包裹时生成按钮,关闭包裹时,清掉按钮。当然,要加上战斗中的判断。。以这思路扩展下,就可以了。

temptemp 发表于 2008-8-9 00:19

清理怎么搞呢 不会释放,,正想问呢

kurapica 发表于 2008-8-9 22:51

好像不会报错俄。战斗中我也测试过了,可以正常打开包裹的。代码如下
[quote]
local btn = ContainerFMBtn or CreateFrame("Button", "ContainerFMBtn", ContainerFrame1, "SecureActionButtonTemplate");

btn:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up")
local t = btn:GetNormalTexture()
t:SetTexCoord(0, 0.625, 0, 0.6875)

btn:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down")
t = btn:GetPushedTexture()
t:SetTexCoord(0, 0.625, 0, 0.6875)

btn:SetHighlightTexture("Interface\\Buttons\\UI-Panel-Button-Highlight")
t = btn:GetHighlightTexture()
t:SetTexCoord(0, 0.625, 0, 0.6875)

local  btnFontString = btn:CreateFontString(nil, "ARTWORK", "GameFontNormal")
btn:SetFontString(btnFontString)
btn:SetText("分解")

btn:RegisterForClicks("LeftButtonUp","RightButtonUp","MiddleButtonUp","Button4Up","Button5Up")

btn:SetAttribute("*type1","macro")
btn:SetAttribute("macrotext","/cast 分解")

btn:SetHeight(30);
btn:SetWidth(40);
btn:SetPoint("TOPLEFT", ContainerFrame1, "TOPLEFT", 44, -4);

[/quote]

还是蛮好用得。。可以增加一些其他的按钮,比如猎人的喂食之类,考虑全点,就能作一个插件发布了。

temptemp 发表于 2008-8-10 04:33

h呵呵谢谢楼上的写好完整的代码,不过呢 还是一样哦,主要是这个ToggleBackpack()及其ToggleBag()函数会被阻止
而fubar-bagfu是用这2个函数来开包的 如果只是通过点包包及按热键开包就不会有问题
还有,请问下 如何释放对象呢, 在wow里 比如哪个button
还有 SetTexCoord(0, 0.625, 0, 0.6875) 这个函数的4参数意义和8参数意义, 我查不到解释 麻烦了
错误 见图

kurapica 发表于 2008-8-10 11:29

难怪,我就在想,可能出错的原因,只有打开时,重新设定ContainerFrame的位置之类。如果不是用这类插件的话,上面就可以了。如果需要使用的话。清除一个button

btn:ClearAllPoints()
btn:Hide()

也不用清除掉,就这样,让它不附着ContainerFrame1,并且隐藏掉就可以了。然后打开背包,并且不处于战斗状态时,在设置一下Points,Show出来。你试试吧,我没用过fubar。不测试了。

SetTexCoord用来截取材质的,前4个参数就是left, right, top,bottom四个方向,0-1表示范围。不算很容易用,我这里使用的值也是根据Blz的模板定义来使用的。见 UIPanelTemplates.xml。

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.