Advertisement
Guest User

Untitled

a guest
Jul 7th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 6.15 KB | None | 0 0
  1. TestHUD = {}
  2.  
  3. TestHUD.addonName = "TestHUD"
  4.  
  5. TestHUD.questTrackerAlpha = 0.5
  6. TestHUD.subtitlesAlpha = 0.5
  7. TestHUD.compassAlpha = 0.5
  8. TestHUD.reticleAlpha = 0.5
  9. TestHUD.chatAlpha = 0.5
  10. TestHUD.performanceMetersAlpha = 0.1
  11.  
  12. TestHUD.questTrackerScale = 0.8
  13. TestHUD.subtitlesScale = 0.8
  14. TestHUD.compassScale = 0.8
  15. TestHUD.reticleScale = 0.8
  16. TestHUD.chatScale = 0.75
  17. TestHUD.performanceMetersScale = 0.8
  18.  
  19. function TestHUD.QuestTracker()
  20.   -- Position
  21.   ZO_FocusedQuestTrackerPanel:ClearAnchors()
  22.   ZO_FocusedQuestTrackerPanel:SetAnchor(TOPRIGHT, GuiRoot, TOPRIGHT, -40, 120)
  23.  
  24.   -- Scale
  25.   ZO_FocusedQuestTrackerPanel:SetScale(TestHUD.questTrackerScale)
  26.  
  27.   -- Alpha
  28.   ZO_FocusedQuestTrackerPanel:SetAlpha(TestHUD.questTrackerAlpha)
  29.   ZO_FocusedQuestTrackerPanelContainerQuestContainerAssisted:SetAlpha(TestHUD.questTrackerAlpha)
  30.   ZO_FocusedQuestTrackerPanelContainerQuestContainerTrackedHeader1:SetAlpha(TestHUD.questTrackerAlpha)
  31.  
  32.   -- Remove Hotkey Icon
  33.   ZO_FocusedQuestTrackerPanelContainerQuestContainerAssistedKeyLabel:SetParent(GuiRoot)
  34. end
  35.  
  36. function TestHUD.Subtitles()
  37.   -- Position
  38.   ZO_Subtitles:ClearAnchors()
  39.   ZO_Subtitles:SetAnchor(BOTTOM, GuiRoot, BOTTOM, 0, -200)
  40.  
  41.   -- Scale
  42.   ZO_Subtitles:SetScale(TestHUD.subtitlesScale)
  43.  
  44.   -- Alpha
  45.   ZO_Subtitles:SetAlpha(TestHUD.subtitlesAlpha)
  46.  
  47.   -- Remove Background
  48.   ZO_SubtitlesTextBackground:SetParent(GuiRoot)
  49.   ZO_SubtitlesTextBackgroundLeft:SetParent(GuiRoot)
  50.   ZO_SubtitlesTextBackgroundRight:SetParent(GuiRoot)
  51. end
  52.  
  53. function TestHUD.Compass()
  54.   -- Scale Compass
  55.   ZO_CompassContainer:SetInheritScale(false)
  56.   ZO_CompassContainer:SetInheritAlpha(false)
  57.   ZO_CompassFrame:SetAlpha(TestHUD.compassAlpha)
  58.   ZO_CompassFrame:SetScale(TestHUD.compassScale)
  59.  
  60.   -- Compass Icons
  61.   ZO_CompassContainer:SetInheritScale(false)
  62.   ZO_CompassContainer:SetInheritAlpha(false)
  63.   ZO_CompassContainer:SetScale(1.1875*TestHUD.compassScale)
  64.   ZO_CompassContainer:SetAlpha(TestHUD.compassAlpha)
  65.  
  66.   -- Compass Background (Center)
  67.   ZO_CompassFrameCenter:SetAlpha(0.2)
  68.   ZO_CompassFrameCenter:SetDesaturation(1)
  69.   -- Compass Background (Left)
  70.   ZO_CompassFrameLeft:SetAlpha(0.2)
  71.   ZO_CompassFrameLeft:SetDesaturation(1)
  72.   -- Compass Background (Right)
  73.   ZO_CompassFrameRight:SetAlpha(0.2)
  74.   ZO_CompassFrameRight:SetDesaturation(1)
  75. end
  76.  
  77. function TestHUD.Reticle()
  78.   -- Reticle Graphic (White Triangles)
  79.   ZO_ReticleContainerReticle:SetAlpha(TestHUD.reticleAlpha)
  80.   ZO_ReticleContainerReticle:SetScale(TestHUD.reticleScale/2)
  81.  
  82.   -- Remove the "E" Button Icon
  83.   ZO_ReticleContainerInteractKeybindButton:SetParent(GuiRoot)
  84.  
  85.   -- Interaction Text Container (Position)
  86.   ZO_ReticleContainerInteract:SetDimensions(0, 0)
  87.   ZO_ReticleContainerInteract:SetResizeToFitDescendents(true)
  88.   ZO_ReticleContainerInteract:ClearAnchors()
  89.   ZO_ReticleContainerInteract:SetAnchor(TOP, GuiRoot, CENTER, 0, 50)
  90.   ZO_ReticleContainerInteract:SetAlpha(TestHUD.reticleAlpha)
  91.   ZO_ReticleContainerInteract:SetScale(TestHUD.reticleScale)
  92.  
  93.   -- Name of the Item (Container, NPC's Name, etc)
  94.   ZO_ReticleContainerInteractContext:ClearAnchors()
  95.   ZO_ReticleContainerInteractContext:SetAnchor(TOP, ZO_ReticleContainerInteract, TOP)
  96.   ZO_ReticleContainerInteractContext:SetWidth(200)
  97.   ZO_ReticleContainerInteractContext:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
  98.   ZO_ReticleContainerInteractContext:SetScale(TestHUD.reticleScale)
  99.  
  100.   -- Name of the Action (Talk, Open, etc)
  101.   ZO_ReticleContainerInteractKeybindButtonNameLabel:ClearAnchors()
  102.   ZO_ReticleContainerInteractKeybindButtonNameLabel:SetAnchor(TOP, ZO_ReticleContainerInteractContext, BOTTOM, 0, 5)
  103.   ZO_ReticleContainerInteractKeybindButtonNameLabel:SetWidth(250)
  104.   ZO_ReticleContainerInteractKeybindButtonNameLabel:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
  105.   ZO_ReticleContainerInteractKeybindButtonNameLabel:SetParent(ZO_ReticleContainerInteract)
  106.   ZO_ReticleContainerInteractKeybindButtonNameLabel:SetScale(TestHUD.reticleScale)
  107.  
  108.   -- Extra Info (Fishing Hole Type, etc)
  109.   ZO_ReticleContainerInteractAdditionalInfo:ClearAnchors()
  110.   ZO_ReticleContainerInteractAdditionalInfo:SetAnchor(TOP, ZO_ReticleContainerInteractKeybindButtonNameLabel, BOTTOM, 0, 5)
  111.   ZO_ReticleContainerInteractAdditionalInfo:SetWidth(250)
  112.   ZO_ReticleContainerInteractAdditionalInfo:SetHorizontalAlignment(TEXT_ALIGN_CENTER)
  113.   ZO_ReticleContainerInteractAdditionalInfo:SetScale(TestHUD.reticleScale)
  114. end
  115.  
  116. function TestHUD.Chat()
  117.   -- Remove the Maximized Grunge Background
  118.   ZO_ChatWindowBg:SetParent(GuiRoot)
  119.  
  120.   -- Remove the Minimized Grunge Texture
  121.   ZO_ChatWindowMinBarBG:SetParent(GuiRoot)
  122.  
  123.   -- Set Minimized Size
  124.   ZO_ChatWindowMinBar:SetScale(TestHUD.chatScale)
  125.   ZO_ChatWindowMinBar:SetAlpha(TestHUD.chatAlpha)
  126.   ZO_ChatWindowMinBar:SetAnchor(BOTTOMLEFT, GuiRoot, BOTTOMLEFT, 0, -120)
  127. end
  128.  
  129. function TestHUD.PerformanceMeters()
  130.   -- Size and scale
  131.   ZO_PerformanceMeters:SetScale(TestHUD.performanceMetersScale)
  132.   ZO_PerformanceMeters:SetAlpha(TestHUD.performanceMetersAlpha)
  133.  
  134.   -- Remove background
  135.   ZO_PerformanceMetersBg:SetParent(GuiRoot)
  136. end
  137.  
  138. function TestHUD.OnLoad(eventCode, addonName)
  139.   if (TestHUD.addonName ~= addonName) then
  140.     return
  141.   end
  142.  
  143.   zo_callLater(function () TestHUD.QuestTracker() end, 1000)
  144.   zo_callLater(function () TestHUD.Subtitles() end, 1000)
  145.   zo_callLater(function () TestHUD.Compass() end, 1000)
  146.   zo_callLater(function () TestHUD.Reticle() end, 1000)
  147.   zo_callLater(function () TestHUD.Chat() end, 1000)
  148.   zo_callLater(function () TestHUD.PerformanceMeters() end, 1000)
  149.  
  150.   EVENT_MANAGER:UnregisterForEvent(TestHUD.addonName, EVENT_ADD_ON_LOADED)
  151. end
  152.  
  153. EVENT_MANAGER:RegisterForEvent("TestHUD", EVENT_ADD_ON_LOADED, TestHUD.OnLoad)
  154.  
  155. -- Undo rollbacks caused during main menu transitions
  156. SCENE_MANAGER:GetScene("hud"):RegisterCallback("StateChange", function(oldState, newState)
  157.   if newState == "showing" then
  158.     zo_callLater(function () TestHUD.Compass() end, 250)
  159.     zo_callLater(function () TestHUD.PerformanceMeters() end, 250)
  160.   end
  161. end)
  162.  
  163. -- Undo rollback caused by changing tracked quest
  164. FOCUSED_QUEST_TRACKER:RegisterCallback("QuestTrackerTrackingStateChanged",  function ()
  165.   zo_callLater(function () TestHUD.QuestTracker() end, 0)
  166. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement