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

📄 stock_sublayer.luac.lua

📁 htc manila 2 sourcecode
💻 LUA
📖 第 1 页 / 共 2 页
字号:
            end
            if l_14_9 then
               l_14_3:AddItem(l_14_8.Symbol)
            end
         end
         StockManager:DeleteChart(l_14_3)
         l_14_2:DeleteAll()
         StockManager:SaveSearchResult()
         _application.Navigation:Navigate(URL("Manila://inforwidget/stockadd/stockadd.page"), true)
      elseif l_14_0.Result.UserValue == "Delete" then
          StockManager:CancelAllRequests()
          _application.Navigation:Navigate(URL("Manila://inforwidget/stockdelete/stockdelete.page?page=" .. _request.URL.Parameters:GetParameter("page")), true)
      elseif l_14_0.Result.UserValue == "Rearrange" then
          StockManager:CancelAllRequests()
          _application.Navigation:Navigate(URL("Manila://inforwidget/stockrearrange/stockrearrange.page?page=" .. _request.URL.Parameters:GetParameter("page")), true)
      elseif l_14_0.Result.UserValue == "Settings" then
          StockManager:CancelAllRequests()
          _application.Navigation:Navigate(URL("Manila://inforwidget/stocksettings/stocksettings.page"), true)
      elseif l_14_0.Result.UserValue == "UpdateNow" then
          onPressUpdate()
      end
   end
end

HandleVisibilityChanged = function()
   if _application.Visibility == true then
      UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
      SetupTimeUpdator()
   elseif TimerUpdate ~= nil then
      TimerUpdate:Stop()
   end
end

OnMenu = function()
   DialogRequest = _application.DialogManager:GetDialog(URL("Manila://inforwidget-stock-menu.dialog"))
   DialogRequest.OnExit:connect(MenuExitCallback)
   DialogRequest:Show()
end

OnAddStock = function()
   StockManager:SaveSearchResult()
   _application.Navigation:Navigate(URL("Manila://inforwidget/stockadd/stockadd.page"), true)
end

OnStockListViewMouseDown = function(l_18_0)
   trace(" x = " .. l_18_0._xmouse .. ", y = " .. l_18_0._ymouse .. ", ItemSize.x" .. StockListView:GetLayout().ItemSize.x)
end

OnStockListViewMomentumFinish = function()
   trace("[StockSublayer] OnStockListViewMomentumFinish")
end

start = function()
   stock_type = StockType_MyPortfolio
   RedIsUP = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.RedIsUP") == 1
   StockManager = CStockManager(_application.Store)
   if _application.Store:GetStringValue(Lifetime_Permanent, "EnableLandscape") == "true" then
      trace("[StockSublayer] : EnableLandscape")
      require("Stock\\Stock_Landscape")
      _Stock_ScreenRotation = Stock_ScreenRotation(StockListView, Selector, Masksub, YahooFinanceGroup, UpdateComponent, NoStockItemComponent, Camera3Dsub, Camera2Dsub, Selector)
   end
   if StockManager:GetStockItemList(stock_type):GetCount() > 0 then
      StockManager.OnQuoteComplete:connect(OnQueryComplete)
      CreateListView(StockManager:GetStockItemList(stock_type), StockListView, Selector)
      ListPhysics = ScrollPhysics(StockListView, StockListView, HandleItemSelection)
      ListPhysics:ConnectMouseEvents()
      UpdateHitArea.onPress:connect(onPressUpdate)
      UpdateTime.Color = GetMainTextUnselectedColor()
      UpdateTime.String = FormateTime(StockManager:GetPassThroughTime())
      _application.OnVisibilityChanged:connect(HandleVisibilityChanged)
      StockListView.onMouseDown:connect(OnStockListViewMouseDown)
      autoDownloadOn = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.AutoDownloadOff") == 0
      nInterval = _application.Store:GetIntValue(Lifetime_Permanent, "StockManagerAUMInterval")
      DownloadWhenRoaming = _application.Store:GetIntValue(Lifetime_Permanent, "StockData.DownloadWhenRoaming") == 1
      SetupTimeUpdator()
      _application:SetLeftSoftkey(Softkey(Locale:GetString("IDS_UPDATENOW"), onPressUpdate))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_INFOR_MENU"), OnMenu))
      if StockManager:NeedUpdate() and autoDownloadOn then
         onPressUpdate()
      end
      NoStockItemComponent._visible = false
      YahooFinanceGroup._visible = not NoStockItemComponent._visible
   else
      UpdateComponent._visible = false
      Selector._visible = false
      NoStockItemComponent._visible = true
      YahooFinanceGroup._visible = not NoStockItemComponent._visible
      _application:SetLeftSoftkey(Softkey("", nil))
      _application:SetRightSoftkey(Softkey(Locale:GetString("IDS_INFOR_QUOTE"), OnAddStock))
   end
   TitleUpdateGp.Position.x = TitleUpdateGp.Position.x - 10
   error_log = false
   IsFlipping = false
