网演高层钦州
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

54 lines
1.4 KiB

using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class ShowPanel : MonoBehaviour {
public Toggle AllScreen;
public Toggle Window;
public Dropdown DropDown;
public int ResolutionX;
public int ResolutionY;
public bool IsFullScreen;
private string OriResolution;
// Use this for initialization
void Start () {
AllScreen.onValueChanged.AddListener(AllScreenChange);
Window.onValueChanged.AddListener(WindowChange);
DropDown.onValueChanged.AddListener(DropDownChange);
OriResolution=DropDown.options[DropDown.value].text;
int[] orires = GetResolution(OriResolution);
ResolutionX = orires[0];
ResolutionY = orires[1];
IsFullScreen = AllScreen.isOn;
}
private void DropDownChange(int arg0)
{
int[]res= GetResolution(DropDown.options[arg0].text);
ResolutionX = res[0];
ResolutionY = res[1];
}
private void WindowChange(bool arg0)
{
DropDown.interactable = arg0;
IsFullScreen = !arg0;
}
private void AllScreenChange(bool arg0)
{
}
int[] GetResolution(string str)
{
int[] res=new int[2];
string[] array = str.Split('*');
res[0] = int.Parse(array[0]);
res[1]= int.Parse(array[1]);
return res;
}
}