예제 #1
0
    public void SendPhoto()
    {
        //AddPost
        AllTakenPhotos.Add(PicInSavePage.sprite);
        countTakenPhotos++;
        AddInsPost("Karara", PicInSavePage.sprite);
        AddFollower();
        AdsController.UseAdAndPose();


        FinalCameraController.ChangeToApp();
    }
예제 #2
0
    private void addToKararaPage()
    {
        //RECORD THE POSTURE
//        if (usedPostures.ContainsKey(CalculateInventory.posNum.ToString()))
//        {
//            FinalCameraController.Show(Notice);
//            return;
//        }
//        else
//        {
//            usedPostures.Add(CalculateInventory.posNum.ToString(), true);
//
//        }
//
//        if (usedBackground.ContainsKey(InstagramController.currentBackground))
//        {
//            FinalCameraController.Show(Notice);
//            return;
//        }
//        else
//        {
//            usedBackground.Add(InstagramController.currentBackground, true);
//
//        }

        if (!FinalCameraController.isTutorial)
        {
            usedPostures.Add(CalculateInventory.posNum.ToString(), true);
        }

        //usedBackground.Add(InstagramController.currentBackground, true);

        //instantiate new post object
        var newPost = Instantiate(InstagramController.photoPostPrefab, new Vector3(0, 0, 0), Quaternion.identity);

        //set parent(probably a better way to do
        newPost.transform.parent     = InstagramController.filmParent.transform;
        newPost.transform.localScale = Vector3.one;

        Texture2D sprites = CropImage();

        Rect rec = new Rect(0, 0, sprites.width, sprites.height);

        //change sprite to the newly taken photo
        newPost.GetComponent <Image>().sprite = Sprite.Create(sprites, rec, new Vector2(0, 0), 100f);


        if (!FinalCameraController.isTutorial)
        {
            //get the post text
            toothpastePost.transform.Find("Post").gameObject.GetComponent <Image>().sprite =
                Sprite.Create(sprites, rec, new Vector2(0, 0), 100f);
            var textList = toothpastePost.transform.Find("Post").gameObject.GetComponentsInChildren <Text>();



            //create comments
            var newComment = Instantiate(InstagramController.commentPrefab, new Vector3(0, 0, 0), Quaternion.identity,
                                         toothpastePost.transform.Find("Comments"));
            //set parent(probably a better way to do
//        newComment.transform.parent = toothpastePost.transform.Find("Comments");

            newComment.transform.localPosition = new Vector3(0f, 0f, 0);

            //get the text child
            var CommentText = newComment.GetComponentInChildren <TextMeshProUGUI>();


            print(CommentText.name);
            //get the profile
            var ProfileImage = newComment.GetComponent <Image>();

            InstagramController.replyParent = toothpastePost.transform.Find("Reply");

            //now this background cannot be used again
            InstagramController.AdAlreadyTakenList[InstagramController.currentBackground] = false;

            //generate different comment for each post

            if (InstagramController.currentBackground == "RV")
            {
                //record background
                newPost.GetComponent <RecordBackgroundPosture>().backgroundName = 0;


                //todo: comments need to occur after sometime
                CommentText.text    = "That RV looks amazing. I'm gonna get one for myself.";
                ProfileImage.sprite = InstagramController.allProfile["nico"];

                //change the post text
                newPost.GetComponent <EntryTime>().postText = "<b>Karara</b> Vocation";
                textList[0].text = "<b>Karara</b> Vocation";
                textList[1].text = "Today";

                //Add followers to Karara
//            if (KararaTop == "TopA1")
//            {
//                followerNum += 8;
//                print("asdfasdf;lkj;lkjasdf");
//            }
//            else
//            {
//                followerNum += 3;}
//
//
//            if (KararaBottom == "BottomA1")
//            {
//                followerNum += 6;
//            }else
//            {
//                followerNum += 3;}
//
                if (KararaWork)
                {
                    followerNum += 3;
                }
                else
                {
                    followerNum += 8;
                }
            }
//        else if (InstagramController.currentBackground == "Toothpaste")
//        {
//            CommentText.text = "I like the way you dress.";
//            ProfileImage.sprite = InstagramController.allProfile["ojisan"];
//
//        }
            else if (InstagramController.currentBackground == "FruitStand")
            {
                //record background
                newPost.GetComponent <RecordBackgroundPosture>().backgroundName = 1;

                CommentText.text    = "Flavor of life";
                ProfileImage.sprite = InstagramController.allProfile["ojisan"];

                //change the post text
                newPost.GetComponent <EntryTime>().postText = "<b>Karara</b> Fresh";
                textList[0].text = "<b>Karara</b> Fresh";
                textList[1].text = "Today";

                if (KararaWork)
                {
                    followerNum += 3;
                }
                else
                {
                    followerNum += 8;
                }
            }
            else if (InstagramController.currentBackground == "Park")
            {
                //record background
                newPost.GetComponent <RecordBackgroundPosture>().backgroundName = 2;

                CommentText.text    = "Amusement parks are boring.";
                ProfileImage.sprite = InstagramController.allProfile["nico"];

                //change the post text
                newPost.GetComponent <EntryTime>().postText = "<b>Karara</b> Relaxing";

                textList[0].text = "<b>Karara</b> Relaxing";
                textList[1].text = "Today";

                if (KararaWork)
                {
                    followerNum += 3;
                }
                else
                {
                    followerNum += 8;
                }
            }
            else if (InstagramController.currentBackground == "Alcohol")
            {
                //record background
                newPost.GetComponent <RecordBackgroundPosture>().backgroundName = 3;

//            CommentText.text = "Amusement parks are boring.";
//            ProfileImage.sprite = InstagramController.allProfile["nico"];

                //change the post text
                newPost.GetComponent <EntryTime>().postText = "<b>Karara</b> Cheers";

                textList[0].text = "<b>Karara</b> Cheers";
                textList[1].text = "Today";

                if (KararaWork)
                {
                    followerNum += 3;
                }
                else
                {
                    followerNum += 8;
                }
            }
        }
        FinalCameraController.ChangeToApp();
    }