Ejemplo n.º 1
0
    IEnumerator ExampleCoroutine()
    {
        //Print the time of when the function is first called.
        Debug.Log("Started Coroutine at timestamp : " + Time.time);

        yield return(new WaitForSeconds(0.5f));

        //in tutorial
        if (FinalCameraController.isTutorial)
        {
            flash = true;

            myFlash.alpha = 1;

            //yield on a new YieldInstruction that waits for 5 seconds.
            yield return(new WaitForSeconds(0.1f));

            addToKararaPage();
        }
        else if (!usedPostures.ContainsKey(CalculateInventory.posNum.ToString()))//if the posture is never used
        {
            flash = true;

            myFlash.alpha = 1;

            //yield on a new YieldInstruction that waits for 5 seconds.
            yield return(new WaitForSeconds(0.1f));

            addToKararaPage();



            //After we have waited 5 seconds print the time again.
            Debug.Log("Finished Coroutine at timestamp : " + Time.time);
        }
        else //if the posture has already been used
        {
            // myFlash.alpha = 1;

            FinalCameraController.Show(Notice);

            if (usedPostures.ContainsKey(CalculateInventory.posNum.ToString()))
            {
                Notice.gameObject.GetComponentInChildren <TextMeshProUGUI>().text = "no same posture!";
                isTaken = false;
            }
        }
    }
Ejemplo n.º 2
0
    public void clickBackground()
    {
        InstagramController.currentBackground = gameObject.name;
        //reset everything to the first posture being able to use in this background
        if (FinalCameraController.alreadyClothUI == false)
        {
            if (FinalCameraController.isSwipping == false && !FinalCameraController.isTutorial)
            {
                InstagramController.CalculateInventory.resetPosture();

                FinalCameraController.CancelAllUI(false);
                photoBackground.sprite = InstagramController.allBackAd[transform.name];
                InstagramController.currentBackground = transform.name;

                FinalCameraController.GoAdvertisement();
            }
            else if (FinalCameraController.isSwipping == false && FinalCameraController.isTutorial)
            {
//              if (InstagramController.AdAlreadyTakenList[transform.name])
//              {
                if (FinalCameraController.TutorialManager.tutorialNumber == 0)
                {
                    //cancel dialogues and the touch tutorial
                    //TutorialManager.tutorialDialogueState = TutorialManager.DialogueState.none;

                    FinalCameraController.Show(TutorialManager.hintArrowCG);
                    TutorialManager.hintArrow.transform.SetParent(TutorialManager.screenshot.transform);
                    TutorialManager.hintArrow.GetComponent <RectTransform>().anchoredPosition = new Vector2(-0.5f, 0f);

                    photoBackground.sprite = InstagramController.allBackAd[transform.name];
                    InstagramController.currentBackground = transform.name;

                    FinalCameraController.GoAdvertisement();
                }
                else if (FinalCameraController.TutorialManager.tutorialNumber == 2 || FinalCameraController.TutorialManager.tutorialNumber == 3)
                {
                    TutorialManager.fishText.text = "Don't touch it! Come over here!";
                    TutorialManager.KararaStandingImage.enabled = true;
                }
                else if (FinalCameraController.TutorialManager.tutorialNumber == 15)
                {
                    print("transform name = " + transform.name);
                    photoBackground.sprite = InstagramController.allBackAd[transform.name];

                    InstagramController.currentBackground = transform.name;

                    FinalCameraController.GoAdvertisement();
                }

//              }
            }
        }
        else
        {
            Destroy(FinalCameraController.generatedNotice);
            Destroy(FinalCameraController.currentClothUI);
            FinalCameraController.alreadyClothUI = false;
        }
    }
Ejemplo n.º 3
0
    public void ChangeToPersonalPage()
    {
        if (FinalCameraController.isTutorial && FinalCameraController.TutorialManager.tutorialNumber == 17)
        {
            FinalCameraController.TutorialManager.tutorialDialogueState = TutorialManager.DialogueState.none;
            FinalCameraController.Show(FinalCameraController.TutorialManager.finalComic);
        }

        else
        {
            FinalCameraController.lastAppState = FinalCameraController.myAppState;

            Hide(FinalCameraController.frontPage);
            FinalCameraController.HideAllPersonalPages();

            if (username.text == "Karara")
            {
                Camera.main.transform.position =
                    new Vector3(45, Camera.main.transform.position.y, Camera.main.transform.position.z);

                FinalCameraController.myAppState = FinalCameraController.AppState.KararaPage;
                Show(FinalCameraController.KararaPage);
            }
            else if (username.text == "Nico")
            {
                Camera.main.transform.position =
                    new Vector3(55, Camera.main.transform.position.y, Camera.main.transform.position.z);
                FinalCameraController.myAppState = FinalCameraController.AppState.RetroPage;
                Show(FinalCameraController.RetroPage);
            }
            else if (username.text == "Alex")
            {
                Camera.main.transform.position =
                    new Vector3(55, Camera.main.transform.position.y, Camera.main.transform.position.z);
                FinalCameraController.myAppState = FinalCameraController.AppState.DesignerPage;
                Show(FinalCameraController.DesignerPage);
            }
        }
    }
