예제 #1
0
        void OnElementPostPropertyEdit(object sender, EventArgs e)
        {
            SFXElement             elemCtrl = sender as SFXElement;
            NActorComponent        comp     = m_preview.ResourceActorComponent;
            NSpecialEffectInstance sfxComp  = comp as NSpecialEffectInstance;

            if (sfxComp != null)
            {
                sfxComp.ResetResource(m_res);
            }
        }
예제 #2
0
        void OnRestartInstance(object sender, EventArgs e)
        {
            SFXElement elemCtrl = sender as SFXElement;

            //-- 处理资源和渲染对象
            NActorComponent        comp    = m_preview.ResourceActorComponent;
            NSpecialEffectInstance sfxComp = comp as NSpecialEffectInstance;

            if (sfxComp != null)
            {
                sfxComp.ResetResource(m_res);
            }
        }
예제 #3
0
        private void newNToolStripMenuItem_Click(object sender, EventArgs e)
        {
            //新建特效
            m_res.Clear();
            m_elementsCtrl.Clear();
            m_Timeline.Clear();
            this.splitContainerV.Panel2.Controls.Clear();
            NActorComponent        comp    = m_preview.ResourceActorComponent;
            NSpecialEffectInstance sfxComp = comp as NSpecialEffectInstance;

            if (sfxComp != null)
            {
                sfxComp.ResetResource(m_res);
            }
            m_preview.Refresh();
        }
예제 #4
0
 private void openOToolStripMenuItem_Click(object sender, EventArgs e)
 {
     //打开特效
     using (VirtualFileDialog dlg = new VirtualFileDialog())
     {
         dlg.Text = "加载特效 ...";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             NResourceLoc loc = dlg.GetResourceLocation();
             m_res.Clear();
             m_elementsCtrl.Clear();
             m_Timeline.Clear();
             this.splitContainerV.Panel2.Controls.Clear();
             m_res.LoadFromFile(loc);
             //更新控制器
             for (int i = 0; i < m_res.ElementCount(); ++i)
             {
                 NEffectElement elem    = m_res.GetElement(i);
                 int            numCtrl = m_elementsCtrl.Count;
                 SFXElement     newCtrl = new SFXElement(elem);
                 this.splitContainerV.Panel2.Controls.Add(newCtrl);
                 newCtrl.Location = new Point(2 + numCtrl * (newCtrl.Width + 2), 2);
                 int h = this.splitContainerV.Panel2.Height - 20;
                 newCtrl.Height = h;
                 m_elementsCtrl.Add(newCtrl);
                 newCtrl.SetActive(true);
                 newCtrl.RemoveElement    += new EventHandler(OnRemoveElement);
                 newCtrl.PropertySelected += new EventHandler(OnElementPropertySelected);
                 newCtrl.PostPropertyEdit += new EventHandler(OnElementPostPropertyEdit);
                 newCtrl.ActiveElement    += new EventHandler(OnActiveElement);
                 newCtrl.RestartInstance  += new EventHandler(OnRestartInstance);
             }
             NActorComponent        comp    = m_preview.ResourceActorComponent;
             NSpecialEffectInstance sfxComp = comp as NSpecialEffectInstance;
             if (sfxComp != null)
             {
                 sfxComp.ResetResource(m_res);
             }
             m_preview.Refresh();
         }
     }
 }
예제 #5
0
        public void ShowSpecialEffect(NResourceSpecialEffect sfx)
        {
            try
            {
                m_level.DestroyAllActors();

                //-- create a actor for SFX
                NActor                 sfxActor = m_level.CreateActor("SFXActor", "nactor");
                NActorComponent        comp     = sfxActor.CreateComponent("SFXComp", "nspecial_effect_instance");
                NSpecialEffectInstance sfxComp  = comp as NSpecialEffectInstance;
                sfxComp.ResetResource(sfx);
                sfxComp.Play();

                m_resActorComp = sfxComp;
            }
            catch (System.Exception e)
            {
                NexusEditor.Program.ShowException(e, "SFX Preview Open FAILED!");
            }
        }
예제 #6
0
        void OnRemoveElement(object sender, EventArgs e)
        {
            SFXElement elemCtrl = sender as SFXElement;

            //-- 处理资源和渲染对象
            m_res.RemoveElement(elemCtrl.EditElement.Name);
            NActorComponent        comp    = m_preview.ResourceActorComponent;
            NSpecialEffectInstance sfxComp = comp as NSpecialEffectInstance;

            if (sfxComp != null)
            {
                sfxComp.ResetResource(m_res);
            }

            //-- 更新UI
            m_Timeline.Clear();
            this.splitContainerV.Panel2.Controls.Clear();
            m_elementsCtrl.Remove(elemCtrl);
            //更新控制器
            for (int i = 0; i < m_res.ElementCount(); ++i)
            {
                NEffectElement elem    = m_res.GetElement(i);
                int            numCtrl = i;
                SFXElement     newCtrl = new SFXElement(elem);
                this.splitContainerV.Panel2.Controls.Add(newCtrl);
                newCtrl.Location = new Point(2 + numCtrl * (newCtrl.Width + 2), 2);
                int h = this.splitContainerV.Panel2.Height - 20;
                newCtrl.Height = h;
                newCtrl.SetActive(true);
                newCtrl.RemoveElement    += new EventHandler(OnRemoveElement);
                newCtrl.PropertySelected += new EventHandler(OnElementPropertySelected);
                newCtrl.PostPropertyEdit += new EventHandler(OnElementPostPropertyEdit);
                newCtrl.ActiveElement    += new EventHandler(OnActiveElement);
                newCtrl.RestartInstance  += new EventHandler(OnRestartInstance);
            }
            m_preview.Refresh();
        }