From 4a1404e212d4621c12e2b3a95e04e50cc64eb3e8 Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Tue, 13 May 2025 22:41:47 +0900 Subject: [PATCH 1/4] =?UTF-8?q?DEG-165=20[Fix]=20=EC=9D=B4=EC=A0=84=20?= =?UTF-8?q?=EB=B8=8C=EB=9E=9C=EC=B9=98=20=EB=B3=91=ED=95=A9=20=EC=9A=94?= =?UTF-8?q?=EC=86=8C=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../PlayerAction/PlayerActionAttack.cs | 2 +- Assets/JAY/Scripts/PlayerController.cs | 40 +++++++++++++++++++ Assets/KJM/KJM.unity | 4 +- Assets/KJM/KJM_Test/Save/TestScript.cs | 30 +++++++------- .../Upgrade/Prefabs/SaveManager.prefab | 3 ++ .../Upgrade/Prefabs/SaveManager.prefab.meta | 7 ++++ .../Upgrade/Prefabs/UpgradeManager.prefab | 3 ++ .../Prefabs/UpgradeManager.prefab.meta | 7 ++++ Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs | 16 +++++++- Assets/KSH/DungeonLogic.cs | 2 - Assets/KSH/DungeonPanelController.cs | 23 ++++++++++- Assets/KSH/PlayerStats.cs | 29 +++++++++++++- Assets/LYM/Scripts/ClearPanelController.cs | 1 + Assets/Scripts/Common/GameManager.cs | 31 +++++++++++++- 14 files changed, 172 insertions(+), 26 deletions(-) create mode 100644 Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab create mode 100644 Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab.meta create mode 100644 Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab create mode 100644 Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab.meta diff --git a/Assets/JAY/Scripts/PlayerAction/PlayerActionAttack.cs b/Assets/JAY/Scripts/PlayerAction/PlayerActionAttack.cs index 154d9f60..e0662afa 100644 --- a/Assets/JAY/Scripts/PlayerAction/PlayerActionAttack.cs +++ b/Assets/JAY/Scripts/PlayerAction/PlayerActionAttack.cs @@ -35,7 +35,7 @@ public class PlayerActionAttack : IPlayerAction { comboQueued = true; } - if (comboTimer >= comboDuration) { + if (comboTimer >= comboDuration-player.attackSpeedLevel) { ProceedComboOrEnd(); } } diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index b3720cfe..3af1b575 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -30,6 +30,12 @@ public class PlayerController : CharacterBase, IObserver private IPlayerAction _currentAction; public IPlayerAction CurrentAction => _currentAction; + // 강화 관련 + private float attackPowerLevel; + private float moveSpeedLevel; + private float dashCoolLevel; + public float attackSpeedLevel; + // 상태 관련 private PlayerStateIdle _playerStateIdle; private PlayerStateMove _playerStateMove; @@ -37,6 +43,12 @@ public class PlayerController : CharacterBase, IObserver private PlayerStateHit _playerStateHit; private PlayerStateDead _playerStateDead; + //대시 쿨타임 관련 + [SerializeField] private float dashCooldownDuration = 1.5f; + private float dashCooldownTimer = 0f; + public bool IsDashOnCooldown => dashCooldownTimer > 0f; + public float DashCooldownRatio => dashCooldownTimer / dashCooldownDuration; + // 행동 관련 private PlayerActionAttack _attackAction; private PlayerActionDash _actionDash; @@ -72,6 +84,20 @@ public class PlayerController : CharacterBase, IObserver hitEffectController = GetComponentInChildren(); PlayerInit(); + + //강화 수치 적용 + //attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2; + attackPowerLevel = 1.1f; + //moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2; + moveSpeedLevel = 1.1f; + //dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5; + dashCoolLevel = 0.2f; + //attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10; + attackSpeedLevel = 0.1f; + + attackPower *= attackPowerLevel; + moveSpeed *= moveSpeedLevel; + dashCooldownDuration -= dashCoolLevel; } private void Update() @@ -81,6 +107,10 @@ public class PlayerController : CharacterBase, IObserver _playerStates[CurrentState].Update(); } + //대시 쿨타임 진행 + if (dashCooldownTimer > 0f) + dashCooldownTimer -= Time.deltaTime; + // Hit 상태거나 게임 끝났을 땐 땐 입력 무시 if (CurrentState == PlayerState.Hit || CurrentState == PlayerState.Dead || CurrentState == PlayerState.Win) return; @@ -223,6 +253,13 @@ public class PlayerController : CharacterBase, IObserver { if (!_isBattle) return; + // 쿨타임 중이면 무시 + if (IsDashOnCooldown) + { + Debug.Log("대시 쿨타임 중"); + return; + } + _currentAction = _attackAction; _currentAction.StartAction(this); } @@ -244,6 +281,9 @@ public class PlayerController : CharacterBase, IObserver _currentAction = _actionDash; _actionDash.StartAction(this); + + // 쿨타임 시작 + dashCooldownTimer = dashCooldownDuration; } public void OnActionEnded(IPlayerAction action) diff --git a/Assets/KJM/KJM.unity b/Assets/KJM/KJM.unity index c0fd141b..cb936039 100644 --- a/Assets/KJM/KJM.unity +++ b/Assets/KJM/KJM.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:e4246afb41d86d6a92c3bcf1325630d7871a5e59255be61a927c5994dfc1ea81 -size 75255 +oid sha256:bde7a603bba4913552736fd24ee6f8ff6dbcd9511042ef8fc2f0880294387169 +size 78356 diff --git a/Assets/KJM/KJM_Test/Save/TestScript.cs b/Assets/KJM/KJM_Test/Save/TestScript.cs index 1d863d71..108cfffb 100644 --- a/Assets/KJM/KJM_Test/Save/TestScript.cs +++ b/Assets/KJM/KJM_Test/Save/TestScript.cs @@ -38,13 +38,13 @@ public class TestScript : MonoBehaviour,ISaveable // attackSpeedLevel = intValue; // heartLevel = intValue; // moveSpeedLevel = intValue; - stageLevel = intValue; + //stageLevel = intValue; - time = floatValue; - currentDay = intValue; - health = floatValue; - reputation = floatValue; + // time = floatValue; + // currentDay = intValue; + // health = floatValue; + // reputation = floatValue; mealCount = intValue; houseworkCount = intValue; @@ -64,15 +64,15 @@ public class TestScript : MonoBehaviour,ISaveable // heartLevel = save.dungeonSave.heartLevel; // moveSpeedLevel = save.dungeonSave.moveSpeedLevel; // dashCoolDownLevel = save.dungeonSave.dashCoolDownLevel; - stageLevel = save.dungeonSave.stageLevel; + //stageLevel = save.dungeonSave.stageLevel; } if (save?.homeSave != null) { - time = save.homeSave.time; - currentDay = save.homeSave.currentDay; - health = save.homeSave.health; - reputation = save.homeSave.reputation; + // time = save.homeSave.time; + // currentDay = save.homeSave.currentDay; + // health = save.homeSave.health; + // reputation = save.homeSave.reputation; mealCount = save.homeSave.mealCount; houseworkCount = save.homeSave.houseworkCount; @@ -95,16 +95,16 @@ public class TestScript : MonoBehaviour,ISaveable // heartLevel = this.heartLevel, // moveSpeedLevel = this.moveSpeedLevel, // dashCoolDownLevel = this.dashCoolDownLevel, - stageLevel = this.stageLevel, + //stageLevel = this.stageLevel, }, homeSave = new HomeSave { - time = this.time, - currentDay = this.currentDay, - health = this.health, - reputation = this.reputation, + // time = this.time, + // currentDay = this.currentDay, + // health = this.health, + // reputation = this.reputation, mealCount = this.mealCount, houseworkCount = this.houseworkCount } diff --git a/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab b/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab new file mode 100644 index 00000000..51ffd182 --- /dev/null +++ b/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:4ad0b15cfe6cefa2e27d326d363d8144f357d1b1879c5a3392581699f0bb54f6 +size 1858 diff --git a/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab.meta b/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab.meta new file mode 100644 index 00000000..3c01190a --- /dev/null +++ b/Assets/KJM/KJM_Test/Upgrade/Prefabs/SaveManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 322b2c3b468b7714ea61240f9ca7952b +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab b/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab new file mode 100644 index 00000000..3b685f42 --- /dev/null +++ b/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c2e7a0d966af4c7e6b8b16729c50291d61752e463b349333bbaf557dd1849790 +size 1999 diff --git a/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab.meta b/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab.meta new file mode 100644 index 00000000..8c795775 --- /dev/null +++ b/Assets/KJM/KJM_Test/Upgrade/Prefabs/UpgradeManager.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 903a43d31237e6d4cb31a9ad566f4481 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs b/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs index f7bf555e..db209224 100644 --- a/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs +++ b/Assets/KJM/KJM_Test/Upgrade/UpgradeManager.cs @@ -18,7 +18,6 @@ public enum StatType public class UpgradeManager : Singleton { - //캔버스 프리팹 사용..? Canvas canvas; public GameObject backgroundPanel; @@ -157,6 +156,18 @@ public class UpgradeManager : Singleton //배경 패널 비활성화 StartCoroutine(CoFade(backgroundRectTransform.gameObject, 0.7f,0f,0.2f)); + + if (SceneManager.GetActiveScene().name == "ReDungeon") + { + StartCoroutine(DelayedSceneChange()); // n초 대기 후 전환 + } + } + + //씬 전환 대기 코루틴 + private IEnumerator DelayedSceneChange() + { + yield return new WaitForSeconds(2f); + GameManager.Instance.ChangeToHomeScene(); } @@ -232,7 +243,8 @@ public class UpgradeManager : Singleton protected override void OnSceneLoaded(Scene scene, LoadSceneMode mode) { - + if(canvas == null) + canvas = FindObjectOfType(); } } diff --git a/Assets/KSH/DungeonLogic.cs b/Assets/KSH/DungeonLogic.cs index 1bc28af7..9a1251c0 100644 --- a/Assets/KSH/DungeonLogic.cs +++ b/Assets/KSH/DungeonLogic.cs @@ -114,8 +114,6 @@ public class DungeonLogic : MonoBehaviour // TODO: 강화 시스템으로 넘어가고 일상 맵으로 이동 GameManager.Instance.PanelManager.GetPanel("ClearPanelBG"); - - StartCoroutine(DelayedSceneChange()); // 5초 대기 후 전환 } } diff --git a/Assets/KSH/DungeonPanelController.cs b/Assets/KSH/DungeonPanelController.cs index 684b3e7a..4c645e8e 100644 --- a/Assets/KSH/DungeonPanelController.cs +++ b/Assets/KSH/DungeonPanelController.cs @@ -9,6 +9,25 @@ public class DungeonPanelController : MonoBehaviour [SerializeField] private Slider _bossHealthBar; // 0~1 value [SerializeField] private Image[] _playerHealthImages; // color 값 white / black 로 조정 private int _countHealth = 0; + private int visibleHeartCount = 3; // 강화 레벨로 설정됨 + + private void Start() + { + //int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3 + int level = 2; + + visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개 + + for (int i = 0; i < _playerHealthImages.Length; i++) + { + var color = _playerHealthImages[i].color; + color.a = (i < visibleHeartCount) ? 1f : 0f; + color = (i < visibleHeartCount) ? Color.white : new Color(1,1,1,0); + _playerHealthImages[i].color = color; + } + + _countHealth = 0; + } public void SetBossHealthBar(float hp) // hp: 0~300 { @@ -21,11 +40,11 @@ public class DungeonPanelController : MonoBehaviour { StartCoroutine(WaitForOneSecond()); // out of index error 방지 - if (_countHealth > _playerHealthImages.Length - 1) return false; + if (_countHealth >= visibleHeartCount) return false; _playerHealthImages[_countHealth].color = Color.black; _countHealth++; - return _countHealth <= _playerHealthImages.Length - 1; + return _countHealth < visibleHeartCount; } IEnumerator WaitForOneSecond() diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index ea614d58..7fd0e33d 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -5,7 +5,7 @@ using UnityEngine; using UnityEngine.SceneManagement; using Random = UnityEngine.Random; -public class PlayerStats : MonoBehaviour +public class PlayerStats : MonoBehaviour,ISaveable { public class StatsChangeData // 변경된 스탯 데이터 { @@ -385,4 +385,31 @@ public class PlayerStats : MonoBehaviour } #endregion + + public void ApplySaveData(Save save) + { + if (save?.homeSave != null) + { + TimeStat = save.homeSave.time; + HealthStat = save.homeSave.health; + ReputationStat = save.homeSave.reputation; + //mealCount = save.homeSave.mealCount; + //houseworkCount = save.homeSave.houseworkCount; + } + } + + public Save ExtractSaveData() + { + return new Save + { + homeSave = new HomeSave + { + time = this.TimeStat, + health = this.HealthStat, + reputation = this.ReputationStat, + //mealCount = this.mealCount, + //houseworkCount = this.houseworkCount + } + }; + } } diff --git a/Assets/LYM/Scripts/ClearPanelController.cs b/Assets/LYM/Scripts/ClearPanelController.cs index e79991d5..8de3197a 100644 --- a/Assets/LYM/Scripts/ClearPanelController.cs +++ b/Assets/LYM/Scripts/ClearPanelController.cs @@ -61,5 +61,6 @@ public class ClearPanelController : PanelController, IPointerClickHandler { onCompleted?.Invoke(); Hide(); + UpgradeManager.Instance.StartUpgrade(); } } \ No newline at end of file diff --git a/Assets/Scripts/Common/GameManager.cs b/Assets/Scripts/Common/GameManager.cs index 871d1795..85f65d7c 100644 --- a/Assets/Scripts/Common/GameManager.cs +++ b/Assets/Scripts/Common/GameManager.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement; -public partial class GameManager : Singleton +public partial class GameManager : Singleton,ISaveable { // 게임 진행 상태 private int currentDay = 1; // 날짜 @@ -109,4 +109,33 @@ public partial class GameManager : Singleton { // TODO: 게임 종료 시 로직 추가 } + + public void ApplySaveData(Save save) + { + if (save?.dungeonSave != null) + { + stageLevel = save.dungeonSave.stageLevel; + } + + if (save?.homeSave != null) + { + currentDay = save.homeSave.currentDay; + } + } + + public Save ExtractSaveData() + { + return new Save + { + dungeonSave = new DungeonSave() + { + stageLevel = this.stageLevel, + }, + + homeSave = new HomeSave + { + currentDay = this.currentDay, + } + }; + } } -- 2.47.1 From d8a4e6c28b438fca19571c77d81dbf0c190e387e Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Tue, 13 May 2025 22:45:36 +0900 Subject: [PATCH 2/4] =?UTF-8?q?DEG-165-[FIX]=20=EC=97=85=EA=B7=B8=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EB=93=9C=20=EB=A7=A4=EB=8B=88=EC=A0=80=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KSH/ReHousing.unity | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/KSH/ReHousing.unity b/Assets/KSH/ReHousing.unity index eb32bdf3..84fd83e2 100644 --- a/Assets/KSH/ReHousing.unity +++ b/Assets/KSH/ReHousing.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:8807affa9b2db75e9fd8568f3c15d629e1ba75392574134de08d6e970296acc3 -size 43883 +oid sha256:da4d76aa361f46ee82658b01e691ea3b7abf7828e05059c5414274239fc73e71 +size 46388 -- 2.47.1 From a61e3c4d09b808d00ef94a766a807e27589abf9b Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Wed, 14 May 2025 01:20:54 +0900 Subject: [PATCH 3/4] =?UTF-8?q?DEG-165=20=EC=98=88=EC=99=B8=EC=B2=98?= =?UTF-8?q?=EB=A6=AC=20=EB=B0=8F=20=EB=B2=84=EA=B7=B8=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/JAY/Scripts/PlayerController.cs | 26 +++++++++------------- Assets/KJM/KJM_Test/Save/Save.cs | 26 ++++++++++++++++++++-- Assets/KJM/KJM_Test/Save/SaveManager.cs | 19 +++++++++------- Assets/KJM/KJM_Test/Save/TestScript.cs | 8 +++---- Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs | 21 ++++++++--------- Assets/KSH/DungeonPanelController.cs | 3 +-- Assets/KSH/PlayerStats.cs | 18 +++++++-------- Assets/KSH/ReDungeon.unity | 4 ++-- Assets/KSH/ReHousing.unity | 4 ++-- Assets/Scripts/Common/GameManager.cs | 8 +++---- 10 files changed, 78 insertions(+), 59 deletions(-) diff --git a/Assets/JAY/Scripts/PlayerController.cs b/Assets/JAY/Scripts/PlayerController.cs index 3af1b575..82a34e05 100644 --- a/Assets/JAY/Scripts/PlayerController.cs +++ b/Assets/JAY/Scripts/PlayerController.cs @@ -86,14 +86,10 @@ public class PlayerController : CharacterBase, IObserver PlayerInit(); //강화 수치 적용 - //attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2; - attackPowerLevel = 1.1f; - //moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2; - moveSpeedLevel = 1.1f; - //dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5; - dashCoolLevel = 0.2f; - //attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10; - attackSpeedLevel = 0.1f; + attackPowerLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackPower) / 2; + moveSpeedLevel = 1 + (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.MoveSpeed) / 2; + dashCoolLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.DashCoolDown)/5; + attackSpeedLevel = (float)UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.AttackSpeed)/10; attackPower *= attackPowerLevel; moveSpeed *= moveSpeedLevel; @@ -253,13 +249,6 @@ public class PlayerController : CharacterBase, IObserver { if (!_isBattle) return; - // 쿨타임 중이면 무시 - if (IsDashOnCooldown) - { - Debug.Log("대시 쿨타임 중"); - return; - } - _currentAction = _attackAction; _currentAction.StartAction(this); } @@ -268,6 +257,13 @@ public class PlayerController : CharacterBase, IObserver { if (!_isBattle) return; + // 쿨타임 중이면 무시 + if (IsDashOnCooldown) + { + Debug.Log("대시 쿨타임 중"); + return; + } + // 만약 공격 중이면 강제로 공격 종료 if (_currentAction == _attackAction && _attackAction.IsActive) { diff --git a/Assets/KJM/KJM_Test/Save/Save.cs b/Assets/KJM/KJM_Test/Save/Save.cs index bebffded..a17dcde5 100644 --- a/Assets/KJM/KJM_Test/Save/Save.cs +++ b/Assets/KJM/KJM_Test/Save/Save.cs @@ -44,7 +44,6 @@ public class HomeSave //이벤트 public int mealCount = 999; - public int houseworkCount = 999; //병합을 위한 메서드 public void MergeWith(HomeSave other) @@ -56,7 +55,6 @@ public class HomeSave if (other.health < 999) health = other.health; if (other.reputation < 999) reputation = other.reputation; if (other.mealCount < 999) mealCount = other.mealCount; - if (other.houseworkCount < 999) houseworkCount = other.houseworkCount; } } @@ -66,4 +64,28 @@ public class Save { public HomeSave homeSave; public DungeonSave dungeonSave; + + public Save InitSave() + { + return new Save + { + homeSave = new HomeSave + { + currentDay = 1, + time = 8.0f, + health = 8.0f, + reputation = 2.0f, + mealCount = 0 + }, + dungeonSave = new DungeonSave + { + attackPowerLevel = 1, + attackSpeedLevel = 1, + heartLevel = 1, + moveSpeedLevel = 1, + dashCoolDownLevel = 1, + stageLevel = 1 + } + }; + } } \ No newline at end of file diff --git a/Assets/KJM/KJM_Test/Save/SaveManager.cs b/Assets/KJM/KJM_Test/Save/SaveManager.cs index e56c402c..bc18a2e3 100644 --- a/Assets/KJM/KJM_Test/Save/SaveManager.cs +++ b/Assets/KJM/KJM_Test/Save/SaveManager.cs @@ -103,14 +103,7 @@ public class SaveManager : Singleton { Debug.LogWarning("Backup 세이브 로드 실패: " + e.Message); - // 백업 시도 - if (QuickSaveRaw.Exists(MainSaveFilePath)) - { - Debug.LogWarning("메인 세이브로 복구 시도"); - return LoadMain(); - } - - // 메인도 없을 경우 새 세이브 생성 + // 새 세이브 생성 Debug.LogError("세이브 전체 손상 → 새 세이브 생성"); return CreateNewSave(); } @@ -184,5 +177,15 @@ public class SaveManager : Singleton Debug.Log("자동저장 되었습니다."); } + public void ResetSave() + { + Save fresh = new Save(); + mainSave = fresh.InitSave(); + backupSave = fresh.InitSave(); + SaveMain(); + SaveBackup(); + saveDataController.ApplySaveData(fresh); + } + } diff --git a/Assets/KJM/KJM_Test/Save/TestScript.cs b/Assets/KJM/KJM_Test/Save/TestScript.cs index 108cfffb..0f52da73 100644 --- a/Assets/KJM/KJM_Test/Save/TestScript.cs +++ b/Assets/KJM/KJM_Test/Save/TestScript.cs @@ -73,8 +73,8 @@ public class TestScript : MonoBehaviour,ISaveable // currentDay = save.homeSave.currentDay; // health = save.homeSave.health; // reputation = save.homeSave.reputation; - mealCount = save.homeSave.mealCount; - houseworkCount = save.homeSave.houseworkCount; + //mealCount = save.homeSave.mealCount; + //houseworkCount = save.homeSave.houseworkCount; Debug.Log("ApplySaveData : " + reputation); } @@ -105,8 +105,8 @@ public class TestScript : MonoBehaviour,ISaveable // currentDay = this.currentDay, // health = this.health, // reputation = this.reputation, - mealCount = this.mealCount, - houseworkCount = this.houseworkCount + //mealCount = this.mealCount, + //houseworkCount = this.houseworkCount } }; } diff --git a/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs b/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs index baf47f88..3d3c7328 100644 --- a/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs +++ b/Assets/KJM/KJM_Test/Upgrade/UpgradeStat.cs @@ -92,11 +92,11 @@ public class UpgradeStat : MonoBehaviour, ISaveable { dungeonSave = new DungeonSave { - attackPowerLevel = levels[StatType.AttackPower], - attackSpeedLevel = levels[StatType.AttackSpeed], - moveSpeedLevel = levels[StatType.MoveSpeed], - dashCoolDownLevel = levels[StatType.DashCoolDown], - heartLevel = levels[StatType.Heart] + attackPowerLevel = Mathf.Clamp(levels[StatType.AttackPower],1, DEFAULT_MAX), + attackSpeedLevel = Mathf.Clamp(levels[StatType.AttackSpeed],1, DEFAULT_MAX), + moveSpeedLevel = Mathf.Clamp(levels[StatType.MoveSpeed],1, DEFAULT_MAX), + dashCoolDownLevel = Mathf.Clamp(levels[StatType.DashCoolDown],1, DEFAULT_MAX), + heartLevel = Mathf.Clamp(levels[StatType.Heart],1, MAX_HEART) } }; } @@ -109,11 +109,12 @@ public class UpgradeStat : MonoBehaviour, ISaveable { if (save?.dungeonSave == null) return; - levels[StatType.AttackPower] = save.dungeonSave.attackPowerLevel; - levels[StatType.AttackSpeed] = save.dungeonSave.attackSpeedLevel; - levels[StatType.MoveSpeed] = save.dungeonSave.moveSpeedLevel; - levels[StatType.DashCoolDown] = save.dungeonSave.dashCoolDownLevel; - levels[StatType.Heart] = save.dungeonSave.heartLevel; + levels[StatType.AttackPower] = Mathf.Clamp(save.dungeonSave.attackPowerLevel,1, DEFAULT_MAX); + levels[StatType.AttackSpeed] = Mathf.Clamp(save.dungeonSave.attackSpeedLevel,1, DEFAULT_MAX); + levels[StatType.MoveSpeed] = Mathf.Clamp(save.dungeonSave.moveSpeedLevel,1, DEFAULT_MAX); + levels[StatType.DashCoolDown] = Mathf.Clamp(save.dungeonSave.dashCoolDownLevel,1, DEFAULT_MAX); + levels[StatType.Heart] = Mathf.Clamp(save.dungeonSave.heartLevel,1, MAX_HEART); + } } diff --git a/Assets/KSH/DungeonPanelController.cs b/Assets/KSH/DungeonPanelController.cs index 4c645e8e..1d460ba3 100644 --- a/Assets/KSH/DungeonPanelController.cs +++ b/Assets/KSH/DungeonPanelController.cs @@ -13,8 +13,7 @@ public class DungeonPanelController : MonoBehaviour private void Start() { - //int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3 - int level = 2; + int level = UpgradeManager.Instance.upgradeStat.CurrentUpgradeLevel(StatType.Heart); // 1~3 visibleHeartCount = 3 + (level - 1); // level 1=3개, 2=4개, 3=5개 diff --git a/Assets/KSH/PlayerStats.cs b/Assets/KSH/PlayerStats.cs index 7fd0e33d..83905c71 100644 --- a/Assets/KSH/PlayerStats.cs +++ b/Assets/KSH/PlayerStats.cs @@ -390,11 +390,10 @@ public class PlayerStats : MonoBehaviour,ISaveable { if (save?.homeSave != null) { - TimeStat = save.homeSave.time; - HealthStat = save.homeSave.health; - ReputationStat = save.homeSave.reputation; - //mealCount = save.homeSave.mealCount; - //houseworkCount = save.homeSave.houseworkCount; + TimeStat = Mathf.Clamp(save.homeSave.time, 0, _gameConstants.maxTime); + HealthStat = Mathf.Clamp(save.homeSave.health, 0, _gameConstants.maxHealth); + ReputationStat = Mathf.Clamp(save.homeSave.reputation, 0, _gameConstants.maxReputation); + _mealCount = Mathf.Clamp(save.homeSave.mealCount, 0, 2); } } @@ -404,11 +403,10 @@ public class PlayerStats : MonoBehaviour,ISaveable { homeSave = new HomeSave { - time = this.TimeStat, - health = this.HealthStat, - reputation = this.ReputationStat, - //mealCount = this.mealCount, - //houseworkCount = this.houseworkCount + time = Mathf.Clamp(this.TimeStat,0,_gameConstants.maxTime), + health = Mathf.Clamp(this.HealthStat,0,_gameConstants.maxHealth), + reputation = Mathf.Clamp(this.ReputationStat,0,_gameConstants.maxReputation), + mealCount = Mathf.Clamp(this._mealCount,0,2) } }; } diff --git a/Assets/KSH/ReDungeon.unity b/Assets/KSH/ReDungeon.unity index 2eff2973..40c41a6d 100644 --- a/Assets/KSH/ReDungeon.unity +++ b/Assets/KSH/ReDungeon.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:908889f0158f1e1ef86cf9a7ddeb607c5fab7b4afebf4418be91f18329a97003 -size 35082 +oid sha256:a1d61074bbb8366ae290687ea6dc34c30266acc9273be837f634593b70b6d8c4 +size 45432 diff --git a/Assets/KSH/ReHousing.unity b/Assets/KSH/ReHousing.unity index 84fd83e2..5515d1ac 100644 --- a/Assets/KSH/ReHousing.unity +++ b/Assets/KSH/ReHousing.unity @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:da4d76aa361f46ee82658b01e691ea3b7abf7828e05059c5414274239fc73e71 -size 46388 +oid sha256:b78f0bfed1d3d148a76f0032abb0e6f41226b5c3f91b6ff6b24d30c8eadad8ee +size 49095 diff --git a/Assets/Scripts/Common/GameManager.cs b/Assets/Scripts/Common/GameManager.cs index 85f65d7c..aa7a98c4 100644 --- a/Assets/Scripts/Common/GameManager.cs +++ b/Assets/Scripts/Common/GameManager.cs @@ -114,12 +114,12 @@ public partial class GameManager : Singleton,ISaveable { if (save?.dungeonSave != null) { - stageLevel = save.dungeonSave.stageLevel; + stageLevel = Mathf.Clamp(save.dungeonSave.stageLevel,1,2); } if (save?.homeSave != null) { - currentDay = save.homeSave.currentDay; + currentDay = Mathf.Clamp(save.homeSave.currentDay,1,maxDays); } } @@ -129,12 +129,12 @@ public partial class GameManager : Singleton,ISaveable { dungeonSave = new DungeonSave() { - stageLevel = this.stageLevel, + stageLevel = Mathf.Clamp(this.stageLevel,1,2), }, homeSave = new HomeSave { - currentDay = this.currentDay, + currentDay = Mathf.Clamp(this.currentDay,1,maxDays), } }; } -- 2.47.1 From 56ee17db2f5f083a3a9bb6deb9570ebfbcc41ce5 Mon Sep 17 00:00:00 2001 From: 99jamin <99jamin56@gmail.com> Date: Wed, 14 May 2025 01:36:24 +0900 Subject: [PATCH 4/4] =?UTF-8?q?DEG-165=20[Fix]=20=EC=84=B8=EC=9D=B4?= =?UTF-8?q?=EB=B8=8C=20=EA=B0=95=EC=A0=9C=20=EB=B3=80=ED=99=98=20=EC=98=88?= =?UTF-8?q?=EC=99=B8=20=EC=B2=98=EB=A6=AC=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/KJM/KJM_Test/Save/SaveManager.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Assets/KJM/KJM_Test/Save/SaveManager.cs b/Assets/KJM/KJM_Test/Save/SaveManager.cs index bc18a2e3..29e35767 100644 --- a/Assets/KJM/KJM_Test/Save/SaveManager.cs +++ b/Assets/KJM/KJM_Test/Save/SaveManager.cs @@ -112,7 +112,10 @@ public class SaveManager : Singleton //더미 세이브 파일 생성 private Save CreateNewSave() { - var fresh = saveDataController.GetSaveData(); + Save fresh = new Save(); + mainSave = fresh.InitSave(); + backupSave = fresh.InitSave(); + SaveMain(); SaveBackup(); return fresh; -- 2.47.1