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

📄 clockview.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 4 页
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;;2,4;0,11;;0,0,13;0,9,77,80;;;;;;;;;;;1;;0,0,0,4,15;0,6;;;;;;;0,0,16,20;;0,0,9,20;0,3,13;;;;;;0,0,0,4;0,9;;;;;0,0,0,4;0,9;;;;24,41;;;;;;;;;;;;;;30;; 09a70371_manila.luac 

trace("ClockViewNew invoked!")
require("machine_status_svc")
require("weather_svc")
require("worldclock_svc")
require("transitions")
require("scrollphysics")
require("RadioButtonControl")
require("CheckboxControl")
require("theme")
require("LetterPicker")
require("WorldClock/WorldClockCommon")
require("Component/GraphicClock")
require("CalendarPickerScript")
require("WorldClock/TimeComponentUI")
WorldClock.Clock.PageView = class(WorldClock.Clock.PageBase)
WorldClock.Clock.PageView.__init = function(l_1_0)
   l_1_0.Node = CityListNode
   l_1_0.ComponentName = "CityListComponent"
end

WorldClock.Clock.PageView.ShowPage = function(l_2_0)
   _application.Navigation.Title = Locale:GetString("IDS_WorldClock_Title")
   _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_DONE"), WorldClock.Clock.PageView_OnLsk))
   _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MENU"), WorldClock.Clock.PageView_OnRsk))
   _application.Navigation.TabVisibility = true
   l_2_0:Initialize()
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[ClockPageView] : EnableLandscape")
      require("WorldClock\\ClockPageView_Landscape")
      ClockPageView_Landscape = ClockPageView_ScreenRotation(Camera2D, ClockPageView_Mask, LvCityList, LvsCityList)
   end
   for i = 0, FrmClockView.CityList:GetCount() - 1 do
      local item = FrmClockView.CityList:GetItem(i)
      if item.CityCode == "(system)" then
         aSysItem = TimeZone_GetSysTimeZone()
         item.Name = aSysItem.Name
         item.TimeZone = aSysItem.TimeZone
      end
   end
   l_2_0.ItemListLayout = TileLayout()
   if _application.Orientation == ScreenOrientation_Portrait then
      l_2_0.ItemListLayout:SetItemSize(480, 90, 0)
   else
      if _application.Orientation == ScreenOrientation_Landscape then
         l_2_0.ItemListLayout:SetItemSize(800, 90, 0)
      end
   end
   l_2_0.ItemListLayout.SelectionNode = LvsCityList
   LvCityList:SetLayout(l_2_0.ItemListLayout)
   l_2_0.ItemListGenerator = LibraryGeneratorCities(FrmClockView.CityList, LvCityList:GetMovie(), LvCityList.ComponentLibraryName, LvCityList.ComponentLibraryID)
   l_2_0.ItemListGenerator.ItemCreated:connect(l_2_0.OnItemCreated, l_2_0)
   l_2_0.ItemListGenerator.ItemDestroyed:connect(l_2_0.OnItemDestroyed, l_2_0)
   LvCityList:SetGenerator(l_2_0.ItemListGenerator)
   LvCityList:Focus()
   if ClockPageView_Landscape ~= nil then
      ClockPageView_Landscape._generator = l_2_0.ItemListGenerator
   end
   l_2_0.PhysicalScroll = ScrollPhysics(LvCityList, LvCityList, WorldClock.Clock.PageView_OnItemSelected)
   l_2_0.PhysicalScroll:ConnectMouseEvents()
   SprAddCityBg.onPress:connect(l_2_0.OnAddCityPress, l_2_0)
   l_2_0.Node._visible = true
end

