Esempio n. 1
0
 void Start()
 {
     Debug.Log("Start");
     GameObject.Find("Canvas/PopupPanel/Panel").gameObject.GetComponent <Button> ().onClick.AddListener(ClosePopup);
     foreach (GameObject popup in GameObject.FindGameObjectsWithTag("Popup"))
     {
         if (popup.name == "Popup1")
         {
             popup1 = popup;
             // Initialize the scrollSnapRect with starting page index of 0.
             scrollSnapRect.Init(0);
             scrollSnapRect.LerpToPage(0);
             // Get user input components for name, description, points and catch game category of the treasure.
             treasureName = popup.transform.Find("Dynamic Objects/TreasureNameInput").GetComponent <InputField> ();
             points       = popup.transform.Find("Dynamic Objects/PointsSlider").GetComponent <Slider> ();
             catchGame    = popup.transform.Find("Dynamic Objects/CatchGameDropdown").GetComponent <Dropdown> ();
             question     = " ";
             answer       = " ";
             location     = " ";
         }
         else if (popup.name == "Popup2")
         {
             popup2      = popup;
             description = popup.transform.Find("TreasureDesc/DescriptionInput").GetComponent <InputField> ();
             targetImage = "";
         }
         else
         {
             popup3 = popup;
             // Let user choose a treasure image.
             //treasureImage = "https://ipetcompanion.com/feedapuppy/styles/media/puppy.jpg";
             treasureImage = 0;
         }
     }
 }
Esempio n. 2
0
 void Start()
 {
     Debug.Log("Start");
     panel.GetComponent <Button> ().onClick.AddListener(ClosePopup);
     foreach (GameObject popup in GameObject.FindGameObjectsWithTag("Popup"))
     {
         if (popup.name == "Popup1")
         {
             // Initialize the scrollSnapRect with starting page index of 0.
             scrollSnapRect.Init(0);
             scrollSnapRect.LerpToPage(0);
             // to do:
         }
         else
         {
             // to do:
         }
     }
 }
Esempio n. 3
0
    public void Init()
    {
        totalStarCount = Game.Instance.playData.star;

        stageScrollRects = new List <ScrollRect>(new ScrollRect[Game.Instance.config.worldInfos.Count]);
        stageInfos       = new List <UIStageInfo> (new UIStageInfo[Game.Instance.config.stageInfos.Count]);
        for (int i = 0; i < Game.Instance.config.worldInfos.Count; i++)
        {
            ScrollRect stageScrollRect = GameObject.Instantiate <ScrollRect> (stageScrollRectPrefab);
            stageScrollRect.transform.SetParent(content, false);
            stageScrollRects[i] = stageScrollRect;

            Config.WorldInfo worldInfo = Game.Instance.config.worldInfos[i];
            foreach (Config.StageInfo stageInfo in worldInfo.stageInfos)
            {
                UIStageInfo uiStageInfo = GameObject.Instantiate <UIStageInfo>(stageInfoPrefab);
                uiStageInfo.transform.SetParent(stageScrollRect.content, false);
                uiStageInfo.Init(stageInfo);
                stageInfos [stageInfo.id - 1] = uiStageInfo;
            }
        }

        scrollSnapRect.Init();

        achievementButton.onClick.AddListener(() => {
            AudioManager.Instance.Play("ButtonClick");
            Game.Instance.achievementPanel.gameObject.SetActive(true);
            Game.Instance.achievementPanel.Sort();
            Game.Instance.rootPanel.ScrollScreen(new Vector3(0.0f, -1.0f, 0.0f), () => {
                gameObject.SetActive(false);
            });
            newAchievement.SetActive(false);
        });

        shopButton.onClick.AddListener(() => {
            AudioManager.Instance.Play("ButtonClick");
            Game.Instance.shopPanel.gameObject.SetActive(true);
            Game.Instance.rootPanel.ScrollScreen(new Vector3(0.0f, 1.0f, 0.0f), () => {
                gameObject.SetActive(false);
            });
        });
    }