全屏界面 背景图片适配脚本 自行挂载
parent
fb6a6c9da5
commit
96e795c7c5
|
@ -25931,6 +25931,7 @@ GameObject:
|
|||
- component: {fileID: 223345070565805176}
|
||||
- component: {fileID: 114816973201343810}
|
||||
- component: {fileID: 114498738120361456}
|
||||
- component: {fileID: 5147115212176841222}
|
||||
m_Layer: 5
|
||||
m_Name: RoleInfoPanel
|
||||
m_TagString: Untagged
|
||||
|
@ -26124,6 +26125,23 @@ MonoBehaviour:
|
|||
isPlayAudio: 1
|
||||
isHaveCloseBtn: 0
|
||||
isPlayOnOpen: 1
|
||||
--- !u!114 &5147115212176841222
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1434973737169448}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: 7fdc50ec1a2f1534f93155e67c3708ab, type: 3}
|
||||
m_Name:
|
||||
m_EditorClassIdentifier:
|
||||
bgList:
|
||||
- {fileID: 3262098017588439445}
|
||||
- {fileID: 7753673013085996136}
|
||||
- {fileID: 239770745853423168}
|
||||
- {fileID: 5361733365052867487}
|
||||
--- !u!1 &1440606597669382
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
|
@ -31975,7 +31993,7 @@ RectTransform:
|
|||
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_AnchoredPosition: {x: 125.3, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 100.75}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!222 &222314792653266900
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public class UIBgAdaptive : MonoBehaviour
|
||||
{
|
||||
public GameObject[] bgList;
|
||||
void Start()
|
||||
{
|
||||
for (int i = 0; i < bgList.Length; i++)
|
||||
{
|
||||
if (bgList[i] != null)
|
||||
{
|
||||
bgList[i].GetComponent<RectTransform>().anchorMin = new Vector2(0.5f, 0.5f);
|
||||
bgList[i].GetComponent<RectTransform>().anchorMax = new Vector2(0.5f, 0.5f);
|
||||
bgList[i].GetComponent<RectTransform>().pivot = new Vector2(0.5f, 0.5f);
|
||||
bgList[i].transform.localScale = new Vector3(1, 1, 1);
|
||||
bgList[i].transform.localPosition = new Vector3(0, 0, 0);
|
||||
float curWidth = (1080f / 1920f) * Screen.height;
|
||||
//Debug.Log("Screen.height " + Screen.height+ " curWidth "+ curWidth);
|
||||
bgList[i].GetComponent<RectTransform>().sizeDelta = new Vector2(curWidth, Screen.height);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
fileFormatVersion: 2
|
||||
guid: 7fdc50ec1a2f1534f93155e67c3708ab
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Loading…
Reference in New Issue