本文整理汇总了C#中Type.getType方法的典型用法代码示例。如果您正苦于以下问题:C# Type.getType方法的具体用法?C# Type.getType怎么用?C# Type.getType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Type
的用法示例。
在下文中一共展示了Type.getType方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: damageMultiplierToType
/// <summary>
/// Returns the damage multiplier to Type t.
/// </summary>
/// <returns>The multiplier to type.</returns>
/// <param name="t">T.</param>
public double damageMultiplierToType(Type t)
{
int i = t.getType ();
if (type == 1) {
if (i == 2) {
return 0.5;
} else if (i == 3) {
return 1.5;
} else {
return 1d;
}
} else if (type == 2) {
if (i == 3) {
return 0.5;
} else if (i == 1) {
return 1.5;
} else {
return 1d;
}
} else if (type == 3) {
if (i == 1){
return 0.5;
}else if(i == 2){
return 1.5;
} else{
return 1d;
}
}else{
return 1d;
}
}
示例2: Read
/// <summary>
/// This is used to resolve and load a class for the given element.
/// Resolution of the class to used is done by inspecting the
/// XML element provided. If there is a "class" attribute on the
/// element then its value is used to resolve the class to use.
/// If no such attribute exists on the element this returns null.
/// </summary>
/// <param name="type">
/// this is the type of the XML element expected
/// </param>
/// <param name="node">
/// this is the element used to resolve an override
/// </param>
/// <param name="map">
/// this is used to maintain contextual information
/// </param>
/// <returns>
/// returns the class that should be used for the object
/// </returns>
public Value Read(Type type, NodeMap node, Dictionary map) {
Class actual = ReadValue(type, node);
Class expect = type.getType();
if(expect.isArray()) {
return ReadArray(actual, node);
}
if(expect != actual) {
return new ObjectValue(actual);
}
return null;
}
示例3: Write
/// <summary>
/// This is used to attach a attribute to the provided element
/// that is used to identify the class. The attribute name is
/// "class" and has the value of the fully qualified class
/// name for the object provided. This will only be invoked
/// if the object class is different from the field class.
/// </summary>
/// <param name="type">
/// this is the declared class for the field used
/// </param>
/// <param name="value">
/// this is the instance variable being serialized
/// </param>
/// <param name="node">
/// this is the element used to represent the value
/// </param>
/// <param name="map">
/// this is used to maintain contextual information
/// </param>
/// <returns>
/// this returns true if serialization is complete
/// </returns>
public bool Write(Type type, Object value, NodeMap node, Dictionary map) {
Class actual = value.getClass();
Class expect = type.getType();
Class real = actual;
if(actual.isArray()) {
real = WriteArray(expect, value, node);
}
if(actual != expect) {
node.put(label, real.getName());
}
return false;
}
示例4: ReadValue
/// <summary>
/// This is used to resolve and load a class for the given element.
/// Resolution of the class to used is done by inspecting the
/// XML element provided. If there is a "class" attribute on the
/// element then its value is used to resolve the class to use.
/// If no such attribute exists the specified field is returned,
/// or if the field type is an array then the component type.
/// </summary>
/// <param name="type">
/// this is the type of the XML element expected
/// </param>
/// <param name="node">
/// this is the element used to resolve an override
/// </param>
/// <returns>
/// returns the class that should be used for the object
/// </returns>
public Class ReadValue(Type type, NodeMap node) {
Node entry = node.remove(label);
Class expect = type.getType();
if(expect.isArray()) {
expect = expect.getComponentType();
}
if(entry != null) {
String name = entry.getValue();
expect = loader.Load(name);
}
return expect;
}
示例5: Write
public void Write(Type type, NodeMap<OutputNode> node) {
if(!node.getNode().isRoot()) {
node.getNode().setComment(type.getType().getName());
}
}
示例6: Read
public void Read(Type type, NodeMap<InputNode> node) {
InputNode element = node.getNode();
if(element.isRoot()) {
Object source = element.getSource();
Class sourceType = source.getClass();
Class itemType = type.getType();
System.out.printf(">>>>> ELEMENT=[%s]%n>>>>> TYPE=[%s]%n>>>>> SOURCE=[%s]%n", element, itemType, sourceType);
}
}