Files
MI-38/Heli_with_panels/Assets/Scripts/Panel2D/0115/BarPressure.cs
2022-07-04 13:15:35 +03:00

46 lines
1.2 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using TMPro;
//TextBarPressure
public class BarPressure : MonoBehaviour
{
[HideInInspector]
public string textValue_="";
private (string, string) defaultValue_ = ("766 мм рт.ст", "1013 гѕ");
private TextMeshPro text_;
//private Text text_;
void Start()
{
text_ = this.GetComponent<TextMeshPro>();
var txt= (textValue_ == "") ? defaultValue_.Item1 : textValue_;
text_.SetText(txt);
/*text_ = this.gameObject.GetComponent<Text>();
text_.text = (textValue_ == "") ? defaultValue_.Item1 : textValue_;*/
}
private void OnMouseDown()//нажатие на счетчик
{
if(textValue_ == "")
{
var txt = (text_.text == defaultValue_.Item2) ? defaultValue_.Item1 : defaultValue_.Item2;
text_.SetText(txt);
}
else
{
text_.SetText(textValue_);
}
/*if(textValue_ == "")
{
text_.text = (text_.text == defaultValue_.Item2) ? defaultValue_.Item1 : defaultValue_.Item2;
}
else
{
text_.text = textValue_;
}*/
}
}