end

DoOnChangeSymbolPress = function(l_21_0, l_21_1)
   trace("[StockSublayer] DoOnChangeSymbolPress")
   l_21_1.value = true
   DoRotationAnimation(l_21_0)
   local l_21_2 = l_21_0.Namespace:FindName("ChangeSymbol")
   if l_21_2 == nil then
      return 
   end
   l_21_2.onPress:disconnect(DoOnChangeSymbolPress)
   l_21_2.onRelease:connect(DoOnChangeSymbolRelease)
   l_21_2.onReleaseOutside:connect(DoOnChangeSymbolReleaseOutside)
end

DoOnChangeSymbolRelease = function(l_22_0)
   trace("[StockSublayer] DoOnChangeSymbolRelease")
end

DoOnChangeSymbolReleaseOutside = function(l_23_0)
   trace("[StockSublayer] DoOnChangeSymbolReleaseOutside")
end

DoRotationTimer = function()
   trace("[StockSublayer] DoOnChangeSymbolReleaseOutside")
   if RotateIndex < StockListView:GetGenerator():GetCount() then
      trace("[StockSublayer] items " .. RotateIndex)
      local item = StockListView:GetGenerator():GetItem(RotateIndex)
      if item ~= nil then
         local cs = item.Namespace:FindName("ChangeSymbol")
         DoRotationAnimation(cs)
      end
   else
      trace("[StockSublayer] End Update Animation")
      AnimationTimer:Stop()
   end
   RotateIndex = RotateIndex + 1
end

DoRotationAnimation = function(l_25_0)
   trace("[StockSublayer] DoRotationAnimation")
   local l_25_1 = l_25_0.Namespace:FindName("ChangeSymbol")
   local l_25_2 = l_25_0.Namespace:FindName("Change")
   local l_25_3 = l_25_0.Namespace:FindName("ChangePercent")
   if l_25_1 ~= nil and l_25_2 ~= nil and l_25_3 ~= nil then
    if IsFlipping == false then
      IsFlipping = true
      l_25_1.Rotation.x = 0
      l_25_2.Rotation.x = 0
      l_25_3.Rotation.x = 0
      l_25_1.Rotation:Interpolate(Vector3(0, l_25_1.Rotation.y, l_25_1.Rotation.z), Vector3(90, l_25_1.Rotation.y, l_25_1.Rotation.z), 5, 0, Interpolate_Linear, nil)
      if l_25_2._visible == true then
         l_25_2.Rotation:Interpolate(Vector3(0, l_25_2.Rotation.y, l_25_2.Rotation.z), Vector3(90, l_25_2.Rotation.y, l_25_2.Rotation.z), 5, 0, Interpolate_Linear, DoSecHalfAnime, l_25_0)
      else
         l_25_3.Rotation:Interpolate(Vector3(0, l_25_3.Rotation.y, l_25_3.Rotation.z), Vector3(90, l_25_3.Rotation.y, l_25_3.Rotation.z), 5, 0, Interpolate_Linear, DoSecHalfAnime, l_25_0)
      end
      IsFlipping = false
     else
      IsFlipping = false
      l_25_1.Rotation.x = 0
      l_25_2.Rotation.x = 0
      l_25_3.Rotation.x = 0
      if l_25_2._visible == true then
         l_25_2._visible = false
         l_25_3._visible = true
      else
         l_25_2._visible = true
         l_25_3._visible = false
       end
     end
  else
    trace("[StockSublayer] Symbol == nil")
  end
end

DoUpdateAnimation = function()
   trace("[StockSublayer] Start Update Animation")
   itemIdx = StockListView:GetIndexAtMousePoint(10, 111)
   trace("[StockSublayer] first item index of current page is " .. itemIdx)
   if AnimationTimer == nil then
      AnimationTimer = timer(0.099990844726563)
      AnimationTimer.OnElapsed:connect(DoOnAnimationTimer)
      AnimationTimer:Start()
   else
      AnimationTimer:Stop()
      AnimationTimer:Start()
   end
