protected override void UndoObject()
	{
		if (m_bDialogType == DIALOG_TYPE.SELECT)
		{
			if (m_bSelectMeshDialog)
			{
				NgSerialized.SetMesh(m_SelectMeshComponent, m_OldSelectMesh, true);
				FXMakerHierarchy.inst.UpdateMeshList();
			} else SetAttachPrefab(m_OldSelectPrefab, true);
			m_AddGameObject		= null;
		} else {
			m_AddGameObjectList.Remove(m_AddGameObject);
			DestroyImmediate(m_AddGameObject);
			if (0 < m_AddGameObjectList.Count)
				m_AddGameObject	= m_AddGameObjectList[0];
		}
		m_nObjectIndex			= -1;
		m_nSelObjectGroupIndex	= -1;
		m_nSelObjectProjectIndex= -1;
		m_SelObjectContent		= null;
		m_AddPrefabObject		= null;

		if (m_bDialogType == DIALOG_TYPE.SELECT)
		{
			FXMakerMain.inst.CreateCurrentInstanceEffect(true);
		} else {
			if (FXMakerHierarchy.inst.SetActiveGameObject(m_SelectedTransform.gameObject) == false)
				FXMakerMain.inst.CreateCurrentInstanceEffect(true);
		}
	}
// --------------------------------------------------------------------------------------
    // Legacy Only...
    public static void ConvertToStaticScale(ParticleEmitter pe, ParticleAnimator pa)
    {
        if (pe == null)
        {
            return;
        }

        Vector3 vecVelScale = (pe.transform.lossyScale);
        float   fVelScale   = (NcTransformTool.GetTransformScaleMeanValue(pe.transform));
        float   fScale      = (NcTransformTool.GetTransformScaleMeanValue(pe.transform));

        pe.minSize *= fScale;
        pe.maxSize *= fScale;

        pe.worldVelocity         = Vector3.Scale(pe.worldVelocity, vecVelScale);
        pe.localVelocity         = Vector3.Scale(pe.localVelocity, vecVelScale);
        pe.rndVelocity           = Vector3.Scale(pe.rndVelocity, vecVelScale);
        pe.angularVelocity      *= fVelScale;
        pe.rndAngularVelocity   *= fVelScale;
        pe.emitterVelocityScale *= fVelScale;

        if (pa != null)
        {
            pa.rndForce = Vector3.Scale(pa.rndForce, vecVelScale);
            pa.force    = Vector3.Scale(pa.force, vecVelScale);
//			pa.damping					*= fScale;
        }
        Vector3 ellipsoid;
        float   minEmitterRange;

        NgSerialized.GetEllipsoidSize(pe, out ellipsoid, out minEmitterRange);
        NgSerialized.SetEllipsoidSize(pe, ellipsoid * fScale, minEmitterRange * fScale);
//      NgAssembly.LogFieldsPropertis(pe);
    }
Пример #3
0
    protected bool IsParticleEmitterOneShot(ParticleEmitter pe)
    {
        NcParticleSystem ps       = pe.GetComponent <NcParticleSystem>();
        bool             bOneShot = (bool)NgSerialized.GetPropertyValue(new SerializedObject(pe as ParticleEmitter), "m_OneShot");

        return(bOneShot && (ps == null || ps.m_bBurst == false));
    }
Пример #4
0
 void SetClipboardComponent(Component selCom)
 {
     m_CopyCloneGameObject = NgObject.CreateGameObject(gameObject.transform, selCom.gameObject.name);
     NgObject.SetActiveRecursively(m_CopyCloneGameObject, false);
     m_CopyCloneObject = NgSerialized.AddComponent(m_CopyCloneGameObject, selCom);
     NgSerialized.CopySerialized(selCom, (m_CopyCloneObject as Component));
 }
    public virtual bool ShowSelectMeshPopupWindow(Object selObj)
    {
        m_SelectMeshComponent = selObj as Component;
        m_OldSelectMesh       = NgSerialized.GetMesh(m_SelectMeshComponent, true) as Mesh;
        m_CaptionName         = "Select Mesh";
        m_PrefsName           = "SelectMesh";

        SetShowOption(m_SelectMeshComponent.transform, DIALOG_TYPE.SELECT, true);
        return(base.ShowPopupWindow(m_SelectMeshComponent.transform, false));
    }
	public virtual bool ShowSelectMeshPopupWindow(Object selObj)
	{
		m_LoadPrefabType		= NgEnum.PREFAB_TYPE.All;
		m_SelectMeshComponent	= selObj as Component;
		m_OldSelectMesh			= NgSerialized.GetMesh(m_SelectMeshComponent, true) as Mesh;
		m_CaptionName			= "Select Mesh - " + m_LoadPrefabType.ToString();
		m_PrefsName				= "SelectMesh";

		SetShowOption(m_SelectMeshComponent.transform, DIALOG_TYPE.SELECT, true);
		return base.ShowPopupWindow(m_SelectMeshComponent.transform, false);
	}
Пример #7
0
    public static Component CloneComponent(Component srcCom, GameObject targetGameObj, bool bRemoveSrcCom)
    {
        Component tarCom = NgSerialized.AddComponent(targetGameObj, srcCom);

        NgSerialized.CopySerialized(srcCom, tarCom);
        if (bRemoveSrcCom)
        {
            Object.DestroyImmediate(srcCom);
        }
        return(tarCom);
    }
    protected bool IsParticleEmitterOneShot()
    {
        ParticleEmitter pe = m_Sel.GetComponent <ParticleEmitter>();

        if (pe == null)
        {
            return(false);
        }
        bool bOneShot = (bool)NgSerialized.GetPropertyValue(new SerializedObject(pe as ParticleEmitter), "m_OneShot");

        return(bOneShot && m_Sel.m_bBurst == false);
    }
    public void OnAutoInitValue()
    {
        NcEffectBehaviour[] oriComs = m_OriginalTrans.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in oriComs)
        {
            effect.OnUpdateToolData();
        }
        NcEffectBehaviour[] insComs = transform.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in insComs)
        {
            effect.OnUpdateToolData();
        }

        // Set particleSystem.speed
