本文整理汇总了C#中ConfigNode.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ConfigNode.GetValue方法的具体用法?C# ConfigNode.GetValue怎么用?C# ConfigNode.GetValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConfigNode
的用法示例。
在下文中一共展示了ConfigNode.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Load
public void Load(ConfigNode node)
{
int resourceID = node.GetValue("name").GetHashCode();
if (PartResourceLibrary.Instance.resourceDefinitions.Any(rd => rd.id == resourceID))
{
resource = PartResourceLibrary.Instance.resourceDefinitions[resourceID];
float.TryParse(node.GetValue("ratio"), out ratio);
}
}
示例2: Load
public void Load(ConfigNode node)
{
string resourceID = node.GetValue("name");
if (PartResourceLibrary.Instance.resourceDefinitions.Contains(resourceID))
{
resource = PartResourceLibrary.Instance.resourceDefinitions[resourceID];
float.TryParse(node.GetValue("ratio"), out ratio);
}
}
示例3: ResourceDefinition
public ResourceDefinition(ConfigNode node)
{
Resource = node.GetValue("Resource");
var colorFull = node.GetValue("ColorFull");
ColorFull = colorFull != null ? ConfigNode.ParseColor(colorFull) : Color.white;
var colorEmpty = node.GetValue("ColorEmpty");
ColorEmpty = colorEmpty != null ? ConfigNode.ParseColor(colorEmpty) : Color.white;
Generator = node.GetNode("Generator") ?? new ConfigNode();
}
示例4: loadMonoOverlay
protected void loadMonoOverlay(ConfigNode node)
{
_red = 0;
_green = 0;
_blue = 0;
loadOverlay(node);
if (node.HasValue("red")) _red = byte.Parse(node.GetValue("red"));
if (node.HasValue("green")) _green = byte.Parse(node.GetValue("green"));
if (node.HasValue("blue")) _blue = byte.Parse(node.GetValue("blue"));
}
示例5: loadText
public void loadText(ConfigNode node)
{
_text = string.Empty;
_fontName = "CAPSMALL_CLEAN";
_fontSize = 32;
loadMonoOverlay(node);
if (node.HasValue("text")) _text = node.GetValue("text");
if (node.HasValue("fontName")) _fontName = node.GetValue("fontName");
if (node.HasValue("fontSize")) _fontSize = int.Parse(node.GetValue("fontSize"));
}
示例6: OnLoad
public override void OnLoad(ConfigNode node)
{
base.OnLoad(node);
if (!string.IsNullOrEmpty(moduleID) && node.HasValue(nameof(moduleID)))
{
string newID = node.GetValue(nameof(moduleID));
if (!string.Equals(moduleID, newID))
{
var correctModule = part.Modules.OfType<CFGUtilPartModule>().FirstOrDefault(m => m != this && m.GetType() == this.GetType() && m.moduleID == newID);
if (correctModule.IsNotNull())
{
LogWarning("OnLoad was called with the wrong ModuleID ('" + newID + "'), but found the correct module to load");
correctModule.Load(node);
}
else
{
LogError("OnLoad was called with the wrong ModuleID and the correct module could not be found");
}
return;
}
}
configFieldList.Load(node);
}
示例7: CreateBaseTexture
public static IM.BaseTexture CreateBaseTexture(ConfigNode node)
{
IM.BaseTexture baseTexture = null;
Method method = Method.AUTO;
if (node.HasValue("method")) method = (Method)ConfigNode.ParseEnum(typeof(Method), node.GetValue("method"));
switch (method)
{
case Method.CURRENT:
baseTexture = new IM.CurrentBaseTexture();
break;
case Method.MULTIPLE:
baseTexture = new IM.MultipleBaseTexture();
break;
default:
case Method.AUTO:
baseTexture = new IM.AutoBaseTexture();
break;
}
return baseTexture;
}
示例8: Load
public void Load(ConfigNode node)
{
if (node.HasValue("Name"))
{
var partName = node.GetValue("Name");
Part = PartLoader.getPartInfoByName(partName);
}
}
示例9: GetValue
public static int GetValue(ConfigNode config, string name, int currentValue)
{
int newValue;
if (config.HasValue(name) && int.TryParse(config.GetValue(name), out newValue))
{
return newValue;
}
return currentValue;
}
示例10: load
public override void load(ConfigNode node)
{
_type = Type.BITMAP_MONO_DECAL;
_url = string.Empty;
loadMonoOverlay(node);
if (node.HasValue("url")) _url = node.GetValue("url");
}
示例11: OnLoad
public override void OnLoad(ConfigNode node)
{
if (node.HasValue("burning"))
bool.TryParse(node.GetValue("burning"), out burning);
if (burning)
{
startBurning();
}
}
示例12: GetValue
public static double GetValue(ConfigNode config, string name, double currentValue)
{
double newValue;
if (config.HasValue(name) && double.TryParse(config.GetValue(name), out newValue))
{
return newValue;
}
return currentValue;
}
示例13: TryParse
public static GuiNode TryParse(ConfigNode node)
{
if (node != null)
{
var buttonTexture = node.GetValue("buttonTexture");
return new GuiNode(buttonTexture);
}
Log.Warning("Could not parse missing GUI node");
return null;
}
示例14: OnLoad
protected override void OnLoad(ConfigNode node)
{
if (node.HasValue("target"))
{
string t = node.GetValue("target");
target = FlightGlobals.Bodies.Find(b => b.name == t);
if (target == null)
{
Utilities.Log_Debug("Checking Galaxies");
target = TSTGalaxies.Galaxies.Find(g => g.name == t);
}
}
}
示例15: loadOverlay
protected void loadOverlay(ConfigNode node)
{
_position = new IntVector2();
_mirror = false;
_alpha = 255;
_textureAlpha = 0;
_alphaOption = AlphaOption.USE_TEXTURE;
_normalScale = 2.0f;
_normalOption = NormalOption.USE_BACKGROUND;
_blendMethod = BlendMethod.RGB;
_rotation = Rotation.R0;
if (node.HasValue("x")) _position.x = int.Parse(node.GetValue("x"));
if (node.HasValue("y")) _position.y = int.Parse(node.GetValue("y"));
if (node.HasValue("mirror")) _mirror = bool.Parse(node.GetValue("mirror"));
if (node.HasValue("alpha")) _alpha = byte.Parse(node.GetValue("alpha"));
if (node.HasValue("textureAlpha")) _textureAlpha = byte.Parse(node.GetValue("textureAlpha"));
if (node.HasValue("alphaOption")) _alphaOption = (AlphaOption)ConfigNode.ParseEnum(typeof(AlphaOption), node.GetValue("alphaOption"));
if (node.HasValue("normalScale")) _normalScale = int.Parse(node.GetValue("normalScale"));
if (node.HasValue("normalOption")) _normalOption = (NormalOption)ConfigNode.ParseEnum(typeof(NormalOption), node.GetValue("normalOption"));
if (node.HasValue("blendMethod")) _blendMethod = (BlendMethod)ConfigNode.ParseEnum(typeof(BlendMethod), node.GetValue("blendMethod"));
if (node.HasValue("rotation")) _rotation = (Rotation)ConfigNode.ParseEnum(typeof(Rotation), node.GetValue("rotation"));
}