Skip to content

TypeResolver โ€‹

ๅ‘ฝๅ็ฉบ้—ด: Cwl.API.Processors;

ๆธธๆˆๆ— ๆณ•่งฃๆž็ฑปๅž‹ๆ—ถๅผ•ๅ‘็š„ไบ‹ไปถใ€‚ไธป่ฆ็”ฑCWL่‡ช่บซไฝฟ็”จใ€‚

TypeResolve โ€‹

cs
delegate void TypeResolve(ref bool resolved, Type objectType, ref Type readType, string qualified);
// ->
static void MyTypeResolver(ref bool resolved, Type objectType, ref Type readType, string qualified)
{
    if (resolved || objectType != typeof(Zone)) {
        return;
    }

    readType = typeof(Zone_Fallback);
    resolved = true;
    // ๅฆ‚ๆœ‰้œ€่ฆ๏ผŒ่ฟ›่กŒไธ€ไบ›้ขๅค–็š„ๆธ…็†
}

ๅฝ“resolvedไธบfalseๆ—ถ๏ผŒ่ฟ™ๆ„ๅ‘ณ็€็ฑปๅž‹ๅ็งฐไธบqualified็š„readTypeๆ— ๆณ•ๅฎžไพ‹ๅŒ–ไธบobjectTypeใ€‚ๅฆ‚ๆžœๆ‚จ็š„่งฃๆžๅ™จๆ— ๆณ•่งฃๆžๆญค็ฑปๅž‹๏ผŒ่ฏท็›ดๆŽฅ่ฟ”ๅ›žๅนถ่ฎฉไธ‹ไธ€ไธช่งฃๆžๅ™จๅค„็†๏ผŒๆˆ–่€…่ฎฉๆธธๆˆๆŠ›ๅ‡บๅผ‚ๅธธใ€‚

ๅฆ‚ๆžœๆ‚จ็š„ๅค„็†็จ‹ๅบ่ƒฝๅคŸ่งฃๆžๆญค็ฑปๅž‹๏ผŒ่ฏทๅฐ†readTypeๆ›ดๆ”นไธบ่งฃๆžๅŽ็š„็ฑปๅž‹๏ผŒๅนถๅฐ†resolved่ฎพ็ฝฎไธบtrueใ€‚

ๆณจๅ†Œ โ€‹

cs
TypeResolver.Add(MyTypeResolver);

This project is an unofficial documentation site and is not affiliated with, endorsed by, or associated with Elin or Lafrontier / Noa. All trademarks are the property of their respective owners.