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

📄 soundsettingsscript.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 3 页
字号:
   local l_35_11 = l_35_0.Namespace:FindName("SliderComponent")
   local l_35_12 = l_35_0.Namespace:FindName("OnOffButtonComponent")
   local l_35_13 = l_35_0.Namespace:FindName("RadioButtonComponent")
   local l_35_14 = l_35_0.Namespace:FindName("CheckboxComponent")
   if not l_35_1 then
      l_35_8.Duration = 0
   else
      l_35_8.Duration = 40
   end
   if not l_35_2 then
      l_35_9.Duration = 0
   else
      l_35_9.Duration = 40
   end
   if not l_35_3 then
      l_35_10.Duration = 0
   else
      l_35_10.Duration = 40
   end
   if not l_35_4 then
      l_35_11.Duration = 0
   else
      l_35_11.Duration = 40
   end
   if not l_35_5 then
      l_35_12.Duration = 0
   else
      l_35_12.Duration = 40
   end
   if not l_35_6 then
      l_35_13.Duration = 0
   else
      l_35_13.Duration = 40
   end
   if not l_35_7 then
      l_35_14.Duration = 0
   else
      l_35_14.Duration = 40
   end
end

Sound_HandleItemCreated = function(l_36_0, l_36_1)
   local ntext = l_36_1.Namespace:FindName("Text")
   local nmaintext = l_36_1.Namespace:FindName("MainText")
   local ndetailtext = l_36_1.Namespace:FindName("DetailText")
   local nslidercomponent = l_36_1.Namespace:FindName("SliderComponent")
   local onoffbuttoncomponent = l_36_1.Namespace:FindName("OnOffButtonComponent")
   local nradiobuttoncomponent = l_36_1.Namespace:FindName("RadioButtonComponent")
   local ntextcomponent = l_36_1.Namespace:FindName("TextComponent")
   local ntextwithdetailcomponent = l_36_1.Namespace:FindName("TextWithDetailComponent")
   local niconcomponent = l_36_1.Namespace:FindName("IconComponent")
   local nicon = l_36_1.Namespace:FindName("Icon")
   local niconbox = l_36_1.Namespace:FindName("IconBox")
   if Sound_MapSettingsItemUI[l_36_0].DetailText ~= "" then
      nmaintext.String = Sound_MapSettingsItemUI[l_36_0].Text
      ndetailtext.String = Sound_MapSettingsItemUI[l_36_0].DetailText
      ntextcomponent._visible = false
      ntextwithdetailcomponent._visible = true
   else
      ntext.String = Sound_MapSettingsItemUI[l_36_0].Text
      ntextcomponent._visible = true
      ntextwithdetailcomponent._visible = false
   end
   if Sound_MapSettingsItemUI[l_36_0].IconTexture ~= nil then
      nicon._visible = false
      niconbox:SetTextureRef(Sound_MapSettingsItemUI[l_36_0].IconTexture)
      niconbox.TextureCoords:set(0, 0, 0.875, 0.875)
      niconbox.Size.width = 56
      niconbox.Size.height = 56
      ntextcomponent.Position.x = 60
      ntextwithdetailcomponent.Position.x = 60
   end
   nslidercomponent._visible = Sound_MapSettingsItemUI[l_36_0].SliderVisible
   onoffbuttoncomponent._visible = Sound_MapSettingsItemUI[l_36_0].OnOffButtonVisible
   nradiobuttoncomponent._visible = Sound_MapSettingsItemUI[l_36_0].RadioVisible
   niconcomponent._visible = Sound_MapSettingsItemUI[l_36_0].IconTexture ~= nil
   FreeUnusedAssets(l_36_1, ntextcomponent._visible, ntextwithdetailcomponent._visible, niconcomponent._visible, nslidercomponent._visible, onoffbuttoncomponent._visible, nradiobuttoncomponent._visible, false)
   l_36_1.Tag = {}
   l_36_1.Tag.Data = l_36_0
   Sound_MapVisibleElements[Sound_MapSettingsItemUI[l_36_0]] = l_36_1
   local l_36_13 = Sound_GetValueForElement(l_36_1)
   l_36_1.Focusable = true
   l_36_1.OnSelected:connect(Sound_ItemSelectedFunc)
   l_36_1.OnDeselected:connect(Sound_ItemDeselectedFunc)
   if onoffbuttoncomponent._visible then
      OnOffButton_Initialize(onoffbuttoncomponent, l_36_13)
      l_36_1.onKeyDown:connect(Sound_HandleOnOffKeyDown)
   elseif nslidercomponent._visible then
      SliderControl_Initialize(nslidercomponent, l_36_13)
      ndetailtext.String = tostring(l_36_13) .. Locale:GetString("IDS_PERCENT")
      nslidercomponent.Tag.Data = l_36_0
      l_36_1.onKeyDown:connect(Sound_HandleSliderKeyDown)
      if SoundPageGetNewRingTones then
         if l_36_0 == 5 then
            RingSlider = nslidercomponent
         elseif l_36_0 == 9 then
            SystemSlider = nslidercomponent
         end
      else
         if l_36_0 == 5 then
            RingSlider = nslidercomponent
         elseif l_36_0 == 8 then
            SystemSlider = nslidercomponent
         end
     end
  elseif nradiobuttoncomponent._visible then
      RadioButton_Initialize(nradiobuttoncomponent, l_36_13)
      l_36_1.onKeyDown:connect(Sound_HandleRadioKeyDown)
  elseif l_36_13 ~= nil then
      if not SoundPageGetNewRingTones or SoundPageGetNewRingTones and l_36_0 ~= 8 then
         local x = Locale:GetString("IDS_CURRENT_DETAIL")
         ndetailtext.String = string.format(x, l_36_13)
      end
      l_36_1.onKeyDown:connect(Sound_HandleDetailKeyDown)
   end
   if Sound_HandleItemCreated_Operator ~= nil then
      Sound_HandleItemCreated_Operator(l_36_1)
   end
