Пример #1
0
    public void GetLottoList()
    {
        WWWForm form = new WWWForm();

        form.AddField("Get", "test");
        resultFunction rf = new resultFunction(LottoListResult);

        StartCoroutine(ConnectManager.getInst().SendData(URL + "/GetLottoList.php", form, rf));
    }
Пример #2
0
    //로또 리스트 가져오기.
    void LottoListResult()
    {
        Debug.Log("LottoListResult 실행 중");
        var list = new List <Dictionary <string, object> >();

        string[] lines  = ConnectManager.getInst()._result.Split(new string[] { "\n" }, System.StringSplitOptions.RemoveEmptyEntries);
        var      header = lines[0].Split(',');

        for (int i = 1; i < lines.Length; i++)
        {
            var values = lines[i].Split(',');
            if (values.Length == 0 || values[0] == "")
            {
                continue;
            }
            var entry = new Dictionary <string, object>();
            for (var j = 0; j < header.Length && j < values.Length; j++)
            {
                string value      = values[j];
                object finalvalue = value;
                int    n;
                float  f;
                if (int.TryParse(value, out n))
                {
                    finalvalue = n;
                }
                else if (float.TryParse(value, out f))
                {
                    finalvalue = f;
                }
                entry[header[j]] = finalvalue;
            }
            list.Add(entry);
        }

        data    = list;
        success = true;
        Debug.Log(data.Count);
    }