91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

讓Unity的主攝像機,根據實際的設計尺寸,縮放到最佳視角。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.Linq;
using?script.simplefade;
using?UnityEngine;
using?UnityEngine.SceneManagement;
using?UnityEngine.UI;

namespace?script
{
????public?class?Camerascript?:?MonoBehaviour
????{
????????//?設計區域像素尺寸(由各場景攝像機上的組件參數指定)
????????public?float?contentWidth;
????????public?float?contentHeight;

????????//屏幕主攝像機
????????private?Camera?_mainCamera;

????????//?屏幕當前分辨率
????????private?int?_resolutionX;
????????private?int?_resolutionY;
????????private?FullScreenMode??_fullScreenMode?=?null;

????????//屏幕當前寬高比
????????private?float?_aspectRatio;

????????//?屏幕當前正交尺寸(正交模式)
????????private?float?_orthographicSize;

????????//?屏幕當前透視角度(透視模式)
????????private?float?_fieldOfView;

????????//?Start?is?called?before?the?first?frame?update
????????private?void?Start()
????????{
????????????_mainCamera?=?GetComponent();
????????????//?InitFullscreenMode();
????????????ResizeCamera();
????????}

????????/**
?????????*?初始化全屏模式
?????????*/
????????private?void?InitFullscreenMode()
????????{
????????????string[]?commandLineArgs?=?Environment.GetCommandLineArgs();
????????????bool?found?=?false;
????????????List?values?=?new?List();
????????????foreach?(var?item?in?commandLineArgs)
????????????{
????????????????if?(item.IndexOf(“-“?StringComparison.Ordinal)?==?0)
????????????????{
????????????????????//?item是參數名
????????????????????if?(found)
????????????????????{
????????????????????????//?如果之前已經找到參數,則跳出循環
????????????????????????Output($“參數查找結束“);
????????????????????????break;
????????????????????}

????????????????????if?(item.IndexOf(“-screen-fullscreen“?StringComparison.Ordinal)?==?0)
????????????????????{
????????????????????????//?如果找到參數,則開啟標志
????????????????????????found?=?true;
????????????????????????Output($“找到全屏參數:{item}“);
????????????????????}
????????????????}
????????????????else
????????????????{
????????????????????//?item是參數內容
????????????????????if?(found)
????????????????????{
????????????????????????//?如果是找到參數狀態,則保存該數值
????????????????????????values.Add(item);
????????????????????????Output($“添加參數值:{item}“);
????????????????????}
????????????????}
????????????}

????????????if?(values.Count?>?1)
????????????{
????????????????Output($“窗口模式參數:({values[1].GetType()}){values[1]}“);
????????????????//?當全屏參數大于1個時,取第二個作為全屏模式
????????????????switch?(values[1])
????????????????{
????????????????????case?“1“:
????????????????????????_fullScreenMode?=?FullScreenMode.FullScreenWindow;
????????????????????????break;
????????????????????case?“2“:
????????????????????????_fullScreenMode?=?FullScreenMode.MaximizedWindow;
????????????????????????break;
????????????????????case?“3“:
????????????????????????_fullScreenMode?=?FullScreenMode.ExclusiveFullScreen;
????????????????????????break;
????????????????????default:
????????????????????????_fullScreenMode?=?FullScreenMode.Windowed;
??

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件????????8451??2020-03-09?16:20??Camerascript.cs

評論

共有 條評論