Exemplo n.º 1
0
        public IEnumerator SendReportRoutine(TrelloCard card, List <Texture2D> screenshots)
        {
            // Shows the "in progress" text
            inProgressUI.SetActive(true);

            // We upload the card with an async custom coroutine that will return the card ID
            // Once it has been uploaded.
            CustomCoroutine cC = new CustomCoroutine(this, trello.UploadCardRoutine(card));

            yield return(cC.coroutine);

            // The uploaded card ID
            string cardID = (string)cC.result;

            int i = 0;

            foreach (Texture2D screenshot in screenshots)
            {
                i++;
                // We can now attach the screenshot to the card given its ID.
                yield return(trello.SetUpAttachmentInCardRoutine(cardID, "ScreenShot" + i + ".png", screenshot));
            }

#if UNITY_STANDALONE
            // We make sure the log exists before trying to retrieve it.
            if (System.IO.File.Exists(logPath))
            {
                // We make a copy of the log since the original is being used by Unity.
                System.IO.File.Copy(logPath, logPathCopy, true);

                // We attach the Unity log file to the card.
                yield return(trello.SetUpAttachmentInCardFromFileRoutine(cardID, "output_log.txt", logPathCopy));
            }
#endif
            // this one is meant to be replaced with relevant data about your game
            string relevantData = GetSettings() + GetSystemInfo();
            yield return(trello.SetUpAttachmentInCardRoutine(cardID, "SystemInfo.txt", relevantData));

            /**
             *
             *   Attach more convenient data to the card here
             *
             **/

            // Wait for one extra second to let the player read that his isssue is being processed
            yield return(new WaitForSeconds(1));

            // Since we are done we can deactivate the in progress canvas
            inProgressUI.SetActive(false);

            // Now we show the success text to let the user know the action has been completed
            StartCoroutine(SetActiveForSecondsRoutine(successUI, 2));
        }