public ListResponse <BodyComponent> GetBodyComponentList(ListRequest <BodyComponent> request) { lock (_lock) { var actComponent = BodyComponentBase.GetActuallyComponent(request.Parameter); var compNode = CharacterNode.SearchNode(actComponent.BaseNodePath); compNode.Nodes.SortByImgID(); var resp = new ListResponse <BodyComponent> { Results = compNode.Nodes.Skip(request.Start).Take(request.Num).Select(nd => { var comp = new BodyComponent { ID = actComponent.FormatID(nd.Text), ConfigType = actComponent.ConfigType, MotionName = actComponent.DefaultMotionName }; return(GetBodyComponent(comp, false)); }).ToList() }; resp.HasNext = resp.Results.Count == request.Num; return(resp); } }
public BodyComponent GetBodyComponent(BodyComponent bodyComponent, bool isDefault = true) { lock (_lock) { Wz_Node compNode; Wz_Node compStringNode; var actComponent = BodyComponentBase.GetActuallyComponent(bodyComponent); compNode = CharacterNode.SearchNode(actComponent.BaseNodePath); compStringNode = StringNode.SearchNode(actComponent.BaseStringNodePath); if (isDefault) { bodyComponent.ID = actComponent.DefaultID; bodyComponent.MotionName = actComponent.DefaultMotionName; } var node = compNode.Nodes.First(nd => actComponent.FormatID(nd.Text) == bodyComponent.ID).GetImageNode(); var motionNode = node.SearchNode(bodyComponent.MotionName); var stringNode = compStringNode.SearchNode(bodyComponent.ID.ToString()); string name; if (stringNode == null) { name = null; } else if (stringNode.Nodes["name"] == null) { name = $"{stringNode.Text}:{stringNode.Value}"; } else { name = stringNode.Nodes["name"].Value.ToString(); } bodyComponent.Name = name; bodyComponent.Info = node.GetCharacterInfo(CharacterNode); bodyComponent.Motion = motionNode?.GetCharacterMotion(CharacterNode, bodyComponent.ConfigType); return(bodyComponent); } }