//      {
//          NcParticleSystem	ncParticleScaleOri	= (m_OriginalTrans.GetComponent<NcParticleSystem>());
//          NcParticleSystem	ncParticleScaleIns	= (transform.GetComponent<NcParticleSystem>());
//          if (ncParticleScaleOri != null && ncParticleScaleIns != null && ncParticleScaleOri.particleSystem != null)
//          {
//              ncParticleScaleOri.SaveShurikenSpeed();
//              ncParticleScaleIns.SaveShurikenSpeed();
//          }
//      }

        // Update bWorldSpace
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleIns != null)
            {
                ncParticleScaleIns.m_bWorldSpace = ncParticleScaleOri.m_bWorldSpace = NgSerialized.GetSimulationSpaceWorld(ncParticleScaleOri.transform);
            }
        }

        // Set particleEmitter.m_MinNormalVelocity, m_MaxNormalVelocity
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleOri.enabled && ncParticleScaleIns != null && ncParticleScaleOri.GetComponent <ParticleEmitter>() != null && ncParticleScaleOri.m_bScaleWithTransform && NgSerialized.IsMeshParticleEmitter(ncParticleScaleOri.GetComponent <ParticleEmitter>()))
            {
                float fSetMinValue;
                float fSetMaxValue;
                NgSerialized.GetMeshNormalVelocity(ncParticleScaleOri.GetComponent <ParticleEmitter>(), out fSetMinValue, out fSetMaxValue);
                if (fSetMinValue != ncParticleScaleOri.GetScaleMinMeshNormalVelocity() || fSetMaxValue != ncParticleScaleOri.GetScaleMaxMeshNormalVelocity())
                {
                    NgSerialized.SetMeshNormalVelocity(ncParticleScaleOri.GetComponent <ParticleEmitter>(), ncParticleScaleOri.GetScaleMinMeshNormalVelocity(), ncParticleScaleOri.GetScaleMaxMeshNormalVelocity());
                    NgSerialized.SetMeshNormalVelocity(ncParticleScaleIns.GetComponent <ParticleEmitter>(), ncParticleScaleOri.GetScaleMinMeshNormalVelocity(), ncParticleScaleOri.GetScaleMaxMeshNormalVelocity());
                }
            }
        }
    }
Пример #10
0
    void RemoveInvaildComponent(GameObject gameObj)
    {
        // MeshParticleEmitter - missing mesh - unity error
        ParticleEmitter[] pes = gameObj.GetComponentsInChildren <ParticleEmitter>(true);

        foreach (ParticleEmitter pe in pes)
        {
            if (NgSerialized.IsMeshParticleEmitter(pe as ParticleEmitter) && NgSerialized.GetMesh(pe, false) == null)
            {
//              Debug.Log(pe.name + " - MeshParticleEmitter : missing mesh");
                if (pe.gameObject.renderer != null)
                {
                    DestroyImmediate(pe.gameObject.renderer);
                }
                DestroyImmediate(pe);
            }
        }

        // remove Dup Component - Over process error
        Transform[] transComs = gameObj.GetComponentsInChildren <Transform>(true);
        foreach (Transform trans in transComs)
        {
            NcEffectBehaviour[] effComs = trans.GetComponents <NcEffectBehaviour>();
            foreach (NcEffectBehaviour eff in effComs)
            {
                if (eff != null && eff.CheckProperty() == "SCRIPT_WARRING_DUPLICATE")
                {
                    Component[] dupcoms = eff.GetComponents(eff.GetType());
                    for (int n = 0; n < dupcoms.Length; n++)
                    {
                        if (0 < n)
                        {
                            DestroyImmediate(dupcoms[n]);
                        }
                    }
                }
            }
        }

        // remove DisableComponent - AutoRet error
        NcEffectBehaviour[] effDComs = gameObj.GetComponentsInChildren <NcEffectBehaviour>(true);
        for (int n = 0; n < effDComs.Length; n++)
        {
            if (effDComs[n].enabled == false)
            {
                DestroyImmediate(effDComs[n]);
            }
        }
    }
Пример #11
0
    public static Component ObjectCopy(Component src, Transform dstSelTrans, Object dstSelObj, bool bCreateNewTarget, bool bSearchTarComponent, bool bCopyAllTarComs)
    {
        Component[] tarComs = null;
        Component   retCom  = null;

        // bCreateNewTarget ツ?タフソゥオオ, bSearchTarComponent ツ?タフク?サ?キホ サ?シコセネヌヤ

        if ((bCreateNewTarget == false) && src.GetType() == dstSelObj.GetType())                // スナアヤサ?シコ チカーヌタフ セニエマク? ーータコーヤソ。 オ蠍?チ゚
        {
//          if (NgAssembly.IsValidCopy(dst, src))
            {
                tarComs    = new Component[1];
                tarComs[0] = dstSelObj as Component;
            }
        }
        else
        {
            if (bSearchTarComponent)
            {
                tarComs = dstSelTrans.GetComponents(src.GetType());
            }
        }
        if (tarComs == null || tarComs.Length <= 0)                                             // セ?エル ククオ鯊レ
        {
            tarComs    = new Component[1];
            tarComs[0] = NgSerialized.AddComponent(dstSelTrans.gameObject, (src as Component));
        }
        if (tarComs != null)
        {
            foreach (Component tarcom in tarComs)                                               // ウサソ?コケサ?
            {
                if (src != tarcom)
                {
                    NgSerialized.CopySerialized(src as Component, tarcom);
                    FXMakerHierarchy.inst.OnAddComponent(tarcom);
                    retCom = tarcom;
                    if (bCopyAllTarComs == false)
                    {
                        break;
                    }
                }
            }
        }
        return(retCom);
    }
Пример #12
0
    public static Component ObjectCopy(Component src, Transform dstSelTrans, Object dstSelObj, bool bCreateNewTarget, bool bSearchTarComponent, bool bCopyAllTarComs)
    {
        Component[] tarComs = null;
        Component   retCom  = null;

        // bCreateNewTarget ���̿���, bSearchTarComponent ���̸� ���� ��������

        if ((bCreateNewTarget == false) && src.GetType() == dstSelObj.GetType())                // �űԻ��� ������ �ƴϸ�, �����Կ� �����
        {
//          if (NgAssembly.IsValidCopy(dst, src))
            {
                tarComs    = new Component[1];
                tarComs[0] = dstSelObj as Component;
            }
        }
        else
        {
            if (bSearchTarComponent)
            {
                tarComs = dstSelTrans.GetComponents(src.GetType());
            }
        }
        if (tarComs == null || tarComs.Length <= 0)                                             // ���� ������
        {
            tarComs    = new Component[1];
            tarComs[0] = NgSerialized.AddComponent(dstSelTrans.gameObject, (src as Component));
        }
        if (tarComs != null)
        {
            foreach (Component tarcom in tarComs)                                               // ���� ����
            {
                if (src != tarcom)
                {
                    NgSerialized.CopySerialized(src as Component, tarcom);
                    FXMakerHierarchy.inst.OnAddComponent(tarcom);
                    retCom = tarcom;
                    if (bCopyAllTarComs == false)
                    {
                        break;
                    }
                }
            }
        }
        return(retCom);
    }
    protected void ConvertOneShotToFXMakerBurst()
    {
        ParticleEmitter  pe       = m_Sel.GetComponent <ParticleEmitter>();
        ParticleAnimator pa       = m_Sel.GetComponent <ParticleAnimator>();
        bool             bOneShot = (bool)NgSerialized.GetPropertyValue(new SerializedObject(pe as ParticleEmitter), "m_OneShot");

        if (bOneShot && m_Sel.m_bBurst == false)
        {
            m_Sel.m_bBurst              = true;
            m_Sel.m_fBurstRepeatTime    = pe.maxEnergy;
            m_Sel.m_nBurstRepeatCount   = 1;
            m_Sel.m_fBurstEmissionCount = (int)Random.Range(pe.minEmission, pe.maxEmission + 1);

            pe.emit = false;
            NgSerialized.SetPropertyValue(new SerializedObject(pe as ParticleEmitter), "m_OneShot", false, true);
            if (pa != null)
            {
                pa.autodestruct = false;
            }
        }
    }
