Beispiel #1
0
 private void AnimationExplorerWPF_OnClosing(object sender, CancelEventArgs e)
 {
     //if (!GameController.TryGetME3Process(out _))
     //{
     //    string asiPath = InteropHelper.GetInteropAsiWritePath();
     //    if (File.Exists(asiPath))
     //    {
     //        File.Delete(asiPath);
     //    }
     //}
     ME3OpenTimer.Stop();
     ME3OpenTimer.Tick -= CheckIfME3Open;
     GameController.RecieveME3Message -= GameController_RecieveME3Message;
     DataContext = null;
     Instance    = null;
 }
Beispiel #2
0
        private void GameController_RecieveME3Message(string msg)
        {
            if (msg == "AnimViewer string Loaded")
            {
                if (GameController.TryGetMEProcess(MEGame.ME3, out Process me3Process))
                {
                    me3Process.MainWindowHandle.RestoreAndBringToFront();
                }

                this.RestoreAndBringToFront();
                ME3OpenTimer.Start();
                ME3StartingUp      = false;
                LoadingAnimation   = false;
                ReadyToView        = true;
                animTab.IsSelected = true;

                noUpdate            = true;
                ShouldFollowActor   = false;
                SelectedSquadMember = ESquadMember.Liara;
                noUpdate            = false;

                EndBusy();
                if (AnimQueuedForFocus != null)
                {
                    SelectedAnimation  = Animations.FirstOrDefault(a => a.AnimSequence == AnimQueuedForFocus.AnimSequence);
                    AnimQueuedForFocus = null;
                }
            }
            else if (msg.StartsWith("AnimViewer string AnimLoaded"))
            {
                Vector3 pos = defaultPosition;
                if (msg.IndexOf("vector") is int idx && idx > 0 &&
                    msg.Substring(idx + 7).Split(' ') is string[] strings && strings.Length == 3)
                {
                    var floats = new float[3];
                    for (int i = 0; i < 3; i++)
                    {
                        if (float.TryParse(strings[i], out float f))
                        {
                            floats[i] = f;
                        }
                        else
                        {
                            floats = defaultPosition.ToArray();
                            break;
                        }
                    }
                    pos = new Vector3(floats);
                }
                noUpdate      = true;
                XPos          = (int)pos.X;
                YPos          = (int)pos.Y;
                ZPos          = (int)pos.Z;
                Yaw           = 180;
                Pitch         = 0;
                playbackState = PlaybackState.Playing;
                PlayPauseIcon = EFontAwesomeIcon.Solid_Pause;
                noUpdate      = false;
                if (GameController.TryGetMEProcess(MEGame.ME3, out Process me3Process))
                {
                    me3Process.MainWindowHandle.RestoreAndBringToFront();
                }
                this.RestoreAndBringToFront();
                LoadingAnimation = false;
                EndBusy();
            }
            else if (msg == "AnimViewer string HenchLoaded")
            {
                LoadAnimation(SelectedAnimation);
            }
        }