屏幕适配方式改为按高度适配,修复点击特效位置错误的问题

dev_chengFeng
gaoxin 2020-08-29 17:22:46 +08:00
parent a0535ffc12
commit fc9a5341f0
4 changed files with 13 additions and 6 deletions

View File

@ -11112,10 +11112,10 @@ RectTransform:
m_Father: {fileID: 8490762427581985335}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 1080, y: 1920}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!222 &8490762427331175397
CanvasRenderer:
@ -11493,7 +11493,7 @@ Animator:
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8490762427581985332}
m_Enabled: 1
m_Enabled: 0
m_Avatar: {fileID: 0}
m_Controller: {fileID: 9100000, guid: b85d6ca1190810742abf849920ed910d, type: 2}
m_CullingMode: 0

View File

@ -156,7 +156,7 @@ MonoBehaviour:
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1080, y: 1920}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0.5
m_MatchWidthOrHeight: 1
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96

View File

@ -50,8 +50,12 @@ local update = function()
clickEffect.transform.localScale = Vector3.one
clickEffect.transform.localPosition = Vector3.zero
local ft = UIManager.width/UIManager.height
local rw = ft * 1920
local v3 = Input.mousePosition - effectPos
v3 = Vector3.New(v3.x / UIManager.width * 1080, v3.y / UIManager.height * 1920, v3.z)
v3 = Vector3.New(v3.x / UIManager.width * rw, v3.y / UIManager.height * 1920, v3.z)
clickEffect:GetComponent("RectTransform").anchoredPosition = v3
clickEffect:SetActive(true)

View File

@ -28,6 +28,8 @@ function this:InitComponent()
this.loginPart = this.gameObject
this.tip = Util.GetGameObject(this.loginPart, "tip/Text")
this.loginAnim = this.gameObject:GetComponent("Animator")
this.loginAnim.enabled = false
this.btnLoginPart = Util.GetGameObject(this.loginPart, "jinruyouxi")
this.btnLogin = Util.GetGameObject(this.loginPart, "jinruyouxi _wenzi")
@ -660,6 +662,7 @@ function this.OnDisconnect(network)
end
function this.SetLoginPart(flag)
this.loginAnim.enabled = flag
this.btnLoginPart:SetActive(flag)
this.btnLogin:SetActive(flag)
this.serverSelectPart:SetActive(flag)