private void LoadScene() { _scene = OpenWorldManager.GetScene(_sceneIndex); if (_currentCharacters != null) { foreach (CharacterBody body in _currentCharacters) { if (body != _mainCharacter) { main_grid.Children.Remove(body.CharacterPic); } } } _currentCharacters = new List <CharacterBody>(); _currentCharacters.Add(_mainCharacter); ImageBrush background = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/BCA_StoryMode;component/Assets/StoryMode/Backgrounds/" + _scene.Background + ".jpg"))); main_grid.Background = background; tb_scene_name.Text = _scene.Name; dialog_pic.Visibility = Visibility.Hidden; LoadSceneCharacters(); }
private void ChangeSceneLeft() { if (OpenWorldManager.GetScene(_sceneIndex - 1) == null || _isMapChanging) { int offset = _isMapChanging ? _mainCharacter.Sprites.SpriteWidth : 0; if (_mainCharacter.MoveTransform.X - 10 > 0 - offset) { _mainCharacter.MoveTransform.X -= 10; } else { _mainCharacter.MoveTransform.X = 0 - offset; } return; } _isMapChanging = true; Storyboard storyboard = new Storyboard(); DoubleAnimation opacityAnimation = new DoubleAnimation(); opacityAnimation.Duration = TimeSpan.FromMilliseconds(200); opacityAnimation.From = 0.0; opacityAnimation.To = 1.0; DoubleAnimation opacityAnimationCharacter = opacityAnimation.Clone(); opacityAnimationCharacter.From = 1.0; opacityAnimationCharacter.To = 0.0; storyboard.Children.Add(opacityAnimation); storyboard.Children.Add(opacityAnimationCharacter); Storyboard.SetTargetProperty(opacityAnimation, new PropertyPath(OpacityProperty)); Storyboard.SetTargetProperty(opacityAnimationCharacter, new PropertyPath(OpacityProperty)); Storyboard.SetTarget(opacityAnimation, bd_black_fade); Storyboard.SetTarget(opacityAnimationCharacter, _mainCharacter.CharacterPic); storyboard.Completed += (sender, e) => FadeOut(sender, e, true); storyboard.Begin(); }