mirror of
https://github.com/Alex-Rachel/TEngine.git
synced 2025-08-07 16:45:10 +00:00
[=]SafeTop ImageBackGround
[=]SafeTop ImageBackGround
This commit is contained in:
@@ -1,30 +0,0 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
/// <summary>
|
||||
/// 背景图片等比拉伸
|
||||
/// </summary>
|
||||
public class ImageBackGroundStretch : MonoBehaviour
|
||||
{
|
||||
protected virtual void Start()
|
||||
{
|
||||
DoImageStretch(9/16f);
|
||||
}
|
||||
|
||||
private void DoImageStretch(float standardAspect)
|
||||
{
|
||||
float deviceAspect = Screen.width / (float)Screen.height;
|
||||
if (standardAspect > deviceAspect)
|
||||
{
|
||||
float scale = standardAspect / deviceAspect;
|
||||
transform.localScale = new Vector3(scale, scale, 1f);
|
||||
}
|
||||
else if (standardAspect < deviceAspect)
|
||||
{
|
||||
float scale = deviceAspect / standardAspect;
|
||||
transform.localScale = new Vector3(scale, scale, 1f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4e6e63472f81d39499f4bf79b27eaf44
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0a563c3e931db74f94f9991270a2dee
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
Reference in New Issue
Block a user