📄 calendarmonthviewscript.luac.lua
字号:
CalendarObject.GetNextDay = function(l_28_0, l_28_1)
if l_28_1 < CalendarControl.selectedDay then
if CalendarControl.selectedMonth == 12 then
CalendarControl.selectedMonth = 1
CalendarControl.selectedYear = CalendarControl.selectedYear + 1
else
CalendarControl.selectedMonth = CalendarControl.selectedMonth + 1
end
CalendarControl:setSelectDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, l_28_1)
return true
end
CalendarControl:setSelectDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, l_28_1)
return false
end
CalendarObject.GetNextMonth = function(l_29_0, l_29_1, l_29_2)
if l_29_2 == 12 then
l_29_1 = l_29_1 + 1
l_29_2 = 1
else
l_29_2 = l_29_2 + 1
end
return l_29_1, l_29_2
end
CalendarObject.GetPreMonth = function(l_30_0, l_30_1, l_30_2)
if l_30_2 == 1 then
l_30_1 = l_30_1 - 1
l_30_2 = 12
else
l_30_2 = l_30_2 - 1
end
return l_30_1, l_30_2
end
CalendarObject.ResizeMonthView = function(l_31_0, l_31_1)
local l_31_2 = -l_31_0.WindowW / 2
local l_31_3 = l_31_0.WindowH / 2 - l_31_1
ActiveCalendar.Position.x = l_31_2
NextCalendar.Position.x = l_31_2
PreCalendar.Position.x = l_31_2
ActiveCalendar.Position.y = l_31_3
NextCalendar.Position.y = -800
PreCalendar.Position.y = -800
l_31_0:ResetCalendar(ActiveCalendar)
l_31_0:ResetCalendar(NextCalendar)
l_31_0:ResetCalendar(PreCalendar)
end
CalendarObject.ResetCalendar = function(l_32_0, l_32_1)
trace("ResetCalendar")
local l_32_2 = l_32_1:GetComponentClip().Namespace
l_32_2:FindName("MonthUpArrow").Position.x = screenWidth - CalendarControl.ARROWDX
local l_32_3 = nil
l_32_3 = l_32_2:FindName("VLine0")
l_32_3.Size.width = screenWidth
local l_32_4 = l_32_3.Position.y - l_32_0.WEEKH - l_32_0.LINEH
for i = 1, 7 do
l_32_3 = l_32_2:FindName("VLine" .. i)
l_32_3.Size.width = screenWidth
l_32_3.Position.y = l_32_4 - l_32_0.Height * (i - 1)
end
for i = 0, 5 do
l_32_3 = l_32_2:FindName("HLine" .. i)
l_32_3.Size.height = l_32_0.WEEKH + l_32_0.Height * 6 + l_32_0.HLINE_DH
l_32_3.Position.x = l_32_0.BoundMinX + l_32_0.Width * (i + 1)
end
local l_32_5 = l_32_1.Tag
if l_32_5 == nil then
return
end
l_32_5.year.Position.x = (l_32_0.WindowW - l_32_5.year.Size.width) / 2
local l_32_6 = 0
for i = 0, 6 do
l_32_6 = (l_32_0.Width - l_32_0.TextW) / 2
l_32_5.label[i].Position.x = l_32_6 + l_32_0.BoundMinX + l_32_0.Width * i
end
local l_32_7 = nil
local l_32_8 = nil
local l_32_9 = 0
local l_32_10 = (l_32_0.Width - l_32_0.TextW) / 2
local l_32_11 = (l_32_0.Height - l_32_0.TextW) / 2
local l_32_12 = l_32_0.MonthViewY
local l_32_13 = 0
for i1 = 0, 5 do
l_32_9 = l_32_0.BoundMinX
for i2 = 0, 6 do
l_32_13 = i1 * 7 + i2
l_32_7 = l_32_5[l_32_13]
l_32_8 = l_32_5.sprite[l_32_13]
l_32_10 = (l_32_0.Width - l_32_7.Size.width) / 2
l_32_7.Position.x = l_32_9 + l_32_10
l_32_7.Position.y = l_32_12 - l_32_11
l_32_8.Position.x = l_32_9 + l_32_0.Width - l_32_8.Size.width
l_32_8.Position.y = l_32_12
l_32_9 = l_32_9 + l_32_0.Width
end
l_32_12 = l_32_12 - l_32_0.Height
end
trace("ResetCalendar" .. l_32_0.BoundMinX)
end
CalendarObject.GetNextList = function(l_33_0, l_33_1)
trace("GetNextList")
if l_33_1.Tag == nil then
l_33_0:CreateCalendar(l_33_1)
end
local l_33_2 = l_33_1.Tag
l_33_2.year.String = calendar:GetCurrentMonthName() .. " " .. calendar:GetCurrentYearName()
l_33_2.yearNum = calendar:GetCurrentYear()
l_33_2.monthNum = calendar:GetCurrentMonth()
local l_33_3, l_33_4 = nil, nil
local l_33_5 = 0
for i1 = 0, 5 do
for i2 = 0, 6 do
l_33_5 = i1 * 7 + i2
l_33_2.sprite[l_33_5]._visible = false
ResetDayText(l_33_2[l_33_5], i1, i2, l_33_2.yearNum, l_33_2.monthNum)
end
end
trace("getNextList= end")
end
CalendarObject.DestoryCalendar = function(l_34_0, l_34_1)
trace("DestoryCalendar")
local l_34_2 = l_34_1.Tag
if l_34_2 ~= nil then
local l_34_3 = 41
for i = 0, 6 do
l_34_1:Detach(l_34_2.label[i])
l_34_2.label[i] = nil
end
for i = 0, l_34_3 do
l_34_1:Detach(l_34_2[i])
l_34_1:Detach(l_34_2.sprite[i])
l_34_2[i] = nil
l_34_2.sprite[i] = nil
end
l_34_1:Detach(l_34_2.year)
l_34_2.label = nil
l_34_2.sprite = nil
l_34_2.year = nil
l_34_2.count = nil
l_34_2 = nil
l_34_1.Tag = nil
end
trace("DestoryCalendar end")
end
CalendarObject.CreateCalendar = function(l_35_0, l_35_1)
trace("create calendar start")
local l_35_2 = {}
l_35_1.Tag = l_35_2
l_35_2.year = l_35_0:initCurrentYear()
l_35_1:Attach(l_35_2.year)
l_35_2.count = 42
local l_35_3 = l_35_0.BoundMinX
local l_35_4 = 0
local l_35_5 = 0
l_35_2.label = {}
local l_35_6 = 0
for i = 0, 6 do
l_35_6 = (l_35_0.Width - l_35_0.TextW) / 2
l_35_2.label[i] = l_35_0:initMonthLabel(l_35_3 + l_35_6)
l_35_1:Attach(l_35_2.label[i])
l_35_2.label[i].Color = Color(153,153,153,255)
l_35_2.label[i].String = Locale:GetString("IDS_WEEK_" .. i)
if i == 0 or i == 6 then
l_35_2.label[i].Opacity.value = 50
end
l_35_3 = l_35_3 + l_35_0.Width
end
local l_35_7 = 0
l_35_2.sprite = {}
l_35_4 = l_35_0.MonthViewY
local l_35_8 = (l_35_0.Width - l_35_0.TextW) / 2
local l_35_9 = (l_35_0.Height - l_35_0.TextW) / 2
for i1 = 0, 5 do
l_35_3 = l_35_0.BoundMinX
l_35_8 = (l_35_0.Width - l_35_0.TextW) / 2
for i2 = 0, 6 do
l_35_7 = i1 * 7 + i2
l_35_2[l_35_7] = l_35_0:initMonthDayText(l_35_3 + l_35_8, l_35_4 - l_35_9, l_35_5)
l_35_2.sprite[l_35_7] = l_35_0:initMonthItem(l_35_3 + l_35_0.Width - l_35_0.APPW,l_35_4,l_35_5)
l_35_1:Attach(l_35_2.sprite[l_35_7])
l_35_1:Attach(l_35_2[l_35_7])
l_35_3 = l_35_3 + l_35_0.Width
end
l_35_4 = l_35_4 - l_35_0.Height
end
trace("create calendar end")
end
CalendarObject.initCurrentYear = function(l_36_0)
local l_36_1 = GLESText()
l_36_1.Color = Color(255, 255, 255, 255)
l_36_1.FontPath = "\\Windows\\HTC\\Assets\\Fonts\\Helvetica Neue LT Pro 1\\neue helvetica 35 thin.ttf"
l_36_1.FontSize = 30
l_36_1.Size.width = 380
l_36_1.Size.height = 46
l_36_1.Position.x = (l_36_0.WindowW - l_36_1.Size.width) / 2
l_36_1.Position.y = -4
l_36_1.Position.z = 0
l_36_1.VerticalAlignment = Alignment_VerticalCenter
l_36_1.HorizontalAlignment = Alignment_HorizontalCenter
return l_36_1
end
CalendarObject.initMonthLabel = function(l_37_0, l_37_1)
local l_37_2 = GLESText()
l_37_2.FontPath = "\\Windows\\HTC\\Assets\\Fonts\\Helvetica Neue LT Pro 1\\neue helvetica 55 roman.ttf"
l_37_2.FontSize = l_37_0.WEEKTEXTSIZE
l_37_2.Position.x = l_37_1
l_37_2.Position.y = -l_37_0.HEADERH - l_37_0.LINEH
l_37_2.Position.z = 0
l_37_2.Size.width = l_37_0.TextW
l_37_2.Size.height = l_37_0.WEEKH
l_37_2.VerticalAlignment = Alignment_VerticalCenter
l_37_2.HorizontalAlignment = Alignment_HorizontalCenter
return l_37_2
end
CalendarObject.initMonthItem = function(l_38_0, l_38_1, l_38_2, l_38_3)
local l_38_4 = GLESSprite2D()
l_38_4.TextureCoords.x = 0
l_38_4.TextureCoords.y = 0
l_38_4.TextureCoords.width = 0.515625
l_38_4.TextureCoords.height = 0.5546875
l_38_4.Size.width = l_38_0.APPW
l_38_4.Size.height = l_38_0.APPH
l_38_4.Position.x = l_38_1 - 1
l_38_4.Position.y = l_38_2 - 1
l_38_4.Position.z = l_38_3
l_38_4._visible = false
return l_38_4
end
CalendarObject.initMonthDayText = function(l_39_0, l_39_1, l_39_2, l_39_3)
local l_39_4 = GLESText()
l_39_4.String = ""
l_39_4.FontPath = "\\Windows\\HTC\\Assets\\Fonts\\Helvetica Neue LT Pro 1\\neue helvetica 55 roman.ttf"
l_39_4.FontSize = l_39_0.DAYTEXTSIZE
l_39_4.Position.x = l_39_1
l_39_4.Position.y = l_39_2
l_39_4.Position.z = l_39_3
l_39_4.Size.width = CalendarControl.TextW
l_39_4.Size.height = CalendarControl.TextW
l_39_4.VerticalAlignment = Alignment_VerticalCenter
l_39_4.HorizontalAlignment = Alignment_HorizontalCenter
return l_39_4
end
CalendarObject.Destory = function(l_40_0)
l_40_0:DestoryCalendar(ActiveCalendar)
l_40_0:DestoryCalendar(NextCalendar)
l_40_0:DestoryCalendar(PreCalendar)
if l_40_0.AppointmentLoader ~= nil then
l_40_0.AppointmentLoader:StopThread()
l_40_0.AppointmentLoader = nil
end
end
preDay = function()
local l_41_0 = calendar:GetPreviousDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
if CalendarControl:GetPreDay(l_41_0) then
CalendarControl:ToPreMonth(1)
CalendarControl.weekOfMonth = calendar:GetWeeksInMonth(calendar:GetCurrentYear(), calendar:GetCurrentMonth())
end
GetNewDay()
end
nextDay = function()
local l_42_0 = calendar:GetNextDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, CalendarControl.selectedDay)
if CalendarControl:GetNextDay(l_42_0) then
CalendarControl:ToNextMonth(1)
CalendarControl.weekOfMonth = calendar:GetWeeksInMonth(calendar:GetCurrentYear(), calendar:GetCurrentMonth())
end
GetNewDay()
end
ShowNextMonth = function()
trace("ShowNextMonth")
TodayBackground.Opacity.value = 0
CalendarControl:StartAnimation(MonthAnimate(ActiveCalendar, NextCalendar, SwitchCalendarToNextComplete, true, CalendarControl.dsty))
end
ShowPreMonth = function()
trace("ShowPreMonth")
TodayBackground.Opacity.value = 0
CalendarControl:StartAnimation(MonthAnimate(ActiveCalendar, PreCalendar, SwitchCalendarToPreComplete, false, CalendarControl.dsty))
end
ShowNextNMonth = function(l_45_0)
TodayBackground.Opacity.value = 0
trace("ShowNextNMonth" .. l_45_0)
CalendarControl:ToNextMonth(l_45_0)
CalendarControl:GetNextList(NextCalendar)
ResetAppInfo(NextCalendar)
CalendarControl:ToPreMonth(l_45_0)
CalendarControl:StartAnimation(MonthAnimate(ActiveCalendar, NextCalendar, ToNextNMonthComplete, true, CalendarControl.dsty))
end
ShowPreNMonth = function(l_46_0, l_46_1)
TodayBackground.Opacity.value = 0
CalendarControl:ToPreMonth(l_46_0)
CalendarControl:GetNextList(PreCalendar)
ResetAppInfo(PreCalendar)
CalendarControl:ToNextMonth(l_46_0)
trace("ShowPreNMonth" .. l_46_0)
CalendarControl:StartAnimation(MonthAnimate(ActiveCalendar, PreCalendar, ToPreNMonthComplete, false, CalendarControl.dsty))
end
getFloor = function(l_47_0, l_47_1)
return (l_47_0 - math.mod(l_47_0, l_47_1)) / l_47_1
end
getCeil = function(l_48_0, l_48_1)
local m = math.mod(l_48_0, l_48_1)
local f = getFloor(l_48_0, l_48_1)
if m ~= 0 then
return f+1
end
return f
end
initialCalendar = function()
local l_49_0 = calendar:GetToday()
CalendarControl = CalendarObject(l_49_0.Year, l_49_0.Month, l_49_0.Day)
CalendarControl:SetToday(l_49_0)
CalendarControl:CreateCalendar(ActiveCalendar)
trace("init calenar view")
end
StartLoadAppointment = function(l_50_0)
if l_50_0.Tag ~= nil then
StopAppointmentLoader(l_50_0)
l_50_0.Tag.Loader = CalendarAppointmentLoader(AsyncAppointmentLoader_CreateInstance(g_objAppointmentLoader:GetLoader()), l_50_0, l_50_0.Tag.yearNum, l_50_0.Tag.monthNum)
end
end
StopAppointmentLoader = function(l_51_0)
if l_51_0.Tag.Loader ~= nil then
l_51_0.Tag.Loader:Cancel()
l_51_0.Tag.Loader = nil
end
end
CancelSwitchCalendar = function()
trace("Set CancelSwitchCalendar")
bCancelSwitchCalendar = true
end
SwitchCalendarToNextComplete = function()
trace("SwitchCalendarToNextComplete")
if bCancelSwitchCalendar then
trace("Cancel SwitchCalendarToNextComplete")
return
end
local l_53_0 = PreCalendar
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -