private void TryLogin()
        {
            var character = _playdata.Characters[_pendingCharacterIndex];

            _pendingCharacterIndex = -1;
            string characterName = character.Name;

            var    world        = _playdata.FindWorld(character.WorldId);
            string worldName    = world.Name;
            string worldAddress = world.GetAddress(OpenTibiaUnity.GameManager.ClientVersion, OpenTibiaUnity.GameManager.BuildVersion);
            int    worldPort    = world.GetPort(OpenTibiaUnity.GameManager.ClientVersion, OpenTibiaUnity.GameManager.BuildVersion);

            InternalEnterGame(characterName, worldAddress, worldName, worldPort);
        }
        public void Setup(PlayData playData)
        {
            _playdata = playData;

            foreach (Transform child in _characterScrollRect.content)
            {
                Destroy(child.gameObject);
            }

            int clientVersion  = OpenTibiaUnity.GameManager.ClientVersion;
            int characterCount = playData.Characters.Count;

            for (int i = 0; i < characterCount; i++)
            {
                var    character = playData.Characters[i];
                var    world     = playData.FindWorld(character.WorldId);
                string worldName = world.Name;
                if (world.PreviewState == 1)
                {
                    if (clientVersion >= 1100)
                    {
                        worldName += " (Experimental)";
                    }
                    else
                    {
                        worldName += " (Preview)";
                    }
                }

                if (clientVersion >= 1200)
                {
                    worldName += $"\n({world.GetPvPTypeDescription()})";
                }

                var characterPanel = Instantiate(ModulesManager.Instance.AccountCharacterPrefab, _characterScrollRect.content);
                characterPanel.UseAlternateColor = clientVersion >= 1100;
                characterPanel.CharacterName     = character.Name;
                characterPanel.WorldName         = worldName;
                characterPanel.toggle.onValueChanged.AddListener((value) => OnCharacterValueToggleValueChanged(characterPanel, value));
                characterPanel.toggle.group = _characterToggleGroup;

                if (clientVersion >= 1200)
                {
                    characterPanel.GetComponent <UnityUI.LayoutElement>().minHeight = 34;
                }
                characterPanel.onDoubleClick.AddListener(OnOkButtonClick);
            }
        }