【适配】修改适配相关

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_baseMaterial: {fileID: 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
GameObject:
m_ObjectHideFlags: 0
@ -1588,6 +1623,7 @@ RectTransform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 2341961941982336478}
- {fileID: 1760505213620796457}
m_Father: {fileID: 6932959358951144995}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
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_Name:
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
GameObject:
m_ObjectHideFlags: 0
@ -832,7 +933,7 @@ MonoBehaviour:
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 1080, y: 1920}
m_ScreenMatchMode: 0
m_ScreenMatchMode: 1
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
@ -1079,6 +1180,7 @@ MonoBehaviour:
root: {fileID: 0}
rootBg: {fileID: 0}
rootGfx: {fileID: 0}
rootMatch: {fileID: 0}
UICamera: {fileID: 123179488}
--- !u!4 &2081420527
Transform:
@ -1094,6 +1196,7 @@ Transform:
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1428869213}
- {fileID: 264469040}
- {fileID: 1436771297}
- {fileID: 632163661}
- {fileID: 123179489}

View File

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

View File

@ -11,6 +11,7 @@ namespace Framework.UI
[HideInInspector] public GameObject root;
[HideInInspector] public GameObject rootBg;
[HideInInspector] public GameObject rootGfx;
[HideInInspector] public GameObject rootMatch;
private const string ScriptSuffix = "Controller";
@ -26,6 +27,7 @@ namespace Framework.UI
root = GameObject.Find("UIRoot").gameObject;
rootBg = GameObject.Find("BGRoot").gameObject;
rootGfx = GameObject.Find("GfxRoot").gameObject;
rootMatch = GameObject.Find("UIMatchRoot").gameObject;
//解决花屏
Font.textureRebuilt += delegate(Font font1)
@ -53,10 +55,12 @@ namespace Framework.UI
{
Destroy(bg);
}
foreach (Transform child in rootBg.transform)
{
Destroy(child.gameObject);
}
UIManager.Instance.CloseAllBg();
}
@ -78,7 +82,7 @@ namespace Framework.UI
/// <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);
if (uiPrefab == null)
@ -88,7 +92,12 @@ namespace Framework.UI
}
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 dirs = path.Split('/');
var className = dirs[^1] + ScriptSuffix;

View File

@ -49,10 +49,10 @@ namespace Gameplay.LoadingExecutor
await UIManager.Instance.OpenWindow(UIConstants.UILevelPanel);
var window = UIManager.Instance.GetOpenedWindowByPath<UILevelPanelController>(UIConstants.UILevelPanel);
window?.ReloadWindow();
CommonUIUtils.DestroyScreenshot();
}
protected override void _OnEnd()
{
LevelManager.Instance.ReportEnterLevel();

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
{
@ -73,7 +73,8 @@ public class GfxManager : SingletonMono<GfxManager>, IInitable
{
var gfx = await AssetManager.Instance.LoadAssetAsync<GameObject>(string.Format(Constants.GfxPath,
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.name = gfx.name;
gfxDic.Add(gfxName, gfxObj);

View File

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

View File

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

View File

@ -40,7 +40,7 @@ public class UIStartMainController : UIWindow
FindObj("ResultPanel/Img_Blueprint").GetComponent<Image>().sprite = sprite;
BindButton("ResultPanel/Img_Blueprint/Btn_Close", () => { _blueprint.SetActive(false); });
}
/// <summary>
/// 预览
/// </summary>
@ -129,7 +129,7 @@ public class UIStartMainController : UIWindow
{
CloseWindow(true);
BIManager.Instance.TrackEvent(Event.click_level_select);
await UIManager.Instance.OpenWindow(UIConstants.UILevelSelect);
await UIManager.Instance.OpenWindow(UIConstants.UILevelSelect, isMatchUI: true);
}
private void RegisterEvent()