⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 calendarmonthviewscript.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 3 页
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;0,4;0,1,2;;;;;0,12;0,0,0,10;0,37;;;;;0,0,0,0,0,0,0,0,11;;;0,0,0,16,21,26;;0,0,0,22,27;;;0,0,0,0,0,7,13,17,21;;;;;;;;0,0,3,6;0,0,6,20,29;0,0,10,29,29,30;0,0,4,7;0,0,4,1314,15,18;0,2;0,0,2;0,0,0,0,2;0,0,0,0,2;;9;9;;;;;;;3;;;;11;11;11,62;8,59;;0,0,0,0,0,5,10,15,20;0,1,8,9,10,11,12,13,17;14,14;14,14;;;;;;11,21,28;;;;;;;0,0,3,16,17,23 20abba60_manila.luac 

trace("month view script+++++")
require("ActiveSyncDetect")
ActiveCalendar = Calendar_1
NextCalendar = Calendar_2
PreCalendar = Calendar_3
ActiveSyncObj = nil
bCancelSwitchCalendar = false
Animate = class()
Animate.__init = function(l_1_0, l_1_1, l_1_2)
   l_1_0.Duration = l_1_2
   l_1_0.Time = 0
   l_1_0.A = 4 * l_1_1 / (l_1_0.Duration * l_1_0.Duration)
   l_1_0.Distance = l_1_1
   l_1_0.total = 0
   l_1_0.HalfTime = l_1_0.Duration / 2
   l_1_0.V = l_1_0.A * l_1_0.HalfTime
   trace("A=" .. l_1_0.A)
end

Animate.StepAnimation = function(l_2_0)
   l_2_0.Time = l_2_0.Time + 1
   if l_2_0.Time >= l_2_0.Duration  then
      local l_2_1 = l_2_0.Distance
      l_2_1 = l_2_1 - l_2_0.total
      l_2_0.total = l_2_0.Distance
      return l_2_1
   else
      local l_2_1 = l_2_0:EaseFunction() 
      l_2_0.total = l_2_0.total + l_2_1
      return l_2_1
   end
end

Animate.EaseFunction = function(l_3_0)
   local l_3_1 = l_3_0.Time
   local l_3_2 = l_3_0.HalfTime
   if l_3_2 < l_3_1 then
      l_3_2 = l_3_0.HalfTime
      l_3_1 = l_3_1 - l_3_2
      l_3_2 = l_3_0.V
      l_3_2 = l_3_2 - l_3_0.A * (2 * (l_3_1) - 1) / 2
      return l_3_2
   else
      l_3_2 = l_3_0.A
      l_3_2 = l_3_2 * (2 * (l_3_1) - 1)
      l_3_2 = l_3_2 / 2
      return l_3_2
   end
end

Animate_2 = class()
Animate_2.__init = function(l_4_0, l_4_1, l_4_2, l_4_3, l_4_4, l_4_5)
   l_4_0.StartValue = l_4_1
   l_4_0.DesiredValue = l_4_2
   l_4_0.Duration = l_4_3
   l_4_0.Delay = l_4_4
   l_4_0.Time = 1
   l_4_0.Distance = l_4_0.DesiredValue - l_4_0.StartValue
   l_4_0.A = 2 * l_4_0.Distance / (l_4_0.Duration * l_4_0.Duration)
   l_4_0.Desc = l_4_5
   if l_4_5 then
      l_4_0.V = l_4_0.A * l_4_0.Duration
   else
      l_4_0.V = 0
   end
end

Animate_2.StepAnimation = function(l_5_0)
   l_5_0.Time = l_5_0.Time + 1
   if l_5_0.Delay < l_5_0.Time  then
      local x = l_5_0.Time - l_5_0.Delay
      if x >= l_5_0.Duration  then
         return l_5_0.DesiredValue
      else
         return l_5_0:EaseFunction(x)
      end
   else
      return l_5_0.StartValue
   end
end

Animate_2.EaseFunction = function(l_6_0, l_6_1)
   if l_6_0.Desc then
      return l_6_0.StartValue + l_6_0.V * l_6_1 - l_6_0.A * l_6_1 * l_6_1 / 2
   else
      return l_6_0.StartValue + l_6_0.A * l_6_1 * l_6_1 / 2
   end
end

