public string TaggedFileString(Dictionary <string, long> counts) { // danbooru: // app/presenters/tag_set_presenter.rb:66 humanized_essential_tag_string // Rules: // 5 character tags max ("{n - 5} more" if total number exceeds 5) // 1 copyright tag, same rule when exceeded // "drawn by {artist} if an artist is present // // First 2 are sorted by post count, descending string result = ""; if (HasCharacterTags) { // I hope danbooru trims it right, but just to be sure // First instance of "_(" denotes start of copyright part of character tag. Remove this part List <string> characters = CharacterTags.OrderByDescending(e => counts[e]).RemoveAfterFirst("_(") .Select(s => s.Replace('_', ' ')).ToList(); if (characters.Count > 5) { int count = characters.Count; characters = characters.Take(5).ToList(); characters.Add($"{count - 5} more"); } result += $"{characters.ToSentence()} "; } if (HasCopyrightTags) { // Extra copyright description not needed List <string> copyrights = CopyrightTags.OrderByDescending(e => counts[e]).RemoveAfterFirst("_(") .Select(s => s.Replace('_', ' ')).ToList(); if (copyrights.Count > 1) { int count = copyrights.Count; copyrights = copyrights.Take(1).ToList(); copyrights.Add($"{count - 1} more"); } result += $"({copyrights.ToSentence()}) "; } if (HasArtistTags) { // Artist tags aren't humanized? result += $"drawn by {ArtistTags.ToSentence()} "; } return(NotEmpty(result) ? $"{result}- {MD5}" : MD5); }
/* Works as follows... * We iterate through the entire loop of characters, and for each character, * we are going to create an instance of it, set it to inactive, name it properly, * and then add it to our list of all actors called actorsList. */ void Awake() { _inkManager = GetComponent <InkManager>(); for (int i = 0; i < characters.Length; i++) { GameObject newActor = Instantiate(characters[i]); newActor.SetActive(false); newActor.name = characters[i].name; actorsList.Add(newActor); } characterTags = GetComponent <CharacterTags>(); }
/* Given an actor whose name is actorName, set that actor's reactionIcon to REACTIONICON. */ private void setReactionIcon(string reactionIcon, string actorName) { Vector3 actorPosition = FetchActor(actorName).transform.position; foreach (GameObject sprite in characterTags.getReactionIcons()) { if (sprite.name == reactionIcon) { GameObject toPlace = Instantiate(sprite) as GameObject; toPlace.transform.position = actorPosition; CharacterTags.RepositionTag(toPlace); } } }
public XAnimation GetXAnimation(CharacterTags c_tag, AnimationTags a_tag) { return(character_dictionary[c_tag][a_tag]); }