20261017
This commit is contained in:
1 parent
caf19faf09
commit
c4b10383f9
18 files changed
+3295
-1524
No files matched your search
@@ -0,0 +1,98 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!1 &1582993415978139043
|
||||
GameObject:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
serializedVersion: 6
|
||||
m_Component:
|
||||
- component: {fileID: 5858762196770789120}
|
||||
- component: {fileID: 6935294160548028746}
|
||||
m_Layer: 5
|
||||
m_Name: Space
|
||||
m_TagString: Untagged
|
||||
m_Icon: {fileID: 0}
|
||||
m_NavMeshLayer: 0
|
||||
m_StaticEditorFlags: 0
|
||||
m_IsActive: 1
|
||||
--- !u!224 &5858762196770789120
|
||||
RectTransform:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1582993415978139043}
|
||||
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
|
||||
m_LocalPosition: {x: 0, y: 0, z: 0}
|
||||
m_LocalScale: {x: 1, y: 1, z: 1}
|
||||
m_ConstrainProportionsScale: 0
|
||||
m_Children: []
|
||||
m_Father: {fileID: 0}
|
||||
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
|
||||
m_AnchorMin: {x: 0, y: 0}
|
||||
m_AnchorMax: {x: 0, y: 0}
|
||||
m_AnchoredPosition: {x: 0, y: 0}
|
||||
m_SizeDelta: {x: 0, y: 16}
|
||||
m_Pivot: {x: 0.5, y: 0.5}
|
||||
--- !u!212 &6935294160548028746
|
||||
SpriteRenderer:
|
||||
serializedVersion: 3
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 1582993415978139043}
|
||||
m_Enabled: 1
|
||||
m_CastShadows: 0
|
||||
m_ReceiveShadows: 0
|
||||
m_DynamicOccludee: 1
|
||||
m_StaticShadowCaster: 0
|
||||
m_MotionVectors: 1
|
||||
m_LightProbeUsage: 1
|
||||
m_ReflectionProbeUsage: 1
|
||||
m_RayTracingMode: 0
|
||||
m_RayTraceProcedural: 0
|
||||
m_RayTracingAccelStructBuildFlagsOverride: 0
|
||||
m_RayTracingAccelStructBuildFlags: 1
|
||||
m_SmallMeshCulling: 1
|
||||
m_ForceMeshLod: -1
|
||||
m_MeshLodSelectionBias: 0
|
||||
m_RenderingLayerMask: 1
|
||||
m_RendererPriority: 0
|
||||
m_Materials:
|
||||
- {fileID: 2100000, guid: 9dfc825aed78fcd4ba02077103263b40, type: 2}
|
||||
m_StaticBatchInfo:
|
||||
firstSubMesh: 0
|
||||
subMeshCount: 0
|
||||
m_StaticBatchRoot: {fileID: 0}
|
||||
m_ProbeAnchor: {fileID: 0}
|
||||
m_LightProbeVolumeOverride: {fileID: 0}
|
||||
m_ScaleInLightmap: 1
|
||||
m_ReceiveGI: 1
|
||||
m_PreserveUVs: 0
|
||||
m_IgnoreNormalsForChartDetection: 0
|
||||
m_ImportantGI: 0
|
||||
m_StitchLightmapSeams: 1
|
||||
m_SelectedEditorRenderState: 0
|
||||
m_MinimumChartSize: 4
|
||||
m_AutoUVMaxDistance: 0.5
|
||||
m_AutoUVMaxAngle: 89
|
||||
m_LightmapParameters: {fileID: 0}
|
||||
m_GlobalIlluminationMeshLod: 0
|
||||
m_SortingLayerID: 0
|
||||
m_SortingLayer: 0
|
||||
m_SortingOrder: 0
|
||||
m_MaskInteraction: 0
|
||||
m_Sprite: {fileID: 7482667652216324306, guid: 311925a002f4447b3a28927169b83ea6, type: 3}
|
||||
m_Color: {r: 1, g: 1, b: 1, a: 1}
|
||||
m_FlipX: 0
|
||||
m_FlipY: 0
|
||||
m_DrawMode: 0
|
||||
m_Size: {x: 1, y: 1}
|
||||
m_AdaptiveModeThreshold: 0.5
|
||||
m_SpriteTileMode: 0
|
||||
m_WasSpriteAssigned: 1
|
||||
m_SpriteSortPoint: 0
|
||||
m_BlendShapeWeights: []
|
||||
@@ -0,0 +1,7 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d8d7cc34b8d4ee44f827a4c8698a3f6a
|
||||
PrefabImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
+1311
-12
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7ac97578fd8d0fe4681f179f499959f3
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,56 @@
|
||||
%YAML 1.1
|
||||
%TAG !u! tag:unity3d.com,2011:
|
||||
--- !u!114 &11400000
|
||||
MonoBehaviour:
|
||||
m_ObjectHideFlags: 0
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_GameObject: {fileID: 0}
|
||||
m_Enabled: 1
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 15003, guid: 0000000000000000e000000000000000, type: 0}
|
||||
m_Name: Windows
|
||||
m_EditorClassIdentifier: UnityEditor.dll::UnityEditor.Build.Profile.BuildProfile
|
||||
m_AssetVersion: 2
|
||||
m_BuildTarget: 19
|
||||
m_Subtarget: 2
|
||||
m_PlatformId: 4e3c793746204150860bf175a9a41a05
|
||||
m_PlatformBuildProfile:
|
||||
rid: 2864545946587365382
|
||||
m_ActivePlatformGuid:
|
||||
m_AdditionalPlatformBuildSettings: []
|
||||
m_OverrideGlobalSceneList: 0
|
||||
m_Scenes: []
|
||||
m_HasScriptingDefines: 0
|
||||
m_ScriptingDefines: []
|
||||
m_PlayerSettingsYaml:
|
||||
m_Settings: []
|
||||
requiredComponents: []
|
||||
references:
|
||||
version: 2
|
||||
RefIds:
|
||||
- rid: 2864545946587365382
|
||||
type: {class: WindowsPlatformSettings, ns: UnityEditor.WindowsStandalone, asm: UnityEditor.WindowsStandalone.Extensions}
|
||||
data:
|
||||
m_Development: 0
|
||||
m_ConnectProfiler: 0
|
||||
m_BuildWithDeepProfilingSupport: 0
|
||||
m_BuildWithCodeCoverage: 0
|
||||
m_AllowDebugging: 0
|
||||
m_WaitForManagedDebugger: 0
|
||||
m_ManagedDebuggerFixedPort: 0
|
||||
m_ExplicitNullChecks: 0
|
||||
m_ExplicitDivideByZeroChecks: 0
|
||||
m_ExplicitArrayBoundsChecks: 0
|
||||
m_CompressionType: 0
|
||||
m_InstallInBuildFolder: 0
|
||||
m_InsightsSettingsContainer:
|
||||
m_BuildProfileEngineDiagnosticsState: 2
|
||||
m_AdaptivePerformanceEnabled: 0
|
||||
m_WindowsBuildAndRunDeployTarget: 0
|
||||
m_Architecture: 0
|
||||
m_CreateSolution: 0
|
||||
m_CopyPDBFiles: 0
|
||||
m_WindowsDevicePortalAddress:
|
||||
m_WindowsDevicePortalUsername:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 29c0f634dbd9659488cd9e95a75c2348
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d4fdb1aa5c67c794f8afc4a9916197df
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,52 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
// StartUI 與 InGame 共用的設定資料,存成 JSON
|
||||
[Serializable]
|
||||
public class GameSettings
|
||||
{
|
||||
// 貢獻者
|
||||
public string contributorID = "Anonymous";
|
||||
|
||||
// 一般設定
|
||||
public float sensitivity = 1.0f;
|
||||
public int fov = 90;
|
||||
|
||||
// 輔助設定 (0 = 無輔助, 1 = 直接移動準心, 2 = 動態靈敏度)
|
||||
public int assistMode = 0;
|
||||
public int assistStrength = 0; // 1~100 (%),無輔助時為 0
|
||||
public bool disableHorizontalAssist = false;
|
||||
public bool disableVerticalAssist = false;
|
||||
|
||||
// 系統資訊
|
||||
public int screenWidth;
|
||||
public int screenHeight;
|
||||
public int refreshRate;
|
||||
public string savedTime; // ISO 8601
|
||||
|
||||
// 檔案位置 : Windows 為 %USERPROFILE%/AppData/LocalLow/<公司>/<產品>/settings.json
|
||||
public static string FilePath => Path.Combine(Application.persistentDataPath, "settings.json");
|
||||
|
||||
public void Save()
|
||||
{
|
||||
File.WriteAllText(FilePath, JsonUtility.ToJson(this, true));
|
||||
}
|
||||
|
||||
// 讀不到檔案就回傳預設值
|
||||
public static GameSettings Load()
|
||||
{
|
||||
if (File.Exists(FilePath))
|
||||
{
|
||||
try
|
||||
{
|
||||
return JsonUtility.FromJson<GameSettings>(File.ReadAllText(FilePath));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogWarning($"讀取設定失敗,改用預設值 : {e.Message}");
|
||||
}
|
||||
}
|
||||
return new GameSettings();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5dff0267e33ca77449f74683ee4cce39
|
||||
@@ -0,0 +1,40 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using TMPro;
|
||||
|
||||
public class Fov : MonoBehaviour
|
||||
{
|
||||
[Header("UI 參照")]
|
||||
[Tooltip("Slider")]
|
||||
public Slider targetSlider;
|
||||
|
||||
[Tooltip("Text (TMP)")]
|
||||
public TextMeshProUGUI valueDisplayText;
|
||||
|
||||
[Header("預設值")]
|
||||
public int defaultFov = 90;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (targetSlider != null)
|
||||
{
|
||||
// 與 Apex 相同的範圍
|
||||
targetSlider.minValue = 70f;
|
||||
targetSlider.maxValue = 110f;
|
||||
targetSlider.wholeNumbers = true;
|
||||
targetSlider.value = defaultFov;
|
||||
|
||||
UpdateDisplayText(targetSlider.value);
|
||||
|
||||
targetSlider.onValueChanged.AddListener(UpdateDisplayText);
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateDisplayText(float val)
|
||||
{
|
||||
if (valueDisplayText != null)
|
||||
{
|
||||
valueDisplayText.text = $"FOV : {Mathf.RoundToInt(val)}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c01dc4b4f3335f04a892ab93a70c3e47
|
||||
@@ -0,0 +1,96 @@
|
||||
using System;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.SceneManagement;
|
||||
using TMPro;
|
||||
|
||||
public class SettingsSaver : MonoBehaviour
|
||||
{
|
||||
[Header("開始與同意書")]
|
||||
[Tooltip("開始 Button")]
|
||||
public Button startButton;
|
||||
|
||||
[Tooltip("同意書 Toggle,不勾就不能開始")]
|
||||
public Toggle consentToggle;
|
||||
|
||||
[Header("一般設定")]
|
||||
public IDManager idManager;
|
||||
public Slider sensitivitySlider;
|
||||
public Slider fovSlider;
|
||||
|
||||
[Header("輔助設定")]
|
||||
public TMP_Dropdown assistDropdown;
|
||||
public Slider assistStrengthSlider;
|
||||
public Toggle disableHorizontalToggle;
|
||||
public Toggle disableVerticalToggle;
|
||||
|
||||
[Header("場景")]
|
||||
[Tooltip("要切換到的場景名稱 (需加入 Build Profiles 的場景清單)")]
|
||||
public string gameSceneName = "InGame";
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (consentToggle != null)
|
||||
{
|
||||
consentToggle.onValueChanged.AddListener(OnConsentChanged);
|
||||
OnConsentChanged(consentToggle.isOn);
|
||||
}
|
||||
|
||||
if (startButton != null)
|
||||
{
|
||||
startButton.onClick.AddListener(OnStartClicked);
|
||||
}
|
||||
}
|
||||
|
||||
void OnConsentChanged(bool isOn)
|
||||
{
|
||||
if (startButton != null)
|
||||
{
|
||||
startButton.interactable = isOn;
|
||||
}
|
||||
}
|
||||
|
||||
void OnStartClicked()
|
||||
{
|
||||
if (consentToggle != null && !consentToggle.isOn) return;
|
||||
|
||||
GameSettings settings = CollectSettings();
|
||||
settings.Save();
|
||||
Debug.Log($"設定已存到 : {GameSettings.FilePath}");
|
||||
|
||||
if (Application.CanStreamedLevelBeLoaded(gameSceneName))
|
||||
{
|
||||
SceneManager.LoadScene(gameSceneName);
|
||||
}
|
||||
else
|
||||
{
|
||||
Debug.LogError($"找不到場景 \"{gameSceneName}\",請確認已加入 Build Profiles 的場景清單");
|
||||
}
|
||||
}
|
||||
|
||||
GameSettings CollectSettings()
|
||||
{
|
||||
GameSettings s = new GameSettings();
|
||||
|
||||
if (idManager != null) s.contributorID = idManager.GetFinalContributorID();
|
||||
|
||||
// 與 Sensitivity.cs 相同的 0.1 階梯
|
||||
if (sensitivitySlider != null) s.sensitivity = Mathf.Round(sensitivitySlider.value * 10f) / 10f;
|
||||
if (fovSlider != null) s.fov = Mathf.RoundToInt(fovSlider.value);
|
||||
|
||||
if (assistDropdown != null) s.assistMode = assistDropdown.value;
|
||||
if (assistStrengthSlider != null && s.assistMode != 0)
|
||||
{
|
||||
s.assistStrength = Mathf.RoundToInt(assistStrengthSlider.value);
|
||||
}
|
||||
if (disableHorizontalToggle != null) s.disableHorizontalAssist = disableHorizontalToggle.isOn;
|
||||
if (disableVerticalToggle != null) s.disableVerticalAssist = disableVerticalToggle.isOn;
|
||||
|
||||
s.screenWidth = Screen.width;
|
||||
s.screenHeight = Screen.height;
|
||||
s.refreshRate = Mathf.RoundToInt((float)Screen.currentResolution.refreshRateRatio.value);
|
||||
s.savedTime = DateTime.Now.ToString("o");
|
||||
|
||||
return s;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: ffe004b22c1ea624694aac6e673483d4
|
||||
@@ -0,0 +1,38 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
using UnityEngine.EventSystems;
|
||||
|
||||
// 掛在開始按鈕上 : 按鈕反灰時,滑鼠移上去會顯示提示
|
||||
public class StartButtonHint : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[Header("UI 參照")]
|
||||
[Tooltip("開始 Button")]
|
||||
public Button targetButton;
|
||||
|
||||
[Tooltip("提示物件 (例如寫著「請閱讀資訊欄並勾選同意書」的 Text 或 Panel)")]
|
||||
public GameObject hintObject;
|
||||
|
||||
void Start()
|
||||
{
|
||||
if (hintObject != null)
|
||||
{
|
||||
hintObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
if (hintObject != null && targetButton != null && !targetButton.interactable)
|
||||
{
|
||||
hintObject.SetActive(true);
|
||||
}
|
||||
}
|
||||
|
||||
public void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
if (hintObject != null)
|
||||
{
|
||||
hintObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4dee269d1934cff4eb46037a8108c44b
|
||||
File diff suppressed because it is too large.
Load diff
@@ -5,9 +5,12 @@ EditorBuildSettings:
|
||||
m_ObjectHideFlags: 0
|
||||
serializedVersion: 2
|
||||
m_Scenes:
|
||||
- enabled: 1
|
||||
- enabled: 0
|
||||
path: Assets/Scenes/MainScene.unity
|
||||
guid: 99c9720ab356a0642a771bea13969a05
|
||||
- enabled: 1
|
||||
path: Assets/Scenes/StartUI.unity
|
||||
guid: 87626c7027225264e966faafcd155421
|
||||
m_configObjects:
|
||||
com.unity.dt.app-ui: {fileID: 11400000, guid: 1b1c20d82303e4b5781c3ef50ac1449f, type: 2}
|
||||
com.unity.input.settings.actions: {fileID: -944628639613478452, guid: 052faaac586de48259a63d0c4782560b, type: 3}
|
||||
Binary file not shown.
Reference in new issue
Block a user