【适配】修改适配相关

iOS_release
zhangaotian 2024-07-25 22:51:34 +08:00
parent 928c7a1cc0
commit 88e4ddb102
10 changed files with 206 additions and 22 deletions

View File

@ -545,6 +545,41 @@ MonoBehaviour:
m_hasFontAssetChanged: 0 m_hasFontAssetChanged: 0
m_baseMaterial: {fileID: 0} m_baseMaterial: {fileID: 0}
m_maskOffset: {x: 0, y: 0, z: 0, w: 0} m_maskOffset: {x: 0, y: 0, z: 0, w: 0}
--- !u!1 &1275364910179308477
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1760505213620796457}
m_Layer: 5
m_Name: Pos_Gfx
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1760505213620796457
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1275364910179308477}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 8495630731123082184}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 1, y: 0.5}
m_AnchorMax: {x: 1, y: 0.5}
m_AnchoredPosition: {x: -600, y: -20}
m_SizeDelta: {x: 100, y: 100}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &3631049813883594003 --- !u!1 &3631049813883594003
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -1588,6 +1623,7 @@ RectTransform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 2341961941982336478} - {fileID: 2341961941982336478}
- {fileID: 1760505213620796457}
m_Father: {fileID: 6932959358951144995} m_Father: {fileID: 6932959358951144995}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1} m_AnchorMin: {x: 0.5, y: 1}

View File

@ -0,0 +1,32 @@
fileFormatVersion: 2
guid: 164f5631c330c446ea72aafa69734772
PluginImporter:
externalObjects: {}
serializedVersion: 2
iconMap: {}
executionOrder: {}
defineConstraints: []
isPreloaded: 0
isOverridable: 0
isExplicitlyReferenced: 0
validateReferences: 1
platformData:
- first:
Android: Android
second:
enabled: 1
settings: {}
- first:
Any:
second:
enabled: 0
settings: {}
- first:
Editor: Editor
second:
enabled: 0
settings:
DefaultValueInitialized: true
userData:
assetBundleName:
assetBundleVariant:

View File

@ -570,6 +570,107 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a6faecb60ea5fb745b4d8a3b62e399a3, type: 3} m_Script: {fileID: 11500000, guid: a6faecb60ea5fb745b4d8a3b62e399a3, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
--- !u!1 &264469039
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 264469040}
- component: {fileID: 264469043}
- component: {fileID: 264469042}
- component: {fileID: 264469041}
m_Layer: 5
m_Name: UIMatchRoot
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &264469040
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264469039}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 0, y: 0, z: 0}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 2081420527}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0, y: 0}
--- !u!114 &264469041
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264469039}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 55
--- !u!114 &264469042
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264469039}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 1
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1080, y: 1920}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
m_PresetInfoIsWorld: 0
--- !u!223 &264469043
Canvas:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 264469039}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 1
m_Camera: {fileID: 123179488}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_VertexColorAlwaysGammaSpace: 1
m_AdditionalShaderChannelsFlag: 25
m_UpdateRectTransformForStandalone: 0
m_SortingLayerID: 0
m_SortingOrder: 100
m_TargetDisplay: 0
--- !u!1 &403430398 --- !u!1 &403430398
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -832,7 +933,7 @@ MonoBehaviour:
m_ReferencePixelsPerUnit: 100 m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1 m_ScaleFactor: 1
m_ReferenceResolution: {x: 1080, y: 1920} m_ReferenceResolution: {x: 1080, y: 1920}
m_ScreenMatchMode: 0 m_ScreenMatchMode: 1
m_MatchWidthOrHeight: 0 m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3 m_PhysicalUnit: 3
m_FallbackScreenDPI: 96 m_FallbackScreenDPI: 96
@ -1079,6 +1180,7 @@ MonoBehaviour:
root: {fileID: 0} root: {fileID: 0}
rootBg: {fileID: 0} rootBg: {fileID: 0}
rootGfx: {fileID: 0} rootGfx: {fileID: 0}
rootMatch: {fileID: 0}
UICamera: {fileID: 123179488} UICamera: {fileID: 123179488}
--- !u!4 &2081420527 --- !u!4 &2081420527
Transform: Transform:
@ -1094,6 +1196,7 @@ Transform:
m_ConstrainProportionsScale: 0 m_ConstrainProportionsScale: 0
m_Children: m_Children:
- {fileID: 1428869213} - {fileID: 1428869213}
- {fileID: 264469040}
- {fileID: 1436771297} - {fileID: 1436771297}
- {fileID: 632163661} - {fileID: 632163661}
- {fileID: 123179489} - {fileID: 123179489}

View File

@ -59,9 +59,9 @@ namespace Framework.UI
return null; return null;
} }
public async UniTask<UIWindow> OpenWindow(string path, object data = null) public async UniTask<UIWindow> OpenWindow(string path, object data = null, bool isMatchUI = false)
{ {
var window = await Open(path); var window = await Open(path, isMatchUI);
if (window) if (window)
window.OpenWindow(data); window.OpenWindow(data);
return window; return window;
@ -114,7 +114,7 @@ namespace Framework.UI
_backGroundWindowsDic.Clear(); _backGroundWindowsDic.Clear();
} }
private async UniTask<UIWindow> Open(string path) private async UniTask<UIWindow> Open(string path, bool isMatchUI = false)
{ {
try try
{ {
@ -129,7 +129,7 @@ namespace Framework.UI
if (!_windowsDic.TryGetValue(path, out var window)) if (!_windowsDic.TryGetValue(path, out var window))
{ {
var isTopUI = uiWindowLayer is UIWindowLayer.BgTop; var isTopUI = uiWindowLayer is UIWindowLayer.BgTop;
window = await UIRoot.Instance.CreateWindow(path, isTopUI); window = await UIRoot.Instance.CreateWindow(path, isTopUI, isMatchUI);
if (window != null) if (window != null)
{ {
window.WindowPath = path; window.WindowPath = path;

View File

@ -11,6 +11,7 @@ namespace Framework.UI
[HideInInspector] public GameObject root; [HideInInspector] public GameObject root;
[HideInInspector] public GameObject rootBg; [HideInInspector] public GameObject rootBg;
[HideInInspector] public GameObject rootGfx; [HideInInspector] public GameObject rootGfx;
[HideInInspector] public GameObject rootMatch;
private const string ScriptSuffix = "Controller"; private const string ScriptSuffix = "Controller";
@ -26,6 +27,7 @@ namespace Framework.UI
root = GameObject.Find("UIRoot").gameObject; root = GameObject.Find("UIRoot").gameObject;
rootBg = GameObject.Find("BGRoot").gameObject; rootBg = GameObject.Find("BGRoot").gameObject;
rootGfx = GameObject.Find("GfxRoot").gameObject; rootGfx = GameObject.Find("GfxRoot").gameObject;
rootMatch = GameObject.Find("UIMatchRoot").gameObject;
//解决花屏 //解决花屏
Font.textureRebuilt += delegate(Font font1) Font.textureRebuilt += delegate(Font font1)
@ -53,10 +55,12 @@ namespace Framework.UI
{ {
Destroy(bg); Destroy(bg);
} }
foreach (Transform child in rootBg.transform) foreach (Transform child in rootBg.transform)
{ {
Destroy(child.gameObject); Destroy(child.gameObject);
} }
UIManager.Instance.CloseAllBg(); UIManager.Instance.CloseAllBg();
} }
@ -78,7 +82,7 @@ namespace Framework.UI
/// <summary> /// <summary>
/// 创建窗口 /// 创建窗口
/// </summary> /// </summary>
public async UniTask<UIWindow> CreateWindow(string path,bool bgRoot = false) public async UniTask<UIWindow> CreateWindow(string path, bool bgRoot = false, bool isMatch = false)
{ {
var uiPrefab = await LoadPrefab(path); var uiPrefab = await LoadPrefab(path);
if (uiPrefab == null) if (uiPrefab == null)
@ -88,7 +92,12 @@ namespace Framework.UI
} }
UIWindow window = null; UIWindow window = null;
var rootTransform = bgRoot ? rootBg.transform : root.transform; var rootTransform = isMatch ? rootMatch.transform : root.transform;
if (bgRoot)
{
rootTransform = rootBg.transform;
}
var obj = Instantiate(uiPrefab, rootTransform, false) as GameObject; var obj = Instantiate(uiPrefab, rootTransform, false) as GameObject;
var dirs = path.Split('/'); var dirs = path.Split('/');
var className = dirs[^1] + ScriptSuffix; var className = dirs[^1] + ScriptSuffix;

View File

@ -62,7 +62,7 @@ public class GfxManager : SingletonMono<GfxManager>, IInitable
} }
} }
public async UniTask<GameObject> PreLoadGfx(string gfxName, bool show = false) public async UniTask<GameObject> PreLoadGfx(string gfxName, bool show = false, bool inUI = false)
{ {
try try
{ {
@ -73,7 +73,8 @@ public class GfxManager : SingletonMono<GfxManager>, IInitable
{ {
var gfx = await AssetManager.Instance.LoadAssetAsync<GameObject>(string.Format(Constants.GfxPath, var gfx = await AssetManager.Instance.LoadAssetAsync<GameObject>(string.Format(Constants.GfxPath,
gfxName)); gfxName));
var gfxObj = Instantiate(gfx, UIRoot.Instance.rootGfx.transform); var root = inUI ? UIRoot.Instance.root.transform : UIRoot.Instance.rootGfx.transform;
var gfxObj = Instantiate(gfx, root);
gfxObj.SetActive(show); gfxObj.SetActive(show);
gfxObj.name = gfx.name; gfxObj.name = gfx.name;
gfxDic.Add(gfxName, gfxObj); gfxDic.Add(gfxName, gfxObj);

View File

@ -85,7 +85,7 @@ namespace Gameplay.Manager
_gfxWin = await GfxManager.Instance.PreLoadGfx("Effect_Win"); _gfxWin = await GfxManager.Instance.PreLoadGfx("Effect_Win");
_particleWin = _gfxWin.GetComponent<ParticleSystem>(); _particleWin = _gfxWin.GetComponent<ParticleSystem>();
await GfxManager.Instance.PreLoadGfx("Effect_LevelSpirit"); await GfxManager.Instance.PreLoadGfx("Effect_LevelSpirit", inUI: true);
} }
public void ReLoadLevelValue() public void ReLoadLevelValue()
@ -158,11 +158,6 @@ namespace Gameplay.Manager
GfxManager.Instance.ReturnGfxObj("Effect_LevelSpirit"); GfxManager.Instance.ReturnGfxObj("Effect_LevelSpirit");
} }
private async void ShowGfx()
{
await GfxManager.Instance.LoadGfx("Effect_LevelSpirit");
}
public void PushUndoState() public void PushUndoState()
{ {
if (CurUndoState.LastModifiedKong == null || CurUndoState.PreModifiedKong == null) return; if (CurUndoState.LastModifiedKong == null || CurUndoState.PreModifiedKong == null) return;
@ -626,7 +621,6 @@ namespace Gameplay.Manager
EventManager.Instance.Register(EventManager.EventName.WatchADSuccessToGetTime, ADGetTime); EventManager.Instance.Register(EventManager.EventName.WatchADSuccessToGetTime, ADGetTime);
EventManager.Instance.Register(EventManager.EventName.WatchADSuccessToGetRandomProp, ADGetRandomProp); EventManager.Instance.Register(EventManager.EventName.WatchADSuccessToGetRandomProp, ADGetRandomProp);
EventManager.Instance.Register(EventManager.EventName.HideGfx, HideGfx); EventManager.Instance.Register(EventManager.EventName.HideGfx, HideGfx);
EventManager.Instance.Register(EventManager.EventName.ShowGfx, ShowGfx);
} }
private void UnRegisterEvent() private void UnRegisterEvent()
@ -637,7 +631,6 @@ namespace Gameplay.Manager
EventManager.Instance.Unregister(EventManager.EventName.WatchADSuccessToGetTime, ADGetTime); EventManager.Instance.Unregister(EventManager.EventName.WatchADSuccessToGetTime, ADGetTime);
EventManager.Instance.Unregister(EventManager.EventName.WatchADSuccessToGetRandomProp, ADGetRandomProp); EventManager.Instance.Unregister(EventManager.EventName.WatchADSuccessToGetRandomProp, ADGetRandomProp);
EventManager.Instance.Unregister(EventManager.EventName.HideGfx, HideGfx); EventManager.Instance.Unregister(EventManager.EventName.HideGfx, HideGfx);
EventManager.Instance.Unregister(EventManager.EventName.ShowGfx, ShowGfx);
} }
//Debug //Debug

View File

@ -8,12 +8,14 @@ using UnityEngine.UI;
using Framework.Event; using Framework.Event;
using Gameplay.Manager; using Gameplay.Manager;
using Framework.Constants; using Framework.Constants;
using Unity.VisualScripting;
public class UILevelPanelController : UIWindow public class UILevelPanelController : UIWindow
{ {
private TextMeshProUGUI _txtMeshProUGUITime; private TextMeshProUGUI _txtMeshProUGUITime;
private TextMeshProUGUI _txtLevelID; private TextMeshProUGUI _txtLevelID;
private string _levelID; private string _levelID;
private GameObject _gfxPosObj;
private GameObject _newbieGuide; private GameObject _newbieGuide;
private Animator _timeAnimator; private Animator _timeAnimator;
@ -64,7 +66,7 @@ public class UILevelPanelController : UIWindow
_levelID = StringManager.Instance.GetTextByKey("LevelID"); _levelID = StringManager.Instance.GetTextByKey("LevelID");
_txtLevelID.text = string.Format(_levelID, LevelManager.Instance.CurrentLevel.GetLevelID()); _txtLevelID.text = string.Format(_levelID, LevelManager.Instance.CurrentLevel.GetLevelID());
_timeAnimator = FindObj("UI_LiuHaiTop/Txt_Time").GetComponent<Animator>(); _timeAnimator = FindObj("UI_LiuHaiTop/Txt_Time").GetComponent<Animator>();
_gfxPosObj = FindObj("UI_LiuHaiTop/Img_LevelID/Pos_Gfx");
//新手引导 //新手引导
if (LevelManager.Instance.IsNewbieGuide) if (LevelManager.Instance.IsNewbieGuide)
{ {
@ -115,6 +117,12 @@ public class UILevelPanelController : UIWindow
EventManager.Instance.Send(EventManager.EventName.ShowGfx); EventManager.Instance.Send(EventManager.EventName.ShowGfx);
} }
private async void ShowGfx()
{
var gfxObj = await GfxManager.Instance.LoadGfx("Effect_LevelSpirit");
gfxObj.transform.position = _gfxPosObj.transform.position;
}
private void Update() private void Update()
{ {
if (LevelManager.Instance.PlayAnimation) if (LevelManager.Instance.PlayAnimation)
@ -230,6 +238,7 @@ public class UILevelPanelController : UIWindow
private void RegisterEvent() private void RegisterEvent()
{ {
EventManager.Instance.Register(EventManager.EventName.ShowGfx, ShowGfx);
EventManager.Instance.Register(EventManager.EventName.AddTime, AddTimeGfx); EventManager.Instance.Register(EventManager.EventName.AddTime, AddTimeGfx);
EventManager.Instance.Register(EventManager.EventName.RefreshProp, RefreshProp); EventManager.Instance.Register(EventManager.EventName.RefreshProp, RefreshProp);
EventManager.Instance.Register(EventManager.EventName.NewBieGuideNext, NewbieGuideNext); EventManager.Instance.Register(EventManager.EventName.NewBieGuideNext, NewbieGuideNext);
@ -238,6 +247,7 @@ public class UILevelPanelController : UIWindow
private void UnRegisterEvent() private void UnRegisterEvent()
{ {
EventManager.Instance.Unregister(EventManager.EventName.ShowGfx, ShowGfx);
EventManager.Instance.Unregister(EventManager.EventName.AddTime, AddTimeGfx); EventManager.Instance.Unregister(EventManager.EventName.AddTime, AddTimeGfx);
EventManager.Instance.Unregister(EventManager.EventName.RefreshProp, RefreshProp); EventManager.Instance.Unregister(EventManager.EventName.RefreshProp, RefreshProp);
EventManager.Instance.Unregister(EventManager.EventName.NewBieGuideNext, NewbieGuideNext); EventManager.Instance.Unregister(EventManager.EventName.NewBieGuideNext, NewbieGuideNext);

View File

@ -129,7 +129,7 @@ public class UIStartMainController : UIWindow
{ {
CloseWindow(true); CloseWindow(true);
BIManager.Instance.TrackEvent(Event.click_level_select); BIManager.Instance.TrackEvent(Event.click_level_select);
await UIManager.Instance.OpenWindow(UIConstants.UILevelSelect); await UIManager.Instance.OpenWindow(UIConstants.UILevelSelect, isMatchUI: true);
} }
private void RegisterEvent() private void RegisterEvent()