Commit 1eb0b9a0 authored by 赤子奈落's avatar 赤子奈落

add switch for displaying fps

parent a3468b51
......@@ -37,6 +37,7 @@ public class LAZYsetting : MonoBehaviour
public UIToggle handm;
public UIToggle spyer;
public UIToggle confirmLeft;
public UIToggle fps;
public UILabel character0;
public UILabel character1;
public UILabel field0;
......
using UnityEngine;
using System.Collections;
using DG.Tweening;
public class ShowFPS : MonoBehaviour
{
private float m_lastUpdateShowTime = 0f;
private readonly float m_updateTime = 0.5f;
private int m_frames = 0;
private float m_FPS = 0;
UILabel m_label;
private void Start()
{
m_lastUpdateShowTime = Time.realtimeSinceStartup;
m_label = GetComponent<UILabel>();
}
private void Update()
{
m_frames++;
if (Time.realtimeSinceStartup - m_lastUpdateShowTime >= m_updateTime)
{
m_FPS = m_frames / (Time.realtimeSinceStartup - m_lastUpdateShowTime);
m_lastUpdateShowTime = Time.realtimeSinceStartup;
m_frames = 0;
if (Program.I().setting.setting.fps.value)
m_label.text = "FPS: " + (int)m_FPS;
else
m_label.text = "";
}
}
}
\ No newline at end of file
fileFormatVersion: 2
guid: e88b1f7666e90ab4d8f8c3b184083de8
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:
This diff is collapsed.
......@@ -49,6 +49,7 @@ public class Setting : WindowServant2D
UIHelper.fromStringToBool(Config.Get("handmPosition_", "1"));
UIHelper.getByName<UIToggle>(gameObject, "spyer_").value = UIHelper.fromStringToBool(Config.Get("spyer_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "confirmLeft_").value = UIHelper.fromStringToBool(Config.Get("confirmLeft_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "showFPS_").value = UIHelper.fromStringToBool(Config.Get("showFPS_", "0"));
UIHelper.getByName<UIToggle>(gameObject, "resize_").canChange = false;
if (QualitySettings.GetQualityLevel() < 3)
UIHelper.getByName<UIToggle>(gameObject, "high_").value = false;
......@@ -62,6 +63,7 @@ public class Setting : WindowServant2D
UIHelper.registEvent(gameObject, "handmPosition_", save);
UIHelper.registEvent(gameObject, "spyer_", save);
UIHelper.registEvent(gameObject, "confirmLeft_", save);
UIHelper.registEvent(gameObject, "showFPS_", save);
UIHelper.registEvent(gameObject, "high_", save);
//Program.go(2000, readVales);
......@@ -330,6 +332,7 @@ public class Setting : WindowServant2D
UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "handmPosition_").value));
Config.Set("spyer_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "spyer_").value));
Config.Set("confirmLeft_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "confirmLeft_").value));
Config.Set("showFPS_", UIHelper.fromBoolToString(UIHelper.getByName<UIToggle>(gameObject, "showFPS_").value));
if (UIHelper.getByName<UIToggle>(gameObject, "high_").value)
QualitySettings.SetQualityLevel(5);
else
......
......@@ -4,7 +4,7 @@
QualitySettings:
m_ObjectHideFlags: 0
serializedVersion: 5
m_CurrentQuality: 0
m_CurrentQuality: 5
m_QualitySettings:
- serializedVersion: 2
name: Fastest
......@@ -202,8 +202,8 @@ QualitySettings:
shadowNearPlaneOffset: 3
shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.19999999, z: 0.46666664}
shadowmaskMode: 0
skinWeights: 4
shadowmaskMode: 1
skinWeights: 1
textureQuality: 0
anisotropicTextures: 2
antiAliasing: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment