예제 #1
0
    public static void UpdateSaveData()
    {
        DataBank         bank     = DataBank.Open();
        UserGameSaveData saveData = new UserGameSaveData();

        saveData.pleaseCharacterId         = UserPlayData.Instance.userGamePlayData.pleaseCharacterId;
        saveData.pleaseCommandFlg          = UserPlayData.Instance.userGamePlayData.pleaseCommandFlg;
        saveData.pleaseCompleteTime        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime;
        saveData.pleaseCompleteYear        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Year;
        saveData.pleaseCompleteMonth       = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Month;
        saveData.pleaseCompleteDay         = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Day;
        saveData.pleaseCompleteHour        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Hour;
        saveData.pleaseCompleteMinute      = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Minute;
        saveData.pleaseCompleteSecond      = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Second;
        saveData.pleaseCompleteMilliSecond = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Second;
        saveData.pleaseItemId       = UserPlayData.Instance.userGamePlayData.pleaseItemId;
        saveData.userCharacterDatas = new List <UserCharacterSaveData>();
        foreach (KeyValuePair <int, UserCharacterData> userSaveData in UserPlayData.Instance.userGamePlayData.userCharacterData)
        {
            foreach (KeyValuePair <int, int> itemCountTable in userSaveData.Value.itemCountTable)
            {
                var userCharacterSaveData = new UserCharacterSaveData();
                userCharacterSaveData.characterId = userSaveData.Key;
                userCharacterSaveData.itemId      = itemCountTable.Key;
                userCharacterSaveData.itemCount   = itemCountTable.Value;
                saveData.userCharacterDatas.Add(userCharacterSaveData);
            }
        }
        bank.Store("userGamePlay", saveData);
        bank.SaveAll();
    }
예제 #2
0
    public void OnClick()
    {
        sePlayer.onClickSe();
        DataBank bank = DataBank.Open();

        bank.Load <UserGameSaveData>("userGamePlay");

        UserGameSaveData playerData = new UserGameSaveData();

        playerData = bank.Get <UserGameSaveData>("userGamePlay");
        if (playerData != null)
        {
            UserPlayData.Instance.userGamePlayData.pleaseCharacterId = playerData.pleaseCharacterId;
            UserPlayData.Instance.userGamePlayData.pleaseCommandFlg  = playerData.pleaseCommandFlg;
            UserPlayData.Instance.userGamePlayData.pleaseItemId      = playerData.pleaseItemId;
            if (playerData.pleaseCompleteYear > 2000)
            {
                playerData.pleaseCompleteTime = new System.DateTime(playerData.pleaseCompleteYear, playerData.pleaseCompleteMonth, playerData.pleaseCompleteDay, playerData.pleaseCompleteHour, playerData.pleaseCompleteMinute, playerData.pleaseCompleteSecond, playerData.pleaseCompleteMilliSecond);
            }
            UserPlayData.Instance.userGamePlayData.pleaseCompleteTime = playerData.pleaseCompleteTime;
            UserPlayData.Instance.userGamePlayData.userCharacterData  = new System.Collections.Generic.Dictionary <int, UserCharacterData>();
            foreach (UserCharacterSaveData characterSaveData in playerData.userCharacterDatas)
            {
                var characterId = characterSaveData.characterId;
                if (!UserPlayData.Instance.userGamePlayData.userCharacterData.ContainsKey(characterId))
                {
                    UserPlayData.Instance.userGamePlayData.userCharacterData.Add(characterId, new UserCharacterData());
                    UserPlayData.Instance.userGamePlayData.userCharacterData[characterId].itemCountTable = new System.Collections.Generic.Dictionary <int, int>();
                }
                var itemId    = characterSaveData.itemId;
                var itemCount = characterSaveData.itemCount;
                UserPlayData.Instance.userGamePlayData.userCharacterData[characterId].itemCountTable.Add(itemId, itemCount);
            }
        }
        StartCoroutine("CharaSelectStart");
    }