Пример #14
0
    void UpdateLines()
    {
        bool bParticle = (IsLegacy() || IsShuriken());

        if ((bParticle == false) && (m_BaseTrans.GetComponent <MeshFilter>() == null || m_BaseTrans.GetComponent <MeshFilter>().mesh == null))
        {
            m_bWireframe = false;
            return;
        }

        ArrayList linesArray = new ArrayList();
        Mesh      mesh;

        if (bParticle)
        {
            mesh             = NgSerialized.GetParticleMesh(GetParticleComponent());
            m_bWorldParticle = NgSerialized.GetSimulationSpaceWorld(m_BaseTrans);
        }
        else
        {
            mesh = m_BaseTrans.GetComponent <MeshFilter>().mesh;
        }

        if (mesh != null)
        {
            Vector3[] vertices  = mesh.vertices;
            int[]     triangles = mesh.triangles;

            for (int i = 0; i < triangles.Length / 3; i++)
            {
                linesArray.Add(vertices[triangles[i * 3]]);
                linesArray.Add(vertices[triangles[i * 3 + 1]]);
                linesArray.Add(vertices[triangles[i * 3 + 2]]);
            }
            m_lines = NgConvert.ToArray <Vector3>(linesArray);
        }
    }
Пример #15
0
    public void OnAutoInitValue()
    {
        NcEffectBehaviour[] oriComs = m_OriginalTrans.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in oriComs)
        {
            effect.OnUpdateToolData();
        }
        NcEffectBehaviour[] insComs = transform.GetComponents <NcEffectBehaviour>();
        foreach (NcEffectBehaviour effect in insComs)
        {
            effect.OnUpdateToolData();
        }

        // Set particleSystem.speed
//      {
//          NcParticleSystem	ncParticleScaleOri	= (m_OriginalTrans.GetComponent<NcParticleSystem>());
//          NcParticleSystem	ncParticleScaleIns	= (transform.GetComponent<NcParticleSystem>());
//          if (ncParticleScaleOri != null && ncParticleScaleIns != null && ncParticleScaleOri.GetComponent<ParticleSystem>() != null)
//          {
//              ncParticleScaleOri.SaveShurikenSpeed();
//              ncParticleScaleIns.SaveShurikenSpeed();
//          }
//      }

        // Update bWorldSpace
        {
            NcParticleSystem ncParticleScaleOri = (m_OriginalTrans.GetComponent <NcParticleSystem>());
            NcParticleSystem ncParticleScaleIns = (transform.GetComponent <NcParticleSystem>());
            if (ncParticleScaleOri != null && ncParticleScaleIns != null)
            {
                ncParticleScaleIns.m_bWorldSpace = ncParticleScaleOri.m_bWorldSpace = NgSerialized.GetSimulationSpaceWorld(ncParticleScaleOri.transform);
            }
        }
    }
