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

📄 3.lua

📁 htc manila 2 sourcecode
💻 LUA
字号:
-- Decompiled using luadec 0.6 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l ;;;;4,15;;0,4,8,12;0,4,8,12;0,2;0,2;0,9;0,6,10,14,18,22;;;0,0,7,11,15,19;0,4,8,12;;;25,149;; 22bb3b19_manila_19DE.luac 
-- Minor Q16.16 conversion errors

IsRmovePage = false
ValidItemCount = 0
require("scrollphysics")
ItemSizeWidth = 148.5
ItemSizeHeight = 142
LVPositionX = 17
LVPositionY = 4
LVWidth = 445.5
LVHeight = 540
APNameHeight = 128
g_bigIconSize = 88
g_smallIconSize = 64
thumbnailFolderPath = "\\Windows\\htc\\programlauncher\\"
HandleKeyDown = function(l_1_0, l_1_1, l_1_2)
   if PageListView:GetGenerator().SelectedIndex == -1 then
      if l_1_1.Code == KeyCode_Down or l_1_1.Code == KeyCode_Up then
         PageListView:GetLayout().SelectionNode.Opacity.value = 100
      end
      return 
   end
   if l_1_1.Code == KeyCode_Down then
      PageListView:GetLayout().SelectionNode.Opacity.value = 100
      PageListView:GetGenerator().SelectedIndex = PageListView:GetGenerator().SelectedIndex + 1
      PageListView:FocusItems()
      l_1_2.value = true
   else
      if l_1_1.Code == KeyCode_Up then
         PageListView:GetLayout().SelectionNode.Opacity.value = 100
         PageListView:GetGenerator().SelectedIndex = PageListView:GetGenerator().SelectedIndex - 1
         PageListView:FocusItems()
         l_1_2.value = true
      else
         if l_1_1.Code == KeyCode_Return or l_1_1.Code == KeyCode_Space then
            PressSelectItem(PageListView)
            if PageListView:GetGenerator().SelectedIndex ~= -1 then
               HitItem(PageListView:GetGenerator().SelectedIndex)
            end
            l_1_2.value = true
         else
            if l_1_1.Code == KeyCode_Right or l_1_1.Code == KeyCode_Left then
               l_1_2.value = true
            end
         end
      end
   end
end

HandleKeyUp = function(l_2_0, l_2_1, l_2_2)
   if l_2_1.Code == KeyCode_Return or l_2_1.Code == KeyCode_Space then
      ReleaseSelectItem(PageListView)
      l_2_2.value = true
   end
end

CheckValidItem = function()
   if ValidItemCount == 0 then
      if IsRmovePage then
         trace("CheckValidItem IsRmovePage")
         OnRemoveItemPress()
      end
      if DataBindingEnabled then
         _application:SetRightSoftkey(Softkey(Locale:GetString(""), Emptyfunction))
      end
   else
     if IsRmovePage then
     else
       _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_REMOVE"), RSKfunction))
     end
   end
end

CountValidItem = function()
   local l_4_0 = (CompositeManager_Instance():GetLaunchItems())
   local l_4_1 = nil
   for i = 0, l_4_0:GetCount() - 1 do
      l_4_1 = l_4_0:GetItem(i)
      if not l_4_1.ReadOnly and l_4_1:GetName() ~= "" then
         ValidItemCount = ValidItemCount + 1
      end
   end
   CheckValidItem()
end

EnlargeIcon = function(l_5_0, l_5_1, l_5_2, l_5_3)
   if l_5_0 then
      local v = Vector3Property(Vector3(0.91999816894531, 0.91999816894531, 0.91999816894531))
      l_5_1.Scale = v
      l_5_2.Scale = v
      l_5_3.Scale = v
   else
      local v = Vector3Property(Vector3(1, 1, 1))
      l_5_1.Scale = v
      l_5_2.Scale = v
      l_5_3.Scale = v
   end
end

PressItem = function(l_6_0)
   local l_6_1 = l_6_0.Namespace:FindName("PageIcon")
   local l_6_2 = l_6_0.Namespace:FindName("PageBackground")
   local l_6_3 = l_6_0.Namespace:FindName("SpriteX")
   if not l_6_0.Tag.ReadOnly then
      l_6_3:SetTextureRef("bt_RemoveX_press")
   end
   EnlargeIcon(true, l_6_1, l_6_2, l_6_3)
end

ReleaseItem = function(l_7_0)
   local l_7_1 = l_7_0.Namespace:FindName("PageIcon")
   local l_7_2 = l_7_0.Namespace:FindName("PageBackground")
   local l_7_3 = l_7_0.Namespace:FindName("SpriteX")
   if not l_7_0.Tag.ReadOnly then
      l_7_3:SetTextureRef("bt_RemoveX_rest")
   end
   EnlargeIcon(false, l_7_1, l_7_2, l_7_3)
end

PressSelectItem = function(l_8_0)
   local l_8_1 = l_8_0:GetGenerator()
   if l_8_1.SelectedIndex ~= -1 then
      PressItem(l_8_1:GetItem(l_8_1.SelectedIndex))
   end
