-
Notifications
You must be signed in to change notification settings - Fork 5
/
XMLLoader.cs
107 lines (103 loc) · 2.89 KB
/
XMLLoader.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Xml.Linq;
using UnityEditor;
using UnityEngine;
namespace AvaterInfo
{
public class XMLLoader
{
public enum keys
{
NAME,
Hips,
LeftUpperLeg,
RightUpperLeg,
LeftLowerLeg,
RightLowerLeg,
LeftFoot,
RightFoot,
Spine,
Chest,
UpperChest,
Neck,
Head,
LeftShoulder,
RightShoulder,
LeftUpperArm,
RightUpperArm,
LeftLowerArm,
RightLowerArm,
LeftHand,
RightHand,
LeftToes,
RightToes,
LeftEye,
RightEye,
Jaw,
LeftThumbProximal,
LeftThumbIntermediate,
LeftThumbDistal,
LeftIndexProximal,
LeftIndexIntermediate,
LeftIndexDistal,
LeftMiddleProximal,
LeftMiddleIntermediate,
LeftMiddleDistal,
LeftRingProximal,
LeftRingIntermediate,
LeftRingDistal,
LeftLittleProximal,
LeftLittleIntermediate,
LeftLittleDistal,
RightThumbProximal,
RightThumbIntermediate,
RightThumbDistal,
RightIndexProximal,
RightIndexIntermediate,
RightIndexDistal,
RightMiddleProximal,
RightMiddleIntermediate,
RightMiddleDistal,
RightRingProximal,
RightRingIntermediate,
RightRingDistal,
RightLittleProximal,
RightLittleIntermediate,
RightLittleDistal,
LastBone,
RightBreastRoot,
RightBreastMid,
RightBreastEnd,
LeftBreastRoot,
LeftBreastMid,
LeftBreastEnd
}
static XElement xml;
static IEnumerable<XElement> elements;
public XMLLoader ()
{
var path = AssetDatabase.GUIDToAssetPath("47081239d4c81964ea0b40ebe97514ee");
xml = XElement.Load(path);
elements = from item in xml.Elements("avater")
select item;
}
public string[] GetAvaterNames()
{
IEnumerable<string> infos = from item in elements.Elements(keys.NAME.ToString())
select item.Value;
return infos.ToArray();
}
public string[] GetBoneNameFromKey(keys key)
{
IEnumerable<string> infos = from item in elements.Elements(key.ToString())
select item.Value;
return infos.ToArray();
}
}
class BoneInfo
{
public string avaterName { set; get; }
}
}