// ========================================================================================================== protected virtual void DrawObjectList(Rect baseRect) { if (m_bInvokeLoadObject) { baseRect = FXMakerLayout.GetOffsetRect(baseRect, baseRect.width / 8, baseRect.height / 3, -baseRect.width / 8, -baseRect.height / 3); GUI.Box(baseRect, "Loading...", GUI.skin.GetStyle("PopupLoading_Box")); return; } if (m_nObjectCount <= 0) { return; } int nObjectCount = m_ObjectContents.Length; int nColumn = m_nObjectColumn; if (m_nObjectColumn == 0) { Debug.Break(); return; } // Object List ------------------------------------------------------ Rect listRect = baseRect; Rect scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, !m_bOptionShowName); Rect gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, !m_bOptionShowName); GUIStyle styleButton = GUI.skin.GetStyle("ScrollList_Button"); m_ObjectListScrollPos = GUI.BeginScrollView(listRect, m_ObjectListScrollPos, scrollRect); styleButton.imagePosition = (m_bOptionShowName ? ImagePosition.ImageAbove : ImagePosition.ImageOnly); // int nObjectIndex = GUI.SelectionGrid(gridRect, ((m_nSelObjectProjectIndex == m_nProjectIndex && ((m_nGroupIndex == m_nSelObjectGroupIndex) || (m_nSelObjectGroupIndex == -1 && m_bOptionRecursively))) ? m_nObjectIndex : -1), m_ObjectContents, nColumn, styleButton); bool OldEnabled = GUI.enabled; if (m_bSaveDialog) { GUI.enabled = false; } // int nObjectIndex = GUI.SelectionGrid(gridRect, m_nObjectIndex, m_ObjectContents, nColumn, styleButton); int nObjectIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_ObjectListScrollPos.y), listRect, gridRect, m_nObjectIndex, m_ObjectContents, nColumn, styleButton); if (GUI.changed && nObjectIndex != m_nObjectIndex) { this.SetActiveObject(nObjectIndex); } // Draw over DrawOverObjectList(gridRect, styleButton); if (m_bSaveDialog) { GUI.enabled = OldEnabled; } GUI.EndScrollView(); }
// ========================================================================================================== protected override void DrawObjectList(Rect baseRect) { if (m_bInvokeLoadObject) { baseRect = FXMakerLayout.GetOffsetRect(baseRect, baseRect.width / 8, baseRect.height / 3, -baseRect.width / 8, -baseRect.height / 3); GUI.Box(baseRect, "Loading...", GUI.skin.GetStyle("PopupLoading_Box")); return; } if (m_nObjectCount <= 0) { return; } int nObjectCount = m_ObjectContents.Length; int nColumn = m_nObjectColumn; if (m_nObjectColumn == 0) { Debug.Break(); return; } // right menu CheckRightMenu(); // Object List ------------------------------------------------------ Rect listRect = baseRect; Rect scrollRect = FXMakerLayout.GetAspectScrollViewRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, !m_bOptionShowName); Rect gridRect = FXMakerLayout.GetAspectScrollGridRect((int)listRect.width, m_fButtonAspect, nObjectCount, nColumn, !m_bOptionShowName); GUIStyle styleButton = GUI.skin.GetStyle("ScrollList_Button"); m_ObjectListScrollPos = GUI.BeginScrollView(listRect, m_ObjectListScrollPos, scrollRect); styleButton.imagePosition = (m_bOptionShowName ? ImagePosition.ImageAbove : ImagePosition.ImageOnly); bool OldEnabled = GUI.enabled; // if (m_bSaveDialog) // GUI.enabled = false; // Draw grid int nObjectIndex = GUI.SelectionGrid(gridRect, m_nObjectIndex, m_ObjectContents, nColumn, styleButton); if (GUI.changed) { // right menu if (Input.GetMouseButtonUp(1)) { ShowRightMenu(nObjectIndex); } else { if (nObjectIndex != m_nObjectIndex) { this.SetActiveObject(nObjectIndex); } } } // Draw Curve for (int n = 0; n < m_CurveInfos.Length; n++) { DrawCurve(n, gridRect, n % nColumn, n / nColumn, m_CurveInfos[n], styleButton); } if (m_bSaveDialog) { GUI.enabled = OldEnabled; } GUI.EndScrollView(); }
// ========================================================================================================== 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.GetComponent <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.GetComponent <Renderer>().sharedMaterial.mainTexture != null) { string path = AssetDatabase.GetAssetPath(spriteCom.GetComponent <Renderer>().sharedMaterial.mainTexture); AssetDatabase.MoveAssetToTrash(path); // AssetDatabase.DeleteAsset(path); } string matpath = AssetDatabase.GetAssetPath(spriteCom.GetComponent <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(); }
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(); } }