Ejemplo n.º 4
0
    public void AddClothToInventory()
    {
        if (FinalCameraController.isSwipping == false)
        {
            WasherController = GetComponentInParent <WasherController>();

            if (CalculateInventory.occupiedI < 6)
            {
                //print("pressed");
                //get the machine this cloth belongs to
                //if all clothes in the machine are taken, close door
                WasherController.clothNum--; //洗衣机里的衣服少一

                //如果洗衣机里没衣服了,那么直接关上
                if (WasherController.clothNum == 0)
                {
                    print("should close machine door");
                    StartCoroutine(WasherController.MachineFold());
                    WasherController.DoorImage.sprite = WasherController.AllMachines.closedDoor;
                }



                selfButton    = GetComponent <Button>();
                currentSprite = selfButton.image.sprite;
                print("currentSpriteName = " + currentSprite.name);

                Sprite buttonSprite = currentSprite;
                print("SpriteName = " + currentSprite.name);

                print("occupiedI = " + CalculateInventory.occupiedI);

                int firstEmptyInventory = new int();
                //这里应该找到第一个空着的inventory位置
                for (int i = 0; i < CalculateInventory.inventory.Count; i++)
                {
                    if (CalculateInventory.inventory[i].CompareTag("Untagged"))
                    {
                        firstEmptyInventory = i;
                        break;
                    }
                }

                //inventory used to be buttons
                CalculateInventory.inventory[firstEmptyInventory].GetComponent <Image>().sprite = buttonSprite;
                CalculateInventory.inventory[firstEmptyInventory].tag = this.tag;
                CalculateInventory.occupiedI++;



                //for tutorial
                if (FinalCameraController.isTutorial) //打开了洗衣机的门,真的拿了衣服
                {
                    if (FinalCameraController.TutorialManager.tutorialNumber == 9 ||
                        FinalCameraController.TutorialManager.tutorialNumber == 11) //拿了第二件衣服
                    {
                        FinalCameraController.TutorialManager.tutorialNumber = 12;
                        //in tutorial, if click a cloth, cloth the entire ui interface
                        WasherController.clickMachine();
                        StartCoroutine(FinalCameraController.TutorialManager.AnimateText(
                                           FinalCameraController.TutorialManager.kararaText, "put on",
                                           true, FinalCameraController.TutorialManager.closet, new Vector2(-81, 37)));
                        FinalCameraController.TutorialManager.tutorialDialogueState =
                            TutorialManager.DialogueState.karara;
//                        FinalCameraController.clickKarara();
                        FinalCameraController.Hide(FinalCameraController.TutorialManager.arrowButton);
                    }
                }

                //image disappear
                selfButton.image.enabled = false;
                //selfButton.enabled = false;
            }

            else if (CalculateInventory.occupiedI > 5 && CalculateInventory.fulltemp == false)
            {
                FinalCameraController.Hide(WasherController.ClothUI);
                FinalCameraController.Show(CalculateInventory.InventoryFull);
                CalculateInventory.fulltemp = true;

                //close all machine doors
                WasherController.DoorImage.sprite = WasherController.AllMachines.closedDoor;
                StartCoroutine(WasherController.MachineFold());
            }
        }
    }
Ejemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        //enable new posters for chapter one
        //when player is not in subway4
        if (!FinalCameraController.isTutorial)
        {
            if (FinalCameraController.mySubwayState != FinalCameraController.SubwayState.Four)
            {
//            print("AdAlreadyTakenList FruitStand" + AdAlreadyTakenList["FruitStand"]);
//            print("AdAlreadyTakenList FruitStand" + AdAlreadyTakenList["RV"]);

                if (!AdAlreadyTakenList["FruitStand"] && SubwayMovement.alreadyStation1)
                {
                    thirdAd.SetActive(true);
                }

                if (!AdAlreadyTakenList["RV"] && SubwayMovement.alreadyStation2)
                {
                    fourthAd.SetActive(true);
                }
            }


            //第一次到第一站,产生一个新的post, nico
            if (FinalCameraController.myCameraState == FinalCameraController.CameraState.App)
            {
                //啥都不发生
            }
            else if (SubwayMovement.alreadyStation1 && newStationNum == 0)
            {
                print("arriving first station, nico");

                StartCoroutine(CreatePersonalPagePost("nico", nicoLaterPost[0],
                                                      "I feel like the icecream"));

                newStationNum = 1;
            }

            //第一次到第二站,产生一个新的post, nami
            else if (SubwayMovement.alreadyStation2 && newStationNum == 1)
            {
                print("arriving 2 station, nami");

                StartCoroutine(CreatePersonalPagePost("ojisan", ojisanLaterPost[0],
                                                      "Homemade salad"));

                newStationNum = 2;
            }
            //第一次到第二站,产生一个新的post, nico
            else if (SubwayMovement.alreadyStation0 && newStationNum == 2)
            {
                print("arriving 3 station, nico");

                StartCoroutine(CreatePersonalPagePost("nico", nicoLaterPost[2],
                                                      "Crazy is my daily routine"));


                newStationNum = 3;
            }


//
//        //to decide how many posters have been used
//        for (int i = 0; i < backAdList.Count; i++)
//        {
//            if (AdAlreadyTakenList[backAdList[i].name])
//            {
//                takenNum++;
//            }
//
//        }
            //第一次到第一站,产生一个新的post, nico
            if (FinalCameraController.myCameraState == FinalCameraController.CameraState.App)
            {
                //啥都不发生
            }
            //在两个海报前面照过相
            else if (takenNum == 1 && newPostNum == 0)
            {
                print("1 poster used, nami");
                StartCoroutine(CreatePersonalPagePost("ojisan", ojisanLaterPost[1],
                                                      "Stay healthy"));

                newPostNum = 1;
            }

            else if (takenNum == 2 && newPostNum == 1)
            {
                if (FinalCameraController.myCameraState != FinalCameraController.CameraState.App)
                {
                    print("2 poster used, nico");

                    StartCoroutine(CreatePersonalPagePost("nico", nicoLaterPost[1],
                                                          "Night in the wood"));


                    newPostNum = 2;
                }
            }

            //todo:if all posters have been used
            //if all posters have been used
            //end for chapter 1
            //必须当玩家不在app界面中的时候才能产生
            if (!AdAlreadyTakenList.ContainsValue(true))
            {
                //if more than 20 followers, chapter 1 succeeds
                if (newPostNum == 2 && newStationNum == 3 &&
                    !FinalCameraController.chapterOneSucceed && !FinalCameraController.chapterOneFail)
                {
                    endStationPre = SubwayMovement.currentStation;

                    if (FinalCameraController.myCameraState != FinalCameraController.CameraState.App)
                    {
                        if (System.Convert.ToInt32(followerNum.text) >= 30)
                        {
                            //下一章ojisan要搬家了,所以这个是最后一张post
                            StartCoroutine(CreatePersonalPagePost("ojisan", ojisanLaterPost[2],
                                                                  "embrace yourself"));

                            newPostNum    = 3;
                            fishText.text = "What are you doing? Turn off your phone during work!";
                            FinalCameraController.chapterOneSucceed = true;
                        }
                        else//如果没到30fo,失败了
                        {
                            //什么时机出现这个漫画?
                            //到最近的一站之后,转到鱼的界面

                            FinalCameraController.chapterOneFail = true;
                        }
                    }
                }
            }

            if (FinalCameraController.chapterOneSucceed)
            {
                if (FinalCameraController.mySubwayState == FinalCameraController.SubwayState.Two)
                {
                    FinalCameraController.Show(FinalCameraController.messageCG);
                }
                else if (FinalCameraController.mySubwayState == FinalCameraController.SubwayState.One)
                {
                    FinalCameraController.Show(FishBoss);
                }

                FinalCameraController.ChapterOneEnd = true;

                //到达最近的一站之后,就停下来,车再也不动了
                if (!SubwayMovement.isMoving && SubwayMovement.currentStation == endStationPre &&
                    FinalCameraController.myCameraState == FinalCameraController.CameraState.Subway)
                {
                    SubwayMovement.isMoving             = false;
                    FinalCameraController.ChapterOneEnd = true;
                }
            }
            else if (FinalCameraController.chapterOneFail)
            {
                //到达最近的一站之后,就停下来,车再也不动了
                if (!SubwayMovement.isMoving && SubwayMovement.currentStation == endStationPre &&
                    FinalCameraController.myCameraState == FinalCameraController.CameraState.Subway)
                {
                    SubwayMovement.isMoving = false;


                    FinalCameraController.ChapterOneEnd = true;
                }
            }
        }
    }
