コード例 #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);
        }
コード例 #2
0
ファイル: BrowserService.cs プロジェクト: MikyWang/WzLoader
        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);
        }
コード例 #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);
        }
コード例 #4
0
ファイル: BrowserService.cs プロジェクト: MikyWang/WzLoader
        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
            });
        }
コード例 #5
0
        /// <summary>
        /// Gets a character with the given name from <see cref="LoadedCharacters"/>
        /// </summary>
        /// <param name="name">The name.</param>
        /// <returns></returns>
        public Character GetCharacter(string name)
        {
            Character c = new Character(h: name);

            return(LoadedCharacters.Find(x => x.Handle == name));
        }