protected override void UndoObject() { if (m_bDialogType == DIALOG_TYPE.SELECT) { if (m_bSelectMeshDialog) { NgSerialized.SetMesh(m_SelectMeshComponent, m_OldSelectMesh, true); FXMakerHierarchy.inst.UpdateMeshList(); } else SetAttachPrefab(m_OldSelectPrefab, true); m_AddGameObject = null; } else { m_AddGameObjectList.Remove(m_AddGameObject); DestroyImmediate(m_AddGameObject); if (0 < m_AddGameObjectList.Count) m_AddGameObject = m_AddGameObjectList[0]; } m_nObjectIndex = -1; m_nSelObjectGroupIndex = -1; m_nSelObjectProjectIndex= -1; m_SelObjectContent = null; m_AddPrefabObject = null; if (m_bDialogType == DIALOG_TYPE.SELECT) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } else { if (FXMakerHierarchy.inst.SetActiveGameObject(m_SelectedTransform.gameObject) == false) FXMakerMain.inst.CreateCurrentInstanceEffect(true); } }
// ---------------------------------------------------------------------------------------------------------- protected override void SetActiveObject(int nObjectIndex) { if (nObjectIndex < 0 || m_nObjectCount <= nObjectIndex) { return; } bool bAppend = false; GameObject selPrefab = GetObjectNodePrefab(nObjectIndex); // right button, image Ping and not select if (Input.GetMouseButtonUp(1)) { if (m_bDialogType == DIALOG_TYPE.ADD && FXMakerOption.inst.m_PrefabDlg_RightClick == FXMakerOption.DLG_RIGHTCLICK.APPEND) { bAppend = true; } else { // if (m_bDialogType == DIALOG_TYPE.SELECT == false) FXMakerAsset.SetPingObject(selPrefab); return; } } // 같은것 재클릭 if (m_nObjectIndex == nObjectIndex) { // if (m_bDialogType != DIALOG_TYPE.SELECT) FXMakerAsset.SetPingObject(m_AddGameObject); FXMakerMain.inst.CreateCurrentInstanceEffect(true); return; } if (m_bDialogType == DIALOG_TYPE.SELECT) { m_AddPrefabObject = selPrefab; m_AddGameObject = selPrefab; if (m_bSelectMeshDialog) { MeshFilter meshFilter = m_AddPrefabObject.GetComponent <MeshFilter>(); if (meshFilter != null && meshFilter.sharedMesh != null) { NgSerialized.SetMesh(m_SelectMeshComponent, meshFilter.sharedMesh, true); FXMakerHierarchy.inst.UpdateMeshList(); } } else { SetAttachPrefab(selPrefab); } FXMakerMain.inst.CreateCurrentInstanceEffect(true); } else { if (bAppend == false) { // 기존것 삭제 if (m_AddGameObject != null) { m_AddGameObjectList.Remove(m_AddGameObject); DestroyImmediate(m_AddGameObject); m_AddGameObject = null; } } // create m_AddPrefabObject = selPrefab; m_AddGameObject = FXMakerHierarchy.inst.AddGameObject(m_SelectedTransform.gameObject, selPrefab); m_AddGameObjectList.Insert(0, m_AddGameObject); if (FXMakerHierarchy.inst.SetActiveGameObject(m_AddGameObject) == false) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } } m_nObjectIndex = nObjectIndex; m_nSelObjectProjectIndex = m_nProjectIndex; m_nSelObjectGroupIndex = (m_bOptionRecursively ? -1 : m_nGroupIndex); m_SelObjectContent = new GUIContent(m_ObjectContents[nObjectIndex].text, m_ObjectContents[nObjectIndex].image, m_ObjectContents[nObjectIndex].tooltip); }
// ========================================================================================================== 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))) { if (m_bDialogType == DIALOG_TYPE.SELECT) { if (m_bSelectMeshDialog) { NgSerialized.SetMesh(m_SelectMeshComponent, m_OldSelectMesh, true); FXMakerHierarchy.inst.UpdateMeshList(); } else { SetAttachPrefab(m_OldSelectPrefab); } m_AddGameObject = null; } else { m_AddGameObjectList.Remove(m_AddGameObject); DestroyImmediate(m_AddGameObject); if (0 < m_AddGameObjectList.Count) { m_AddGameObject = m_AddGameObjectList[0]; } } m_nObjectIndex = -1; m_nSelObjectGroupIndex = -1; m_nSelObjectProjectIndex = -1; m_SelObjectContent = null; m_AddPrefabObject = null; if (m_bDialogType == DIALOG_TYPE.SELECT) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } else { if (FXMakerHierarchy.inst.SetActiveGameObject(m_SelectedTransform.gameObject) == false) { FXMakerMain.inst.CreateCurrentInstanceEffect(true); } } } // close buttonRect.x += buttonRect.width + 5; buttonRect.width = baseRect.width - buttonRect.x; if (GUI.Button(buttonRect, GetHelpContent("Close"))) { ClosePopup(true); } } }