コード例 #1
0
        public bool DeleteCharacter(Character character, string sessionToken)
        {
            try
            {
                var client          = ClientTable.Instance.SearchClient(sessionToken);
                var deleteCharacter = client.User.Characters.FirstOrDefault(t =>
                                                                            t.Name == character.Name);
                if (deleteCharacter != null)
                {
                    WorkUnit.Instance.Characters.Remove(deleteCharacter.Id);
                }
                else
                {
                    return(false);
                }

                WorkUnit.Instance.SaveAsync();

                return(true);
            }
            catch
            {
                return(false);
            }
        }
コード例 #2
0
        public Character[] GetCharacters(string sessionToken)
        {
            var client       = ClientTable.Instance.SearchClient(sessionToken);
            var dbCharacters = client.User.Characters;
            var characters   = new Character[dbCharacters.Count];
            var i            = 0;

            foreach (var dbCharacter in dbCharacters)
            {
                characters[i++] = new Character()
                {
                    Name             = dbCharacter.Name,
                    MainRedColor     = dbCharacter.MainRedColor,
                    MainGreenColor   = dbCharacter.MainGreenColor,
                    MainBlueColor    = dbCharacter.MainBlueColor,
                    StrokeRedColor   = dbCharacter.StrokeRedColor,
                    StrokeGreenColor = dbCharacter.StrokeGreenColor,
                    StrokeBlueColor  = dbCharacter.StrokeBlueColor,
                    StrokeLength     = dbCharacter.StrokeLength,
                    StrokeSpace      = dbCharacter.StrokeSpace
                };
            }

            return(characters);
        }
コード例 #3
0
ファイル: GameSessions.cs プロジェクト: Nickname10/Strider
 public Player Connect(int gameSessionId, Character character, LoggedClient loggedClient)
 {
     try
     {
         // if client isn't in client table we throw the exception
         if (ClientTable.Instance.SearchClient(loggedClient.SessionToken) == null)
         {
             throw new Exception();
         }
         return(GameSessionManager.GameMaps[gameSessionId]
                .GeneratePlayer(loggedClient, character, OperationContext.Current));
     }
     catch
     {
         return(null);
     }
 }