Esempio n. 1
0
    public void doubleQuotationUnescapeTest()
    {
        // テストデータ作成
        NCMBObject obj = new NCMBObject("TestClass");

        obj ["key"] = "\"test\"";
        obj.SaveAsync((NCMBException e) => {
            if (e != null)
            {
                Assert.Fail(e.ErrorMessage);
            }
        });
        NCMBTestSettings.AwaitAsync();

        // テストデータ検索
        NCMBQuery <NCMBObject> query = new NCMBQuery <NCMBObject> ("TestClass");

        query.WhereEqualTo("objectId", obj.ObjectId);
        query.FindAsync((List <NCMBObject> list, NCMBException e) => {
            if (e == null)
            {
                Assert.AreEqual("\"test\"", list [0] ["key"]);
            }
            else
            {
                Assert.Fail(e.ErrorMessage);
            }
            NCMBTestSettings.CallbackFlag = true;
        });

        NCMBTestSettings.AwaitAsync();
        Assert.True(NCMBTestSettings.CallbackFlag);

        // テストデータ削除
        obj.DeleteAsync();
    }
Esempio n. 2
0
    public void OnClick()
    {
        AudioSource[] audioSources = GameObject.Find("SEController").GetComponents <AudioSource>();

        if (Application.internetReachability == NetworkReachability.NotReachable)
        {
            //接続されていないときの処理
            Message msg = new Message();
            msg.makeMessage(msg.getMessage(136));
            audioSources[4].Play();
        }
        else
        {
            audioSources[3].Play();

            //NCMB delete
            NCMBObject query = new NCMBObject("reward");
            query.ObjectId = objectId;
            query.DeleteAsync();

            //List delete
            DataReward DataRewardObj = GameObject.Find("DataStore").GetComponent <DataReward>();
            int        line          = 0;
            for (int i = 0; i < DataRewardObj.objectIdList.Count; i++)
            {
                if (objectId == DataRewardObj.objectIdList[i])
                {
                    line = i;
                }
            }
            DataRewardObj.objectIdList.RemoveAt(line);
            DataRewardObj.itemTitleList.RemoveAt(line);
            DataRewardObj.itemGrpList.RemoveAt(line);
            DataRewardObj.itemRankList.RemoveAt(line);
            DataRewardObj.itemQtyList.RemoveAt(line);

            //visual delete
            Destroy(slot);

            //item register
            if (grp == "money")
            {
                Message msgScript = new Message();
                string  msg       = "";
                int     money     = PlayerPrefs.GetInt("money");
                int     newMoney  = money + qty;
                if (newMoney < 0)
                {
                    newMoney = int.MaxValue;
                }
                PlayerPrefs.SetInt("money", newMoney);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty + " money.";
                }
                else
                {
                    msg = "金を" + qty + "受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else if (grp == "stone")
            {
                Message msgScript    = new Message();
                string  msg          = "";
                int     busyoDama    = PlayerPrefs.GetInt("busyoDama");
                int     newBusyoDama = busyoDama + qty;
                PlayerPrefs.SetInt("busyoDama", newBusyoDama);
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty + " stone.";
                }
                else
                {
                    msg = "武将珠を" + qty + "個受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else if (grp == "busyo")
            {
                audioSources[7].Play();
                receiveBusyo(busyoId);
            }
            else if (grp == "kaho")
            {
                receiveKaho();
            }
            else if (grp == "syokaijyo")
            {
                receiveShokaijyo(rank, qty);
            }
            else if (grp == "shiro")
            {
                Shiro   shiro     = new Shiro();
                int     shiroId   = shiro.getRandomId();
                string  shiroName = shiro.getName(shiroId);
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + shiroName + ". You can enhance your castle in town development.";
                }
                else
                {
                    msg = "天下の要害、" + shiroName + "を築城できますぞ。内政で城を増強しましょう。";
                }
                msgScript.makeMessage(msg);
                shiro.registerShiro(shiroId);
            }
            else if (grp == "jinkei")
            {
                if (rank == "1")
                {
                    PlayerPrefs.SetBool("addJinkei1", true);
                }
                else if (rank == "2")
                {
                    PlayerPrefs.SetBool("addJinkei2", true);
                }
                else if (rank == "3")
                {
                    PlayerPrefs.SetBool("addJinkei3", true);
                }
                else if (rank == "4")
                {
                    PlayerPrefs.SetBool("addJinkei4", true);
                }
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got an additional formation.";
                }
                else
                {
                    msg = "追加陣形を受領しました。";
                }
                msgScript.makeMessage(msg);
            }
            else
            {
                PlayerPrefs.SetInt(grp, qty);
                Message msgScript = new Message();
                string  msg       = "";
                if (Application.systemLanguage != SystemLanguage.Japanese)
                {
                    msg = "You got " + qty.ToString() + " " + grp + ".";
                }
                else
                {
                    msg = grp + "を" + qty + "入手しました。";
                }
                msgScript.makeMessage(msg);
            }
            PlayerPrefs.Flush();
        }
    }