public void RenderPart(FigurePart part) { int partValue = 2; if (part == FigurePart.Head) { partValue = this.HeadValue; } else if (part == FigurePart.Neck) { partValue = this.NeckValue; } else if (part == FigurePart.Legs) { partValue = this.LegsValue; } else if (part == FigurePart.Feet) { partValue = this.FeetValue; } if (partValue == 1) { Console.Write(" 0 "); } else if (partValue == 0) { Console.Write("0 0"); } else { Console.Write("Invalid value"); } }
private AvatarAsset LoadCarryItemAsset(int carryId) { var key = "ri" + (IsSmall ? "_sh" : "_h"); var document = FigureExtractor.Parts.ContainsKey(key) ? FigureExtractor.Parts[key] : null; if (document == null) { return(null); } int direction = BodyDirection; if (BodyDirection == 4) { direction = 2; } if (BodyDirection == 6) { direction = 0; } if (BodyDirection == 5) { direction = 1; } var part = new FigurePart("0", "ri", false, 0, null); var set = new FigureSet("ri", "", "", false, false, false); var asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_" + Action + "_ri_" + carryId + "_" + direction + "_" + Frame, document, null, part, set); if (asset == null) { asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_crr_ri_" + carryId + "_" + direction + "_" + Frame, document, null, part, set); } if (asset == null) { LocateAsset((this.IsSmall ? "sh" : "h") + "_std_ri_" + carryId + "_0_" + Frame, document, null, part, set); } return(asset); }
public string PartString(FigurePart part) { string s = "empty"; int partValue = 2; if (part == FigurePart.Head) { partValue = this.HeadValue; } else if (part == FigurePart.Neck) { partValue = this.NeckValue; } else if (part == FigurePart.Legs) { partValue = this.LegsValue; } else if (part == FigurePart.Feet) { partValue = this.FeetValue; } if (partValue == 1) { s = " 0 "; } else if (partValue == 0) { s = "0 0"; } else { s = "error"; } return(s); }
public AvatarAsset(bool isSmall, string action, string name, string fileName, int X, int Y, FigurePart part, FigureSet set, int canvasW, int canvasH, string[] parts) { this.Name = name; this.X = X; this.Y = Y; this.FileName = fileName; this.Part = part; this.Set = set; this.Parts = parts; this.RenderOrder = this.Part.OrderId; this.IsDrinkCanvas = false; if (action == "lay") { this.ImageY = Y + (canvasW / 2) + (isSmall ? -5 : -20); this.ImageX = X + (canvasH / 2) - (isSmall ? -11 : -10); } else { this.ImageX = X + (canvasW / 2) + (isSmall ? 5 : 10); this.ImageY = Y + (canvasH / 2) - (isSmall ? 11 : 20); } }
private AvatarAsset LocateAsset(string assetName, FigureDocument document, string[] parts, FigurePart part, FigureSet set) { var list = document.XmlFile.SelectNodes("//manifest/library/assets/asset"); for (int i = 0; i < list.Count; i++) { var asset = list.Item(i); var name = asset.Attributes.GetNamedItem("name").InnerText; if (name != assetName) { continue; } var offsetList = asset.ChildNodes; for (int j = 0; j < offsetList.Count; j++) { var offsetData = offsetList.Item(j); if (offsetData.Attributes.GetNamedItem("key") == null || offsetData.Attributes.GetNamedItem("value") == null) { continue; } if (offsetData.Attributes.GetNamedItem("key").InnerText != "offset") { continue; } var offsets = offsetData.Attributes.GetNamedItem("value").InnerText.Split(','); return(new AvatarAsset(this.IsSmall, Action, name, FileUtil.SolveFile("figuredata/" + document.FileName + "/", name), int.Parse(offsets[0]), int.Parse(offsets[1]), part, set, CANVAS_HEIGHT, CANVAS_WIDTH, parts)); } } return(null); }
private AvatarAsset LoadFigureAsset(string[] parts, FigurePart part, FigureSet set) { var key = part.Type + (IsSmall ? "_sh" : "_h"); var document = FigureExtractor.Parts.ContainsKey(key) ? FigureExtractor.Parts[key] : null; if (document == null) { return(null); } int direction; string gesture; if (IsHead(part.Type)) { direction = HeadDirection; gesture = Gesture; if (HeadDirection == 4) { direction = 2; } if (HeadDirection == 6) { direction = 0; } if (HeadDirection == 5) { direction = 1; } } else { direction = BodyDirection; gesture = Action; if (BodyDirection == 4) { direction = 2; } if (BodyDirection == 6) { direction = 0; } if (BodyDirection == 5) { direction = 1; } } // Hide left arm on side view if (direction == 1 && part.Type == "ls") { return(null); } if (Action == "lay") { if (BodyDirection >= 4) { direction = 2; } } if (CarryDrink > 0 && Action != "lay" && Action != "drk") { if (new string[] { "ls", "lh" }.Contains(part.Type)) { gesture = "std"; } if (CarryDrink > 0) { if (new string[] { "rs", "rh" }.Contains(part.Type)) { gesture = "crr"; } } } var asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_" + gesture + "_" + part.Type + "_" + part.Id + "_" + direction + "_" + Frame, document, parts, part, set); if (asset == null) { asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_" + "std" + "_" + part.Type + "_" + part.Id + "_" + direction + "_" + Frame, document, parts, part, set); } if (asset == null) { asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_" + "std" + "_" + part.Type + "_" + part.Id + "_" + direction + "_" + 0, document, parts, part, set); } if (IsSmall) { if (asset == null) { asset = LocateAsset((this.IsSmall ? "sh" : "h") + "_" + "std" + "_" + part.Type + "_" + 1 + "_" + direction + "_" + Frame, document, parts, part, set); } } return(asset); }