-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJSIHUDVariables.cs
68 lines (63 loc) · 2.64 KB
/
JSIHUDVariables.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UnityEngine;
namespace JSI
{
public class InfoGauge : InternalModule
{
[KSPField] // 贴图
public string Texture = string.Empty;
[KSPField] // 绘图区的位置(从左上角开始),绘图区的大小(横,纵)
public Vector4 Position = new Vector4(0f, 0f, 64f, 320f);
[KSPField] // 输入数据的上下限
public Vector2 Limit = new Vector2(0f, 10000f);
[KSPField] // 贴图绘制的限度(上,下,左,右)
public Vector4 TextureLimit = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);
[KSPField] // 在绘图区绘制多少个像素
public float TextureSize = 0.5f;
[KSPField] // 调用的变量
public string Variable = string.Empty;
[KSPField] //垂直或水平
public bool VerticalMovement = true;
[KSPField] // 对数计数
public bool UseLog10 = true;
[KSPField] // 空翻一圈之后回到原位
public bool Use360Horizon = true;
[KSPField] //随载具滚转
public bool RotateWithVessel = false;
public Material Material;
//与信息条相关的变量
public InfoGauge()
{
Texture = string.Empty;
Position = new Vector4(0f, 0f, 64f, 320f);
Limit = new Vector2(0f, 10000f);
TextureLimit = new Vector4(0.0f, 1.0f, 0.0f, 1.0f);
TextureSize =0.5f;
Variable = string.Empty;
VerticalMovement = true;
UseLog10 = true;
Use360Horizon = true;
RotateWithVessel = false;
Material = null;
}
//构造函数
public static InfoGauge ReadNode (ConfigNode node)
{
InfoGauge gauge = new InfoGauge();
gauge.Texture = node.GetValue("Texture");
gauge.Position = ConfigNode.ParseVector4(node.GetValue("Position"));
gauge.Limit = ConfigNode.ParseVector2(node.GetValue("Limit"));
gauge.TextureLimit = ConfigNode.ParseVector2(node.GetValue("TextureLimit"));
gauge.TextureSize = float.Parse(node.GetValue("TextureSize"));
gauge.Variable = node.GetValue("Variable");
gauge.VerticalMovement = bool.Parse(node.GetValue("VerticalMovement"));
gauge.UseLog10 = bool.Parse(node.GetValue("UseLog10"));
gauge.Use360Horizon = bool.Parse(node.GetValue("Use360horizon"));
gauge.RotateWithVessel = bool.Parse(node.GetValue("RotateWithVessel"));
return gauge;
}
}
}