mirror of
https://github.com/xiaopeng12138/MaiDXR.git
synced 2024-12-15 02:41:15 +01:00
42 lines
839 B
C#
42 lines
839 B
C#
using System.Collections;
|
|
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using TMPro;
|
|
|
|
public class ValueManager : MonoBehaviour
|
|
{
|
|
TMP_Text tmp;
|
|
public float Value;
|
|
float tempValue;
|
|
public bool isPointerDown = false;
|
|
void Start()
|
|
{
|
|
tmp = GetComponent<TMP_Text>();
|
|
}
|
|
void Update()
|
|
{
|
|
if (isPointerDown)
|
|
{
|
|
ChangeValueContinue(tempValue);
|
|
}
|
|
}
|
|
|
|
public void ChangeValueContinue(float value)
|
|
{
|
|
tempValue = value;
|
|
Value += value;
|
|
tmp.text = String.Format("{0:F2}", Value);
|
|
isPointerDown = true;
|
|
}
|
|
public void PointerState(bool state)
|
|
{
|
|
isPointerDown = state;
|
|
}
|
|
public void ChangeValue(float value)
|
|
{
|
|
Value += value;
|
|
tmp.text = String.Format("{0:F2}", Value);
|
|
}
|
|
}
|