void BuildContents() { if (enabled == false) { return; } m_nNotLoadCount = 0; for (int n = 0; n < m_nObjectCount; n++) { if (m_ObjectContents[n] == null) { m_ObjectContents[n] = new GUIContent(); m_ObjectContents[n].text = NgFile.GetFilename(m_ObjectNodes[n].m_AssetPath); } if (m_ObjectNodes[n].m_Object == null) { m_nNotLoadCount++; } else { m_ObjectContents[n].image = NgAsset.GetMiniThumbnail(m_ObjectNodes[n].m_Object); m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetTextureInfo(m_ObjectContents[n].image, true)); m_ObjectContents[n].tooltip += FXMakerTooltip.AddPopupPreview(m_ObjectContents[n].image); } } }
void AyncLoadObject() { if (enabled == false) { return; } NcTickTimerTool tickTimer = new NcTickTimerTool(); for (int n = 0; n < m_nObjectCount; n++) { if (m_ObjectNodes[n].m_Object == null) { m_ObjectNodes[n].m_Object = GetObjectNodeTexture(n); m_ObjectContents[n].image = NgAsset.GetMiniThumbnail(m_ObjectNodes[n].m_Object); m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetTextureInfo(m_ObjectContents[n].image, true)); m_ObjectContents[n].tooltip += FXMakerTooltip.AddPopupPreview(m_ObjectContents[n].image); m_nNotLoadCount--; // return; if (200 < tickTimer.GetStartedTickCount()) { return; } } } }
void BuildNewShaderContents() { CancelInvoke("BuildNewShaderContents"); if (enabled == false) { return; } if (m_NewShaderMaterials == null || m_NewShaderMaterials.Length <= 0) { return; } int nNotLoadPreviewCount = 0; int nCount = 0; foreach (Material mat in m_NewShaderMaterials) { if (m_NewShaderMaterialContents[nCount] == null) { m_NewShaderMaterialContents[nCount] = new GUIContent(); m_NewShaderMaterialContents[nCount].text = mat.name; m_NewShaderMaterialContents[nCount].tooltip = FXMakerTooltip.Tooltip(mat.name + "\n" + (mat.shader != null ? mat.shader.name : "Not Selected")); } if (m_NewShaderMaterialContents[nCount].image == null) { m_NewShaderMaterialContents[nCount].image = NgAsset.GetAssetPreview(mat); if (m_NewShaderMaterialContents[nCount].image != null) { m_NewShaderMaterialContents[nCount].tooltip += FXMakerTooltip.AddPopupPreview(m_NewShaderMaterialContents[nCount].image); } } if (m_NewShaderMaterialContents[nCount].image == null) { nNotLoadPreviewCount++; } nCount++; } if (0 < nNotLoadPreviewCount) { Invoke("BuildNewShaderContents", FXMakerLayout.m_fReloadPreviewTime); } }
void BuildContents() { CancelInvoke("BuildContents"); if (enabled == false) { return; } int nNotLoadPreviewCount = 0; for (int n = 0; n < m_nObjectCount; n++) { if (m_ObjectContents[n] == null) { string subDir = AssetDatabase.GetAssetPath(m_CurveAniObjects[n]); subDir = NgFile.PathSeparatorNormalize(subDir).Replace(m_LoadDirectory, ""); m_ObjectContents[n] = new GUIContent(); m_ObjectContents[n].text = m_CurveAniObjects[n].name; m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(m_CurveAniObjects[n].name + "\n" + subDir); } if (m_ObjectContents[n].image == null) { m_ObjectContents[n].image = FXMakerMain.inst.GetPrefabThumbTexture(m_CurveAniObjects[n]); if (m_ObjectContents[n].image != null) { m_ObjectContents[n].tooltip += FXMakerTooltip.AddPopupPreview(m_ObjectContents[n].image); } } if (m_ObjectContents[n].image == null) { nNotLoadPreviewCount++; } } if (0 < nNotLoadPreviewCount) { Invoke("BuildContents", FXMakerLayout.m_fReloadPreviewTime); } }
void AyncLoadObject() { if (enabled == false) { return; } NcTickTimerTool tickTimer = new NcTickTimerTool(); for (int n = 0; n < m_nObjectCount; n++) { if (m_ObjectNodes[n].m_Object == null || m_ObjectContents[n].image == null) { if (m_ObjectNodes[n].m_Object == null) { m_ObjectNodes[n].m_Object = GetObjectNodePrefab(n); } if (m_ObjectContents[n].image == null) { m_ObjectContents[n].image = FXMakerMain.inst.GetPrefabThumbTexture(GetObjectNodePrefab(n)); } if (m_ObjectContents[n].image != null) { string subDir = AssetDatabase.GetAssetPath(GetObjectNodePrefab(n)); subDir = NgFile.PathSeparatorNormalize(subDir).Replace(m_LoadDirectory, ""); m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetObjectInfo(GetObjectNodePrefab(n), subDir)); m_ObjectContents[n].tooltip += FXMakerTooltip.AddPopupPreview(m_ObjectContents[n].image); m_nNotLoadCount--; } if (300 < tickTimer.GetStartedTickCount()) { return; } } } }
// ------------------------------------------------------------------------------------------- void winActionToolbar(int id) { Rect popupRect = FXMakerLayout.GetActionToolbarRect(); Rect baseRect; Rect rect; string info = ""; string infotooltip = ""; int nColCount = 10; int nRowCount = 5; GUIContent content; // window desc ----------------------------------------------------------- FXMakerTooltip.WindowDescription(popupRect, FXMakerLayout.WINDOWID.EFFECT_CONTROLS, null); // mini ---------------------------------------------------------------- m_bMinimize = GUI.Toggle(new Rect(3, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), m_bMinimize, "Mini"); if (GUI.changed) { EditorPrefs.SetBool("FXMakerControls.m_bMinimize", m_bMinimize); } GUI.changed = false; if (FXMakerLayout.m_bMinimizeAll || m_bMinimize) { FXMakerLayout.m_fActionToolbarHeight = FXMakerLayout.m_MinimizeHeight; nRowCount = 1; // mesh info ----------------------------------------------------------------- baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1); if (FXMakerMain.inst.IsCurrentEffectObject()) { info = string.Format("P={0} M={1} T={2}", m_nParticleCount, m_nMeshCount, m_nTriangles); infotooltip = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", m_nParticleCount, m_nMeshCount, m_nTriangles, m_nVertices); } GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), new GUIContent(info, FXMakerTooltip.Tooltip(infotooltip))); // CurrentTime Horizontal Slider ---------------------------------------------- if (FXMakerMain.inst.IsCurrentEffectObject()) { float fMaxTime = (m_nRepeatIndex <= m_nPlayIndex) ? m_fPlayToolbarTimes[m_nPlayIndex] : 10.0f; baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1); content = FXMakerTooltip.GetHcEffectControls("ElapsedTime", ""); content.text += " " + (Time.time - m_fPlayStartTime).ToString("0.000"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 2), content); rect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 4, 4); rect.y += 5; GUI.HorizontalSlider(rect, Time.time - m_fPlayStartTime, 0.0f, fMaxTime); // restart baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 2), FXMakerTooltip.GetHcEffectControls("Restart", ""))) { CreateInstanceEffect(); } } FXMakerMain.inst.SaveTooltip(); return; } else { FXMakerLayout.m_fActionToolbarHeight = FXMakerLayout.m_fOriActionToolbarHeight; } // mesh info ----------------------------------------------------------------- baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 2); if (NcEffectBehaviour.GetRootInstanceEffect()) { info = string.Format("P = {0}\nM = {1}\nT = {2}", m_nParticleCount, m_nMeshCount, m_nTriangles); infotooltip = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", m_nParticleCount, m_nMeshCount, m_nTriangles, m_nVertices); } GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 1), new GUIContent(info, FXMakerTooltip.Tooltip(infotooltip))); // control button ------------------------------------------------------------ if (FXMakerMain.inst.IsCurrentEffectObject()) { bool bClick = false; // Play --------------------------------------- GUIContent[] playToolbarContents = FXMakerTooltip.GetHcEffectControls_Play(0, m_fTimeScale, m_fPlayToolbarTimes[1], m_fPlayToolbarTimes[m_nRepeatIndex], m_fPlayToolbarTimes[m_nRepeatIndex + 1], m_fPlayToolbarTimes[m_nRepeatIndex + 2], m_fPlayToolbarTimes[m_nRepeatIndex + 3], m_fPlayToolbarTimes[m_nRepeatIndex + 4]); baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 0, 1); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 1, 1), FXMakerTooltip.GetHcEffectControls("Play", "")); int nPlayIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nPlayIndex, playToolbarContents, playToolbarContents.Length); if (GUI.changed) { bClick = true; } // Trans --------------------------------------- GUIContent[] TransToolbarContents = FXMakerTooltip.GetHcEffectControls_Trans(m_nTransAxis); baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 1, 1); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 1, 1), FXMakerTooltip.GetHcEffectControls("Trans", "")); int nTransIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 8), m_nTransIndex, TransToolbarContents, TransToolbarContents.Length); if (GUI.changed) { bClick = true; m_fTransRate = 1.0f; if ((nTransIndex == 1 || nTransIndex == 2) && Input.GetMouseButtonUp(1)) // m_nTransIndex scale { if (m_nTransAxis == NgEnum.AXIS.Z) { m_nTransAxis = 0; } else { m_nTransAxis++; } UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nTransAxis", (int)m_nTransAxis); } } if (bClick) { FXMakerMain.inst.CreateCurrentInstanceEffect(false); RunActionControl(nPlayIndex, nTransIndex); UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nPlayIndex", m_nPlayIndex); UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nTransIndex", m_nTransIndex); } } // TransSpeed Horizontal Slider ----------------------------------------------- float TransSpeed = m_fDistPerTime; baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 2, 1); content = FXMakerTooltip.GetHcEffectControls("DistPerTime", ""); content.text += " " + m_fDistPerTime.ToString("00.00"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content); rect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5); rect.y += 5; TransSpeed = GUI.HorizontalSlider(rect, TransSpeed, 0.1f, 40.0f); // TransSpeed Trans ---------------------------------------------- // if (GUI.Button(NgLayout.GetInnerHorizontalRect(baseRect, nColCount*2, 23, 1), NgTooltip.GetHcEffectControls("1", ""))) // TransSpeed = 1; if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 14, 1), FXMakerTooltip.GetHcEffectControls("<", ""))) { TransSpeed = (int)(TransSpeed - 1); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 15, 1), FXMakerTooltip.GetHcEffectControls(">", ""))) { TransSpeed = (int)(TransSpeed + 1); } if (TransSpeed != m_fDistPerTime) { m_fDistPerTime = (TransSpeed == 0 ? 0.1f : TransSpeed); UnityEditor.EditorPrefs.SetFloat("FXMakerControls.m_fDistPerTime", m_fDistPerTime); // Trans 상태면.. 바로 적용 if (0 < m_nTransIndex) { CreateInstanceEffect(); } } if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 9, 1), FXMakerTooltip.GetHcEffectControls("Multi", m_nMultiShotCount.ToString()), true)) { if (Input.GetMouseButtonUp(0)) { m_nMultiShotCount++; if (4 < m_nMultiShotCount) { m_nMultiShotCount = 1; } } else { m_nMultiShotCount = 1; } CreateInstanceEffect(); } // front Rotation ---------------------------------------------- GUIContent[] rotateToolbarContents = FXMakerTooltip.GetHcEffectControls_Rotate(); baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 2, 1); int nRotateIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 1), m_nRotateIndex, rotateToolbarContents, rotateToolbarContents.Length); if (nRotateIndex != m_nRotateIndex) { m_nRotateIndex = nRotateIndex; UnityEditor.EditorPrefs.SetInt("FXMakerControls.m_nRotateIndex", m_nRotateIndex); // Trans 상태면.. 바로 적용 if (0 < m_nTransIndex) { CreateInstanceEffect(); } } // timeScale Horizontal Slider ----------------------------------------------- float timeScale = m_fTimeScale; baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 3, 1); content = FXMakerTooltip.GetHcEffectControls("TimeScale", ""); content.text += " " + m_fTimeScale.ToString("0.00"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content); rect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5); rect.y += 5; timeScale = GUI.HorizontalSlider(rect, timeScale, 0.0f, 2.0f); if (timeScale == 0) { if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 1), FXMakerTooltip.GetHcEffectControls("Resume", ""))) { timeScale = m_fOldTimeScale; } } else { if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 1), FXMakerTooltip.GetHcEffectControls("Pause", ""))) { timeScale = 0; } } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 8, 1), FXMakerTooltip.GetHcEffectControls("Reset", ""))) { timeScale = 1; } SetTimeScale(timeScale); // CurrentTime Horizontal Slider ---------------------------------------------- if (FXMakerMain.inst.IsCurrentEffectObject()) { float fMaxTime = (m_nRepeatIndex <= m_nPlayIndex) ? m_fPlayToolbarTimes[m_nPlayIndex] : 10.0f; baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 4, 1); content = FXMakerTooltip.GetHcEffectControls("ElapsedTime", ""); content.text += " " + (Time.time - m_fPlayStartTime).ToString("0.000"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 2), content); rect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 2, 5); rect.y += 5; GUI.HorizontalSlider(rect, Time.time - m_fPlayStartTime, 0.0f, fMaxTime); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 14, 1), FXMakerTooltip.GetHcEffectControls("+.5", ""))) { SetTimeScale(1.0f); Invoke("invokeStopTimer", 0.5f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 15, 1), FXMakerTooltip.GetHcEffectControls("+.1", ""))) { SetTimeScale(0.4f); Invoke("invokeStopTimer", 0.1f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 16, 1), FXMakerTooltip.GetHcEffectControls("+.05", ""))) { SetTimeScale(0.2f); Invoke("invokeStopTimer", 0.05f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount * 2, 17, 1), FXMakerTooltip.GetHcEffectControls("+.01", ""))) { SetTimeScale(0.04f); Invoke("invokeStopTimer", 0.01f); } // restart baseRect = FXMakerLayout.GetChildVerticalRect(popupRect, 0, nRowCount, 3, 2); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 9, 1), FXMakerTooltip.GetHcEffectControls("Restart", ""))) { CreateInstanceEffect(); } } FXMakerMain.inst.SaveTooltip(); }
protected override void LoadObjects() { ArrayList infoList = new ArrayList(); m_CurveInfos = null; m_ObjectContents = null; m_nObjectCount = 0; m_nObjectIndex = -1; if (m_nGroupCount <= 0) { return; } GameObject currentObj = m_CurveAniObjects[m_nProjectIndex]; if (m_bOnlyCurve) { NcCurveAnimation curveAnis = currentObj.GetComponent <NcCurveAnimation>(); if (curveAnis != null) { List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAnis.m_CurveInfoList; for (int n = 0; n < curveInfoList.Count; n++) { curveInfoList[n].m_nTag = n; if (m_nGroupIndex == 0) { infoList.Add(curveInfoList[n]); } else { if (m_nGroupIndex == curveInfoList[n].m_nSortGroup) // 1, 2, 3 { infoList.Add(curveInfoList[n]); } } } } } else { NcCurveAnimation[] curveAnis = currentObj.GetComponents <NcCurveAnimation>(); foreach (NcCurveAnimation curveAni in curveAnis) { List <NcCurveAnimation.NcInfoCurve> curveInfoList = curveAni.m_CurveInfoList; for (int n = 0; n < curveInfoList.Count; n++) { NcCurveAnimation.NcInfoCurve curveInfo = curveInfoList[n]; curveInfo.m_nTag = n; // Add CurveInfo if (m_bSaveDialog) { if (m_OriCurveInfo.m_ApplyType == curveInfo.m_ApplyType) { infoList.Add(curveInfo); } } else { if (0 < m_nGroupIndex) { if (m_nGroupIndex - 1 == (int)curveInfo.m_ApplyType) { infoList.Add(curveInfo); } } else { infoList.Add(curveInfo); } } } } } m_CurveInfos = NgConvert.ToArray <NcCurveAnimation.NcInfoCurve>(infoList); m_nObjectCount = infoList.Count; // build contents string subDir = AssetDatabase.GetAssetPath(m_CurveAniObjects[m_nProjectIndex]); subDir = NgFile.PathSeparatorNormalize(subDir).Replace(m_LoadDirectory, ""); m_ObjectContents = new GUIContent[m_nObjectCount]; for (int n = 0; n < m_nObjectCount; n++) { if (m_ObjectContents[n] == null) { m_ObjectContents[n] = new GUIContent(); m_ObjectContents[n].text = ""; m_ObjectContents[n].tooltip = FXMakerTooltip.Tooltip(GetCurveInfo(m_CurveInfos[n], subDir)); } } Debug.Log("m_nObjectCount " + m_nObjectCount); }
public override bool ShowPopupWindow(Object selObj, bool bSaveDialog) { Material currentObj = selObj as Material; // No Shader Selected if (currentObj != null && (currentObj.shader == null || currentObj.shader.name == "")) { currentObj = null; } // init m_OriMaterial = currentObj; m_OriObjectContent = (currentObj == null ? new GUIContent() : new GUIContent(currentObj.name, currentObj.mainTexture, FXMakerTooltip.Tooltip(GetTextureInfo(currentObj.mainTexture, false)))); m_SelectedMaterial = currentObj; m_CurrentTextureMaterials = null; m_nCurrentTextureMaterialIndex = -1; m_NewShaderMaterials = null; m_nNewShaderMaterialIndex = -1; m_nBottomHeight = m_nOriginalBottomHeight + m_nMaterialBottomHeight + m_nPaletteBottomHeight; m_bUniqueSave = false; m_PrefsName = "Texture"; m_BaseDefaultGroupName = m_DefaultGroupName; bool baseRet = base.ShowPopupWindow(m_SelectedTransform, bSaveDialog); // arg select m_SelObjectContent = m_OriObjectContent; if (currentObj != null) { SetActiveObject(currentObj.mainTexture, false); } return(baseRet); }