MonthAnimate = class()
MonthAnimate.__init = function(l_7_0, l_7_1, l_7_2, l_7_3, l_7_4, l_7_5)
   l_7_0.DSTY = l_7_5
   l_7_0.Distance = 600
   l_7_0.PREY = l_7_0.DSTY + l_7_0.Distance
   l_7_0.NEXTY = l_7_0.DSTY - l_7_0.Distance
   l_7_0.DUIRATION = 10
   l_7_0.CompleteFunc = l_7_3
   l_7_0.outObj = l_7_1
   l_7_0.inObj = l_7_2
   l_7_0.Time = 1
   l_7_0.outObj.Position.y = l_7_0.DSTY
   if l_7_4 then
      l_7_0.inObj.Position.y = l_7_0.NEXTY
      l_7_0.Animation = Animate(l_7_0.Distance, l_7_0.DUIRATION)
   else
      l_7_0.inObj.Position.y = l_7_0.PREY
      l_7_0.Animation = Animate(-l_7_0.Distance, l_7_0.DUIRATION)
   end
   l_7_0.inObj._visible = true
   l_7_0.outObj._visible = true
end

MonthAnimate.Refresh = function(l_8_0)
   if l_8_0.Time > l_8_0.DUIRATION then
    return true
   end
   l_8_0.Time = l_8_0.Time + 1
   local l_8_1 = l_8_0.Animation:StepAnimation()
   l_8_0.outObj.Position.y = l_8_0.outObj.Position.y + l_8_1
   l_8_0.inObj.Position.y = l_8_0.inObj.Position.y + l_8_1
   return false
end

SwitchModeAnimate = class()
SwitchModeAnimate.__init = function(l_9_0, l_9_1, l_9_2)
   l_9_0.MONTHSCALE = 1.1999969482422
   l_9_0.DSTSCALE = 1
   l_9_0.DAYSCALE = 0.79998779296875
   l_9_0.DURATION = 6
   l_9_0.TOTAL = 12
   l_9_0.Time = 1
   l_9_0.CompleteFunc = l_9_2
   local l_9_3 = l_9_0.TOTAL - l_9_0.DURATION
   if l_9_1 then
      l_9_0.MonthScale = Animate_2(l_9_0.DSTSCALE, l_9_0.MONTHSCALE, l_9_0.DURATION, 0, false)
      l_9_0.MonthOpacity = Animate_2(100, 0, l_9_0.DURATION, 0, false)
      l_9_0.DayScale = Animate_2(l_9_0.DAYSCALE, l_9_0.DSTSCALE, l_9_0.DURATION, l_9_3, true)
      l_9_0.DayOpacity = Animate_2(0, 100, l_9_0.DURATION, l_9_3, true)
   else
      l_9_0.DayScale = Animate_2(l_9_0.DSTSCALE, l_9_0.DAYSCALE, l_9_0.DURATION, 0, false)
      l_9_0.DayOpacity = Animate_2(100, 0, l_9_0.DURATION, 0, false)
      l_9_0.MonthScale = Animate_2(l_9_0.MONTHSCALE, l_9_0.DSTSCALE, l_9_0.DURATION, l_9_3, true)
      l_9_0.MonthOpacity = Animate_2(0, 100, l_9_0.DURATION, l_9_3, true)
   end
end

SwitchModeAnimate.Refresh = function(l_10_0)
   if l_10_0.Time > l_10_0.TOTAL  then
     return true
   end
   l_10_0.Time = l_10_0.Time + 1
   MonthView.Opacity.value = l_10_0.MonthOpacity:StepAnimation()
   local sa = l_10_0.MonthScale:StepAnimation()
   MonthView.Scale.x = sa
   MonthView.Scale.y = sa
   MonthView.Scale.z = sa
   DayView.Opacity.value = l_10_0.DayOpacity:StepAnimation()
   sa = l_10_0.DayScale:StepAnimation()
   DayView.Scale.x = sa
   DayView.Scale.y = sa
   DayView.Scale.z = sa
   return false
end

AppointmentLoaderObject = class()
AppointmentLoaderObject.__init = function(l_11_0)
   l_11_0.objAppointmentLoader = AppointmentLoader_CreateInstance()
end

AppointmentLoaderObject.Destroy = function(l_12_0)
   if l_12_0.objAppointmentLoader ~= nil then
      l_12_0.objAppointmentLoader:StopThread()
      l_12_0.objAppointmentLoader = nil
   end
end

AppointmentLoaderObject.GetLoader = function(l_13_0)
   if l_13_0.objAppointmentLoader ~= nil then
      return l_13_0.objAppointmentLoader
   else
      return nil
   end
end