end

Sound_HandleHeaderCreated = function(l_37_0, l_37_1)
   local ntext = l_37_1.Namespace:FindName("Text")
   if SoundPageGetNewRingTones then
      if l_37_0 >= 0 and l_37_0 <= 3 then
         ntext.String = "[[IDS_PROFILES]]"
      elseif l_37_0 >= 4 and l_37_0 <= 4 then
         ntext.String = "Volume Control"
      elseif l_37_0 >= 5 and l_37_0 <= 8 then
         ntext.String = "[[IDS_RINGS]]"
      elseif l_37_0 >= 9 then
         ntext.String = "[[IDS_SYSTEM]]"
      end
   else         
      if l_37_0 >= 0 and l_37_0 <= 3 then
         ntext.String = "[[IDS_PROFILES]]"
      elseif l_37_0 >= 4 and l_37_0 <= 4 then
         ntext.String = "[[IDS_VOLUME_CTRL]]"
      elseif l_37_0 >= 5 and l_37_0 <= 7 then
         ntext.String = "[[IDS_RINGS]]"
      elseif l_37_0 >= 8 then
         ntext.String = "[[IDS_SYSTEM]]"
      end
   end
end

Sound_CompareItems = function(a, b)
   local res = -1
   if SoundPageGetNewRingTones then
      if (a >= 0 and a <= 3 and b >= 0 and b <= 3) or
         (a >= 4 and a <= 4 and b >= 4 and b <= 4) or
         (a >= 5 and a <= 8 and b >= 5 and b <= 8) or
         (a >= 9 and b >= 9)
      then
          res = 0
      end
   else
      if (a >= 0 and a <= 3 and b >= 0 and b <= 3) or
         (a >= 4 and a <= 4 and b >= 4 and b <= 4) or
         (a >= 5 and a <= 7 and b >= 5 and b <= 7) or
         (a >= 8 and b >= 8)
      then
          res = 0
      end     
   end
   return res
