67 lines
3.2 KiB
C#
67 lines
3.2 KiB
C#
using UnityEngine;
|
|
|
|
namespace TKS
|
|
{
|
|
/// <summary>
|
|
/// 기기 설정(PD 2026-11-25 옵션 메뉴) — 소리 외의 설정 값(PlayerPrefs · 기기마다 · 세이브와 무관). 소리 = <see cref="Sound"/>(같은 PlayerPrefs 방식).
|
|
/// · 조작 방식: 0 = 직접 조준(기본 · 지금 방식 = 가고 싶은 쪽으로 끈다) · 1 = 슬링샷(당긴 반대쪽으로 날아간다)
|
|
/// · 언어: 글자 표의 언어 칸 이름(빈 값 = 한국어) — 바꾸면 <see cref="OutGame.UiText.Lang"/> 에 바로 넣는다
|
|
/// </summary>
|
|
public static class GameSettings
|
|
{
|
|
public const string KeyControl = "tks_set_control";
|
|
public const string KeyLang = "tks_set_lang";
|
|
public const int ControlDirect = 0;
|
|
public const int ControlSlingshot = 1;
|
|
|
|
public static int Control
|
|
{
|
|
get { return PlayerPrefs.GetInt(KeyControl, ControlDirect) == ControlSlingshot ? ControlSlingshot : ControlDirect; }
|
|
set { PlayerPrefs.SetInt(KeyControl, value == ControlSlingshot ? ControlSlingshot : ControlDirect); PlayerPrefs.Save(); }
|
|
}
|
|
|
|
/// <summary>
|
|
/// 슬링샷 조작이 지금 걸리는가 — 학습 판 안내(TutorialDirector.GuideOn · 첫 플레이의 안내 단계가 있는 판)의 끌기 손가락 · 맞춤은 직접 조준 기준이라 그 판 동안은 직접 조준.
|
|
/// (TutorialDirector 는 전투 관리자에 늘 붙어 있다 = Current 만으로는 학습 판인지 모른다 · 2026-11-25 실측)
|
|
/// </summary>
|
|
public static bool SlingshotActive
|
|
{
|
|
get
|
|
{
|
|
if (Control != ControlSlingshot) return false;
|
|
var tut = TutorialDirector.Current;
|
|
return tut == null || !tut.GuideOn;
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// 조준 손가락 자리 → 조준 계산에 넘길 자리: 직접 조준 = 그대로 · 슬링샷 = 유닛을 가운데로 뒤집은 자리(같은 거리 · 반대 방향)
|
|
/// = 화살표 · 이동 거리 · 판정 게이지 · 취소 반경 계산은 직접 조준과 똑같이 돌고 방향만 반대가 된다.
|
|
/// </summary>
|
|
public static Vector2 AimFinger(Vector2 unitPos, Vector2 finger)
|
|
{
|
|
return SlingshotActive ? unitPos * 2f - finger : finger;
|
|
}
|
|
|
|
/// <summary>표시 언어 코드(빈 값 = 기본 한국어).</summary>
|
|
public static string Language
|
|
{
|
|
get { return PlayerPrefs.GetString(KeyLang, ""); }
|
|
set
|
|
{
|
|
PlayerPrefs.SetString(KeyLang, value ?? "");
|
|
PlayerPrefs.Save();
|
|
OutGame.UiText.Lang = string.IsNullOrEmpty(value) ? OutGame.UiText.Fallback : value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Play 진입 · 앱 시작마다 저장된 언어를 글자 표에 건다(도메인 리로드를 끈 에디터 포함).</summary>
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
|
static void ApplyLanguage()
|
|
{
|
|
string l = PlayerPrefs.GetString(KeyLang, "");
|
|
OutGame.UiText.Lang = l.Length > 0 ? l : OutGame.UiText.Fallback;
|
|
}
|
|
}
|
|
}
|