Пример #1
0
        public async Task FetchRoster(StandardCommand c)
        {
            if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken)
            {
                (ListOf_DBResult flag, List <Character> characters) = await HoloData.FetchCharacters(c.SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddCharacters(characters);
                ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel);
            }
        }
Пример #2
0
        public async Task CreateCharacter(CharacterData character)
        {
            string SessionToken = connectedUsers[Context.ConnectionId].SessionToken;

            if (SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId))
            {
                Character NewCharacter = character;
                NewCharacter.Specializations  = string.Join(",", character.SpecializationsList);
                NewCharacter.SkillsCareer     = string.Join(",", character.SkillsCareerList);
                NewCharacter.SkillsCareerFree = string.Join(",", character.SkillsCareerFreeList);
                NewCharacter.SkillsSpec       = string.Join(",", character.SkillsSpecList);
                NewCharacter.SkillsSpecFree   = string.Join(",", character.SkillsSpecFreeList);
                await HoloData.CreateCharacter(SessionToken, NewCharacter);

                (ListOf_DBResult flag, List <Character> characters) = await HoloData.FetchCharacters(SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddCharacters(characters);
                ClientUpdates.SendUpdate(connectedUsers.Where(x => x.Value.SessionToken == SessionToken).Select(x => Clients.Client(x.Key)).ToList(), flag, updateModel);
            }
        }