示例#1
0
        private void Awake()
        {
            Logger   = base.Logger;
            Instance = this;

            ShowSubtitles = Config.Bind("Config", "Show Subtitles", true, new ConfigDescription("Enable or disable showing subtitles.", null, new ConfigurationManagerAttributes {
                Order = 11
            }));
            SubtitleDirectory = Config.Bind("Config", "Subtitle Directory", $"Translation\\{PluginNameInternal}", new ConfigDescription("Directory containing subtitle xml info, relative to the BepInEx folder.", null, new ConfigurationManagerAttributes {
                Order = 10
            }));
            FontSize = Config.Bind("Config", "Font Size", -5, new ConfigDescription("Font size of subtitles.", null, new ConfigurationManagerAttributes {
                Order = 9
            }));
            FontStyle = Config.Bind("Config", "Font Style", UnityEngine.FontStyle.Bold, new ConfigDescription("Font style of subtitles, i.e. bold, italic, etc.", null, new ConfigurationManagerAttributes {
                Order = 8
            }));
            TextAlign = Config.Bind("Config", "Text Align", TextAnchor.LowerCenter, new ConfigDescription("Text alignment of subtitles.", null, new ConfigurationManagerAttributes {
                Order = 7
            }));
            TextVerticalOffset = Config.Bind("Config", "Text Vertical Offset", 10, new ConfigDescription("Distance from top and bottom edges of the screen.", null, new ConfigurationManagerAttributes {
                Order = 5
            }));
            TextHorizontalOffset = Config.Bind("Config", "Text Horizontal Offset", 10, new ConfigDescription("Distance from left and right edges of the screen.", null, new ConfigurationManagerAttributes {
                Order = 6
            }));
            OutlineThickness = Config.Bind("Config", "Outline Thickness", 2, new ConfigDescription("Outline thickness for subtitle text.", null, new ConfigurationManagerAttributes {
                Order = 4
            }));
#if !PC
            TextColor = Config.Bind("Config", "Text Color", UnityEngine.ColorUtility.TryParseHtmlString("#FFCCFFFF", out Color color) ? color : Color.magenta, new ConfigDescription("Subtitle text color.", null, new ConfigurationManagerAttributes {
                Order = 3
            }));
            OutlineColor = Config.Bind("Config", "Outline Color", Color.black, new ConfigDescription("Subtitle text outline color.", null, new ConfigurationManagerAttributes {
                Order = 2
            }));
            VRTextOffset = Config.Bind("VR", "VR Text Offset", new Vector3(-0.1f * WorldScale, -0.1f * WorldScale, 0.5f * WorldScale), new ConfigDescription("Subtitle text position in VR.", null, new ConfigurationManagerAttributes {
                Order = 1
            }));
            VRText2Offset = Config.Bind("VR", "VR Text 2 Offset", new Vector3(0.1f * WorldScale, -0.2f * WorldScale, 0.5f * WorldScale), new ConfigDescription("Subtitle text position in VR. For 3P when two subtitles may be displayed at once.", null, new ConfigurationManagerAttributes {
                Order = 0
            }));
#endif
            TextAlign.SettingChanged += TextAlign_SettingChanged;

            LoadSubtitles();

            Harmony.CreateAndPatchAll(typeof(Hooks));

#if !HS && !PC
            SceneManager.sceneLoaded   += Caption.SceneLoaded;
            SceneManager.sceneUnloaded += Caption.SceneUnloaded;
#endif
        }
示例#2
0
        internal void Awake()
        {
            Logger   = base.Logger;
            Instance = this;

            ShowSubtitles = Config.Bind("Config", "Show Subtitles", true, new ConfigDescription("Enable or disable showing subtitles.", null, new ConfigurationManagerAttributes {
                Order = 10
            }));
            SubtitleDirectory = Config.Bind("Config", "Subtitle Directory", $"Translation\\{PluginNameInternal}", new ConfigDescription("Directory containing subtitle xml info, relative to the BepInEx folder.", null, new ConfigurationManagerAttributes {
                Order = 9
            }));
            FontSize = Config.Bind("Config", "Font Size", -5, new ConfigDescription("Font size of subtitles.", null, new ConfigurationManagerAttributes {
                Order = 8
            }));
            FontStyle = Config.Bind("Config", "Font Style", UnityEngine.FontStyle.Bold, new ConfigDescription("Font style of subtitles, i.e. bold, italic, etc.", null, new ConfigurationManagerAttributes {
                Order = 7
            }));
            TextAlign = Config.Bind("Config", "Text Align", TextAnchor.LowerCenter, new ConfigDescription("Text alignment of subtitles.", null, new ConfigurationManagerAttributes {
                Order = 6
            }));
            TextOffset = Config.Bind("Config", "Text Offset", 10, new ConfigDescription("Distance from edge of the screen.", null, new ConfigurationManagerAttributes {
                Order = 5
            }));
            OutlineThickness = Config.Bind("Config", "Outline Thickness", 2, new ConfigDescription("Outline thickness for subtitle text.", null, new ConfigurationManagerAttributes {
                Order = 4
            }));
            TextColor = Config.Bind("Config", "Text Color", ColorUtility.TryParseHtmlString("#FFCCFFFF", out Color color) ? color : Color.magenta, new ConfigDescription("Subtitle text color.", null, new ConfigurationManagerAttributes {
                Order = 3
            }));
            OutlineColor = Config.Bind("Config", "Outline Color", Color.black, new ConfigDescription("Subtitle text outline color.", null, new ConfigurationManagerAttributes {
                Order = 2
            }));

            TextAlign.SettingChanged += TextAlign_SettingChanged;

            LoadSubtitles();

            HarmonyWrapper.PatchAll(typeof(Hooks));
        }