// ========================================================================================================== void winPopup(int id) { Rect baseRect = GetPopupRect(); GUIStyle styleList = GUI.skin.GetStyle("List_Box"); if (UnfocusClose(baseRect, 0, 0, 0, 0)) { return; } // -------------------------------------------------------------------------------- int nMargin = 5; int nTopHeight = 25; Rect topRect = FXMakerLayout.GetChildTopRect(baseRect, -nMargin, nTopHeight); Rect bottomRect = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1); Rect leftRect = FXMakerLayout.GetInnerHorizontalRect(bottomRect, 6, 0, 6); // top - Name ---------------------------------------------------------------------------- topRect = FXMakerLayout.GetOffsetRect(topRect, -nMargin / 2); GUI.Box(FXMakerLayout.GetOffsetRect(topRect, 0, -2, 0, 2), ""); Rect nameRect = FXMakerLayout.GetInnerVerticalRect(topRect, 2, 0, 2); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 0, 1), "Name"); GUI.SetNextControlName("TextField"); // FXMakerMain.inst.ToggleGlobalLangSkin(true); string newName = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 1, 4), m_SelectedTransform.name, m_SelectedTransform.gameObject != FXMakerMain.inst.GetOriginalEffectObject()); // FXMakerMain.inst.ToggleGlobalLangSkin(false); if (m_SelectedTransform.name != newName) { m_SelectedTransform.name = newName; if (newName.Trim() != "" && m_SelectedTransform.gameObject == FXMakerMain.inst.GetOriginalEffectObject()) { FXMakerEffect.inst.RenameCurrentPrefab(newName); } } if (Event.current.type == EventType.KeyDown && Event.current.character == '\n') { ClosePopup(true); } // left ---------------------------------------------------------------------------- leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin / 2); GUI.Box(leftRect, ""); leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin); Rect scrollRect = FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 2, 15); int scrollBarWidth = 13; int nCellHeight = 18; scrollRect.width -= scrollBarWidth; GUI.Box(scrollRect, ""); // folder list // m_nGroupIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length); m_nGroupIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length); if (GUI.changed) { LoadScriptList(); } // script list Rect listRect = new Rect(0, 0, scrollRect.width - 1, nCellHeight * m_ScriptScrings.Length); m_PopupScrollPos = GUI.BeginScrollView(scrollRect, m_PopupScrollPos, listRect); GUI.changed = false; // m_nPopupListIndex = GUI.SelectionGrid(listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList); m_nPopupListIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_PopupScrollPos.y), scrollRect, listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList); if (GUI.changed && Input.GetMouseButtonUp(1)) { AddScript(m_ScriptScrings[m_nPopupListIndex]); } GUI.EndScrollView(); // Add script button if (0 <= m_nPopupListIndex && m_nPopupListIndex < m_ScriptContents.Length) { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 17, 3), GetHelpContent("Add Component "), (m_ScriptScrings[m_nPopupListIndex] != ""))) { AddScript(m_ScriptScrings[m_nPopupListIndex]); if (Input.GetMouseButtonUp(0)) { ClosePopup(true); } } } FXMakerMain.inst.SaveTooltip(); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = null; // GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_PlayType = (NcAttachSound.PLAY_TYPE)EditorGUILayout.EnumPopup("m_PlayType", m_Sel.m_PlayType); m_Sel.m_bPlayOnActive = EditorGUILayout.Toggle(GetHelpContent("m_bPlayOnActive"), m_Sel.m_bPlayOnActive); m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); m_Sel.m_fRepeatTime = EditorGUILayout.FloatField(GetHelpContent("m_fRepeatTime"), m_Sel.m_fRepeatTime); m_Sel.m_nRepeatCount = EditorGUILayout.IntField(GetHelpContent("m_nRepeatCount"), m_Sel.m_nRepeatCount); m_Sel.m_AudioClip = (AudioClip)EditorGUILayout.ObjectField(GetHelpContent("m_AudioClip"), m_Sel.m_AudioClip, typeof(AudioClip), false, null); m_Sel.m_nPriority = EditorGUILayout.IntField(GetHelpContent("m_nPriority"), m_Sel.m_nPriority); m_Sel.m_bLoop = EditorGUILayout.Toggle(GetHelpContent("m_bLoop"), m_Sel.m_bLoop); m_Sel.m_fVolume = EditorGUILayout.Slider(GetHelpContent("m_fVolume"), m_Sel.m_fVolume, 0, 1.0f, null); m_Sel.m_fPitch = EditorGUILayout.Slider(GetHelpContent("m_fPitch"), m_Sel.m_fPitch, -3, 3.0f, null); // check SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMinValue(ref m_Sel.m_fRepeatTime, 0); SetMinValue(ref m_Sel.m_nRepeatCount, 0); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("Select AudioClip"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectAudioClipPopup(m_Sel); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("Clear AudioClip"), (m_Sel.m_AudioClip != null))) { bClickButton = true; m_Sel.m_AudioClip = null; } 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 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); Rect buttonRect2 = FXMakerLayout.GetInnerVerticalRect(rightRect, 12, 5, 5); // image if (m_SelObjectContent == null) { guiCon = new GUIContent("[Not Selected]"); } else { guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip); } if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null))) { if (Input.GetMouseButtonUp(0)) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } } int nImageMargin = 3; imageRect = FXMakerLayout.GetOffsetRect(imageRect, -nImageMargin); EditorGUIUtility.DrawCurveSwatch(imageRect, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).m_AniCurve, null, Color.green, Color.black, m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex).GetFixedDrawRange()); // text // GUI.Label(NgLayout.GetInnerVerticalRect(rightRect, 12, 5, 8), (m_SelObjectContent == null ? "[Not Selected]" : m_SelObjectContent.text)); if (m_bSaveDialog) { bool bSaveEnable = (0 <= m_nProjectIndex); bool bReadOnyFolder = false; if (bSaveEnable) { bReadOnyFolder = IsReadOnlyFolder(m_ProjectFolerContents[m_nProjectIndex].text); 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)) { SaveAddCurvePrefab(false); ClosePopup(true); } // overwrite if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect2, 2, 0, 2), (bReadOnyFolder ? FXMakerTooltip.GetGUIContent("Overwrite", FXMakerTooltip.GetHsToolMessage("READONLY_FOLDER", "")) : GetHelpContent("Overwrite")), (bSaveEnable && 0 <= m_nObjectIndex))) { SaveAddCurvePrefab(true); ClosePopup(true); } buttonRect.height *= 2; if (m_bDrawRedBottomButtom) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(buttonRect, 3), FXMakerLayout.m_ColorHelpBox, (bSaveEnable ? 2:1), false); } } else { // Undo if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 0, 1), GetHelpContent("Undo"), (m_SelCurveInfo != null))) { UndoCurveAni(); } // close if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 2, 1, 1), GetHelpContent("Close"))) { ClosePopup(true); } } }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_AttachType = (NcParticleEmit.AttachType)EditorGUILayout.EnumPopup(GetHelpContent("m_AttachType"), m_Sel.m_AttachType, GUILayout.MaxWidth(Screen.width)); if (m_Sel.m_AttachType == NcParticleEmit.AttachType.Active) { m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); m_Sel.m_fRepeatTime = EditorGUILayout.FloatField(GetHelpContent("m_fRepeatTime"), m_Sel.m_fRepeatTime); } m_Sel.m_nRepeatCount = EditorGUILayout.IntField(GetHelpContent("m_nRepeatCount"), m_Sel.m_nRepeatCount); m_Sel.m_ParticlePrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_ParticlePrefab"), m_Sel.m_ParticlePrefab, typeof(GameObject), false, null); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 0, 2), GetHelpContent("SelectParticlePrefab"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 2, 1), GetHelpContent("ClearPrefab"), (m_Sel.m_ParticlePrefab != null))) { bClickButton = true; m_Sel.m_ParticlePrefab = null; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 3, 1), GetHelpContent("OpenPrefab"), (m_FxmPopupManager != null) && (m_Sel.m_ParticlePrefab != null))) { bClickButton = true; GetFXMakerMain().OpenPrefab(m_Sel.m_ParticlePrefab); return; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); // -------------------------------------------------------------- if (m_Sel.m_AttachType == NcParticleEmit.AttachType.Destroy) { SetMinValue(ref m_Sel.m_nRepeatCount, 1); } FXMakerLayout.GUIEnableBackup(false); EditorGUILayout.Toggle(GetHelpContent("m_bWorldSpace"), true); FXMakerLayout.GUIEnableRestore(); m_Sel.m_EmitCount = EditorGUILayout.IntField("m_EmitCount", m_Sel.m_EmitCount); m_Sel.m_RandomRange = EditorGUILayout.Vector3Field("m_RandomRange", m_Sel.m_RandomRange, null); m_Sel.m_AddStartPos = EditorGUILayout.Vector3Field("m_AddStartPos", m_Sel.m_AddStartPos, null); // check SetMinValue(ref m_Sel.m_EmitCount, 1); SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMinValue(ref m_Sel.m_fRepeatTime, 0); SetMinValue(ref m_Sel.m_nRepeatCount, 0); } m_UndoManager.CheckDirty(); // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); int nClickIndex = -1; int nClickButton = 0; Rect rect; int nLeftWidth = 34; int nAddHeight = 30; int nDelWidth = 35; int nLineHeight = 18; int nSpriteHeight = nLeftWidth; List <NcSpriteFactory.NcSpriteNode> spriteList = m_Sel.m_SpriteList; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { m_UndoManager.CheckUndo(); // -------------------------------------------------------------- m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); EditorGUILayout.Space(); m_Sel.m_SpriteType = (NcSpriteFactory.SPRITE_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_SpriteType"), m_Sel.m_SpriteType); // -------------------------------------------------------------- if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation && m_Sel.gameObject.GetComponent("NcSpriteAnimation") == null) { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(rect, GetHelpContent("Add NcSpriteAnimation Component"), true)) { m_Sel.gameObject.AddComponent <NcSpriteAnimation>(); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); } // -------------------------------------------------------------- if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteTexture && m_Sel.gameObject.GetComponent("NcSpriteTexture") == null) { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(rect, GetHelpContent("Add NcSpriteTexture Component"), true)) { m_Sel.gameObject.AddComponent <NcSpriteTexture>(); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); // -------------------------------------------------------------- int nSelIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nCurrentIndex"), m_Sel.m_nCurrentIndex, 0, (spriteList == null ? 0 : spriteList.Count - 1)); float fUvScale = EditorGUILayout.FloatField(GetHelpContent("m_fUvScale"), m_Sel.m_fUvScale); if (m_Sel.m_nCurrentIndex != nSelIndex || fUvScale != m_Sel.m_fUvScale) { m_Sel.m_nCurrentIndex = nSelIndex; m_Sel.m_fUvScale = fUvScale; m_Sel.SetSprite(nSelIndex, false); } // Rebuild Check EditorGUI.BeginChangeCheck(); m_Sel.m_bTrimBlack = EditorGUILayout.Toggle(GetHelpContent("m_bTrimBlack"), m_Sel.m_bTrimBlack); m_Sel.m_bTrimAlpha = EditorGUILayout.Toggle(GetHelpContent("m_bTrimAlpha"), m_Sel.m_bTrimAlpha); m_Sel.m_nMaxAtlasTextureSize = EditorGUILayout.IntPopup("nMaxAtlasTextureSize", m_Sel.m_nMaxAtlasTextureSize, NgEnum.m_TextureSizeStrings, NgEnum.m_TextureSizeIntters); // m_Sel.m_AtlasMaterial = (Material)EditorGUILayout.ObjectField(GetHelpContent("m_AtlasMaterial") , m_Sel.m_AtlasMaterial, typeof(Material), false); if (EditorGUI.EndChangeCheck()) { m_Sel.m_bNeedRebuild = true; } int nBuildStartIndex = EditorGUILayout.IntSlider("m_nBuildStartIndex", m_Sel.m_nBuildStartIndex, 0, (spriteList == null ? 0 : spriteList.Count - 1)); if (spriteList != null && nBuildStartIndex != m_Sel.m_nBuildStartIndex) { for (int n = Mathf.Min(m_Sel.m_nBuildStartIndex, nBuildStartIndex); n < Mathf.Max(m_Sel.m_nBuildStartIndex, nBuildStartIndex); n++) { if (spriteList[n].IsUnused() == false && spriteList[n].IsEmptyTexture() == false) { m_Sel.m_bNeedRebuild = true; } } m_Sel.m_nBuildStartIndex = nBuildStartIndex; } // Add Button ------------------------------------------------------ EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nAddHeight * 2)); { Rect lineRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 0, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Add Sprite"))) { bClickButton = true; m_Sel.AddSpriteNode(); } bool bHighLight = m_Sel.m_bNeedRebuild; if (bHighLight) { FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("Build Sprite"))) { #if UNITY_WEBPLAYER Debug.LogError("In WEB_PLAYER mode, you cannot run the FXMaker."); Debug.Break(); #else bClickButton = true; CreateSpriteAtlas(m_Sel.GetComponent <Renderer>().sharedMaterial); m_Sel.m_bNeedRebuild = false; #endif } if (bHighLight) { FXMakerLayout.GUIColorRestore(); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), GetHelpContent("Clear All"), (0 < m_Sel.GetSpriteNodeCount()))) { bClickButton = true; if (m_FxmPopupManager != null) { m_FxmPopupManager.CloseNcPrefabPopup(); } m_Sel.ClearAllSpriteNode(); } lineRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 1, 1); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Sequence"), (0 < m_Sel.GetSpriteNodeCount()))) { m_Sel.m_bSequenceMode = true; bClickButton = true; m_Sel.SetSprite(0, false); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("NewMaterial"), true)) { Material newMat = new Material(m_Sel.GetComponent <Renderer>().sharedMaterial); string matPath = AssetDatabase.GetAssetPath(m_Sel.GetComponent <Renderer>().sharedMaterial); NgMaterial.SaveMaterial(newMat, NgFile.TrimFilenameExt(matPath), m_Sel.name); m_Sel.GetComponent <Renderer>().sharedMaterial = newMat; // m_Sel.renderer.sharedMaterial = (Material)AssetDatabase.LoadAssetAtPath(savePath, typeof(Material)); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // Select ShotType ------------------------------------------------- // showType = (NcSpriteFactory.SHOW_TYPE)EditorGUILayout.EnumPopup (GetHelpContent("m_ShowType") , showType); // -------------------------------------------------------------- EditorGUILayout.Space(); NcSpriteFactory.SHOW_TYPE showType = (NcSpriteFactory.SHOW_TYPE)EditorPrefs.GetInt("NcSpriteFactory.SHOW_TYPE", 0); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 0, 1), showType == NcSpriteFactory.SHOW_TYPE.NONE, GetHelpContent("NONE"), true) ? NcSpriteFactory.SHOW_TYPE.NONE : showType; showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 1, 1), showType == NcSpriteFactory.SHOW_TYPE.ALL, GetHelpContent("ALL"), true) ? NcSpriteFactory.SHOW_TYPE.ALL : showType; if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) { showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 2, 1), showType == NcSpriteFactory.SHOW_TYPE.SPRITE, GetHelpContent("SPRITE"), true) ? NcSpriteFactory.SHOW_TYPE.SPRITE : showType; showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 3, 1), showType == NcSpriteFactory.SHOW_TYPE.ANIMATION, GetHelpContent("ANIMATION"), true) ? NcSpriteFactory.SHOW_TYPE.ANIMATION : showType; } showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 4, 1), showType == NcSpriteFactory.SHOW_TYPE.EFFECT, GetHelpContent("EFFECT"), true) ? NcSpriteFactory.SHOW_TYPE.EFFECT : showType; GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorPrefs.SetInt("NcSpriteFactory.SHOW_TYPE", ((int)showType)); // Show Option ------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { m_Sel.m_bShowEffect = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 0, 1), m_Sel.m_bShowEffect, GetHelpContent("m_bShowEffect"), true); if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) { m_Sel.m_bTestMode = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 1, 1), m_Sel.m_bTestMode, GetHelpContent("m_bTestMode"), true); m_Sel.m_bSequenceMode = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 2, 1), m_Sel.m_bSequenceMode, GetHelpContent("m_bSequenceMode"), true); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // Node List ------------------------------------------------------ for (int n = 0; n < (spriteList != null ? spriteList.Count : 0); n++) { if (m_Sel.IsUnused(n)) { continue; } EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); // Load Texture --------------------------------------------------------- Texture2D selTexture = null; if (spriteList[n].m_TextureGUID != "") { selTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(spriteList[n].m_TextureGUID), typeof(Texture2D)); } // Enabled -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { Rect subRect; EditorGUI.BeginChangeCheck(); // enable spriteList[n].m_bIncludedAtlas = GUILayout.Toggle(spriteList[n].m_bIncludedAtlas, "Idx", GUILayout.Width(nLeftWidth)); // change index subRect = rect; subRect.x += nLeftWidth; subRect.width = nLineHeight * 2; int newPos = EditorGUI.IntPopup(subRect, n, NgConvert.GetIntStrings(0, spriteList.Count), NgConvert.GetIntegers(0, spriteList.Count)); if (newPos != n) { NcSpriteFactory.NcSpriteNode node = spriteList[n]; m_Sel.m_SpriteList.Remove(node); m_Sel.m_SpriteList.Insert(newPos, node); return; } if (EditorGUI.EndChangeCheck()) { m_Sel.m_bNeedRebuild = true; } // name subRect = rect; subRect.x += nLeftWidth + nLineHeight * 2; subRect.width -= nLeftWidth + nLineHeight * 2; spriteList[n].m_TextureName = selTexture == null ? "" : selTexture.name; GUI.Label(subRect, (selTexture == null ? "" : "(" + spriteList[n].m_nFrameCount + ") " + selTexture.name)); GUI.Box(subRect, ""); GUI.Box(rect, ""); // delete if (GUI.Button(new Rect(subRect.x + subRect.width - nDelWidth, subRect.y, nDelWidth, subRect.height), GetHelpContent("Del"))) { m_Sel.m_bNeedRebuild = true; bClickButton = true; if (m_FxmPopupManager != null) { m_FxmPopupManager.CloseNcPrefabPopup(); } m_Sel.DeleteSpriteNode(n); return; } } EditorGUILayout.EndHorizontal(); // SpriteName MaxAlpha ----------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUILayout.Label("", GUILayout.Width(nLineHeight)); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(rect, 7, 0, 2), "Name,fMaxAlpha"); spriteList[n].m_SpriteName = EditorGUI.TextField(FXMakerLayout.GetInnerHorizontalRect(rect, 7, 2, 4), spriteList[n].m_SpriteName); spriteList[n].m_fMaxTextureAlpha = EditorGUI.FloatField(FXMakerLayout.GetInnerHorizontalRect(rect, 7, 6, 1), spriteList[n].m_fMaxTextureAlpha); } EditorGUILayout.EndHorizontal(); // Texture -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nSpriteHeight / (selTexture == null ? 2 : 1))); { GUILayout.Label("", GUILayout.Width(nLeftWidth)); Rect subRect = rect; subRect.width = nLeftWidth; FXMakerLayout.GetOffsetRect(rect, 0, 5, 0, -5); EditorGUI.BeginChangeCheck(); selTexture = (Texture2D)EditorGUI.ObjectField(subRect, GetHelpContent(""), selTexture, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { if (selTexture != null) { spriteList[n].m_TextureGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(selTexture)); } m_Sel.m_bNeedRebuild = true; } // draw texture subRect = FXMakerLayout.GetOffsetRect(rect, nLeftWidth + 4, 0, 0, -4); Rect drawRect = FXMakerLayout.GetOffsetRect(subRect, 0, 0, -nDelWidth, 0); if (selTexture != null) { // draw texture GUI.DrawTexture(drawRect, selTexture, ScaleMode.ScaleToFit, true, selTexture.width / selTexture.height); // draw tile float fDrawRatio = drawRect.width / drawRect.height; float fImageRatio = selTexture.width / selTexture.height; if (fDrawRatio < fImageRatio) { drawRect = FXMakerLayout.GetVOffsetRect(drawRect, drawRect.height * -(1 - (fDrawRatio / fImageRatio)) / 2); } else { drawRect = FXMakerLayout.GetHOffsetRect(drawRect, drawRect.width * -(1 - (fImageRatio / fDrawRatio)) / 2); } float tileWidth = (drawRect.width / spriteList[n].m_nTilingX); float tileHeight = (drawRect.height / spriteList[n].m_nTilingY); for (int tn = spriteList[n].m_nStartFrame; tn < Mathf.Min(spriteList[n].m_nStartFrame + spriteList[n].m_nFrameCount, spriteList[n].m_nTilingX * spriteList[n].m_nTilingY); tn++) { int posx = tn % spriteList[n].m_nTilingX; int posy = tn / spriteList[n].m_nTilingX; Rect tileRect = new Rect(drawRect.x + posx * tileWidth, drawRect.y + posy * tileHeight, tileWidth, tileHeight); NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(tileRect, -1), Color.green, 1, false); } } // delete if (GUI.Button(new Rect(subRect.x + subRect.width - nDelWidth, subRect.y, nDelWidth, subRect.height), GetHelpContent("Rmv"))) { spriteList[n].SetEmpty(); } GUI.Box(rect, ""); } EditorGUILayout.EndHorizontal(); // Change selIndex Event e = Event.current; if (e.type == EventType.MouseDown && rect.Contains(e.mousePosition)) { nClickIndex = n; nClickButton = e.button; } // ----------------------------------------------------------------------------------------------------------------------------------------------- if (spriteList[n].IsEmptyTexture() == false) { // Frame tile rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUILayout.Label("", GUILayout.Width(nLineHeight)); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 0, 4), "nTileXY,Start,Count"); // m_nTilingX, m_nTilingY EditorGUI.BeginChangeCheck(); spriteList[n].m_nTilingX = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 4, 1), spriteList[n].m_nTilingX); spriteList[n].m_nTilingY = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 5, 1), spriteList[n].m_nTilingY); SetMinValue(ref spriteList[n].m_nTilingX, 1); SetMinValue(ref spriteList[n].m_nTilingY, 1); if (EditorGUI.EndChangeCheck()) { spriteList[n].m_nFrameCount = spriteList[n].m_nTilingX * spriteList[n].m_nTilingY - spriteList[n].m_nStartFrame; m_Sel.m_bNeedRebuild = true; } // m_nStartFrame, m_nFrameCount EditorGUI.BeginChangeCheck(); spriteList[n].m_nStartFrame = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 6, 1), spriteList[n].m_nStartFrame); spriteList[n].m_nFrameCount = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 7, 1), spriteList[n].m_nFrameCount); SetMaxValue(ref spriteList[n].m_nStartFrame, spriteList[n].m_nTilingX * spriteList[n].m_nTilingY - 1); SetMinValue(ref spriteList[n].m_nStartFrame, 0); SetMaxValue(ref spriteList[n].m_nFrameCount, spriteList[n].m_nTilingX * spriteList[n].m_nTilingY - spriteList[n].m_nStartFrame); SetMinValue(ref spriteList[n].m_nFrameCount, 1); if (EditorGUI.EndChangeCheck()) { m_Sel.m_bNeedRebuild = true; } } EditorGUILayout.EndHorizontal(); // SpriteNode ---------------------------------------------------------- if (bClickButton == false) { if ((m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) && (showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.SPRITE)) { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUILayout.Label("", GUILayout.Width(nLineHeight)); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 0, 4), "Loop,Start,FCnt,LCnt"); bool bOldLoop = spriteList[n].m_bLoop; spriteList[n].m_bLoop = EditorGUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 4, 1), spriteList[n].m_bLoop); if (!bOldLoop && spriteList[n].m_bLoop) { spriteList[n].m_nLoopStartFrame = 0; spriteList[n].m_nLoopFrameCount = spriteList[n].m_nFrameCount; spriteList[n].m_nLoopingCount = 0; } if (spriteList[n].m_bLoop) { spriteList[n].m_nLoopStartFrame = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 5, 1), spriteList[n].m_nLoopStartFrame); spriteList[n].m_nLoopFrameCount = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 6, 1), spriteList[n].m_nLoopFrameCount); spriteList[n].m_nLoopingCount = EditorGUI.IntField(FXMakerLayout.GetInnerHorizontalRect(rect, 8, 7, 1), spriteList[n].m_nLoopingCount); } // check SetMaxValue(ref spriteList[n].m_nLoopStartFrame, spriteList[n].m_nFrameCount - 1); SetMinValue(ref spriteList[n].m_nLoopStartFrame, 0); SetMaxValue(ref spriteList[n].m_nLoopFrameCount, spriteList[n].m_nFrameCount - spriteList[n].m_nLoopStartFrame); SetMinValue(ref spriteList[n].m_nLoopingCount, 0); } EditorGUILayout.EndHorizontal(); spriteList[n].m_fTime = EditorGUILayout.Slider(GetHelpContent("m_fTime"), spriteList[n].m_nFrameCount / spriteList[n].m_fFps, 0, 5, null); spriteList[n].m_fFps = EditorGUILayout.Slider(GetHelpContent("m_fFps"), spriteList[n].m_nFrameCount / spriteList[n].m_fTime, 50, 1, null); } if ((m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) && (showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.ANIMATION)) { spriteList[n].m_nNextSpriteIndex = EditorGUILayout.Popup("m_nNextSpriteIndex", spriteList[n].m_nNextSpriteIndex + 1, GetSpriteNodeNames()) - 1; if (0 <= spriteList[n].m_nNextSpriteIndex) { spriteList[n].m_nTestMode = EditorGUILayout.Popup("m_nTestMode", spriteList[n].m_nTestMode, NgConvert.ContentsToStrings(FxmTestControls.GetHcEffectControls_Trans(FxmTestControls.AXIS.Z)), GUILayout.MaxWidth(Screen.width)); spriteList[n].m_fTestSpeed = EditorGUILayout.FloatField("m_fTestSpeed", spriteList[n].m_fTestSpeed); SetMinValue(ref spriteList[n].m_fTestSpeed, 0.01f); } } if (showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.EFFECT) { EditorGUILayout.Separator(); // char effect ------------------------------------------------------------- spriteList[n].m_EffectPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_EffectPrefab"), spriteList[n].m_EffectPrefab, typeof(GameObject), false, null); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 0.7f)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 0, 1), GetHelpContent("SelEffect"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, n, 0, true); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 1, 1), GetHelpContent("ClearEffect"), (spriteList[n].m_EffectPrefab != null))) { bClickButton = true; spriteList[n].m_EffectPrefab = null; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 2, 1), GetHelpContent("OpenEffect"), (m_FxmPopupManager != null) && (spriteList[n].m_EffectPrefab != null))) { bClickButton = true; GetFXMakerMain().OpenPrefab(spriteList[n].m_EffectPrefab); return; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); if (spriteList[n].m_EffectPrefab != null) { spriteList[n].m_bEffectInstantiate = EditorGUILayout.Toggle(GetHelpContent("m_bEffectInstantiate"), spriteList[n].m_bEffectInstantiate); if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) { spriteList[n].m_nEffectFrame = EditorGUILayout.IntSlider(GetHelpContent("m_nEffectFrame"), spriteList[n].m_nEffectFrame, 0, spriteList[n].m_nFrameCount, null); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUILayout.Label("", GUILayout.Width(nLineHeight)); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 0, 2), "bOnlyFirst,bEffDetach"); spriteList[n].m_bEffectOnlyFirst = EditorGUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 2, 1), spriteList[n].m_bEffectOnlyFirst); spriteList[n].m_bEffectDetach = EditorGUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 3, 1), spriteList[n].m_bEffectDetach); } EditorGUILayout.EndHorizontal(); } rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUILayout.Label("", GUILayout.Width(nLineHeight)); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 0, 2), "fSpeed, fScale"); spriteList[n].m_fEffectSpeed = EditorGUI.FloatField(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 2, 1), spriteList[n].m_fEffectSpeed); spriteList[n].m_fEffectScale = EditorGUI.FloatField(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 3, 1), spriteList[n].m_fEffectScale); } EditorGUILayout.EndHorizontal(); spriteList[n].m_EffectPos = EditorGUILayout.Vector3Field("m_EffectPos", spriteList[n].m_EffectPos, null); spriteList[n].m_EffectRot = EditorGUILayout.Vector3Field("m_EffectRot", spriteList[n].m_EffectRot, null); SetMinValue(ref spriteList[n].m_fEffectScale, 0.001f); } EditorGUILayout.Space(); // char sound ------------------------------------------------------------- spriteList[n].m_AudioClip = (AudioClip)EditorGUILayout.ObjectField(GetHelpContent("m_AudioClip"), spriteList[n].m_AudioClip, typeof(AudioClip), false, null); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 0.7f)); { // if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("SelAudio"), (m_FxmPopupManager != null))) // m_FxmPopupManager.ShowSelectAudioClipPopup(m_Sel); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("ClearAudio"), (spriteList[n].m_AudioClip != null))) { bClickButton = true; spriteList[n].m_AudioClip = null; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); if (spriteList[n].m_AudioClip != null) { if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation || m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.Auto) { spriteList[n].m_nSoundFrame = EditorGUILayout.IntSlider(GetHelpContent("m_nSoundFrame"), spriteList[n].m_nSoundFrame, 0, spriteList[n].m_nFrameCount, null); spriteList[n].m_bSoundOnlyFirst = EditorGUILayout.Toggle(GetHelpContent("m_bSoundOnlyFirst"), spriteList[n].m_bSoundOnlyFirst); } spriteList[n].m_bSoundLoop = EditorGUILayout.Toggle(GetHelpContent("m_bSoundLoop"), spriteList[n].m_bSoundLoop); spriteList[n].m_fSoundVolume = EditorGUILayout.Slider(GetHelpContent("m_fSoundVolume"), spriteList[n].m_fSoundVolume, 0, 1.0f, null); spriteList[n].m_fSoundPitch = EditorGUILayout.Slider(GetHelpContent("m_fSoundPitch"), spriteList[n].m_fSoundPitch, -3, 3.0f, null); } } } } if (EditorGUI.EndChangeCheck()) { nClickIndex = n; } selTexture = null; } // Select Node ---------------------------------------------------- if (0 <= nClickIndex) { m_Sel.SetSprite(nClickIndex, false); if (m_Sel.m_bTestMode && 0 <= spriteList[nClickIndex].m_nTestMode && GetFXMakerMain()) { GetFXMakerMain().GetFXMakerControls().SetTransIndex(spriteList[nClickIndex].m_nTestMode, (4 <= spriteList[nClickIndex].m_nTestMode ? 1.8f : 1.0f), spriteList[nClickIndex].m_fTestSpeed); } // Rotate if (nClickButton == 1) { m_Sel.transform.Rotate(0, 180, 0); } nClickIndex = -1; bClickButton = true; } m_UndoManager.CheckDirty(); } // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
// ========================================================================================================== void winEffectList(int id) { if (GetGroupIndex() < 0) { return; } Rect effectRect = FXMakerLayout.GetEffectListRect(); // window desc ----------------------------------------------------------- FXMakerTooltip.WindowDescription(effectRect, FXMakerLayout.WINDOWID.EFFECT_LIST, null); // mini ---------------------------------------------------------------- m_bMinimize = GUI.Toggle(new Rect(3, 1, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), m_bMinimize, "Mini"); GUI.changed = false; if (FXMakerLayout.m_bMinimizeAll || m_bMinimize) { RenameCurrentPrefab(m_EditingName); FXMakerMain.inst.SaveTooltip(); return; } // 기능 버튼 ----------------------------------------------------------- Rect rect1Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 25); Rect rect2Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 50, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 20); Rect rect3Row = new Rect(FXMakerLayout.m_rectInnerMargin.x, 75, effectRect.width - FXMakerLayout.m_rectInnerMargin.x * 2, 12); // Add button if (m_nEffectCount < FXMakerLayout.m_nMaxPrefabListCount) { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 0, 1), FXMakerTooltip.GetHcToolEffect("New"), IsReadOnlyFolder() == 0)) { RenameCurrentPrefab(m_EditingName); ShowNewMenu(); return; } } if (m_nEffectCount <= 0) { // right button if (Input.GetMouseButtonUp(1)) { ShowRightMenu(-1, false); } return; } // Selected state bool bEnable = (FXMakerMain.inst.IsCurrentEffectObject() && IsReadOnlyFolder() == 0); // Delete button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 1, 1), FXMakerTooltip.GetHcToolEffect("Del"), bEnable)) { RenameCurrentPrefab(m_EditingName); m_bProcessDelete = true; } if (m_bProcessDelete) { m_bProcessDelete = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_EffectContents[m_nEffectIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETEPREFAB", "")); if (m_bProcessDelete == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { NcSpriteAnimation spriteCom = FXMakerMain.inst.GetOriginalEffectPrefab().GetComponent <NcSpriteAnimation>(); if (spriteCom != null && spriteCom.m_bBuildSpriteObj && spriteCom.renderer.sharedMaterial != null) { m_bProcessDelSprite = true; } else { GameObject deletePrefab = FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); FXMakerAsset.DeleteEffectPrefab(deletePrefab); SelectToolbar(m_nProjectIndex, GetGroupIndex(), m_nEffectIndex); return; } } } } if (m_bProcessDelSprite) { m_bProcessDelSprite = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_EffectContents[m_nEffectIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETESPRITE", "")); if (m_bProcessDelSprite == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { // delete material, texture NcSpriteAnimation spriteCom = FXMakerMain.inst.GetOriginalEffectPrefab().GetComponent <NcSpriteAnimation>(); if (spriteCom.renderer.sharedMaterial.mainTexture != null) { string path = AssetDatabase.GetAssetPath(spriteCom.renderer.sharedMaterial.mainTexture); AssetDatabase.MoveAssetToTrash(path); // AssetDatabase.DeleteAsset(path); } string matpath = AssetDatabase.GetAssetPath(spriteCom.renderer.sharedMaterial); AssetDatabase.MoveAssetToTrash(matpath); // AssetDatabase.DeleteAsset(matpath); } // delete prefab GameObject deletePrefab = FXMakerMain.inst.ClearCurrentEffectObject(m_CurrentEffectRoot, true); FXMakerAsset.DeleteEffectPrefab(deletePrefab); SelectToolbar(m_nProjectIndex, GetGroupIndex(), m_nEffectIndex); return; } } // Clone button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 2, 1), FXMakerTooltip.GetHcToolEffect("Clone"), bEnable)) { RenameCurrentPrefab(m_EditingName); ClonePrefab(); return; } // Capture Thumb button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 3, 1), FXMakerTooltip.GetHcToolEffect("Thumb"), bEnable)) { RenameCurrentPrefab(m_EditingName); ThumbPrefab(); return; } // // History button // if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 4, 1), FXMakertip.GetHcToolEffect("History"), bEnable)) // { // SetActiveEffect(m_nEffectIndex); // return; // } // Sprite button if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect1Row, 5, 4, 1), FXMakerTooltip.GetHcToolEffect("Sprite"), bEnable)) { RenameCurrentPrefab(m_EditingName); SpritePrefab(); return; } // Selected state if (FXMakerMain.inst.IsCurrentEffectObject()) { // ChangeName if (FXMakerMain.inst.IsCurrentEffectObject() && 0 <= m_nEffectIndex && m_nEffectIndex < m_nEffectCount) { GUI.SetNextControlName("TextField"); FXMakerLayout.GUIEnableBackup(IsReadOnlyFolder() == 0); // FXMakerMain.inst.ToggleGlobalLangSkin(true); m_EditingName = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(rect2Row, 4, 0, 4), m_EditingName, 50); // FXMakerMain.inst.ToggleGlobalLangSkin(false); FXMakerLayout.GUIEnableRestore(); bool bEnterKey = (Event.current.isKey && (Event.current.keyCode == KeyCode.Return || Event.current.keyCode == KeyCode.KeypadEnter)); if (bEnterKey || (FXMakerMain.GetPrevWindowFocus() == (int)FXMakerLayout.WINDOWID.EFFECT_LIST && FXMakerMain.GetWindowFocus() != (int)FXMakerLayout.WINDOWID.EFFECT_LIST)) { RenameCurrentPrefab(m_EditingName); } } } // Resize -------------------------------------------------------------- bool bChangeScrollColumn = false; m_nScrollColumn = (int)GUI.HorizontalScrollbar(rect3Row, m_nScrollColumn, 1, 1, m_nMaxObjectColumn + 1); if (GUI.changed) { UnityEditor.EditorPrefs.SetInt("FXMakerEffect.Effect_nScrollColumn", m_nScrollColumn); bChangeScrollColumn = true; Rect rect = FXMakerLayout.GetAspectScrollViewRect((int)rect3Row.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); m_EffectListScrollPos.y = rect.height * (m_nEffectIndex - m_nScrollColumn) / (float)m_nEffectCount; } // Draw line Rect lineRect = rect3Row; lineRect.y = rect3Row.yMax + 5; lineRect.height = 3; NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y), (int)lineRect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); // Effect List ------------------------------------------------------ Rect listRect = FXMakerLayout.GetChildVerticalRect(effectRect, m_nGuiTopHeight, 1, 0, 1); Rect scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); Rect gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, FXMakerLayout.m_fScrollButtonAspect, m_nEffectCount, m_nScrollColumn, false); m_EffectListScrollPos = GUI.BeginScrollView(listRect, m_EffectListScrollPos, scrollRect); // FXMakerMain.inst.ToggleGlobalLangSkin(true); // int nEffectIndex = GUI.SelectionGrid(listRect, m_nEffectIndex, m_EffectNameStrings, m_nScrollColumn); // int nEffectIndex = GUI.SelectionGrid(gridRect, m_nEffectIndex, m_EffectContents, m_nScrollColumn); int nEffectIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(effectRect, 0, -m_EffectListScrollPos.y), listRect, gridRect, m_nEffectIndex, m_EffectContents, m_nScrollColumn); // FXMakerMain.inst.ToggleGlobalLangSkin(false); // move key if (FXMakerMain.inst.GetFocusInputKey(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.EFFECT_LIST)) != 0) { switch (FXMakerMain.inst.GetFocusInputKey(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.EFFECT_LIST))) { case KeyCode.LeftArrow: nEffectIndex--; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.RightArrow: nEffectIndex++; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.UpArrow: nEffectIndex -= m_nScrollColumn; FXMakerMain.inst.SetFocusInputKey(0); break; case KeyCode.DownArrow: nEffectIndex += m_nScrollColumn; FXMakerMain.inst.SetFocusInputKey(0); break; } if (nEffectIndex < 0) { nEffectIndex = 0; } if (m_nEffectCount <= nEffectIndex) { nEffectIndex = m_nEffectCount - 1; } } // select if ((bChangeScrollColumn == false && GUI.changed) || m_nEffectIndex != nEffectIndex) { RenameCurrentPrefab(m_EditingName); // right button if (Input.GetMouseButtonUp(1)) { ShowRightMenu(nEffectIndex, true); } // active NgUtil.LogDevelop("changed m_nEffectIndex - id = " + id + ", value = " + m_EffectContents[nEffectIndex].text); if (nEffectIndex == m_nEffectIndex && FXMakerMain.inst.IsCurrentEffectObject()) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } else { SetActiveEffect(nEffectIndex); } } else { // right button if (Input.GetMouseButtonUp(1)) { RenameCurrentPrefab(m_EditingName); ShowRightMenu(-1, false); } } GUI.EndScrollView(); FXMakerMain.inst.SaveTooltip(); }
// ========================================================================================================== protected void DrawFolderList(Rect baseRect) { if (m_nProjectCount <= 0) { return; } Rect rect; int nPRowCount = (m_nProjectCount / m_nProjectColumn + (0 < (m_nProjectCount % m_nProjectColumn) ? 1 : 0)); int nGRowCount = (m_nGroupCount / m_nGroupColumn + (0 < (m_nGroupCount % m_nGroupColumn) ? 1 : 0)); // Group Project rect = FXMakerLayout.GetInnerTopRect(baseRect, 0, nPRowCount * m_nMenuButtonHeight); // int nProjectIndex = GUI.SelectionGrid(rect, m_nProjectIndex, m_ProjectFolerContents, m_nProjectColumn); int nProjectIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), rect, m_nProjectIndex, m_ProjectFolerContents, m_nProjectColumn); if (m_nProjectIndex != nProjectIndex) { SetProjectIndex(nProjectIndex, false); } if (m_bDrawRedProject) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(rect, 3), FXMakerLayout.m_ColorHelpBox, 2, false); } // Draw line rect = FXMakerLayout.GetInnerTopRect(baseRect, nPRowCount * m_nMenuButtonHeight, m_nMenuButtonHeight); NgGUIDraw.DrawHorizontalLine(new Vector2(rect.x, rect.y + m_nMenuButtonHeight / 4 + 1), (int)rect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); // ResizePopup, Recursively , ScrollColumn rect = FXMakerLayout.GetInnerTopRect(baseRect, nPRowCount * m_nMenuButtonHeight + m_nMenuButtonHeight / 3, m_nMenuButtonHeight); rect = FXMakerLayout.GetOffsetRect(rect, 0, rect.height / 5, 0, 0); bool bOldOptionRecursively = m_bOptionRecursively; int nLeftSize = 195; Rect resizeRect = rect; Rect toggleRect; resizeRect.width = nLeftSize; string[] resizeStrings = { "1", "2", "3", "4", "5" }; GUIStyle resizeStyle = GUI.skin.GetStyle("Popup_ResizePopup"); int nPopupColumn = (int)GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(resizeRect, 40, 0, 20), m_nPopupColumn - 2, resizeStrings, 5, resizeStyle) + 2; if (GUI.changed && m_nPopupColumn != nPopupColumn) { UpdatePopupColumn(nPopupColumn); } if (4 < m_nPopupColumn) { toggleRect = FXMakerLayout.GetInnerHorizontalRect(resizeRect, 40, 21, 19); m_bOptionRecursively = FXMakerLayout.GUIToggle(toggleRect, m_bOptionRecursively, GetHelpContent("Recursively"), (m_bFixedOptionRecursively == false)); if (GUI.changed && bOldOptionRecursively != m_bOptionRecursively) { SavePrefs(); SetGroupIndex(0); } toggleRect.x += toggleRect.width; m_bOptionShowName = FXMakerLayout.GUIToggle(toggleRect, m_bOptionShowName, GetHelpContent("ShowName"), !m_bDisableOptionShowName); if (GUI.changed) { SavePrefs(); } } else { toggleRect = FXMakerLayout.GetInnerHorizontalRect(resizeRect, 40, 21, 19); toggleRect.y -= 5; m_bOptionRecursively = FXMakerLayout.GUIToggle(toggleRect, m_bOptionRecursively, GetHelpContent("Recursively"), (m_bFixedOptionRecursively == false)); if (GUI.changed && bOldOptionRecursively != m_bOptionRecursively) { SavePrefs(); SetGroupIndex(0); } toggleRect.y += 12; m_bOptionShowName = FXMakerLayout.GUIToggle(toggleRect, m_bOptionShowName, GetHelpContent("ShowName"), !m_bDisableOptionShowName); if (GUI.changed) { SavePrefs(); } } if (nLeftSize < (rect.width - nLeftSize)) { nLeftSize = (int)rect.width - nLeftSize; } int nObjectColumn = (int)GUI.HorizontalScrollbar(FXMakerLayout.GetOffsetRect(rect, nLeftSize, 1, 0, -2), m_nObjectColumn, 1, 1, m_nMaxObjectColumn + 1); if (GUI.changed && m_nObjectColumn != nObjectColumn) { m_nObjectColumn = nObjectColumn; SavePrefs(); if (m_nSelObjectGroupIndex == -1 && m_bOptionRecursively && 0 < m_nObjectCount) { Rect scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)baseRect.width, m_fButtonAspect, m_ObjectContents.Length, m_nObjectColumn, false); m_ObjectListScrollPos.y = scrollRect.height * (m_nObjectIndex - m_nObjectColumn) / (float)m_nObjectCount; } } // Draw line rect = FXMakerLayout.GetInnerTopRect(baseRect, nPRowCount * m_nMenuButtonHeight + m_nMenuButtonHeight + m_nMenuButtonHeight / 3, m_nMenuButtonHeight); NgGUIDraw.DrawHorizontalLine(new Vector2(rect.x, rect.y + m_nMenuButtonHeight / 4 + 1), (int)rect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); // Group List if (m_nGroupCount <= 0) { return; } if (m_bOptionRecursively == false) { rect = FXMakerLayout.GetInnerTopRect(baseRect, nPRowCount * m_nMenuButtonHeight + m_nMenuButtonHeight + m_nMenuButtonHeight, nGRowCount * m_nMenuButtonHeight); // int nGroupIndex = GUI.SelectionGrid(rect, m_nGroupIndex, m_GroupFolderContents, m_nGroupColumn); int nGroupIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), rect, m_nGroupIndex, m_GroupFolderContents, m_nGroupColumn); if (m_nGroupIndex != nGroupIndex) { SetGroupIndex(nGroupIndex); } if (m_bDrawRedGroup) { NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(rect, 3), FXMakerLayout.m_ColorHelpBox, 2, false); } } }
void DrawBottomPaletteRect(Rect baseRect) { if (m_SelectedMaterial == null) { return; } GUIStyle styleBox = GUI.skin.GetStyle("MaterialList_Box"); Color oldColor = GUI.color; Color oldMatColor; bool bReinstance = false; if (NgMaterial.IsMaterialColor(m_SelectedMaterial) == false) { return; } // Color Palette Image baseRect = FXMakerLayout.GetOffsetRect(baseRect, 0, -2, 0, -3); GUI.Box(baseRect, FXMakerTooltip.GetGUIContentNoTooltip(), styleBox); baseRect = FXMakerLayout.GetOffsetRect(baseRect, 2, 2, -2, -2); Rect popupRect = GetPopupRect(); Rect leftRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 0, 1); Rect rightRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 1, 1); // Pickup Color GUI.color = Color.white; Color pickColor = oldMatColor = NgMaterial.GetMaterialColor(m_SelectedMaterial); Color32 oldMatCol32 = oldMatColor; // Color Progress Rect barRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(leftRect, 5, 0, 1), -1, 1, 1, -1); GUI.DrawTexture(FXMakerLayout.GetOffsetRect(barRect, 5, 0, -5, 0), m_PaletteBarColorImage); float fPaletteBarValue = GUI.HorizontalSlider(barRect, m_fPaletteBarColorValue, 0, 1.0f); if (m_fPaletteBarColorValue != fPaletteBarValue) { m_fPaletteBarColorValue = fPaletteBarValue; pickColor = m_PaletteBarColorImage.GetPixelBilinear(m_fPaletteBarColorValue, 0.5f); } // Color Palette Rect palRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(leftRect, 5, 1, 4), 4, 0, -4, -1); Rect lockRect = new Rect(palRect.x + popupRect.x, palRect.y + popupRect.y, palRect.width, palRect.height + 1); Vector2 mousePos = FXMakerLayout.GetGUIMousePosition(); GUI.DrawTexture(palRect, m_PalettePanelImage); if (Input.GetMouseButtonDown(0) && lockRect.Contains(mousePos)) { m_bEnterPalette = true; } if (Input.GetMouseButtonUp(0) && m_bEnterPalette) { m_bEnterPalette = false; bReinstance = true; } if (Input.GetMouseButton(0) && m_bEnterPalette) { int xpos = (int)(mousePos.x - lockRect.x); int ypos = (int)(mousePos.y - lockRect.y); if (xpos < 0) { xpos = 0; } if (ypos < 0) { ypos = 0; } if (lockRect.width <= xpos) { xpos = (int)(lockRect.width); } if (lockRect.height <= ypos) { ypos = (int)(lockRect.height); } pickColor = m_PalettePanelImage.GetPixelBilinear(xpos / palRect.width, (palRect.height - ypos) / palRect.height); } // Gray Progress GUI.changed = false; barRect = FXMakerLayout.GetOffsetRect(FXMakerLayout.GetInnerVerticalRect(rightRect, 5, 0, 1), -1, 1, 1, -1); GUI.DrawTexture(FXMakerLayout.GetOffsetRect(barRect, 5, 0, -5, 0), m_PaletteBarGrayImage); fPaletteBarValue = GUI.HorizontalSlider(barRect, m_fPaletteBarGrayValue, 0, 1.0f); if (GUI.changed) // m_fPaletteBarGrayValue != fPaletteBarValue { m_fPaletteBarGrayValue = fPaletteBarValue; pickColor = m_PaletteBarGrayImage.GetPixelBilinear(m_fPaletteBarGrayValue, 0.5f); if (Input.GetMouseButtonDown(1)) { m_fPaletteBarGrayValue = 0.5f; pickColor = new Color(0.5f, 0.5f, 0.5f); } GUI.changed = false; } GUI.color = oldColor; // Color RGB Scroll rightRect = FXMakerLayout.GetOffsetRect(rightRect, 0, 3, -5, -3); Color32 selColor32 = new Color(pickColor.r, pickColor.g, pickColor.b, oldMatColor.a); int nTextWidth = 15; int nEditWidth = 38; string[] rgbName = { "R", "G", "B", "A" }; Color[] rgbColor = { Color.red, Color.green, Color.blue, Color.white }; byte[] RGBA = new byte[4]; RGBA[0] = selColor32.r; RGBA[1] = selColor32.g; RGBA[2] = selColor32.b; RGBA[3] = selColor32.a; // RGB Progress for (int n = 0; n < 4; n++) { string str; oldColor = GUI.color; Rect line = FXMakerLayout.GetInnerVerticalRect(rightRect, 5, n + 1, 1); line.width = nTextWidth; GUI.color = rgbColor[n]; GUI.Label(line, rgbName[n]); GUI.color = oldColor; line = FXMakerLayout.GetInnerVerticalRect(rightRect, 5, n + 1, 1); RGBA[n] = (byte)GUI.HorizontalSlider(FXMakerLayout.GetOffsetRect(line, nTextWidth, 0, -nEditWidth - 8, 0), RGBA[n], 0, 255); if (GUI.changed) { if (Input.GetMouseButtonDown(1)) { RGBA[n] = 127; } GUI.changed = false; } line.x = line.x + line.width - nEditWidth; line.width = nEditWidth; str = GUI.TextField(FXMakerLayout.GetOffsetRect(line, 0, -2, 0, 2), RGBA[n].ToString()); RGBA[n] = (byte)(255 < NgConvert.ToUint(str, RGBA[n]) ? 255 : NgConvert.ToUint(str, RGBA[n])); } selColor32.r = RGBA[0]; selColor32.g = RGBA[1]; selColor32.b = RGBA[2]; selColor32.a = RGBA[3]; if (selColor32.r != oldMatCol32.r || selColor32.g != oldMatCol32.g || selColor32.b != oldMatCol32.b || selColor32.a != oldMatCol32.a) { SetActiveMaterialColor(selColor32); } // mouse up - reinstance Rect chkRect = new Rect(baseRect.x + popupRect.x, baseRect.y + popupRect.y, baseRect.width, baseRect.height); if (Input.GetMouseButtonUp(0) && chkRect.Contains(mousePos)) { bReinstance = true; } if (bReinstance) { // CreateNewShaderMaterials(m_SelectedMaterial); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } }
void DrawBottomMaterialRect(Rect baseRect) { int nVMargin = 4; GUIStyle styleBox = GUI.skin.GetStyle("MaterialList_Box"); GUIStyle styleButton = GUI.skin.GetStyle("ImageOnly_Button"); // Draw line NgGUIDraw.DrawHorizontalLine(new Vector2(baseRect.x + nVMargin, baseRect.y + nVMargin), (int)baseRect.width, new Color(0.1f, 0.1f, 0.1f, 0.7f), 2, false); baseRect = FXMakerLayout.GetOffsetRect(baseRect, 0, nVMargin * 2, 0, -nVMargin); int nObjectCount; Rect listRect; int nColumn; Rect scrollRect; Rect gridRect; int nSelectIndex; bool bShowList = true; // (0 <= m_nObjectIndex && m_nSelObjectProjectIndex == m_nProjectIndex && m_nGroupIndex == m_nSelObjectGroupIndex); // New Shader Material List ------------------------------------------------------ listRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 0, 1); GUI.Box(listRect, GetHelpContent("New Shader Material"), styleBox); if (bShowList && m_NewShaderMaterials != null && 0 < m_NewShaderMaterials.Length) { listRect = FXMakerLayout.GetOffsetRect(listRect, 5, 15, -5, -3); nColumn = (int)((listRect.width - 5) / listRect.height * 2.3f); nObjectCount = m_NewShaderMaterials.Length; scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, true); gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, true); m_NewShaderMaterialListScrollPos = GUI.BeginScrollView(listRect, m_NewShaderMaterialListScrollPos, scrollRect); // nSelectIndex = GUI.SelectionGrid(gridRect, m_nNewShaderMaterialIndex, m_NewShaderMaterialContents, nColumn, styleButton); nSelectIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_NewShaderMaterialListScrollPos.y), listRect, gridRect, m_nNewShaderMaterialIndex, m_NewShaderMaterialContents, nColumn, styleButton); if (m_nNewShaderMaterialIndex != nSelectIndex) { if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(m_NewShaderMaterials[nSelectIndex]); } else { m_nNewShaderMaterialIndex = nSelectIndex; if (m_SelectedMaterial != null) { NgMaterial.CopyMaterialArgument(m_SelectedMaterial, m_NewShaderMaterials[nSelectIndex]); } SetActiveMaterial(m_NewShaderMaterials[nSelectIndex], null, true, false); } } GUI.EndScrollView(); } // Found Material List ------------------------------------------------------ listRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, 2, 1, 1); GUI.Box(listRect, GetHelpContent("Found Material"), styleBox); if (bShowList && m_CurrentTextureMaterials != null && 0 < m_CurrentTextureMaterials.Length) { listRect = FXMakerLayout.GetOffsetRect(listRect, 5, 15, -5, -3); nColumn = (int)((listRect.width - 5) / listRect.height * 2.3f); nObjectCount = m_CurrentTextureMaterials.Length; scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, true); gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, true); m_CurrentTextureMaterialListScrollPos = GUI.BeginScrollView(listRect, m_CurrentTextureMaterialListScrollPos, scrollRect); // nSelectIndex = GUI.SelectionGrid(gridRect, m_nCurrentTextureMaterialIndex, m_CurrentTextureMaterialContents, nColumn, styleButton); nSelectIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_CurrentTextureMaterialListScrollPos.y), listRect, gridRect, m_nCurrentTextureMaterialIndex, m_CurrentTextureMaterialContents, nColumn, styleButton); if (m_nCurrentTextureMaterialIndex != nSelectIndex) { if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(m_NewShaderMaterials[nSelectIndex]); } else { m_nCurrentTextureMaterialIndex = nSelectIndex; SetActiveMaterial(m_CurrentTextureMaterials[nSelectIndex], null, false, false); } } GUI.EndScrollView(); } }
public override void OnInspectorGUI() { Rect rect; AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); m_FxmPopupManager = GetFxmPopupManager(); // test code // if (GUILayout.Button("Pause")) // FxmInfoIndexing.FindInstanceIndexing(m_Sel.transform, false).GetComponent<NcSpriteAnimation>().PauseAnimation(); // if (GUILayout.Button("Resume")) // FxmInfoIndexing.FindInstanceIndexing(m_Sel.transform, false).GetComponent<NcSpriteAnimation>().ResumeAnimation(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_TextureType = (NcSpriteAnimation.TEXTURE_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_TextureType"), m_Sel.m_TextureType); EditorGUILayout.Space(); if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.TileTexture) { if (GUILayout.Button(GetHelpContent("ConvertTo : TrimTexture"))) { m_Sel.m_NcSpriteFrameInfos = NgAtlas.TileToTrimTexture(m_Sel.renderer.sharedMaterial, m_Sel.m_nTilingX, m_Sel.m_nTilingY, 0, m_Sel.m_nFrameCount, 4096); if (m_Sel.m_NcSpriteFrameInfos != null) { m_Sel.m_TextureType = NcSpriteAnimation.TEXTURE_TYPE.TrimTexture; } } if (GUILayout.Button(GetHelpContent("ExportTo : SplitTexture"))) { string path = FXMakerCapture.GetExportSlitDir(); path = NgAtlas.ExportSplitTexture(path, m_Sel.renderer.sharedMaterial.mainTexture, m_Sel.m_nTilingX, m_Sel.m_nTilingY, 0, m_Sel.m_nFrameCount); if (path != "") { Debug.Log(path); EditorUtility.OpenWithDefaultApp(path); } } } else if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.TrimTexture) { if (GUILayout.Button(GetHelpContent("ExportTo : SplitTexture"))) { string path = FXMakerCapture.GetExportSlitDir(); path = NgAtlas.ExportSplitTexture(path, m_Sel.renderer.sharedMaterial.mainTexture, m_Sel.m_NcSpriteFrameInfos); if (path != "") { Debug.Log(path); EditorUtility.OpenWithDefaultApp(path); } } } else if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.SpriteFactory) { } EditorGUILayout.Space(); if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.TileTexture) { m_Sel.m_nTilingX = EditorGUILayout.IntField(GetHelpContent("m_nTilingX"), m_Sel.m_nTilingX); m_Sel.m_nTilingY = EditorGUILayout.IntField(GetHelpContent("m_nTilingY"), m_Sel.m_nTilingY); } else if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.TrimTexture) { m_Sel.m_MeshType = (NcSpriteFactory.MESH_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_MeshType"), m_Sel.m_MeshType); m_Sel.m_AlignType = (NcSpriteFactory.ALIGN_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_AlignType"), m_Sel.m_AlignType); } else if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.SpriteFactory) { m_Sel.m_NcSpriteFactoryPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_NcSpriteFactoryPrefab"), m_Sel.m_NcSpriteFactoryPrefab, typeof(GameObject), false, null); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("Select SpriteFactory"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("Clear SpriteFactory"), (m_Sel.m_NcSpriteFactoryPrefab != null))) { bClickButton = true; m_Sel.m_NcSpriteFactoryPrefab = null; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // -------------------------------------------------------------- if (m_Sel.m_NcSpriteFactoryPrefab != null && m_Sel.m_NcSpriteFactoryPrefab.renderer != null && m_Sel.renderer) { if (m_Sel.m_NcSpriteFactoryPrefab.renderer.sharedMaterial != m_Sel.renderer.sharedMaterial) { m_Sel.UpdateFactoryMaterial(); } } // -------------------------------------------------------------- NcSpriteFactory ncSpriteFactory = (m_Sel.m_NcSpriteFactoryPrefab == null ? null : m_Sel.m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory>()); if (ncSpriteFactory != null) { int nSelIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nSpriteFactoryIndex"), m_Sel.m_nSpriteFactoryIndex, 0, ncSpriteFactory.GetSpriteNodeCount() - 1); if (m_Sel.m_nSpriteFactoryIndex != nSelIndex) { m_Sel.SetSpriteFactoryIndex(nSelIndex, false); } } m_Sel.m_MeshType = (NcSpriteFactory.MESH_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_MeshType"), m_Sel.m_MeshType); m_Sel.m_AlignType = (NcSpriteFactory.ALIGN_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_AlignType"), m_Sel.m_AlignType); } m_Sel.m_PlayMode = (NcSpriteAnimation.PLAYMODE)EditorGUILayout.EnumPopup(GetHelpContent("m_PlayMode"), m_Sel.m_PlayMode, GUILayout.MaxWidth(Screen.width)); if (m_Sel.m_PlayMode != NcSpriteAnimation.PLAYMODE.SELECT) { m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); } m_Sel.m_nStartFrame = EditorGUILayout.IntField(GetHelpContent("m_nStartFrame"), m_Sel.m_nStartFrame); m_Sel.m_nFrameCount = EditorGUILayout.IntField(GetHelpContent("m_nFrameCount"), m_Sel.m_nFrameCount); if (m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.SELECT) { m_Sel.m_nSelectFrame = EditorGUILayout.IntField(GetHelpContent("m_nSelectFrame"), m_Sel.m_nSelectFrame); } if (m_Sel.m_PlayMode != NcSpriteAnimation.PLAYMODE.RANDOM && m_Sel.m_PlayMode != NcSpriteAnimation.PLAYMODE.SELECT) { bool bOldLoop = m_Sel.m_bLoop; m_Sel.m_bLoop = EditorGUILayout.Toggle(GetHelpContent("m_bLoop"), m_Sel.m_bLoop); if (!bOldLoop && m_Sel.m_bLoop) { m_Sel.m_nLoopStartFrame = 0; m_Sel.m_nLoopFrameCount = m_Sel.m_nFrameCount; m_Sel.m_nLoopingCount = 0; } if (m_Sel.m_bLoop && m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.DEFAULT) { m_Sel.m_nLoopStartFrame = EditorGUILayout.IntField(" nLoopStartFrame", m_Sel.m_nLoopStartFrame); m_Sel.m_nLoopFrameCount = EditorGUILayout.IntField(" nLoopFrameCount", m_Sel.m_nLoopFrameCount); m_Sel.m_nLoopingCount = EditorGUILayout.IntField(" nLoopingCount", m_Sel.m_nLoopingCount); } if (m_Sel.m_bLoop == false || 0 < m_Sel.m_nLoopingCount) { m_Sel.m_bAutoDestruct = EditorGUILayout.Toggle(GetHelpContent("m_bAutoDestruct"), m_Sel.m_bAutoDestruct); } m_Sel.m_fFps = EditorGUILayout.FloatField(GetHelpContent("m_fFps"), m_Sel.m_fFps); } // check SetMinValue(ref m_Sel.m_nTilingX, 1); SetMinValue(ref m_Sel.m_nTilingY, 1); SetMinValue(ref m_Sel.m_fFps, 0.1f); SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMaxValue(ref m_Sel.m_nStartFrame, m_Sel.GetMaxFrameCount() - 1); SetMinValue(ref m_Sel.m_nStartFrame, 0); SetMaxValue(ref m_Sel.m_nFrameCount, m_Sel.GetValidFrameCount()); SetMinValue(ref m_Sel.m_nFrameCount, 1); SetMaxValue(ref m_Sel.m_nSelectFrame, (0 < m_Sel.m_nFrameCount ? m_Sel.m_nFrameCount - 1 : m_Sel.m_nTilingX *m_Sel.m_nTilingY - 1)); SetMinValue(ref m_Sel.m_nSelectFrame, 0); SetMaxValue(ref m_Sel.m_nLoopStartFrame, m_Sel.m_nFrameCount - 1); SetMinValue(ref m_Sel.m_nLoopStartFrame, 0); SetMinValue(ref m_Sel.m_nLoopFrameCount, 0); SetMaxValue(ref m_Sel.m_nLoopFrameCount, m_Sel.m_nFrameCount - m_Sel.m_nLoopStartFrame); SetMinValue(ref m_Sel.m_nLoopingCount, 0); if (m_Sel.m_PlayMode != NcSpriteAnimation.PLAYMODE.RANDOM && m_Sel.m_PlayMode != NcSpriteAnimation.PLAYMODE.SELECT) { EditorGUILayout.TextField(GetHelpContent("DurationTime"), m_Sel.GetDurationTime().ToString()); } // Texture -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(150)); { GUI.Box(rect, ""); GUILayout.Label(""); Rect subRect = rect; // draw texture if (m_Sel.renderer != null && m_Sel.renderer.sharedMaterial != null && m_Sel.renderer.sharedMaterial.mainTexture != null) { int nClickFrameIndex; if (m_Sel.m_TextureType == NcSpriteAnimation.TEXTURE_TYPE.TileTexture) { if (DrawTileTexture(subRect, (m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.SELECT), m_Sel.renderer.sharedMaterial, m_Sel.m_nTilingX, m_Sel.m_nTilingY, m_Sel.m_nStartFrame, m_Sel.m_nFrameCount, m_Sel.m_nSelectFrame, out nClickFrameIndex)) { bClickButton = true; if (bClickButton && m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.SELECT) { m_Sel.m_nSelectFrame = nClickFrameIndex; } } } if (m_Sel.m_TextureType != NcSpriteAnimation.TEXTURE_TYPE.TileTexture) { if (DrawTrimTexture(subRect, (m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.SELECT), m_Sel.renderer.sharedMaterial, m_Sel.m_NcSpriteFrameInfos, m_Sel.m_nStartFrame, m_Sel.m_nFrameCount, m_Sel.m_nSelectFrame, out nClickFrameIndex)) { bClickButton = true; if (bClickButton && m_Sel.m_PlayMode == NcSpriteAnimation.PLAYMODE.SELECT) { m_Sel.m_nSelectFrame = nClickFrameIndex; } } } } } EditorGUILayout.EndHorizontal(); m_UndoManager.CheckDirty(); EditorGUILayout.Space(); // Remove AlphaChannel if (GUILayout.Button(GetHelpContent("Remove AlphaChannel"))) { NgAtlas.ConvertAlphaTexture(m_Sel.renderer.sharedMaterial, false, m_Sel.m_curveAlphaWeight, 1, 1, 1); } // AlphaWeight if ((m_Sel.m_curveAlphaWeight == null || m_Sel.m_curveAlphaWeight.length <= 0) && FXMakerOption.inst != null) { m_Sel.m_curveAlphaWeight = FXMakerOption.inst.m_AlphaWeightCurve; } if (m_Sel.m_curveAlphaWeight != null) { bool bHighLight = m_Sel.m_bNeedRebuildAlphaChannel; if (bHighLight) { FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox); } if (GUILayout.Button(GetHelpContent("Adjust the alpha channel with AlphaWeight"))) { m_Sel.m_bNeedRebuildAlphaChannel = false; NgAtlas.ConvertAlphaTexture(m_Sel.renderer.sharedMaterial, true, m_Sel.m_curveAlphaWeight, 1, 1, 1); // NgAtlas.ConvertAlphaTexture(m_Sel.renderer.sharedMaterial, m_Sel.m_curveAlphaWeight, m_Sel.m_fRedAlphaWeight, m_Sel.m_fGreenAlphaWeight, m_Sel.m_fBlueAlphaWeight); } if (bHighLight) { FXMakerLayout.GUIColorRestore(); } EditorGUI.BeginChangeCheck(); m_Sel.m_curveAlphaWeight = EditorGUILayout.CurveField(GetHelpContent("m_curveAlphaWeight"), m_Sel.m_curveAlphaWeight); if (EditorGUI.EndChangeCheck()) { m_Sel.m_bNeedRebuildAlphaChannel = true; } // m_Sel.m_fRedAlphaWeight = EditorGUILayout.Slider("", m_Sel.m_fRedAlphaWeight , 0, 1.0f); // m_Sel.m_fGreenAlphaWeight = EditorGUILayout.Slider("", m_Sel.m_fGreenAlphaWeight , 0, 1.0f); // m_Sel.m_fBlueAlphaWeight = EditorGUILayout.Slider("", m_Sel.m_fBlueAlphaWeight , 0, 1.0f); } EditorGUILayout.Space(); } // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
void winPopup(int id) { Rect baseRect = GetPopupRect(); Rect lineRect; int nMargin = 2; int nTopHeight = 1; int nLineCount = 25; int nIncLine = 0; string str; // if (UnfocusClose(baseRect, 5, 0, 0, 0)) // return; baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1); baseRect = FXMakerLayout.GetOffsetRect(baseRect, -nMargin); // Capture lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height - 1), (int)lineRect.width, Color.grey, 2, false); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), "Capture"); // m_CaptureType lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("CaptureType"), false); m_CaptureType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_CaptureType == CAPTURE_TYPE.ANIMATION, new GUIContent("Animation"), true) ? CAPTURE_TYPE.ANIMATION : m_CaptureType; m_CaptureType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), m_CaptureType == CAPTURE_TYPE.RANDOM, new GUIContent("Random"), true) ? CAPTURE_TYPE.RANDOM : m_CaptureType; // size 32, 64, 128, 256, 512 lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Size"), false); m_nCaptureSizeIndex = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nCaptureSizeIndex, 1, 0, m_nCaptureSizeValues.Length - 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nCaptureSizeValues[m_nCaptureSizeIndex].ToString(), false); if (m_CaptureType == CAPTURE_TYPE.ANIMATION) { // frame lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Fps"), false); m_nFrameCountIndex = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nFrameCountIndex, 1, 0, m_nFrameCountValues.Length); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nFrameCountValues[m_nFrameCountIndex].ToString(), false); // Get Time lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 1, 0, 1), "Get Duration = " + FXMakerMain.inst.GetFXMakerControls().GetLastAutoRetTime().ToString("0.00"), true)) { m_fCaptureTime = System.Convert.ToSingle(FXMakerMain.inst.GetFXMakerControls().GetLastAutoRetTime().ToString("0.00")); } // Rescale Time lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Time"), false); m_fCaptureTime = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fCaptureTime, GetFrameTime(), GetFrameTime(), m_fMaxCaptureTime); str = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_fCaptureTime.ToString(), true).Trim(); m_fCaptureTime = NgConvert.ToFloat(str, m_fCaptureTime); // SkipFrameCount lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("SkipFrame"), false); if (m_nTotalFrameCount <= m_nSkipFrameCount) { m_nSkipFrameCount = m_nTotalFrameCount - 1; } if (m_nTotalFrameCount <= 1) { m_nSkipFrameCount = 0; } else { m_nSkipFrameCount = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nSkipFrameCount, 1, 0, m_nTotalFrameCount); } FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nSkipFrameCount.ToString(), false); // total m_nTotalFrameCount = (int)(m_fCaptureTime / GetFrameTime()) + 1; m_nSaveFrameCount = (m_nTotalFrameCount - m_nSkipFrameCount); m_nResultFps = m_nFrameCountValues[m_nFrameCountIndex]; } if (m_CaptureType == CAPTURE_TYPE.RANDOM) { // m_nRandomCaptureCount lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("CaptureCount"), false); m_nRandomCaptureCount = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_nRandomCaptureCount, 1, 1, m_fMaxRandomCaptureCount); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nRandomCaptureCount.ToString(), false); // SkipTime lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("SkipTime"), false); m_fCaptureTime = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fCaptureTime, 0.01f, 0, m_fMaxCaptureTime); str = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_fCaptureTime.ToString(), true).Trim(); m_fCaptureTime = NgConvert.ToFloat(str, m_fCaptureTime); nIncLine += 2; // total m_nSkipFrameCount = 0; m_nTotalFrameCount = m_nRandomCaptureCount; m_nSaveFrameCount = m_nRandomCaptureCount; m_nResultFps = m_nFrameCountValues[m_nFrameCountIndex]; } // total frame lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TotalFrame"), false); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 7), (m_nTotalFrameCount - m_nSkipFrameCount).ToString(), false); // m_nResultTextureSize m_nResultCaptureSize = m_nCaptureSizeValues[(int)m_nCaptureSizeIndex]; m_nResultTextureSize = NgAtlas.GetTextureSize(m_nSaveFrameCount, m_nResultCaptureSize); lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TextureSize"), false); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 7), m_nResultTextureSize.ToString() + " x " + (m_nSaveFrameCount <= (m_nResultTextureSize / m_nResultCaptureSize) * (m_nResultTextureSize / m_nResultCaptureSize) / 2 ? m_nResultTextureSize / 2 : m_nResultTextureSize).ToString(), false); // ------------------------------------------------------------------------------------------------------------------------- // Output lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); NgGUIDraw.DrawHorizontalLine(new Vector2(lineRect.x, lineRect.y + lineRect.height - 1), (int)lineRect.width, Color.grey, 2, false); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), "Output"); // bCreatePrefab lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Create"), false); m_bCreatePrefab = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_bCreatePrefab, new GUIContent("Prefab"), true); m_bCreatePrefab = !FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), !m_bCreatePrefab, new GUIContent("Texture"), true); // PlayMode lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("PlayMode"), false); if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.DEFAULT), new GUIContent("Default"), m_bCreatePrefab)) { m_PlayMode = NcSpriteAnimation.PLAYMODE.DEFAULT; } if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.INVERSE), new GUIContent("Inverse"), m_bCreatePrefab)) { m_PlayMode = NcSpriteAnimation.PLAYMODE.INVERSE; } lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.PINGPONG), new GUIContent("PingPong"), m_bCreatePrefab)) { m_PlayMode = NcSpriteAnimation.PLAYMODE.PINGPONG; } if (FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_PlayMode == NcSpriteAnimation.PLAYMODE.RANDOM), new GUIContent("Random"), m_bCreatePrefab)) { m_PlayMode = NcSpriteAnimation.PLAYMODE.RANDOM; } // Loop lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Loop"), false); if (m_bCreatePrefab) { m_bLoop = !FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && !m_bLoop), new GUIContent("Once"), m_bCreatePrefab); m_bLoop = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && m_bLoop), new GUIContent("Loop"), m_bCreatePrefab); } else { FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), (m_bCreatePrefab && m_bLoop), new GUIContent("Once"), m_bCreatePrefab); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), (m_bCreatePrefab && !m_bLoop), new GUIContent("Loop"), m_bCreatePrefab); } // Shader lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Shader"), false); if (m_bCreatePrefab) { m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE), new GUIContent("Additive"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE : m_ShaderType; m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_MOBILE), new GUIContent("AdditiveMobile"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE_MOBILE : m_ShaderType; lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_SOFT), new GUIContent("AdditiveSoft"), m_bCreatePrefab) ? SHADER_TYPE.ADDITIVE_SOFT : m_ShaderType; m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED), new GUIContent("AlphaBlended"), m_bCreatePrefab) ? SHADER_TYPE.ALPHA_BLENDED : m_ShaderType; lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); m_ShaderType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 13), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE), new GUIContent("AlphaBlendedMobile"), m_bCreatePrefab) ? SHADER_TYPE.ALPHA_BLENDED_MOBILE : m_ShaderType; } else { FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 5), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE), new GUIContent("Additive"), m_bCreatePrefab); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 12, 4), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_MOBILE), new GUIContent("Mobile"), m_bCreatePrefab); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 17, 3), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE_SOFT), new GUIContent("Soft"), m_bCreatePrefab); lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED), new GUIContent("AlphaBlended"), m_bCreatePrefab); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 14, 7), (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED_MOBILE), new GUIContent("AlphaBlendedMobile"), m_bCreatePrefab); } // Fade lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); bool bFade = (m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ADDITIVE || m_bCreatePrefab && m_ShaderType == SHADER_TYPE.ALPHA_BLENDED); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Fade"), false); if (bFade) { m_bFadeIn = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), m_bFadeIn, new GUIContent("FadeIn"), bFade); m_bFadeOut = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), m_bFadeOut, new GUIContent("FadeOut"), bFade); } else { FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6), false, new GUIContent("FadeIn"), bFade); FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6), false, new GUIContent("FadeOut"), bFade); } // Texture Format --------------------------------------------------------------------------------------- // TextureType lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("TextureType"), false); m_bGUITexture = FXMakerLayout.GUIToggle(GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 7, 6)), m_bGUITexture, new GUIContent("GUI"), true); m_bGUITexture = !FXMakerLayout.GUIToggle(GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 20, 13, 6)), !m_bGUITexture, new GUIContent("Texture"), true); // AnisoLevel lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("AnisoLevel"), false); if (!m_bGUITexture) { m_anisoLevel = (int)GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_anisoLevel, 1, 0, 9 + 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_anisoLevel.ToString(), false); } // m_nSpriteTextureSizes lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("MaxSize"), false); m_fSpriteTextureIndex = GUI.HorizontalScrollbar(GetScrollbarRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 3, 5)), m_fSpriteTextureIndex, 1, 0, m_nSpriteTextureSizes.Length - 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 8, 2), m_nSpriteTextureSizes[(int)m_fSpriteTextureIndex].ToString(), false); // m_nSpriteTextureFormat lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 10, 0, 3), GetHelpContent("Format"), false); lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); for (int n = 0; n < m_SpriteTextureFormatName.Length; n++) { Rect toggleRect = GetToggleRect(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, n, 1)); if (n == 2) { toggleRect.x -= 15; toggleRect.width += 15; } bool bCheck = (GUI.Toggle(toggleRect, (m_fSpriteTextureFormatIdx == n), m_SpriteTextureFormatName[n])); if (bCheck && m_fSpriteTextureFormatIdx != n) { m_fSpriteTextureFormatIdx = n; // EditorPrefs.SetInt("FxmSpritePopup.m_nShowGameObjectOptionIndex", m_nShowGameObjectOptionIndex); } } nIncLine++; lineRect = FXMakerLayout.GetInnerVerticalRect(baseRect, nLineCount, nIncLine++, 1); lineRect = FXMakerLayout.GetOffsetRect(lineRect, 0, -12, 0, 0); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 2, 0, 1), "Build Sprite", (m_nResultTextureSize <= 2048))) { FXMakerCapture.StartSpriteCapture(m_CaptureType, m_nTotalFrameCount, (m_CaptureType == CAPTURE_TYPE.ANIMATION ? GetFrameTime() : m_fCaptureTime), GetSpriteCaptureRect()); ClosePopup(); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 2, 1, 1), "Close", true)) { ClosePopup(); } FXMakerMain.inst.SaveTooltip(); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_AttachType = (NcAttachPrefab.AttachType)EditorGUILayout.EnumPopup(GetHelpContent("m_AttachType"), m_Sel.m_AttachType, GUILayout.MaxWidth(Screen.width)); if (m_Sel.m_AttachType == NcAttachPrefab.AttachType.Active) { m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); m_Sel.m_fRepeatTime = EditorGUILayout.FloatField(GetHelpContent("m_fRepeatTime"), m_Sel.m_fRepeatTime); } m_Sel.m_nRepeatCount = EditorGUILayout.IntField(GetHelpContent("m_nRepeatCount"), m_Sel.m_nRepeatCount); m_Sel.m_AttachPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_AttachPrefab"), m_Sel.m_AttachPrefab, typeof(GameObject), false, null); 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); if (m_Sel.m_AttachType == NcAttachPrefab.AttachType.Destroy) { SetMinValue(ref m_Sel.m_nRepeatCount, 1); FXMakerLayout.GUIEnableBackup(false); EditorGUILayout.Toggle(GetHelpContent("m_bWorldSpace"), true); FXMakerLayout.GUIEnableRestore(); } if (m_Sel.m_AttachType == NcAttachPrefab.AttachType.Active) { m_Sel.m_bWorldSpace = EditorGUILayout.Toggle(GetHelpContent("m_bWorldSpace"), m_Sel.m_bWorldSpace); } m_Sel.m_RandomRange = EditorGUILayout.Vector3Field("m_RandomRange", m_Sel.m_RandomRange, null); m_Sel.m_AddStartPos = EditorGUILayout.Vector3Field("m_AddStartPos", m_Sel.m_AddStartPos, null); m_Sel.m_AccumStartRot = EditorGUILayout.Vector3Field("m_AccumStartRot", m_Sel.m_AccumStartRot, null); // check SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMinValue(ref m_Sel.m_fRepeatTime, 0); SetMinValue(ref m_Sel.m_nRepeatCount, 0); SetMinValue(ref m_Sel.m_fPrefabSpeed, 0.01f); SetMinValue(ref m_Sel.m_fPrefabLifeTime, 0); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 0, 1), GetHelpContent("Select Prefab"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 1, 1), GetHelpContent("Clear Prefab"), (m_Sel.m_AttachPrefab != null))) { bClickButton = true; m_Sel.m_AttachPrefab = null; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 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(); // m_nSpriteFactoryIndex EditorGUILayout.Space(); if (m_Sel.m_AttachPrefab) { NcSpriteFactory ncSpriteFactory = m_Sel.m_AttachPrefab.GetComponent <NcSpriteFactory>(); if (ncSpriteFactory) { m_Sel.m_nSpriteFactoryIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nSpriteFactoryIndex"), m_Sel.m_nSpriteFactoryIndex, 0, ncSpriteFactory.GetSpriteNodeCount() - 1); string[] spriteNames = new string[ncSpriteFactory.GetSpriteNodeCount()]; for (int n = 0; n < ncSpriteFactory.GetSpriteNodeCount(); n++) { spriteNames[n] = ncSpriteFactory.GetSpriteNode(n).m_SpriteName; } m_Sel.m_nSpriteFactoryIndex = EditorGUILayout.Popup("SpriteName", m_Sel.m_nSpriteFactoryIndex, spriteNames); } else { m_Sel.m_nSpriteFactoryIndex = -1; } } else { m_Sel.m_nSpriteFactoryIndex = -1; } } m_UndoManager.CheckDirty(); // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
// ========================================================================================================== public void OnGUIGizmo() { Rect baseRect = FXMakerLayout.GetMenuGizmoRect(); Rect boxRect; Rect subRect; GUIStyle toolStyle = GUI.skin.GetStyle("GizmoToolbar"); int nColCount = 15; // ----------------------------------------------------------------------------------------------------------------------------------- GUI.Box(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 7), new GUIContent(" ", " ")); m_nGizmoTypeIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 0, 5), m_nGizmoTypeIndex, GetGizmoContents(), 5, toolStyle); // ----------------------------------------------------------------------------------------------------------------------------------- boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 5, 2); subRect = FXMakerLayout.GetOffsetRect(boxRect, 4, 0, -2, 0); m_bWorldSpace = GUI.Toggle(new Rect(subRect.x, subRect.y - 3, subRect.width, subRect.height - 5), m_bWorldSpace, FXMakerTooltip.GetHcEffectGizmo("World")); m_bFixedSide = GUI.Toggle(new Rect(subRect.x, subRect.y + 10, subRect.width, subRect.height - 6), m_bFixedSide, FXMakerTooltip.GetHcEffectGizmo("Fixed-Z")); // ----------------------------------------------------------------------------------------------------------------------------------- boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 7, 4); boxRect = FXMakerLayout.GetOffsetRect(boxRect, 2, 0, -2, 0); GUI.Box(boxRect, new GUIContent(" ", " ")); subRect = FXMakerLayout.GetOffsetRect(boxRect, 1, -3, -4, -8); m_bGridXY = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bGridXY, FXMakerTooltip.GetHcEffectGizmo("XY")); m_bGridXZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bGridXZ, FXMakerTooltip.GetHcEffectGizmo("XZ")); m_bGridYZ = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bGridYZ, FXMakerTooltip.GetHcEffectGizmo("YZ")); subRect = FXMakerLayout.GetOffsetRect(boxRect, 1, 10, -4, 3); m_bBackground = GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 1, 0, 1), m_bBackground, FXMakerTooltip.GetHcEffectGizmo("Background")); // ----------------------------------------------------------------------------------------------------------------------------------- boxRect = FXMakerLayout.GetInnerHorizontalRect(baseRect, nColCount, 11, 4); GUI.Box(boxRect, new GUIContent(" ", " ")); subRect = FXMakerLayout.GetOffsetRect(boxRect, 0, 2, 0, -2); // Grayscale bool bGray = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 0, 1), m_bShowGameObjectOptionGray, FXMakerTooltip.GetHcEffectGizmo("Gray"))); if (m_bShowGameObjectOptionGray != bGray) { m_bShowGameObjectOptionGray = bGray; UnityEditor.EditorPrefs.SetBool("FXMakerHierarchy.m_bShowGameObjectOptionGray", m_bShowGameObjectOptionGray); FXMakerMain.inst.ResetCamera(); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } // BoundsBox bool bBounds = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 1, 1), m_bShowGameObjectOptionBounds, FXMakerTooltip.GetHcEffectGizmo("Box"))); if (m_bShowGameObjectOptionBounds != bBounds) { m_bShowGameObjectOptionBounds = bBounds; UnityEditor.EditorPrefs.SetBool("FXMakerHierarchy.m_bShowGameObjectOptionBounds", m_bShowGameObjectOptionBounds); FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true); } // wireframe bool bWireframe = (GUI.Toggle(FXMakerLayout.GetInnerHorizontalRect(subRect, 3, 2, 1), m_bShowGameObjectOptionWireframe, FXMakerTooltip.GetHcEffectGizmo("Wire"))); if (m_bShowGameObjectOptionWireframe != bWireframe) { m_bShowGameObjectOptionWireframe = bWireframe; UnityEditor.EditorPrefs.SetBool("FXMakerHierarchy.m_bShowGameObjectOptionWireframe", m_bShowGameObjectOptionWireframe); FXMakerHierarchy.inst.ChangeBoundsBoxWireframe(FXMakerHierarchy.inst.GetSelectedGameObject(), FXMakerMain.inst.GetOriginalEffectObject(), true, true); } // ----------------------------------------------------------------------------------------------------------------------------------- if (GUI.changed) { SetGizmoType(m_nGizmoTypeIndex); EditorPrefs.SetBool("FXMakerGizmo.m_bWorldSpace", m_bWorldSpace); // EditorPrefs.SetBool("FXMakerGizmo.m_bFixedSide", m_bFixedSide); EditorPrefs.SetBool("FXMakerGizmo.m_bGridXY", m_bGridXY); EditorPrefs.SetBool("FXMakerGizmo.m_bGridXZ", m_bGridXZ); EditorPrefs.SetBool("FXMakerGizmo.m_bGridYZ", m_bGridYZ); EditorPrefs.SetBool("FXMakerGizmo.m_bBackground", m_bBackground); UpdateGrid(true); FXMakerBackground.inst.UpdateBackground(); } // DrawGuiGizmo(); FXMakerMain.inst.SaveTooltip(); }
// ========================================================================================================== void winPopup(int id) { Rect baseRect = GetPopupRect(); GUIStyle styleBox = GUI.skin.GetStyle("Transform_Box"); if (UnfocusClose(baseRect, 0, 0, 0, 20)) { return; } Rect lineRect; Rect groupRect; Rect leftRect; Rect rightRect; int nGroup = 3; int nLine = 2; string format = ""; baseRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 1, 0, 1); baseRect = FXMakerLayout.GetOffsetRect(baseRect, -2); GUI.Box(baseRect, " "); // -------------------------------------------------------------------------------- // // World Position // groupRect = gNcLayout.GetInnerVerticalRect(baseRect, 15, 0, 5); // groupRect = gNcLayout.GetOffsetRect(groupRect, -5); // leftRect = gNcLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2); // rightRect = gNcLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4); // GUI.Label(gNcLayout.GetInnerHorizontalRect(leftRect, 1, 0, 1), "World Position"); // GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), trans.position.x.ToString(format), styleBox); // GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), trans.position.y.ToString(format), styleBox); // GUI.Box(gNcLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), trans.position.z.ToString(format), styleBox); // NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.yMax+5), (int)groupRect.width, Color.black, 2, false); // Clipboard groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 0, 8); groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5); leftRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2); rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4); for (int n = 0; n < nGroup; n++) { Vector3 vecValue = Vector3.zero; TRANS_TYPE nTrans = (TRANS_TYPE)n; switch (nTrans) { case TRANS_TYPE.POSITION: vecValue = m_CopyTransform.m_vecPos; break; case TRANS_TYPE.ROTATION: vecValue = m_CopyTransform.m_vecRotHint; break; case TRANS_TYPE.SCALE: vecValue = m_CopyTransform.m_vecScale; break; } GUI.Label(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(leftRect, 1, 0, 1), 3, n, 1), "Clipboard " + m_TransStrings[n]); GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), 3, n, 1), vecValue.x.ToString(format), styleBox); GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), 3, n, 1), vecValue.y.ToString(format), styleBox); GUI.Box(FXMakerLayout.GetInnerVerticalRect(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), 3, n, 1), vecValue.z.ToString(format), styleBox); } groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 8, 1); groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5); NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.y - 5), (int)groupRect.width, Color.grey, 2, false); // -------------------------------------------------------------------------------- groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 9, 3); groupRect = FXMakerLayout.GetOffsetRect(groupRect, 5, 0, -5, 0); GUIContent[] worldlocalCon = new GUIContent[2] { GetHelpContent("World"), GetHelpContent("Local") }; // int nWorldLocalIndex = GUI.SelectionGrid(groupRect, m_nWorldLocalSelIndex, worldlocalCon, 2); int nWorldLocalIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), groupRect, m_nWorldLocalSelIndex, worldlocalCon, 2); if (m_nWorldLocalSelIndex != nWorldLocalIndex) { m_nWorldLocalSelIndex = nWorldLocalIndex; EditorPrefs.SetInt("FxmPopup_Transform.m_nWorldLocalSelIndex", m_nWorldLocalSelIndex); InitFloatInput(); SaveTransform(); } // -------------------------------------------------------------------------------- Rect editRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 12, 18); for (int n = 0; n < nGroup; n++) { Vector3 vecValue = Vector3.zero; TRANS_TYPE nTrans = (TRANS_TYPE)n; switch (nTrans) { case TRANS_TYPE.POSITION: vecValue = m_SaveTrans.m_vecPos; break; case TRANS_TYPE.ROTATION: vecValue = m_SaveTrans.m_vecRotHint; break; case TRANS_TYPE.SCALE: vecValue = m_SaveTrans.m_vecScale; break; } Vector3 oldValue = vecValue; for (int nn = 0; nn < 3; nn++) { if (m_strFloatInput[n, nn] == null) { m_strFloatInput[n, nn] = vecValue[nn].ToString(); } } groupRect = FXMakerLayout.GetInnerVerticalRect(editRect, nGroup, n, 1); groupRect = FXMakerLayout.GetOffsetRect(groupRect, -3); leftRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2); rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4); // left // line 1 lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 0, 1); GUI.Label(FXMakerLayout.GetInnerHorizontalRect(lineRect, 1, 0, 1), (m_nWorldLocalSelIndex == 0 ? "World " : "Local ") + m_TransStrings[n]); // line 2 lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 1, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Reset"))) { ResetTransform(nTrans); RecreateInstance(); InitFloatInput(); return; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("Copy"))) { CopyTransform(nTrans); InitFloatInput(); return; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), GetHelpContent("Paste"))) { PasteTransform(nTrans); InitFloatInput(); return; } // left, All Scale if (nTrans == TRANS_TYPE.SCALE) { lineRect = FXMakerLayout.GetInnerVerticalRect(leftRect, nLine, 0, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 5, 3, 1), GetHelpContent(GetPrevName(nTrans).ToString()))) { SetTransform(TRANS_TYPE.SCALE, GetPrevValue(nTrans, vecValue)); RecreateInstance(); InitFloatInput(); return; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 5, 4, 1), GetHelpContent(GetNextName(nTrans).ToString()))) { SetTransform(TRANS_TYPE.SCALE, GetNextValue(nTrans, vecValue)); RecreateInstance(); InitFloatInput(); return; } } // right // line 1 lineRect = FXMakerLayout.GetInnerVerticalRect(rightRect, nLine, 0, 1); GUI.SetNextControlName("TextField"); m_strFloatInput[n, 0] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), m_strFloatInput[n, 0]); m_strFloatInput[n, 0] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 0], ref vecValue.x); GUI.SetNextControlName("TextField"); m_strFloatInput[n, 1] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), m_strFloatInput[n, 1]); m_strFloatInput[n, 1] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 1], ref vecValue.y); GUI.SetNextControlName("TextField"); m_strFloatInput[n, 2] = GUI.TextField(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), m_strFloatInput[n, 2]); m_strFloatInput[n, 2] = NgConvert.GetVaildFloatString(m_strFloatInput[n, 2], ref vecValue.z); // if (nTrans == TRANS_TYPE.ROTATION) // vecValue = Vector3.zero; // line 2 lineRect = FXMakerLayout.GetInnerVerticalRect(rightRect, nLine, 1, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 0, 1), GetHelpContent(GetPrevName(nTrans).ToString()))) { vecValue.x = GetPrevValue(nTrans, vecValue.x); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 1, 1), GetHelpContent(GetNextName(nTrans).ToString()))) { vecValue.x = GetNextValue(nTrans, vecValue.x); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 2, 1), GetHelpContent(GetPrevName(nTrans).ToString()))) { vecValue.y = GetPrevValue(nTrans, vecValue.y); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 3, 1), GetHelpContent(GetNextName(nTrans).ToString()))) { vecValue.y = GetNextValue(nTrans, vecValue.y); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 4, 1), GetHelpContent(GetPrevName(nTrans).ToString()))) { vecValue.z = GetPrevValue(nTrans, vecValue.z); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3 * 2, 5, 1), GetHelpContent(GetNextName(nTrans).ToString()))) { vecValue.z = GetNextValue(nTrans, vecValue.z); } // Set if (vecValue != oldValue) { SetTransform(nTrans, vecValue); RecreateInstance(); InitFloatInput(); return; } } // -------------------------------------------------------------------------------- // World, Local groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 30, 1); groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5); NgGUIDraw.DrawHorizontalLine(new Vector2(groupRect.x, groupRect.y - 6), (int)groupRect.width, Color.grey, 1, false); groupRect = FXMakerLayout.GetInnerVerticalRect(baseRect, 35, 30, 5); groupRect = FXMakerLayout.GetOffsetRect(groupRect, -5); leftRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 0, 2); rightRect = FXMakerLayout.GetInnerHorizontalRect(groupRect, 6, 2, 4); GUI.Label(leftRect, m_nWorldLocalSelIndex == 0 ? "World " : "Local "); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 0, 1), GetHelpContent("Reset"))) { ResetTransform(TRANS_TYPE.POSITION); ResetTransform(TRANS_TYPE.ROTATION); ResetTransform(TRANS_TYPE.SCALE); RecreateInstance(); InitFloatInput(); return; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 1, 1), GetHelpContent("Copy"))) { CopyTransform(TRANS_TYPE.POSITION); CopyTransform(TRANS_TYPE.ROTATION); CopyTransform(TRANS_TYPE.SCALE); return; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(rightRect, 3, 2, 1), GetHelpContent("Paste"))) { PasteTransform(TRANS_TYPE.POSITION); PasteTransform(TRANS_TYPE.ROTATION); PasteTransform(TRANS_TYPE.SCALE); RecreateInstance(); InitFloatInput(); return; } FXMakerMain.inst.SaveTooltip(); }
void winMenuEdit(int id) { if (m_nGroupCount <= 0) { return; } // Change Group name if (0 <= m_nGroupIndex && m_nGroupIndex < m_nGroupCount) { // string newName = GUI.TextField(gNcLayout.GetChildVerticalRect(gNcLayout.GetMenuTopRightRect(), 0, 2, 0), m_GroupFolerStrings[m_nGroupIndex], 50); // newName = newName.Trim(); // if (newName != "" && m_GroupFolerStrings[m_nGroupIndex] != newName) // { // FileUtil.ReplaceDirectory(NgFile.CombinePath(m_RootBackgroundDir, m_GroupFolerStrings[m_nGroupIndex]), NgFile.CombinePath(m_RootBackgroundDir, newName)); // m_GroupFolerStrings[m_nGroupIndex] = newName; // FXMakerMain.inst.AssetDatabaseRefresh(); // } } // Add button if (m_nBackgroundCount < FXMakerOption.inst.m_nMinBottomToolbarCount) { if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 0, 1), 2, 0, 1), FXMakerTooltip.GetHcToolBackground("New", NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), m_GroupFolerContents[m_nGroupIndex].text)))) { RenameCurrentPrefab(m_EditingName); NewPrefab(); return; } } // Selected state if (m_CurrentBackgroundInfo != null) { // Delete button if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 0, 1), 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Del", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); m_bProcessDelete = true; } if (m_bProcessDelete) { m_bProcessDelete = FxmPopupManager.inst.ShowModalOkCancelMessage("'" + m_BackgroundContents[m_nBackgroundIndex].text + "'\n" + FXMakerTooltip.GetHsToolMessage("DIALOG_DELETEPREFAB", "")); if (m_bProcessDelete == false) { if (FxmPopupManager.inst.GetModalMessageValue() == FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK) { if (m_CurrentBackgroundInfo != null) { DestroyImmediate(m_CurrentBackgroundInfo.gameObject); } FXMakerAsset.DeleteEffectPrefab(m_BackgroundPrefabs[m_nBackgroundIndex]); SelectToolbar(m_nGroupIndex, m_nBackgroundIndex - 1); return; } } } // Clone button if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 1, 1), 2, 0, 1), FXMakerTooltip.GetHcToolBackground("Clone", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); ClonePrefab(); return; } // Thumb Selected if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 1, 1), 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Thumb", m_BackgroundContents[m_nBackgroundIndex].text))) { RenameCurrentPrefab(m_EditingName); ThumbPrefab(); return; } // ChangeName if (m_CurrentBackgroundInfo != null && 0 <= m_nBackgroundIndex && m_nBackgroundIndex < m_nBackgroundCount) { GUI.SetNextControlName("TextField"); m_EditingName = GUI.TextField(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuTopRightRect(), 0, 3, 2, 1), m_EditingName, 50); if (FXMakerMain.GetPrevWindowFocus() == (int)FXMakerLayout.WINDOWID.TOP_RIGHT && FXMakerMain.GetWindowFocus() != (int)FXMakerLayout.WINDOWID.TOP_RIGHT) { RenameCurrentPrefab(m_EditingName); } } } FXMakerMain.inst.SaveTooltip(); }
private void winActionToolbar(int id) { Rect actionToolbarRect = this.GetActionToolbarRect(); string text = string.Empty; string str = string.Empty; int num = 10; int count = 5; this.m_bMinimize = GUI.Toggle(new Rect(3f, 1f, FXMakerLayout.m_fMinimizeClickWidth, FXMakerLayout.m_fMinimizeClickHeight), this.m_bMinimize, "Mini"); if (GUI.changed) { PlayerPrefs.SetInt("FxmTestControls.m_bMinimize", (!this.m_bMinimize) ? 0 : 1); } GUI.changed = false; Rect childVerticalRect; Rect innerHorizontalRect; if (FXMakerLayout.m_bMinimizeAll || this.m_bMinimize) { count = 1; childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1); if (FxmTestMain.inst.IsCurrentEffectObject()) { text = string.Format("P={0} M={1} T={2}", this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles); str = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", new object[] { this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles, this.m_nVertices }); } GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), text); if (FxmTestMain.inst.IsCurrentEffectObject()) { float rightValue = (3 > this.m_nPlayIndex) ? 10f : this.m_fPlayToolbarTimes[this.m_nPlayIndex]; childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 2), "ElapsedTime " + (Time.time - this.m_fPlayStartTime).ToString("0.000")); innerHorizontalRect = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 4, 4); innerHorizontalRect.y += 5f; GUI.HorizontalSlider(innerHorizontalRect, Time.time - this.m_fPlayStartTime, 0f, rightValue); childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 2), "Restart")) { this.CreateInstanceEffect(); } } return; } childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 2); if (NcEffectBehaviour.GetRootInstanceEffect()) { text = string.Format("P = {0}\nM = {1}\nT = {2}", this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles); str = string.Format("ParticleCount = {0} MeshCount = {1}\n Mesh: Triangles = {2} Vertices = {3}", new object[] { this.m_nParticleCount, this.m_nMeshCount, this.m_nTriangles, this.m_nVertices }); } GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 1), new GUIContent(text, this.NgTooltipTooltip(str))); if (FxmTestMain.inst.IsCurrentEffectObject()) { bool flag = false; GUIContent[] hcEffectControls_Play = FxmTestControls.GetHcEffectControls_Play(0f, this.m_fTimeScale, this.m_fPlayToolbarTimes[1], this.m_fPlayToolbarTimes[3], this.m_fPlayToolbarTimes[4], this.m_fPlayToolbarTimes[5], this.m_fPlayToolbarTimes[6], this.m_fPlayToolbarTimes[7]); childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 0, 1); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 1, 1), new GUIContent("Play", string.Empty)); int nPlayIndex = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 8), this.m_nPlayIndex, hcEffectControls_Play, hcEffectControls_Play.Length); if (GUI.changed) { flag = true; } GUIContent[] hcEffectControls_Trans = FxmTestControls.GetHcEffectControls_Trans(this.m_nTransAxis); childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 1, 1); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 1, 1), new GUIContent("Trans", string.Empty)); int num2 = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 8), this.m_nTransIndex, hcEffectControls_Trans, hcEffectControls_Trans.Length); if (GUI.changed) { flag = true; if ((num2 == 1 || num2 == 2) && Input.GetMouseButtonUp(1)) { if (this.m_nTransAxis == FxmTestControls.AXIS.Z) { this.m_nTransAxis = FxmTestControls.AXIS.X; } else { this.m_nTransAxis++; } PlayerPrefs.SetInt("FxmTestControls.m_nTransAxis", (int)this.m_nTransAxis); } } if (flag) { FxmTestMain.inst.CreateCurrentInstanceEffect(false); this.RunActionControl(nPlayIndex, num2); PlayerPrefs.SetInt("FxmTestControls.m_nPlayIndex", this.m_nPlayIndex); PlayerPrefs.SetInt("FxmTestControls.m_nTransIndex", this.m_nTransIndex); } } float num3 = this.m_fDistPerTime; childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 2, 1); GUIContent gUIContent = new GUIContent("DistPerTime", string.Empty); GUIContent expr_471 = gUIContent; expr_471.text = expr_471.text + " " + this.m_fDistPerTime.ToString("00.00"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent); innerHorizontalRect = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5); innerHorizontalRect.y += 5f; num3 = GUI.HorizontalSlider(innerHorizontalRect, num3, 0.1f, 40f); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 14, 1), new GUIContent("<", string.Empty))) { num3 = (float)((int)(num3 - 1f)); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 15, 1), new GUIContent(">", string.Empty))) { num3 = (float)((int)(num3 + 1f)); } if (num3 != this.m_fDistPerTime) { this.m_fDistPerTime = ((num3 != 0f) ? num3 : 0.1f); PlayerPrefs.SetFloat("FxmTestControls.m_fDistPerTime", this.m_fDistPerTime); if (0 < this.m_nTransIndex) { this.CreateInstanceEffect(); } } if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 9, 1), new GUIContent("Multi", this.m_nMultiShotCount.ToString()), true)) { if (Input.GetMouseButtonUp(0)) { this.m_nMultiShotCount++; if (4 < this.m_nMultiShotCount) { this.m_nMultiShotCount = 1; } } else { this.m_nMultiShotCount = 1; } this.CreateInstanceEffect(); } GUIContent[] hcEffectControls_Rotate = FxmTestControls.GetHcEffectControls_Rotate(); childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 2, 1); int num4 = GUI.SelectionGrid(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 1), this.m_nRotateIndex, hcEffectControls_Rotate, hcEffectControls_Rotate.Length); if (num4 != this.m_nRotateIndex) { this.m_nRotateIndex = num4; PlayerPrefs.SetInt("FxmTestControls.m_nRotateIndex", this.m_nRotateIndex); if (0 < this.m_nTransIndex) { this.CreateInstanceEffect(); } } float num5 = this.m_fTimeScale; childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 3, 1); gUIContent = new GUIContent("TimeScale", string.Empty); GUIContent expr_681 = gUIContent; expr_681.text = expr_681.text + " " + this.m_fTimeScale.ToString("0.00"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent); innerHorizontalRect = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5); innerHorizontalRect.y += 5f; num5 = GUI.HorizontalSlider(innerHorizontalRect, num5, 0f, 3f); if (num5 == 0f) { if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 7, 1), new GUIContent("Resume", string.Empty))) { num5 = this.m_fOldTimeScale; } } else if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 7, 1), new GUIContent("Pause", string.Empty))) { num5 = 0f; } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 8, 1), new GUIContent("Reset", string.Empty))) { num5 = 1f; } this.SetTimeScale(num5); if (FxmTestMain.inst.IsCurrentEffectObject()) { float rightValue2 = (3 > this.m_nPlayIndex) ? 10f : this.m_fPlayToolbarTimes[this.m_nPlayIndex]; childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 4, 1); gUIContent = new GUIContent("ElapsedTime", string.Empty); GUIContent expr_7D4 = gUIContent; expr_7D4.text = expr_7D4.text + " " + (Time.time - this.m_fPlayStartTime).ToString("0.000"); GUI.Box(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 0, 2), gUIContent); innerHorizontalRect = FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 2, 5); innerHorizontalRect.y += 5f; GUI.HorizontalSlider(innerHorizontalRect, Time.time - this.m_fPlayStartTime, 0f, rightValue2); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 14, 1), new GUIContent("+.5", string.Empty))) { this.SetTimeScale(1f); base.Invoke("invokeStopTimer", 0.5f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 15, 1), new GUIContent("+.1", string.Empty))) { this.SetTimeScale(0.4f); base.Invoke("invokeStopTimer", 0.1f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 16, 1), new GUIContent("+.05", string.Empty))) { this.SetTimeScale(0.2f); base.Invoke("invokeStopTimer", 0.05f); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num * 2, 17, 1), new GUIContent("+.01", string.Empty))) { this.SetTimeScale(0.04f); base.Invoke("invokeStopTimer", 0.01f); } childVerticalRect = FXMakerLayout.GetChildVerticalRect(actionToolbarRect, 0, count, 3, 2); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(childVerticalRect, num, 9, 1), new GUIContent("Restart", string.Empty))) { this.CreateInstanceEffect(); } } }
// ========================================================================================================== void winResourceList(int id) { GUIStyle labelStyle = GUI.skin.GetStyle("BackMain_NotSelected"); int nWinIndex = id - FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.RESOURCE_START); int nBackIndex = nWinIndex - m_CloneTypeCount; bool bCloneType = nWinIndex < m_CloneTypeCount; GameObject settingObj = (m_CurrentBackgroundInfo != null) ? m_CurrentBackgroundInfo.GetChildObject(nWinIndex) : null; // 현재 선택된 prefab if (settingObj != null) { GUIContent econ = new GUIContent(); econ.image = FXMakerMain.inst.GetPrefabThumbTexture(m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex)); econ.text = settingObj.name; econ.tooltip = bCloneType ? FXMakerTooltip.GetHsToolBackground("RES_CLONE_HOVER", settingObj.name) : FXMakerTooltip.GetHsToolBackground("RES_REFERENCE_HOVER", settingObj.name); // Current Selected if (settingObj != null && GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, FXMakerLayout.m_fScrollButtonHeight), econ)) { m_CurrentBackgroundInfo.SetPingObject(nWinIndex); } // Clear Selected if (GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25), FXMakerTooltip.GetHcToolBackground("Clear Selected", settingObj.name))) { settingObj = null; if (bCloneType) { m_CurrentBackgroundInfo.SetCloneObject(nWinIndex, null); } else { m_CurrentBackgroundInfo.SetReferenceObject(nBackIndex, null); } // SaveBackgroundPrefab(); } // Thumb Selected if (bCloneType && m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex) != "" && GUI.Button(new Rect(FXMakerLayout.m_rectInnerMargin.x, 48 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25), FXMakerTooltip.GetHcToolBackground("Create Thumb", settingObj.name))) { FXMakerCapture.StartSaveBackThumb(m_CurrentBackgroundInfo.GetClildThumbFilename(nWinIndex)); return; } } else { if (bCloneType) { string strDir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDRESOURCES), m_ResourceSubDir[nWinIndex]); GUI.Box(new Rect(FXMakerLayout.m_rectInnerMargin.x, 20, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, FXMakerLayout.m_fScrollButtonHeight), FXMakerTooltip.GetHcToolBackground("[Not Selected]", strDir), labelStyle); // list ---------------------------- int nNodeCount = m_ClonePrefabs[nWinIndex].Length; Rect listRect = FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetResListRect(nWinIndex), 160, 1, 0, 1); Rect scrollRect = FXMakerLayout.GetScrollViewRect((int)listRect.width, nNodeCount, 1); Rect gridRect = FXMakerLayout.GetScrollGridRect((int)listRect.width, nNodeCount, 1); m_CloneWindowScrollPos[nWinIndex] = GUI.BeginScrollView(listRect, m_CloneWindowScrollPos[nWinIndex], scrollRect); // m_nResourceSelIndex[nWinIndex] = GUI.SelectionGrid(gNcLayout.GetChildVerticalRect(gNcLayout.GetResListRect(nWinIndex), 80, 1, 0, 1), m_nResourceSelIndex[nWinIndex], m_strResourceList[nWinIndex], 1); // m_nClonePrefabSelIndex[nWinIndex] = GUI.SelectionGrid(gridRect, m_nClonePrefabSelIndex[nWinIndex], m_CloneContents[nWinIndex], 1); m_nClonePrefabSelIndex[nWinIndex] = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(FXMakerLayout.GetResListRect(nWinIndex), 0, -m_CloneWindowScrollPos[nWinIndex].y), listRect, gridRect, m_nClonePrefabSelIndex[nWinIndex], m_CloneContents[nWinIndex], 1); if (GUI.changed) { NgUtil.LogDevelop("changed m_nResourceSelIndex - nWinIndex = " + nWinIndex + ", value = " + m_nClonePrefabSelIndex[nWinIndex]); GameObject selPrefab = m_ClonePrefabs[nWinIndex][m_nClonePrefabSelIndex[nWinIndex]]; m_CurrentBackgroundInfo.SetCloneObject(nWinIndex, selPrefab); // SaveBackgroundPrefab(); } GUI.EndScrollView(); } } // select prefab if (bCloneType == false) { Rect subRect = new Rect(FXMakerLayout.m_rectInnerMargin.x, 48 + FXMakerLayout.m_fScrollButtonHeight + 3, FXMakerLayout.GetFixedWindowWidth() - FXMakerLayout.m_rectInnerMargin.x * 2, 25); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(subRect, 2, 0, 1), FXMakerTooltip.GetHcToolBackground("Select", ""))) { FxmPopupManager.inst.ShowSelectPrefabPopup(m_CurrentBackgroundInfo, false, nBackIndex); // SaveBackgroundPrefab(); } if (NgLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(subRect, 2, 1, 1), FXMakerTooltip.GetHcToolBackground("Open", ""), m_CurrentBackgroundInfo.GetReferenceObject(nBackIndex) != null)) { FXMakerEffect.inst.LoadProject(AssetDatabase.GetAssetPath(m_CurrentBackgroundInfo.GetReferenceObject(nBackIndex))); FXMakerMain.inst.SetActiveTool(1); // SaveBackgroundPrefab(); } } FXMakerMain.inst.SaveTooltip(); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_ParticlePrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_ParticlePrefab"), m_Sel.m_ParticlePrefab, typeof(GameObject), false, null); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 0, 2), GetHelpContent("SelectParticlePrefab"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 2, 1), GetHelpContent("ClearPrefab"), (m_Sel.m_ParticlePrefab != null))) { bClickButton = true; m_Sel.m_ParticlePrefab = null; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 4, 3, 1), GetHelpContent("OpenPrefab"), (m_FxmPopupManager != null) && (m_Sel.m_ParticlePrefab != null))) { bClickButton = true; GetFXMakerMain().OpenPrefab(m_Sel.m_ParticlePrefab); return; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); // -------------------------------------------------------------- m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); m_Sel.m_nNumberOfArms = EditorGUILayout.IntField(GetHelpContent("m_nNumberOfArms"), m_Sel.m_nNumberOfArms); m_Sel.m_nParticlesPerArm = EditorGUILayout.IntField(GetHelpContent("m_nParticlesPerArm"), m_Sel.m_nParticlesPerArm); m_Sel.m_fParticleSeparation = EditorGUILayout.FloatField(GetHelpContent("m_fParticleSeparation"), m_Sel.m_fParticleSeparation); m_Sel.m_fTurnDistance = EditorGUILayout.FloatField(GetHelpContent("m_fTurnDistance"), m_Sel.m_fTurnDistance); m_Sel.m_fVerticalTurnDistance = EditorGUILayout.FloatField(GetHelpContent("m_fVerticalTurnDistance"), m_Sel.m_fVerticalTurnDistance); m_Sel.m_fOriginOffset = EditorGUILayout.FloatField(GetHelpContent("m_fOriginOffset"), m_Sel.m_fOriginOffset); m_Sel.m_fTurnSpeed = EditorGUILayout.FloatField(GetHelpContent("m_fTurnSpeed"), m_Sel.m_fTurnSpeed); m_Sel.m_fFadeValue = EditorGUILayout.FloatField(GetHelpContent("m_fFadeValue"), m_Sel.m_fFadeValue); m_Sel.m_fSizeValue = EditorGUILayout.FloatField(GetHelpContent("m_fSizeValue"), m_Sel.m_fSizeValue); m_Sel.m_nNumberOfSpawns = EditorGUILayout.IntField(GetHelpContent("m_nNumberOfSpawns"), m_Sel.m_nNumberOfSpawns); m_Sel.m_fSpawnRate = EditorGUILayout.FloatField(GetHelpContent("m_fSpawnRate"), m_Sel.m_fSpawnRate); Rect butRect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 2)); { if (FXMakerLayout.GUIButton(butRect, GetHelpContent("Randomize"), true)) { m_Sel.RandomizeEditor(); bClickButton = true; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMinValue(ref m_Sel.m_nNumberOfArms, 1); SetMinValue(ref m_Sel.m_nParticlesPerArm, 1); SetMinValue(ref m_Sel.m_fFadeValue, -1); SetMaxValue(ref m_Sel.m_fFadeValue, 1); SetMinValue(ref m_Sel.m_nNumberOfSpawns, 1); SetMinValue(ref m_Sel.m_fSpawnRate, 0.1f); } m_UndoManager.CheckDirty(); // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
// ========================================================================================================== 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))) { UndoObject(); } // 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); Rect rect; int nLeftWidth = 115; int nAddHeight = 22; int nDelHeight = 17; int nLineHeight = 19; int nCurveHeight = 50; List <NcCurveAnimation.NcInfoCurve> curveInfoList = m_Sel.m_CurveInfoList; m_FxmPopupManager = GetFxmPopupManager(); // test code // if (GUILayout.Button("Pause")) // FxmInfoIndexing.FindInstanceIndexing(m_Sel.transform, false).GetComponent<NcCurveAnimation>().PauseAnimation(); // if (GUILayout.Button("Resume")) // FxmInfoIndexing.FindInstanceIndexing(m_Sel.transform, false).GetComponent<NcCurveAnimation>().ResumeAnimation(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { m_UndoManager.CheckUndo(); // -------------------------------------------------------------- m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); EditorGUILayout.Space(); m_Sel.m_fDelayTime = EditorGUILayout.FloatField(GetHelpContent("m_fDelayTime"), m_Sel.m_fDelayTime); m_Sel.m_fDurationTime = EditorGUILayout.FloatField(GetHelpContent("m_fDurationTime"), m_Sel.m_fDurationTime); m_Sel.m_bAutoDestruct = EditorGUILayout.Toggle(GetHelpContent("m_bAutoDestruct"), m_Sel.m_bAutoDestruct); // check SetMinValue(ref m_Sel.m_fDelayTime, 0); SetMinValue(ref m_Sel.m_fDurationTime, 0.01f); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nAddHeight * 3)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 1), GetHelpContent("Clear All"), (0 < m_Sel.GetCurveInfoCount()))) { bClickButton = true; m_Sel.ClearAllCurveInfo(); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1), 2, 0, 1), GetHelpContent("Load Curves"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowNcCurveAnimationPopup(m_Sel, false); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1), 2, 1, 1), GetHelpContent("Save Curves"), (m_FxmPopupManager != null && 0 < m_Sel.GetCurveInfoCount()))) { m_FxmPopupManager.ShowNcCurveAnimationPopup(m_Sel, true); } if (GUI.Button(FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1), GetHelpContent("Add EmptyCurve"))) { bClickButton = true; m_Sel.AddCurveInfo(); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); m_UndoManager.CheckDirty(); // -------------------------------------------------------------- for (int n = 0; n < (curveInfoList != null ? curveInfoList.Count : 0); n++) { EditorGUILayout.Space(); // Enabled -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nDelHeight)); { GUI.Box(rect, ""); curveInfoList[n].m_bEnabled = GUILayout.Toggle(curveInfoList[n].m_bEnabled, "CurveInfo " + n.ToString(), GUILayout.Width(nLeftWidth)); // GUILayout.Label("CurveInfo Index " + n.ToString(), GUILayout.Width(nLeftWidth)); } EditorGUILayout.EndHorizontal(); // CurveName ----------------------------------------------------------- curveInfoList[n].m_CurveName = EditorGUILayout.TextField(GetHelpContent("m_CurveName"), curveInfoList[n].m_CurveName); // ApplyType -------------------------------------------------------------- EditorGUI.BeginChangeCheck(); { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUI.Box(rect, ""); GUILayout.Label("", GUILayout.Width(nLeftWidth)); NcCurveAnimation.NcInfoCurve.APPLY_TYPE nApplyType = (NcCurveAnimation.NcInfoCurve.APPLY_TYPE)EditorGUI.Popup(new Rect(rect.x, rect.y, nLeftWidth, rect.height), (int)curveInfoList[n].m_ApplyType, NcCurveAnimation.NcInfoCurve.m_TypeName); if (curveInfoList[n].m_ApplyType != nApplyType) { curveInfoList[n].m_ApplyType = nApplyType; curveInfoList[n].SetDefaultValueScale(); } // Add Component bool bShowOption = true; if (curveInfoList[n].m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.TEXTUREUV) { if (m_Sel.gameObject.GetComponent <NcUvAnimation>() == null) { bShowOption = false; FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox); if (GUI.Button(new Rect(rect.x + nLeftWidth, rect.y, rect.width - nLeftWidth, rect.height), GetHelpContent("Add NcUvAnimation Script"))) { m_Sel.gameObject.AddComponent <NcUvAnimation>(); } FXMakerLayout.GUIColorRestore(); } } if (bShowOption) { for (int nValueIndex = 0; nValueIndex < curveInfoList[n].GetValueCount(); nValueIndex++) { curveInfoList[n].m_bApplyOption[nValueIndex] = GUILayout.Toggle(curveInfoList[n].m_bApplyOption[nValueIndex], curveInfoList[n].GetValueName(nValueIndex)); } } if (curveInfoList[n].m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE) { GUILayout.Label("LocalSpace"); } } EditorGUILayout.EndHorizontal(); } if (EditorGUI.EndChangeCheck()) { m_Sel.CheckInvalidOption(n); } if (curveInfoList[n].m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MATERIAL_COLOR) { // ValueScale -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight * 2)); { GUI.Box(rect, ""); GUILayout.Label("", GUILayout.Width(nLeftWidth)); bool bEnableColor = (m_Sel.renderer != null && m_Sel.renderer.sharedMaterial != null & NgMaterial.IsMaterialColor(m_Sel.renderer.sharedMaterial)); Rect colorRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 0, 1); colorRect.width = nLeftWidth; if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 0, 1), GetHelpContent("White"), bEnableColor)) { curveInfoList[n].m_ToColor = Color.white; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 1, 1), GetHelpContent("Current"), bEnableColor)) { curveInfoList[n].m_ToColor = NgMaterial.GetMaterialColor(m_Sel.renderer.sharedMaterial); } colorRect.x += colorRect.width; GUI.Label(colorRect, GetHelpContent("ToColor")); colorRect.x += 60; colorRect.width = rect.width - colorRect.x; curveInfoList[n].m_ToColor = EditorGUI.ColorField(colorRect, curveInfoList[n].m_ToColor); // m_bRecursively Rect recRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 1, 1); curveInfoList[n].m_bRecursively = GUI.Toggle(FXMakerLayout.GetRightRect(recRect, rect.width - nLeftWidth), curveInfoList[n].m_bRecursively, GetHelpContent("Recursively")); } EditorGUILayout.EndHorizontal(); } else if (curveInfoList[n].m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.MESH_COLOR) { // ValueScale -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight * 3)); { GUI.Box(rect, ""); GUILayout.Label("", GUILayout.Width(nLeftWidth)); // bool bEnableColor = (m_Sel.renderer != null && m_Sel.renderer.sharedMaterial != null & NgMaterial.IsMaterialColor(m_Sel.renderer.sharedMaterial)); // From Color Rect colorRect = FXMakerLayout.GetInnerVerticalRect(rect, 3, 0, 1); colorRect.width = nLeftWidth; if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 0, 1), GetHelpContent("White"), true)) { curveInfoList[n].m_FromColor = Color.white; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 1, 1), GetHelpContent("Black"), true)) { curveInfoList[n].m_FromColor = Color.black; } colorRect.x += colorRect.width; GUI.Label(colorRect, GetHelpContent("FromColor")); colorRect.x += 60; colorRect.width = rect.width - colorRect.x; curveInfoList[n].m_FromColor = EditorGUI.ColorField(colorRect, curveInfoList[n].m_FromColor); // To Color colorRect = FXMakerLayout.GetInnerVerticalRect(rect, 3, 1, 1); colorRect.width = nLeftWidth; if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 0, 1), GetHelpContent("White"), true)) { curveInfoList[n].m_ToColor = Color.white; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(colorRect, 2, 1, 1), GetHelpContent("Black"), true)) { curveInfoList[n].m_ToColor = Color.black; } colorRect.x += colorRect.width; GUI.Label(colorRect, GetHelpContent("ToColor")); colorRect.x += 60; colorRect.width = rect.width - colorRect.x; curveInfoList[n].m_ToColor = EditorGUI.ColorField(colorRect, curveInfoList[n].m_ToColor); // m_bRecursively Rect recRect = FXMakerLayout.GetInnerVerticalRect(rect, 3, 2, 1); curveInfoList[n].m_bRecursively = GUI.Toggle(FXMakerLayout.GetRightRect(recRect, rect.width - nLeftWidth), curveInfoList[n].m_bRecursively, GetHelpContent("Recursively")); } EditorGUILayout.EndHorizontal(); } else { // ValueScale -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { GUI.Box(rect, ""); GUILayout.Label("", GUILayout.Width(nLeftWidth)); if (curveInfoList[n].m_ApplyType == NcCurveAnimation.NcInfoCurve.APPLY_TYPE.SCALE) { curveInfoList[n].m_fValueScale = EditorGUI.FloatField(rect, GetHelpContent("Value Scale"), curveInfoList[n].m_fValueScale + 1) - 1; } else { curveInfoList[n].m_fValueScale = EditorGUI.FloatField(rect, GetHelpContent("Value Scale"), curveInfoList[n].m_fValueScale); } } EditorGUILayout.EndHorizontal(); } // Curve -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nCurveHeight)); { GUI.Box(rect, ""); GUILayout.Label("", GUILayout.Width(nLeftWidth)); EditorGUI.BeginChangeCheck(); { curveInfoList[n].m_AniCurve = EditorGUI.CurveField(FXMakerLayout.GetOffsetRect(rect, nLeftWidth + 4, 0, 0, -4), curveInfoList[n].m_AniCurve, Color.green, curveInfoList[n].GetEditRange()); // curveInfoList[n].m_AniCurve = EditorGUILayout.CurveField(" ", curveInfoList[n].m_AniCurve, Color.green, curveInfoList[n].GetEditRange(), GUILayout.Height(nCurveHeight-4)); // curveInfoList[n].m_AniCurve = EditorGUILayout.CurveField(" ", curveInfoList[n].m_AniCurve, GUILayout.Height(nCurveHeight-4)); } if (EditorGUI.EndChangeCheck()) { curveInfoList[n].NormalizeCurveTime(); } if (m_FxmPopupManager != null) { Rect buttonRect = rect; buttonRect.width = nLeftWidth; FXMakerLayout.GetOffsetRect(rect, 0, 5, 0, -5); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetInnerVerticalRect(buttonRect, 2, 0, 1), 2, 0, 1), GetHelpContent("Change"))) { m_FxmPopupManager.ShowNcInfoCurvePopup(m_Sel, n, false); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetInnerVerticalRect(buttonRect, 2, 0, 1), 2, 1, 1), GetHelpContent("Save"))) { m_FxmPopupManager.ShowNcInfoCurvePopup(m_Sel, n, true); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetInnerVerticalRect(buttonRect, 2, 1, 1), 2, 0, 2), GetHelpContent("Delete"))) { bClickButton = true; m_Sel.DeleteCurveInfo(n); } } } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); } } // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_NcSpriteFactoryPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_NcSpriteFactoryPrefab"), m_Sel.m_NcSpriteFactoryPrefab, typeof(GameObject), false, null); // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 0, 1), GetHelpContent("Select SpriteFactory"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 1, 1), GetHelpContent("Clear SpriteFactory"), (m_Sel.m_NcSpriteFactoryPrefab != null))) { bClickButton = true; m_Sel.m_NcSpriteFactoryPrefab = null; } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 2, 1), GetHelpContent("Open Prefab"), (m_FxmPopupManager != null) && (m_Sel.m_NcSpriteFactoryPrefab != null))) { bClickButton = true; GetFXMakerMain().OpenPrefab(m_Sel.m_NcSpriteFactoryPrefab); return; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorGUILayout.Space(); // -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(rect, GetHelpContent("Update from FactoryPrefab"), (m_Sel.m_NcSpriteFactoryPrefab != null))) { m_Sel.SetSpriteFactoryIndex(m_Sel.m_nSpriteFactoryIndex, m_Sel.m_nFrameIndex, false); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); NcSpriteFactory ncSpriteFactory = (m_Sel.m_NcSpriteFactoryPrefab == null ? null : m_Sel.m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory>()); if (ncSpriteFactory != null) { int nSelIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nSpriteFactoryIndex"), m_Sel.m_nSpriteFactoryIndex, 0, ncSpriteFactory.GetSpriteNodeCount() - 1); if (m_Sel.m_nSpriteFactoryIndex != nSelIndex) { m_Sel.SetSpriteFactoryIndex(nSelIndex, m_Sel.m_nFrameIndex, false); } nSelIndex = EditorGUILayout.IntField(GetHelpContent("m_nFrameIndex"), m_Sel.m_nFrameIndex); if (m_Sel.m_nFrameIndex != nSelIndex) { m_Sel.SetFrameIndex(nSelIndex); } } // -------------------------------------------------------------- if (m_Sel.m_NcSpriteFactoryPrefab != null && m_Sel.m_NcSpriteFactoryPrefab.GetComponent <Renderer>() != null && m_Sel.GetComponent <Renderer>()) { if (m_Sel.m_NcSpriteFactoryPrefab.GetComponent <Renderer>().sharedMaterial != m_Sel.GetComponent <Renderer>().sharedMaterial) { m_Sel.UpdateSpriteMaterial(); } } // -------------------------------------------------------------- m_Sel.m_MeshType = (NcSpriteFactory.MESH_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_MeshType"), m_Sel.m_MeshType); m_Sel.m_AlignType = (NcSpriteFactory.ALIGN_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_AlignType"), m_Sel.m_AlignType); if (m_Sel.m_AlignType == NcSpriteFactory.ALIGN_TYPE.LEFTCENTER) { m_Sel.m_fShowRate = EditorGUILayout.FloatField(GetHelpContent("m_fShowRate"), m_Sel.m_fShowRate); } SetMaxValue(ref m_Sel.m_fShowRate, 1.0f); SetMinValue(ref m_Sel.m_fShowRate, 0); // -------------------------------------------------------------- if (ncSpriteFactory != null && ncSpriteFactory.IsValidFactory()) { // Texture -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(GetDrawTextureHeight(m_Sel.GetComponent <Renderer>()))); { GUI.Box(rect, ""); GUILayout.Label(""); Rect subRect = rect; // draw texture if (0 < rect.width && m_Sel.GetComponent <Renderer>() != null && m_Sel.GetComponent <Renderer>().sharedMaterial != null && m_Sel.GetComponent <Renderer>().sharedMaterial.mainTexture != null) { int nClickFactoryIndex; int nClickFrameIndex; bClickButton = DrawTrimTexture(subRect, true, m_Sel.GetComponent <Renderer>().sharedMaterial, ncSpriteFactory, m_Sel.m_nSpriteFactoryIndex, m_Sel.m_nFrameIndex, true, out nClickFactoryIndex, out nClickFrameIndex); if (bClickButton) { m_Sel.SetSpriteFactoryIndex(nClickFactoryIndex, nClickFrameIndex, false); } } } EditorGUILayout.EndHorizontal(); } else { m_Sel.m_nSpriteFactoryIndex = -1; } } m_UndoManager.CheckDirty(); // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { OnEditComponent(); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
// ========================================================================================================== 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 { // image if (m_SelObjectContent == null) { guiCon = new GUIContent("[Not Selected]"); } else { guiCon = new GUIContent("", m_SelObjectContent.image, m_SelObjectContent.tooltip); } if (FXMakerLayout.GUIButton(imageRect, guiCon, GUI.skin.GetStyle("PopupBottom_ImageButton"), (m_SelObjectContent != null))) { if (Input.GetMouseButtonUp(0)) { FXMakerAsset.SetPingObject(m_CurrentCurveAnimation); FXMakerMain.inst.CreateCurrentInstanceEffect(true); } if (Input.GetMouseButtonUp(1)) { FXMakerAsset.SetPingObject(m_CurveAniObjects[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)) { SaveCurveAniToPrefabFile(); 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_SelCurveAniObject != null))) { UndoCurveAni(); m_nObjectIndex = -1; m_nSelObjectGroupIndex = -1; m_nSelObjectProjectIndex = -1; m_SelObjectContent = null; m_SelCurveAniObject = null; FXMakerMain.inst.CreateCurrentInstanceEffect(true); } // close buttonRect.x += buttonRect.width + 5; buttonRect.width = baseRect.width - buttonRect.x; if (GUI.Button(buttonRect, GetHelpContent("Close"))) { ClosePopup(true); } } }
// ------------------------------------------------------------------------------------------- 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); int nPlayIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, 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); int nTransIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, 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); int nRotateIndex = FXMakerLayout.TooltipSelectionGrid(popupRect, 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(); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); int nClickIndex = -1; int nClickButton = 0; Rect rect; int nLeftWidth = 35; int nAddHeight = 30; int nDelWidth = 35; int nLineHeight = 18; int nSpriteHeight = nLeftWidth; List <NcSpriteFactory.NcSpriteNode> spriteList = m_Sel.m_SpriteList; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { m_UndoManager.CheckUndo(); // -------------------------------------------------------------- m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); EditorGUILayout.Space(); m_Sel.m_SpriteType = (NcSpriteFactory.SPRITE_TYPE)EditorGUILayout.EnumPopup(GetHelpContent("m_SpriteType"), m_Sel.m_SpriteType); // -------------------------------------------------------------- if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation && m_Sel.gameObject.GetComponent("NcSpriteAnimation") == null) { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(rect, GetHelpContent("Add NcSpriteAnimation Component"), true)) { m_Sel.gameObject.AddComponent("NcSpriteAnimation"); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); } // -------------------------------------------------------------- if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteTexture && m_Sel.gameObject.GetComponent("NcSpriteTexture") == null) { rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(rect, GetHelpContent("Add NcSpriteTexture Component"), true)) { m_Sel.gameObject.AddComponent("NcSpriteTexture"); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); } EditorGUILayout.Space(); // -------------------------------------------------------------- int nSelIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nCurrentIndex"), m_Sel.m_nCurrentIndex, 0, (spriteList == null ? 0 : spriteList.Count)); if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteTexture) { m_Sel.m_fUvScale = EditorGUILayout.FloatField(GetHelpContent("m_fUvScale"), m_Sel.m_fUvScale); } m_Sel.m_nMaxAtlasTextureSize = EditorGUILayout.IntPopup("nMaxAtlasTextureSize", m_Sel.m_nMaxAtlasTextureSize, NgEnum.m_TextureSizeStrings, NgEnum.m_TextureSizeIntters); // m_Sel.m_AtlasMaterial = (Material)EditorGUILayout.ObjectField(GetHelpContent("m_AtlasMaterial") , m_Sel.m_AtlasMaterial, typeof(Material), false); if (m_Sel.m_nCurrentIndex != nSelIndex) { m_Sel.m_nCurrentIndex = nSelIndex; m_Sel.SetSprite(nSelIndex, false); } // check // Add Button ------------------------------------------------------ EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nAddHeight * 2)); { Rect lineRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 0, 1); if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Add Sprite"))) { bClickButton = true; m_Sel.AddSpriteNode(); } if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("Build Sprite"))) { bClickButton = true; BuildSpriteAtlas(m_Sel.renderer.sharedMaterial); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 2, 1), GetHelpContent("Clear All"), (0 < m_Sel.GetSpriteNodeCount()))) { bClickButton = true; if (m_FxmPopupManager != null) { m_FxmPopupManager.CloseNcPrefabPopup(); } m_Sel.ClearAllSpriteNode(); } lineRect = FXMakerLayout.GetInnerVerticalRect(rect, 2, 1, 1); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 0, 1), GetHelpContent("Sequence"), (0 < m_Sel.GetSpriteNodeCount()))) { m_Sel.m_bSequenceMode = true; bClickButton = true; m_Sel.SetSprite(0, false); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(lineRect, 3, 1, 1), GetHelpContent("NewMaterial"), true)) { Material newMat = new Material(m_Sel.renderer.sharedMaterial); string matPath = AssetDatabase.GetAssetPath(m_Sel.renderer.sharedMaterial); NgMaterial.SaveMaterial(newMat, NgFile.TrimFilenameExt(matPath), m_Sel.name); m_Sel.renderer.sharedMaterial = newMat; // m_Sel.renderer.sharedMaterial = (Material)AssetDatabase.LoadAssetAtPath(savePath, typeof(Material)); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // Select ShotType ------------------------------------------------- // showType = (NcSpriteFactory.SHOW_TYPE)EditorGUILayout.EnumPopup (GetHelpContent("m_ShowType") , showType); // -------------------------------------------------------------- EditorGUILayout.Space(); NcSpriteFactory.SHOW_TYPE showType = (NcSpriteFactory.SHOW_TYPE)EditorPrefs.GetInt("NcSpriteFactory.SHOW_TYPE", 0); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 0, 1), showType == NcSpriteFactory.SHOW_TYPE.NONE, GetHelpContent("NONE"), true) ? NcSpriteFactory.SHOW_TYPE.NONE : showType; showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 1, 1), showType == NcSpriteFactory.SHOW_TYPE.ALL, GetHelpContent("ALL"), true) ? NcSpriteFactory.SHOW_TYPE.ALL : showType; if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation) { showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 2, 1), showType == NcSpriteFactory.SHOW_TYPE.SPRITE, GetHelpContent("SPRITE"), true) ? NcSpriteFactory.SHOW_TYPE.SPRITE : showType; showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 3, 1), showType == NcSpriteFactory.SHOW_TYPE.ANIMATION, GetHelpContent("ANIMATION"), true) ? NcSpriteFactory.SHOW_TYPE.ANIMATION : showType; } showType = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 5, 4, 1), showType == NcSpriteFactory.SHOW_TYPE.EFFECT, GetHelpContent("EFFECT"), true) ? NcSpriteFactory.SHOW_TYPE.EFFECT : showType; GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); EditorPrefs.SetInt("NcSpriteFactory.SHOW_TYPE", ((int)showType)); // Show Option ------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { m_Sel.m_bShowEffect = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 0, 1), m_Sel.m_bShowEffect, GetHelpContent("m_bShowEffect"), true); if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation) { m_Sel.m_bTestMode = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 1, 1), m_Sel.m_bTestMode, GetHelpContent("m_bTestMode"), true); m_Sel.m_bSequenceMode = FXMakerLayout.GUIToggle(FXMakerLayout.GetInnerHorizontalRect(rect, 3, 2, 1), m_Sel.m_bSequenceMode, GetHelpContent("m_bSequenceMode"), true); } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // Node List ------------------------------------------------------ for (int n = 0; n < (spriteList != null ? spriteList.Count : 0); n++) { EditorGUILayout.Space(); EditorGUI.BeginChangeCheck(); // Load Texture --------------------------------------------------------- Texture2D selTexture = null; if (spriteList[n].m_TextureGUID != "") { selTexture = (Texture2D)AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(spriteList[n].m_TextureGUID), typeof(Texture2D)); } // Enabled -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nLineHeight)); { Rect subRect; // enable spriteList[n].m_bIncludedAtlas = GUILayout.Toggle(spriteList[n].m_bIncludedAtlas, "Idx", GUILayout.Width(nLeftWidth)); // change index subRect = rect; subRect.x += nLeftWidth; subRect.width = nLineHeight * 2; int newPos = EditorGUI.IntPopup(subRect, n, NgConvert.GetIntStrings(0, spriteList.Count), NgConvert.GetIntegers(0, spriteList.Count)); if (newPos != n) { NcSpriteFactory.NcSpriteNode node = spriteList[n]; m_Sel.m_SpriteList.Remove(node); m_Sel.m_SpriteList.Insert(newPos, node); return; } // name subRect = rect; subRect.x += nLeftWidth + nLineHeight * 2; subRect.width -= nLeftWidth + nLineHeight * 2; spriteList[n].m_TextureName = selTexture == null ? "" : selTexture.name; GUI.Label(subRect, (selTexture == null ? "" : "(" + spriteList[n].m_nFrameCount + ") " + selTexture.name)); GUI.Box(subRect, ""); GUI.Box(rect, ""); // delete if (GUI.Button(new Rect(subRect.x + subRect.width - nDelWidth, subRect.y, nDelWidth, subRect.height), GetHelpContent("Del"))) { bClickButton = true; if (m_FxmPopupManager != null) { m_FxmPopupManager.CloseNcPrefabPopup(); } m_Sel.DeleteSpriteNode(n); return; } } EditorGUILayout.EndHorizontal(); // MaxAlpha ------------------------------------------------------------- spriteList[n].m_fMaxTextureAlpha = EditorGUILayout.FloatField(GetHelpContent("m_fMaxTextureAlpha"), spriteList[n].m_fMaxTextureAlpha); // Texture -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(nSpriteHeight)); { GUILayout.Label("", GUILayout.Width(nLeftWidth)); Rect subRect = rect; subRect.width = nLeftWidth; FXMakerLayout.GetOffsetRect(rect, 0, 5, 0, -5); EditorGUI.BeginChangeCheck(); selTexture = (Texture2D)EditorGUI.ObjectField(subRect, GetHelpContent(""), selTexture, typeof(Texture2D), false); if (EditorGUI.EndChangeCheck()) { if (selTexture != null) { spriteList[n].m_TextureGUID = AssetDatabase.AssetPathToGUID(AssetDatabase.GetAssetPath(selTexture)); } } if (selTexture != null) { if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation) { spriteList[n].m_nFrameCount = selTexture.width / selTexture.height; spriteList[n].m_nFrameSize = selTexture.height; m_Sel.m_nFrameSize = spriteList[n].m_nFrameSize; } else { spriteList[n].m_nFrameCount = 1; spriteList[n].m_nFrameSize = 1; m_Sel.m_nFrameSize = 1; } } // draw texture subRect = FXMakerLayout.GetOffsetRect(rect, nLeftWidth + 4, 0, 0, -4); if (selTexture != null) { GUI.DrawTexture(FXMakerLayout.GetOffsetRect(subRect, 0, 0, -nDelWidth, 0), selTexture, ScaleMode.ScaleToFit, true, selTexture.width / selTexture.height); } // delete if (GUI.Button(new Rect(subRect.x + subRect.width - nDelWidth, subRect.y, nDelWidth, subRect.height), GetHelpContent("Rmv"))) { spriteList[n].m_TextureGUID = ""; spriteList[n].m_nFrameCount = 0; spriteList[n].m_nFrameSize = 0; } GUI.Box(rect, ""); } EditorGUILayout.EndHorizontal(); // Change selIndex Event e = Event.current; if (e.type == EventType.MouseDown) { if (rect.Contains(e.mousePosition)) { nClickIndex = n; nClickButton = e.button; } } // SpriteNode ---------------------------------------------------------- if (bClickButton == false) { if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation && showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.SPRITE) { spriteList[n].m_bLoop = EditorGUILayout.Toggle(GetHelpContent("m_bLoop"), spriteList[n].m_bLoop); spriteList[n].m_fTime = EditorGUILayout.Slider(GetHelpContent("m_fTime"), spriteList[n].m_nFrameCount / spriteList[n].m_fFps, 0, 5, null); spriteList[n].m_fFps = EditorGUILayout.Slider(GetHelpContent("m_fFps"), spriteList[n].m_nFrameCount / spriteList[n].m_fTime, 50, 1, null); } if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation && showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.ANIMATION) { spriteList[n].m_nNextSpriteIndex = EditorGUILayout.Popup("m_nNextSpriteIndex", spriteList[n].m_nNextSpriteIndex + 1, GetSpriteNodeNames()) - 1; spriteList[n].m_nTestMode = EditorGUILayout.Popup("m_nTestMode", spriteList[n].m_nTestMode, NgConvert.ContentsToStrings(FxmTestControls.GetHcEffectControls_Trans(FxmTestControls.AXIS.Z)), GUILayout.MaxWidth(Screen.width)); spriteList[n].m_fTestSpeed = EditorGUILayout.FloatField("m_fTestSpeed", spriteList[n].m_fTestSpeed); SetMinValue(ref spriteList[n].m_fTestSpeed, 0.01f); SetMinValue(ref spriteList[n].m_fTestSpeed, 0.01f); } if (showType == NcSpriteFactory.SHOW_TYPE.ALL || showType == NcSpriteFactory.SHOW_TYPE.EFFECT) { // char effect ------------------------------------------------------------- spriteList[n].m_EffectPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_EffectPrefab"), spriteList[n].m_EffectPrefab, typeof(GameObject), false, null); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 0.7f)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("SelEffect"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, n, 0, true); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("ClearEffect"), (spriteList[n].m_EffectPrefab != null))) { bClickButton = true; spriteList[n].m_EffectPrefab = null; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); if (spriteList[n].m_EffectPrefab != null) { if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation) { spriteList[n].m_nEffectFrame = EditorGUILayout.IntSlider(GetHelpContent("m_nEffectFrame"), spriteList[n].m_nEffectFrame, 0, spriteList[n].m_nFrameCount, null); spriteList[n].m_bEffectOnlyFirst = EditorGUILayout.Toggle(GetHelpContent("m_bEffectOnlyFirst"), spriteList[n].m_bEffectOnlyFirst); } spriteList[n].m_fEffectSpeed = EditorGUILayout.FloatField("m_fEffectSpeed", spriteList[n].m_fEffectSpeed); spriteList[n].m_fEffectScale = EditorGUILayout.FloatField("m_fEffectScale", spriteList[n].m_fEffectScale); spriteList[n].m_EffectPos = EditorGUILayout.Vector3Field("m_EffectPos", spriteList[n].m_EffectPos, null); spriteList[n].m_EffectRot = EditorGUILayout.Vector3Field("m_EffectRot", spriteList[n].m_EffectRot, null); SetMinValue(ref spriteList[n].m_fEffectScale, 0.001f); } EditorGUILayout.Space(); // char sound ------------------------------------------------------------- spriteList[n].m_AudioClip = (AudioClip)EditorGUILayout.ObjectField(GetHelpContent("m_AudioClip"), spriteList[n].m_AudioClip, typeof(AudioClip), false, null); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight * 0.7f)); { // if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("SelAudio"), (m_FxmPopupManager != null))) // m_FxmPopupManager.ShowSelectAudioClipPopup(m_Sel); if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("ClearAudio"), (spriteList[n].m_AudioClip != null))) { bClickButton = true; spriteList[n].m_AudioClip = null; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); if (spriteList[n].m_AudioClip != null) { if (m_Sel.m_SpriteType == NcSpriteFactory.SPRITE_TYPE.NcSpriteAnimation) { spriteList[n].m_nSoundFrame = EditorGUILayout.IntSlider(GetHelpContent("m_nSoundFrame"), spriteList[n].m_nSoundFrame, 0, spriteList[n].m_nFrameCount, null); spriteList[n].m_bSoundOnlyFirst = EditorGUILayout.Toggle(GetHelpContent("m_bSoundOnlyFirst"), spriteList[n].m_bSoundOnlyFirst); } spriteList[n].m_bSoundLoop = EditorGUILayout.Toggle(GetHelpContent("m_bSoundLoop"), spriteList[n].m_bSoundLoop); spriteList[n].m_fSoundVolume = EditorGUILayout.Slider(GetHelpContent("m_fSoundVolume"), spriteList[n].m_fSoundVolume, 0, 1.0f, null); spriteList[n].m_fSoundPitch = EditorGUILayout.Slider(GetHelpContent("m_fSoundPitch"), spriteList[n].m_fSoundPitch, -3, 3.0f, null); } } } if (EditorGUI.EndChangeCheck()) { nClickIndex = n; } selTexture = null; } // Select Node ---------------------------------------------------- if (0 <= nClickIndex) { m_Sel.SetSprite(nClickIndex, false); if (m_Sel.m_bTestMode && 0 <= spriteList[nClickIndex].m_nTestMode && GetFXMakerMain()) { GetFXMakerMain().GetFXMakerControls().SetTransIndex(spriteList[nClickIndex].m_nTestMode, (4 <= spriteList[nClickIndex].m_nTestMode ? 1.8f : 1.0f), spriteList[nClickIndex].m_fTestSpeed); } // Rotate if (nClickButton == 1) { m_Sel.transform.Rotate(0, 180, 0); } nClickIndex = -1; bClickButton = true; } m_UndoManager.CheckDirty(); } // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { GetFXMakerMain().CreateCurrentInstanceEffect(true); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }
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); 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); }
public override void OnInspectorGUI() { AddScriptNameField(m_Sel); m_UndoManager.CheckUndo(); Rect rect; m_FxmPopupManager = GetFxmPopupManager(); // -------------------------------------------------------------- bool bClickButton = false; EditorGUI.BeginChangeCheck(); { // DrawDefaultInspector(); m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag); m_Sel.m_NcSpriteFactoryPrefab = (GameObject)EditorGUILayout.ObjectField(GetHelpContent("m_NcSpriteFactoryPrefab"), m_Sel.m_NcSpriteFactoryPrefab, typeof(GameObject), false, null); NcSpriteFactory ncSpriteFactory = (m_Sel.m_NcSpriteFactoryPrefab == null ? null : m_Sel.m_NcSpriteFactoryPrefab.GetComponent <NcSpriteFactory>()); if (ncSpriteFactory != null) { int nSelIndex = EditorGUILayout.IntSlider(GetHelpContent("m_nSpriteFactoryIndex"), m_Sel.m_nSpriteFactoryIndex, 0, ncSpriteFactory.GetSpriteNodeCount() - 1); if (m_Sel.m_nSpriteFactoryIndex != nSelIndex) { m_Sel.m_nSpriteFactoryIndex = nSelIndex; ncSpriteFactory.m_nCurrentIndex = nSelIndex; } } // -------------------------------------------------------------- if (m_Sel.m_NcSpriteFactoryPrefab != null && m_Sel.m_NcSpriteFactoryPrefab.renderer != null && m_Sel.renderer) { if (m_Sel.m_NcSpriteFactoryPrefab.renderer.sharedMaterial != m_Sel.renderer.sharedMaterial) { m_Sel.UpdateSpriteMaterial(); } } // -------------------------------------------------------------- EditorGUILayout.Space(); rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight)); { if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 0, 1), GetHelpContent("Select SpriteFactory"), (m_FxmPopupManager != null))) { m_FxmPopupManager.ShowSelectPrefabPopup(m_Sel, true, 0); } if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(rect, 2, 1, 1), GetHelpContent("Clear SpriteFactory"), (m_Sel.m_NcSpriteFactoryPrefab != null))) { bClickButton = true; m_Sel.m_NcSpriteFactoryPrefab = null; } GUILayout.Label(""); } EditorGUILayout.EndHorizontal(); // -------------------------------------------------------------- if (ncSpriteFactory != null) { // Texture -------------------------------------------------------------- rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(200)); { GUI.Box(rect, ""); GUILayout.Label(""); Rect subRect = rect; FXMakerLayout.GetOffsetRect(rect, 0, 5, 0, -5); // draw texture if (m_Sel.renderer != null && m_Sel.renderer.sharedMaterial != null && m_Sel.renderer.sharedMaterial.mainTexture != null) { GUI.DrawTexture(subRect, m_Sel.renderer.sharedMaterial.mainTexture, ScaleMode.StretchToFill, true); Event ev = Event.current; for (int n = 0; n < ncSpriteFactory.GetSpriteNodeCount(); n++) { NcSpriteFactory.NcSpriteNode ncSNode = ncSpriteFactory.GetSpriteNode(n); // draw indexRect Rect currRect = new Rect(rect.x + ncSNode.m_UvRect.xMin * rect.width, rect.y + (1 - ncSNode.m_UvRect.yMin - ncSNode.m_UvRect.height) * rect.height, ncSNode.m_UvRect.width * rect.width, ncSNode.m_UvRect.height * rect.height); NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(currRect, 0), (m_Sel.m_nSpriteFactoryIndex == n ? Color.green : Color.red), 1, false); GUI.DrawTexture(subRect, m_Sel.renderer.sharedMaterial.mainTexture, ScaleMode.StretchToFill, true); // Change selIndex if ((ev.type == EventType.MouseDown) && currRect.Contains(ev.mousePosition)) { m_Sel.m_nSpriteFactoryIndex = n; ncSpriteFactory.m_nCurrentIndex = n; // Rotate if (ev.button == 1) { m_Sel.transform.Rotate(0, 180, 0); } bClickButton = true; } } } } EditorGUILayout.EndHorizontal(); } else { m_Sel.m_nSpriteFactoryIndex = -1; } } m_UndoManager.CheckDirty(); // -------------------------------------------------------------- if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain()) { GetFXMakerMain().CreateCurrentInstanceEffect(true); } // --------------------------------------------------------------------- if (GUI.tooltip != "") { m_LastTooltip = GUI.tooltip; } HelpBox(m_LastTooltip); }