55 using System . Linq ;
66
77 using Exiled . Loader ;
8+ using EffectDisplay . Features . Sereliazer ;
89
10+ /// <summary>
11+ /// Provides work with the service by providing hints for multi-transmissions
12+ /// </summary>
913 public class MeowHintManager
1014 {
1115 private static Assembly meowhints ;
@@ -14,7 +18,7 @@ public class MeowHintManager
1418 private Type VerticalAligmentType ;
1519 private object HintInstance ;
1620 /// <summary>
17- /// Creates all the necessary types to work with HintServiceMeow
21+ /// Creates an instance of a class without any default settings.
1822 /// </summary>
1923 public MeowHintManager ( )
2024 {
@@ -32,7 +36,67 @@ public MeowHintManager()
3236 if ( VerticalAligmentType == null | ! VerticalAligmentType . IsEnum ) throw new Exception ( "HintVerticalAligment not found or is not Enum type" ) ;
3337 }
3438 /// <summary>
35- /// Exposes a parameter to the main Hint instance with the appropriate name
39+ /// Creates an instance of a class with preset parameters that can be retrieved without extra methods
40+ /// </summary>
41+ /// <param name="text">Hint text</param>
42+ /// <param name="fontsize">Text font size</param>
43+ /// <param name="valign">Vertical aligment (Left, Center, Right)</param>
44+ /// <param name="halign">Horizontal aligment (Top, Middle, Bottom)</param>
45+ /// <param name="y">Y Coordinate position (0 : 1080)</param>
46+ /// <param name="x">X Coordinate position (-1200 : 1200)</param>
47+ /// <param name="id">Hint work id</param>
48+ public MeowHintManager ( string text , int fontsize = 16 , string valign = "Center" , string halign = "Middle" , int y = 0 , int x = 0 , string id = "HintGeneration" )
49+ {
50+ if ( meowhints == null )
51+ {
52+ meowhints = Loader . Plugins . Where ( xp => xp . Name == "HintServiceMeow" ) . FirstOrDefault ( ) . Assembly ;
53+ }
54+ if ( meowhints == null ) throw new Exception ( "Assembly HintServiceMeow not loaded in Exiled plugins" ) ;
55+ Hint = meowhints . GetType ( "HintServiceMeow.Core.Models.Hints.Hint" , false ) ;
56+ if ( Hint == null ) throw new Exception ( "Type Hint not found" ) ;
57+ HintInstance = Activator . CreateInstance ( Hint ) ;
58+ HorizantalAligmentType = meowhints . GetType ( "HintServiceMeow.Core.Enum.HintAlignment" ) ;
59+ if ( HorizantalAligmentType == null | ! HorizantalAligmentType . IsEnum ) throw new Exception ( "HintAligment not found or is not Enum type" ) ;
60+ VerticalAligmentType = meowhints . GetType ( "HintServiceMeow.Core.Enum.HintVerticalAlign" ) ;
61+ if ( VerticalAligmentType == null | ! VerticalAligmentType . IsEnum ) throw new Exception ( "HintVerticalAligment not found or is not Enum type" ) ;
62+ SetText ( text ) ;
63+ SetFont ( fontsize ) ;
64+ SetVerticalAligment ( valign ) ;
65+ SetHorizontalAligment ( halign ) ;
66+ SetId ( id ) ;
67+ SetXCoordinate ( x ) ;
68+ SetYCoordinates ( y ) ;
69+ }
70+ /// <summary>
71+ /// Creates an instance of a class with predefined parameters from <see cref="MeowHintSettings"/>
72+ /// </summary>
73+ /// <param name="text">Hint text</param>
74+ /// <param name="id">Hint work id</param>
75+ /// <param name="settings">Class providing settings</param>
76+ public MeowHintManager ( string text , string id , MeowHintSettings settings )
77+ {
78+ if ( meowhints == null )
79+ {
80+ meowhints = Loader . Plugins . Where ( xp => xp . Name == "HintServiceMeow" ) . FirstOrDefault ( ) . Assembly ;
81+ }
82+ if ( meowhints == null ) throw new Exception ( "Assembly HintServiceMeow not loaded in Exiled plugins" ) ;
83+ Hint = meowhints . GetType ( "HintServiceMeow.Core.Models.Hints.Hint" , false ) ;
84+ if ( Hint == null ) throw new Exception ( "Type Hint not found" ) ;
85+ HintInstance = Activator . CreateInstance ( Hint ) ;
86+ HorizantalAligmentType = meowhints . GetType ( "HintServiceMeow.Core.Enum.HintAlignment" ) ;
87+ if ( HorizantalAligmentType == null | ! HorizantalAligmentType . IsEnum ) throw new Exception ( "HintAligment not found or is not Enum type" ) ;
88+ VerticalAligmentType = meowhints . GetType ( "HintServiceMeow.Core.Enum.HintVerticalAlign" ) ;
89+ if ( VerticalAligmentType == null | ! VerticalAligmentType . IsEnum ) throw new Exception ( "HintVerticalAligment not found or is not Enum type" ) ;
90+ SetText ( text ) ;
91+ SetFont ( settings . FontSize ) ;
92+ SetVerticalAligment ( settings . VerticalAligment ) ;
93+ SetHorizontalAligment ( settings . Aligment ) ;
94+ SetId ( id ) ;
95+ SetXCoordinate ( settings . XCoordinate ) ;
96+ SetYCoordinates ( settings . YCoordinate ) ;
97+ }
98+ /// <summary>
99+ /// Sets the text size parameter in the working class hint
36100 /// </summary>
37101 public void SetFont ( int FontSize )
38102 {
@@ -46,7 +110,7 @@ public void SetFont(int FontSize)
46110 }
47111 }
48112 /// <summary>
49- /// Exposes a parameter to the main Hint instance with the appropriate name
113+ /// Sets the text parameter that will be displayed
50114 /// </summary>
51115 public void SetText ( string Text )
52116 {
@@ -60,8 +124,9 @@ public void SetText(string Text)
60124 }
61125 }
62126 /// <summary>
63- /// Exposes a parameter to the main Hint instance with the appropriate name
127+ /// Sets horizontal alignment
64128 /// </summary>
129+ /// <param name="aligment">Left, Center, Right</param>
65130 public void SetHorizontalAligment ( string aligment )
66131 {
67132 try
@@ -72,9 +137,9 @@ public void SetHorizontalAligment(string aligment)
72137 catch { }
73138 }
74139 /// <summary>
75- /// Exposes a parameter to the main Hint instance with the appropriate name
140+ /// Sets vertical alignment
76141 /// </summary>
77- /// <param name="aligment"></param>
142+ /// <param name="aligment">Top, Bottom, Middle </param>
78143 public void SetVerticalAligment ( string aligment )
79144 {
80145 try
@@ -85,8 +150,9 @@ public void SetVerticalAligment(string aligment)
85150 catch { }
86151 }
87152 /// <summary>
88- /// Exposes a parameter to the main Hint instance with the appropriate name
153+ /// Takes a position in relation to Y
89154 /// </summary>
155+ /// <param name="y">0 -> 1080</param>
90156 public void SetYCoordinates ( int y )
91157 {
92158 try
@@ -98,6 +164,10 @@ public void SetYCoordinates(int y)
98164
99165 }
100166 }
167+ /// <summary>
168+ /// Takes a position in relation to X
169+ /// </summary>
170+ /// <param name="x">-1200 -> 1200</param>
101171 public void SetXCoordinate ( int x )
102172 {
103173 try
@@ -110,7 +180,7 @@ public void SetXCoordinate(int x)
110180 }
111181 }
112182 /// <summary>
113- /// Exposes a parameter to the main Hint instance with the appropriate name
183+ /// Sets a unique identifier for the displayed hint message.
114184 /// </summary>
115185 public void SetId ( string id )
116186 {
@@ -137,6 +207,11 @@ private void SetProperty(string name, object value)
137207 if ( HintInstance == null ) return ;
138208 HintInstance . GetType ( ) . GetProperty ( name ) ? . SetValue ( HintInstance , value , null ) ;
139209 }
210+ private object GetPropertyValue ( string name )
211+ {
212+ if ( HintInstance == null ) return null ;
213+ return HintInstance . GetType ( ) . GetProperty ( name ) ? . GetValue ( HintInstance , null ) ;
214+ }
140215 /// <summary>
141216 /// uses the extension method from HintServiceMeow to add an object Hint"/>
142217 /// </summary>
0 commit comments