Пример #1
0
        private static async void ClientInitCallbackHandler(ICharacter character)
        {
            if (Client.CurrentGame.ConnectionState != ConnectionState.Connected)
            {
                return;
            }

            if (!ClientStoredCharacterData.TryLoad(out CharacterProgressData data))
            {
                // no data to restore
                return;
            }

            ClientStoredCharacterData.Clear();

            var serverAddress = Client.CurrentGame.ServerInfo.ServerAddress;

            if (!serverAddress.IsLocalServer ||
                serverAddress.LocalServerSlotId != data.SlotId)
            {
                // the client has connected to something else, it seems
                return;
            }

            await Instance.CallServer(_ => _.ServerRemote_RestoreCharacterData(data));

            MenuCharacterCreation.HideIfCharacterCreated();
        }