WorldClock.Clock.PageView.HidePage = function(l_3_0)
   l_3_0.Node._visible = false
   l_3_0.ItemListGenerator:Reset()
   l_3_0.ItemListGenerator.ItemCreated:disconnect(l_3_0.OnItemCreated, l_3_0)
   l_3_0.ItemListGenerator.ItemDestroyed:disconnect(l_3_0.OnItemDestroyed, l_3_0)
   l_3_0.PhysicalScroll:DisconnectMouseEvents()
   SprAddCityBg.onPress:disconnect(l_3_0.OnAddCityPress, l_3_0)
end

WorldClock.Clock.PageView_OnLsk = function()
   _application.Navigation:NavigateBack()
end

WorldClock.Clock.PageView_OnRsk = function()
   local l_5_0 = MachineStatus()
   local l_5_1 = WorldClockManager()
   if FrmClockView.CityList:GetCount() > 1 then
      if l_5_0.CurrentTime.Value.IsTwentyFourHour then
         WorldClock.Clock.PageView_DialogRequest = _application.DialogManager:GetDialog(URL("Manila://worldclock-12HRS.dialog"))
      else
         WorldClock.Clock.PageView_DialogRequest = _application.DialogManager:GetDialog(URL("Manila://worldclock-24HRS.dialog"))
      end
   else
      if l_5_0.CurrentTime.Value.IsTwentyFourHour then
         WorldClock.Clock.PageView_DialogRequest = _application.DialogManager:GetDialog(URL("Manila://worldclock-set-only-12HRS.dialog"))
      else
         WorldClock.Clock.PageView_DialogRequest = _application.DialogManager:GetDialog(URL("Manila://worldclock-set-only-24HRS.dialog"))
      end
   end
   WorldClock.Clock.PageView_DialogRequest.OnExit:connect(WorldClock.Clock.PageView_OnMenuExit)
   WorldClock.Clock.PageView_DialogRequest:Show()
end

WorldClock.Clock.PageView_OnMenuExit = function(l_6_0)
   WorldClock.Clock.PageView_DialogRequest.OnExit:disconnect(WorldClock.Clock.PageView_OnMenuExit)
   local l_6_1 = WorldClockManager()
   if l_6_0.Result.ExitType ~= DialogExitType_Cancel then
      if l_6_0.Result.UserValue == "Delete" then
         FrmClockView:Switch(FrmClockView.PageDelete)
      elseif l_6_0.Result.UserValue == "Reposition" then
         FrmClockView:Switch(FrmClockView.PageRearrange)
      elseif l_6_0.Result.UserValue == "SetLocal" then
         if nil ~= FrmClockView.SelectedData then
           local now = Time_GetNow()
           now:ToSpecificLocalTime(FrmClockView.SelectedData.TimeZone)
           FrmClockView.PageEdit:SetNewDate(now.Year, now.Month, now.Day)
           FrmClockView.PageEdit:SetTempTimeZone(FrmClockView.SelectedData.CityCode, FrmClockView.SelectedData.Name, FrmClockView.SelectedData.TimeZone)
           PageSetLocalTime_Dirty = false
           PageSetLocalTime_FirstLoad = true
           FrmClockView:Switch(FrmClockView.PageEdit)           
        end
      elseif l_6_0.Result.UserValue == "SetTimeFormat" then
           if FrmClockView.MachineStatus.CurrentTime.Value.IsTwentyFourHour then
              l_6_1:SetHourFormat(false)
           else
              l_6_1:SetHourFormat(true)
           end
        end
      else
      end
end

WorldClock.Clock.PageView.OnItemCreated = function(l_7_0, l_7_1, l_7_2)
   local lvci = WorldClock.Clock.LvCityListItem(l_7_1, l_7_2)
   FrmClockView.MachineStatus.CurrentTime.OnValueChanged:connect(lvci.OnTimeChanged, lvci)
   FrmClockView.MachineStatus.TwentyFourHourTime.OnValueChanged:connect(lvci.OnTimeChanged, lvci)
   l_7_2.OnSelected:connect(lvci.OnItemSelected, lvci)
   l_7_2.OnDeselected:connect(lvci.OnItemDeselected, lvci)
   if ClockPageView_Landscape ~= nil then
      ClockPageView_Landscape:AdjustListviewItemLayout(l_7_1, l_7_2)
   end
   l_7_2.Tag = {}
   l_7_2.Tag.ListViewItem = lvci