예제 #3
0
    public void Update()
    {
        var userPlayData = UserPlayData.Instance;

        if (userPlayData.userGamePlayData != null && userPlayData.userGamePlayData.pleaseCommandFlg)
        {
            // 時間を経過しているのでデータをゲットする
            var pleaseTimeTextEnabled = userPlayData.userGamePlayData.pleaseCompleteTime.CompareTo(System.DateTime.Now) != -1;
            if (pleaseTimeTextEnabled)
            {
                var now = userPlayData.userGamePlayData.pleaseCompleteTime.Subtract(System.DateTime.Now);
                if (now != null)
                {
                    pleaseTimeText.text = now.Hours.ToString() + ":" + now.Minutes.ToString() + ":" + now.Seconds.ToString();
                }
            }
            else if (userPlayData.userGamePlayData != null)
            {
                // 初めてお願いしたキャラクターの場合
                var pleaseCharacterId = userPlayData.userGamePlayData.pleaseCharacterId;
                var pleaseItemId      = userPlayData.userGamePlayData.pleaseItemId;
                if (!userPlayData.userGamePlayData.userCharacterData.ContainsKey(pleaseCharacterId))
                {
                    var charaData = new UserCharacterData();
                    charaData.itemCountTable = new Dictionary <int, int>();
                    UserPlayData.Instance.userGamePlayData.userCharacterData.Add(pleaseCharacterId, charaData);
                }

                if (!userPlayData.userGamePlayData.userCharacterData[pleaseCharacterId].itemCountTable.ContainsKey(pleaseItemId))
                {
                    UserPlayData.Instance.userGamePlayData.userCharacterData[pleaseCharacterId].itemCountTable.Add(pleaseItemId, 1);
                }
                else
                {
                    UserPlayData.Instance.userGamePlayData.userCharacterData[pleaseCharacterId].itemCountTable[pleaseItemId] += 1;
                }
                UserPlayData.Instance.userGamePlayData.pleaseCommandFlg = false;
                DataBank bank = DataBank.Open();

                UserGameSaveData saveData = new UserGameSaveData();
                saveData.pleaseCharacterId         = UserPlayData.Instance.userGamePlayData.pleaseCharacterId;
                saveData.pleaseCommandFlg          = UserPlayData.Instance.userGamePlayData.pleaseCommandFlg;
                saveData.pleaseCompleteTime        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime;
                saveData.pleaseItemId              = UserPlayData.Instance.userGamePlayData.pleaseItemId;
                saveData.pleaseCompleteYear        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Year;
                saveData.pleaseCompleteMonth       = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Month;
                saveData.pleaseCompleteDay         = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Day;
                saveData.pleaseCompleteHour        = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Hour;
                saveData.pleaseCompleteMinute      = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Minute;
                saveData.pleaseCompleteSecond      = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Second;
                saveData.pleaseCompleteMilliSecond = UserPlayData.Instance.userGamePlayData.pleaseCompleteTime.Second;
                saveData.userCharacterDatas        = new List <UserCharacterSaveData>();
                foreach (KeyValuePair <int, UserCharacterData> userSaveData in UserPlayData.Instance.userGamePlayData.userCharacterData)
                {
                    foreach (KeyValuePair <int, int> itemCountTable in userSaveData.Value.itemCountTable)
                    {
                        var userCharacterSaveData = new UserCharacterSaveData();
                        userCharacterSaveData.characterId = userSaveData.Key;
                        userCharacterSaveData.itemId      = itemCountTable.Key;
                        userCharacterSaveData.itemCount   = itemCountTable.Value;
                        saveData.userCharacterDatas.Add(userCharacterSaveData);
                    }
                }
                bank.Store("userGamePlay", saveData);
                bank.SaveAll();
                pleaseBoardItemIcon.sprite = pleaseItemIcon.sprite;
                pleaseBoardCompleteRoot.SetActive(true);
            }
            pleaseBoardRoot.SetActive(pleaseTimeTextEnabled);
        }
    }