Ejemplo n.º 1
0
    /// <summary>
    /// 返回全部User
    /// </summary>
    public void SearchUser()
    {
        BmobQuery query = new BmobQuery();

        bmobUnity.Find <BmobGameObject>(TABLE_NAME, query, (resp, exception) =>
        {
            if (exception != null)
            {
                Debug.Log("查询失败, 失败原因为: " + exception.Message);
                return;
            }

            List <BmobGameObject> list = resp.results;
            foreach (var user in list)
            {
                Debug.Log("ID:" + user.userid);
            }
        });
    }
Ejemplo n.º 2
0
    void FindQuery()
    {
        BmobQuery query = new BmobQuery();

        query.WhereEqualTo("playerName", "123");
        Bmob.Find <BmobGameObject> (TABLENAME, query, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败, 失败原因为: " + exception.Message);
                return;
            }

            List <BmobGameObject> list = resp.results;
            foreach (var game in list)
            {
                print("获取的对象为: " + toString(game));
            }
        });
    }
Ejemplo n.º 3
0
    public void FindUser(string id)
    {
        BmobQuery query = new BmobQuery();

        query.WhereEqualTo("username", id);
        bmob.Find <GameUser>(GameUser.TABLE, query, (resp, ex) => {
            if (ex != null)
            {
                print("查找失败, 失败原因为: " + ex.Message);
                flag++;
                return;
            }
            if (resp.results.Count > 0)
            {
                ID = id;
                print("存在用户:" + resp.results[0].username);
            }
            else
            {
                flag++;
            }
        });
    }
Ejemplo n.º 4
0
//    public bool isGetAllOver = false;
//    /// <summary>
//    /// 获取表所以信息 查询条件符合的所有数据:
//    /// </summary>
//    public void getAllInfo<T>(BmobQuery query, string tabName,List<T> list) where T : MyGameTable
//    {
//        isGetAllOver = false;
//        Bmob.Find<T>(tabName, query, (resp, exception) =>
//        {
//            if (exception != null)
//            {
//                print("查询失败, 失败原因为: " + exception.Message);
//                return;
//            }
//            //对返回结果进行处理
//            isGetAllOver = true;
//            list = resp.results;
//        });
//    }



    public IEnumerator ConditionFind <T>(BmobQuery query, string tabName, Action <List <T>, bool> onOk)
    {
        Bmob.Find <T>(tabName, query, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败, 失败原因为: " + exception.Message);
                onOk(null, true);
                return;
            }
            //对返回结果进行处理
            onOk(resp.results, true);
        });
        yield break;
    }
Ejemplo n.º 5
0
    public void RefreshList()
    {
        //创建一个BmobQuery查询对象
        BmobQuery query = new BmobQuery();

        query.Limit(10);
        bmobUnity.Find <ContentMode>("Content", query, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败, 失败原因为: " + exception.Message);
                return;
            }
            lists.Clear();
            lists = resp.results;
            artMng.Refresh(lists);
        });
    }
Ejemplo n.º 6
0
    /// <summary>
    /// Ranks the data.
    /// </summary>
    void RankData()
    {
        //设置获取表的属性
        BmobQuery queryData = new BmobQuery();

        queryData.OrderByDescending("coin");
        queryData.Limit(10);

        //获取对应的表的内容
        Bmob.Find <BmobGameObject>(TABLENAME, queryData,
                                   (response, exception) => {
            if (exception != null)
            {
                print("数据列表获取失败" + exception);

                return;
            }

            print("数据列表获取成功");

            List <BmobGameObject> list = response.results;

            foreach (var data in list)
            {
                print(data);

                //生成数据列表
                GameObject rankDataUI              = Instantiate(rankDataPrefab);
                rankDataUI.transform.parent        = rankDataParent;
                rankDataUI.transform.localRotation = rankDataPrefab.transform.localRotation;
                rankDataUI.transform.localScale    = Vector3.one;
                rankDataUI.GetComponent <RankDataAttr>().userNmaeText.text = data.userName;
                rankDataUI.GetComponent <RankDataAttr>().coinText.text     = data.coin.ToString();
            }
        }
                                   );
    }
Ejemplo n.º 7
0
    //---------------------------------------------------------

    /// <summary>
    /// 查询排名数据
    /// </summary>
    public static void DownloadRankList()
    {
        //bmobQuery用于查询相关
        BmobQuery bmobQuery = new BmobQuery();

        //以分数来从高到低排序
        bmobQuery.OrderByDescending("score");
        //只查询前七名
        bmobQuery.Limit(7);

        bmobUnity.Find <Rank>("RankTable", bmobQuery, (resp, exception) =>
        {
            if (exception != null)
            {
                print("查询失败,失败原因为:" + exception.Message);
                return;
            }
            GameData.rankList = resp.results;

            LoadingNetwork.isDoneLoading = true;

            Debug.Log("查询完毕");
        });
    }