Exemple #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;
         }
     }
 }
Exemple #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:
         }
     }
 }
Exemple #3
0
    // Update is called once per frame
    void Update()
    {
        bool wasTouched = (Input.touchCount > 0 || Input.GetMouseButtonDown(0));

        scrollSnapRect = this.transform.parent.GetComponentInParent <ScrollSnapRect> ();
        scrollSnapRect.LerpToPage(4);


        if (wasTouched)
        {
        }
    }
    public void Check(Node unit)
    {
        string sub = unit.Name;

        //Debug.Log(sub);
        title.text = sub;
        title.name = sub;

        foreach (Transform child in container.transform)
        {
            GameObject.Destroy(child.gameObject);
        }

        for (int i = 0; i < unit.Children.Count; i++)
        {
            Node _option;
            _option = unit.Children[i];
            //Debug.Log(_option);

            GameObject   opt = (GameObject)Instantiate(option, transform.position, Quaternion.identity);
            OptionScript os  = opt.GetComponent <OptionScript>();
            os.node = _option;
            //Debug.Log(os.node.Name);

            opt.transform.SetParent(container.transform);
            opt.name = _option.Name;
            opt.GetComponentInChildren <Text>().text = _option.Name;
        }

        ScrollSnapRect ssr = options.GetComponent <ScrollSnapRect>();

        if (ssr._pageCount > 0)
        {
            ssr.LerpToPage(0);
            ssr.SetPagePositions();
        }
    }
Exemple #5
0
    public void SwitchImage()
    {
        ScrollSnapRect ssr = classes.GetComponent <ScrollSnapRect>();

        ssr.LerpToPage(screenIndex);
    }