g_objAppointmentLoader = AppointmentLoaderObject()
CalendarObject = class()
CalendarObject.__init = function(l_14_0, l_14_1, l_14_2, l_14_3)
   trace("CalendarObject:__init")
   l_14_0.HEIGHT_NORMAL = 73
   l_14_0.WIDTH_NORMAL = 68
   l_14_0.DAYVIEWPORT_NORMAL = 420
   l_14_0.HEIGHT_LANDSCAPE = 44
   l_14_0.WIDTH_LANDSCAPE = 114
   l_14_0.DAYVIEWPORT_LANDSCAPE = 368
   l_14_0.HLINE_DH = 30
   l_14_0.WEEKH = 23
   l_14_0.ARROWDX = 28
   l_14_0.DAYVIEWDX = 26
   l_14_0.HEADERH = 50
   l_14_0.DAYVIEWH = 81
   l_14_0.DAYVIEWHEADERH = 160
   l_14_0.DAYVIEW_ICONW = 50
   l_14_0.DAYVIEW_ICONDX = 5
   l_14_0.TITLEBARH = 60
   l_14_0.WEATHERDX = 210
   l_14_0.DAYTEXTSIZE = 28
   l_14_0.WEEKTEXTSIZE = 20
   l_14_0.DAYTIMEPOSY = -10
   l_14_0.APPW = 16
   l_14_0.APPH = 16
   l_14_0.LINEH = 2
   l_14_0.WindowW = 480
   l_14_0.WindowH = 696
   l_14_0.TextW = 32
   l_14_0.MonthViewY = -l_14_0.HEADERH - l_14_0.WEEKH - 2 * l_14_0.LINEH
   l_14_0.isLandscape = false
   l_14_0.DayViewW = 0
   l_14_0.Height = l_14_0.HEIGHT_NORMAL
   l_14_0.Width = l_14_0.WIDTH_NORMAL
   l_14_0.dsty = 0
   l_14_0:ResetBound(l_14_0.Width, l_14_0.Height, l_14_0.WindowH / 2 - l_14_0.TITLEBARH, l_14_0.WindowW, l_14_0.WindowH, l_14_0.TITLEBARH, l_14_0.isLandscape)
   l_14_0.weekOfMonth = 6
   l_14_0.IsMousePressed = false
   l_14_0.selectedYear = l_14_1
   l_14_0.selectedMonth = l_14_2
   l_14_0.selectedDay = l_14_3
   l_14_0.row = calendar:GetWeek(l_14_1, l_14_2, l_14_3)
   l_14_0.col = calendar:GetDayOfWeek(l_14_1, l_14_2, l_14_3)
   l_14_0.TotalDelta = 0
   l_14_0.dMonth = 0
   l_14_0.Year = 0
   l_14_0.Month = 0
   l_14_0.Day = 0
   l_14_0.animationObj = nil
   trace("CalendarObject end")
end

CalendarObject.ResetBound = function(l_15_0, l_15_1, l_15_2, l_15_3, l_15_4, l_15_5, l_15_6, l_15_7)
   l_15_0.WindowW = l_15_4
   l_15_0.WindowH = l_15_5
   l_15_0.Height = l_15_2
   l_15_0.Width = l_15_1
   l_15_0.isLandscape = l_15_7
   l_15_0.DayViewW = l_15_4 - 2 * l_15_0.DAYVIEWDX
   l_15_0.dsty = l_15_3
   local l_15_8 = l_15_1 * 7
   l_15_0.BoundMinX = (l_15_4 - l_15_8) / 2
   l_15_0.BoundMaxX = (l_15_4 + l_15_8) / 2
   l_15_0.BoundMinY = l_15_6 + l_15_0.WEEKH + l_15_0.HEADERH + l_15_0.LINEH * 2
   l_15_0.BoundMaxY = l_15_0.BoundMinY + l_15_2 * 6
end

CalendarObject.StartAnimation = function(l_16_0, l_16_1)
   MonthSelector.Opacity.value = 0
   l_16_0.animationObj = l_16_1
   Group3D.onUpdate:connect(l_16_0.onUpdate, l_16_0)
end

CalendarObject.onUpdate = function(l_17_0)
   if l_17_0.animationObj ~= nil and l_17_0.animationObj:Refresh() then
      Group3D.onUpdate:disconnect(l_17_0.onUpdate, l_17_0)
      l_17_0.animationObj:CompleteFunc()
      l_17_0.animationObj = nil
   end
end