Ejemplo n.º 6
0
    // Update is called once per frame
    void Update()
    {
//        print("cancelCloth = " + doubleTouch);
        for (var i = 0; i < Input.touchCount; ++i)
        {
            if (Input.GetTouch(i).phase == TouchPhase.Began)
            {
                if (Input.GetTouch(i).tapCount == 2)
                {
                    Debug.Log("Double Tap");
                    doubleTouch = true;
                }
            }
            else if (Input.GetTouch(i).phase == TouchPhase.Ended)
            {
                doubleTouch = false;
            }
        }


        if (Input.touchCount == 1)               // user is touching the screen with a single touch
        {
            touch = Input.GetTouch(0);           // get the touch
            if (touch.phase == TouchPhase.Began) //check for the first touch
            {
                fp = touch.position;
                lp = touch.position;

                startTime = Time.time;

                offsetX = camTransform.position.x - lp.x;

                myInputState = InputState.None;

                //for swipe screen
                isSwipable = true;
            }
            else if (touch.phase == TouchPhase.Moved) // update the last position based on where they moved
            {
                lp = touch.position;
//                print("lp = " + lp);

                if (Mathf.Abs(lp.y - fp.y) > dragDistance / 4 || Mathf.Abs(lp.x - fp.x) > dragDistance / 4)
                {
                    isSwiping = true;

                    //disable dialogue bubble if swiped
                    //important: don't disable if it shouldn't be disabled
                    //for example, in the middle of someone talking
                    if (FinalCameraController.isTutorial && !FinalCameraController.TutorialManager.stopDisappear &&
                        FinalCameraController.TutorialManager.tutorialNumber != 3 &&
                        FinalCameraController.TutorialManager.tutorialNumber != 0 &&
                        FinalCameraController.TutorialManager.tutorialNumber < 15)
                    {
                        FinalCameraController.Hide(FinalCameraController.TutorialManager.GestureCG);
                        FinalCameraController.TutorialManager.screamImage.enabled   = false;
                        FinalCameraController.TutorialManager.tutorialDialogueState =
                            TutorialManager.DialogueState.none;
                        print("disappear in the middle");
                    }
                }
                else
                {
                    isSwiping = false;
                }

                if (Mathf.Abs(lp.x - fp.x) > dragDistance || Mathf.Abs(lp.y - fp.y) > dragDistance)
                {
                }
                else
                {
                    //it is a long tap
                    if (Time.time - startTime > 0.8f)
                    {
                        isLongTap = true;
                    }
                    else
                    {
                        isLongTap = false;
                    }
                }
            }
            else if (touch.phase == TouchPhase.Ended) //check if the finger is removed from the screen
            {
//                if(FinalCameraController.isTutorial && FinalCameraController.myCameraState == FinalCameraController.CameraState.Subway)
//                {
//                    if(FinalCameraController.TutorialManager.tutorialNumber != 6 && FinalCameraController.TutorialManager.tutorialNumber != 7)
//                    {
//                        FinalCameraController.TutorialManager.tutorialDialogueState =
//                            TutorialManager.DialogueState.fish;
//                    }
//                }

                if (FinalCameraController.isTutorial && FinalCameraController.mySubwayState != FinalCameraController.SubwayState.One &&
                    FinalCameraController.TutorialManager.tutorialNumber == 1)
                {
                    FinalCameraController.Show(FinalCameraController.TutorialManager.GestureCG);
                    FinalCameraController.TutorialManager.screamImage.enabled = true;
                    FinalCameraController.TutorialManager.DoFishDialogue(true);
                }


                lp = touch.position;  //last touch position. Ommitted if you use list

                offsetX   = 0;
                isSwiping = false;

                //check if this is a fast swipe
                diffTime      = startTime - Time.time;
                swipeDistance = Vector2.Distance(fp, lp);
                swipeSpeed    = Mathf.Abs(swipeDistance / diffTime);//<<<<<<<<
//                print("diffTime =" + diffTime);
//                print("swipeSpeed =" + swipeSpeed);
                if (swipeSpeed > 500 && Mathf.Abs(diffTime) < 0.2f)
                {
                    isFastSwipe = true;
                }
                else
                {
                    isFastSwipe = false;
                }

                //Check if drag distance is greater than 20% of the screen height
                if (Mathf.Abs(lp.x - fp.x) > dragDistance || Mathf.Abs(lp.y - fp.y) > dragDistance)
                {//It's a drag
                 //check if the drag is vertical or horizontal
                    if (Mathf.Abs(lp.x - fp.x) > Mathf.Abs(lp.y - fp.y))
                    {                      //If the horizontal movement is greater than the vertical movement...
                        if ((lp.x > fp.x)) //If the movement was to the right)
                        {                  //Right swipe
                            Debug.Log("Right Swipe");
                            leftSwipe    = false;
                            myInputState = InputState.RightSwipe;
                        }
                        else
                        {   //Left swipe
                            Debug.Log("Left Swipe");
                            leftSwipe = true;

                            myInputState = InputState.LeftSwipe;
                        }
                    }
                    else
                    {                    //the vertical movement is greater than the horizontal movement
                        if (lp.y > fp.y) //If the movement was up
                        {                //Up swipe
                            Debug.Log("Up Swipe");
                        }
                        else
                        {   //Down swipe
                            Debug.Log("Down Swipe");
                        }
                    }
                }
                else
                {   //It's a tap as the drag distance is less than 20% of the screen height
                    Debug.Log("Tap");
                    myInputState = InputState.Tap;
                }
            }
        }
    }
