13
13
using System . ComponentModel ;
14
14
using WPFCustomMessageBox ;
15
15
using System . Collections . Generic ;
16
+ using System . Windows . Media ;
16
17
using System . Runtime . InteropServices ;
17
18
18
19
namespace RiseQuestEditor
@@ -467,6 +468,7 @@ private void PopulateEditorFields()
467
468
QuestClient . Text = info . Client ;
468
469
QuestDesc . Text = info . Description ;
469
470
QuestTarget . Text = info . Target ;
471
+ QuestFail . Text = info . Fail ;
470
472
}
471
473
}
472
474
@@ -680,6 +682,7 @@ private void StoreEditorFields()
680
682
info . Client = QuestClient . Text ;
681
683
info . Description = QuestDesc . Text ;
682
684
info . Target = QuestTarget . Text ;
685
+ info . Fail = QuestFail . Text ;
683
686
text . QuestInfo [ i ] = info ;
684
687
685
688
break ;
@@ -733,7 +736,7 @@ private void StoreEditorFields()
733
736
data . SubTargets [ 3 ] = ( QuestTargetType ) ( int ) RampageSubTarget4 . SelectedValue ;
734
737
data . SubTargets [ 4 ] = ( QuestTargetType ) ( int ) RampageSubTarget5 . SelectedValue ;
735
738
data . SubTargets [ 5 ] = ( QuestTargetType ) ( int ) RampageSubTarget6 . SelectedValue ;
736
-
739
+
737
740
738
741
for ( int i = 0 ; i < 3 ; i ++ )
739
742
{
@@ -987,6 +990,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
987
990
info . Client = QuestClient . Text ;
988
991
info . Description = QuestDesc . Text ;
989
992
info . Target = QuestTarget . Text ;
993
+ info . Fail = QuestFail . Text ;
990
994
text . QuestInfo [ i ] = info ;
991
995
992
996
break ;
@@ -1006,6 +1010,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
1006
1010
QuestClient . Text = info . Client ;
1007
1011
QuestDesc . Text = info . Description ;
1008
1012
QuestTarget . Text = info . Target ;
1013
+ QuestFail . Text = info . Fail ;
1009
1014
1010
1015
break ;
1011
1016
}
@@ -1019,6 +1024,7 @@ private void GameLanguage_SelectionChanged(object sender, SelectionChangedEventA
1019
1024
QuestClient . Text = "" ;
1020
1025
QuestDesc . Text = "" ;
1021
1026
QuestTarget . Text = "" ;
1027
+ QuestFail . Text = "" ;
1022
1028
}
1023
1029
1024
1030
_selectedLanguage = newIndex ;
@@ -1118,6 +1124,62 @@ private void ApplyTextEditSize_Click(object sender, ExecutedRoutedEventArgs e)
1118
1124
}
1119
1125
}
1120
1126
}
1127
+
1128
+ private void ApplyTextEditColor_Click ( object sender , ExecutedRoutedEventArgs e )
1129
+ {
1130
+ if ( _customQuest != null )
1131
+ {
1132
+ TextBox ? textBox = GetSelectedTextBox ( ) ;
1133
+ if ( textBox != null )
1134
+ {
1135
+
1136
+ string text = textBox . Text ;
1137
+ int start = textBox . SelectionStart ;
1138
+ int end = start + textBox . SelectionLength ;
1139
+
1140
+ textBox . Text = $ "{ text [ ..start ] } <COLOR 000000>{ textBox . SelectedText } </COLOR>{ text [ end ..] } ";
1141
+ }
1142
+ }
1143
+ }
1144
+
1145
+ private void QuestInfo_SelectionChanged ( object sender , RoutedEventArgs e )
1146
+ {
1147
+ bool colorDisplayed = false ;
1148
+
1149
+ if ( _customQuest != null )
1150
+ {
1151
+ Regex regex = new ( @"<(COLOR|color) ([0-9a-fA-F]+)>[^<]*</(COLOR|color)>" ) ;
1152
+ TextBox ? textBox = GetSelectedTextBox ( ) ;
1153
+ if ( textBox != null )
1154
+ {
1155
+ Match match = regex . Match ( textBox . Text ) ;
1156
+ if ( match . Success )
1157
+ {
1158
+ int start = match . Index ;
1159
+ int end = start + match . Length ;
1160
+
1161
+ if ( textBox . SelectionStart >= start && textBox . SelectionStart + textBox . SelectionLength < end )
1162
+ {
1163
+ int color = int . Parse ( match . Groups [ 2 ] . Value , System . Globalization . NumberStyles . HexNumber ) ;
1164
+
1165
+ byte r = ( byte ) ( ( color & 0xFF0000 ) >> 0x10 ) ;
1166
+ byte g = ( byte ) ( ( color & 0x00FF00 ) >> 0x08 ) ;
1167
+ byte b = ( byte ) ( ( color & 0x0000FF ) >> 0x00 ) ;
1168
+
1169
+ ColorBox . Visibility = Visibility . Visible ;
1170
+ ColorBox . Fill = new SolidColorBrush ( Color . FromRgb ( r , g , b ) ) ;
1171
+ colorDisplayed = true ;
1172
+ }
1173
+ }
1174
+ }
1175
+ }
1176
+
1177
+ if ( ! colorDisplayed )
1178
+ {
1179
+ ColorBox . Visibility = Visibility . Hidden ;
1180
+ ColorBox . Fill = Brushes . White ;
1181
+ }
1182
+ }
1121
1183
}
1122
1184
1123
1185
public static class Command
0 commit comments