CalendarObject.setSelection = function(l_18_0, l_18_1, l_18_2)
   if l_18_1 < 0 or l_18_0.weekOfMonth <= l_18_1 or l_18_2 < 0 or l_18_2 > 6 then
     return false
   end
   local l_18_3 = calendar:GetPosYear(l_18_1, l_18_2)
   local l_18_4 = calendar:GetPosMonth(l_18_1, l_18_2)
   local l_18_5 = calendar:GetPosDay(l_18_1, l_18_2)
   if l_18_3 ~= calendar:GetCurrentYear() or l_18_4 ~= calendar:GetCurrentMonth() then
      trace("invaild day")
      return false
   end
   l_18_0.row = l_18_1
   l_18_0.col = l_18_2
   l_18_0.selectedDay = calendar:GetPosDay(l_18_1, l_18_2)
   l_18_0.selectedMonth = calendar:GetPosMonth(l_18_1, l_18_2)
   l_18_0.selectedYear = calendar:GetPosYear(l_18_1, l_18_2)
   l_18_0.row = calendar:GetWeek(l_18_3, l_18_4, l_18_5) - 1
   return true
end

CalendarObject.setSelectDay = function(l_19_0, l_19_1, l_19_2, l_19_3)
   trace("setSelection" .. l_19_1 .. " month=" .. l_19_2 .. "day=" .. l_19_3)
   l_19_0.selectedDay = l_19_3
   l_19_0.selectedMonth = l_19_2
   l_19_0.selectedYear = l_19_1
   l_19_0.row = calendar:GetWeek(l_19_1, l_19_2, l_19_3) - 1
   l_19_0.col = calendar:GetDayOfWeek(l_19_1, l_19_2, l_19_3)
   return true
end

CalendarObject.setSelectionPos = function(l_20_0, l_20_1, l_20_2)
   if l_20_1 < l_20_0.BoundMinX or l_20_0.BoundMaxX < l_20_1 or l_20_2 < l_20_0.BoundMinY or l_20_0.BoundMaxY < l_20_2 then
      trace("out of bound")
      return false
   end
   local l_20_3 = getFloor(l_20_1 - l_20_0.BoundMinX, l_20_0.Width)
   local l_20_4 = getFloor(l_20_2 - l_20_0.BoundMinY, l_20_0.Height)
   return l_20_0:setSelection(l_20_4, l_20_3)
end

CalendarObject.GetDayPositionY = function(l_21_0, l_21_1)
   return -l_21_1 * l_21_0.Height
end

CalendarObject.GetDayPositionX = function(l_22_0, l_22_1)
   return l_22_1 * l_22_0.Width + 1
end

CalendarObject.GetDayPosition = function(l_23_0, l_23_1, l_23_2, l_23_3, l_23_4)
   local l_23_5 = calendar:GetWeek(l_23_1, l_23_2, l_23_3) - 1
   local l_23_6 = calendar:GetDayOfWeek(l_23_1, l_23_2, l_23_3)
   local l_23_7 = l_23_0:GetDayPositionY(l_23_5) - 16
   local l_23_8 = l_23_4 + l_23_0:GetDayPositionX(l_23_6)
   return l_23_8, l_23_7
end

CalendarObject.SetToday = function(l_24_0, l_24_1)
   l_24_0.Year = l_24_1.Year
   l_24_0.Month = l_24_1.Month
   l_24_0.Day = l_24_1.Day
   l_24_0.weekOfMonth = calendar:GetWeeksInMonth(l_24_1.Year, l_24_1.Month)
end

CalendarObject.ToNextMonth = function(l_25_0, l_25_1)
   l_25_0.dMonth = l_25_1
   calendar:NextNMonth(l_25_1)
   l_25_0.TotalDelta = l_25_0.TotalDelta + l_25_1
end

CalendarObject.ToPreMonth = function(l_26_0, l_26_1)
   l_26_0.dMonth = l_26_1
   calendar:PreviousNMonth(l_26_1)
   l_26_0.TotalDelta = l_26_0.TotalDelta - l_26_1
end

CalendarObject.GetPreDay = function(l_27_0, l_27_1)
   if CalendarControl.selectedDay < l_27_1 then
      if CalendarControl.selectedMonth == 1 then
         CalendarControl.selectedMonth = 12
         CalendarControl.selectedYear = CalendarControl.selectedYear - 1
      else
         CalendarControl.selectedMonth = CalendarControl.selectedMonth - 1
      end
      CalendarControl:setSelectDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, l_27_1)
      return true
   end
   CalendarControl:setSelectDay(CalendarControl.selectedYear, CalendarControl.selectedMonth, l_27_1)
   return false
end

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -