Shestak UI
Go Back   Shestak UI > Interface Forums > English Community > General Discussion

General Discussion The place for World of Warcraft discussions that don’t fit into any other forum.

Advertising

 
Thread Tools
Old 12.09.2012, 12:18   #1
 Assistant User Information

leg883's Avatar
Question How to hide in combat

How to hide in combat ?
lua Code [Select]:
local Model = CreateFrame("PlayerModel", "Model", UIParent)
function Model:Init()
   self.scale = 3
   self.x = 0
   self.y = 0
   self.z = 0
   self.width = 130
   self.height = 200
   self:SetModelScale(self.scale)
   self:SetSize(self.width, self.height)
   self:SetPoint("CENTER")
   self:SetCamera(1)
   self:SetFrameStrata("BACKGROUND")  --設置為背景
   self:SetFrameLevel(0)
   self:SetPoint("BOTTOMRIGHT",UIParent,"BOTTOMRIGHT",-23,160)
end
function Model:OnEvent()
   self:RegisterEvent("PLAYER_TARGET_CHANGED")
   self:SetScript("OnEvent", function(self)
      if (UnitExists("target")) then
         self:SetUnit("target")
         self:Show()
         self.x = 1.5
         self.y = 0
         self.z = 0
         self:SetPosition(self.x, self.y, self.z)
      else
         self:ClearModel()
         self:Hide()
      end
   end)
end
function Model:OnUpdate()
    self:SetScript("OnUpdate", function(self, elapsed)
        self:SetFacing(self:GetFacing() + math.pi * elapsed / 2)
    end)
end

function Model:OnMouseWheel()
   self:EnableMouseWheel(true)
   self:SetScript("OnMouseWheel", function(self, d)
      if IsAltKeyDown() then
         if d > 0 then
            self.y = self.y + .25
            self:SetPosition(self.x, self.y, self.z)
         elseif d < 0 then
            self.y = self.y - .25
            self:SetPosition(self.x, self.y, self.z)
         end
      elseif IsControlKeyDown() then
         if d > 0 then
            self.z = self.z + .25
            self:SetPosition(self.x, self.y, self.z)
         elseif d < 0 then
            self.z = self.z - .25
            self:SetPosition(self.x, self.y, self.z)
         end
      else
         if d > 0 then
            self.x = self.x + .25
            self:SetPosition(self.x, self.y, self.z)
         elseif d < 0 then
            self.x = self.x - .25
            self:SetPosition(self.x, self.y, self.z)
         end
      end
   end)
end

function Model:OnDrag()
   self:EnableMouse(true)
   self:SetMovable(true)
   self:RegisterForDrag("LEFTBUTTON")
   self:SetScript("OnDragStart", function(self)
      self:StartMoving()
   end)
   self:SetScript("OnDragStop", function(self)
      self:StopMovingOrSizing()
   end)
end
Model:Init()
Model:OnEvent()
Model:OnUpdate()
Model:OnMouseWheel()
--Model:OnDrag()
 
Old 12.09.2012, 12:18   #1.5 - Disable Ads

Advertise on this site

Old 12.09.2012, 12:52   #2
Shestak
 Junior Member User Information

Shestak's Avatar
https://github.com/Shestak/ShestakUI...niMap.lua#L287
Old 12.09.2012, 14:05   #3
leg883
 Assistant User Information

leg883's Avatar
thx

Tags
avatar

Thread Tools


Similar Threads
Thread Thread Starter Forum Replies Last Post
xCT (lightweight combat text) affli Technical Support 260 05.07.2014 22:10
Disable Combat Text eponectarine Technical Support 3 24.08.2012 19:27
Quest Tracking and Combat Text Sprites Technical Support 3 10.04.2012 09:53
Map / Quest icons dissapearing when entering combat? Blitzed Technical Support 2 07.01.2011 21:00
Text combat Guaro Technical Support 1 20.07.2010 02:44


Mobile Style Русский English Deutsch Italian Chinese