| r182 vs r183 | ||
|---|---|---|
| ... | ... | |
| 397 | 397 | return false; |
| 398 | 398 | } |
| 399 | 399 | } }}} |
| 400 | ||
| 401 | {{{#!syntax csharp | |
| 402 | using UnityEngine; | |
| 403 | ||
| 404 | public class ExampleUsage : MonoBehaviour | |
| 405 | { | |
| 406 | private readonly string testPlayerName = "Gemini_Test_User"; | |
| 407 | private readonly int initialScore = 1000; | |
| 408 | private readonly int newScore = 5000; | |
| 409 | ||
| 410 | void Start() | |
| 411 | { | |
| 412 | if (SecureManager.Instance == null) | |
| 413 | { | |
| 414 | Debug.LogError("SecureManager 인스턴스를 찾을 수 없습니다. SecureManager.cs를 GameObject에 추가했는지 확인해주세요."); | |
| 415 | return; | |
| 416 | } | |
| 417 | SaveTestData(); | |
| 418 | ||
| 419 | LoadTestData(); | |
| 420 | ||
| 421 | UpdateAndSaveTestData(); | |
| 422 | ||
| 423 | LoadTestData(); | |
| 424 | } | |
| 425 | ||
| 426 | void SaveTestData() | |
| 427 | { | |
| 428 | Debug.Log("--- 1. 초기 데이터 저장 시도 ---"); | |
| 429 | PlayerData dataToSave = new PlayerData | |
| 430 | { | |
| 431 | playerName = testPlayerName, | |
| 432 | score = initialScore | |
| 433 | }; | |
| 434 | ||
| 435 | SecureManager.Instance.Save(dataToSave); | |
| 436 | Debug.Log($"초기 데이터 저장 완료: Player={dataToSave.playerName}, Score={dataToSave.score}"); | |
| 437 | } | |
| 438 | ||
| 439 | void LoadTestData() | |
| 440 | { | |
| 441 | Debug.Log("--- 2. 데이터 로드 시도 ---"); | |
| 442 | PlayerData loadedData = SecureManager.Instance.Load<PlayerData>(); | |
| 443 | ||
| 444 | if (loadedData != null) | |
| 445 | { | |
| 446 | Debug.Log($"데이터 로드 성공: Player={loadedData.playerName}, Score={loadedData.score}"); | |
| 447 | } | |
| 448 | else | |
| 449 | { | |
| 450 | Debug.LogWarning("데이터 로드 실패 (파일 없음, 오류 발생, 혹은 디버거 감지)."); | |
| 451 | } | |
| 452 | } | |
| 453 | ||
| 454 | void UpdateAndSaveTestData() | |
| 455 | { | |
| 456 | Debug.Log("--- 3. 데이터 업데이트 및 재저장 시도 ---"); | |
| 457 | PlayerData loadedData = SecureManager.Instance.Load<PlayerData>(); | |
| 458 | ||
| 459 | if (loadedData != null) | |
| 460 | { | |
| 461 | loadedData.score = newScore; | |
| 462 | SecureManager.Instance.Save(loadedData); | |
| 463 | Debug.Log($"데이터 업데이트 및 저장 완료: New Score={loadedData.score}"); | |
| 464 | } | |
| 465 | } | |
| 466 | ||
| 467 | void OnDestroy() | |
| 468 | { | |
| 469 | if (SecureManager.Instance != null && SecureManager.Instance.EnableAntiDebugChecks) | |
| 470 | { | |
| 471 | Debug.Log("SecureManager: Anti-Debug Checks가 활성화되어 있습니다."); | |
| 472 | } | |
| 473 | } | |
| 474 | } }}} |