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

📄 4.lua

📁 htc manila 2 sourcecode
💻 LUA
字号:
-- Decompiled using luadec 1.0 by sztupy (http://winmo.sztupy.hu)
-- Command line was: -l2 ;1;;21;115,126,198,240;;;;;;; 6c422ab4_manila_4800.luac 

FrameArray = {}
FrameArray[1] = Picture1
FrameArray[2] = Picture2
FrameArray[3] = Picture3
FrameArray[4] = Picture4
FrameArray[5] = Picture5
FrameArray[6] = Picture6
PhotoArray = {}
PhotoArray[1] = Photo1
PhotoArray[2] = Photo2
PhotoArray[3] = Photo3
PhotoArray[4] = Photo4
PhotoArray[5] = Photo5
PhotoArray[6] = Photo6
IndexArray = {}
IndexArray[1] = -1
IndexArray[2] = -1
IndexArray[3] = -1
IndexArray[4] = -1
IndexArray[5] = -1
IndexArray[6] = -1
CurrentlyDisplayingFrameIndex = 0
DesiredDataIndex = -1
NewDesiredDataIndex = -1
NumDisplayingPictures = 0
RotationEaseFunction = Interpolate_Linear
RotationDuration = 0
OpacityEaseFunction = Interpolate_Linear
OpacityDuration = 0
GetWrappingFrameIndex = function(l_1_0)
   local l_1_1 = l_1_0
   if NumDisplayingPictures + 1 < l_1_0 then
      l_1_1 = l_1_0 - (NumDisplayingPictures + 1)
   elseif l_1_0 < 1 then
      l_1_1 = l_1_0 + NumDisplayingPictures + 1
   end
   return l_1_1
end

GetDataIndex = function(l_2_0)
   if ThumbnailList:GetGenerator():GetCount() - 1 < l_2_0 then
      return -1
   elseif l_2_0 < 0 then
      return -1
   else
      return l_2_0
   end
end

GetNextIndexToDisplay = function()
   if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex] then
      for i = 0, NumDisplayingPictures - 1 do
         if IndexArray[GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + i)] == DesiredDataIndex then
            if IndexArray[GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + NumDisplayingPictures - 1)] == -1 then
               return -1
            else
               return GetDataIndex(IndexArray[GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + NumDisplayingPictures - 1)] + 1)
            end
         end
      end
      return DesiredDataIndex      
   else
      if IndexArray[CurrentlyDisplayingFrameIndex] - DesiredDataIndex > NumDisplayingPictures then
         return GetDataIndex(DesiredDataIndex + NumDisplayingPictures - 1)
      else
         return GetDataIndex(IndexArray[CurrentlyDisplayingFrameIndex] - 1)
      end
   end
end

