// Property ------------------------------------------------------------------------- public bool ShowPopupWindow(NcCurveAnimation ncCurveAni, int nIndex, bool bSaveDialog) { m_CurrentCurveAnimation = ncCurveAni; m_OriCurveInfoIndex = nIndex; if (m_CurrentCurveAnimation == null) { Debug.LogError("ncCurveAni is null"); return false; } // Save Hint Box m_bDrawRedProject = bSaveDialog; m_bDrawRedBottomButtom = bSaveDialog; // backup m_OriCurveInfo = m_CurrentCurveAnimation.GetCurveInfo(nIndex).GetClone(); m_nOriMaxObjectColumn = 3; m_fButtonAspect = FXMakerLayout.m_fScrollButtonAspect; m_SelectedTransform = m_CurrentCurveAnimation.transform; m_SelCurveInfo = null; m_PrefsName = "NcInfoCurve"; m_DefaultProjectName = m_DefaultFileName; m_bFixedOptionRecursively = true; m_bOptionRecursively = false; m_bDisableOptionShowName = true; bool reValue = base.ShowPopupWindow(ncCurveAni, bSaveDialog); // default nGroupIndex if (m_bOnlyCurve == false) m_nGroupIndex = (int)m_CurrentCurveAnimation.GetCurveInfo(nIndex).m_ApplyType+1; return reValue; }
public override void OnGUIPopup() { if (m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex) == null) { ClosePopup(false); } else { base.OnGUIPopup(); // Popup Window --------------------------------------------------------- FXMakerMain.inst.ModalMsgWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP), GetPopupRect(), winPopup, "NcInfoCurve"); } }
// Property ------------------------------------------------------------------------- public bool ShowPopupWindow(NcCurveAnimation ncCurveAni, int nIndex, bool bSaveDialog) { m_CurrentCurveAnimation = ncCurveAni; m_OriCurveInfoIndex = nIndex; if (m_CurrentCurveAnimation == null) { Debug.LogError("ncCurveAni is null"); return(false); } // Save Hint Box m_bDrawRedProject = bSaveDialog; m_bDrawRedBottomButtom = bSaveDialog; // backup m_OriCurveInfo = m_CurrentCurveAnimation.GetCurveInfo(nIndex).GetClone(); m_nOriMaxObjectColumn = 3; m_fButtonAspect = FXMakerLayout.m_fScrollButtonAspect; m_SelectedTransform = m_CurrentCurveAnimation.transform; m_SelCurveInfo = null; m_PrefsName = "NcInfoCurve"; m_DefaultProjectName = m_DefaultFileName; m_bFixedOptionRecursively = true; m_bOptionRecursively = false; m_bDisableOptionShowName = true; bool reValue = base.ShowPopupWindow(ncCurveAni, bSaveDialog); // default nGroupIndex if (m_bOnlyCurve == false) { m_nGroupIndex = (int)m_CurrentCurveAnimation.GetCurveInfo(nIndex).m_ApplyType + 1; } return(reValue); }
// --------------------------------------------------------------------- public string EndCapture(Texture2D[] SpriteTextures) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); return(null); #else int nTexSize = m_nResultTextureSize; int nCapSize = m_nResultCaptureSize; int nMaxCount = (nTexSize / nCapSize) * (nTexSize / nCapSize); int nTexHeight = (m_nSaveFrameCount <= nMaxCount / 2 ? nTexSize / 2 : nTexSize); Texture2D spriteTexture = new Texture2D(nTexSize, nTexHeight, TextureFormat.ARGB32, false); int nSaveCount = 0; for (int x = 0; x < spriteTexture.width; x++) { for (int y = 0; y < spriteTexture.height; y++) { spriteTexture.SetPixel(x, y, Color.black); } } for (int n = m_nSkipFrameCount; n < m_nTotalFrameCount; n++, nSaveCount++) { Color[] srcColors = SpriteTextures[n].GetPixels(0); if (m_ShaderType == SHADER_TYPE.ALPHA_BLENDED || m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE) { srcColors = NgAtlas.ConvertAlphaTexture(srcColors, true, FXMakerOption.inst.m_AlphaWeightCurve, 1, 1, 1); } spriteTexture.SetPixels(((nSaveCount) % (nTexSize / nCapSize)) * nCapSize, nTexHeight - (((nSaveCount) / (nTexSize / nCapSize) + 1) * nCapSize), nCapSize, nCapSize, srcColors); Object.DestroyImmediate(SpriteTextures[n]); } byte[] bytes = spriteTexture.EncodeToPNG(); string texBasePath; if (FXMakerLayout.m_bDevelopState) { texBasePath = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SPRITE_TOOL); } else { texBasePath = FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.SPRITE_USER); } string pathTexture = NgTexture.UniqueTexturePath(texBasePath, m_SelectedPrefabName); // save texture File.WriteAllBytes(pathTexture, bytes); AssetDatabase.Refresh(); NgTexture.ReimportTexture(pathTexture, m_bGUITexture, m_wrapMode, m_filterMode, m_anisoLevel, m_nSpriteTextureSizes[(int)m_fSpriteTextureIndex], m_SpriteTextureFormat[(int)m_fSpriteTextureFormatIdx]); Object.DestroyImmediate(spriteTexture); // Create Prefab if (m_bCreatePrefab) { string pathMaterial = CreateMaterial(pathTexture); Material newMat = (Material)AssetDatabase.LoadAssetAtPath(pathMaterial, typeof(Material)); GameObject newPrefab = (GameObject)Instantiate(FXMakerMain.inst.m_FXMakerSpritePrefab); newPrefab.transform.rotation = Quaternion.identity; newPrefab.GetComponent <Renderer>().material = newMat; NcSpriteAnimation spriteCom = newPrefab.GetComponent <NcSpriteAnimation>(); spriteCom.m_bBuildSpriteObj = true; spriteCom.m_nFrameCount = m_nSaveFrameCount; spriteCom.m_fFps = m_nResultFps; spriteCom.m_nTilingX = m_nResultTextureSize / m_nResultCaptureSize; spriteCom.m_nTilingY = (m_nSaveFrameCount <= spriteCom.m_nTilingX * spriteCom.m_nTilingX / 2 ? spriteCom.m_nTilingX / 2 : spriteCom.m_nTilingX); spriteCom.m_PlayMode = m_PlayMode; spriteCom.m_bLoop = m_bLoop; spriteCom.m_nLoopStartFrame = 0; spriteCom.m_nLoopFrameCount = spriteCom.m_nFrameCount; spriteCom.m_nLoopingCount = 0; spriteCom.m_bAutoDestruct = !m_bLoop; NcCurveAnimation curveCom = newPrefab.GetComponent <NcCurveAnimation>(); if (curveCom.GetCurveInfoCount() != 3) { Debug.LogError("FXMakerMain.inst.m_FxmSpritePrefab : curveCom Count Error!!!"); } curveCom.GetCurveInfo(0).m_bEnabled = false; // both curveCom.GetCurveInfo(1).m_bEnabled = false; // fadein curveCom.GetCurveInfo(2).m_bEnabled = false; // fadeout curveCom.m_bAutoDestruct = false; curveCom.m_fDurationTime = spriteCom.GetDurationTime(); if (m_bFadeIn && m_bFadeOut) { curveCom.GetCurveInfo(0).m_bEnabled = true; } else { if (m_bFadeIn) { curveCom.GetCurveInfo(1).m_bEnabled = true; } if (m_bFadeOut) { curveCom.GetCurveInfo(2).m_bEnabled = true; } } string basePath = AssetDatabase.GetAssetPath(FXMakerMain.inst.GetOriginalEffectPrefab()); string prefabPath = UniquePrefabPath(NgFile.TrimFilenameExt(basePath)); GameObject createPrefab = PrefabUtility.CreatePrefab(prefabPath, newPrefab); Destroy(newPrefab); // Create Thumb CreateSpriteThumb(createPrefab, pathTexture); AssetDatabase.SaveAssets(); return(prefabPath); } else { return(pathTexture); } #endif }