Exemplo n.º 1
0
 void Start()
 {
     superCube    = transform.parent.parent.parent.transform;
     cubeScript   = superCube.GetComponent <KubikRub>();
     CameraObject = superCube.parent.transform.Find("CameraObject");
     setLock      = CameraObject.GetComponent <SetLock>();
 }
Exemplo n.º 2
0
 void Start()
 {
     urls        = new List <string>();
     cubeScript1 = Cube.GetComponent <KubikRub>();
     infoPanelMake();
     Load();
 }
Exemplo n.º 3
0
    IEnumerator getCoupon(int currentPgg)
    {
        loadingPanel.SetActive(true);
        url = "http://kubirub.com/api/getCoupons?page=" + currentPgg.ToString();

        WWWForm apiformCoupon = new WWWForm();
        string  formApiKey    = PlayerPrefs.GetString("uuid");

        //Debug.Log (formApiKey);
        apiformCoupon.AddField("uuid", formApiKey);

        //  WWW www2 = new WWW(url2, postData: apiform1.data, headers: postHeader);
        WWW www2 = new WWW(url, apiformCoupon);

        yield return(www2);        //cavab gelir serverden

        //Debug.Log(www2.text);
        myObject = JsonMapper.ToObject(www2.text);
        try
        {
            if (!myObject.Keys.Contains("coupons") && myObject.Keys.Contains("status") && KubikRub.HasConnection())
            {
                loadingPanel.SetActive(false);
            }
            JsonData jsonData = JsonMapper.ToObject(myObject["coupons"].ToJson());
            //currentPg = (int)jsonData["current_page"];
            lastPg = (int)jsonData["last_page"];
            //currentPg++;

            //Debug.Log(currentPg);
            jsonArray = JsonMapper.ToObject(jsonData["data"].ToJson());
            GameObject coupBut;
            count = jsonArray.Count;

            for (int i = 0; i < count; i++)
            {
                couponDes = "";

                coupBut = Instantiate(coupon, couponParent.transform);

                //coupBut.transform.parent = textList.transform;

                try
                {
                    coupBut.gameObject.name = jsonArray[i]["id"].ToString();
                    //couponDes = jsonArray[i]["id"].ToString();
                    couponDes = jsonArray[i]["name"].ToString() + " " + jsonArray[i]["product"].ToString() + " " + jsonArray[i]["discount"].ToString() + " %";
                }
                catch (Exception e)
                {
                    Debug.LogException(e, this);
                }
                coupBut.gameObject.transform.Find("Text").GetComponent <Text>().text = couponDes;
                coupBut.GetComponent <Button>().onClick.AddListener(discountPopUp);
            }
            loaded = false;


            if (recursive)
            {
                currentPg++;
                if (currentPg < goalPg)
                {
                    StartCoroutine(getCoupon(currentPg));
                }
                else
                {
                    recursive = false;
                    discounts.normalizedPosition = last_pos;
                }
            }
        }
        catch (Exception ex)
        {
            Debug.Log(ex);
        }
        yield return(new WaitForEndOfFrame());

        if (KubikRub.HasConnection())
        {
            loadingPanel.SetActive(false);
        }
    }
Exemplo n.º 4
0
 // Use this for initialization
 void Start()
 {
     cubeScript_load = Cube.GetComponent <KubikRub>();
 }