11using MEC ;
22using System . Collections . Generic ;
33using System . Reflection ;
4+ using YongAnFrame . Components ;
45
56namespace YongAnFrame . Players
67{
78 /// <summary>
89 /// 提示系统管理器
910 /// </summary>
10- public class HintManager
11+ public sealed class HintManager
1112 {
1213 /// <summary>
1314 /// 拥有该实例的框架玩家
@@ -17,11 +18,9 @@ public class HintManager
1718 private readonly CoroutineHandle coroutine ;
1819
1920
20- public Text [ ] CustomText1 = new Text [ 10 ] ;
21- public Text [ ] CustomText2 = new Text [ 20 ] ;
22- public List < Text > RoleText { get ; } = [ ] ;
23- public List < Text > MessageTexts { get ; } = [ ] ;
24- public List < Text > ChatTexts { get ; } = [ ] ;
21+ public Text [ ] CustomText = new Text [ 20 ] ;
22+ public CapacityList < Text > MessageTexts { get ; } = new ( 7 ) ;
23+ public CapacityList < Text > ChatTexts { get ; } = new ( 6 ) ;
2524 public HintManager ( FramePlayer player )
2625 {
2726 fPlayer = player ;
@@ -37,25 +36,9 @@ public IEnumerator<float> Update()
3736 int usedMex = text . Length - 1 ;
3837 int used = 0 ;
3938 text [ used ] = $ "YongAnFrame 1.0.0-alpha6";
40- used ++ ;
39+ used = 1 ;
4140 text [ used ] = "<align=left>" ;
42- used ++ ;
43- foreach ( string data in CustomText1 )
44- {
45- text [ used ] = data ?? string . Empty ;
46- used ++ ;
47- }
48- used ++ ;
4941
50- if ( ChatTexts . Count > 28 - used )
51- {
52- for ( int i = 0 ; i < ChatTexts . Count - ( 28 - used ) ; i ++ )
53- {
54- ChatTexts . Remove ( ChatTexts [ i ] ) ;
55- }
56- }
57-
58- used = 22 ;
5942 for ( int i = 0 ; i < ChatTexts . Count ; i ++ )
6043 {
6144 Text textData = ChatTexts [ i ] ;
@@ -71,16 +54,13 @@ public IEnumerator<float> Update()
7154 }
7255 }
7356
74- used = 29 ;
75-
76- if ( usedMex - RoleText . Count < used + MessageTexts . Count + 1 )
57+ foreach ( Text data in CustomText )
7758 {
78- for ( int i = 0 ; i < usedMex - RoleText . Count - ( used + MessageTexts . Count + 1 ) ; i ++ )
79- {
80- MessageTexts . Remove ( MessageTexts [ i ] ) ;
81- }
59+ text [ used ] = data ?? string . Empty ;
60+ used ++ ;
8261 }
8362
63+
8464 for ( int i = 0 ; i < MessageTexts . Count ; i ++ )
8565 {
8666 Text messageText = MessageTexts [ i ] ;
@@ -94,22 +74,14 @@ public IEnumerator<float> Update()
9474 }
9575 }
9676
97- used = usedMex - RoleText . Count ;
9877 text [ used ] += "</align>" ;
9978
100- foreach ( Text roleText in RoleText )
79+ if ( fPlayer . CustomRolePlus != null )
10180 {
102- text [ used ] += roleText ;
103- used ++ ;
104- }
105-
106- for ( int i = 0 ; i < usedMex ; i ++ )
107- {
108- if ( string . IsNullOrEmpty ( text [ i ] ) )
109- {
110- text [ i ] = "<color=#00000000>占</color>" ;
111- }
81+ text [ 34 ] = fPlayer . CustomRolePlus . Name ;
82+ text [ 35 ] = fPlayer . CustomRolePlus . Description ;
11283 }
84+
11385 fPlayer . ExPlayer . ShowHint ( $ "<size=20>{ string . Join ( "\n " , text ) } \n \n \n \n \n \n \n \n \n \n \n \n \n \n </size>", 2f ) ;
11486 yield return Timing . WaitForSeconds ( 1f ) ;
11587 }
@@ -144,19 +116,5 @@ public static implicit operator Text(string text)
144116 return new Text ( text , - 1 ) ;
145117 }
146118 }
147- public struct Registry
148- {
149- public Assembly Assembly { get ; }
150- public int StartLineNum { get ; }
151- public int EndLineNum { get ; }
152- public int LineNum => EndLineNum - StartLineNum + 1 ;
153-
154- public Registry ( Assembly assembly , int startLineNum , int endLineNum )
155- {
156- Assembly = assembly ;
157- StartLineNum = startLineNum ;
158- EndLineNum = endLineNum ;
159- }
160- }
161119 }
162120}
0 commit comments