示例#1
0
        private void Load()
        {
            USER_SAVE data = SaveMgr.Load <USER_SAVE>(SAVEDATA_FILE);

            availableStartItemCount  = data.availableStartItemsCount;
            availableInGameItemCount = data.availableInGameItemsCount;
            life = data.life;
            coin = data.coin;
        }
示例#2
0
        private void Save()
        {
            GAMEDATA_SAVE data = new GAMEDATA_SAVE();

            data.endLevel = endLevel;
            data.isBGM    = isBGM;
            data.isEffect = isEffect;

            SaveMgr.Save <GAMEDATA_SAVE>(data, SAVEDATA_FILE);
        }
示例#3
0
        private void Load()
        {
            GAMEDATA_SAVE data = SaveMgr.Load <GAMEDATA_SAVE>(SAVEDATA_FILE);

            if (data != null)
            {
                endLevel = data.endLevel;
                isBGM    = data.isBGM;
                isEffect = data.isEffect;
            }
        }
示例#4
0
        private void Save()
        {
            USER_SAVE data = new USER_SAVE();

            data.life = life;
            data.coin = coin;
            data.availableStartItemsCount  = availableStartItemCount;
            data.availableInGameItemsCount = availableInGameItemCount;

            SaveMgr.Save <USER_SAVE>(data, SAVEDATA_FILE);
        }
示例#5
0
        private void Save()
        {
            UpdateAdsRewardedCount();

            USER_SAVE data = new USER_SAVE();

            data.life = life;
            data.coin = coin;
            data.coinRewardedCount         = coinRewardedCount;
            data.availableStartItemsCount  = availableStartItemCount;
            data.availableInGameItemsCount = availableInGameItemCount;
            data.timeToNextLife            = timeToNextLife;
            data.quitTime = DateTime.Now.Ticks;

            SaveMgr.Save <USER_SAVE>(data, SAVEDATA_FILE);
        }
示例#6
0
        private void Load()
        {
            USER_SAVE data = SaveMgr.Load <USER_SAVE>(SAVEDATA_FILE);

            if (data == null)
            {
                life = maxLife;
                coin = 500;
                return;
            }
            availableStartItemCount  = data.availableStartItemsCount;
            availableInGameItemCount = data.availableInGameItemsCount;
            life = data.life;
            coin = data.coin;
            coinRewardedCount = data.coinRewardedCount;
            quitTime          = new DateTime(data.quitTime);
            loginTime         = DateTime.Now;

            if (quitTime.Date != loginTime.Date)
            {
                coinRewardedCount = 0;
            }

            TimeSpan ts = loginTime - quitTime;

            if (ts.TotalSeconds > data.timeToNextLife)
            {
                life = maxLife;
            }
            else
            {
                if (life < maxLife)
                {
                    timeToNextLife = 0;
                    int plusLife = Mathf.FloorToInt((data.timeToNextLife - (float)ts.TotalSeconds) / lifeAddTime);
                    life          += plusLife;
                    timeToNextLife = Mathf.FloorToInt((data.timeToNextLife - (float)ts.TotalSeconds) - (lifeAddTime * plusLife));
                }
            }
        }