コード例 #1
0
ファイル: MartUI.cs プロジェクト: mkelany/HayDay-Project
        private void ClearStats()
        {
            MartBidControl.biddingCow = new Cow();

            MartBidControl.currentTimer  = 0;
            MartBidControl.currentCowBid = 0;

            // Clear all buttons && re-populate list
            CreateScrollList.RemoveAllButtons();
            GameController.Instance().scrollCowList.PopulateList();

            timerStart   = false;
            timerChecked = true;
            cowInRing    = false;
            MartBidControl.biddingOver   = true;
            MartBidControl.playerBidLast = false;

            SetHealth(0);
            SetHappiness(0);
        }
コード例 #2
0
ファイル: MartUI.cs プロジェクト: mkelany/HayDay-Project
        private void CowSellBid(int windowID)
        {
            GUI.contentColor = backgroundColor;

            if (!GameController.Instance().cowSelected)
            {
                GUI.Label(new Rect(70, 30, 210, 45), "", labelSelect);
            }

            scrollCowList.transform.position = new Vector2(windowRect.center.x, scrollListPaddingY);

            if (GameController.Instance().cowSelected&& GameController.Instance().cows.Count != 0)
            {
                SetHealth(GameController.Instance().cows[GameController.Instance().cowIndex].health / 100f);
                SetHappiness(GameController.Instance().cows[GameController.Instance().cowIndex].happiness / 10f);

                healthBar.transform.position    = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY + 35);
                happinessBar.transform.position = new Vector2(windowRect.center.x + 64, healthHappinessPaddingY);

                if (!GameController.Instance().cows[GameController.Instance().cowIndex].gender == true)
                {
                    cowGender = "Female";

                    if (GameController.Instance().cows[GameController.Instance().cowIndex].pregnant == true)
                    {
                        cowPregnant = "Yes";
                    }
                }
                else
                {
                    cowGender = "Male";
                    GameController.Instance().cows[GameController.Instance().cowIndex].pregnant = false;
                    cowPregnant = "No";
                }

                GUI.Label(new Rect(110, 20, 150, 30), GameController.Instance().player.name, customTextStyle);
                GUI.Label(new Rect(90, 50, 150, 30), "Cash: € " + GameController.Instance().player.cash, customTextStyle);
                GUI.Label(new Rect(110, 90, 150, 30), "Going In: " + MartBidControl.currentTimer + "s", customTextStyle);
                GUI.Label(new Rect(25, 135, 80, 25), "", labelAge);
                GUI.Label(new Rect(132, 132, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].age, customTextStyle);
                GUI.Label(new Rect(25, 170, 90, 25), "", labelBreed);
                GUI.Label(new Rect(132, 170, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].breed, customTextStyle);
                GUI.Label(new Rect(25, 205, 110, 30), "", labelHappiness);
                GUI.Label(new Rect(25, 240, 90, 25), "", labelHealth);
                GUI.Label(new Rect(25, 275, 110, 30), "", labelPregnant);
                GUI.Label(new Rect(150, 275, 150, 30), "" + cowPregnant, customTextStyle);
                GUI.Label(new Rect(25, 313, 90, 25), "", labelGender);
                GUI.Label(new Rect(132, 313, 150, 30), "" + cowGender, customTextStyle);
                GUI.Label(new Rect(25, 350, 90, 30), "", labelWeight);
                GUI.Label(new Rect(132, 350, 150, 30), "" + GameController.Instance().cows[GameController.Instance().cowIndex].weight + " KG", customTextStyle);

                GUI.Label(new Rect(65, 400, 150, 30), "Current Bid: € " + MartBidControl.currentCowBid, customTextStyle);

                if (!cowInRing)
                {
                    if (GUI.Button(new Rect(105, 445, 120, 40), "", buttonSell))
                    {
                        if (GameController.Instance().cows.Count != 0)
                        {
                            if (!cowInRing)
                            {
                                GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                                MartBidControl.biddingCow = GameController.Instance().cows[GameController.Instance().cowIndex];
                                CowMaker.SpawnCow(MartBidControl.biddingCow, 109f, 137f, Vector3.zero);
                                StartBidding();
                                CreateScrollList.RemoveCowButton(GameController.Instance().cowIndex);
                            }
                        }
                    }
                }
            }

            if (!cowInRing)
            {
                if (GUI.Button(new Rect(295, 450, 35, 35), "", buttonX))
                {
                    GetComponent <AudioSource>().PlayOneShot(buttonSound, 0.6f);
                    if (GameController.Instance().cowSelected)
                    {
                        GameController.Instance().cowSelected = false;
                        MartBidControl.cowList.SetActive(true);
                        SetHealth(0f);
                        SetHappiness(0f);
                    }
                    else
                    {
                        GameController.Instance().martCowMenuUI    = true;
                        GameController.Instance().martCowSellBidUI = false;
                        MartBidControl.cowList.SetActive(false);
                        joyStick.gameObject.SetActive(true);
                        cameraControl.FollowPlayer();
                    }
                }
            }
        }
コード例 #3
0
ファイル: CowButton.cs プロジェクト: mkelany/HayDay-Project
 public void WhatIsMyName()
 {
     CreateScrollList.GetCowDetails(this.gameObject.name);
 }