【主界面】右上角调整

dev_chengFeng
ZhangBiao 2021-05-26 13:48:33 +08:00
parent 51576888a2
commit b526f58bc3
1 changed files with 34 additions and 25 deletions

View File

@ -244,6 +244,12 @@ function this:InitComponent()
this.RightUp2.transform.localScale = Vector3.one * UIManager.adapterScale
this.rpRightUp2 = Util.GetGameObject(this.RightUp2, "BG/redPoint")
this.RightUp2Grid = Util.GetGameObject(self.gameObject, "RightUp2/Ract2D/Grid")
this.RightUp2bgSize = Util.GetGameObject(this.RightUp2,"BG"):GetComponent("RectTransform")
this.RightUp2btn = Util.GetGameObject(this.RightUp2,"BG/Button")
this.RightUp2btnImg = Util.GetGameObject(this.RightUp2,"BG/Button"):GetComponent("RectTransform")
this.RightUp2rectSize = Util.GetGameObject(this.RightUp2,"Ract2D"):GetComponent("RectTransform")
this.RightUp2gridSize = this.RightUp2Grid :GetComponent("RectTransform")
this.jiantouObj=Util.GetGameObject(self.gameObject, "jiantouObj")
end
@ -760,60 +766,62 @@ function this.CreatActivity()
end
end)
end
Timer.New(function ()
this.SetRightBarSize()
end,0.2):Start()
-- CheckRedPointStatus(RedPointType.RightUp2)
Game.GlobalEvent:DispatchEvent(GameEvent.PatFace.RefreshRightUp)
end
--设置右侧条
function this.SetRightBarSize()
LogWarn("SetRightBarSize刷新")
this.RightUp2:SetActive(PlayerManager.level >= 5)
local bgSize = Util.GetGameObject(this.RightUp2,"BG"):GetComponent("RectTransform")
local btn = Util.GetGameObject(this.RightUp2,"BG/Button")
local btnImg = Util.GetGameObject(this.RightUp2,"BG/Button"):GetComponent("RectTransform")
local rectSize = Util.GetGameObject(this.RightUp2,"Ract2D"):GetComponent("RectTransform")
local gridSize = this.RightUp2Grid :GetComponent("RectTransform")
-- local this.RightUp2bgSize = Util.GetGameObject(this.RightUp2,"BG"):GetComponent("RectTransform")
-- local this.RightUp2btn = Util.GetGameObject(this.RightUp2,"BG/Button")
-- local this.RightUp2btnImg = Util.GetGameObject(this.RightUp2,"BG/Button"):GetComponent("RectTransform")
-- local this.RightUp2rectSize = Util.GetGameObject(this.RightUp2,"Ract2D"):GetComponent("RectTransform")
-- local this.RightUp2gridSize = this.RightUp2Grid :GetComponent("RectTransform")
-- this.RightUp2bgSize = Util.GetGameObject(this.RightUp2,"BG"):GetComponent("RectTransform")
-- this.RightUp2btn = Util.GetGameObject(this.RightUp2,"BG/Button")
-- this.RightUp2btnImg = Util.GetGameObject(this.RightUp2,"BG/Button"):GetComponent("RectTransform")
-- this.RightUp2rectSize = Util.GetGameObject(this.RightUp2,"Ract2D"):GetComponent("RectTransform")
-- this.RightUp2gridSize = this.RightUp2Grid :GetComponent("RectTransform")
local str = PlayerPrefs.GetInt(PlayerManager.uid.."MainRightBarSetting")
if not str or str == 0 then
bgSize.sizeDelta = Vector3.New(160,320,0)
rectSize.sizeDelta = Vector3.New(160,220,0)
btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,-90))
this.RightUp2bgSize.sizeDelta = Vector3.New(160,320,0)
this.RightUp2rectSize.sizeDelta = Vector3.New(160,220,0)
this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,-90))
else
LogRed("gridSize.sizeDelta:"..tostring(gridSize.sizeDelta))
bgSize.sizeDelta = gridSize.sizeDelta + Vector3.New(0,100,0)
rectSize.sizeDelta = gridSize.sizeDelta
btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,90))
this.RightUp2bgSize.sizeDelta = this.RightUp2gridSize.sizeDelta + Vector3.New(0,100,0)
this.RightUp2rectSize.sizeDelta = this.RightUp2gridSize.sizeDelta
this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,90))
end
Util.AddOnceClick(btn.gameObject,function()
Util.AddOnceClick(this.RightUp2btn.gameObject,function()
local str2 = PlayerPrefs.GetInt(PlayerManager.uid.."MainRightBarSetting")
if str2 == 0 then
PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting",1)
--按钮旋转
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return -90 end),
DG.Tweening.Core.DOSetter_float(function (t)
btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t))
this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t))
end), 90, 0.3):SetEase(Ease.Linear)
--底图拉伸
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 220 end),
DG.Tweening.Core.DOSetter_float(function (t)
rectSize.sizeDelta = Vector3.New(160,t,0)
bgSize.sizeDelta = Vector3.New(160,t + 100,0)
end), gridSize.sizeDelta.y, 0.3):SetEase(Ease.Linear)
this.RightUp2rectSize.sizeDelta = Vector3.New(160,t,0)
this.RightUp2bgSize.sizeDelta = Vector3.New(160,t + 100,0)
end), this.RightUp2gridSize.sizeDelta.y, 0.3):SetEase(Ease.Linear)
else
PlayerPrefs.SetInt(PlayerManager.uid.."MainRightBarSetting",0)
--按钮旋转
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return 90 end),
DG.Tweening.Core.DOSetter_float(function (t)
btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t))
this.RightUp2btnImg.rotation = Quaternion.Euler(Vector3.New(0,0,t))
end), -90, 0.3):SetEase(Ease.Linear)
--底图拉伸
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return gridSize.sizeDelta.y end),
DoTween.To(DG.Tweening.Core.DOGetter_float( function () return this.RightUp2gridSize.sizeDelta.y end),
DG.Tweening.Core.DOSetter_float(function (t)
rectSize.sizeDelta = Vector3.New(160,t,0)
bgSize.sizeDelta = Vector3.New(160,t + 100,0)
this.RightUp2rectSize.sizeDelta = Vector3.New(160,t,0)
this.RightUp2bgSize.sizeDelta = Vector3.New(160,t + 100,0)
end), 220, 0.3):SetEase(Ease.Linear)
end
end)
@ -1073,6 +1081,7 @@ end
-- 时间格式化
function this.TimeFormat()
-- 如果逮到一个云游商人
this.SetRightBarSize()
local isRoamActive = ShopManager.IsActive(SHOP_TYPE.ROAM_SHOP)
this.yunyou:SetActive(isRoamActive)
if isRoamActive then