Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
susnow committed Apr 6, 2012
1 parent f0087b4 commit f9c7858
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 49 deletions.
64 changes: 26 additions & 38 deletions SlideLock.lua
@@ -1,12 +1,12 @@
--Susnow --Susnow


local addon,ns = ... local addon,ns = ...
local cfg = ns.cfg
local texFile = "Interface\\Buttons\\WHITE8X8" local texFile = "Interface\\Buttons\\WHITE8X8"
local bgTex = {bgFile = texFile,edgeFile = texFile, edgeSize = 1,insets={top = 0, bottom = 0,left = 0,right = 0}} local bgTex = {bgFile = texFile,edgeFile = texFile, edgeSize = 1,insets={top = 0, bottom = 0,left = 0,right = 0}}
local tex = "Interface\\AddOns\\SlideLock\\media\\" local tex = "Interface\\AddOns\\SlideLock\\media\\"
local barTex = tex.."bar2"
local buttonTex = tex.."button2" local month = {"January","February","March","April","May","June","July","Auguest","September","October","November","December"}local week = {"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Sturday"}



local function CreateFontObject(fontObject,parent,layer,color) local function CreateFontObject(fontObject,parent,layer,color)
parent[fontObject] = parent.SlideBar:CreateFontString(layer,nil,"ChatFontNormal") parent[fontObject] = parent.SlideBar:CreateFontString(layer,nil,"ChatFontNormal")
Expand All @@ -30,18 +30,14 @@ SL.nextUpdate = 0
SL.gradient = 0 SL.gradient = 0
SL:EnableMouse(true) SL:EnableMouse(true)
SL:EnableKeyboard(true) SL:EnableKeyboard(true)

SL:EnableMouseWheel(true)

--SL:SetBackdrop(bgTex)
--SL:SetBackdropColor(.3,.3,.3,.8)
--SL:SetBackdropBorderColor(0,0,0,0)


SL.SlideBar = CreateFrame("Frame","SlideBar",SL)-- :CreateTexture(nil,"ARTWORK") SL.SlideBar = CreateFrame("Frame","SlideBar",SL)-- :CreateTexture(nil,"ARTWORK")
SL.SlideBar.nextUpdate = 0 SL.SlideBar.nextUpdate = 0
SL.SlideBar:SetSize(256,32) SL.SlideBar:SetSize(256,32)
SL.SlideBar:SetPoint("BOTTOM",SL,0,20) SL.SlideBar:SetPoint("BOTTOM",SL,0,20)
SL.SlideBar.tex = SL.SlideBar:CreateTexture(nil,"ARTWORK") SL.SlideBar.tex = SL.SlideBar:CreateTexture(nil,"ARTWORK")
SL.SlideBar.tex:SetTexture(barTex) SL.SlideBar.tex:SetTexture(tex.."bar2")
SL.SlideBar.tex:SetAllPoints(SL.SlideBar) SL.SlideBar.tex:SetAllPoints(SL.SlideBar)
SL.CameraButton = CreateFrame("Button",nil,SL) SL.CameraButton = CreateFrame("Button",nil,SL)
SL.CameraButton:SetSize(32,32) SL.CameraButton:SetSize(32,32)
Expand All @@ -57,7 +53,7 @@ SL.SlideButton.nextUpdate = 0
SL.SlideButton:SetSize(64,32) SL.SlideButton:SetSize(64,32)
SL.SlideButton:SetPoint("LEFT",SL.SlideBar,14,-0.3) SL.SlideButton:SetPoint("LEFT",SL.SlideBar,14,-0.3)
SL.SlideButton.tex = SL.SlideButton:CreateTexture(nil,"OVERLAY") SL.SlideButton.tex = SL.SlideButton:CreateTexture(nil,"OVERLAY")
SL.SlideButton.tex:SetTexture(buttonTex) SL.SlideButton.tex:SetTexture(tex.."button2")
SL.SlideButton.tex:SetPoint("CENTER",SL.SlideButton) SL.SlideButton.tex:SetPoint("CENTER",SL.SlideButton)
SL.SlideButton:EnableKeyboard(true) SL.SlideButton:EnableKeyboard(true)
SL.control = CreateFrame("Frame") SL.control = CreateFrame("Frame")
Expand Down Expand Up @@ -96,6 +92,17 @@ do
TP.time:SetFont(font,48,"OUTLINE") TP.time:SetFont(font,48,"OUTLINE")
end end
TP.time:SetText(format("%s:%s:%s",date("%H"),date("%M"),date("%S"))) TP.time:SetText(format("%s:%s:%s",date("%H"),date("%M"),date("%S")))
TP.YMDW = TP:CreateFontString(nil,"OVERLAY","ChatFontNormal")
do
local font,size,flag = TP.YMDW:GetFont()
TP.YMDW:SetFont(font,10,"NORMAL")
end
TP.YMDW:SetPoint("TOP",TP.time,"BOTTOM",0,-10)
TP:RegisterEvent("PLAYER_LOGIN")
TP:SetScript("OnEvent",function(self)
local w,m,d,y = CalendarGetDate()
TP.YMDW:SetText(format("%s,%s%s",week[w],month[m],d))
end)


SL:SetScript("OnUpdate",function(self,elapsed) SL:SetScript("OnUpdate",function(self,elapsed)
self.nextUpdate = self.nextUpdate + elapsed self.nextUpdate = self.nextUpdate + elapsed
Expand Down Expand Up @@ -156,10 +163,8 @@ SL.SlideButton:SetScript("OnMouseUp",function(self)
self:SetPoint("LEFT",SL.SlideBar,tempX,-0.3) self:SetPoint("LEFT",SL.SlideBar,tempX,-0.3)
else else
self:SetScript("OnUpdate",nil) self:SetScript("OnUpdate",nil)
PlaySoundFile(tex.."Unlock2.ogg","Master")
self:SetPoint("LEFT",SL.SlideBar,194,-0.3) self:SetPoint("LEFT",SL.SlideBar,194,-0.3)
UIParent:Show() SL:ToggleSlideLock("HIDE")
SetUIVisibility(true)
end end
self.nextUpdate = 0 self.nextUpdate = 0
end end
Expand Down Expand Up @@ -195,15 +200,21 @@ end)
SL:SetScript("OnKeyDown",function(self,key) SL:SetScript("OnKeyDown",function(self,key)
-- --
end) end)
SL:SetScript("OnMouseWheel",function()
--
end)


local function ToggleSlideLock(flag) function SL:ToggleSlideLock(flag)
if flag == "HIDE" then if flag == "HIDE" then
SL:Hide() SL:Hide()
BP1:Hide() BP1:Hide()
BP2:Hide() BP2:Hide()
TP:Hide() TP:Hide()
PlaySoundFile(tex.."Unlock2.ogg","Master")
UIParent:Show()
SetUIVisibility(true) SetUIVisibility(true)
elseif flag == "SHOW" then elseif flag == "SHOW" then
UIParent:Hide()
SL:Show() SL:Show()
SL.SlideButton:SetPoint("LEFT",SL.SlideBar,13.5, -0.3) SL.SlideButton:SetPoint("LEFT",SL.SlideBar,13.5, -0.3)
BP1:Show() BP1:Show()
Expand All @@ -213,28 +224,5 @@ local function ToggleSlideLock(flag)
end end
end end


ToggleSlideLock("HIDE") SL:ToggleSlideLock("HIDE")

UIParent:HookScript("OnHide",function()
ToggleSlideLock("SHOW")
end)

UIParent:HookScript("OnShow",function()
ToggleSlideLock("HIDE")
end)


local UIP = CreateFrame("Frame")
if cfg.AFK then
UIP:RegisterEvent("PLAYER_FLAGS_CHANGED")
UIP:SetScript("OnEvent",function()
if UnitIsAFK("player") then
UIParent:Hide()
else
return
end
end)
else
return
end


2 changes: 0 additions & 2 deletions SlideLock.toc
Expand Up @@ -7,6 +7,4 @@
## Notes-zhCN: 和iOS风格类似的锁屏插件 ## Notes-zhCN: 和iOS风格类似的锁屏插件
## Notes-zhTW: 和iOS風格類似的鎖屏插件 ## Notes-zhTW: 和iOS風格類似的鎖屏插件



config.lua
SlideLock.lua SlideLock.lua
9 changes: 0 additions & 9 deletions config.lua

This file was deleted.

0 comments on commit f9c7858

Please sign in to comment.