Пример #16
0
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();
        Rect buttonRect;
        Rect lineRect;

        if (UnfocusClose(baseRect, -10, 0, 0, 0))
        {
            return;
        }

        baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1);

        Transform transOriginalRoot = FXMakerMain.inst.GetOriginalEffectObject().transform;
        int       nButtonCount      = m_nButtonCount * 2;
        int       nDrawCount        = 0;
        bool      bEnable           = false;

        // Copy
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy"), true))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Cut
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Cut"), bEnable))
        {
            FXMakerClipboard.inst.SetClipboardObject(m_SelectedObject);
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Paste
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsObject();     break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare");      break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste", FXMakerClipboard.inst.GetName()), bEnable))
        {
            Object tarObj = FXMakerClipboard.inst.PasteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            if (tarObj is GameObject)
            {
                SetAddObject((tarObj as GameObject), tarObj);
            }
            else
            {
                SetAddObject(null, tarObj);
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Overwrite
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:            bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = FXMakerClipboard.inst.IsTransform() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = FXMakerClipboard.inst.IsComponent() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();             break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = FXMakerClipboard.inst.IsMaterial() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType();              break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = FXMakerClipboard.inst.IsAnimationClip() && FXMakerClipboard.inst.GetObject().GetType() == m_SelectedObject.GetType(); break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Overwrite", FXMakerClipboard.inst.GetName()), bEnable))
        {
            FXMakerClipboard.inst.OverwriteClipboardObject(m_SelectedTransform.gameObject, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // Duplicate
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);   break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = false;        break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Duplicate"), bEnable))
        {
            switch (m_SelObjectType)
            {
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    SetAddObject(FXMakerHierarchy.inst.AddGameObject(m_SelectedTransform.transform.parent.gameObject, m_SelectedTransform.gameObject), null);               break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:
            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 m_AddComObject = NgSerialized.CloneComponent(m_SelectedObject as Component, (m_SelectedObject as Component).gameObject, false); break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              break;

            case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               break;

            default: Debug.LogWarning("not declare"); break;
            }
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Disable
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            bool bObjEnable = (m_SelectedTransform.gameObject.GetComponent <NcDontActive>() == null);
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), (bObjEnable ? GetHelpContent("Disable") : GetHelpContent("Enable")), (m_SelectedTransform != transOriginalRoot)))
            {
                FXMakerHierarchy.inst.SetEnableGameObject(m_SelectedTransform.gameObject, !bObjEnable);
                ClosePopup(true);
                return;
            }
        }
        else
        {
            buttonRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2);
            if (m_SelectedObject is Component)
            {
                int nObjEnable = EditorUtility.GetObjectEnabled(m_SelectedObject);
                if (0 <= nObjEnable)
                {
                    if (0 < nObjEnable)
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Disable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, false);
                            ClosePopup(true);
                            return;
                        }
                    }
                    else
                    {
                        if (GUI.Button(buttonRect, GetHelpContent("Enable")))
                        {
                            EditorUtility.SetObjectEnabled(m_SelectedObject, true);
                            ClosePopup(true);
                            return;
                        }
                    }
                }
                else
                {
                    FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
                }
            }
            else
            {
                FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Disable"), false);
            }
        }
        nDrawCount += 2;


        // Delete
        switch (m_SelObjectType)
        {
        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT:    bEnable = (m_SelectedTransform != transOriginalRoot);  break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_TRANSFORM:             bEnable = false;        break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_EASYEFFECT:    bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_UNITYENGINE:   bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_OTHER:                 bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL:              bEnable = true;         break;

        case FXMakerHierarchy.OBJECT_TYPE.OBJECT_ANICLIP:               bEnable = true;         break;

        default: Debug.LogWarning("not declare"); break;
        }
        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Delete"), bEnable))
        {
            FXMakerHierarchy.inst.DeleteHierarchyObject(m_SelectedTransform, m_SelectedObject, m_nSelectedIndex);
            ClosePopup(true);
            return;
        }
        nDrawCount += 2;

        // Draw line
        lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 1);
        NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height / 2), (int)lineRect.width, Color.gray, 2, false);
        nDrawCount += 1;

        // -------------------------------------------------------------------------------------
        if (m_SelectedObject is NcCurveAnimation)
        {
            // NcCurveAnimation
            NcCurveAnimation curveCom = m_SelectedObject as NcCurveAnimation;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("SaveCurves"), 0 < curveCom.GetCurveInfoCount()))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, true);
                return;
            }
            nDrawCount += 2;
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("LoadCurves"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowNcCurveAnimationPopup(curveCom, false);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_GAMEOBJECT)
        {
            // Add Child
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Child"), true))
            {
//              GameObject	newChild	= new GameObject("GameObject");
//              newChild.transform.parent = m_SelectedTransform;
//              FXMakerHierarchy.inst.OnAddGameObject(newChild);
//              SetAddObject(newChild, null);
//              ClosePopup(true);

                FXMakerHierarchy.inst.ShowAddObjectRightPopup();
                ClosePopup(false);

                return;
            }
            nDrawCount += 2;

            // Add Parent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Parent"), true))
            {
                GameObject newParent = new GameObject("GameObject");
                newParent.transform.parent = m_SelectedTransform.parent;
                m_SelectedTransform.parent = newParent.transform;
                m_SelectedTransform.name   = m_SelectedTransform.name.Replace("(Original)", "");
                if (m_SelectedTransform == transOriginalRoot)
                {
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(newParent);
                }
                FXMakerHierarchy.inst.OnAddGameObject(newParent);
                SetAddObject(newParent, null);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // MoveToParent
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("MoveToParent"), (m_SelectedTransform != transOriginalRoot && (m_SelectedTransform.parent != transOriginalRoot) || (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1))))
            {
                if (m_SelectedTransform.parent == transOriginalRoot && transOriginalRoot.childCount == 1)
                {
                    FXMakerMain.inst.SaveTool("");
                    m_SelectedTransform = FXMakerMain.inst.GetOriginalEffectObject().transform;
                    // root swap
                    Transform toolRoot  = m_SelectedTransform.parent;
                    Transform newParent = m_SelectedTransform.GetChild(0);
                    Transform newChild  = m_SelectedTransform;
                    newChild.parent     = null;
                    newParent.parent    = null;
                    newChild.parent     = newParent;
                    newParent.parent    = toolRoot;
                    m_SelectedTransform = newParent;
                    FXMakerMain.inst.ChangeRoot_OriginalEffectObject(m_SelectedTransform.gameObject);
                    SetAddObject(null, null);
                }
                else
                {
                    m_SelectedTransform.parent = m_SelectedTransform.parent.parent;
                }
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Add Component
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Component"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowHierarchyObjectPopup("FxmPopup_GameObject", m_SelectedTransform.gameObject);
                return;
            }
            nDrawCount += 2;

            // Add Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Add Prefab"), true))
            {
                FxmPopupManager.inst.ShowAddPrefabPopup(m_SelectedTransform);
                ClosePopup(true);
                return;
            }
            nDrawCount += 2;

            // Save Prefab
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Save Prefab"), true))
            {
                ClosePopup(true);
                FxmPopupManager.inst.ShowSavePrefabPopup(m_SelectedTransform);
                return;
            }
            nDrawCount += 2;
        }
        // -------------------------------------------------------------------------------------
        if (m_SelObjectType == FXMakerHierarchy.OBJECT_TYPE.OBJECT_MATERIAL)
        {
            bEnable = NgMaterial.IsMaterialColor(m_SelectedObject as Material);

            // Copy Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Copy Color"), bEnable))
            {
                FXMakerClipboard.inst.SetClipboardColor(NgMaterial.GetMaterialColor(m_SelectedObject as Material));
                ClosePopup(true);
                return;
            }
            if (bEnable)
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, NgMaterial.GetMaterialColor(m_SelectedObject as Material));
            }
            nDrawCount += 2;

            // Paste Color
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), GetHelpContent("Paste Color"), bEnable))
            {
                FXMakerClipboard.inst.PasteClipboardColor(m_SelectedTransform, m_nSelectedIndex, m_SelectedObject as Material);
                ClosePopup(true);
                return;
            }
            {
                Rect colorRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(baseRect, nButtonCount, nDrawCount, 2), -5);
                colorRect.width = colorRect.height;
                EditorGUIUtility.DrawColorSwatch(colorRect, FXMakerClipboard.inst.m_CopyColor);
            }
            nDrawCount += 2;
        }

        m_nButtonCount = nDrawCount / 2;
        FXMakerMain.inst.SaveTooltip();
    }
