Ejemplo n.º 1
0
        public async Task FetchAdventure(StandardCommand c)
        {
            if (c.SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId) && c.SessionToken == connectedUsers[Context.ConnectionId].SessionToken)
            {
                (ListOf_DBResult flag, Group group) = await HoloData.FetchAdventure(c.SessionToken);

                UpdateModel updateModel = new UpdateModel();
                updateModel.AddAdventure(group);
                ClientUpdates.SendUpdate(Clients.Caller, flag, updateModel);
            }
        }
Ejemplo n.º 2
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);
            }
        }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
0
        public async Task CreateGroup(Group NewGroup)
        {
            string SessionToken = connectedUsers[Context.ConnectionId].SessionToken;

            if (SessionToken != null && connectedUsers.ContainsKey(Context.ConnectionId))
            {
                (ListOf_DBResult flag, Group group) = await HoloData.CreateGroup(SessionToken, new Group()
                {
                    Name = NewGroup.Name, ConnectionId = NewGroup.ConnectionId
                });

                if (flag == ListOf_DBResult.Success)
                {
                    UpdateModel updateModel = new UpdateModel();
                    updateModel.AddGroupList(group);
                    ClientUpdates.SendUpdate(connectedUsers.Where(x => x.Value.SessionToken == SessionToken).Select(x => Clients.Client(x.Key)).ToList(), flag, updateModel);
                }
                else
                {
                    ClientUpdates.SendUpdate(connectedUsers.Where(x => x.Value.SessionToken == SessionToken).Select(x => Clients.Client(x.Key)).ToList(), flag);
                }
            }
        }