Example #1
0
    public void PushDanmaku(string content, float x, float y, float z, int level, Color color, int fontSize = 14)
    {
        Danmaku danmaku = new Danmaku();

        danmaku.Content  = content;
        danmaku.UserId   = BmobUser.CurrentUser.username;
        danmaku.X        = x;
        danmaku.Y        = y;
        danmaku.Z        = z;
        danmaku.Level    = level;
        danmaku.FontSize = fontSize;
        danmaku.ColorR   = new BmobDouble(color.r);
        danmaku.ColorG   = new BmobDouble(color.g);
        danmaku.ColorB   = new BmobDouble(color.b);
        bmob.Create(danmaku, (resp, exception) =>
        {
            if (exception != null)
            {
                print("保存失败, 失败原因为: " + exception.Message);
                return;
            }

            print("保存成功, @" + resp.createdAt);
        });
    }
Example #2
0
    public void FinishLevel()
    {
        var data = new ScoreRank();

        data.score = score;
        if (ifSend)
        {
        }
        else
        {
            bmobUnity.Create("scoreRank", data, (resp, exception) =>
            {
                if (exception != null)
                {
                    print("保存失败,失败原因为 " + exception.Message);
                    return;
                }
                ifSend = true;
                print("保存成功,@" + resp.createdAt);
            });
        }
        showMenu = !showMenu;
        deadMenu.SetActive(showMenu);
        titleText.text = "MISSION Finish";
    }
Example #3
0
 /// <summary>
 /// 添加用户
 /// </summary>
 /// <param name="user"></param>
 /// <returns></returns>
 public void AddUser(BmobGameObject user)
 {
     bmobUnity.Create("EasyUser", user, (resp, exception) =>
     {
         if (exception != null)
         {
             print("保存失败, 失败原因为: " + exception.Message);
             ///在此处提示用户登录失败
             return;
         }
         print("保存成功, @" + resp.createdAt);
     });
 }
Example #4
0
 /// <summary>
 /// 插入数据
 /// </summary>
 public void InsertData <T>(T mg, string tabName) where T : BmobTable
 {
     Bmob.Create(tabName, mg, (resp, exception) =>
     {
         if (exception != null)
         {
             Debug.Log("保存失败,原因: " + exception.Message);
         }
         else
         {
             Debug.Log("保存成功" + resp.createdAt);
         }
     });
 }
Example #5
0
    //---------------------------------------------------------

    /// <summary>
    /// 上传分数
    /// </summary>
    public static void UploadRank(Rank rank)
    {
        bmobUnity.Create("RankTable", rank, (resp, exception) =>
        {
            if (exception != null)
            {
                print("保存失败,失败原因:" + exception.Message);
                return;
            }

            LoadingNetwork.isDoneUpload = true;

            print("上传数据成功,@" + resp.createdAt);
        });
    }
Example #6
0
    public void createData_Click()
    {
        var data = new ContentMode();

        data.title   = title.text;
        data.content = content.text;

        bmobUnity.Create("Content", data, (resp, exception) =>
        {
            if (exception != null)
            {
                Debug.Log("保存失败,失败原因" + exception.Message);
                return;
            }
            Debug.Log("保存成功" + resp.createdAt);
        });
    }
Example #7
0
    void addData()
    {
        var data = new BmobGameObject();

        data.userId   = 2;
        data.userName = "******";

        Bmob.Create(TABLENAME, data,
                    (resp, exception) => {
            if (exception != null)
            {
                print("加载失败");
            }
            else
            {
                print("加载成功" + resp.createdAt + exception);
            }
        }
                    );
    }
Example #8
0
        //private string usernameid;

        void add_data(int thisscore)      //在数据库中增加数据方法
        {
            var new_data = new BmobGameObject();

            new_data.userId  = PlayerPrefs.GetString(typeof(name_pass) + "Id");
            new_data.myscore = thisscore;


            Bmob.Create(TABLENAME, new_data, (resp, exception) =>
            {
                if (exception != null)
                {
                    print("fail" + exception.Message);
                    return;
                }

                Debug.Log("创建成功");
            }
                        );
        }
Example #9
0
    void create()
    {
        var data = new BmobGameObject();

        System.Random rnd = new System.Random();
        data.score      = rnd.Next(-50, 170);
        data.playerName = "123";
        data.cheatMode  = false;

        Bmob.Create(TABLENAME, data,
                    (resp, exception) => {
            if (exception != null)
            {
                print("保存失败, 失败原因为: " + exception.Message);
                return;
            }

            print("保存成功, @" + resp.createdAt);
        }
                    );
        //Bmob.CreateTaskAsync (TABLENAME, data);
    }
Example #10
0
    private void createData_Click()
    {
        //设置值
        gameObject.score = 100;

        Bmob.Create("Score", gameObject, (resp, exception) =>
        {
            if (exception != null)
            {
                Debug.Log("保存失败,失败原因" + exception.Message);
                return;
            }
            Debug.Log("保存成功" + resp.createdAt);
        });


        //保存数据
        //var future = Bmob.  CreateTaskAsync(gameObject);
        //异步显示返回的数据
        //FinishedCallback(future.Result, resultText);


        //var data = new BmobScore();
        //int score = 100;
        //data.score = score;

        //Bmob.Create("Score", data, (resp, exception) =>
        //{
        //    if (exception != null)
        //    {
        //        Debug.Log("保存失败,失败原因" + exception.Message);
        //        return;
        //    }
        //    Debug.Log("保存成功" + resp.createdAt);
        //});
    }