コード例 #1
0
ファイル: TexturePainter.cs プロジェクト: bransel/KoiPond2
    ////////////////// OPTIONAL METHODS //////////////////

    public void SaveTextureAndMessage(InputField inputField)
    {
        if (string.IsNullOrEmpty(inputField.text))
        {
            ShowEmptyMessagePanel();
        }
        else if (profanityClass.IsContentProfane(inputField.text))
        {
            ShowProfanityPanel(profanityClass.GetProfanity(inputField.text));
        }
        else if (uploadInProgress)
        {
            Debug.LogError("Upload is already in progress!");
        }
        else
        {
            uploadInProgress = true;
            UploadMessage.SetActive(true);

            string guid         = System.Guid.NewGuid().ToString();
            byte[] textureBytes = SaveTexture().EncodeToPNG();

            SceneController sceneController = FindObjectOfType <SceneController>();

            UnityEvent sceneLoadEvent = new UnityEvent();
            sceneLoadEvent.AddListener(sceneController.LoadNextScene);

            UnityEvent uploadFailEvent = new UnityEvent();
            uploadFailEvent.AddListener(DisableUploadMessage);

            tweetClient.TweetMessageAndImage(inputField.text, textureBytes, sceneLoadEvent, uploadFailEvent);
        }
    }
コード例 #2
0
    void ProcessUserTweets(List <Tweet> tweets)
    {
        foreach (var tweet in tweets)
        {
            if (!fishDataList.Select(i => i.id).Contains(tweet.id))
            {
                TwitterFishData fishData = new TwitterFishData();
                fishData.id = tweet.id;

                fishData.texture = mentionsTextures[UnityEngine.Random.Range(0, mentionsTextures.Length)];

                string[] created_at_separated = tweet.created_at.Split(' ');
                fishData.message  = string.Format("@{0} • {1} {2}\r\n\r\n", tweet.user.screen_name, created_at_separated[1], created_at_separated[2]);
                fishData.message += tweet.full_text;
                fishData.message  = WebUtility.HtmlDecode(fishData.message);

                if (profanityClass.IsContentProfane(fishData.message))
                {
                    print("RUDE! This fish wanted to say: " + string.Join(", ", profanityClass.GetProfanity(fishData.message)));
                    print("Original Message: " + fishData.message);
                }
                else if (!blacklist.Contains(tweet.user.screen_name) && tweet.retweeted_status == null)
                {
                    fishDataList.Add(fishData);
                }
            }
        }
    }