@@ -102,6 +102,7 @@ public TriggersWindow(WindowManager windowManager, Map map, EditorState editorSt
102102 private SelectStringWindow selectStringWindow ;
103103 private SelectSpeechWindow selectSpeechWindow ;
104104 private SelectSoundWindow selectSoundWindow ;
105+ private SelectSuperWeaponTypeWindow selectSuperWeaponTypeWindow ;
105106 private SelectParticleSystemTypeWindow selectParticleSystemTypeWindow ;
106107 private CreateRandomTriggerSetWindow createRandomTriggerSetWindow ;
107108
@@ -307,6 +308,10 @@ public override void Initialize()
307308 var particleSystemTypeDarkeningPanel = DarkeningPanel . InitializeAndAddToParentControlWithChild ( WindowManager , Parent , selectParticleSystemTypeWindow ) ;
308309 particleSystemTypeDarkeningPanel . Hidden += ParticleSystemTypeDarkeningPanel_Hidden ;
309310
311+ selectSuperWeaponTypeWindow = new SelectSuperWeaponTypeWindow ( WindowManager , map ) ;
312+ var swDarkeningPanel = DarkeningPanel . InitializeAndAddToParentControlWithChild ( WindowManager , Parent , selectSuperWeaponTypeWindow ) ;
313+ swDarkeningPanel . Hidden += SuperWeaponDarkeningPanel_Hidden ;
314+
310315 createRandomTriggerSetWindow = new CreateRandomTriggerSetWindow ( WindowManager , map ) ;
311316 var createRandomTriggersSetDarkeningPanel = DarkeningPanel . InitializeAndAddToParentControlWithChild ( WindowManager , Parent , createRandomTriggerSetWindow ) ;
312317 createRandomTriggerSetWindow . RandomTriggerSetTriggersCreated += CreateRandomTriggerSetWindow_RandomTriggersSetCreated ;
@@ -937,10 +942,17 @@ private void BtnEventParameterValuePreset_LeftClick(object sender, EventArgs e)
937942 ctxEventParameterPresetValues . Open ( GetCursorPoint ( ) ) ;
938943 break ;
939944 case TriggerParamType . SuperWeapon :
940- ctxEventParameterPresetValues . ClearItems ( ) ;
941- ctxEventParameterPresetValues . Width = 250 ;
942- map . Rules . SuperWeaponTypes . ForEach ( sw => ctxEventParameterPresetValues . AddItem ( sw . GetDisplayString ( ) ) ) ;
943- ctxEventParameterPresetValues . Open ( GetCursorPoint ( ) ) ;
945+ int swTypeIndex = Conversions . IntFromString ( triggerEvent . Parameters [ paramIndex ] , - 1 ) ;
946+ selectSuperWeaponTypeWindow . IsForEvent = true ;
947+ selectSuperWeaponTypeWindow . UseININameAsValue = false ;
948+ if ( swTypeIndex > - 1 && swTypeIndex < map . Rules . SuperWeaponTypes . Count )
949+ selectSuperWeaponTypeWindow . Open ( map . Rules . SuperWeaponTypes [ swTypeIndex ] ) ;
950+ break ;
951+ case TriggerParamType . SuperWeaponName :
952+ string swTypeID = triggerEvent . Parameters [ paramIndex ] ;
953+ selectSuperWeaponTypeWindow . IsForEvent = true ;
954+ selectSuperWeaponTypeWindow . UseININameAsValue = true ;
955+ selectSuperWeaponTypeWindow . Open ( map . Rules . SuperWeaponTypes . Find ( swType => swType . ININame . Equals ( swTypeID , StringComparison . Ordinal ) ) ) ;
944956 break ;
945957 case TriggerParamType . TeamType :
946958 TeamType existingTeamType = map . TeamTypes . Find ( tt => tt . ININame == triggerEvent . Parameters [ paramIndex ] ) ;
@@ -1058,10 +1070,18 @@ private void BtnActionParameterValuePreset_LeftClick(object sender, EventArgs e)
10581070 selectStringWindow . Open ( existingString ) ;
10591071 break ;
10601072 case TriggerParamType . SuperWeapon :
1061- ctxActionParameterPresetValues . ClearItems ( ) ;
1062- ctxActionParameterPresetValues . Width = 250 ;
1063- map . Rules . SuperWeaponTypes . ForEach ( sw => ctxActionParameterPresetValues . AddItem ( sw . GetDisplayString ( ) ) ) ;
1064- ctxActionParameterPresetValues . Open ( GetCursorPoint ( ) ) ;
1073+ int swTypeIndex = Conversions . IntFromString ( triggerAction . Parameters [ paramIndex ] , - 1 ) ;
1074+ selectSuperWeaponTypeWindow . IsForEvent = false ;
1075+ selectSuperWeaponTypeWindow . UseININameAsValue = false ;
1076+ if ( swTypeIndex > - 1 && swTypeIndex < map . Rules . SuperWeaponTypes . Count )
1077+ selectSuperWeaponTypeWindow . Open ( map . Rules . SuperWeaponTypes [ swTypeIndex ] ) ;
1078+ break ;
1079+ case TriggerParamType . SuperWeaponName :
1080+ string swTypeID = triggerAction . Parameters [ paramIndex ] ;
1081+ selectSuperWeaponTypeWindow . IsForEvent = false ;
1082+ selectSuperWeaponTypeWindow . UseININameAsValue = true ;
1083+ if ( ! string . IsNullOrEmpty ( swTypeID ) )
1084+ selectSuperWeaponTypeWindow . Open ( map . Rules . SuperWeaponTypes . Find ( swType => swType . ININame . Equals ( swTypeID , StringComparison . Ordinal ) ) ) ;
10651085 break ;
10661086 case TriggerParamType . ParticleSystem :
10671087 ParticleSystemType existingParticleSystemType = map . Rules . ParticleSystemTypes . Find ( pst => pst . Index == Conversions . IntFromString ( triggerAction . Parameters [ paramIndex ] , - 1 ) ) ;
@@ -1272,6 +1292,19 @@ private void ParticleSystemTypeDarkeningPanel_Hidden(object sender, EventArgs e)
12721292 AssignParamValue ( selectParticleSystemTypeWindow . IsForEvent , selectParticleSystemTypeWindow . SelectedObject . Index ) ;
12731293 }
12741294
1295+ private void SuperWeaponDarkeningPanel_Hidden ( object sender , EventArgs e )
1296+ {
1297+ if ( selectSuperWeaponTypeWindow . SelectedObject == null )
1298+ return ;
1299+
1300+ var swType = selectSuperWeaponTypeWindow . SelectedObject ;
1301+
1302+ if ( selectSuperWeaponTypeWindow . UseININameAsValue )
1303+ AssignParamValue ( selectSuperWeaponTypeWindow . IsForEvent , swType . ININame ) ;
1304+ else
1305+ AssignParamValue ( selectSuperWeaponTypeWindow . IsForEvent , swType . Index ) ;
1306+ }
1307+
12751308 private void AssignParamValue ( bool isForEvent , int paramValue )
12761309 {
12771310 if ( isForEvent )
@@ -2252,6 +2285,13 @@ private string GetParamValueText(string paramValue, TriggerParamType paramType,
22522285 return intValue + " - nonexistent super weapon" ;
22532286
22542287 return intValue + " " + map . Rules . SuperWeaponTypes [ intValue ] . GetDisplayStringWithoutIndex ( ) ;
2288+ case TriggerParamType . SuperWeaponName :
2289+ var swType = map . Rules . SuperWeaponTypes . Find ( sw => sw . ININame . Equals ( paramValue , StringComparison . Ordinal ) ) ;
2290+
2291+ if ( swType == null )
2292+ return paramValue ;
2293+
2294+ return swType . GetDisplayStringWithoutIndex ( ) ;
22552295 case TriggerParamType . ParticleSystem :
22562296 if ( ! intParseSuccess )
22572297 return paramValue ;
0 commit comments