Пример #17
0
    // ==========================================================================================================
    protected override void DrawBottomRect(Rect baseRect)
    {
        GUI.Box(baseRect, "");

        GUIContent guiCon;
        Rect       imageRect = baseRect;

        imageRect.width = FXMakerLayout.GetFixedWindowWidth();
        Rect rightRect = baseRect;

        rightRect.x     += imageRect.width;
        rightRect.width -= imageRect.width;
        rightRect        = FXMakerLayout.GetOffsetRect(rightRect, 5, 3, -5, -3);

        Rect buttonRect = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 0, 5);

        if (m_bSaveDialog)
        {
            Rect labelRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 2, 3);
            GUI.Label(FXMakerLayout.GetLeftRect(labelRect, 100), "Filename:");
            Rect   editRect     = FXMakerLayout.GetInnerVerticalRect(baseRect, 12, 5, 5);
            string saveFilename = GUI.TextField(editRect, m_SaveFilename, 50);
            if (saveFilename != m_SaveFilename)
            {
                if (saveFilename.Trim() != "")
                {
                    m_SaveFilename = saveFilename;
                }
            }
        }
        else
        {
            bool bPreviewEnable = false;
            // image
            if (m_SelObjectContent == null)
            {
                guiCon = new GUIContent("[Not Selected]");
                // original mesh preview
                if (m_bDialogType == DIALOG_TYPE.SELECT && m_bSelectMeshDialog && m_OldSelectMesh != null)
                {
                    Texture2D preview = NgAsset.GetAssetPreview(m_OldSelectMesh);
                    guiCon         = new GUIContent(m_OldSelectMesh.name, preview, GetMeshInfo(m_OldSelectMesh));
                    bPreviewEnable = true;
                }
            }
            else
            {
                guiCon         = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip);
                bPreviewEnable = (m_SelObjectContent != null);
            }

            if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), bPreviewEnable))
            {
                if (m_bDialogType == DIALOG_TYPE.SELECT)
                {
                    if (m_bSelectMeshDialog)
                    {
                        Object pingObj;
                        Object pingMesh;
                        if (m_AddPrefabObject != null)
                        {
                            pingObj  = m_AddPrefabObject;
                            pingMesh = m_AddPrefabObject.GetComponent <MeshFilter>().sharedMesh;
                        }
                        else
                        {
                            pingObj  = m_OldSelectMesh;
                            pingMesh = m_OldSelectMesh;
                        }

                        if (Input.GetMouseButtonUp(0))
                        {
                            FXMakerAsset.SetPingObject(pingObj);
                            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                        }
                        if (Input.GetMouseButtonUp(1))
                        {
                            FXMakerAsset.SetPingObject(pingMesh);
                        }
                    }
                    else
                    {
                        FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                    }
                }
                else
                {
                    if (Input.GetMouseButtonUp(0))
                    {
                        FXMakerAsset.SetPingObject(m_AddGameObject);
                        FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                    }
                    if (Input.GetMouseButtonUp(1))
                    {
                        FXMakerAsset.SetPingObject(GetObjectNodePrefab(m_nObjectIndex));
                    }
                }
            }

            // text
            GUI.Label(FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text));
        }

        if (m_bSaveDialog)
        {
            bool bSaveEnable    = (0 <= m_nGroupIndex && 0 < m_nGroupCount);
            bool bReadOnyFolder = false;

            if (bSaveEnable)
            {
                bReadOnyFolder = 0 < IsReadOnlyFolder();
                bSaveEnable    = !bReadOnyFolder;
            }

            // Cancel
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Cancel"), true))
            {
                ClosePopup(false);
                return;
            }
            // save
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Save", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Save")), bSaveEnable))
            {
                SaveCurrentObjectToPrefabFile();
                ClosePopup(true);
//              FXMakerEffect.inst.LoadProject();
            }
            if (m_bDrawRedBottomButtom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
            if (m_bDrawRedBottom)
            {
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(baseRect, 2), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false);
            }
        }
        else
        {
            // Undo
            int nButtonWidht = 70;
            buttonRect.width = nButtonWidht / 2;
            if (FXMakerLayout.GUIButton(buttonRect, GetHelpContent("Undo"), (m_AddGameObject != null)))
            {
                if (m_bDialogType == DIALOG_TYPE.SELECT)
                {
                    if (m_bSelectMeshDialog)
                    {
                        NgSerialized.SetMesh(m_SelectMeshComponent, m_OldSelectMesh, true);
                        FXMakerHierarchy.inst.UpdateMeshList();
                    }
                    else
                    {
                        SetAttachPrefab(m_OldSelectPrefab);
                    }
                    m_AddGameObject = null;
                }
                else
                {
                    m_AddGameObjectList.Remove(m_AddGameObject);
                    DestroyImmediate(m_AddGameObject);
                    if (0 < m_AddGameObjectList.Count)
                    {
                        m_AddGameObject = m_AddGameObjectList[0];
                    }
                }
                m_nObjectIndex           = -1;
                m_nSelObjectGroupIndex   = -1;
                m_nSelObjectProjectIndex = -1;
                m_SelObjectContent       = null;
                m_AddPrefabObject        = null;

                if (m_bDialogType == DIALOG_TYPE.SELECT)
                {
                    FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                }
                else
                {
                    if (FXMakerHierarchy.inst.SetActiveGameObject(m_SelectedTransform.gameObject) == false)
                    {
                        FXMakerMain.inst.CreateCurrentInstanceEffect(true);
                    }
                }
            }

            // close
            buttonRect.x    += buttonRect.width + 5;
            buttonRect.width = baseRect.width - buttonRect.x;
            if (GUI.Button(buttonRect, GetHelpContent("Close")))
            {
                ClosePopup(true);
            }
        }
    }
    public override void OnInspectorGUI()
    {
        AddScriptNameField(m_Sel);
        m_UndoManager.CheckUndo();

        m_FxmPopupManager = GetFxmPopupManager();

        bool bClickButton = false;

        EditorGUI.BeginChangeCheck();
        {
            m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag);

            m_Sel.m_fStartDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fStartDelayTime"), m_Sel.m_fStartDelayTime);
            // --------------------------------------------------------------------------------------------------------------------------------------------
            if (IsParticleEmitterOneShot())
            {
                Rect butRect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight));
                {
                    if (FXMakerLayout.GUIButton(butRect, GetHelpContent("Convert: OneShot To FXMakerBurst"), true))
                    {
                        ConvertOneShotToFXMakerBurst();
                        return;
                    }
                    GUILayout.Label("");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }
            // --------------------------------------------------------------------------------------------------------------------------------------------
            m_Sel.m_bBurst = EditorGUILayout.Toggle(GetHelpContent("m_bBurst"), m_Sel.m_bBurst);
            if (m_Sel.m_bBurst)
            {
                m_Sel.m_fBurstRepeatTime    = EditorGUILayout.FloatField(GetHelpContent("m_fBurstRepeatTime"), m_Sel.m_fBurstRepeatTime);
                m_Sel.m_nBurstRepeatCount   = EditorGUILayout.IntField(GetHelpContent("m_nBurstRepeatCount"), m_Sel.m_nBurstRepeatCount);
                m_Sel.m_fBurstEmissionCount = EditorGUILayout.IntField(GetHelpContent("m_fBurstEmissionCount"), m_Sel.m_fBurstEmissionCount);
                SetMinValue(ref m_Sel.m_fBurstRepeatTime, 0.01f);
            }
            else
            {
                m_Sel.m_fEmitTime  = EditorGUILayout.FloatField(GetHelpContent("m_fEmitTime"), m_Sel.m_fEmitTime);
                m_Sel.m_fSleepTime = EditorGUILayout.FloatField(GetHelpContent("m_fSleepTime"), m_Sel.m_fSleepTime);
            }

            m_Sel.m_bScaleWithTransform = EditorGUILayout.Toggle(GetHelpContent("m_bScaleWithTransform"), m_Sel.m_bScaleWithTransform);
            // --------------------------------------------------------------------------------------------------------------------------------------------
            if (m_Sel.GetComponent <ParticleEmitter>() != null && m_Sel.m_bScaleWithTransform && m_Sel.transform.lossyScale != Vector3.one)
            {
                Rect butRect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight));
                {
                    if (FXMakerLayout.GUIButton(butRect, GetHelpContent("Convert To Static Scale"), true))
                    {
                        ConvertToStaticScale(m_Sel.GetComponent <ParticleEmitter>(), m_Sel.GetComponent <ParticleAnimator>());
                        m_Sel.m_bScaleWithTransform = false;
                        return;
                    }
                    GUILayout.Label("");
                }
                EditorGUILayout.EndHorizontal();
                EditorGUILayout.Space();
            }

            // --------------------------------------------------------------------------------------------------------------------------------------------
            bool bWorldSpace = EditorGUILayout.Toggle(GetHelpContent("m_bWorldSpace"), m_Sel.m_bWorldSpace);
            // Set bWorldSpace
            if (m_Sel.m_bWorldSpace != bWorldSpace)
            {
                m_Sel.m_bWorldSpace = bWorldSpace;
                NgSerialized.SetSimulationSpaceWorld(m_Sel.transform, bWorldSpace);
            }
            // Update bWorldSpace
            if (m_Sel.m_bWorldSpace != NgSerialized.GetSimulationSpaceWorld(m_Sel.transform))
            {
                m_Sel.m_bWorldSpace = !m_Sel.m_bWorldSpace;
            }
            // --------------------------------------------------------------------------------------------------------------------------------------------

            m_Sel.m_fStartSizeRate     = EditorGUILayout.FloatField(GetHelpContent("m_fStartSizeRate"), m_Sel.m_fStartSizeRate);
            m_Sel.m_fStartLifeTimeRate = EditorGUILayout.FloatField(GetHelpContent("m_fStartLifeTimeRate"), m_Sel.m_fStartLifeTimeRate);
            m_Sel.m_fStartEmissionRate = EditorGUILayout.FloatField(GetHelpContent("m_fStartEmissionRate"), m_Sel.m_fStartEmissionRate);
            m_Sel.m_fStartSpeedRate    = EditorGUILayout.FloatField(GetHelpContent("m_fStartSpeedRate"), m_Sel.m_fStartSpeedRate);
            m_Sel.m_fRenderLengthRate  = EditorGUILayout.FloatField(GetHelpContent("m_fRenderLengthRate"), m_Sel.m_fRenderLengthRate);

            if (m_Sel.GetComponent <ParticleEmitter>() != null && NgSerialized.IsMeshParticleEmitter(m_Sel.GetComponent <ParticleEmitter>()))
            {
                m_Sel.m_fLegacyMinMeshNormalVelocity = EditorGUILayout.FloatField(GetHelpContent("m_fLegacyMinMeshNormalVelocity"), m_Sel.m_fLegacyMinMeshNormalVelocity);
                m_Sel.m_fLegacyMaxMeshNormalVelocity = EditorGUILayout.FloatField(GetHelpContent("m_fLegacyMaxMeshNormalVelocity"), m_Sel.m_fLegacyMaxMeshNormalVelocity);
            }

            if (m_Sel.GetComponent <ParticleSystem>() != null)
            {
                float fShurikenSpeedRate = EditorGUILayout.FloatField(GetHelpContent("m_fShurikenSpeedRate"), m_Sel.m_fShurikenSpeedRate);
                // Set particleSystem.speed
                if (m_Sel.m_fShurikenSpeedRate != fShurikenSpeedRate)
                {
                    m_Sel.m_fShurikenSpeedRate = fShurikenSpeedRate;
                    m_Sel.SaveShurikenSpeed();
                }
            }

            // m_ParticleDestruct
            m_Sel.m_ParticleDestruct = (NcParticleSystem.ParticleDestruct)EditorGUILayout.EnumPopup(GetHelpContent("m_ParticleDestruct"), m_Sel.m_ParticleDestruct, GUILayout.MaxWidth(Screen.width));
            if (m_Sel.m_ParticleDestruct != NcParticleSystem.ParticleDestruct.NONE)
            {
                if (m_Sel.m_ParticleDestruct == NcParticleSystem.ParticleDestruct.COLLISION)
                {
                    m_Sel.m_CollisionLayer   = LayerMaskField(GetHelpContent("m_CollisionLayer"), m_Sel.m_CollisionLayer);
                    m_Sel.m_fCollisionRadius = EditorGUILayout.FloatField(GetHelpContent("m_fCollisionRadius"), m_Sel.m_fCollisionRadius);
                }
                if (m_Sel.m_ParticleDestruct == NcParticleSystem.ParticleDestruct.WORLD_Y)
                {
                    m_Sel.m_fDestructPosY = EditorGUILayout.FloatField(GetHelpContent("m_fDestructPosY"), m_Sel.m_fDestructPosY);
                }
                m_Sel.m_AttachPrefab    = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_AttachPrefab"), m_Sel.m_AttachPrefab, typeof(GameObject), false, null);
                m_Sel.m_fPrefabScale    = EditorGUILayout.FloatField(GetHelpContent("m_fPrefabScale"), m_Sel.m_fPrefabScale);
                m_Sel.m_fPrefabSpeed    = EditorGUILayout.FloatField(GetHelpContent("m_fPrefabSpeed"), m_Sel.m_fPrefabSpeed);
                m_Sel.m_fPrefabLifeTime = EditorGUILayout.FloatField(GetHelpContent("m_fPrefabLifeTime"), m_Sel.m_fPrefabLifeTime);

                SetMinValue(ref m_Sel.m_fCollisionRadius, 0.01f);
                SetMinValue(ref m_Sel.m_fPrefabScale, 0.01f);
                SetMinValue(ref m_Sel.m_fPrefabSpeed, 0.01f);
                SetMinValue(ref m_Sel.m_fPrefabLifeTime, 0);

                // --------------------------------------------------------------
                EditorGUILayout.Space();
                Rect attRect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight));
                {
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(attRect, 3, 0, 1), GetHelpContent("Select Prefab"), (m_FxmPopupManager != null)))
                    {
                        m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0);
                    }
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(attRect, 3, 1, 1), GetHelpContent("Clear Prefab"), (m_Sel.m_AttachPrefab != null)))
                    {
                        bClickButton         = true;
                        m_Sel.m_AttachPrefab = null;
                    }
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(attRect, 3, 2, 1), GetHelpContent("Open Prefab"), (m_FxmPopupManager != null) && (m_Sel.m_AttachPrefab != null)))
                    {
                        bClickButton = true;
                        GetFXMakerMain().OpenPrefab(m_Sel.m_AttachPrefab);
                        return;
                    }
                    GUILayout.Label("");
                }
                EditorGUILayout.EndHorizontal();
            }


            // ---------------------------------------------------------------------
            // current ParticleSystem
            EditorGUILayout.Space();
            Component currentParticle = null;
            Rect      rect            = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 3));
            {
                if ((currentParticle = m_Sel.gameObject.GetComponent <ParticleSystem>()) != null)
                {
                    ParticleSystemRenderer psr = m_Sel.gameObject.GetComponent <ParticleSystemRenderer>();
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 2), GetHelpContent("Delete Shuriken Components"), true))
                    {
                        bClickButton = true;
                        Object.DestroyImmediate(currentParticle);
                        if (psr != null)
                        {
                            Object.DestroyImmediate(psr);
                        }
                    }
                    if (psr == null)
                    {
                        FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox);
                        if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), GetHelpContent("Add ParticleSystemRenderer"), true))
                        {
                            bClickButton = true;
                            m_Sel.gameObject.AddComponent <ParticleSystemRenderer>();
                        }
                        FXMakerLayout.GUIColorRestore();
                    }
                    else
                    {
                        FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), "ParticleSystemRenderer", false);
                    }
                }
                else
                {
                    if ((currentParticle = m_Sel.gameObject.GetComponent <ParticleEmitter>()) != null)
                    {
                        ParticleAnimator pa = m_Sel.gameObject.GetComponent <ParticleAnimator>();
                        ParticleRenderer pr = m_Sel.gameObject.GetComponent <ParticleRenderer>();

                        if (currentParticle.ToString().Contains("EllipsoidParticleEmitter"))
                        {
                            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 1), GetHelpContent("Delete Legacy(Ellipsoid) Components"), true))
                            {
                                bClickButton = true;
                                Object.DestroyImmediate(currentParticle);
                                if (pa != null)
                                {
                                    Object.DestroyImmediate(pa);
                                }
                                if (pr != null)
                                {
                                    Object.DestroyImmediate(pr);
                                }
                            }
                        }
                        else
                        {
                            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 1), GetHelpContent("Delete Legacy(Mesh) Components"), true))
                            {
                                bClickButton = true;
                                Object.DestroyImmediate(currentParticle);
                                if (pa != null)
                                {
                                    Object.DestroyImmediate(pa);
                                }
                                if (pr != null)
                                {
                                    Object.DestroyImmediate(pr);
                                }
                            }
                        }

                        if (pa == null)
                        {
                            FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox);
                            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1), GetHelpContent("Add ParticleAnimator"), true))
                            {
                                bClickButton = true;
                                m_Sel.gameObject.AddComponent <ParticleAnimator>();
                            }
                            FXMakerLayout.GUIColorRestore();
                        }
                        else
                        {
                            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1), "ParticleAnimator", false);
                        }
                        if (pr == null)
                        {
                            FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox);
                            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), GetHelpContent("Add ParticleRenderer"), true))
                            {
                                bClickButton = true;
                                m_Sel.gameObject.AddComponent <ParticleRenderer>();
                            }
                            FXMakerLayout.GUIColorRestore();
                        }
                        else
                        {
                            FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), "ParticleRenderer", false);
                        }
                    }
                }

                // ---------------------------------------------------------------------
                // Create ParticleSystem
                if (currentParticle == null)
                {
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 1), GetHelpContent("Add Shuriken Components"), true))
                    {
                        bClickButton = true;
                        m_Sel.gameObject.AddComponent <ParticleSystem>();
                        if (m_Sel.gameObject.GetComponent <ParticleSystemRenderer>() == null)
                        {
                            m_Sel.gameObject.AddComponent <ParticleSystemRenderer>();
                        }
                    }
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1), GetHelpContent("Add Legacy(Ellipsoid) Components"), true))
                    {
                        bClickButton = true;
                        m_Sel.gameObject.AddComponent <EllipsoidParticleEmitter>();
                        if (m_Sel.gameObject.GetComponent <ParticleAnimator>() == null)
                        {
                            m_Sel.gameObject.AddComponent <ParticleAnimator>();
                        }
                        if (m_Sel.gameObject.GetComponent <ParticleRenderer>() == null)
                        {
                            m_Sel.gameObject.AddComponent <ParticleRenderer>();
                        }
                    }
                    if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), GetHelpContent("Add Legacy(Mesh) Components"), true))
                    {
                        bClickButton = true;
                        m_Sel.gameObject.AddComponent <MeshParticleEmitter>();
                        if (m_Sel.gameObject.GetComponent <ParticleAnimator>() == null)
                        {
                            m_Sel.gameObject.AddComponent <ParticleAnimator>();
                        }
                        if (m_Sel.gameObject.GetComponent <ParticleRenderer>() == null)
                        {
                            m_Sel.gameObject.AddComponent <ParticleRenderer>();
                        }
                    }
                }
                GUILayout.Label("");
            }
            EditorGUILayout.EndHorizontal();
        }
        m_UndoManager.CheckDirty();
        // ---------------------------------------------------------------------
        if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain())
        {
            OnEditComponent();
        }
        // ---------------------------------------------------------------------
        if (GUI.tooltip != "")
        {
            m_LastTooltip = GUI.tooltip;
        }
        HelpBox(m_LastTooltip);
    }
    // ----------------------------------------------------------------------------------------------------------
    protected override void SetActiveObject(int nObjectIndex)
    {
        if (nObjectIndex < 0 || m_nObjectCount <= nObjectIndex)
        {
            return;
        }

        bool       bAppend   = false;
        GameObject selPrefab = GetObjectNodePrefab(nObjectIndex);

        // right button, image Ping and not select
        if (Input.GetMouseButtonUp(1))
        {
            if (m_bDialogType == DIALOG_TYPE.ADD && FXMakerOption.inst.m_PrefabDlg_RightClick == FXMakerOption.DLG_RIGHTCLICK.APPEND)
            {
                bAppend = true;
            }
            else
            {
//	            if (m_bDialogType == DIALOG_TYPE.SELECT == false)
                FXMakerAsset.SetPingObject(selPrefab);
                return;
            }
        }

        // 같은것 재클릭
        if (m_nObjectIndex == nObjectIndex)
        {
//			if (m_bDialogType != DIALOG_TYPE.SELECT)
            FXMakerAsset.SetPingObject(m_AddGameObject);
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
            return;
        }

        if (m_bDialogType == DIALOG_TYPE.SELECT)
        {
            m_AddPrefabObject = selPrefab;
            m_AddGameObject   = selPrefab;

            if (m_bSelectMeshDialog)
            {
                MeshFilter meshFilter = m_AddPrefabObject.GetComponent <MeshFilter>();
                if (meshFilter != null && meshFilter.sharedMesh != null)
                {
                    NgSerialized.SetMesh(m_SelectMeshComponent, meshFilter.sharedMesh, true);
                    FXMakerHierarchy.inst.UpdateMeshList();
                }
            }
            else
            {
                SetAttachPrefab(selPrefab);
            }
            FXMakerMain.inst.CreateCurrentInstanceEffect(true);
        }
        else
        {
            if (bAppend == false)
            {
                // 기존것 삭제
                if (m_AddGameObject != null)
                {
                    m_AddGameObjectList.Remove(m_AddGameObject);
                    DestroyImmediate(m_AddGameObject);
                    m_AddGameObject = null;
                }
            }

            // create
            m_AddPrefabObject = selPrefab;
            m_AddGameObject   = FXMakerHierarchy.inst.AddGameObject(m_SelectedTransform.gameObject, selPrefab);
            m_AddGameObjectList.Insert(0, m_AddGameObject);

            if (FXMakerHierarchy.inst.SetActiveGameObject(m_AddGameObject) == false)
            {
                FXMakerMain.inst.CreateCurrentInstanceEffect(true);
            }
        }

        m_nObjectIndex           = nObjectIndex;
        m_nSelObjectProjectIndex = m_nProjectIndex;
        m_nSelObjectGroupIndex   = (m_bOptionRecursively ? -1 : m_nGroupIndex);
        m_SelObjectContent       = new GUIContent(m_ObjectContents[nObjectIndex].text, m_ObjectContents[nObjectIndex].image, m_ObjectContents[nObjectIndex].tooltip);
    }
