Yohann Puyhaubert
4 年前
当前提交
460eb34c
共有 1109 个文件被更改,包括 4441 次插入 和 3609 次删除
-
5UOP1_Project/.gitignore
-
11UOP1_Project/Assets/AddressableAssetsData/AddressableAssetSettings.asset
-
16UOP1_Project/Assets/Art/Characters/PigChef/Animation/CaneHit.anim
-
14UOP1_Project/Assets/Art/Characters/PigChef/Animation/CaneHit2.anim
-
52UOP1_Project/Assets/Art/Characters/PigChef/Animation/PigChef.controller
-
976UOP1_Project/Assets/Art/Characters/PigChef/Animation/PigChef_Idle.fbx
-
10UOP1_Project/Assets/Art/Characters/Townsfolk_F/Animation/Townsfolk_F.overrideController
-
4UOP1_Project/Assets/Art/Characters/Townsfolk_M/Animation/Townsfolk_M.controller
-
33UOP1_Project/Assets/Art/Characters/Townsfolk_M/Animation/Townsfolk_Walk.fbx.meta
-
917UOP1_Project/Assets/Art/Characters/Townsfolk_M/Animation/Townsfolk_Talk.fbx
-
608UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab
-
1UOP1_Project/Assets/Prefabs/Managers/InventoryManager.prefab
-
15UOP1_Project/Assets/Prefabs/Managers/QuestManager.prefab
-
24UOP1_Project/Assets/Prefabs/Props/Door.prefab
-
118UOP1_Project/Assets/Prefabs/TownStructures/VillageHouse_Big.prefab
-
95UOP1_Project/Assets/Prefabs/TownStructures/VillageHouse_Small.prefab
-
13UOP1_Project/Assets/Scenes/Initialization.unity
-
998UOP1_Project/Assets/Scenes/Locations/Beach.unity
-
660UOP1_Project/Assets/Scenes/Locations/Forest.unity
-
174UOP1_Project/Assets/Scenes/Locations/Glade.unity
-
593UOP1_Project/Assets/Scenes/Menus/MainMenu.unity
-
963UOP1_Project/Assets/Scenes/WIP/ArtShowcase.unity
-
213UOP1_Project/Assets/Scenes/WIP/TestingGround.unity
-
7UOP1_Project/Assets/Scenes/Whiteboxing/GeneralMapMediumMultipleScenes/Materials/poster.mat
-
2UOP1_Project/Assets/ScriptableObjects/Audio/AudioConfigurations/2.5DSFX_Config.asset
-
2UOP1_Project/Assets/ScriptableObjects/Audio/AudioConfigurations/UISFX_Config.asset
-
10UOP1_Project/Assets/ScriptableObjects/SceneData/Gameplay.asset
-
12UOP1_Project/Assets/ScriptableObjects/SceneData/Initialization.asset
-
14UOP1_Project/Assets/ScriptableObjects/SceneData/Locations/Beach.asset
-
14UOP1_Project/Assets/ScriptableObjects/SceneData/Locations/Forest.asset
-
18UOP1_Project/Assets/ScriptableObjects/SceneData/Locations/Glade.asset
-
13UOP1_Project/Assets/ScriptableObjects/SceneData/Menus/MainMenu.asset
-
12UOP1_Project/Assets/ScriptableObjects/SceneData/PersistentManagers.asset
-
10UOP1_Project/Assets/ScriptableObjects/SceneData/WIP/ArtShowcase.asset
-
14UOP1_Project/Assets/ScriptableObjects/SceneData/WIP/TestingGround.asset
-
11UOP1_Project/Assets/Scripts/Audio/AudioCue.cs
-
101UOP1_Project/Assets/Scripts/Audio/AudioManager.cs
-
56UOP1_Project/Assets/Scripts/Audio/SoundEmitters/SoundEmitter.cs
-
11UOP1_Project/Assets/Scripts/Audio/SoundEmitters/SoundEmitterVault.cs
-
4UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/ControlWalkingParticlesActionSO.cs
-
2UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/DestroyEntitySO.cs
-
4UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayJumpParticlesActionSO.cs
-
4UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLandParticlesActionSO.cs
-
4UOP1_Project/Assets/Scripts/Characters/StateMachine/Actions/PlayLiftoffJumpParticlesActionSO.cs
-
4UOP1_Project/Assets/Scripts/Dialogues/DialogueDataSO.cs
-
91UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayEditor.cs
-
2UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayEditor.cs.meta
-
109UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayGizmos.cs
-
2UOP1_Project/Assets/Scripts/Editor/Pathway/PathwayGizmos.cs.meta
-
2UOP1_Project/Assets/Scripts/Editor/SceneSelector/SceneSelector.Data.cs
-
15UOP1_Project/Assets/Scripts/Editor/SceneSelector/SceneSelector.Helper.cs
-
2UOP1_Project/Assets/Scripts/Editor/SceneSelector/SceneSelector.PreferencesWindow.cs
-
42UOP1_Project/Assets/Scripts/Editor/SceneSelector/SceneSelector.cs
-
2UOP1_Project/Assets/Scripts/Events/ScriptableObjects/AudioCueEventChannelSO.cs
-
2UOP1_Project/Assets/Scripts/Events/ScriptableObjects/EventChannelBaseSO.cs.meta
-
4UOP1_Project/Assets/Scripts/Events/ScriptableObjects/LoadEventChannelSO.cs
-
4UOP1_Project/Assets/Scripts/Inventory/InventoryManager.cs
-
4UOP1_Project/Assets/Scripts/Inventory/ScriptableObjects/Item.cs
-
40UOP1_Project/Assets/Scripts/Pathway/Pathway.cs
-
35UOP1_Project/Assets/Scripts/SceneManagement/InitializationLoader.cs
-
233UOP1_Project/Assets/Scripts/SceneManagement/SceneLoader.cs
-
8UOP1_Project/Assets/Scripts/SceneManagement/SceneLoader.cs.meta
-
35UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/GameSceneSO.cs
-
5UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/GameplaySO.cs
-
3UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/LocationSO.cs
-
13UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/MenuSO.cs
-
2UOP1_Project/Assets/Scripts/SceneManagement/ScriptableObjects/PathSO.cs
-
62UOP1_Project/Assets/Scripts/SceneManagement/StartGame.cs
-
1UOP1_Project/Assets/Settings/Audio/DefaultAudioMixer.mixer
-
21UOP1_Project/ProjectSettings/EditorBuildSettings.asset
-
2UOP1_Project/ProjectSettings/ProjectSettings.asset
-
4UOP1_Project/Assets/Audio/SFX/Environment/Env_Campfire.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_13.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_12.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_11.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_10.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_09.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_08.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_07.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_06.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_05.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_04.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_03.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_02.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Footsteps/Grass/UOP_SD_SFX_Footsteps_Soft grass_01.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Grabbing_01.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Jump_Liftoff_01.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Jump_Liftoff_02.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Swing_Cane_01.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Swing_Cane_02.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Characters/Actions/Swing_Cane_03.wav.meta
-
31UOP1_Project/Assets/Scenes/Managers/PersistentManagers.unity
-
2UOP1_Project/Assets/ScriptableObjects/Audio/AudioCues/SFX/SFX_Footsteps_Grass.asset
-
124UOP1_Project/Assets/Scripts/Localization/Editor/LocalizeComponent_TMProFont.cs
-
66UOP1_Project/Assets/Scripts/Localization/Editor/LocalizeTMProFontEvent.cs
-
2UOP1_Project/Assets/Audio/SFX/Interface/Interface_01.wav.meta
-
2UOP1_Project/Assets/Audio/SFX/Interface/Interface_02.wav.meta
-
48Docs/WikiImages/AmbientSettings.png
-
150Docs/WikiImages/BakingSettings.png
976
UOP1_Project/Assets/Art/Characters/PigChef/Animation/PigChef_Idle.fbx
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
917
UOP1_Project/Assets/Art/Characters/Townsfolk_M/Animation/Townsfolk_Talk.fbx
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
608
UOP1_Project/Assets/Prefabs/Characters/PigChef.prefab
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
998
UOP1_Project/Assets/Scenes/Locations/Beach.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
660
UOP1_Project/Assets/Scenes/Locations/Forest.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
174
UOP1_Project/Assets/Scenes/Locations/Glade.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
963
UOP1_Project/Assets/Scenes/WIP/ArtShowcase.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
213
UOP1_Project/Assets/Scenes/WIP/TestingGround.unity
文件差异内容过多而无法显示
查看文件
文件差异内容过多而无法显示
查看文件
|
|||
using UnityEngine; |
|||
using UnityEditor; |
|||
using UnityEngine.AI; |
|||
using System.Collections.Generic; |
|||
public static void DrawHandlesPath(PathwayConfigSO pathway) |
|||
[DrawGizmo(GizmoType.Selected)] |
|||
private static void DrawGizmosSelected(Pathway pathway, GizmoType gizmoType) |
|||
EditorGUI.BeginChangeCheck(); |
|||
|
|||
List<Vector3> pathwayEditorDisplay = new List<Vector3>(); |
|||
|
|||
// Snap the waypoints on the NavMesh
|
|||
for (int i = 0; i < pathway.Waypoints.Count; i++) |
|||
if (!pathway.ToggledNavMeshDisplay) |
|||
NavMesh.SamplePosition(pathway.Waypoints[i], out NavMeshHit hit, 99.0f, NavMesh.AllAreas); |
|||
pathwayEditorDisplay.Add(hit.position); |
|||
DrawHandlesPath(pathway); |
|||
|
|||
// Only one waypoint use case.
|
|||
if (pathway.Waypoints.Count == 1) |
|||
else |
|||
DrawWaypointLabel(pathway, pathway.Waypoints, 0); |
|||
pathway.Waypoints[0] = Handles.PositionHandle(pathway.Waypoints[0], Quaternion.identity); |
|||
DrawNavMeshPath(pathway); |
|||
// All the other use cases where a path exists.
|
|||
for (int index = 0; index < pathway.Waypoints.Count && pathway.Waypoints.Count > 1; index++) |
|||
|
|||
DrawHitPoints(pathway); |
|||
} |
|||
|
|||
|
|||
private static void DrawLabel(Pathway pathway, Vector3 path, int index) |
|||
{ |
|||
GUIStyle style = new GUIStyle(); |
|||
Vector3 textHeight = Vector3.up; |
|||
|
|||
style.normal.textColor = pathway.TextColor; |
|||
style.fontSize = pathway.TextSize; |
|||
|
|||
Handles.Label(path + textHeight, index.ToString(), style); |
|||
} |
|||
|
|||
private static void DrawHandlesPath(Pathway pathway) |
|||
{ |
|||
Handles.color = pathway.LineColor; |
|||
|
|||
if (pathway.Waypoints.Count != 0) |
|||
int nextIndex = (index + 1) % pathway.Waypoints.Count; |
|||
DrawWaypointLabel(pathway, pathway.Waypoints, index); |
|||
List<Vector3> navMeshPath = new List<Vector3>(); |
|||
NavMeshPath navPath = new NavMeshPath(); |
|||
NavMesh.CalculatePath(pathwayEditorDisplay[index], pathwayEditorDisplay[nextIndex], NavMesh.AllAreas, navPath); |
|||
using (new Handles.DrawingScope(pathway.LineColor)) |
|||
DrawLabel(pathway, pathway.Waypoints[0].waypoint, 0); |
|||
|
|||
if (pathway.Waypoints.Count > 1) |
|||
for (int j = 0; j < navPath.corners.Length - 1; j++) |
|||
for (int i = 1; i < pathway.Waypoints.Count; i++) |
|||
Handles.DrawDottedLine(navPath.corners[j], navPath.corners[j + 1], 2); |
|||
DrawLabel(pathway, pathway.Waypoints[i].waypoint, i); |
|||
Handles.DrawDottedLine(pathway.Waypoints[i - 1].waypoint, pathway.Waypoints[i].waypoint, 2); |
|||
} |
|||
|
|||
if (pathway.Waypoints.Count > 2) |
|||
{ |
|||
Handles.DrawDottedLine(pathway.Waypoints[0].waypoint, pathway.Waypoints[pathway.Waypoints.Count - 1].waypoint, 2); |
|||
// Display handles pointing into the path forward direction (Blue handle)
|
|||
if (navPath.corners.Length > 1) |
|||
{ |
|||
pathway.Waypoints[index] = Handles.PositionHandle(pathway.Waypoints[index], Quaternion.LookRotation(navPath.corners[1] - navPath.corners[0])); |
|||
} |
|||
else |
|||
} |
|||
} |
|||
|
|||
private static void DrawNavMeshPath(Pathway pathway) |
|||
{ |
|||
Handles.color = pathway.LineColor; |
|||
|
|||
for (int i = 0; i < pathway.Path.Count - 1; i++) |
|||
{ |
|||
Handles.DrawLine(pathway.Path[i], pathway.Path[i + 1]); |
|||
|
|||
if (i < pathway.Waypoints.Count) |
|||
pathway.Waypoints[index] = Handles.PositionHandle(pathway.Waypoints[index], Quaternion.identity); |
|||
DrawLabel(pathway, pathway.Waypoints[i].waypoint, i); |
|||
private static void DrawWaypointLabel(PathwayConfigSO pathway, List<Vector3> path, int index) |
|||
private static void DrawHitPoints(Pathway pathway) |
|||
GUIStyle style = new GUIStyle(); |
|||
Vector3 textHeight = Vector3.up; |
|||
if (pathway.DisplayProbes) |
|||
{ |
|||
float sphereRadius = pathway.ProbeRadius; |
|||
style.normal.textColor = pathway.TextColor; |
|||
style.fontSize = pathway.TextSize; |
|||
|
|||
Handles.Label(path[index] + textHeight, index.ToString(), style); |
|||
for (int i = 0; i < pathway.Hits.Count; i++) |
|||
{ |
|||
if (pathway.Hits[i]) |
|||
{ |
|||
Gizmos.color = new Color(0, 255, 0, 0.5f); |
|||
Gizmos.DrawSphere(pathway.Waypoints[i].waypoint, sphereRadius); |
|||
} |
|||
else |
|||
{ |
|||
Gizmos.color = new Color(255, 0, 0, 0.5f); |
|||
Gizmos.DrawSphere(pathway.Waypoints[i].waypoint, sphereRadius); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|
|||
using UnityEngine; |
|||
using UnityEngine.AddressableAssets; |
|||
/// This class is a base class which contains what is common to all game scenes (Locations or Menus)
|
|||
/// This class is a base class which contains what is common to all game scenes (Locations, Menus, Managers)
|
|||
public class GameSceneSO : DescriptionBaseSO |
|||
{ |
|||
public GameSceneType sceneType; |
|||
public AssetReference sceneReference; //Used at runtime to load the scene from the right AssetBundle
|
|||
public AudioCueSO musicTrack; |
|||
public abstract partial class GameSceneSO : ScriptableObject |
|||
{ |
|||
[Header("Information")] |
|||
#if UNITY_EDITOR // See GameSceneSOEditor.cs
|
|||
public UnityEditor.SceneAsset sceneAsset; |
|||
#endif
|
|||
[HideInInspector] |
|||
public string scenePath; |
|||
[TextArea] public string shortDescription; |
|||
/// <summary>
|
|||
/// Used by the SceneSelector tool to discern what type of scene it needs to load
|
|||
/// </summary>
|
|||
public enum GameSceneType |
|||
{ |
|||
//Playable scenes
|
|||
Location, //SceneSelector tool will also load PersistentManagers and Gameplay
|
|||
Menu, //SceneSelector tool will also load Gameplay
|
|||
|
|||
//Special scenes
|
|||
Initialisation, |
|||
PersistentManagers, |
|||
Gameplay, |
|||
[Header("Sounds")] |
|||
public AudioClip music; |
|||
//Work in progress scenes that don't need to be played
|
|||
Art, |
|||
} |
|||
} |
|
|||
using TMPro; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Localization.Components; |
|||
|
|||
namespace UnityEditor.Localization.Plugins.TMPro |
|||
{ |
|||
internal static class LocalizeComponent_TMProFont |
|||
{ |
|||
[MenuItem("CONTEXT/TextMeshProUGUI/Localize String And Font")] |
|||
static void LocalizeTMProText(MenuCommand command) |
|||
{ |
|||
var target = command.context as TextMeshProUGUI; |
|||
SetupForStringLocalization(target); |
|||
SetupForFontLocalization(target); |
|||
} |
|||
|
|||
public static MonoBehaviour SetupForStringLocalization(TextMeshProUGUI target) |
|||
using TMPro; |
|||
using UnityEngine; |
|||
using UnityEngine.Events; |
|||
using UnityEngine.Localization.Components; |
|||
|
|||
namespace UnityEditor.Localization.Plugins.TMPro |
|||
{ |
|||
internal static class LocalizeComponent_TMProFont |
|||
{ |
|||
[MenuItem("CONTEXT/TextMeshProUGUI/Localize String And Font")] |
|||
static void LocalizeTMProText(MenuCommand command) |
|||
{ |
|||
var target = command.context as TextMeshProUGUI; |
|||
SetupForStringLocalization(target); |
|||
SetupForFontLocalization(target); |
|||
} |
|||
|
|||
public static MonoBehaviour SetupForStringLocalization(TextMeshProUGUI target) |
|||
if (target.GetComponent<LocalizeStringEvent>() != null) |
|||
return null; |
|||
|
|||
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeStringEvent)) as LocalizeStringEvent; |
|||
var setStringMethod = target.GetType().GetProperty("text").GetSetMethod(); |
|||
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<string>), target, setStringMethod) as UnityAction<string>; |
|||
Events.UnityEventTools.AddPersistentListener(comp.OnUpdateString, methodDelegate); |
|||
|
|||
const int kMatchThreshold = 5; |
|||
var foundKey = LocalizationEditorSettings.FindSimilarKey(target.text); |
|||
if (foundKey.collection != null && foundKey.matchDistance < kMatchThreshold) |
|||
{ |
|||
comp.StringReference.TableEntryReference = foundKey.entry.Id; |
|||
comp.StringReference.TableReference = foundKey.collection.TableCollectionNameReference; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public static MonoBehaviour SetupForFontLocalization(TextMeshProUGUI target) |
|||
if (target.GetComponent<LocalizeStringEvent>() != null) |
|||
return null; |
|||
|
|||
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeStringEvent)) as LocalizeStringEvent; |
|||
var setStringMethod = target.GetType().GetProperty("text").GetSetMethod(); |
|||
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<string>), target, setStringMethod) as UnityAction<string>; |
|||
Events.UnityEventTools.AddPersistentListener(comp.OnUpdateString, methodDelegate); |
|||
|
|||
const int kMatchThreshold = 5; |
|||
var foundKey = LocalizationEditorSettings.FindSimilarKey(target.text); |
|||
if (foundKey.collection != null && foundKey.matchDistance < kMatchThreshold) |
|||
{ |
|||
comp.StringReference.TableEntryReference = foundKey.entry.Id; |
|||
comp.StringReference.TableReference = foundKey.collection.TableCollectionNameReference; |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
|
|||
public static MonoBehaviour SetupForFontLocalization(TextMeshProUGUI target) |
|||
if (target.GetComponent<LocalizeTMProFontEvent>() != null) |
|||
return null; |
|||
|
|||
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeTMProFontEvent)) as LocalizeTMProFontEvent; |
|||
var setFontMethod = target.GetType().GetProperty("font").GetSetMethod(); |
|||
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<TMP_FontAsset>), target, setFontMethod) as UnityAction<TMP_FontAsset>; |
|||
if (target.GetComponent<LocalizeTMProFontEvent>() != null) |
|||
return null; |
|||
|
|||
var comp = Undo.AddComponent(target.gameObject, typeof(LocalizeTMProFontEvent)) as LocalizeTMProFontEvent; |
|||
var setFontMethod = target.GetType().GetProperty("font").GetSetMethod(); |
|||
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<TMP_FontAsset>), target, setFontMethod) as UnityAction<TMP_FontAsset>; |
|||
var collections = LocalizationEditorSettings.GetAssetTableCollections(); |
|||
foreach (var tableCollection in collections) |
|||
{ |
|||
if (tableCollection.name == "Fonts") |
|||
{ |
|||
comp.AssetReference.TableReference = tableCollection.TableCollectionNameReference; |
|||
foreach (var entry in tableCollection.SharedData.Entries) |
|||
{ |
|||
if (entry.Key == "font") |
|||
comp.AssetReference.TableEntryReference = entry.Id; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
} |
|||
var collections = LocalizationEditorSettings.GetAssetTableCollections(); |
|||
foreach (var tableCollection in collections) |
|||
{ |
|||
if (tableCollection.name == "Fonts") |
|||
{ |
|||
comp.AssetReference.TableReference = tableCollection.TableCollectionNameReference; |
|||
foreach (var entry in tableCollection.SharedData.Entries) |
|||
{ |
|||
if (entry.Key == "font") |
|||
comp.AssetReference.TableEntryReference = entry.Id; |
|||
} |
|||
} |
|||
} |
|||
|
|||
return null; |
|||
} |
|||
} |
|||
} |
|
|||
using System; |
|||
using TMPro; |
|||
using UnityEngine.Events; |
|||
|
|||
namespace UnityEngine.Localization.Components |
|||
using System; |
|||
using TMPro; |
|||
using UnityEditor.Localization; |
|||
using UnityEngine.Events; |
|||
|
|||
namespace UnityEngine.Localization.Components |
|||
/// <summary>
|
|||
/// Component that can be used to Localize a TMP_FontAsset asset.
|
|||
/// </summary>
|
|||
[AddComponentMenu("Localization/Asset/Localize TMPro Font Event")] |
|||
public class LocalizeTMProFontEvent : LocalizedAssetEvent<TMP_FontAsset, LocalizedTMProFont, UnityEventFont> |
|||
{ |
|||
} |
|||
|
|||
[Serializable] |
|||
public class LocalizedTMProFont : LocalizedAsset<TMP_FontAsset> { } |
|||
|
|||
[Serializable] |
|||
public class UnityEventFont : UnityEvent<TMP_FontAsset> { } |
|||
|
|||
|
|||
} |
|||
/// <summary>
|
|||
/// Component that can be used to Localize a TMP_FontAsset asset.
|
|||
/// </summary>
|
|||
[AddComponentMenu("Localization/Asset/Localize TMPro Font Event")] |
|||
public class LocalizeTMProFontEvent : LocalizedAssetEvent<TMP_FontAsset, LocalizedTMProFont, UnityEventFont> |
|||
{ |
|||
private void Reset() |
|||
{ |
|||
//Set up Unity Event automatically
|
|||
var target = GetComponent<TextMeshProUGUI>(); |
|||
var setFontMethod = target.GetType().GetProperty("font").GetSetMethod(); |
|||
var methodDelegate = System.Delegate.CreateDelegate(typeof(UnityAction<TMP_FontAsset>), target, setFontMethod) as UnityAction<TMP_FontAsset>; |
|||
UnityEditor.Events.UnityEventTools.AddPersistentListener(this.OnUpdateAsset, methodDelegate); |
|||
|
|||
//Set up font localize asset table automatically
|
|||
var collections = LocalizationEditorSettings.GetAssetTableCollections(); |
|||
foreach (var tableCollection in collections) |
|||
{ |
|||
if (tableCollection.name == "Fonts") |
|||
{ |
|||
this.AssetReference.TableReference = tableCollection.TableCollectionNameReference; |
|||
foreach (var entry in tableCollection.SharedData.Entries) |
|||
{ |
|||
if (entry.Key == "font") |
|||
this.AssetReference.TableEntryReference = entry.Id; |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
[Serializable] |
|||
public class LocalizedTMProFont : LocalizedAsset<TMP_FontAsset> { } |
|||
|
|||
[Serializable] |
|||
public class UnityEventFont : UnityEvent<TMP_FontAsset> { } |
|||
|
|||
|
|||
} |
部分文件因为文件数量过多而无法显示
撰写
预览
正在加载...
取消
保存
Reference in new issue