end

DoOnAnimationTimer = function()
   if itemIdx < StockListView:GetGenerator():GetCount() then
      trace("[StockSublayer] items " .. itemIdx)
      local l_27_0 = StockListView:GetGenerator():GetItem(itemIdx)
      local l_27_1 = StockListView:GetGenerator():GetData(itemIdx)
      if l_27_0 ~= nil then
         local l_27_2 = l_27_0.Namespace:FindName("SubLayerStockGroup")
         if l_27_2 ~= nil then
            local l_27_3 = itemIdx
            l_27_2.Rotation:Interpolate(Vector3(0, l_27_2.Rotation.y, l_27_2.Rotation.z), Vector3(90, l_27_2.Rotation.y, l_27_2.Rotation.z), 6, 0, Interpolate_Linear, nil)
            HandleItemCreated(l_27_1, l_27_0)
            l_27_2.Rotation:Interpolate(Vector3(270, l_27_2.Rotation.y, l_27_2.Rotation.z), Vector3(360, l_27_2.Rotation.y, l_27_2.Rotation.z), 6, 0, Interpolate_Linear, nil)
          end
      end          
   else
      trace("[StockSublayer] End Update Animation")
      AnimationTimer:Stop()
   end
   itemIdx = itemIdx + 1
end

DoSecHalfAnime = function(l_28_0)
   trace("[StockSublayer] OnIconAnimeComplete")
   local l_28_1 = l_28_0.Namespace:FindName("ChangeSymbol")
   local l_28_2 = l_28_0.Namespace:FindName("Change")
   local l_28_3 = l_28_0.Namespace:FindName("ChangePercent")
   if l_28_1 ~= nil and l_28_2 ~= nil and l_28_3 ~= nil then
      l_28_1.Rotation:Interpolate(Vector3(270, l_28_1.Rotation.y, l_28_1.Rotation.z), Vector3(360, l_28_1.Rotation.y, l_28_1.Rotation.z), 5, 0, Interpolate_Linear, OnIconAnimeComplete, l_28_0)
      if l_28_2._visible == true then
         l_28_2._visible = false
         l_28_3._visible = true
         l_28_3.Rotation:Interpolate(Vector3(270, l_28_3.Rotation.y, l_28_3.Rotation.z), Vector3(360, l_28_3.Rotation.y, l_28_3.Rotation.z), 5, 0, Interpolate_Linear, nil)
      else
         l_28_2._visible = true
         l_28_3._visible = false
         l_28_2.Rotation:Interpolate(Vector3(270, l_28_2.Rotation.y, l_28_2.Rotation.z), Vector3(360, l_28_2.Rotation.y, l_28_2.Rotation.z), 5, 0, Interpolate_Linear, nil)
      end
   end
end

OnIconAnimeComplete = function(l_29_0)
   local l_29_1 = l_29_0.Namespace:FindName("ChangeSymbol")
   local l_29_2 = l_29_0.Namespace:FindName("Change")
   local l_29_3 = l_29_0.Namespace:FindName("ChangePercent")
   if l_29_1 ~= nil and l_29_2 ~= nil and l_29_3 ~= nil then
      l_29_2.Rotation.x = 0
      l_29_3.Rotation.x = 0
      l_29_1.onPress:connect(DoOnChangeSymbolPress)
      l_29_1.onRelease:disconnect(DoOnChangeSymbolRelease)
      l_29_1.onReleaseOutside:disconnect(DoOnChangeSymbolReleaseOutside)
   end
end

objs3D = {}
objs3D[1] = Group
setOffScreen()
OnNavigateOut = function(l_30_0)
   _request.NavigateOutTo:disconnect(OnNavigateOut)
   trace("navigate out")
   _application.OnVisibilityChanged:disconnect(HandleVisibilityChanged)
   if StockManager ~= nil then
      StockManager:CancelAllRequests()
      StockManager = nil
   end
   if AnimationTimer ~= nil then
      AnimationTimer:Stop()
   end
   Transition(l_30_0, "Out")
end

OnNavigateIn = function(l_31_0)
   Transition(l_31_0, "In")
   start()
end

_request.NavigateInFrom:connect(OnNavigateIn)
_request.NavigateOutTo:connect(OnNavigateOut)

⌨️ 快捷键说明

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