private void UpdateAnimations(bool saveIndex = true) { var n = 1; var selectedIndex = 0; // if there are no animations, add one by default. if (mEditorItem.Animations.Count == 0) { mEditorItem.Animations.Add(new ProjectileAnimation(Guid.Empty, mEditorItem.Quantity, false)); } //Update the spawn range maximum if (nudAmount.Value < scrlSpawnRange.Value) { scrlSpawnRange.Value = (int)nudAmount.Value; } scrlSpawnRange.Maximum = (int)nudAmount.Value; //Save the index if (saveIndex == true) { selectedIndex = lstAnimations.SelectedIndex; } // Add the animations to the list lstAnimations.Items.Clear(); for (var i = 0; i < mEditorItem.Animations.Count; i++) { if (mEditorItem.Animations[i].AnimationId != Guid.Empty) { lstAnimations.Items.Add( Strings.ProjectileEditor.animationline.ToString( n, mEditorItem.Animations[i].SpawnRange, AnimationBase.GetName(mEditorItem.Animations[i].AnimationId) ) ); } else { lstAnimations.Items.Add( Strings.ProjectileEditor.animationline.ToString( n, mEditorItem.Animations[i].SpawnRange, Strings.General.none ) ); } n = mEditorItem.Animations[i].SpawnRange + 1; } lstAnimations.SelectedIndex = selectedIndex; if (lstAnimations.SelectedIndex < 0) { lstAnimations.SelectedIndex = 0; } if (lstAnimations.SelectedIndex > 0) { lblSpawnRange.Text = Strings.ProjectileEditor.spawnrange.ToString( mEditorItem.Animations[lstAnimations.SelectedIndex - 1].SpawnRange + 1, mEditorItem.Animations[lstAnimations.SelectedIndex].SpawnRange ); } else { lblSpawnRange.Text = Strings.ProjectileEditor.spawnrange.ToString( 1, mEditorItem.Animations[lstAnimations.SelectedIndex].SpawnRange ); } }
private static string GetCommandText(PlayAnimationCommand command, MapInstance map) { if (command.MapId != Guid.Empty) { for (var i = 0; i < MapList.OrderedMaps.Count; i++) { if (MapList.OrderedMaps[i].MapId == command.MapId) { return(Strings.EventCommandList.playanimation.ToString( AnimationBase.GetName(command.AnimationId), Strings.EventCommandList.animationonmap.ToString( MapList.OrderedMaps[i].Name, command.X, command.Y, Strings.Directions.dir[(sbyte)command.Dir] ) )); } } return(Strings.EventCommandList.playanimation.ToString( AnimationBase.GetName(command.AnimationId), Strings.EventCommandList.animationonmap.ToString( Strings.EventCommandList.mapnotfound, command.X, command.Y, Strings.Directions.dir[command.Dir] ) )); } else { var spawnOpt = ""; switch (command.Dir) { //0 does not adhere to direction, 1 is Spawning Relative to Direction, 2 is Rotating Relative to Direction, and 3 is both. case 1: spawnOpt = Strings.EventCommandList.animationrelativedir; break; case 2: spawnOpt = Strings.EventCommandList.animationrotatedir; break; case 3: spawnOpt = Strings.EventCommandList.animationrelativerotate; break; } if (command.EntityId == Guid.Empty) { return(Strings.EventCommandList.playanimation.ToString( AnimationBase.GetName(command.AnimationId), Strings.EventCommandList.animationonplayer.ToString(command.X, command.Y, spawnOpt) )); } else { if (map.LocalEvents.ContainsKey(command.EntityId)) { return(Strings.EventCommandList.playanimation.ToString( AnimationBase.GetName(command.AnimationId), Strings.EventCommandList.animationonevent.ToString( map.LocalEvents[command.EntityId].Name, command.X, command.Y, spawnOpt ) )); } else { return(Strings.EventCommandList.playanimation.ToString( AnimationBase.GetName(command.AnimationId), Strings.EventCommandList.animationonevent.ToString( Strings.EventCommandList.deletedevent, command.X, command.Y, spawnOpt ) )); } } } }