Ejemplo n.º 7
0
    public void ChangeCloth()
    {
        if (FinalCameraController.TouchController.doubleTouch == false)
        {
            if (CalculateInventory.isreturning)
            {
                CancelReturn();
                CalculateInventory.isreturning = false;
            }

            //for tutorial
            if (FinalCameraController.isTutorial)
            {
                //show the button to return to subway
                FinalCameraController.Show(FinalCameraController.TutorialManager.closetSubway);

                FinalCameraController.TutorialManager.tutorialNumber = 14;

                CalculateInventory.everythingSR.sprite  = CalculateInventory.discoCloset;
                CalculateInventory.everythingSSR.sprite = CalculateInventory.discoSubway;

                CalculateInventory.shoeASR.sprite    = CalculateInventory.discoAd;
                CalculateInventory.workCloth.enabled = false;

                CalculateInventory.workClothASR.enabled = false;
                CalculateInventory.workClothS.enabled   = false;

                CalculateInventory.blackPants.enabled = false;
                CalculateInventory.whiteShirt.enabled = false;

                CalculateInventory.whiteShirtS.enabled = false;
                CalculateInventory.blackPantsS.enabled = false;

                FinalCameraController.TutorialManager.wearNothing = false;
                return;
            }

            //currentSprite = GetComponenft<SpriteRenderer>().sprite;
            currentSprite = GetComponent <Image>().sprite;


            if (CalculateInventory.allCloth.ContainsKey(currentSprite.name))
            {
                isWearing = !isWearing;
                //checkImage.enabled = true;

                if (isWearing)
                {
                    if (currentSprite.name.Contains("Top"))
                    {
                        if (CalculateInventory.wearingTop)
                        {
                            CalculateInventory.topButton.gameObject.GetComponent <ClothChanging>().isWearing = false;
                        }

                        //buttonChangeBack();
                        CalculateInventory.wearingTop        = true;
                        CalculateInventory.wearingEverything = false;


                        //record the button
                        CalculateInventory.topButton = selfButton;

                        //change inventory clothes
                        CalculateInventory.topSR.sprite = CalculateInventory.allCloth[currentSprite.name];
                        print(currentSprite.name);

                        //change subway clothes
                        CalculateInventory.topSSR.sprite = CalculateInventory.allSubwayCloth[currentSprite.name];



                        CalculateInventory.whiteShirt.enabled = false;
                        CalculateInventory.workCloth.enabled  = false;


                        CalculateInventory.workClothS.enabled  = false;
                        CalculateInventory.whiteShirtS.enabled = false;


                        //change clothes in advertisement
                        print("Given key = " + currentSprite.name);
                        CalculateInventory.topASR.sprite = CalculateInventory.allAdCloth[currentSprite.name];

                        //Take off workcloth
                        CalculateInventory.workClothASR.enabled = false;
                        CalculateInventory.whiteShirtASR.sprite = transparent;
                        //CalculateInventory.blackPantsASR.sprite = CalculateInventory.allAdCloth["BlackPants"];


                        //take off one piece
                        CalculateInventory.everythingSR.sprite  = transparent;
                        CalculateInventory.everythingASR.sprite = transparent;
                        CalculateInventory.everythingSSR.sprite = transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.topSR.gameObject.tag  = this.tag;
                        CalculateInventory.topASR.gameObject.tag = this.tag;
                        CalculateInventory.topSSR.gameObject.tag = this.tag;


                        //player talks
                        if (currentSprite.name.Contains("A1"))
                        {
                            //text.text = "<b>Karara</b>: Do people wear Hawaii shirts in Hawaii?";
                        }
                    }
                    else if (currentSprite.name.Contains("Bottom"))
                    {
                        //buttonChangeBack();

                        if (CalculateInventory.wearingBottom)
                        {
                            CalculateInventory.bottomButton.gameObject.GetComponent <ClothChanging>().isWearing = false;
                        }
                        CalculateInventory.wearingBottom     = true;
                        CalculateInventory.wearingEverything = false;


                        //record the button
                        CalculateInventory.bottomButton = selfButton;


                        CalculateInventory.otherSR.sprite  = CalculateInventory.allCloth[currentSprite.name];
                        CalculateInventory.otherSSR.sprite = CalculateInventory.allSubwayCloth[currentSprite.name];
                        //change clothes in advertisement
                        CalculateInventory.otherASR.sprite = CalculateInventory.allAdCloth[currentSprite.name];
                        //Take off workcloth
                        CalculateInventory.workClothASR.enabled = false;
                        //CalculateInventory.whiteShirtASR.sprite = CalculateInventory.allAdCloth["WhiteShirt"];
                        CalculateInventory.blackPantsASR.sprite = transparent;


                        //take off one piece
                        CalculateInventory.everythingSR.sprite  = transparent;
                        CalculateInventory.everythingASR.sprite = transparent;
                        CalculateInventory.everythingSSR.sprite = transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.otherSR.gameObject.tag  = this.tag;
                        CalculateInventory.otherASR.gameObject.tag = this.tag;
                        CalculateInventory.otherSSR.gameObject.tag = this.tag;
                        print("change bottom");

                        CalculateInventory.workCloth.enabled  = false;
                        CalculateInventory.blackPants.enabled = false;

                        CalculateInventory.workClothS.enabled  = false;
                        CalculateInventory.blackPantsS.enabled = false;
                    }
                    else if (currentSprite.name.Contains("Shoe"))
                    {
                        //buttonChangeBack();
                        if (CalculateInventory.wearingShoe)
                        {
                            CalculateInventory.shoeButton.gameObject.GetComponent <ClothChanging>().isWearing = false;
                        }

                        CalculateInventory.wearingShoe = true;

                        //record the button
                        CalculateInventory.shoeButton = selfButton;


                        CalculateInventory.shoeSR.sprite  = CalculateInventory.allCloth[currentSprite.name];
                        CalculateInventory.shoeSSR.sprite = CalculateInventory.allSubwayCloth[currentSprite.name];
                        //change clothes in advertisement
                        CalculateInventory.shoeASR.sprite = CalculateInventory.allAdCloth[currentSprite.name];

                        print("change shoe");

                        CalculateInventory.workShoeSR.enabled  = false;
                        CalculateInventory.workShoeSSR.enabled = false;
                        CalculateInventory.workShoeASR.sprite  = transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.shoeSR.gameObject.tag  = this.tag;
                        CalculateInventory.shoeASR.gameObject.tag = this.tag;
                        CalculateInventory.shoeSSR.gameObject.tag = this.tag;
                    }
                    else if (currentSprite.name.Contains("Everything"))
                    {
                        //buttonChangeBack();

                        if (CalculateInventory.wearingEverything)
                        {
                            CalculateInventory.everythingButton.gameObject.GetComponent <ClothChanging>().isWearing = false;
                        }
                        CalculateInventory.wearingEverything = true;
                        CalculateInventory.wearingTop        = false;
                        CalculateInventory.wearingBottom     = false;

                        //record the button
                        CalculateInventory.everythingButton = selfButton;


                        CalculateInventory.everythingSR.sprite  = CalculateInventory.allCloth[currentSprite.name];
                        CalculateInventory.everythingSSR.sprite = CalculateInventory.allSubwayCloth[currentSprite.name];
                        //change clothes in advertisement
                        CalculateInventory.everythingASR.sprite = CalculateInventory.allAdCloth[currentSprite.name];
                        //Take off workcloth
                        CalculateInventory.workClothASR.enabled = false;

                        //take off other cloths
                        CalculateInventory.otherSR.sprite = transparent;
                        CalculateInventory.topSR.sprite   = transparent;

                        CalculateInventory.otherASR.sprite = transparent;
                        CalculateInventory.topASR.sprite   = transparent;

                        CalculateInventory.otherSSR.sprite = transparent;
                        CalculateInventory.topSSR.sprite   = transparent;


                        print("change everything");

                        CalculateInventory.workCloth.enabled = false;

                        CalculateInventory.workClothS.enabled = false;

                        CalculateInventory.topSR.sprite   = transparent;
                        CalculateInventory.otherSR.sprite = transparent;

                        CalculateInventory.blackPants.enabled = true;
                        CalculateInventory.whiteShirt.enabled = true;

                        CalculateInventory.whiteShirtS.enabled = true;
                        CalculateInventory.blackPantsS.enabled = true;

                        CalculateInventory.whiteShirtASR.sprite = CalculateInventory.allAdCloth["WhiteShirt"];
                        CalculateInventory.blackPantsASR.sprite = CalculateInventory.allAdCloth["BlackPants"];


                        //change the tag on all clothes on karara
                        CalculateInventory.everythingSR.gameObject.tag  = this.tag;
                        CalculateInventory.everythingASR.gameObject.tag = this.tag;
                        CalculateInventory.everythingSSR.gameObject.tag = this.tag;
                    }
                }
                else
                {
                    if (currentSprite.name.Contains("Top"))
                    {
                        //buttonChangeBack();
                        CalculateInventory.wearingTop = false;

                        //change inventory clothes
                        CalculateInventory.topSR.sprite = CalculateInventory.transparent;

                        //change subway clothes
                        CalculateInventory.topSSR.sprite = CalculateInventory.transparent;


                        CalculateInventory.whiteShirt.enabled = true;

                        CalculateInventory.whiteShirtS.enabled = true;


                        //change clothes in advertisement
                        CalculateInventory.topASR.sprite = CalculateInventory.transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.topSR.gameObject.tag  = "Untagged";
                        CalculateInventory.topASR.gameObject.tag = "Untagged";
                        CalculateInventory.topSSR.gameObject.tag = "Untagged";


                        //player talks
                        if (currentSprite.name.Contains("A1"))
                        {
                            //text.text = "<b>Karara</b>: Do people wear Hawaii shirts in Hawaii?";
                        }
                    }
                    else if (currentSprite.name.Contains("Bottom"))
                    {
                        //buttonChangeBack();
                        CalculateInventory.wearingBottom = false;

                        //change inventory clothes
                        CalculateInventory.otherSR.sprite = CalculateInventory.transparent;

                        //change subway clothes
                        CalculateInventory.otherSSR.sprite = CalculateInventory.transparent;


                        CalculateInventory.blackPants.enabled = true;

                        CalculateInventory.blackPantsS.enabled = true;


                        //change clothes in advertisement
                        CalculateInventory.otherASR.sprite = CalculateInventory.transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.otherSR.gameObject.tag  = "Untagged";
                        CalculateInventory.otherASR.gameObject.tag = "Untagged";
                        CalculateInventory.otherSSR.gameObject.tag = "Untagged";
                    }
                    else if (currentSprite.name.Contains("Shoe"))
                    {
                        //buttonChangeBack();
                        CalculateInventory.wearingShoe = false;

                        //change inventory clothes
                        CalculateInventory.shoeSR.sprite = CalculateInventory.transparent;

                        //change subway clothes
                        CalculateInventory.shoeSSR.sprite = CalculateInventory.transparent;


                        //change clothes in advertisement
                        CalculateInventory.shoeASR.sprite = CalculateInventory.transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.shoeSR.gameObject.tag  = "Untagged";
                        CalculateInventory.shoeASR.gameObject.tag = "Untagged";
                        CalculateInventory.shoeSSR.gameObject.tag = "Untagged";
                    }
                    else if (currentSprite.name.Contains("Everything"))
                    {
                        //buttonChangeBack();
                        CalculateInventory.wearingEverything = false;

                        //change inventory clothes
                        CalculateInventory.everythingSR.sprite = CalculateInventory.transparent;

                        //change subway clothes
                        CalculateInventory.everythingSSR.sprite = CalculateInventory.transparent;


                        CalculateInventory.whiteShirt.enabled = true;
                        CalculateInventory.blackPants.enabled = true;


                        CalculateInventory.whiteShirtS.enabled = true;
                        CalculateInventory.blackPantsS.enabled = true;


                        //change clothes in advertisement
                        CalculateInventory.everythingASR.sprite = CalculateInventory.transparent;


                        //change the tag on all clothes on karara
                        CalculateInventory.everythingSR.gameObject.tag  = "Untagged";
                        CalculateInventory.everythingASR.gameObject.tag = "Untagged";
                        CalculateInventory.everythingSSR.gameObject.tag = "Untagged";
                    }
                }
            }
        }
    }
