Exemplo n.º 1
0
        /// <summary>
        /// Creates a new character and adds it to the list of loaded characters.
        /// </summary>
        /// <param name="name">The character's name.</param>
        /// <param name="characterPoints">The character points.</param>
        /// <param name="c">The character's class.</param>
        /// <param name="handle">The character's handle.</param>
        /// <param name="lucky">Determines if the character gets points in luck.</param>
        /// <returns></returns>
        public Character CreateCharacter(string name, int characterPoints, CharacterClass c, string handle = "(None)", bool?lucky = false)
        {
            Character newChar = new Character(n: name, h: handle, c: c, points: characterPoints, lucky: (bool)lucky);

            LoadedCharacters.Add(newChar);
            return(newChar);
        }
Exemplo n.º 2
0
        public async Task <Character> GetDefaultCharacter()
        {
            await BodyComponentRefreshMotion();

            if (CurrentCharacter == null)
            {
                var response = await httpClient.GetFromJsonAsync <CharacterResponse>(CommonStrings.CHARACTER);

                var collection = response.CharacterCollection;
                LoadedCharacters.Add(collection.Id, new Dictionary <string, CharacterCollection>());
                LoadedCharacters[collection.Id].Add(collection.HeadMotion.Name, collection);
                CurrentCharacter = new Character
                {
                    Id                 = collection.Id,
                    CurrentFrame       = "0",
                    CurrentFaceFrame   = "0",
                    CurrentHeadMotion  = collection.HeadMotion,
                    CurrentBodyMotion  = collection.BodyMotion,
                    CurrentFaceMotion  = CurrentFace.Motion,
                    CurrentHairMotion  = CurrentHair.Motion,
                    CurrentCoatMotion  = CurrentCoat.Motion,
                    CurrentPantsMotion = CurrentPants.Motion
                };
            }
            return(CurrentCharacter);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Creates a new character and adds it to the list of loaded characters.
        /// </summary>
        /// <param name="name">The character's name.</param>
        /// <param name="stats">The character's stats.</param>
        /// <param name="handle">The character's handle.</param>
        /// <param name="c">The character's class.</param>
        /// <returns></returns>
        public Character CreateCharacter(string name, List <int> stats, string c, string handle = "(None)")
        {
            Character newChar = new Character(stats: stats, n: name, h: handle, c: c);

            LoadedCharacters.Add(newChar);
            return(newChar);
        }
Exemplo n.º 4
0
        public async Task <Character> LoadingCharacterAsync(int id, string motionName, int frame)
        {
            if (!LoadedCharacters.ContainsKey(id))
            {
                LoadedCharacters.Add(id, new Dictionary <string, CharacterCollection>());
            }
            if (!LoadedCharacters[id].ContainsKey(motionName))
            {
                var request = new CharacterRequest {
                    CharacterId = id, MotionName = motionName
                };
                var response = await httpClient.PostAsJsonAsync <CharacterRequest>(CommonStrings.CHARACTER_POST_CHARACTER, request);

                var collection = (await response.Content.ReadFromJsonAsync <CharacterResponse>()).CharacterCollection;
                if (collection == null)
                {
                    return(null);
                }
                LoadedCharacters[id].Add(collection.HeadMotion.Name, collection);
            }
            var extcollection = LoadedCharacters[id][motionName];

            await BodyComponentRefreshMotion(motionName, false);

            return(new Character
            {
                Id = id,
                CurrentFrame = frame.ToString(),
                CurrentFaceFrame = "0",
                CurrentHeadMotion = extcollection.HeadMotion,
                CurrentBodyMotion = extcollection.BodyMotion,
                CurrentFaceMotion = CurrentFace.Motion,
                CurrentHairMotion = CurrentHair.Motion,
                CurrentCoatMotion = CurrentCoat.Motion,
                CurrentPantsMotion = CurrentPants.Motion
            });
        }