コード例 #1
0
        private IEnumerator sendTicketsData(JSONArray array, int price)
        {
            WWWForm form = new WWWForm();

            form.AddField("TAG", "PLACE_BET_LOTTO");
            form.AddField("session", PlayerPrefs.GetString(LOTTOGame.SESSION));
            form.AddField("user_id", PlayerPrefs.GetString(PlayerDetails.ConnectionId));
            form.AddField("bet", price);
            form.AddField("ticket", array.ToString());
            WWW www = new WWW(Tags.URL, form);

            yield return(www);

            if (www.error == null)
            {
                string response = www.text;
                Debug.Log(PlayerPrefs.GetString(LOTTOGame.SESSION) + " Bet Result" + response);
                try{
                    JSONNode node = JSON.Parse(response);

                    if (node != null)
                    {
                        try
                        {
                            string result = node["status"];
                            if (result.Equals("OK"))
                            {
                                try
                                {
                                    LottoGameController.updateWallet();
                                }
                                catch (System.Exception ex)
                                {
                                    Debug.Log(ex.Message);
                                }
                            }
                            else
                            {
                            }
                        }
                        catch (System.Exception ex)
                        {
                            Debug.Log(ex.Message);
                        }
                    }
                    GameController.startGame();
                }
                catch (System.Exception ex)
                {
                    Debug.Log(ex.Message);
                }
            }
            else
            {
            }
        }
コード例 #2
0
        // Update is called once per frame
        void Update()
        {
            if (this.BettingTime)
            {
                //Timer.text = "" + (this.nextSessionTime - DateTime.Now).Minutes + ":" + (this.nextSessionTime - DateTime.Now).Seconds;

                if (DateTime.Now >= this.endBetTime)
                {
                    this.BettingTime = false;
                    Debug.Log("StopBetting");
                    LottoGameController.stopBetting();
                }
            }

            if (this.endBetTime == null)
            {
                if (this.Result)
                {
                    resultTimePanel.SetActive(true);

                    resultTime.text = "0" + (this.ticketAnnounceText - DateTime.Now).Minutes + ":" + (this.ticketAnnounceText - DateTime.Now).Seconds;
                    if ((this.ticketAnnounceText - DateTime.Now).Seconds < 10)
                    {
                        resultTime.text = "0" + (this.ticketAnnounceText - DateTime.Now).Minutes + ":" + "0" + (this.ticketAnnounceText - DateTime.Now).Seconds;
                    }
                }
            }

            if (this.Time)
            {
                systemTime.text = "" + (DateTime.Now).Hour + ":" + (DateTime.Now).Minute + ":" + (DateTime.Now).Second;

                if ((DateTime.Now).Hour < 10)
                {
                    systemTime.text = "0" + (DateTime.Now).Hour + ":" + (DateTime.Now).Minute + ":" + (DateTime.Now).Second;
                }
                if ((DateTime.Now).Minute < 10)
                {
                    systemTime.text = "" + (DateTime.Now).Hour + ":" + "0" + (DateTime.Now).Minute + ":" + (DateTime.Now).Second;
                }
                if ((DateTime.Now).Second < 10)
                {
                    systemTime.text = "" + (DateTime.Now).Hour + ":" + (DateTime.Now).Minute + ":" + "0" + (DateTime.Now).Second;
                }
            }
            if (DateTime.Now < this.endBetTime)
            {
                betTime.text = "Time Left" + " " + "0" + (this.endBetTime - DateTime.Now).Minutes + ":" + (this.endBetTime - DateTime.Now).Seconds;
                if ((this.endBetTime - DateTime.Now).Seconds < 10)
                {
                    betTime.text = "Time Left" + " " + "0" + (this.endBetTime - DateTime.Now).Minutes + ":" + "0" + (this.endBetTime - DateTime.Now).Seconds;
                }
            }
        }
コード例 #3
0
        private IEnumerator refreshWallet()
        {
            WWWForm form = new WWWForm();

            form.AddField("TAG", "LOTTO_BET_DATA");
            form.AddField("session", PlayerPrefs.GetString(LOTTOGame.SESSION));
            form.AddField("user_id", PlayerPrefs.GetString(PlayerDetails.ConnectionId));
            WWW www = new WWW(Tags.URL, form);

            yield return(www);

            if (www.error == null)
            {
                string response = www.text;
                Debug.Log(PlayerPrefs.GetString(LOTTOGame.SESSION) + " response" + response);
                try{
                    JSONNode node = JSON.Parse(response);

                    if (node != null)
                    {
                        string result = node["status"];
                        if (result.Equals("OK"))
                        {
                            try
                            {
                                LottoGameController.refreshWallet(node["data"]);
                            }
                            catch (System.Exception ex)
                            {
                                Debug.Log(ex.Message);
                            }
                        }
                        else
                        {
                        }
                    }
                    GameController.startGame();
                }
                catch (System.Exception ex)
                {
                    Debug.Log(ex.Message);
                }
            }
            else
            {
            }
        }
コード例 #4
0
 public void click()
 {
     if (isOpen)
     {
         if (isSelected)
         {
             isSelected = false;
             GetComponent <Image>().color = Color.white;
         }
         else
         {
             GetComponent <Image>().color = Color.grey;
             isSelected = true;
         }
         LottoGameController.clickTicket();
     }
 }
コード例 #5
0
        // Update is called once per frame
        void Update()
        {
            if (this.callNextSession)
            {
                Timer.text = "0" + (this.nextSessionTime - DateTime.Now).Minutes + ":" + (this.nextSessionTime - DateTime.Now).Seconds;

                if (DateTime.Now >= this.nextSessionTime)
                {
                    this.callNextSession = false;
                    Debug.Log("Call next session");
                    LottoGameController.startSession();
                }
                if ((this.nextSessionTime - DateTime.Now).Seconds < 10)
                {
                    Timer.text = "0" + (this.nextSessionTime - DateTime.Now).Minutes + ":" + "0" + (this.nextSessionTime - DateTime.Now).Seconds;
                }
            }
        }
コード例 #6
0
        IEnumerator closeSession()
        {
            yield return(new WaitForSeconds(2.0f));

            LottoGameController.closeSession();
        }