Ejemplo n.º 8
0
    IEnumerator returnClothYes()
    {
        AllMachines.isReturning = true;
        FinalCameraController.ChangeToSubway();


        //找到那个洗衣机
        for (int a = 0; a < AllMachines.WashingMachines.Count; a++)
        {
            if (WasherControllerList[a].CompareTag(tag))
            {
                FinalCameraController.returnMachineNum = a;
            }
        }

        int temp = 0;

        //转到这个洗衣机在的页面
        if (FinalCameraController.returnMachineNum == 0)
        {
            temp = 2;
        }
        else
        {
            temp = 3;
        }

        FinalCameraController.myHSS.GoToScreen(temp);

        yield return(new WaitForSeconds(1f));

        print("bag disappear");

        //包消失

        FinalCameraController.AllStationClothList.Remove(tag);
        FinalCameraController.alreadyNotice = false;
        //去掉这个洗衣机上的tag

        if (!FinalCameraController.isTutorial)
        {
            AllMachines.nameToTemp[tag].Clear();
            //reset the temp list, so all the clothes are in the temp list
            for (int i = 0; i < AllMachines.nameToPermenant[tag].Count; i++)
            {
                AllMachines.nameToTemp[tag].Add(AllMachines.nameToPermenant[tag][i]);
            }
        }

        for (int i = 0; i < AllMachines.WashingMachines.Count; i++)
        {
            if (WasherControllerList[i].CompareTag(tag))
            {
                FinalCameraController.returnMachineNum = i;

//                print("AllMachines.currentBag.tag = " + AllMachines.currentBag.tag);
                //对所有inventory中带着这个洗衣机tag的衣服,把它们放回洗衣机

                for (int u = 0; u < CalculateInventory.inventory.Count; u++)
                {
                    if (CalculateInventory.inventory[u].CompareTag(tag))
                    {
                        //change the inventory button image back to start
                        CalculateInventory.inventory[u].GetComponent <Image>().sprite            = FinalCameraController.startSprite;
                        CalculateInventory.inventory[u].GetComponent <ClothChanging>().isWearing = false;
                        print("returnrnrnrnrnrnrn");
                        //then
                        CalculateInventory.occupiedI = CalculateInventory.occupiedI - 1;
                        //reset the tag of the inventory item
                        CalculateInventory.inventory[u].tag = "Untagged";
                    }
                }
                //todo: can be simpler
                //如果karara身上正好穿着这件衣服,那么在地铁、换装、广告界面都要脱下来
                if (CalculateInventory.everythingSR.CompareTag(this.tag))
                {
                    CalculateInventory.everythingSR.sprite  = CalculateInventory.transparent;
                    CalculateInventory.everythingASR.sprite = CalculateInventory.transparent;
                    CalculateInventory.everythingSSR.sprite = CalculateInventory.transparent;

                    CalculateInventory.wearingEverything = false;
                    //如果穿的是这件衣服的话

                    ChangeToUnderwear("everything");
                }
                if (CalculateInventory.topSR.CompareTag(tag))
                {
                    CalculateInventory.topSR.sprite  = CalculateInventory.transparent;
                    CalculateInventory.topASR.sprite = CalculateInventory.transparent;
                    CalculateInventory.topSSR.sprite = CalculateInventory.transparent;

                    ChangeToUnderwear("top");
                    CalculateInventory.wearingTop = false;
                }
                if (CalculateInventory.otherSR.CompareTag(tag))
                {
                    CalculateInventory.otherSR.sprite  = CalculateInventory.transparent;
                    CalculateInventory.otherASR.sprite = CalculateInventory.transparent;
                    CalculateInventory.otherSSR.sprite = CalculateInventory.transparent;

                    ChangeToUnderwear("bottom");
                    CalculateInventory.wearingBottom = false;
                }
                if (CalculateInventory.shoeSR.CompareTag(tag))
                {
                    CalculateInventory.shoeSR.sprite  = CalculateInventory.transparent;
                    CalculateInventory.shoeASR.sprite = CalculateInventory.transparent;
                    CalculateInventory.shoeSSR.sprite = CalculateInventory.transparent;

                    CalculateInventory.wearingShoe = false;
                }

                //reset the machine's variables
                WasherControllerList[i].transform.tag  = "Untagged";
                WasherControllerList[i].myMachineState = AllMachines.MachineState.empty;
                WasherControllerList[i].isFirstOpen    = true;
                WasherControllerList[i].clothNum       = 4;

//                print("destroy");
//                print(this.transform.parent.gameObject.name);

                GameObject bagToReturn = new GameObject();

                for (int y = 0; y < SubwayMovement.bagsInCar.Count; y++)
                {
                    if (CompareTag(SubwayMovement.bagsInCar[y].tag))
                    {
                        bagToReturn = SubwayMovement.bagsInCar[y];
                    }
                }

                //如果是晚还包的话
                //必须后destroy这个包,因为destroy在每个frame的最后执行,如果先destroy的话,Coroutine就不会被执行了
                if (FinalCameraController.lateReturnComic && !FinalCameraController.isTutorial)//call这一整个function之前就已经是true了
                {
                    //先播放一个包不见的动画
                    bagToReturn.GetComponent <Image>().sprite = CalculateInventory.disappear;

                    yield return(new WaitForSeconds(0.2f));

                    bagToReturn.GetComponent <Image>().sprite = CalculateInventory.transparent;

                    yield return(new WaitForSeconds(0.5f));

                    FinalCameraController.myHSS.GoToScreen(1);
                    yield return(new WaitForSeconds(0.2f));

                    FinalCameraController.Show(FinalCameraController.fishTalk);
                    FinalCameraController.fishTalkText.text = "Return your customers' clothes on time! Such bad memory!";
                    FinalCameraController.lateReturnComic   = false;
                }


                //this function is called in the notice script, so destroy itself doesn't destroy the bag
                //need to find the bag with the same bagu

                for (int y = 0; y < SubwayMovement.bagsInCar.Count; y++)
                {
                    if (CompareTag(SubwayMovement.bagsInCar[y].tag))
                    {
                        Destroy(SubwayMovement.bagsInCar[y]);

                        SubwayMovement.bagsInCar.Remove(SubwayMovement.bagsInCar[y]);
                    }
                }

                Destroy(FinalCameraController.generatedNotice);
                AllMachines.isReturning = false;
            }
        }
    }