Init
This commit is contained in:
30
Assets/Scripts/JiuJie/XmlReaderEx.cs
Normal file
30
Assets/Scripts/JiuJie/XmlReaderEx.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System.Xml;
|
||||
using UnityEngine;
|
||||
|
||||
namespace DefaultNamespace
|
||||
{
|
||||
public static class XmlReaderEx
|
||||
{
|
||||
public static Vector3 ReadVector3(this XmlNode vNode)
|
||||
{
|
||||
float x = float.Parse(vNode.Attributes["x"].Value);
|
||||
float y = float.Parse(vNode.Attributes["y"].Value);
|
||||
float z = float.Parse(vNode.Attributes["z"].Value);
|
||||
return new Vector3(x, y, z);
|
||||
}
|
||||
|
||||
public static Vector3 ReadVector2(this XmlNode vNode)
|
||||
{
|
||||
float x = float.Parse(vNode.Attributes["x"].Value);
|
||||
float y = float.Parse(vNode.Attributes["y"].Value);
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
|
||||
public static Vector3 ReadUV2(this XmlNode vNode)
|
||||
{
|
||||
float x = float.Parse(vNode.Attributes["u"].Value);
|
||||
float y = float.Parse(vNode.Attributes["v"].Value);
|
||||
return new Vector2(x, y);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user