Ejemplo n.º 1
0
        private void ModelChanged(MDL0Node model)
        {
            if (model != null && !_targetModels.Contains(model))
            {
                _targetModels.Add(model);
            }

            if (_targetModel != null)
            {
                _targetModel._isTargetModel = false;
            }

            if (_targetModel != null)
            {
                modelPanel.RemoveTarget(_targetModel);
            }

            if ((_targetModel = model) != null)
            {
                modelPanel.AddTarget(_targetModel);
                listPanel.VIS0Indices       = _targetModel.VIS0Indices;
                _targetModel._isTargetModel = true;
                ResetVertexColors();
                hurtboxEditor._mainControl_TargetModelChanged(null, null);
            }

            if (_resetCam)
            {
                modelPanel.ResetCamera();
                RunTime.SetFrame(0);
            }
            else
            {
                _resetCam = true;
            }

            modelListsPanel1.Reset();

            //if (TargetModelChanged != null)
            //    TargetModelChanged(this, null);

            //_updating = true;
            //if (_targetModel != null && !_editingAll)
            //    comboCharacters.SelectedItem = _targetModel;
            //_updating = false;

            if (_targetModel != null)
            {
                RenderBones = _targetModel._renderBones;
            }
        }
Ejemplo n.º 2
0
        public void RunScript()
        {
            if (RunTime.CurrentFrame >= RunTime.MaxFrame - 1)
            {
                RunTime.SetFrame(0);
            }

            //RunTime.LoadSubactionScripts();
            //RunTime.ResetSubactionVariables();
            //RunTime.SetFrame(RunTime.CurrentFrame);

            //Run the timer.
            //This will run scripts and animations until the user stops it or everything ends itself.
            //Then the code directly after this line will be executed.
            RunTime.Run();

            //If we have any sounds still playing, stop and dispose of them.
            //This should only be necessary if the user manually stops the timer,
            //as the timer will not stop automatically until all sounds are completed and disposed of.
            if (RunTime._playingSounds.Count != 0)
            {
                List <int> keys = new List <int>();
                foreach (var b in RunTime._playingSounds)
                {
                    foreach (AudioInfo info in b.Value)
                    {
                        if (info._buffer != null && info._buffer.Owner != null)
                        {
                            info._buffer.Stop();
                            info._buffer.Dispose();
                            info._stream.Dispose();
                        }
                    }
                }
                RunTime._playingSounds.Clear();
            }
        }
Ejemplo n.º 3
0
 public override void SetFrame(int index)
 {
     RunTime.SetFrame(index);
 }
Ejemplo n.º 4
0
 public void SetFrame(int index)
 {
     RunTime.SetFrame(index - 1);
 }
Ejemplo n.º 5
0
        public void AnimChanged(AnimType type)
        {
            //Update animation editors
            if (type != AnimType.SRT)
            {
                modelListsPanel1.UpdateSRT0Selection(null);
            }
            if (type != AnimType.PAT)
            {
                modelListsPanel1.UpdatePAT0Selection(null);
            }

            switch (type)
            {
            case AnimType.CHR:
                break;

            case AnimType.SRT:
                modelListsPanel1.UpdateSRT0Selection(SelectedSRT0);
                break;

            case AnimType.SHP:
                shp0Editor.UpdateSHP0Indices();
                break;

            case AnimType.PAT:
                pat0Editor.UpdateBoxes();
                modelListsPanel1.UpdatePAT0Selection(SelectedPAT0);
                break;

            case AnimType.VIS:
                vis0Editor.UpdateAnimation();
                break;

            case AnimType.CLR:
                clr0Editor.UpdateAnimation();
                break;
            }

            if (GetAnimation(type) == null)
            {
                pnlPlayback.numFrameIndex.Maximum  = MaxFrame = 0;
                pnlPlayback.numTotalFrames.Minimum = 0;
                _updating = true;
                pnlPlayback.numTotalFrames.Value = 0;
                _updating = false;
                pnlPlayback.btnPlay.Enabled               =
                    pnlPlayback.numTotalFrames.Enabled    =
                        pnlPlayback.numFrameIndex.Enabled = false;
                pnlPlayback.btnLast.Enabled               = false;
                pnlPlayback.btnFirst.Enabled              = false;
                pnlPlayback.Enabled = false;
                RunTime.SetFrame(-1);
            }
            else
            {
                int oldMax = MaxFrame;

                MaxFrame = GetAnimation(type).FrameCount;

                _updating = true;
                pnlPlayback.btnPlay.Enabled                =
                    pnlPlayback.numFrameIndex.Enabled      =
                        pnlPlayback.numTotalFrames.Enabled = true;
                pnlPlayback.Enabled = true;
                pnlPlayback.numTotalFrames.Value = MaxFrame;
                if (syncLoopToAnimationToolStripMenuItem.Checked)
                {
                    pnlPlayback.chkLoop.Checked = GetAnimation(type).Loop;
                }
                _updating = false;

                if (MaxFrame < oldMax)
                {
                    RunTime.SetFrame(0);
                    pnlPlayback.numFrameIndex.Maximum = MaxFrame;
                }
                else
                {
                    pnlPlayback.numFrameIndex.Maximum = MaxFrame;
                    RunTime.SetFrame(0);
                }
            }
        }