修改屏幕的适配方式,修改计算屏幕位置的方法
parent
9937727ede
commit
92a8b93b50
|
@ -157,7 +157,7 @@ MonoBehaviour:
|
|||
m_ScaleFactor: 1
|
||||
m_ReferenceResolution: {x: 1080, y: 1920}
|
||||
m_ScreenMatchMode: 0
|
||||
m_MatchWidthOrHeight: 1
|
||||
m_MatchWidthOrHeight: 0.5
|
||||
m_PhysicalUnit: 3
|
||||
m_FallbackScreenDPI: 96
|
||||
m_DefaultSpriteDPI: 96
|
||||
|
|
|
@ -1422,9 +1422,8 @@ end
|
|||
function SetObjPosByUV(pos)
|
||||
local u, v = Map_Pos2UV(pos)
|
||||
local v2 = RectTransformUtility.WorldToScreenPoint(TileMapView.GetCamera(), TileMapView.GetLiveTilePos(u, v))
|
||||
v2 = v2 / math.min(Screen.width/1080, Screen.height/1920)
|
||||
v2.x = v2.x - (Screen.width - UIManager.width) / 2
|
||||
v2.y = v2.y - (Screen.height - UIManager.height) / 2
|
||||
v2.x = (v2.x)/Screen.width*UIManager.UIWidth - UIManager.Offset.Left
|
||||
v2.y = (v2.y)/Screen.height*UIManager.UIHeight - UIManager.Offset.Bottom
|
||||
return v2
|
||||
|
||||
end
|
||||
|
|
|
@ -7,6 +7,7 @@ require "Framework/Manager/UIManager"
|
|||
require "Framework/Manager/PoolManager"
|
||||
require "Framework/Manager/SoundManager"
|
||||
require "Framework/Manager/CardRendererManager"
|
||||
require "Framework/Manager/RoleRenderManager"
|
||||
require "Data/UIData"
|
||||
require "Data/SoundData"
|
||||
require "Data/ConfigData"
|
||||
|
@ -48,12 +49,21 @@ local update = function()
|
|||
clickEffect.transform.localScale = Vector3.one
|
||||
clickEffect.transform.localPosition = Vector3.zero
|
||||
|
||||
local ft = UIManager.width/UIManager.height
|
||||
local rw = ft * 1920
|
||||
-- local ft = UIManager.width/UIManager.height
|
||||
-- local rw = ft * 1920
|
||||
|
||||
Log(UIManager.UIWidth.."|"..UIManager.UIHeight)
|
||||
Log(UIManager.width.."|"..UIManager.height)
|
||||
Log(Input.mousePosition.x.."|"..Input.mousePosition.y)
|
||||
local wf = UIManager.UIWidth/1080
|
||||
local hf = UIManager.UIHeight/1920
|
||||
|
||||
|
||||
|
||||
local v3 = Input.mousePosition - effectPos
|
||||
|
||||
v3 = Vector3.New(v3.x / UIManager.width * rw, v3.y / UIManager.height * 1920, v3.z)
|
||||
|
||||
v3 = Vector3.New(v3.x / UIManager.width * UIManager.UIWidth, v3.y / UIManager.height * UIManager.UIHeight, v3.z)
|
||||
clickEffect:GetComponent("RectTransform").anchoredPosition = v3
|
||||
clickEffect:SetActive(true)
|
||||
|
||||
|
|
|
@ -71,6 +71,8 @@ function UIManager.Initialize()
|
|||
this.Adapter()
|
||||
this.InitCommonPanels()
|
||||
UpdateBeat:Add(update, this)
|
||||
|
||||
RoleRenderManager.Init()
|
||||
end
|
||||
|
||||
function UIManager.InitCommonPanels()
|
||||
|
@ -108,6 +110,17 @@ function UIManager.Adapter()
|
|||
-- 屏幕大小
|
||||
UIManager.width = Screen.width
|
||||
UIManager.height = Screen.height
|
||||
|
||||
-- 计算比例因子 比例因子 = 10^((lg(屏幕宽/开发宽)+lg(屏幕高/开发高)/2))
|
||||
local log = math.log( Screen.width / 1080, 10) + math.log(Screen.height / 1920, 10)
|
||||
local avg = log/2
|
||||
local ft = math.pow(10, avg)
|
||||
-- 实际分辨率 = 屏幕分辨率 / 比例因子
|
||||
UIManager.UIHeight = Screen.height / ft
|
||||
UIManager.UIWidth = Screen.width / ft
|
||||
|
||||
|
||||
|
||||
-- 计算屏幕比例的比值,用于部分界面进行屏幕适配的缩放
|
||||
UIManager.adapterScale = (1920/1080)/(Screen.height / Screen.width)
|
||||
-- ui实际大小
|
||||
|
@ -143,6 +156,9 @@ function UIManager.Adapter()
|
|||
|
||||
local w = 1920 / Screen.height * Screen.width
|
||||
local f = (w-1080) / 2
|
||||
UIManager.Offset.Left = f
|
||||
UIManager.Offset.Right = f
|
||||
|
||||
local rectTransform = this.uiNode.gameObject:GetComponent("RectTransform")
|
||||
rectTransform.offsetMin = Vector2.New(rectTransform.offsetMin.x + f, rectTransform.offsetMin.y)
|
||||
rectTransform.offsetMax = Vector2.New(rectTransform.offsetMax.x - f, rectTransform.offsetMax.y)
|
||||
|
@ -165,14 +181,9 @@ function UIManager.Adapter()
|
|||
rectTransform.offsetMax = Vector2.New(0, 0)
|
||||
rectTransform.sizeDelta = Vector2.New(f*2, 0)
|
||||
|
||||
UIManager.width = Screen.width - f*2
|
||||
UIManager.height = Screen.height
|
||||
else
|
||||
this.screenMask1:SetActive(false)
|
||||
this.screenMask2:SetActive(false)
|
||||
|
||||
UIManager.height = Screen.height
|
||||
UIManager.width = Screen.width
|
||||
end
|
||||
-- local n = Screen.height / Screen.width
|
||||
-- if n > standard then
|
||||
|
|
|
@ -234,7 +234,6 @@ end
|
|||
|
||||
-- 设置发送状态
|
||||
function Network:SetSending(isSending)
|
||||
-- Log("设置当前请求状态:"..tostring(isSending))
|
||||
self.sendFlag = isSending
|
||||
end
|
||||
function Network:IsSending()
|
||||
|
@ -275,7 +274,6 @@ function Network:Update()
|
|||
MsgPanel.ShowTwo("请求失败,请再次尝试!", function()
|
||||
Game.Logout()
|
||||
end, function()
|
||||
Log("获取当前请求状态:"..tostring(self:IsSending()))
|
||||
-- if self:IsSending() then
|
||||
self:SetSending(false)
|
||||
self.resendTimes = 0
|
||||
|
|
|
@ -1990,7 +1990,6 @@ local passivityList = {
|
|||
local i1 = args[1]
|
||||
-- 释放技能后
|
||||
local onRoleHit = function(target)
|
||||
-- LogError("target "..target.roleId .. " ".. target.star)
|
||||
if target:IsDead() and BattleUtil.CheckIsNoDead(target) then
|
||||
for i = 1, i1 do
|
||||
role:AddSkill(BattleSkillType.Normal, false, true, nil)
|
||||
|
@ -3061,7 +3060,6 @@ local passivityList = {
|
|||
if controlList then
|
||||
num=num+ #controlList
|
||||
end
|
||||
LogError("异常效果的数量为:".. num)
|
||||
if num>0 and damagingFunc then
|
||||
local dd = BattleUtil.CountValue(damage, f1 * num, CountTypeName.AddPencent) - damage
|
||||
damagingFunc(-floor(BattleUtil.ErrorCorrection(dd)))
|
||||
|
@ -4739,7 +4737,6 @@ local passivityList = {
|
|||
if skill and skill.type == BattleSkillType.Special then
|
||||
BattleUtil.RandomAction(f1, function()
|
||||
BattleLogic.WaitForTrigger(0.1, function()
|
||||
LogError("技能触发再次释放技能"..f2)
|
||||
role:InsertExtraSkill(f2,f3)
|
||||
end)
|
||||
end)
|
||||
|
@ -4759,7 +4756,6 @@ local passivityList = {
|
|||
--加一个延时操作,防止有的英雄有死亡后再释放一次技能的被动 by:王振兴
|
||||
BattleLogic.WaitForTrigger(1, function()
|
||||
role:InsertExtraSkill(f1,f2)
|
||||
LogError("击杀触发再次释放技能")
|
||||
end)
|
||||
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
BattleLogManager = {}
|
||||
local this = BattleLogManager
|
||||
local isLog = false
|
||||
local isLog = true
|
||||
|
||||
local function pairsByKeys(t)
|
||||
local a = {}
|
||||
|
|
|
@ -52,7 +52,6 @@ function this.CheckTurnRound()
|
|||
-- 没有技能释放的时候才轮转
|
||||
if this.TurnRoundFunc then
|
||||
BattleLogic.WaitForTrigger(0.3, function()
|
||||
LogBlue(Language[10239])
|
||||
this.TurnRoundFunc()
|
||||
this.TurnRoundFunc = nil
|
||||
end)
|
||||
|
|
Loading…
Reference in New Issue