Пример #1
0
        public static CharacterConfig GetCharacterConfig(this Wz_Node wz_Node, Wz_Node baseNode)
        {
            if (wz_Node.Value != null && wz_Node.Value is Wz_Uol)
            {
                wz_Node = wz_Node.GetValue <Wz_Uol>().HandleUol(wz_Node);
            }
            var nodes  = wz_Node.Nodes;
            var config = new CharacterConfig
            {
                Name    = wz_Node.Text,
                Origin  = nodes["origin"]?.GetValue <Wz_Vector>(),
                PngInfo = wz_Node.GetPngInfo(baseNode),
                Group   = nodes["group"]?.Value?.ToString(),
                Hash    = nodes["_hash"]?.Value?.ToString(),
                Map     = wz_Node.GetMap(),
                Z       = nodes["z"]?.Value?.ToString(),
                Action  = nodes["action"]?.Value?.ToString(),
                Delay   = nodes["delay"]?.Value?.ToString(),
                Frame   = nodes["frame"]?.Value?.ToString(),
                Move    = nodes["move"]?.GetValue <Wz_Vector>(),
                Rotate  = nodes["rotate"]?.Value?.ToString(),
                Vector  = nodes["vector"]?.GetValue <Wz_Vector>(),
                Flip    = nodes["flip"]?.Value?.ToString()
            };

            if (config.Action != null)
            {
                var link       = $"{config.Action}\\{config.Frame}";
                var node       = wz_Node.GetNodeWzImage().Node.SearchNode(link);
                var baseConfig = node.GetCharacterConfig(baseNode);
                config.Origin  = baseConfig.Origin;
                config.Map     = baseConfig.Map;
                config.Z       = baseConfig.Z;
                config.Group   = baseConfig.Group;
                config.Hash    = baseConfig.Hash;
                config.PngInfo = baseConfig.PngInfo;
            }
            return(config);
        }