private void LoadMainCharacter()
        {
            Character player = CharactersManager.GetCharacter(2);

            if (player == null)
            {
                CloseScene?.Invoke();
            }

            _mainCharacter = new CharacterBody(player);
            _mainCharacter.CharacterPic        = character_pic_left;
            _mainCharacter.Sprites             = SpritesHelper.CreateSprite(player);
            character_pic_left.Height          = _mainCharacter.Sprites.SpriteHeight;
            character_pic_left.Width           = _mainCharacter.Sprites.SpriteWidth;
            _mainCharacter.MoveTransform       = new TranslateTransform(0, 0);
            _mainCharacter.Direction           = DirectionEnum.IDLERight;
            _mainCharacter.MoveSpriteIndex     = 0;
            character_pic_left.RenderTransform = _mainCharacter.MoveTransform;

            character_pic_left.Source = _mainCharacter.Sprites.IDLERight[0].ImageSource;

            this.KeyDown += PlayerKeyDown;
            this.KeyUp   += PlayerKeyUp;


            dialog_pic.Height = 30;
            dialog_pic.Width  = _mainCharacter.Sprites.SpriteWidth;
        }
Beispiel #2
0
        private void LoadDialogState()
        {
            Sentence s = _scene.Dialog.GetSentence(_state);

            if (s == null)
            {
                CloseScene?.Invoke();
                return;
            }
            _currentSentence = s;
            ImageBrush character = new ImageBrush(new BitmapImage(new Uri("pack://application:,,,/BCA_StoryMode;component/Assets/StoryMode/Characters/Faces/" + _currentSentence.Sprite + ".png")));

            if (_state == 0)
            {
                character_pic_left.Source = character.ImageSource;
                if (_scene.ID > 100000)
                {
                    Grid.SetColumnSpan(character_pic_left, 3);
                }
                _lastSpeakerLeft = true;
            }
            else
            {
                if (_lastSpeakerLeft)
                {
                    Grid.SetZIndex(character_pic_left, -2);
                    Grid.SetZIndex(character_pic_right, -1);
                    Grid.SetColumn(character_pic_right, 1);
                    Grid.SetColumnSpan(character_pic_right, 2);
                    Grid.SetColumnSpan(character_pic_left, 1);
                    character_pic_right.Source = character.ImageSource;
                }
                else
                {
                    Grid.SetZIndex(character_pic_left, -1);
                    Grid.SetZIndex(character_pic_right, -2);
                    Grid.SetColumn(character_pic_right, 2);
                    Grid.SetColumnSpan(character_pic_left, 2);
                    Grid.SetColumnSpan(character_pic_right, 1);
                    character_pic_left.Source = character.ImageSource;
                }
                _lastSpeakerLeft = !_lastSpeakerLeft;
            }

            tb_character.Text = s.Speaker.Name;

            _textTimer          = new DispatcherTimer();
            _textTimer.Interval = TimeSpan.FromMilliseconds(40);
            _textTimer.Start();
            _textTimer.Tick += _textTimer_Tick;
        }