end

Sound_HandleItemDestroyed = function(l_39_0)
   Sound_MapVisibleElements[Sound_MapSettingsItemUI[l_39_0.Tag.Data]] = nil
   l_39_0.onKeyDown:disconnect(Sound_HandleOnOffKeyDown)
   l_39_0.onKeyDown:disconnect(Sound_HandleSliderKeyDown)
   l_39_0.onKeyDown:disconnect(Sound_HandleRadioKeyDown)
   l_39_0.onKeyDown:disconnect(Sound_HandleDetailKeyDown)
   l_39_0.OnSelected:disconnect(Sound_ItemSelectedFunc)
   l_39_0.OnDeselected:disconnect(Sound_ItemDeselectedFunc)
end

Sounds_DoneSoftkeyCallback = function()
   _application.Navigation:NavigateBack()
end

Sounds_MoreOptionsSoftkeyCallback = function()
   Shell_NavigateTo(ShellLocation_Sound)
end

SoundsPage_Create = function()
   NormalProfileUI = SoundSettingsItemUI("NormalProfile", "[[IDS_NORMAL]]", "", "profile_normal_icon", false, false, true)
   VibrateProfileUI = SoundSettingsItemUI("VibrateProfile", "[[IDS_VIBRATE]]", "", "profile_vibrate_icon", false, false, true)
   SilentProfileUI = SoundSettingsItemUI("SilentProfile", "[[IDS_SILENT]]", "", "profile_silent_icon", false, false, true)
   if SetPublicModeRegistry then
     CalendarBasedVolumeUI = SoundSettingsItemUI("CalendarProfile", "[[IDS_CALENDARBASEDVOLUME]]", "", "profile_automatic_icon", false, false, true)
   else
     CalendarBasedVolumeUI = SoundSettingsItemUI("CalendarProfile", "[[IDS_CALENDARBASEDVOLUME]]", "[[IDS_CALENDARPROFILE_DETAIL]]", "profile_automatic_icon", false, false, true)
   end
   RingVolumeUI = SoundSettingsItemUI("RingVolume", "[[IDS_VOLUME]]", "[[IDS_PERCENT]]", nil, false, true, false)
   RingtoneUI = SoundSettingsItemUI("Ringtone", "[[IDS_RINGTONE]]", "[[IDS_CURRENT_DETAIL]]", nil, false, false, false)
   VibrateModeUI = SoundSettingsItemUI("VibrateMode", "[[IDS_VIBRATEMODE]]", "[[IDS_CURRENT_DETAIL]]", nil, false, false, false)
   SystemVolumeUI = SoundSettingsItemUI("SystemVolume", "[[IDS_VOLUME]]", "100%", nil, false, true, false)
   NotificationsUI = SoundSettingsItemUI("Notifications", "[[IDS_NOTIFICATIONS]]", "[[IDS_NOTIFICATIONS_DETAIL]]", nil, true, false, false)
   VolumeControlUI = SoundSettingsItemUI("VolumeControl", "[[IDS_VOLUMECTRL_MSG]]", "[[IDS_VOLUMECTRL_DETIAL]]", nil, true, false, false)
   if SoundPageGetNewRingTones then
     NewRingtoneUI = SoundSettingsItemUI("NewRingtone", "[[IDS_GET_NEW_RINGTONE]]", "[[IDS_GET_NEW_RINGTONE_DETAIL]]", nil, false, false, false)
     Sound_MapSettingsItemUI = { [0] = NormalProfileUI, 
                      [1] = VibrateProfileUI,
                      [2] = SilentProfileUI,
                      [3] = CalendarBasedVolumeUI,
                      [4] = VolumeControlUI,
                      [5] = RingVolumeUI,
                      [6] = VibrateModeUI,
                      [7] = RingtoneUI,
                      [8] = NewRingtoneUI,
                      [9] = SystemVolumeUI,
                     [10] = NotificationsUI
                    }
   else
     Sound_MapSettingsItemUI = {
     [0] = NormalProfileUI,
     [1] = VibrateProfileUI,
     [2] = SilentProfileUI,
     [3] = CalendarBasedVolumeUI,
     [4] = VolumeControlUI,
     [5] = RingVolumeUI,
     [6] = VibrateModeUI,
     [7] = RingtoneUI,
     [8] = SystemVolumeUI,
     [9] = NotificationsUI
     }
   end
   if _config_os == "windowsmobile" then
      Sound_RegisterEventCallbacks()
   end
   SoundsSettingsItemListView.Position.x = LVPositionX
   SoundsSettingsItemListView.Position.y = LVPositionY
   SoundsSettingsItemListView.Viewport.x = LVWidth
   SoundsSettingsItemListView.Viewport.y = LVHeight
   Sound_ItemListLayout = SequentialLayout()
   Sound_ItemListLayout:SetItemSize(ItemSizeWidth, ItemSizeHeight, 0)
   Sound_ItemListLayout:SetHeaderSize(ItemSizeWidth, ItemSizeHeight / 2, 0)
   Sound_ItemListLayout.DisableVirtualization = true
   SoundsSettingsItemListView:SetLayout(Sound_ItemListLayout)
   SoundCollection = VectorNotifyint()
   if SoundPageGetNewRingTones then
      for i = 0, 10 do
         SoundCollection:push_back(i)
      end
   else
      for i = 0, 9 do
         SoundCollection:push_back(i)
      end
   end
   Sound_ItemListGenerator = SequentialLibraryGeneratorint(SoundCollection, SoundsSettingsItemListView:GetMovie(), SoundsSettingsItemListView.ComponentLibraryName, SoundsSettingsItemListView.ComponentLibraryID)
   Sound_ItemListGenerator:SetHeaderComponent(SoundsSettingsItemListView:GetMovie(), SoundsSettingsItemListView.ComponentLibraryName, 6)
   Sound_ItemListGenerator.GroupFunction:connect(Sound_CompareItems)
   Sound_ItemListGenerator.HeaderCreated:connect(Sound_HandleHeaderCreated)
   Sound_ItemListGenerator.ItemCreated:connect(Sound_HandleItemCreated)
   Sound_ItemListGenerator.ItemDestroyed:connect(Sound_HandleItemDestroyed)
   Sound_ItemListGenerator.RecycleItems = true
   Sound_ItemListGenerator.RecycleHeaders = true
   SoundsSettingsItemListView:SetGenerator(Sound_ItemListGenerator)
   SoundsSettingsItemListView.onPress:connect(Sound_HandleMouseDown)
   SoundsSettingsItemListView.onMouseMove:connect(Sound_HandleMouseMove)
   SoundsSettingsItemListView.onRelease:connect(Sound_HandleMouseRelease)
   SoundsSettingsItemListView.onReleaseOutside:connect(Sound_HandleMouseRelease)
   ListPhysics = ScrollPhysics(SoundsSettingsItemListView, SoundsSettingsItemListView, Sound_HitIndex)
   ListPhysics:ConnectMouseEvents()
   SoundsSettingsItemListView:Focus()
   if _config_os == "windowsmobile" then
      _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_BACK"), Sounds_DoneSoftkeyCallback))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_MOREOPTIONS"), Sounds_MoreOptionsSoftkeyCallback))
   end
end

if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
   trace("[SoundSettings] : EnableLandscape")
   require("Settings\\SettingsPage_Landscape")
   _SoundPage_ScreenRotation = SettingsPage_ScreenRotation(SoundsSettingsItemListView, Camera_2D, Camera_3D, Mask)
end
SoundsPage_Create()

⌨️ 快捷键说明

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