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

doskoi 发表于 2007-10-27 14:11

请教使用了安全模板的窗体,如目标的目标如何控制它的开关?

对于使用安全模板继承的窗体不熟,不知道怎么控制它

比如这么一个ToT窗体

    <Button name="ToT_Frame"  frameStrata="LOW" inherits="SecureUnitButtonTemplate" parent="UIParent">
        <Size>
            <AbsDimension x="96" y="48"/>
        </Size>
        <Anchors>
            <Anchor point="TOP" relativeTo="TargetFrame" relativePoint="BOTTOM">
                <Offset>
                    <AbsDimension x="50" y="24"/>
                </Offset>
            </Anchor>
        </Anchors>
        <HitRectInsets>
            <AbsInset left="3" right="33" top="3" bottom="3"/>
        </HitRectInsets>
        <Attributes>
            <Attribute name="type" type="string" value="target" />
            <Attribute name="unit" type="string" value="targettarget" />
        </Attributes>
        <Layers>
            <Layer level="ARTWORK">
                <Texture name="$parentPortrait">
                    <Size x="27" y="27"/>
                    <Anchors>
                        <Anchor point="TOPLEFT">
                            <Offset x="6" y="-5"/>
                        </Anchor>
                    </Anchors>
                </Texture>
            </Layer>
        </Layers>
        <Frames>
            <Frame setAllPoints="true">
                <Frames>
                    <Frame setAllPoints="true">
                        <Layers>
                            <Layer level="ARTWORK">
                                <Texture name="$parentTexture" file="Interface\TargetingFrame\UI-SmallTargetingFrame">
                                    <Size x="96" y="48"/>
                                    <Anchors>
                                        <Anchor point="TOPLEFT">
                                            <Offset x="0" y="-2"/>
                                        </Anchor>
                                    </Anchors>
                                </Texture>
                                <FontString name="$parentName" inherits="GameFontNormalSmall" justifyH="LEFT">
                                    <Size x="100" y="10"/>
                                    <Anchors>
                                        <Anchor point="BOTTOMLEFT">
                                            <Offset x="33" y="33"/>
                                        </Anchor>
                                    </Anchors>
                                </FontString>
                                <FontString name="$parentPercent" inherits="GameTooltipTextSmall">
                                    <Anchors>
                                        <Anchor point="BOTTOMLEFT">
                                            <Offset>
                                                <AbsDimension x="10" y="2"/>
                                            </Offset>
                                        </Anchor>
                                    </Anchors>
                                </FontString>
                            </Layer>
                        </Layers>
                    </Frame>
                </Frames>
            </Frame>
            <StatusBar name="$parentHealthBar" inherits="TextStatusBar">
                <Size x="52" y="5"/>
                <Anchors>
                    <Anchor point="TOPLEFT">
                        <Offset x="34" y="-18"/>
                    </Anchor>
                </Anchors>
                <Scripts>
                    <OnEvent>
                        UnitFrameHealthBar_Update(this, arg1);
                    </OnEvent>
                </Scripts>
                <BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
            </StatusBar>
            <StatusBar name="$parentManaBar" inherits="TextStatusBar">
                <Size x="52" y="5"/>
                <Anchors>
                    <Anchor point="TOPLEFT">
                        <Offset x="34" y="-24"/>
                    </Anchor>
                </Anchors>
                <Scripts>
                    <OnEvent>
                        UnitFrameManaBar_Update(this, arg1);
                    </OnEvent>
                </Scripts>
                <BarTexture file="Interface\TargetingFrame\UI-StatusBar"/>
            </StatusBar>
        </Frames>
        <Scripts>
            <OnLoad>
                local pretot = "ToT_Frame";
                UnitFrame_Initialize("targettarget", getglobal(pretot.."Name"),getglobal(pretot.."Portrait"),
                       getglobal(pretot.."HealthBar"), getglobal(pretot.."HealthBarText"),
                       getglobal(pretot.."ManaBar"), getglobal(pretot.."ManaBarText"))
                SetTextStatusBarTextZeroText(getglobal(pretot.."HealthBar"), TEXT(DEAD))
                RegisterUnitWatch(this)
            </OnLoad>
            <OnEvent>
                UnitFrame_OnEvent(event);
            </OnEvent>
            <OnLeave>
                UnitFrame_OnLeave();
            </OnLeave>
            <OnShow>
                UnitFrame_Update()
            </OnShow>
            <OnHide>
                TOTOT_Name = nil
            </OnHide>
            <OnUpdate>
                if not UnitExists("targettarget") then return end
                if TOT_Name ~= UnitName("targettarget") then
                    TOT_Name = UnitName("targettarget")
                    SetPortraitTexture(this.portrait, this.unit)
                    this.name:SetText(TOT_Name)
                end
                UnitFrameHealthBar_Update(this.healthbar, this.unit)
                UnitFrameManaBar_Update(this.manabar, this.unit)
            </OnUpdate>
        </Scripts>
    </Button>

我想能够在自己的设置里面控制目标的目标一个开关
但是不知道怎么写,请熟习的朋友指教!
唯一能想到的就是UnregisterUnitWatch
貌似不管用..会有一个tot窗口残留在那里,动也不动了....

simonw 发表于 2007-10-28 11:26

在非战斗状态下, UnregisterUnitWatch 然后hide 应该可以

页: [1]

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