end

WorldClock.Clock.PageView.OnItemDestroyed = function(l_8_0, l_8_1)
   if l_8_1 == FrmClockView.SelectedElement then
     RadioButton_SetValue(FrmClockView.SelectedElement, false)
     FrmClockView.SelectedElement = nil     
   end
   local l_8_2 = l_8_1.Tag.ListViewItem
   FrmClockView.MachineStatus.CurrentTime.OnValueChanged:disconnect(l_8_2.OnTimeChanged, l_8_2)
   FrmClockView.MachineStatus.TwentyFourHourTime.OnValueChanged:disconnect(l_8_2.OnTimeChanged, l_8_2)
   l_8_1.OnSelected:disconnect(l_8_2.OnItemSelected, l_8_2)
   l_8_1.OnDeselected:disconnect(l_8_2.OnItemDeselected, l_8_2)
   l_8_1.Tag.ListViewItem = nil
   l_8_1.Tag = nil
   l_8_1 = nil
end

WorldClock.Clock.PageView_OnItemSelected = function(l_9_0)
   if l_9_0 < 0 then
      return 
   end
   local l_9_1 = LvCityList:GetGenerator():GetItem(l_9_0)
   if nil == l_9_1 then
      return 
   end
   if l_9_1._xmouse < 91 then
      if FrmClockView.SelectedData ~= nil then
         FrmClockView.SelectedData.IsLocalTime = false
      end
      if FrmClockView.SelectedElement ~= nil then
        RadioButton_SetValue(FrmClockView.SelectedElement, false)
        FrmClockView.SelectedElement.Tag.ListViewItem:OnTimeChanged()
      end
      l_9_1.Tag.ListViewItem.Data.IsLocalTime = true
      RadioButton_SetValue(l_9_1, true)
      FrmClockView.SelectedElement = l_9_1
      FrmClockView.SelectedData = l_9_1.Tag.ListViewItem.Data
      l_9_1.Tag.ListViewItem:OnTimeChanged()
   else
      if (_application.Orientation == ScreenOrientation_Portrait and l_9_1._xmouse > 300) or _application.Orientation == ScreenOrientation_Landscape and l_9_1._xmouse > 620 then
         local l_9_2 = l_9_1.Tag.ListViewItem.GcClock.Time
         local l_9_3 = l_9_1.Tag.ListViewItem.Data
         if nil ~= l_9_3 and l_9_3.IsLocalTime then
            FrmClockView.PageEdit:SetNewDate(l_9_2.Year, l_9_2.Month, l_9_2.Day)
            FrmClockView.PageEdit:SetTempTimeZone(l_9_3.CityCode, l_9_3.Name, l_9_3.TimeZone)
            PageSetLocalTime_Dirty = false
            PageSetLocalTime_FirstLoad = true
            FrmClockView:Switch(FrmClockView.PageEdit)
         end
      end
   end
end

WorldClock.Clock.PageView.OnAddCityPress = function(l_10_0)
   FrmClockView:Switch(FrmClockView.PageAdd)
end

WorldClock.Clock.PageView.AddNewCity = function(l_11_0, l_11_1, l_11_2, l_11_3)
   for i = 1, FrmClockView.CityList:GetCount() - 1 do
      if l_11_1 == FrmClockView.CityList:GetItem(i).CityCode then
         return 
      end
   end
   newItem = CityItem()
   newItem.CityCode = l_11_1
   newItem.Name = l_11_2
   newItem.TimeZone = l_11_3
   newItem.IsLocalTime = false
   FrmClockView.CityList:AddItem(newItem)
   FrmClockView.WcMgr:SetCityList(FrmClockView.CityList)
   return newItem
