mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/MI-38.git
synced 2026-01-24 01:15:41 +03:00
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
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_;
|
||
}*/
|
||
}
|
||
}
|