diff --git a/Assets/ManagedResources/Prefabs/UI/Loading/LoadingPanel.prefab b/Assets/ManagedResources/Prefabs/UI/Loading/LoadingPanel.prefab index 1f3e41119d..0beb3bf3ce 100644 --- a/Assets/ManagedResources/Prefabs/UI/Loading/LoadingPanel.prefab +++ b/Assets/ManagedResources/Prefabs/UI/Loading/LoadingPanel.prefab @@ -506,7 +506,7 @@ RectTransform: m_RootOrder: 0 m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_AnchorMin: {x: 0, y: 0} - m_AnchorMax: {x: 0, y: 1} + m_AnchorMax: {x: 0, y: 0} m_AnchoredPosition: {x: 0, y: 0} m_SizeDelta: {x: -12, y: -8} m_Pivot: {x: 0.5, y: 0.5} @@ -792,7 +792,7 @@ GameObject: m_Icon: {fileID: 0} m_NavMeshLayer: 0 m_StaticEditorFlags: 0 - m_IsActive: 1 + m_IsActive: 0 --- !u!224 &3739793586502117409 RectTransform: m_ObjectHideFlags: 0 diff --git a/Assets/ManagedResources/~Lua/Modules/Message/LoadingPanel.lua b/Assets/ManagedResources/~Lua/Modules/Message/LoadingPanel.lua index 01d0a8051d..7c8ae99f44 100644 --- a/Assets/ManagedResources/~Lua/Modules/Message/LoadingPanel.lua +++ b/Assets/ManagedResources/~Lua/Modules/Message/LoadingPanel.lua @@ -2,52 +2,54 @@ LoadingPanel = Inherit(BasePanel) local this = LoadingPanel local tipsConfig = ConfigManager.GetConfig(ConfigName.Tips) -local loadingConfig=ConfigManager.GetConfig(ConfigName.Loading) +local loadingConfig = ConfigManager.GetConfig(ConfigName.Loading) --初始化组件(用于子类重写) -local spineName=nil -local spineObj=nil -local configLen=0 +local spineName = nil +local spineObj = nil +local configLen = 0 function LoadingPanel:InitComponent() - -- + -- this.Slider = Util.GetGameObject(self.gameObject, "Slider"):GetComponent("Slider") this.Tip = Util.GetGameObject(self.gameObject, "Slider/Image/LoadingText"):GetComponent("Text") this.SliderText = Util.GetGameObject(self.gameObject, "Slider/Fill Area/Fill/Image/Text"):GetComponent("Text") this.bg = Util.GetGameObject(self.gameObject, "bg1"):GetComponent("Image") - this.heroPos=Util.GetGameObject(self.gameObject, "heroPos") + this.heroPos = Util.GetGameObject(self.gameObject, "heroPos") screenAdapte(Util.GetGameObject(self.gameObject, "bg1")) screenAdapte(Util.GetGameObject(self.gameObject, "bg2")) end -function LoadingPanel:OnOpen(sp) +function LoadingPanel:OnOpen() local index = 0 - this.bg.sprite = sp + --this.bg.sprite = sp math.randomseed(os.time()) - index = math.random(1,16) - this.Tip.text = GetLanguageStrById(tipsConfig[index].Tips) + index = math.random(1, 16) + this.Tip.text = GetLanguageStrById(tipsConfig[index].Tips) end + -- 销毁时回收 function LoadingPanel:OnDestroy() end + local callList = {} local curIndex = 0 local lerp = 0 local maxIndex = 0 local function update() if this.Slider and this.SliderText then - lerp = math.clamp(lerp + Time.fixedDeltaTime * 15,0,1) - local curValue = this.Slider.value * (1-lerp) + curIndex * lerp + lerp = math.clamp(lerp + Time.fixedDeltaTime * 15, 0, 1) + local curValue = this.Slider.value * (1 - lerp) + curIndex * lerp this.Slider.value = curValue - local curTextValue = math.ceil((curValue/this.Slider.maxValue)*100) + local curTextValue = math.ceil((curValue / this.Slider.maxValue) * 100) curTextValue = curTextValue > 100 and 100 or curTextValue - this.SliderText.text = curTextValue .."%" + this.SliderText.text = curTextValue .. "%" end end function LoadingPanel.AddStep(func) table.insert(callList, func) maxIndex = maxIndex + 1 -end +end function LoadingPanel.OnStep() lerp = 0 @@ -61,12 +63,11 @@ end function LoadingPanel.ErrorStep(msg) -- if curIndex >= maxIndex then return end - LogError("登录接口"..curIndex..", 报错:"..msg.errCode .. "|"..msg.errMsg) + LogError("登录接口" .. curIndex .. ", 报错:" .. msg.errCode .. "|" .. msg.errMsg) -- 强制进入下一步 LoadingPanel.OnStep() end - function LoadingPanel.Start() -- 创建sprite加载器 this.spLoader = SpriteLoader.New() @@ -79,41 +80,42 @@ function LoadingPanel.Start() -- spName = sprites[index] -- end --LoadStreamingTexture(this.spLoader, spName, function(sp) - if #callList <= 1 then - return + if #callList <= 1 then + return + end + local heroConfig + for k, v in ConfigPairs(loadingConfig) do + configLen = configLen + 1 + end + local spineLive = math.random(1, configLen) + local curLoad = ConfigManager.TryGetConfigData(ConfigName.Loading, spineLive) + if curLoad then + if spineObj ~= nil and spineName ~= nil then + poolManager:UnLoadLive(spineName, spineObj, PoolManager.AssetType.GameObject) end - local heroConfig - for k,v in ConfigPairs(loadingConfig) do - configLen=configLen+1 - end - local spineLive=math.random(1,configLen) - local curLoad=ConfigManager.TryGetConfigData(ConfigName.Loading,spineLive) - if curLoad then - if spineObj~=nil and spineName~=nil then - poolManager:UnLoadLive(spineName, spineObj, PoolManager.AssetType.GameObject) - end - heroConfig=ConfigManager.TryGetConfigData(ConfigName.HeroConfig,curLoad.Hero) - spName=curLoad.LoadingBG - end - UIManager.OpenPanel(UIName.LoadingPanel,this.spLoader:LoadSprite(spName)) - --LogError("heroconfig i================="..heroConfig[10001].Id.." len==="..#heroConfig) - - if heroConfig then - spineName=GetResourcePath(heroConfig.Live) - spineObj= poolManager:LoadLive(spineName,this.heroPos.transform, Vector3.one * heroConfig.Scale, Vector3.New(heroConfig.Position[1], heroConfig.Position[2], 0)) - spineObj.transform:SetParent(this.heroPos.transform) - -- spineObj.transform.localPosition = Vector2.New(0, -20) - -- spineObj.transform.localScale=Vector3.one - end - UpdateBeat:Add(update) - lerp = 0 - curIndex = 0 - this.Slider.maxValue = #callList - 1 - this.Slider.value = curIndex - --"你知道嘛:充值会让你变得更强!" --"白驹工作室倾情奉献" - LoadingPanel.OnStep() - --end - + heroConfig = ConfigManager.TryGetConfigData(ConfigName.HeroConfig, curLoad.Hero) + spName = curLoad.LoadingBG + end + UIManager.OpenPanel(UIName.LoadingPanel) + --LogError("heroconfig i================="..heroConfig[10001].Id.." len==="..#heroConfig) + + if heroConfig then + spineName = GetResourcePath(heroConfig.Live) + spineObj = poolManager:LoadLive(spineName, this.heroPos.transform, Vector3.one * heroConfig.Scale, + Vector3.New(heroConfig.Position[1], heroConfig.Position[2], 0)) + spineObj.transform:SetParent(this.heroPos.transform) + -- spineObj.transform.localPosition = Vector2.New(0, -20) + -- spineObj.transform.localScale=Vector3.one + end + UpdateBeat:Add(update) + lerp = 0 + curIndex = 0 + this.Slider.maxValue = #callList - 1 + this.Slider.value = curIndex + --"你知道嘛:充值会让你变得更强!" --"白驹工作室倾情奉献" + LoadingPanel.OnStep() + --end + --end) end @@ -121,12 +123,12 @@ function LoadingPanel.End() UpdateBeat:Remove(update) this:ClosePanel() callList = {} - if spineObj~=nil and spineName~=nil then + if spineObj ~= nil and spineName ~= nil then poolManager:UnLoadLive(spineName, spineObj, PoolManager.AssetType.GameObject) end - spineName=nil - spineObj=nil + spineName = nil + spineObj = nil this.spLoader:Destroy() end -return LoadingPanel \ No newline at end of file +return LoadingPanel diff --git a/Assets/StreamingAssets/Android.meta b/Assets/StreamingAssets/Android.meta new file mode 100644 index 0000000000..d812872101 --- /dev/null +++ b/Assets/StreamingAssets/Android.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 928fd3985e8c04d4fa22136ad79aee4d +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: