コード例 #1
0
    void ReadGunData()
    {
        string  GunData = Saver.ReadJsonString(Saver.GunDataPath);
        Bag_Gun bag_Gun = JsonMapper.ToObject <Bag_Gun>(GunData);

        m_haveGun = bag_Gun.haveGuns;
    }
コード例 #2
0
    public void SaveHaveGun()
    {
        Bag_Gun bag_Gun = new Bag_Gun
        {
            haveGuns = HaveGun
        };

        Debug.Log("写入枪的数据");
        string GunData = JsonMapper.ToJson(bag_Gun);

        Saver.WriteJsonString(GunData, Saver.GunDataPath);
    }
コード例 #3
0
    void InitHaveGun()
    {
        Bag_Gun bag_Gun = new Bag_Gun();

        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 0, Have = true, InBag = true
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 1, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 2, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 3, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 4, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 5, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 6, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 7, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 8, Have = false, InBag = false
        });
        bag_Gun.haveGuns.Add(new HaveGun()
        {
            ID = 9, Have = false, InBag = false
        });

        string GunData = JsonMapper.ToJson(bag_Gun);

        Saver.WriteJsonString(GunData, Saver.GunDataPath);
    }