IsFlipping = false
FlipToIndex = function()
   DesiredDataIndex = NewDesiredDataIndex
   trace("Attempting to flip to the new index\n")
   if DesiredDataIndex < 0 then
      trace("New index is -1, resetting our pictures\n")
      ResetFrames()
   elseif NumDisplayingPictures == 0 then
      trace("No currently displaying pictures, animating them all into position\n")
      if ThumbnailList:GetGenerator():GetCount() > 5 then
         NumDisplayingPictures = 5
      else
         NumDisplayingPictures = ThumbnailList:GetGenerator():GetCount()
      end
      for i = 1, NumDisplayingPictures do
         IndexArray[i] = GetDataIndex(DesiredDataIndex + i - 1)
         if IndexArray[i] == -1 then
            FrameArray[i]._visible = false
         else
            FrameArray[i]._visible = true
            SetIndexPicture(PhotoArray[i], IndexArray[i])
         end
         FrameArray[i].Rotation:Interpolate(Vector3(0 - (i - 1) * 90 / NumDisplayingPictures, FrameArray[i].Rotation.y, FrameArray[i].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
         FrameArray[i].Opacity:Interpolate(100, OpacityDuration, 0, OpacityEaseFunction, nil)
         trace("Updating Frame " .. i .. " opacity to 100\n")
      end
      CurrentlyDisplayingFrameIndex = 1
   else
      IsFlipping = true
      trace("Already have some pictures displaying, animating them properly\n")
      local l_4_0 = 90 / NumDisplayingPictures
      trace("Calculated our distance between pictures to be " .. l_4_0 .. "\n")
      local l_4_1 = GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + NumDisplayingPictures)
      trace("Picked " .. l_4_1 .. " as our new frame index\n")
      if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex] then
         FrameArray[l_4_1].Rotation.x = -90
      else
         FrameArray[l_4_1].Rotation.x = 90
      end
      FrameArray[l_4_1].Opacity.value = 0
      trace("Setting frame " .. l_4_1 .. " to 0\n")
      IndexArray[l_4_1] = GetNextIndexToDisplay()
      if IndexArray[l_4_1] == -1 then
         FrameArray[l_4_1]._visible = false
      else
         FrameArray[l_4_1]._visible = true
         SetIndexPicture(PhotoArray[l_4_1], IndexArray[l_4_1])
      end
      trace("Animating the new frame into position\n")
      FrameArray[l_4_1].Opacity:Interpolate(100, OpacityDuration, 0, OpacityEaseFunction, nil)
      trace("Animating frame " .. l_4_1 .. " to 100 \n")
      local l_4_2 = nil
      if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex] then
         l_4_2 = -90 + l_4_0
         Pictures3D:MoveAssetToBeginning(FrameArray[l_4_1])
      else
         l_4_2 = 0
         Pictures3D:MoveAssetToEnd(FrameArray[l_4_1])
      end
      FrameArray[l_4_1].Rotation:Interpolate(Vector3(l_4_2, FrameArray[l_4_1].Rotation.y, FrameArray[l_4_1].Rotation.z), RotationDuration, 0, RotationEaseFunction, OnAnimationComplete)
      local l_4_3 = FrameArray[CurrentlyDisplayingFrameIndex]
      if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex] then
         l_4_2 = 90
         trace("CurrentlyDisplayingFrameIndex = " .. CurrentlyDisplayingFrameIndex .. "\n")
         trace("Opacity = " .. l_4_3.Opacity.value .. "\n")
         l_4_3.Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
      else
         l_4_2 = 0 - l_4_0
      end
      l_4_3.Rotation:Interpolate(Vector3(l_4_2, l_4_3.Rotation.y, l_4_3.Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
      trace("Rotating the first picture to " .. l_4_2 .. "\n")
      for i = 1, 4 do
         if i < NumDisplayingPictures then
            l_4_3 = FrameArray[GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + i)]
            if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex] then
               l_4_2 = 0 - (i - 1) * l_4_0
            else
               l_4_2 = 0 - (i + 1) * l_4_0
            end
            l_4_3.Rotation:Interpolate(Vector3(l_4_2, l_4_3.Rotation.y, l_4_3.Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
            trace("Rotated picture " .. i + 1 .. " to " .. l_4_2 .. "\n")
            Shadow.Opacity:Interpolate(100, 50, OpacityDuration, 0, OpacityEaseFunction, nil)
         end
      end
      if NumDisplayingPictures > 1 and DesiredDataIndex < IndexArray[CurrentlyDisplayingFrameIndex] then
         trace("Rotating backwards so hiding the last element\n")
         l_4_3.Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
         trace("Setting UIElement opacity to 0\n")
         Shadow.Opacity:Interpolate(50, 100, OpacityDuration, 0, OpacityEaseFunction, SetShadowOpacityBack)
      end
   end
end

SetShadowOpacityBack = function()
   Shadow.Opacity.value = 50
end

OnAnimationComplete = function()
   trace("Finished animating, changing values\n")
   if DesiredDataIndex > IndexArray[CurrentlyDisplayingFrameIndex]  then
      CurrentlyDisplayingFrameIndex = GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex + 1)
   else
      CurrentlyDisplayingFrameIndex = GetWrappingFrameIndex(CurrentlyDisplayingFrameIndex - 1)
   end
   IsFlipping = false
   if DesiredDataIndex ~= IndexArray[CurrentlyDisplayingFrameIndex] or DesiredDataIndex ~= NewDesiredDataIndex then
      trace("More animations to do, starting another round of flips\n")
      FlipToIndex()
   end
end

IsResetting = false
OnResetComplete = function()
   IsResetting = false
   IsFlipping = false
   if (CurrentlyDisplayingFrameIndex ~= 0 and IndexArray[CurrentlyDisplayingFrameIndex] ~= DesiredDataIndex) or DesiredDataIndex ~= NewDesiredDataIndex then
      FlipToIndex()
   end
end

ResetFrames = function()
   trace("Resetting frames\n")
   IsResetting = true
   FrameArray[1].Rotation:Interpolate(Vector3(-90, FrameArray[1].Rotation.y, FrameArray[1].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
   FrameArray[2].Rotation:Interpolate(Vector3(-90, FrameArray[2].Rotation.y, FrameArray[2].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
   FrameArray[3].Rotation:Interpolate(Vector3(-90, FrameArray[3].Rotation.y, FrameArray[3].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
   FrameArray[4].Rotation:Interpolate(Vector3(-90, FrameArray[4].Rotation.y, FrameArray[4].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
   FrameArray[5].Rotation:Interpolate(Vector3(-90, FrameArray[5].Rotation.y, FrameArray[5].Rotation.z), RotationDuration, 0, RotationEaseFunction, nil)
   FrameArray[6].Rotation:Interpolate(Vector3(-90, FrameArray[6].Rotation.y, FrameArray[6].Rotation.z), RotationDuration, 0, RotationEaseFunction, OnResetComplete)
   FrameArray[1].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   FrameArray[2].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   FrameArray[3].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   FrameArray[4].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   FrameArray[5].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   FrameArray[6].Opacity:Interpolate(0, OpacityDuration, 0, OpacityEaseFunction, nil)
   Pictures3D:MoveAssetToEnd(FrameArray[6])
   Pictures3D:MoveAssetToEnd(FrameArray[5])
   Pictures3D:MoveAssetToEnd(FrameArray[4])
   Pictures3D:MoveAssetToEnd(FrameArray[3])
   Pictures3D:MoveAssetToEnd(FrameArray[2])
   Pictures3D:MoveAssetToEnd(FrameArray[1])
   IndexArray[1] = -1
   IndexArray[2] = -1
   IndexArray[3] = -1
   IndexArray[4] = -1
   IndexArray[5] = -1
   IndexArray[6] = -1
   NumDisplayingPictures = 0
   CurrentlyDisplayingFrameIndex = 0
   DesiredDataIndex = -1
   NewDesiredDataIndex = -1
end

FlipOnSelectedIndexChanged = function(l_9_0, l_9_1)
   NewDesiredDataIndex = l_9_1
   if not IsResetting and not IsFlipping then
      FlipToIndex()
   end
end

FlipOnCollectionReset = function()
   ResetFrames()
end


⌨️ 快捷键说明

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