Esempio n. 1
0
        // Use this for initialization
        void Start()
        {
            currentPlayerIO = this;
            menu            = GameObject.FindGameObjectWithTag("Menu");
            menu.SetActive(false);
            itms = new Items.InventtoryList();
            itms = Items.readData();

            /*
             * QualitySettings.vSyncCount = 0;
             * Application.targetFrameRate = 144;
             */
        }
Esempio n. 2
0
        //保存人物背包信息
        public static void SavePackageData(Inventtory data)
        {
            InventtoryList _myItems = null;
            string         filePath = Application.dataPath + @"/Resources/Settings/package.json";

            if (!File.Exists(filePath))
            {
                _myItems = new InventtoryList();
                _myItems._myItems.Add(data);
            }
            else
            {
                bool bFind = false;
                _myItems = PlayerIO.getPackItems();
                for (int i = 0; i < _myItems._myItems.Count; ++i)
                {
                    Inventtory saveData = _myItems._myItems[i];
                    if (data.Slot == saveData.Slot)
                    {
                        saveData.id     = data.id;
                        saveData.Count  = data.Count;
                        saveData.Damage = data.Damage;
                        bFind           = true;
                        break;
                    }
                }
                if (!bFind)
                {
                    _myItems._myItems.Add(data);
                }
            }

            FileInfo     file = new FileInfo(filePath);
            StreamWriter sw   = file.CreateText();
            string       json = JsonMapper.ToJson(_myItems);

            sw.WriteLine(json);
            sw.Close();
            sw.Dispose();
        }
Esempio n. 3
0
 // Use this for initialization
 void Start()
 {
     saveBtn.onClick.AddListener(delegate() {
         Items.save(PlayerIO.getPackItems());
     });
 }