void BuildNewShaderContents() { CancelInvoke("BuildNewShaderContents"); if (enabled == false) { return; } if (m_NewShaderMaterials == null || m_NewShaderMaterials.Length <= 0) { return; } int nNotLoadPreviewCount = 0; int nCount = 0; foreach (Material mat in m_NewShaderMaterials) { if (m_NewShaderMaterialContents[nCount] == null) { m_NewShaderMaterialContents[nCount] = new GUIContent(); m_NewShaderMaterialContents[nCount].text = mat.name; m_NewShaderMaterialContents[nCount].tooltip = FXMakerTooltip.Tooltip(mat.name + "\n" + (mat.shader != null ? mat.shader.name : "Not Selected")); } if (m_NewShaderMaterialContents[nCount].image == null) { m_NewShaderMaterialContents[nCount].image = NgAsset.GetAssetPreview(mat); if (m_NewShaderMaterialContents[nCount].image != null) { m_NewShaderMaterialContents[nCount].tooltip += FXMakerTooltip.AddPopupPreview(m_NewShaderMaterialContents[nCount].image); } } if (m_NewShaderMaterialContents[nCount].image == null) { nNotLoadPreviewCount++; } nCount++; } if (0 < nNotLoadPreviewCount) { Invoke("BuildNewShaderContents", FXMakerLayout.m_fReloadPreviewTime); } }
// ========================================================================================================== 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); } } }