end

ReleaseSelectItem = function(l_9_0)
   local l_9_1 = l_9_0:GetGenerator()
   if l_9_1.SelectedIndex ~= -1 then
      ReleaseItem(l_9_1:GetItem(l_9_1.SelectedIndex))
   end
end

PageItem_Launch = function(l_10_0)
   if l_10_0 ~= nil then
      local l_10_1 = CompositeManager_Instance():GetLaunchItems():GetItem(l_10_0)
      trace("PageItem Launch")
      l_10_1:Launch()
   end
end

HitItem = function(l_11_0)
   local l_11_1 = PageListView:GetGenerator():GetItem(l_11_0)
   local l_11_2 = l_11_1.Namespace:FindName("PageIcon")
   local l_11_3 = l_11_1.Namespace:FindName("PageBackground")
   local l_11_4 = l_11_1.Namespace:FindName("SpriteX")
   local l_11_5 = l_11_1.Namespace:FindName("APName")
   if IsRmovePage then
      if l_11_1.Tag.ReadOnly then
         return 
      end
      if l_11_1.Tag:GetName() ~= "" then
         l_11_2._visible = false
         l_11_5.String = Locale:GetString("IDS_PROGRAMS_ADD")
         l_11_4._visible = false
         l_11_1.Tag = CompositeItem()
         l_11_1.Tag:SetIndex(l_11_0)
         CompositeManager_Instance():Update(l_11_1.Tag)
         l_11_3:SetTextureRef("bt_UserLauncher_rest")
         ValidItemCount = ValidItemCount - 1
         CheckValidItem()
      end
   else
      if l_11_1.Tag:GetName() ~= "" then
         PageItem_Launch(l_11_0)
      else
         if l_11_1.Tag.ReadOnly then
            return 
         end
         _application.Store:SetIntValue(Lifetime_Application, "Programs.ActiveIndex", l_11_0)
         PageChange()
      end
   end
end

HandleSelected = function(l_12_0)
   if ShowApName then
      if not PageTitle then
         PageTitle = _application.Navigation.Title
      end
      if l_12_0.Tag:GetName() ~= "" then
         _application.Navigation.Title = l_12_0.Tag:GetName()
      end
   end
end

HandleDeselected = function(l_13_0)
   if ShowApName and PageTitle then
      _application.Navigation.Title = PageTitle
   end
   ReleaseItem(l_13_0)
end

HandleItemCreated = function(l_14_0, l_14_1)
   trace("++++++++++[Programs tab] : HandleItemCreated")
   local l_14_2 = l_14_1.Namespace:FindName("PageIcon")
   local l_14_3 = l_14_1.Namespace:FindName("SpriteX")
   local l_14_4 = l_14_1.Namespace:FindName("PageBackground")
   local l_14_5 = l_14_1.Namespace:FindName("APName")
   l_14_5.Size.width = ItemSizeWidth
   l_14_5.Size.height = 24
   l_14_5.Position.y = -APNameHeight
   l_14_4._visible = true
   l_14_4.Position.x = (ItemSizeWidth - l_14_4.Size.width) / 2
   l_14_4.Position.y = -(ItemSizeHeight - l_14_4.Size.height) / 2
   if DataBindingEnabled then
      if IsRmovePage then
         l_14_4:SetTextureRef("bt_UserLauncher_rest")
      else
         l_14_4:SetTextureRef("bt_UserLauncher_pluses_rest")
      end
      if l_14_0.ReadOnly then
         l_14_3:SetTextureRef("bt_lock")
      else
         l_14_3:SetTextureRef("bt_RemoveX_rest")
      end
      if l_14_0:GetName() ~= "" then
         l_14_5.String = l_14_0:GetName()
         if IsRmovePage then
            l_14_3._visible = true
         else
            l_14_3._visible = false
         end
         trace("Program Gizmo Item Create Name = " .. l_14_0:GetName())
         l_14_4:SetTextureRef("bt_UserLauncher_rest")
         local l_14_6 = thumbnailFolderPath .. l_14_0:GetName() .. ".qtc"         
         image = Image()
         if image:LoadFile(l_14_6) == true then
            local gt = image:GetTexture()
            l_14_2.Position.x = (l_14_4.Size.width - g_bigIconSize) / 2
            l_14_2.Position.y = -((l_14_4.Size.height - g_bigIconSize) / 2)
            l_14_2.Size.width = g_bigIconSize
            l_14_2.Size.height = g_bigIconSize
            l_14_2:SetTexture(gt)            
         else
            trace("[ProgramLauncher] Load icon " .. l_14_6 .. " !\n")
            l_14_2.Position.x = (l_14_4.Size.width - g_smallIconSize) / 2
            l_14_2.Position.y = -((l_14_4.Size.height - g_smallIconSize) / 2)
            l_14_2.Size.width = g_smallIconSize
            l_14_2.Size.height = g_smallIconSize
            l_14_2:SetTexture(l_14_0:GetIcon())
         end
         l_14_2.Center.x = l_14_2.Size.width / 2
         l_14_2.Center.y = -(l_14_2.Size.height / 2)
         l_14_2._visible = true
         l_14_0:ClearIcon()
      else
         l_14_5.String = Locale:GetString("IDS_PROGRAMS_ADD")
         l_14_2._visible = false
      end
  else
  end
  l_14_1.Focusable = true
  l_14_1.onKeyDown:connect(HandleKeyDown)
  l_14_1.onKeyUp:connect(HandleKeyUp)
  l_14_1.Tag = l_14_0
  l_14_1.OnSelected:connect(HandleSelected)
  l_14_1.OnDeselected:connect(HandleDeselected)
