直接看效果好了,我只弄了两张图片。支持左右滑动。
如果有更好实现的方式,麻烦请告知,网上看无限滑动的例子很多都是动态增减item,我这个是改变每个item的位置来实现无限滑动。
此为Lua代码
local ImageCarousel = class("ImageCarousel")
function ImageCarousel:ctor()
end
function ImageCarousel:Awake()
self.contents = self.transform:Find("Viewport/Contents")
self.Btn_Live = self.contents.transform:Find("Btn_ads_Live");
self.Btn_lottery = self.contents.transform:Find("Btn_ads_lottery");
self.isLeft = true
self.isAuto = true
self.isCheck = false
end
function ImageCarousel:Start(eventData)
local callback = Delegete:New(typeof(CS.UnityEngine.GameObject), Handler(self, self.BtnClick))
self.gameObjec