end

WorldClock.Clock.LvCityListItem = class()
WorldClock.Clock.LvCityListItem.__init = function(l_12_0, l_12_1, l_12_2)
   l_12_0.Data = l_12_1
   l_12_0.UIElement = l_12_2
   l_12_0.RbnLocal = l_12_2.Namespace:FindName("RbnLocal")
   if l_12_0.Data.IsLocalTime then
     RadioButton_Initialize(l_12_2, true)
     FrmClockView.SelectedData = l_12_1
     FrmClockView.SelectedElement = l_12_2
   else
     RadioButton_Initialize(l_12_2, false)
   end
   l_12_0.TxtTitle = l_12_2.Namespace:FindName("TxtTitle")
   l_12_0.TxtTitle.String = l_12_1.Name
   l_12_0.TxtDescription = l_12_2.Namespace:FindName("TxtDescription")
   l_12_0.GcClock = GraphicClock(Time_GetNow(), l_12_2.Namespace:FindName("SprHourBg"), l_12_2.Namespace:FindName("SprHourDigit1"), l_12_2.Namespace:FindName("SprHourDigit2"), l_12_2.Namespace:FindName("SprMinuteBg"), l_12_2.Namespace:FindName("SprMinuteDigit1"), l_12_2.Namespace:FindName("SprMinuteDigit2"), l_12_2.Namespace:FindName("SprTimeMark"))
   l_12_0:OnTimeChanged()
end

WorldClock.Clock.LvCityListItem.GetTime = function(l_13_0)
   return l_13_0.GcClock.Time
end

WorldClock.Clock.LvCityListItem.OnItemSelected = function(l_14_0, l_14_1)
   FrmClockView.PageView.ItemListLayout.SelectionNode.Opacity.value = 100
   if (_application.Orientation == ScreenOrientation_Portrait and l_14_1._xmouse > 300) or
       _application.Orientation == ScreenOrientation_Landscape and l_14_1._xmouse > 620 then
      local l_14_2 = l_14_1.Tag.ListViewItem.Data
      if (nil == l_14_2 or not l_14_2.IsLocalTime) then
        FrmClockView.PageView.ItemListLayout.SelectionNode.Opacity.value = 0
      end
   else
      if l_14_1._xmouse >= 91 then
         FrmClockView.PageView.ItemListLayout.SelectionNode.Opacity.value = 0
      end
   end
   if 100 == FrmClockView.PageView.ItemListLayout.SelectionNode.Opacity.value then
      local l_14_2 = l_14_1.Namespace:FindName("TxtDescription")
      if nil ~= l_14_2 then
         l_14_2.Color = GetSubTextSelectedColor()
      end
   end
end

WorldClock.Clock.LvCityListItem.OnItemDeselected = function(l_15_0, l_15_1)
   local td = l_15_1.Namespace:FindName("TxtDescription")
   if nil ~= td then
      td.Color = Color(100, 100, 100, 255)
   end
end

WorldClock.Clock.LvCityListItem.OnTimeChanged = function(l_16_0)
   l_16_0.GcClock.Time = Time_GetNow()
   l_16_0.GcClock.Time:ToSpecificLocalTime(l_16_0.Data.TimeZone)
   if l_16_0.Data.IsLocalTime then
      l_16_0.TxtDescription.String = l_16_0.GcClock.Time:GetDateString("MMM d") .. "  (" .. Locale:GetString("IDS_LOCAL") .. ")"
   else
      if l_16_0.GcClock.Time:IsYesterday() then
         l_16_0.TxtDescription.String = Locale:GetString("IDS_YESTERDAY")
      else
         if l_16_0.GcClock.Time:IsToday() then
            l_16_0.TxtDescription.String = Locale:GetString("IDS_TODAY")
         else
            l_16_0.TxtDescription.String = Locale:GetString("IDS_TOMORROW")
         end

⌨️ 快捷键说明

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