end

HandleItemDestroyed = function(l_15_0)
   local l_15_1 = l_15_0.Namespace:FindName("PageIcon")
   local l_15_2 = l_15_0.Namespace:FindName("SpriteX")
   local l_15_3 = l_15_0.Namespace:FindName("PageBackground")
   l_15_1._visible = false
   l_15_2._visible = false
   l_15_3._visible = false
   trace("Program ItemDestroyed")
   l_15_0.OnSelected:disconnect(HandleSelected)
   l_15_0.OnDeselected:disconnect(HandleDeselected)
end

PageListView_OnPress = function(l_16_0)
   PageListView:GetLayout().SelectionNode.Opacity.value = 0
   PressSelectItem(l_16_0)
end

PageListView_OnRelease = function(l_17_0)
   ReleaseSelectItem(l_17_0)
   l_17_0:GetGenerator().SelectedIndex = -1
end

StartPage = function()
   _application.TouchFlo.VerticalEnabled = false
   PageListView.Position.x = LVPositionX
   PageListView.Position.y = -LVPositionY
   PageListView.Viewport.x = LVWidth
   PageListView.Viewport.y = LVHeight
   CubePage_ItemListLayout = TileLayout()
   local l_18_0 = Vector3F()
   l_18_0.x = ItemSizeWidth
   l_18_0.y = ItemSizeHeight
   l_18_0.z = 0
   ProgramSelector_Highlight.Position.x = (ItemSizeWidth - 102) / 2
   ProgramSelector_Highlight.Position.y = -(ItemSizeHeight - 102) / 2
   CubePage_ItemListLayout.SelectionNode = ProgramSelector
   CubePage_ItemListLayout.ItemSize = l_18_0
   PageListView:SetLayout(CubePage_ItemListLayout)
   if DataBindingEnabled then
      local cmi = CompositeManager_Instance():GetLaunchItems()

      CubePage_ItemListGenerator = CompositeLibraryGenerator(cmi, PageListView:GetMovie(), PageListView.ComponentLibraryName, PageListView.ComponentLibraryID)
   else
      FakeCollection = VectorNotifyint()
      for i = 0, 11 do
         FakeCollection:push_back(i)
      end
      CubePage_ItemListGenerator = LibraryGeneratorint(FakeCollection, PageListView:GetMovie(), PageListView.ComponentLibraryName, PageListView.ComponentLibraryID)
   end
   CubePage_ItemListGenerator.RecycleItems = true
   CubePage_ItemListGenerator.ItemCreated:connect(HandleItemCreated)
   CubePage_ItemListGenerator.ItemDestroyed:connect(HandleItemDestroyed)
   PageListView:SetGenerator(CubePage_ItemListGenerator)
   ProgramsPhysics = ScrollPhysics(PageListView, PageListView, HitItem, true)
   ProgramsPhysics:ConnectMouseEvents()
   PageListView.onPress:connect(PageListView_OnPress)
   PageListView.onRelease:connect(PageListView_OnRelease)
   PageListView.onReleaseOutside:connect(PageListView_OnRelease)
   PageListView:ForceLayout()
   PageListView:Focus()
   CountValidItem()
   local l_18_1 = _application.Store:GetIntValue(Lifetime_Application, "Programs.FocusIndex")
   if l_18_1 ~= 0 then
      PageListView:GetGenerator().SelectedIndex = l_18_1 - 1
      PageListView:FocusItems()
      _application.Store:SetIntValue(Lifetime_Application, "Programs.FocusIndex", 0)
   end
end

if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
   trace("[ProgramLauncher] : EnableLandscape")
   require("Programs\\Programs_Landscape")
   _Programs_ScreenRotation = Programs_ScreenRotation()
end
StartPage()
HandleVisibilityChanged2 = function()
   if _application.Visibility then
      ReleaseSelectItem(PageListView)
   end
   if _application.Visibility then
      ProgramsPhysics:ConnectMouseEvents()
      PageListView.onPress:connect(PageListView_OnPress)
   else
      ProgramsPhysics:DisconnectMouseEvents()
      PageListView.onPress:disconnect(PageListView_OnPress)
   end
end

_application.OnVisibilityChanged:connect(HandleVisibilityChanged2)

⌨️ 快捷键说明

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