29d93c0 - change raid frame position as mage
[wowui.git] / kehys / player.lua
index 20f4c4a..7fcc04c 100644 (file)
@@ -36,8 +36,8 @@ local function initPlayer(parent, width, height, update, event)
     f:SetAttribute("vehicle", "vehicle");
     f.unit = "player";
     f.displayed = "player";
-    f.vehicle = "vehicle"
-    f.nonraid = true;
+    f.vehicle = "vehicle";
+    f.constant = true;
     f.prev = {};
 
     playerUpdate = function()
@@ -63,7 +63,7 @@ local function initPlayer(parent, width, height, update, event)
     f.health:SetPoint("TOPLEFT", f.background, "TOPLEFT");
     f.health:SetPoint("BOTTOMLEFT", f.background, "LEFT", 0, -height/8);
     f.health:SetTexture(barTexture);
-    f.health:SetVertexColor(0.8, 0.8, 0.8);
+    f.health:SetVertexColor(0.7, 0.7, 0.7);
     f.health:Hide();
     f.mana = f:CreateTexture(nil, "BORDER");
     f.mana:SetPoint("TOPLEFT", f.background, "LEFT", 0, -height/8);
@@ -93,11 +93,11 @@ local function initPlayer(parent, width, height, update, event)
     f.healabsorb = f:CreateTexture(nil, "ARTWORK");
     f.healabsorb:SetPoint("TOPRIGHT", f.health, "TOPRIGHT");
     f.healabsorb:SetPoint("BOTTOMRIGHT", f.health, "BOTTOMRIGHT");
-    f.healabsorb:SetColorTexture(0.1, 0.1, 0.1);
+    f.healabsorb:SetColorTexture(0.1, 0.1, 0.1, 0);
     f.healabsorb:Hide();
     f.text = f:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
     f.text:SetPoint("RIGHT", f, "RIGHT", -2, 8);
-    f.text:SetFont(STANDARD_TEXT_FONT, 13);
+    f.text:SetFont(STANDARD_TEXT_FONT, 15);
     f.text:Hide();
     f.targeticon = f:CreateTexture(nil, "OVERLAY");
     f.targeticon:SetPoint("CENTER", f, "TOP", 0, -1);
@@ -142,21 +142,31 @@ local function initPet(parent, width, height, update, event)
     f.unit = "pet";
     f.displayed = "pet";
     f.vehicle = "player"
-    f.nonraid = true;
     f.prev = {};
 
     petUpdate = function()
-        CTimerAfter(0.1, petUpdate);
-        update(f);
+        if f.updating then
+            CTimerAfter(0.1, petUpdate);
+            return update(f);
+        end
     end
     f:SetScript("OnEvent", event);
+    f:SetScript("OnHide", function()
+        f:UnregisterAllEvents();
+        f.updating = false;
+        f.prev = {};
+    end);
+    f:SetScript("OnShow", function()
+        addon.RegisterEvents(f);
+        addon.RegisterUnitEvents(f);
+        event(f, "UPDATE_ALL_BARS");
+        f.updating = true;
+        petUpdate();
+    end);
     f:RegisterForClicks("AnyDown");
     f:SetAttribute("*type1", "target");
     f:SetAttribute("*type2", "togglemenu");
     f:SetAttribute("toggleForVehicle", true);
-    RegisterUnitWatch(f);
-    RegisterStateDriver(f, "vehicleui", "[vehicleui] vehicle; no");
-    f:SetAttribute("_onstate-vehicleui", vehicletoggle);
 
     -- create visuals
     f.base = f:CreateTexture(nil, "BACKGROUND");
@@ -169,7 +179,7 @@ local function initPet(parent, width, height, update, event)
     f.health:SetPoint("TOPLEFT", f.background, "TOPLEFT");
     f.health:SetPoint("BOTTOMLEFT", f.background, "BOTTOMLEFT");
     f.health:SetTexture(barTexture);
-    f.health:SetVertexColor(0.8, 0.8, 0.8);
+    f.health:SetVertexColor(0.7, 0.7, 0.7);
     f.health:Hide();
     f.shield = f:CreateTexture(nil, "BORDER");
     f.shield:SetPoint("TOPLEFT", f.health, "TOPRIGHT");
@@ -195,8 +205,8 @@ local function initPet(parent, width, height, update, event)
     f.name = f:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
     f.name:SetPoint("LEFT", f, "LEFT", 5, 0);
     f.text = f:CreateFontString(nil, "OVERLAY", "GameFontHighlight");
-    f.text:SetPoint("RIGHT", f, "RIGHT", -5, 0);
-    f.text:SetFont(STANDARD_TEXT_FONT, 13);
+    f.text:SetPoint("RIGHT", f, "RIGHT", -3, -1);
+    f.text:SetFont(STANDARD_TEXT_FONT, 10);
     f.text:Hide();
     f.targeticon = f:CreateTexture(nil, "OVERLAY");
     f.targeticon:SetPoint("CENTER", f, "TOP", 0, -1);
@@ -205,11 +215,9 @@ local function initPet(parent, width, height, update, event)
     f.targeticon:SetTexture("Interface\\TARGETINGFRAME\\UI-RaidTargetingIcons");
     f.targeticon:Hide();
 
-    addon.RegisterEvents(f);
-    addon.RegisterUnitEvents(f);
-    event(f, "UPDATE_ALL_BARS");
-    petUpdate();
-    f:Show();
+    RegisterUnitWatch(f);
+    RegisterStateDriver(f, "vehicleui", "[vehicleui] vehicle; no");
+    f:SetAttribute("_onstate-vehicleui", vehicletoggle);
 end
 
 CFrame:SetScript("OnEvent", function(self)