Пример #20
0
 void SetLocalEulerAnglesHint(Transform trans, Vector3 localEulerAngle)
 {
     NgSerialized.SetPropertyValue(new SerializedObject(trans), "m_LocalEulerAnglesHint", localEulerAngle, true);
 }
Пример #21
0
 Vector3 GetLocalEulerAnglesHint(Transform trans)
 {
     return((Vector3)NgSerialized.GetPropertyValue(new SerializedObject(trans), "m_LocalEulerAnglesHint"));
 }
Пример #22
0
    // Event -------------------------------------------------------------------------
    // Function ----------------------------------------------------------------------
    public bool SetWireframe(bool bWireframe, bool bTexture, bool bRoot)
    {
        if (m_BaseTrans == null || m_BaseTrans.renderer == null)
        {
            m_bWireframe = false;
            return(false);
        }

        m_bTexture   = bTexture;
        m_bWireframe = bWireframe;
        m_bRoot      = bRoot;
//		m_BaseTrans.renderer.enabled = m_bTexture;
//      if (bWireframe == false)
//      {
//          m_bWireframe = false;
//          return false;
//      }

        bool bParticle = (IsLegacy() || IsShuriken());

        if ((bParticle == false) && (m_BaseTrans.GetComponent <MeshFilter>() == null || m_BaseTrans.GetComponent <MeshFilter>().sharedMesh == null))
        {
            m_bWireframe = false;
            return(false);
        }

//      m_meshRenderer = GetComponent<MeshRenderer>();
//      if (!m_meshRenderer)
//          m_meshRenderer = gameObject.AddComponent<MeshRenderer>();
//      if (m_meshRenderer.material == null)
//      {
//          m_meshRenderer.material = new Material("Shader \"Lines/Background\" { Properties { _Color (\"Main Color\", Color) = (1,1,1,1) } SubShader { Pass {" + (m_ZWrite ? " ZWrite on " : " ZWrite off ") + (m_blend ? " Blend SrcAlpha OneMinusSrcAlpha" : " ") + (m_AWrite ? " Colormask RGBA " : " ") + "Lighting Off Offset 1, 1 Color[_Color] }}}");
// //           m_meshRenderer.material = FXMakerMain.inst.m_LineBackMaterial;
//      }
        if (m_lineMaterial == null)
        {
//          m_lineMaterial	= new Material("Shader \"Lines/Colored Blended\" { SubShader { Pass { Blend SrcAlpha OneMinusSrcAlpha BindChannels { Bind \"Color\",color } ZWrite On Cull Front Fog { Mode Off } } } }");
            m_lineMaterial                  = FXMakerMain.inst.m_LineColorMaterial;
            m_lineMaterial.hideFlags        = HideFlags.HideAndDontSave;
            m_lineMaterial.shader.hideFlags = HideFlags.HideAndDontSave;
        }

        ArrayList linesArray = new ArrayList();
        Mesh      mesh;

        if (bParticle)
        {
            mesh             = NgSerialized.GetParticleMesh(GetParticleComponent());
            m_bWorldParticle = NgSerialized.GetSimulationSpaceWorld(m_BaseTrans);
        }
        else
        {
            mesh = m_BaseTrans.GetComponent <MeshFilter>().sharedMesh;
        }

        if (mesh != null)
        {
            Vector3[] vertices  = mesh.vertices;
            int[]     triangles = mesh.triangles;

            for (int i = 0; i < triangles.Length / 3; i++)
            {
                linesArray.Add(vertices[triangles[i * 3]]);
                linesArray.Add(vertices[triangles[i * 3 + 1]]);
                linesArray.Add(vertices[triangles[i * 3 + 2]]);
            }
            m_lines = NgConvert.ToArray <Vector3>(linesArray);
        }
        return(m_bWireframe);
    }