Exemplo n.º 1
0
        private async void Player_NetUserDataChanged(Player obj)
        {
            if (_char != null)
            {
                return;
            }
            _char = await ServerDB.SelectCharacterAsync(_user.Char);

            if (_char == null)
            {
                _player.Error($"Error while retrieving pony");
            }
            else
            {
                _player.SetBounds();
                _player.SetVersion();
                _object = new WO_Player(this);
                _save   = new AutoSaveChar(this);
                _items  = _object.GetComponent <ItemsMgr>();
                _trade  = _object.GetComponent <TradeMgr>();
                _skills = _object.GetComponent <SkillsMgr>();
                SetPet();
                _user.Map = _server.Map.Id;
                _char.Map = _user.Map;
                _player.SynchNetData();
                await CharsMgr.SaveCharacterAsync(_char);
            }
        }
Exemplo n.º 2
0
 public void Destroy()
 {
     _player.NetUserDataChanged -= Player_NetUserDataChanged;
     _save.Destroy();
     _object.Destroy();
     _pet?.Destroy();
     CharsMgr.SaveCharacter(_char);
     if (_dialog != null)
     {
         _dialog.Dialog.OnDialogEnd(this);
     }
     if (_shop != null)
     {
         _shop.Movement.Unlock();
     }
     foreach (var item in _clones.Values.ToArray())
     {
         item.Destroy();
     }
     _pet    = null;
     _save   = null;
     _shop   = null;
     _user   = null;
     _char   = null;
     _trade  = null;
     _items  = null;
     _clones = null;
     _dialog = null;
     _server = null;
     _player = null;
     _object = null;
     _skills = null;
 }
Exemplo n.º 3
0
 public void CreateSaveTimer()
 {
     _save = new AutoSaveChar(this);
 }