79235259

Date: 2024-11-28 20:42:07
Score: 1.5
Natty:
Report link

In the end, with the help of some acquaintances I've looked at the situation from a different view. Instead of trying to make NicknameData act as its parent, we changed the way the names and titles in the game are called.

Even though now the game deserializes the said JSON twice, it's pretty safe working with the times when the character array lacks the needed lines.

Now the Nickname Data looks like this:

    [Serializable]
public class NicknameData : *GameClass*
{
    [JsonPropertyName("runame")]
    public string? runame;

    [JsonPropertyName("ruNickName")]
    public string? ruNickName;

    public NicknameData() { }

    internal static NicknameData Create(ref Utf8JsonReader reader)
    {
        var result = new NicknameData();
        while (reader.Read())
        {
            if (reader.TokenType == JsonTokenType.EndObject)
            {
                break;
            }
             if (reader.TokenType == JsonTokenType.PropertyName)
            {
                string propertyName = reader.GetString();
                reader.Read();

                if (propertyName == "name")
                {
                    result.name = reader.GetString();
                }
                else if (propertyName == "runame")
                {
                    result.runame = reader.GetString();
                }
                else if (propertyName == "ruNickName")
                {
                    result.ruNickName = reader.GetString();
                }
            }
        }
        return result;
    }
}

Beside that, I was given the custom converter which is, unlike built-in ones, working without sending errors of inability to converse into parent class or, which is more frequent, the Exception: System.NullReferenceException: Object reference not set to an instance of an object. error.

It's quite long so I'll edit the link of the converter into the answer once we push the code update onto our localization GitHub.

Either way, thank you, those who tried to help me! Now the localization idea which haunted me for weeks has come to fruition and I feel really happy and relieved.

Reasons:
  • Blacklisted phrase (0.5): thank you
  • Blacklisted phrase (1): help me
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Knightey