режим предателя + UI референсы и DragonUI
This commit is contained in:
@@ -0,0 +1,768 @@
|
||||
|
||||
-- speed optimizations (mostly so update functions are faster)
|
||||
local _G = getfenv(0);
|
||||
local date = _G.date;
|
||||
local abs = _G.abs;
|
||||
local min = _G.min;
|
||||
local max = _G.max;
|
||||
local floor = _G.floor;
|
||||
local mod = _G.mod;
|
||||
local tonumber = _G.tonumber;
|
||||
local gsub = _G.gsub;
|
||||
local GetCVar = _G.GetCVar;
|
||||
local SetCVar = _G.SetCVar;
|
||||
local GetGameTime = _G.GetGameTime;
|
||||
|
||||
-- private data
|
||||
local SEC_TO_MINUTE_FACTOR = 1/60;
|
||||
local SEC_TO_HOUR_FACTOR = SEC_TO_MINUTE_FACTOR*SEC_TO_MINUTE_FACTOR;
|
||||
|
||||
local WARNING_SOUND_TRIGGER_OFFSET = -2 * SEC_TO_MINUTE_FACTOR; -- play warning sound 2 sec before alarm sound
|
||||
|
||||
local Settings = {
|
||||
militaryTime = false;
|
||||
localTime = false;
|
||||
|
||||
alarmHour = 12;
|
||||
alarmMinute = 00;
|
||||
alarmAM = true;
|
||||
alarmMessage = "";
|
||||
alarmEnabled = false;
|
||||
};
|
||||
|
||||
local CVAR_USE_MILITARY_TIME = "timeMgrUseMilitaryTime";
|
||||
local CVAR_USE_LOCAL_TIME = "timeMgrUseLocalTime";
|
||||
local CVAR_ALARM_TIME = "timeMgrAlarmTime";
|
||||
local CVAR_ALARM_MESSAGE = "timeMgrAlarmMessage";
|
||||
local CVAR_ALARM_ENABLED = "timeMgrAlarmEnabled";
|
||||
|
||||
|
||||
-- public data
|
||||
MAX_TIMER_SEC = 99*3600 + 59*60 + 59; -- 99:59:59
|
||||
|
||||
|
||||
local function _TimeManager_GetCurrentMinutes(localTime)
|
||||
local currTime;
|
||||
if ( localTime ) then
|
||||
local dateInfo = date("*t");
|
||||
local hour, minute = dateInfo.hour, dateInfo.min;
|
||||
currTime = minute + hour*60;
|
||||
else
|
||||
local hour, minute = GetGameTime();
|
||||
currTime = minute + hour*60;
|
||||
end
|
||||
return currTime;
|
||||
end
|
||||
|
||||
-- CVar helpers
|
||||
local function _TimeManager_Setting_SetBool(cvar, field, value)
|
||||
if ( value ) then
|
||||
SetCVar(cvar, "1");
|
||||
else
|
||||
SetCVar(cvar, "0");
|
||||
end
|
||||
Settings[field] = value;
|
||||
end
|
||||
|
||||
local function _TimeManager_Setting_Set(cvar, field, value)
|
||||
SetCVar(cvar, value);
|
||||
Settings[field] = value;
|
||||
end
|
||||
|
||||
local function _TimeManager_Setting_SetTime()
|
||||
local alarmTime = GameTime_ComputeMinutes(Settings.alarmHour, Settings.alarmMinute, Settings.militaryTime, Settings.alarmAM);
|
||||
SetCVar(CVAR_ALARM_TIME, alarmTime);
|
||||
end
|
||||
|
||||
|
||||
-- TimeManagerFrame
|
||||
|
||||
function TimeManager_Toggle()
|
||||
if ( TimeManagerFrame:IsShown() ) then
|
||||
TimeManagerFrame:Hide();
|
||||
else
|
||||
TimeManagerFrame:Show();
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerFrame_OnLoad(self)
|
||||
Settings.militaryTime = GetCVar(CVAR_USE_MILITARY_TIME) == "1";
|
||||
Settings.localTime = GetCVar(CVAR_USE_LOCAL_TIME) == "1";
|
||||
local alarmTime = tonumber(GetCVar(CVAR_ALARM_TIME));
|
||||
Settings.alarmHour = floor(alarmTime / 60);
|
||||
Settings.alarmMinute = max(min(alarmTime - Settings.alarmHour*60, 59), 0);
|
||||
Settings.alarmHour = max(min(Settings.alarmHour, 23), 0);
|
||||
if ( not Settings.militaryTime ) then
|
||||
if ( Settings.alarmHour == 0 ) then
|
||||
Settings.alarmHour = 12;
|
||||
Settings.alarmAM = true;
|
||||
elseif ( Settings.alarmHour < 12 ) then
|
||||
Settings.alarmAM = true;
|
||||
elseif ( Settings.alarmHour == 12 ) then
|
||||
Settings.alarmAM = false;
|
||||
else
|
||||
Settings.alarmHour = Settings.alarmHour - 12;
|
||||
Settings.alarmAM = false;
|
||||
end
|
||||
end
|
||||
Settings.alarmMessage = GetCVar(CVAR_ALARM_MESSAGE);
|
||||
Settings.alarmEnabled = GetCVar(CVAR_ALARM_ENABLED) == "1";
|
||||
|
||||
self:SetFrameLevel(self:GetFrameLevel() + 2);
|
||||
|
||||
UIDropDownMenu_Initialize(TimeManagerAlarmHourDropDown, TimeManagerAlarmHourDropDown_Initialize);
|
||||
UIDropDownMenu_SetWidth(TimeManagerAlarmHourDropDown, 30, 40);
|
||||
|
||||
UIDropDownMenu_Initialize(TimeManagerAlarmMinuteDropDown, TimeManagerAlarmMinuteDropDown_Initialize);
|
||||
UIDropDownMenu_SetWidth(TimeManagerAlarmMinuteDropDown, 30, 40);
|
||||
|
||||
UIDropDownMenu_Initialize(TimeManagerAlarmAMPMDropDown, TimeManagerAlarmAMPMDropDown_Initialize);
|
||||
-- some languages have ridonculously long am/pm strings (i'm looking at you French) so we may have to
|
||||
-- readjust the ampm dropdown width plus do some reanchoring if the text is too wide
|
||||
local maxAMPMWidth;
|
||||
TimeManagerAMPMDummyText:SetText(TIMEMANAGER_AM);
|
||||
maxAMPMWidth = TimeManagerAMPMDummyText:GetWidth();
|
||||
TimeManagerAMPMDummyText:SetText(TIMEMANAGER_PM);
|
||||
if ( maxAMPMWidth < TimeManagerAMPMDummyText:GetWidth() ) then
|
||||
maxAMPMWidth = TimeManagerAMPMDummyText:GetWidth();
|
||||
end
|
||||
maxAMPMWidth = ceil(maxAMPMWidth);
|
||||
if ( maxAMPMWidth > 40 ) then
|
||||
UIDropDownMenu_SetWidth(TimeManagerAlarmAMPMDropDown, maxAMPMWidth + 20, 40);
|
||||
TimeManagerAlarmAMPMDropDown:SetScript("OnShow", TimeManagerAlarmAMPMDropDown_OnShow);
|
||||
TimeManagerAlarmAMPMDropDown:SetScript("OnHide", TimeManagerAlarmAMPMDropDown_OnHide);
|
||||
else
|
||||
UIDropDownMenu_SetWidth(TimeManagerAlarmAMPMDropDown, 40, 40);
|
||||
end
|
||||
|
||||
TimeManager_Update();
|
||||
end
|
||||
|
||||
function TimeManagerFrame_OnUpdate(self, elapsed)
|
||||
TimeManager_UpdateTimeTicker();
|
||||
end
|
||||
|
||||
function TimeManagerFrame_OnShow(self)
|
||||
TimeManager_Update();
|
||||
TimeManagerStopwatchCheck:SetChecked(StopwatchFrame:IsShown());
|
||||
PlaySound("igCharacterInfoOpen");
|
||||
end
|
||||
|
||||
function TimeManagerFrame_OnHide(self)
|
||||
PlaySound("igCharacterInfoClose");
|
||||
end
|
||||
|
||||
function TimeManagerCloseButton_OnClick()
|
||||
TimeManagerFrame:Hide();
|
||||
end
|
||||
|
||||
function TimeManagerStopwatchCheck_OnClick(self)
|
||||
Stopwatch_Toggle();
|
||||
if ( self:GetChecked() ) then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn");
|
||||
else
|
||||
PlaySound("igMainMenuQuit");
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerAlarmHourDropDown_Initialize()
|
||||
local info = UIDropDownMenu_CreateInfo();
|
||||
|
||||
local alarmHour = Settings.alarmHour;
|
||||
local militaryTime = Settings.militaryTime;
|
||||
|
||||
local hourMin, hourMax;
|
||||
if ( militaryTime ) then
|
||||
hourMin = 0;
|
||||
hourMax = 23;
|
||||
else
|
||||
hourMin = 1;
|
||||
hourMax = 12;
|
||||
end
|
||||
for hour = hourMin, hourMax, 1 do
|
||||
info.value = hour;
|
||||
if ( militaryTime ) then
|
||||
info.text = format(TIMEMANAGER_24HOUR, hour);
|
||||
else
|
||||
info.text = hour;
|
||||
info.justifyH = "RIGHT";
|
||||
end
|
||||
info.func = TimeManagerAlarmHourDropDown_OnClick;
|
||||
if ( hour == alarmHour ) then
|
||||
info.checked = 1;
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmHourDropDown, info.text);
|
||||
else
|
||||
info.checked = nil;
|
||||
end
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerAlarmMinuteDropDown_Initialize()
|
||||
local info = UIDropDownMenu_CreateInfo();
|
||||
|
||||
local alarmMinute = Settings.alarmMinute;
|
||||
for minute = 0, 55, 5 do
|
||||
info.value = minute;
|
||||
info.text = format(TIMEMANAGER_MINUTE, minute);
|
||||
info.func = TimeManagerAlarmMinuteDropDown_OnClick;
|
||||
if ( minute == alarmMinute ) then
|
||||
info.checked = 1;
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmMinuteDropDown, info.text);
|
||||
else
|
||||
info.checked = nil;
|
||||
end
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerAlarmAMPMDropDown_Initialize()
|
||||
local info = UIDropDownMenu_CreateInfo();
|
||||
|
||||
local pm = (Settings.militaryTime and Settings.alarmHour >= 12) or not Settings.alarmAM;
|
||||
|
||||
info.value = 1;
|
||||
info.text = TIMEMANAGER_AM;
|
||||
info.func = TimeManagerAlarmAMPMDropDown_OnClick;
|
||||
if ( not pm ) then
|
||||
info.checked = 1;
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmAMPMDropDown, info.text);
|
||||
else
|
||||
info.checked = nil;
|
||||
end
|
||||
UIDropDownMenu_AddButton(info);
|
||||
|
||||
info.value = 0;
|
||||
info.text = TIMEMANAGER_PM;
|
||||
info.func = TimeManagerAlarmAMPMDropDown_OnClick;
|
||||
if ( pm ) then
|
||||
info.checked = 1;
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmAMPMDropDown, info.text);
|
||||
else
|
||||
info.checked = nil;
|
||||
end
|
||||
UIDropDownMenu_AddButton(info);
|
||||
end
|
||||
|
||||
function TimeManagerAlarmHourDropDown_OnClick(self)
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmHourDropDown, self.value);
|
||||
local oldValue = Settings.alarmHour;
|
||||
Settings.alarmHour = self.value;
|
||||
if ( Settings.alarmHour ~= oldValue ) then
|
||||
TimeManager_StartCheckingAlarm();
|
||||
end
|
||||
_TimeManager_Setting_SetTime();
|
||||
end
|
||||
|
||||
function TimeManagerAlarmMinuteDropDown_OnClick(self)
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmMinuteDropDown, self.value);
|
||||
local oldValue = Settings.alarmMinute;
|
||||
Settings.alarmMinute = self.value;
|
||||
if ( Settings.alarmMinute ~= oldValue ) then
|
||||
TimeManager_StartCheckingAlarm();
|
||||
end
|
||||
_TimeManager_Setting_SetTime();
|
||||
end
|
||||
|
||||
function TimeManagerAlarmAMPMDropDown_OnClick(self)
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmAMPMDropDown, self.value);
|
||||
if ( self.value == 1 ) then
|
||||
if ( not Settings.alarmAM ) then
|
||||
Settings.alarmAM = true;
|
||||
TimeManager_StartCheckingAlarm();
|
||||
end
|
||||
else
|
||||
if ( Settings.alarmAM ) then
|
||||
Settings.alarmAM = false;
|
||||
TimeManager_StartCheckingAlarm();
|
||||
end
|
||||
end
|
||||
_TimeManager_Setting_SetTime();
|
||||
end
|
||||
|
||||
function TimeManagerAlarmAMPMDropDown_OnShow()
|
||||
-- readjust the size of and reanchor TimeManagerAlarmAMPMDropDown and all frames below it
|
||||
TimeManagerAlarmAMPMDropDown:SetPoint("TOPLEFT", TimeManagerAlarmHourDropDown, "BOTTOMLEFT", 0, 5);
|
||||
TimeManagerAlarmMessageFrame:SetPoint("TOPLEFT", TimeManagerAlarmHourDropDown, "BOTTOMLEFT", 20, -23);
|
||||
TimeManagerAlarmEnabledButton:SetPoint("CENTER", TimeManagerFrame, "CENTER", -20, -69);
|
||||
TimeManagerMilitaryTimeCheck:SetPoint("TOPLEFT", TimeManagerFrame, "TOPLEFT", 174, -207);
|
||||
end
|
||||
|
||||
function TimeManagerAlarmAMPMDropDown_OnHide()
|
||||
-- readjust the size of and reanchor TimeManagerAlarmAMPMDropDown and all frames below it
|
||||
TimeManagerAlarmAMPMDropDown:SetPoint("LEFT", TimeManagerAlarmHourDropDown, "RIGHT", -22, 0);
|
||||
TimeManagerAlarmMessageFrame:SetPoint("TOPLEFT", TimeManagerAlarmHourDropDown, "BOTTOMLEFT", 20, 0);
|
||||
TimeManagerAlarmEnabledButton:SetPoint("CENTER", TimeManagerFrame, "CENTER", -20, -50);
|
||||
TimeManagerMilitaryTimeCheck:SetPoint("TOPLEFT", TimeManagerFrame, "TOPLEFT", 174, -207);
|
||||
end
|
||||
|
||||
function TimeManager_Update()
|
||||
TimeManager_UpdateTimeTicker();
|
||||
TimeManager_UpdateAlarmTime();
|
||||
TimeManagerAlarmEnabledButton_Update();
|
||||
TimeManagerAlarmMessageEditBox:SetText(Settings.alarmMessage);
|
||||
TimeManagerMilitaryTimeCheck:SetChecked(Settings.militaryTime);
|
||||
TimeManagerLocalTimeCheck:SetChecked(Settings.localTime);
|
||||
end
|
||||
|
||||
function TimeManager_UpdateAlarmTime()
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmHourDropDown, Settings.alarmHour);
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmMinuteDropDown, Settings.alarmMinute);
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmMinuteDropDown, format(TIMEMANAGER_MINUTE, Settings.alarmMinute));
|
||||
if ( Settings.militaryTime ) then
|
||||
TimeManagerAlarmAMPMDropDown:Hide();
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmHourDropDown, format(TIMEMANAGER_24HOUR, Settings.alarmHour));
|
||||
else
|
||||
TimeManagerAlarmAMPMDropDown:Show();
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmHourDropDown, Settings.alarmHour);
|
||||
if ( Settings.alarmAM ) then
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmAMPMDropDown, 1);
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmAMPMDropDown, TIMEMANAGER_AM);
|
||||
else
|
||||
UIDropDownMenu_SetSelectedValue(TimeManagerAlarmAMPMDropDown, 0);
|
||||
UIDropDownMenu_SetText(TimeManagerAlarmAMPMDropDown, TIMEMANAGER_PM);
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManager_UpdateTimeTicker()
|
||||
TimeManagerFrameTicker:SetText(GameTime_GetTime(false));
|
||||
end
|
||||
|
||||
function TimeManagerAlarmMessageEditBox_OnEnterPressed(self)
|
||||
self:ClearFocus();
|
||||
end
|
||||
|
||||
function TimeManagerAlarmMessageEditBox_OnEscapePressed(self)
|
||||
self:ClearFocus();
|
||||
end
|
||||
|
||||
function TimeManagerAlarmMessageEditBox_OnEditFocusLost(self)
|
||||
_TimeManager_Setting_Set(CVAR_ALARM_MESSAGE, "alarmMessage", TimeManagerAlarmMessageEditBox:GetText());
|
||||
end
|
||||
|
||||
function TimeManagerAlarmEnabledButton_Update()
|
||||
if ( Settings.alarmEnabled ) then
|
||||
TimeManagerAlarmEnabledButton:SetText(TIMEMANAGER_ALARM_ENABLED);
|
||||
TimeManagerAlarmEnabledButton:SetNormalFontObject(GameFontNormal);
|
||||
TimeManagerAlarmEnabledButton:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Up");
|
||||
TimeManagerAlarmEnabledButton:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Down");
|
||||
else
|
||||
TimeManagerAlarmEnabledButton:SetText(TIMEMANAGER_ALARM_DISABLED);
|
||||
TimeManagerAlarmEnabledButton:SetNormalFontObject(GameFontHighlight);
|
||||
TimeManagerAlarmEnabledButton:SetNormalTexture("Interface\\Buttons\\UI-Panel-Button-Disabled");
|
||||
TimeManagerAlarmEnabledButton:SetPushedTexture("Interface\\Buttons\\UI-Panel-Button-Disabled-Down");
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerAlarmEnabledButton_OnClick(self)
|
||||
_TimeManager_Setting_SetBool(CVAR_ALARM_ENABLED, "alarmEnabled", not Settings.alarmEnabled);
|
||||
if ( Settings.alarmEnabled ) then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn");
|
||||
TimeManager_StartCheckingAlarm();
|
||||
else
|
||||
PlaySound("igMainMenuOptionCheckBoxOff");
|
||||
if ( TimeManagerClockButton.alarmFiring ) then
|
||||
TimeManager_TurnOffAlarm();
|
||||
end
|
||||
end
|
||||
TimeManagerAlarmEnabledButton_Update();
|
||||
end
|
||||
|
||||
function TimeManagerMilitaryTimeCheck_OnClick(self)
|
||||
TimeManager_ToggleTimeFormat();
|
||||
if ( self:GetChecked() ) then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn");
|
||||
else
|
||||
PlaySound("igMainMenuOptionCheckBoxOff");
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManager_ToggleTimeFormat()
|
||||
local alarmHour = Settings.alarmHour;
|
||||
if ( Settings.militaryTime ) then
|
||||
_TimeManager_Setting_SetBool(CVAR_USE_MILITARY_TIME, "militaryTime", false);
|
||||
Settings.alarmHour, Settings.alarmAM = GameTime_ComputeStandardTime(Settings.alarmHour);
|
||||
else
|
||||
_TimeManager_Setting_SetBool(CVAR_USE_MILITARY_TIME, "militaryTime", true);
|
||||
Settings.alarmHour = GameTime_ComputeMilitaryTime(Settings.alarmHour, Settings.alarmAM);
|
||||
end
|
||||
_TimeManager_Setting_SetTime();
|
||||
TimeManager_UpdateAlarmTime();
|
||||
-- TimeManagerFrame_OnUpdate will pick up the time ticker change
|
||||
-- TimeManagerClockButton_OnUpdate will pick up the clock change
|
||||
if ( CalendarFrame_UpdateTimeFormat ) then
|
||||
-- update the Calendar's time format if it's available
|
||||
CalendarFrame_UpdateTimeFormat();
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerLocalTimeCheck_OnClick(self)
|
||||
TimeManager_ToggleLocalTime();
|
||||
-- since we're changing which time type we're checking, we need to check the alarm now
|
||||
TimeManager_StartCheckingAlarm();
|
||||
if ( self:GetChecked() ) then
|
||||
PlaySound("igMainMenuOptionCheckBoxOn");
|
||||
else
|
||||
PlaySound("igMainMenuOptionCheckBoxOff");
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManager_ToggleLocalTime()
|
||||
_TimeManager_Setting_SetBool(CVAR_USE_LOCAL_TIME, "localTime", not Settings.localTime);
|
||||
-- TimeManagerFrame_OnUpdate will pick up the time ticker change
|
||||
-- TimeManagerClockButton_OnUpdate will pick up the clock change
|
||||
end
|
||||
|
||||
-- TimeManagerClockButton
|
||||
|
||||
function TimeManagerClockButton_Show()
|
||||
TimeManagerClockButton:Show();
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_Hide()
|
||||
TimeManagerClockButton:Hide();
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnLoad(self)
|
||||
self:SetFrameLevel(self:GetFrameLevel() + 2);
|
||||
TimeManagerClockButton_Update();
|
||||
if ( Settings.alarmEnabled ) then
|
||||
TimeManager_StartCheckingAlarm();
|
||||
end
|
||||
self:RegisterForClicks("AnyUp");
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_Update()
|
||||
TimeManagerClockTicker:SetText(GameTime_GetTime(false));
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnEnter(self)
|
||||
GameTooltip:SetOwner(self, "ANCHOR_LEFT");
|
||||
TimeManagerClockButton:SetScript("OnUpdate", TimeManagerClockButton_OnUpdateWithTooltip);
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnLeave(self)
|
||||
GameTooltip:Hide();
|
||||
TimeManagerClockButton:SetScript("OnUpdate", TimeManagerClockButton_OnUpdate);
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnClick(self)
|
||||
if ( self.alarmFiring ) then
|
||||
PlaySound("igMainMenuQuit");
|
||||
TimeManager_TurnOffAlarm();
|
||||
else
|
||||
TimeManager_Toggle();
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnUpdate(self, elapsed)
|
||||
TimeManagerClockButton_Update();
|
||||
if ( self.checkAlarm and Settings.alarmEnabled ) then
|
||||
TimeManager_CheckAlarm(elapsed);
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_OnUpdateWithTooltip(self, elapsed)
|
||||
TimeManagerClockButton_OnUpdate(self, elapsed);
|
||||
TimeManagerClockButton_UpdateTooltip();
|
||||
end
|
||||
|
||||
function TimeManager_ShouldCheckAlarm()
|
||||
return TimeManagerClockButton.checkAlarm and Settings.alarmEnabled;
|
||||
end
|
||||
|
||||
function TimeManager_StartCheckingAlarm()
|
||||
TimeManagerClockButton.checkAlarm = true;
|
||||
|
||||
-- set the time to play the warning sound
|
||||
local alarmTime = GameTime_ComputeMinutes(Settings.alarmHour, Settings.alarmMinute, Settings.militaryTime, Settings.alarmAM);
|
||||
local warningTime = alarmTime + WARNING_SOUND_TRIGGER_OFFSET;
|
||||
-- max minutes per day = 24*60 = 1440
|
||||
if ( warningTime < 0 ) then
|
||||
warningTime = warningTime + 1440;
|
||||
elseif ( warningTime > 1440 ) then
|
||||
warningTime = warningTime - 1440;
|
||||
end
|
||||
TimeManagerClockButton.warningTime = warningTime;
|
||||
TimeManagerClockButton.checkAlarmWarning = true;
|
||||
-- since game time isn't available in seconds, we have to keep track of the previous minute
|
||||
-- in order to play our alarm warning sound at the right time
|
||||
TimeManagerClockButton.currentMinute = _TimeManager_GetCurrentMinutes(Settings.localTime);
|
||||
TimeManagerClockButton.currentMinuteCounter = 0;
|
||||
end
|
||||
|
||||
function TimeManager_CheckAlarm(elapsed)
|
||||
local currTime = _TimeManager_GetCurrentMinutes(Settings.localTime);
|
||||
local alarmTime = GameTime_ComputeMinutes(Settings.alarmHour, Settings.alarmMinute, Settings.militaryTime, Settings.alarmAM);
|
||||
|
||||
-- check for the warning sound
|
||||
local clockButton = TimeManagerClockButton;
|
||||
if ( clockButton.checkAlarmWarning ) then
|
||||
if ( clockButton.currentMinute ~= currTime ) then
|
||||
clockButton.currentMinute = currTime;
|
||||
clockButton.currentMinuteCounter = 0;
|
||||
end
|
||||
local secOffset = floor(clockButton.currentMinuteCounter) * SEC_TO_MINUTE_FACTOR;
|
||||
if ( (currTime + secOffset) == clockButton.warningTime ) then
|
||||
TimeManager_FireAlarmWarning();
|
||||
end
|
||||
clockButton.currentMinuteCounter = clockButton.currentMinuteCounter + elapsed;
|
||||
end
|
||||
-- check for the alarm sound
|
||||
if ( currTime == alarmTime ) then
|
||||
TimeManager_FireAlarm();
|
||||
end
|
||||
end
|
||||
|
||||
function TimeManager_FireAlarmWarning()
|
||||
TimeManagerClockButton.checkAlarmWarning = false;
|
||||
|
||||
PlaySound("AlarmClockWarning1");
|
||||
end
|
||||
|
||||
function TimeManager_FireAlarm()
|
||||
TimeManagerClockButton.alarmFiring = true;
|
||||
TimeManagerClockButton.checkAlarm = false;
|
||||
|
||||
-- do a bunch of crazy stuff to get the player's attention
|
||||
if ( gsub(Settings.alarmMessage, "%s", "") ~= "" ) then
|
||||
local info = ChatTypeInfo["SYSTEM"];
|
||||
DEFAULT_CHAT_FRAME:AddMessage(Settings.alarmMessage, info.r, info.g, info.b, info.id);
|
||||
RaidNotice_AddMessage(RaidWarningFrame, Settings.alarmMessage, ChatTypeInfo["RAID_WARNING"]);
|
||||
end
|
||||
PlaySound("AlarmClockWarning2");
|
||||
UIFrameFlash(TimeManagerAlarmFiredTexture, 0.5, 0.5, -1);
|
||||
-- show the clock if necessary, but record its current state so it can return to that state after
|
||||
-- the player turns the alarm off
|
||||
TimeManagerClockButton.prevShown = TimeManagerClockButton:IsShown();
|
||||
TimeManagerClockButton:Show();
|
||||
end
|
||||
|
||||
function TimeManager_TurnOffAlarm()
|
||||
UIFrameFlashStop(TimeManagerAlarmFiredTexture);
|
||||
if ( not TimeManagerClockButton.prevShown ) then
|
||||
TimeManagerClockButton:Hide();
|
||||
end
|
||||
|
||||
TimeManagerClockButton.alarmFiring = false;
|
||||
end
|
||||
|
||||
function TimeManager_IsAlarmFiring()
|
||||
return TimeManagerClockButton.alarmFiring;
|
||||
end
|
||||
|
||||
function TimeManagerClockButton_UpdateTooltip()
|
||||
GameTooltip:ClearLines();
|
||||
|
||||
if ( TimeManagerClockButton.alarmFiring ) then
|
||||
if ( gsub(Settings.alarmMessage, "%s", "") ~= "" ) then
|
||||
GameTooltip:AddLine(Settings.alarmMessage, HIGHLIGHT_FONT_COLOR.r, HIGHLIGHT_FONT_COLOR.g, HIGHLIGHT_FONT_COLOR.b, 1);
|
||||
GameTooltip:AddLine(" ");
|
||||
end
|
||||
GameTooltip:AddLine(TIMEMANAGER_ALARM_TOOLTIP_TURN_OFF);
|
||||
else
|
||||
GameTime_UpdateTooltip();
|
||||
GameTooltip:AddLine(" ");
|
||||
GameTooltip:AddLine(GAMETIME_TOOLTIP_TOGGLE_CLOCK);
|
||||
end
|
||||
|
||||
-- readjust tooltip size
|
||||
GameTooltip:Show();
|
||||
end
|
||||
|
||||
-- StopwatchFrame
|
||||
|
||||
function Stopwatch_Toggle()
|
||||
if ( StopwatchFrame:IsShown() ) then
|
||||
StopwatchFrame:Hide();
|
||||
else
|
||||
StopwatchFrame:Show();
|
||||
end
|
||||
end
|
||||
|
||||
function Stopwatch_StartCountdown(hour, minute, second)
|
||||
local sec = 0;
|
||||
if ( hour ) then
|
||||
sec = hour * 3600;
|
||||
end
|
||||
if ( minute ) then
|
||||
sec = sec + minute * 60;
|
||||
end
|
||||
if ( second ) then
|
||||
sec = sec + second;
|
||||
end
|
||||
if ( sec == 0 ) then
|
||||
Stopwatch_Toggle();
|
||||
return;
|
||||
end
|
||||
if ( sec > MAX_TIMER_SEC ) then
|
||||
StopwatchTicker.timer = MAX_TIMER_SEC;
|
||||
elseif ( sec < 0 ) then
|
||||
StopwatchTicker.timer = 0;
|
||||
else
|
||||
StopwatchTicker.timer = sec;
|
||||
end
|
||||
StopwatchTicker_Update();
|
||||
StopwatchTicker.reverse = sec > 0;
|
||||
StopwatchFrame:Show();
|
||||
end
|
||||
|
||||
function Stopwatch_Play()
|
||||
if ( StopwatchPlayPauseButton.playing ) then
|
||||
return;
|
||||
end
|
||||
StopwatchPlayPauseButton.playing = true;
|
||||
StopwatchTicker:SetScript("OnUpdate", StopwatchTicker_OnUpdate);
|
||||
StopwatchPlayPauseButton:SetNormalTexture("Interface\\TimeManager\\PauseButton");
|
||||
end
|
||||
|
||||
function Stopwatch_Pause()
|
||||
if ( not StopwatchPlayPauseButton.playing ) then
|
||||
return;
|
||||
end
|
||||
StopwatchPlayPauseButton.playing = false;
|
||||
StopwatchTicker:SetScript("OnUpdate", nil);
|
||||
StopwatchPlayPauseButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up");
|
||||
end
|
||||
|
||||
function Stopwatch_IsPlaying()
|
||||
return StopwatchPlayPauseButton.playing;
|
||||
end
|
||||
|
||||
function Stopwatch_Clear()
|
||||
StopwatchTicker.timer = 0;
|
||||
StopwatchTicker.reverse = false;
|
||||
StopwatchTicker:SetScript("OnUpdate", nil);
|
||||
StopwatchTicker_Update();
|
||||
StopwatchPlayPauseButton.playing = false;
|
||||
StopwatchPlayPauseButton:SetNormalTexture("Interface\\Buttons\\UI-SpellbookIcon-NextPage-Up");
|
||||
end
|
||||
|
||||
function Stopwatch_FinishCountdown()
|
||||
Stopwatch_Clear();
|
||||
PlaySound("AlarmClockWarning3");
|
||||
end
|
||||
|
||||
function StopwatchCloseButton_OnClick()
|
||||
PlaySound("igMainMenuQuit");
|
||||
StopwatchFrame:Hide();
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnLoad(self)
|
||||
self:RegisterEvent("ADDON_LOADED");
|
||||
self:RegisterEvent("PLAYER_LOGOUT");
|
||||
self:RegisterForDrag("LeftButton");
|
||||
StopwatchTabFrame:SetAlpha(0);
|
||||
Stopwatch_Clear();
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnEvent(self, event, ...)
|
||||
if ( event == "ADDON_LOADED" ) then
|
||||
local name = ...;
|
||||
if ( name == "Blizzard_TimeManager" ) then
|
||||
if ( not BlizzardStopwatchOptions ) then
|
||||
BlizzardStopwatchOptions = {};
|
||||
end
|
||||
|
||||
if ( BlizzardStopwatchOptions.position ) then
|
||||
StopwatchFrame:ClearAllPoints();
|
||||
StopwatchFrame:SetPoint("CENTER", "UIParent", "BOTTOMLEFT", BlizzardStopwatchOptions.position.x, BlizzardStopwatchOptions.position.y);
|
||||
StopwatchFrame:SetUserPlaced(true);
|
||||
else
|
||||
StopwatchFrame:SetPoint("TOPRIGHT", "UIParent", "TOPRIGHT", -250, -300);
|
||||
end
|
||||
end
|
||||
elseif ( event == "PLAYER_LOGOUT" ) then
|
||||
if ( StopwatchFrame:IsUserPlaced() ) then
|
||||
if ( not BlizzardStopwatchOptions.position ) then
|
||||
BlizzardStopwatchOptions.position = {};
|
||||
end
|
||||
BlizzardStopwatchOptions.position.x, BlizzardStopwatchOptions.position.y = StopwatchFrame:GetCenter();
|
||||
StopwatchFrame:SetUserPlaced(false);
|
||||
else
|
||||
BlizzardStopwatchOptions.position = nil;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnUpdate(self)
|
||||
if ( self.prevMouseIsOver ) then
|
||||
if ( not self:IsMouseOver() ) then
|
||||
UIFrameFadeOut(StopwatchTabFrame, CHAT_FRAME_FADE_TIME);
|
||||
self.prevMouseIsOver = false;
|
||||
end
|
||||
else
|
||||
if ( self:IsMouseOver() ) then
|
||||
UIFrameFadeIn(StopwatchTabFrame, CHAT_FRAME_FADE_TIME);
|
||||
self.prevMouseIsOver = true;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnShow(self)
|
||||
TimeManagerStopwatchCheck:SetChecked(1);
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnHide(self)
|
||||
UIFrameFadeRemoveFrame(StopwatchTabFrame);
|
||||
StopwatchTabFrame:SetAlpha(0);
|
||||
self.prevMouseIsOver = false;
|
||||
TimeManagerStopwatchCheck:SetChecked(nil);
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnMouseDown(self)
|
||||
self:SetScript("OnUpdate", nil);
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnMouseUp(self)
|
||||
self:SetScript("OnUpdate", StopwatchFrame_OnUpdate);
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnDragStart(self)
|
||||
self:StartMoving();
|
||||
end
|
||||
|
||||
function StopwatchFrame_OnDragStop(self)
|
||||
StopwatchFrame_OnMouseUp(self); -- OnMouseUp won't fire if OnDragStart fired after OnMouseDown
|
||||
self:StopMovingOrSizing();
|
||||
end
|
||||
|
||||
function StopwatchTicker_OnUpdate(self, elapsed)
|
||||
if ( self.reverse ) then
|
||||
self.timer = self.timer - elapsed;
|
||||
if ( self.timer <= 0 ) then
|
||||
Stopwatch_FinishCountdown();
|
||||
return;
|
||||
end
|
||||
else
|
||||
self.timer = self.timer + elapsed;
|
||||
end
|
||||
StopwatchTicker_Update();
|
||||
end
|
||||
|
||||
function StopwatchTicker_Update()
|
||||
local timer = StopwatchTicker.timer;
|
||||
local hour = min(floor(timer*SEC_TO_HOUR_FACTOR), 99);
|
||||
local minute = mod(timer*SEC_TO_MINUTE_FACTOR, 60);
|
||||
local second = mod(timer, 60);
|
||||
StopwatchTickerHour:SetFormattedText(STOPWATCH_TIME_UNIT, hour);
|
||||
StopwatchTickerMinute:SetFormattedText(STOPWATCH_TIME_UNIT, minute);
|
||||
StopwatchTickerSecond:SetFormattedText(STOPWATCH_TIME_UNIT, second);
|
||||
end
|
||||
|
||||
function StopwatchResetButton_OnClick()
|
||||
Stopwatch_Clear();
|
||||
PlaySound("igMainMenuOptionCheckBoxOff");
|
||||
end
|
||||
|
||||
function StopwatchPlayPauseButton_OnClick(self)
|
||||
if ( self.playing ) then
|
||||
Stopwatch_Pause();
|
||||
PlaySound("igMainMenuOptionCheckBoxOff");
|
||||
else
|
||||
Stopwatch_Play();
|
||||
PlaySound("igMainMenuOptionCheckBoxOn");
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
## Interface: 30300
|
||||
## Title: Blizzard Time Manager
|
||||
## Secure: 1
|
||||
## LoadOnDemand: 1
|
||||
## SavedVariablesPerCharacter: BlizzardStopwatchOptions
|
||||
Blizzard_TimeManager.xml
|
||||
Localization.lua
|
||||
@@ -0,0 +1,503 @@
|
||||
<Ui xmlns="http://www.blizzard.com/wow/ui/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.blizzard.com/wow/ui/
|
||||
..\..\FrameXML\UI.xsd">
|
||||
<Script file="Blizzard_TimeManager.lua"/>
|
||||
<Frame name="TimeManagerFrame" toplevel="true" parent="UIParent" enableMouse="true" frameStrata="DIALOG" hidden="true">
|
||||
<Size x="256" y="256"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="45" y="-170"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="TimeManagerGlobe" file="Interface\TimeManager\GlobeIcon">
|
||||
<Size x="64" y="64"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="6" y="-4"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<Layer level="BORDER">
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-TopLeft">
|
||||
<Size x="172" y="240"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.671875" top="0" bottom="0.937500"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-TopRight">
|
||||
<Size x="68" y="240"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="172" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0.46875" right="1" top="0" bottom="0.937500"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-BottomLeft">
|
||||
<Size x="172" y="88"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-240"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0" right="0.671875" top="0.65625" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\PaperDollInfoFrame\UI-Character-General-BottomRight">
|
||||
<Size x="68" y="88"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset>
|
||||
<AbsDimension x="172" y="-240"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<TexCoords left="0.46875" right="1.0" top="0.65625" bottom="1.0"/>
|
||||
</Texture>
|
||||
<FontString name="TimeManagerFrameTicker" inherits="GameFontHighlightLarge" text="TIMEMANAGER_TICKER" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="CENTER" relativeTo="TimeManagerGlobe">
|
||||
<Offset x="-2" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString inherits="GameFontWhite" text="TIMEMANAGER_TITLE">
|
||||
<Anchors>
|
||||
<Anchor point="TOP">
|
||||
<Offset x="0" y="-17"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Button name="TimeManagerCloseButton" inherits="UIPanelCloseButton">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-46" y="-8"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick function="TimeManagerCloseButton_OnClick"/>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<Frame name="TimeManagerStopwatchFrame">
|
||||
<Size x="160" y="60"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-40" y="-24"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="TimeManagerStopwatchFrameBackground" file="Interface\QuestFrame\UI-QuestItemNameFrame">
|
||||
<Size x="150" y="50"/>
|
||||
<Anchors>
|
||||
<Anchor point="RIGHT">
|
||||
<Offset>
|
||||
<AbsDimension x="-4" y="0"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="TimeManagerStopwatchFrameText" text="TIMEMANAGER_SHOW_STOPWATCH" inherits="GameFontNormalSmall" justifyH="RIGHT">
|
||||
<Anchors>
|
||||
<Anchor point="RIGHT">
|
||||
<Offset x="-48" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<CheckButton name="TimeManagerStopwatchCheck">
|
||||
<Size x="28" y="28"/>
|
||||
<Anchors>
|
||||
<Anchor point="RIGHT">
|
||||
<Offset x="-17" y="1"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick function="TimeManagerStopwatchCheck_OnClick"/>
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Icons\INV_Misc_PocketWatch_01">
|
||||
<Size x="28" y="28"/>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER">
|
||||
<Offset>
|
||||
<AbsDimension x="0" y="-1"/>
|
||||
</Offset>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</NormalTexture>
|
||||
<HighlightTexture alphaMode="ADD" file="Interface\Buttons\ButtonHilight-Square"/>
|
||||
<CheckedTexture alphaMode="ADD" file="Interface\Buttons\CheckButtonHilight"/>
|
||||
</CheckButton>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frame name="TimeManagerAlarmTimeFrame">
|
||||
<Size x="145" y="52"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset x="25" y="-80"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="TimeManagerAlarmTimeLabel" inherits="GameFontNormalSmall" text="TIMEMANAGER_ALARM_TIME">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="TimeManagerAMPMDummyText" inherits="GameFontHighlightSmall" hidden="true">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="TimeManagerAlarmHourDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="TimeManagerAlarmTimeLabel" relativePoint="BOTTOMLEFT">
|
||||
<Offset x="-20" y="-4"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
<Frame name="TimeManagerAlarmMinuteDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="TimeManagerAlarmHourDropDown" relativePoint="RIGHT">
|
||||
<Offset x="-22" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
<Frame name="TimeManagerAlarmAMPMDropDown" inherits="UIDropDownMenuTemplate">
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="TimeManagerAlarmMinuteDropDown" relativePoint="RIGHT">
|
||||
<Offset x="-22" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</Frame>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Frame name="TimeManagerAlarmMessageFrame">
|
||||
<Size x="160" y="40"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="TimeManagerAlarmHourDropDown" relativePoint="BOTTOMLEFT">
|
||||
<Offset x="20" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="TimeManagerAlarmMessageLabel" inherits="GameFontNormalSmall" text="TIMEMANAGER_ALARM_MESSAGE">
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<EditBox name="TimeManagerAlarmMessageEditBox" inherits="InputBoxTemplate" autoFocus="false" letters="32" historyLines="1">
|
||||
<Size x="160" y="20"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT" relativeTo="TimeManagerAlarmMessageLabel" relativePoint="BOTTOMLEFT">
|
||||
<Offset x="4" y="-4"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnEnterPressed function="TimeManagerAlarmMessageEditBox_OnEnterPressed"/>
|
||||
<OnEscapePressed function="TimeManagerAlarmMessageEditBox_OnEscapePressed"/>
|
||||
<OnEditFocusLost function="TimeManagerAlarmMessageEditBox_OnEditFocusLost"/>
|
||||
</Scripts>
|
||||
</EditBox>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Button name="TimeManagerAlarmEnabledButton" inherits="UIPanelButtonTemplate">
|
||||
<Size x="160" y="20"/>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER">
|
||||
<Offset x="-20" y="-50"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick function="TimeManagerAlarmEnabledButton_OnClick"/>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<CheckButton name="TimeManagerMilitaryTimeCheck" inherits="UICheckButtonTemplate">
|
||||
<Size x="24" y="24"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPLEFT">
|
||||
<Offset x="171" y="-203"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
_G[self:GetName().."Text"]:SetText(TIMEMANAGER_24HOURMODE);
|
||||
TimeManagerMilitaryTimeCheckText:ClearAllPoints();
|
||||
TimeManagerMilitaryTimeCheckText:SetPoint("RIGHT", self, "RIGHT", -self:GetWidth(), 0);
|
||||
TimeManagerMilitaryTimeCheckText:SetFontObject(GameFontHighlightSmall);
|
||||
</OnLoad>
|
||||
<OnClick function="TimeManagerMilitaryTimeCheck_OnClick"/>
|
||||
</Scripts>
|
||||
</CheckButton>
|
||||
<CheckButton name="TimeManagerLocalTimeCheck" inherits="UICheckButtonTemplate">
|
||||
<Size x="24" y="24"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT" relativeTo="TimeManagerMilitaryTimeCheck" relativePoint="BOTTOMRIGHT">
|
||||
<Offset x="0" y="6"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnLoad>
|
||||
_G[self:GetName().."Text"]:SetText(TIMEMANAGER_LOCALTIME);
|
||||
TimeManagerLocalTimeCheckText:ClearAllPoints();
|
||||
TimeManagerLocalTimeCheckText:SetPoint("RIGHT", self, "RIGHT", -self:GetWidth(), 0);
|
||||
TimeManagerLocalTimeCheckText:SetFontObject(GameFontHighlightSmall);
|
||||
</OnLoad>
|
||||
<OnClick function="TimeManagerLocalTimeCheck_OnClick"/>
|
||||
</Scripts>
|
||||
</CheckButton>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnLoad function="TimeManagerFrame_OnLoad"/>
|
||||
<OnUpdate function="TimeManagerFrame_OnUpdate"/>
|
||||
<OnShow function="TimeManagerFrame_OnShow"/>
|
||||
<OnHide function="TimeManagerFrame_OnHide"/>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
<!-- Minimap button to access the TimeManagerButton -->
|
||||
<Button name="TimeManagerClockButton" parent="Minimap" hidden="true">
|
||||
<Size x="60" y="28"/>
|
||||
<Anchors>
|
||||
<Anchor point="CENTER">
|
||||
<Offset x="0" y="-68"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BORDER">
|
||||
<Texture file="Interface\TimeManager\ClockBackground" setAllPoints="true">
|
||||
<TexCoords left="0.015625" right="0.8125" top="0.015625" bottom="0.390625"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
<Layer level="ARTWORK">
|
||||
<FontString name="TimeManagerClockTicker" inherits="GameFontHighlightSmall">
|
||||
<Anchors>
|
||||
<Anchor point="CENTER">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<Texture name="TimeManagerAlarmFiredTexture" file="Interface\TimeManager\ClockBackground" alphaMode="ADD" hidden="true" setAllPoints="true">
|
||||
<TexCoords left="0.015625" right="0.8125" top="0.51625" bottom="0.890625"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Scripts>
|
||||
<OnLoad function="TimeManagerClockButton_OnLoad"/>
|
||||
<OnEnter function="TimeManagerClockButton_OnEnter"/>
|
||||
<OnLeave function="TimeManagerClockButton_OnLeave"/>
|
||||
<OnUpdate function="TimeManagerClockButton_OnUpdate"/>
|
||||
<OnClick function="TimeManagerClockButton_OnClick"/>
|
||||
</Scripts>
|
||||
</Button>
|
||||
<!-- Stopwatch -->
|
||||
<Frame name="StopwatchFrame" toplevel="true" parent="UIParent" movable="true" enableMouse="true" hidden="true" clampedToScreen="true" frameStrata="DIALOG">
|
||||
<Size x="132" y="44"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-250" y="-300"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentBackgroundLeft" file="Interface\TimeManager\TimerBackground">
|
||||
<Size x="122" y="29"/>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMLEFT"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.046875" right="1.0" top="0" bottom="0.453125"/>
|
||||
</Texture>
|
||||
<Texture file="Interface\TimeManager\TimerBackground">
|
||||
<Size x="10" y="29"/>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentBackgroundLeft" relativePoint="RIGHT"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.0" right="0.078125" top="0.46875" bottom="0.921875"/>
|
||||
</Texture>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Frame name="StopwatchTicker">
|
||||
<Size x="100" y="20"/>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset x="-49" y="3"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<FontString name="StopwatchTickerSecond" inherits="GameFontHighlightLarge" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString text=":" inherits="GameFontHighlightLarge">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-22" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="StopwatchTickerMinute" inherits="GameFontHighlightLarge" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-27" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString text=":" inherits="GameFontHighlightLarge">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-49" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
<FontString name="StopwatchTickerHour" inherits="GameFontHighlightLarge" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="-54" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
</Frame>
|
||||
<Frame name="StopwatchTabFrame">
|
||||
<Size x="126" y="16"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOP">
|
||||
<Offset x="0" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Layers>
|
||||
<Layer level="BACKGROUND">
|
||||
<Texture name="$parentLeft" file="Interface\ChatFrame\ChatFrameTab">
|
||||
<Size x="7" y="1"/>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT"/>
|
||||
<Anchor point="TOP"/>
|
||||
<Anchor point="BOTTOM"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.03125" right="0.140625" top="0.28125" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture name="$parentMiddle" file="Interface\ChatFrame\ChatFrameTab">
|
||||
<Size x="112" y="1"/>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentLeft" relativePoint="RIGHT"/>
|
||||
<Anchor point="TOP"/>
|
||||
<Anchor point="BOTTOM"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.140625" right="0.859375" top="0.28125" bottom="1.0"/>
|
||||
</Texture>
|
||||
<Texture name="$parentRight" file="Interface\ChatFrame\ChatFrameTab">
|
||||
<Size x="7" y="1"/>
|
||||
<Anchors>
|
||||
<Anchor point="LEFT" relativeTo="$parentMiddle" relativePoint="RIGHT"/>
|
||||
<Anchor point="TOP"/>
|
||||
<Anchor point="BOTTOM"/>
|
||||
</Anchors>
|
||||
<TexCoords left="0.859375" right="0.96875" top="0.28125" bottom="1.0"/>
|
||||
</Texture>
|
||||
<FontString name="StopwatchTitle" text="STOPWATCH_TITLE" inherits="GameFontNormalSmall" justifyH="CENTER">
|
||||
<Anchors>
|
||||
<Anchor point="TOP">
|
||||
<Offset x="0" y="-3"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
</FontString>
|
||||
</Layer>
|
||||
</Layers>
|
||||
<Frames>
|
||||
<Button name="StopwatchCloseButton" inherits="UIPanelCloseButton">
|
||||
<Size x="20" y="20"/>
|
||||
<Anchors>
|
||||
<Anchor point="TOPRIGHT">
|
||||
<Offset x="1" y="1"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnClick function="StopwatchCloseButton_OnClick"/>
|
||||
</Scripts>
|
||||
</Button>
|
||||
</Frames>
|
||||
</Frame>
|
||||
<Button name="StopwatchResetButton">
|
||||
<Size x="24" y="24"/>
|
||||
<Anchors>
|
||||
<Anchor point="BOTTOMRIGHT">
|
||||
<Offset x="-2" y="3"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnEnter>
|
||||
GameTooltip_AddNewbieTip(self, nil, 1.0, 1.0, 1.0, NEWBIE_TOOLTIP_STOPWATCH_RESETBUTTON, 1);
|
||||
</OnEnter>
|
||||
<OnLeave function="GameTooltip_Hide"/>
|
||||
<OnClick function="StopwatchResetButton_OnClick"/>
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\TimeManager\ResetButton"/>
|
||||
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
|
||||
</Button>
|
||||
<Button name="StopwatchPlayPauseButton">
|
||||
<Size x="24" y="24"/>
|
||||
<Anchors>
|
||||
<Anchor point="RIGHT" relativeTo="StopwatchResetButton" relativePoint="LEFT">
|
||||
<Offset x="5" y="0"/>
|
||||
</Anchor>
|
||||
</Anchors>
|
||||
<Scripts>
|
||||
<OnEnter>
|
||||
GameTooltip_AddNewbieTip(self, nil, 1.0, 1.0, 1.0, NEWBIE_TOOLTIP_STOPWATCH_PLAYPAUSEBUTTON, 1);
|
||||
</OnEnter>
|
||||
<OnLeave function="GameTooltip_Hide"/>
|
||||
<OnClick function="StopwatchPlayPauseButton_OnClick"/>
|
||||
</Scripts>
|
||||
<NormalTexture file="Interface\Buttons\UI-SpellbookIcon-NextPage-Up"/>
|
||||
<HighlightTexture file="Interface\Buttons\UI-Common-MouseHilight" alphaMode="ADD"/>
|
||||
</Button>
|
||||
</Frames>
|
||||
<Scripts>
|
||||
<OnLoad function="StopwatchFrame_OnLoad"/>
|
||||
<OnEvent function="StopwatchFrame_OnEvent"/>
|
||||
<OnUpdate function="StopwatchFrame_OnUpdate"/>
|
||||
<OnShow function="StopwatchFrame_OnShow"/>
|
||||
<OnHide function="StopwatchFrame_OnHide"/>
|
||||
<OnMouseDown function="StopwatchFrame_OnMouseDown"/>
|
||||
<OnMouseUp function="StopwatchFrame_OnMouseUp"/>
|
||||
<OnDragStart function="StopwatchFrame_OnDragStart"/>
|
||||
<OnDragStop function="StopwatchFrame_OnDragStop"/>
|
||||
</Scripts>
|
||||
</Frame>
|
||||
</Ui>
|
||||
@@ -0,0 +1 @@
|
||||
-- This file is executed at the end of addon load
|
||||
Reference in New Issue
Block a user