📄 weathercitypicker.luac.lua
字号:
_application:SetLeftSoftkey(Softkey("", nil))
_application:SetRightSoftkey(Softkey(Locale:GetString("IDS_CANCEL"), CancelCountryList))
if BackCountryIndex then
CountryPickerList:GetLayout():JumpToIndex(BackCountryIndex, ListAlignment_Top, ListAlignmentOptions_Snap)
CountryPickerList:GetGenerator().SelectedIndex = BackCountryIndex
CountryPickerList:FocusItems()
BackCountryIndex = nil
else
local l_18_0 = weather.FocusIndex
if l_18_0 ~= -1 then
CountryPickerList:GetLayout():JumpToIndex(l_18_0, ListAlignment_Top, ListAlignmentOptions_Snap)
CountryPickerList:GetGenerator().SelectedIndex = l_18_0
CountryPickerList:FocusItems()
end
end
end
GetLetter = function(l_19_0)
if l_19_0 == KeyCode_A then
return "a"
end
if l_19_0 == KeyCode_B then
return "b"
end
if l_19_0 == KeyCode_C then
return "c"
end
if l_19_0 == KeyCode_D then
return "d"
end
if l_19_0 == KeyCode_E then
return "e"
end
if l_19_0 == KeyCode_F then
return "f"
end
if l_19_0 == KeyCode_G then
return "g"
end
if l_19_0 == KeyCode_H then
return "h"
end
if l_19_0 == KeyCode_I then
return "i"
end
if l_19_0 == KeyCode_J then
return "j"
end
if l_19_0 == KeyCode_K then
return "k"
end
if l_19_0 == KeyCode_L then
return "l"
end
if l_19_0 == KeyCode_M then
return "m"
end
if l_19_0 == KeyCode_N then
return "n"
end
if l_19_0 == KeyCode_O then
return "o"
end
if l_19_0 == KeyCode_P then
return "p"
end
if l_19_0 == KeyCode_Q then
return "q"
end
if l_19_0 == KeyCode_R then
return "r"
end
if l_19_0 == KeyCode_S then
return "s"
end
if l_19_0 == KeyCode_T then
return "t"
end
if l_19_0 == KeyCode_U then
return "u"
end
if l_19_0 == KeyCode_V then
return "v"
end
if l_19_0 == KeyCode_W then
return "w"
end
if l_19_0 == KeyCode_X then
return "x"
end
if l_19_0 == KeyCode_Y then
return "y"
end
if l_19_0 == KeyCode_Z then
return "z"
end
if l_19_0 == KeyCode_Space then
return " "
end
if l_19_0 == KeyCode_Subtract then
return "-"
end
return ""
end
GetModifiedSearchString = function(l_20_0, l_20_1)
local l_20_2 = GetLetter(l_20_1)
if l_20_2 ~= "" then
return l_20_0 .. l_20_2
elseif l_20_1 == KeyCode_Backspace then
if string.len(l_20_0) == 0 then
return ""
end
return string.sub(l_20_0, 1, string.len(l_20_0) - 1)
elseif l_20_1 == KeyCode_Escape then
return ""
end
return l_20_0
end
HandleGizmoPress = function(l_21_0, l_21_1)
if GizmoView._visible == true then
l_21_1.value = true
end
end
HandleGizmoRelease = function(l_22_0, l_22_1)
if GizmoView._visible == true then
l_22_1.value = true
end
EasterEggAdvanceState(2)
end
HandleGizmoReleaseOutside = function(l_23_0, l_23_1)
if GizmoView._visible == true then
l_23_1.value = true
end
EasterEggAdvanceState(2)
end
FocusOutInputBox = function()
_application:HideInputPanel()
if InputBox.WindowText == "" then
InputBoxDefaultText._visible = true
LetterPickerGroup._visible = true
end
end
InputBoxOnPress = function()
_application:ShowInputPanel(0)
InputBox:SetShowWindowFlag(true)
InputBox:Focus()
InputBoxDefaultText._visible = false
LetterPickerGroup._visible = false
end
InputBoxChanged = function()
if InputBoxFlag then
InputBoxFlag = false
return
end
if CountryPickerList._visible == true then
CountryPickerList:GetLayout():JumpToIndex(0, ListAlignment_Top, ListAlignmentOptions_Snap)
CountryPickerList:JumpToIndex(0)
CountryPickerList:GetGenerator().SelectedIndex = 0
CountryPickerList:FocusItems()
CountryPickerList:GetGenerator().Collection = weather:SearchCountries(InputBox.WindowText)
else
CityPickerList:GetLayout():JumpToIndex(0, ListAlignment_Top, ListAlignmentOptions_Snap)
CityPickerList:JumpToIndex(0)
CityPickerList:GetGenerator().SelectedIndex = 0
CityPickerList:FocusItems()
CityPickerList:GetGenerator().Collection = weather:SearchCitiesInCountry(InputBox.WindowText, currentCountry, 5000)
end
end
HandleEatsEventsCover = function(l_27_0, l_27_1)
l_27_1.value = true
trace("Eats indicator events")
end
OnIndicatorBarVisibilityChange = function(l_28_0)
local l_28_1 = 430
if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" and _application.Orientation == ScreenOrientation_Landscape then
l_28_1 = 750
end
if l_28_0:IndicatorBarVisibility() then
LetterPickerContainer.Position.x = l_28_1
else
LetterPickerContainer.Position.x = l_28_1 - 5
end
end
OnPostPageInit2 = function()
HitDetector.onPress:connect(HandleGizmoPress)
HitDetector.onRelease:connect(HandleGizmoRelease)
HitDetector.onReleaseOutside:connect(HandleGizmoReleaseOutside)
sprCover.onPress:connect(HandleEatsEventsCover)
sprCover.onRelease:connect(HandleEatsEventsCover)
sprCover.onReleaseOutside:connect(HandleEatsEventsCover)
Text_bg.onPress:connect(InputBoxOnPress)
InputBox.OnTextChanged:connect(InputBoxChanged)
InputBox.onFocusOut:connect(FocusOutInputBox)
InputBoxFlag = flase
end
OnPostPageInit1 = function()
if _config_os == "windowsmobile" then
CityPickerList.AllowScrollToEnd = false
CountryPickerList.AllowScrollToEnd = false
else
CityQuery = VectorNotifyint()
for i = 0, 20 do
CityQuery:push_back(i)
end
cityPickerLayout = TileLayout()
cityPickerLayout:SetItemSize(480, 81, 0)
CityPickerList:SetLayout(cityPickerLayout)
itemListGenerator = LibraryGeneratorint(CityQuery, CityPickerList:GetMovie(), CityPickerList.ComponentLibraryName, CityPickerList.ComponentLibraryID)
itemListGenerator.RecycleItems = true
itemListGenerator.ItemCreated:connect(HandleCityListItemCreation)
itemListGenerator.ItemDestroyed:connect(HandleCityListItemDestruction)
CityPickerList:GetLayout().SelectionNode = CityPickerSelector
CityPickerList:SetGenerator(itemListGenerator)
end
end
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -