예제 #1
0
    void CreatorDropImageSourceReset()
    {
        dropCreatorImageSource.ClearOptions();
        List <string> newOp = new List <string>();

        foreach (string s in filesOnSource)
        {
            string            file = Path.GetFileName(s);
            E621CharacterData dat  = null;
            if (mode == Mode.Character)
            {
                dat = Data.act.e621CharacterData.Where(temp => temp.sourceFile == file).SingleOrDefault();
            }
            else if (mode == Mode.Artist)
            {
                dat = Data.act.e621ArtistData.Where(temp => temp.sourceFile == file).SingleOrDefault();
            }
            if (dat == null)
            {
                newOp.Add(file);
            }
        }
        dropCreatorImageSource.AddOptions(newOp);
        CreatorDropImageSource(0);
    }
예제 #2
0
    public void DropAddTagArtist(int value)
    {
        dropTagsChar.value = 0;
        dropTagsChar.RefreshShownValue();

        GlobalActions.act.LoadImageCancel();

        textTagsArtistName.gameObject.SetActive(value != 0);
        textTagsArtistStats.gameObject.SetActive(value != 0);
        imageTagsArtist.gameObject.SetActive(value != 0);
        buttonTagsArtistAdd.gameObject.SetActive(value != 0);

        if (dropTagsArtist.value == 0)
        {
            return;
        }

        E621CharacterData chara = e621ArtistData[value - 1];

        GlobalActions.act.LoadImage(sprLoading, sprError, imageTagsArtist, PlayerPrefs.GetString("E621_ArtistPortraits") + @"\" + chara.portraitFile + ".png");
        textTagsArtistName.text = "Showing: " + chara.name;

        int   appeared = imageData.Count(t => t.tags.Contains(chara.tag.Replace("é", @"\u00e9")) && !t.filtered);
        int   filtered = imageData.Count(t => t.tags.Contains(chara.tag.Replace("é", @"\u00e9")) && t.filtered);
        float div      = filtered == 0 ? 1 : filtered;

        textTagsArtistStats.text = "Art: " + appeared + ". Filtered: " + filtered + ".\nGood Image Ratio: " + ((Mathf.Round(((float)appeared / div) * 1000f) / 1000f));
    }
예제 #3
0
    public void CreatorNew()
    {
        newCharData  = new E621CharacterData();
        loadedDataID = -1;

        CreatorDropImageSourceReset();
        CreatorResetPortraitToDefault();

        dropCreatorImageSource.interactable   = true;
        inputCreatorSourceFile.interactable   = false;
        inputCreatorPortraitFile.interactable = true;

        editing = false;
    }
    //Editor
    public void OpenInEditor(E621CharacterData data, int id, Sprite sprImage)
    {
        print("oof");
        loadedData = data;
        ClearGridChilds();

        /*
         * textCharName.text = loadedData.tagName;
         * for(int i = 0; i < toggles.Length; i++)
         * {
         *  toggles[i].isOn = loadedData.booleans[i];
         * }
         * dropAnimated.value = loadedData.animated;
         * dropAnimated.RefreshShownValue();
         * dropFetish.value = loadedData.fetish;
         * dropFetish.RefreshShownValue();
         * dropQuality.value = loadedData.quality;
         * dropQuality.RefreshShownValue();
         * //LoadImage(imgLoading, imgError, imageThumbSmall, loadedData.urlSmall);
         * imageThumbSmall.sprite = sprImage;
         * print("Files: " + showFiles.Count + "\nUnedited: " + showFilesUnedited.Count);
         * if (loadedData.urlBig == "" && (showFiles.Count == showFilesUnedited.Count))
         * {
         *  loadedData.urlBig = showFilesUnedited[id];
         *  print(loadedData.urlBig);
         * }
         * else if(loadedData.urlBig == "")
         * {
         *  CreateAdvice("WARNING!", "Character images in the directory DO NOT match the Unedited character images, you should check that, else you're not getting a big preview.", 1);
         * }
         * //print(loadedData.urlBig);
         * LoadImage(imgLoading, imgError, imageThumbBig, loadedData.urlBig);
         *
         * int imageTotal = 0;
         * int female = 0;
         *
         * foreach (ImageData a in Data.act.imageData)
         * {
         *  if (a.tags.Contains(Path.GetFileNameWithoutExtension(showFiles[id])))
         *  {
         *      imageTotal++;
         *  }
         * }
         * //string.Format(extraInfo, imageTotal);
         * textExtraInfo.text = "Images:\n" + imageTotal;
         * objViewer.SetActive(false);
         * objEditor.SetActive(true);
         */
    }
예제 #5
0
    public void CreatorExistent(E621CharacterData data)
    {
        objMainUI.SetActive(false);
        objCreatorEditor.SetActive(true);

        newCharData = data;
        if (mode == Mode.Character)
        {
            loadedDataID = Data.act.e621CharacterData.IndexOf(data);
        }
        else if (mode == Mode.Artist)
        {
            loadedDataID = Data.act.e621ArtistData.IndexOf(data);
        }

        if (loadedDataID == -1)
        {
            CreateAdvice("Error getting the char ID, ABORT!");
        }

        dropCreatorImageSource.ClearOptions();
        CreatorResetPortraitToDefault();
        inputCreatorTag.text           = data.tag;
        inputCreatorName.text          = data.name;
        inputCreatorSourceFile.text    = data.sourceFile;
        inputCreatorPortraitFile.text  = data.portraitFile;
        inputCreatorTagHighlights.text = data.tagHighlights;
        inputCreatorSpecial.text       = data.special;
        string url = inputSources.text + @"\" + data.sourceFile;

        LoadImage(imgLoading, imgError, imageCreatorPortrait, url);

        dropCreatorImageSource.interactable   = false;
        inputCreatorSourceFile.interactable   = false;
        inputCreatorPortraitFile.interactable = false;

        editing = true;
    }
예제 #6
0
    void CheckExistanceThread()
    {
        try
        {
            data = Data.act.imageData.Where(temp => temp.filename.ToLower().Substring(0, temp.filename.IndexOf(".")) == id + "-" + md5).SingleOrDefault();
            string sUrl = "null";
            UnityThread.executeInUpdate(() =>
            {
                sUrl = !(tags.Contains("intersex") || tags.Contains("dickgirl") || tags.Contains("herm")) ? E621_Navigation.act.inputStraightGal.text : E621_Navigation.act.inputDickgirlGal.text;
                if (tags.Contains("animated"))
                {
                    if (sUrl == E621_Navigation.act.inputStraightGal.text)
                    {
                        sUrl = E621_Navigation.act.inputStraightVid.text;
                    }
                    else
                    {
                        sUrl = E621_Navigation.act.inputDickgirlVid.text;
                    }
                }
            });
            while (sUrl == "null")
            {
            }

            string md5_format = urlDownload.Substring(urlDownload.LastIndexOf("/") + 1, urlDownload.Length - (urlDownload.LastIndexOf("/") + 1));


            //bool exist = File.Exists(sUrl + "/" + id + "-" + md5_format) || File.Exists(sUrl + "/" + md5_format) || File.Exists(sUrl + "/" + md5_format.ToUpper());
            bool     exist        = false;
            string[] possibleUrls = new string[] { sUrl + "/" + id + "-" + md5_format, sUrl + "/" + md5_format, sUrl + "/" + md5_format.ToUpper() };

            for (int i = 0; i < possibleUrls.Length; i++)
            {
                if (File.Exists(possibleUrls[i]))
                {
                    fileLocation = possibleUrls[i];
                    exist        = true;
                    break;
                }
            }

            if (data == null)
            {
                data = Data.act.imageData.Where(temp => temp.filename.ToLower().Substring(0, temp.filename.IndexOf(".")) == md5).SingleOrDefault();
            }
            //print(md5);

            //Get the tags in it

            string charTags     = "";
            string artistTags   = "";
            string specificTags = "";

            foreach (string s in tags)
            {
                E621CharacterData temp1 = Data.act.e621CharacterData.Where(temp => temp.tag.Replace("é", @"\u00e9") == s).FirstOrDefault();
                if (temp1 != null)
                {
                    charTags += charTags == "" ? s : " " + s;
                }

                temp1 = Data.act.e621ArtistData.Where(temp => temp.tag == s).FirstOrDefault();
                if (temp1 != null)
                {
                    artistTags += artistTags == "" ? s : " " + s;
                }

                string temp2 = Data.act.e621SpecificTags.Where(temp => temp == s).FirstOrDefault();
                if (temp2 != null)
                {
                    specificTags += specificTags == "" ? s : " " + s;
                }
            }

            string finalTags = "";
            if (charTags != "")
            {
                finalTags += "Characters:\n" + charTags;
            }
            if (artistTags != "")
            {
                finalTags += finalTags == "" ? "Artists:\n" + artistTags : "\nArists:\n" + artistTags;
            }
            //if (specificTags != "") finalTags += finalTags == "" ? "Specific Tags:\n" + specificTags : "\nSpecific Tags:\n" + specificTags;



            UnityThread.executeInUpdate(() =>
            {
                try
                {
                    if (finalTags != "")
                    {
                        buttonSpTags.gameObject.SetActive(true);
                        textSpTags.text = finalTags;
                    }

                    buttonKeep.interactable   = data == null || data.filtered;
                    buttonFilter.interactable = data == null || !data.filtered;
                    print(data);

                    imageExistance.color = exist ? colorOnDisk : colorNotOnDisk;

                    existanceChecked = true;
                }
                catch
                {
                    print("This error should only happen if the button stopped existing");
                }
            });
        }
        catch
        {
            print("Thread Error: Nav. Button");
            return;
        }
    }
    //Viewer of Character
    public void OpenOnViewer(E621CharacterData data, int id, Sprite sprImage)
    {
        objViewer.SetActive(false);
        loadedData = data;
        imageViewerPortrait.sprite = sprImage;
        ClearGridChilds();

        /*
         * textViewerName.text = loadedData.tagName;
         * const string dataFormat = "Categories:\n{0}\n\nFavorite:\n{1}\n\nAnimated Appearances:\n{2}\n\nFetish Worth:\n{3}\n\nGood & Constant Quality:\n{4}";
         * string categories = "";
         *
         *
         * if (data.booleans[1]) categories += "Anthro, ";
         * if (data.booleans[2]) categories += "Mid-Beast, ";
         * if (data.booleans[3]) categories += "Angel, ";
         * if (data.booleans[4]) categories += "Demon, ";
         * if (data.booleans[5]) categories += "Marine, ";
         * if (data.booleans[7]) categories += "Dragon, ";
         * if (data.booleans[8]) categories += "Robot, ";
         * if (data.booleans[9]) categories += "Human, ";
         * if (data.booleans[10]) categories += "Egyptian, ";
         * if (data.booleans[11]) categories += "Other, ";
         * if (categories != "")
         *  categories = categories.Substring(0, categories.Length - 2) + ".";
         * else
         *  categories = "Not Specified";
         * if (!data.booleans[0] && !data.booleans[6])
         *  imageViewerSex.color = colorBlack;
         * else if (data.booleans[0] && !data.booleans[6])
         *  imageViewerSex.color = colorGreen;
         * else if (!data.booleans[0] && data.booleans[6])
         *  imageViewerSex.color = colorRed;
         * else
         *  imageViewerSex.color = colorOrange;
         *
         * string animated = "";
         * string fetish = "";
         * string quality = "";
         * for (int i = 0; i < 4; i++)
         * {
         *  int theInt = 0;
         *  if (i == 0) theInt = data.animated;
         *  if (i == 1) theInt = data.fetish;
         *  if (i == 3) theInt = data.quality;
         *  string say = "";
         *  switch (theInt)
         *  {
         *      case 0:
         *          say = "Doesn't Apply";
         *          break;
         *      case 1:
         *          say = "A bit of it";
         *          break;
         *      case 2:
         *          say = "A 50/50, maybe";
         *          break;
         *      case 3:
         *          say = "Worth it";
         *          break;
         *      case 4:
         *          say = "ABSOLUTELY";
         *          break;
         *  }
         *  if (i == 0) animated = say;
         *  if (i == 1) fetish = say;
         *  if (i == 3) quality = say;
         * }
         *
         * textViewerData.text = string.Format(dataFormat, categories, data.booleans[12] ? "Yes." : "No.", animated, fetish, quality);
         */
        int imageTotal = 0;
        int imageStraigth = 0, imageDickgirl = 0;
        int filteredTimes = 0;

        urlsCharacterSaved.Clear();
        foreach (ImageData a in Data.act.imageData)
        {
            if (a.tags.Contains(Path.GetFileNameWithoutExtension(showFiles[id])))
            {
                urlsCharacterSaved.Add(a.filename);
                if (!a.filtered)
                {
                    imageTotal++;

                    if (a.tags.Contains("dickgirl") || a.tags.Contains("intersex") || a.tags.Contains("herm"))
                    {
                        imageDickgirl++;
                    }
                    else
                    {
                        imageStraigth++;
                    }
                }
                else
                {
                    filteredTimes++;
                }
            }
        }

        currentChar = Path.GetFileNameWithoutExtension(showFiles[id]) + " (" + imageTotal + ")";

        textViewerAppearances.text = "Appeared '" + imageTotal + "' times.\n" + imageStraigth + " - Straight\n" + imageDickgirl + " - Dickgirl\nFiltered: '" + filteredTimes + "' times.";
        objViewerChars.SetActive(true);
    }