-
Notifications
You must be signed in to change notification settings - Fork 96
/
SCAN_VesselInfo.cs
72 lines (59 loc) · 1.59 KB
/
SCAN_VesselInfo.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
#region license
/*
* [Scientific Committee on Advanced Navigation]
* S.C.A.N. Satellite
*
* SCAN_VesselInfo - Script for controlling vessel information readout buttons
*
* Copyright (c)2014 David Grandy <david.grandy@gmail.com>;
* Copyright (c)2014 technogeeky <technogeeky@gmail.com>;
* Copyright (c)2014 (Your Name Here) <your email here>; see LICENSE.txt for licensing details.
*/
#endregion
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using SCANsat.Unity.Interfaces;
namespace SCANsat.Unity.Unity
{
public class SCAN_VesselInfo : MonoBehaviour
{
[SerializeField]
private TextHandler m_VesselText = null;
private Guid _id;
private ISCAN_MainMap mapInterface;
private MapLabelInfo label;
public Guid ID
{
get { return _id; }
}
public void SetVessel(Guid id, MapLabelInfo info, ISCAN_MainMap map)
{
if (m_VesselText == null || map == null)
return;
_id = id;
label = info;
label.name = !string.IsNullOrEmpty(label.name) && label.name.Length > 26 ? label.name.Substring(0, 26) : label.name;
mapInterface = map;
if (info.label != "1")
{
m_VesselText.SetNormalColor(Color.white);
m_VesselText.OnColorUpdate.Invoke(Color.white);
}
m_VesselText.OnTextUpdate.Invoke(label.name);
}
public void UpdateText(string value)
{
if (m_VesselText == null)
return;
m_VesselText.OnTextUpdate.Invoke(string.Format("[{0}] {1}: {2}", label.label, label.name, value));
}
public void ChangeToVessel()
{
if (mapInterface == null)
return;
mapInterface.ChangeToVessel(_id);
}
}
}