void UpdatePosition(Transform camera) { if (m_bHandEnable) { if (Input.GetMouseButtonDown(m_nMoveInputIndex)) { m_OldMousePos = Input.mousePosition; m_bLeftClick = true; } if (m_bLeftClick && Input.GetMouseButton(m_nMoveInputIndex)) { Vector3 currMousePos = Input.mousePosition; float worldlen = NgLayout.GetWorldPerScreenPixel(m_TargetTrans.transform.position); m_MovePostion += (m_OldMousePos - currMousePos) * worldlen; m_OldMousePos = currMousePos; } if (Input.GetMouseButtonUp(m_nMoveInputIndex)) { m_bLeftClick = false; } } camera.Translate(m_MovePostion, Space.Self); }
void DrawGuiGizmo() { float fLineLen = NgLayout.GetWorldPerScreenPixel(FXMakerEffect.inst.m_CurrentEffectRoot.transform.position) * (Screen.width * m_fGizmoLinePerScreen * m_fLocalLineRatio); // draw Selected gizmo DrawGuiGizmoAxis(AXIS.Z, fLineLen, false); DrawGuiGizmoAxis(AXIS.X, fLineLen, false); DrawGuiGizmoAxis(AXIS.Y, fLineLen, false); }
void AddRotation(float x, float y, float z, bool bLocal) { float scale = NgLayout.GetWorldPerScreenPixel(m_SelectedTransform.transform.position); m_SaveRotate += new Vector3(x / scale, y / scale, z / scale); List <FxmInfoIndexing> indexComs = FxmInfoIndexing.FindInstanceIndexings(m_SelectedTransform.transform, false); foreach (FxmInfoIndexing indexCom in indexComs) { indexCom.transform.Rotate(x / scale, y / scale, z / scale, (bLocal ? Space.Self : Space.World)); } m_SelectedTransform.Rotate(x / scale, y / scale, z / scale, (bLocal ? Space.Self : Space.World)); }
private bool IsGUIMousePosition() { Vector2 gUIMousePosition = NgLayout.GetGUIMousePosition(); Rect rect = new Rect(0f, 0f, (float)Screen.width, (float)(Screen.height / 10 + 30)); if (rect.Contains(gUIMousePosition)) { return(true); } Rect rect2 = new Rect(0f, 0f, 40f, (float)Screen.height); return(rect2.Contains(gUIMousePosition)); }
bool IsGUIMousePosition() { Vector2 pos = NgLayout.GetGUIMousePosition(); if (new Rect(0, 0, Screen.width, Screen.height / 10 + 30).Contains(pos)) { return(true); } if (new Rect(0, 0, 40, Screen.height).Contains(pos)) { return(true); } return(false); }
private bool IsGUIMousePosition() { Vector2 gUIMousePosition = NgLayout.GetGUIMousePosition(); if (FxmTestMain.inst.GetFXMakerControls().GetActionToolbarRect().Contains(gUIMousePosition)) { return(true); } Rect rect = new Rect(0f, 0f, (float)Screen.width, (float)(Screen.height / 10 + 30)); if (rect.Contains(gUIMousePosition)) { return(true); } Rect rect2 = new Rect(0f, 0f, 40f, (float)Screen.height); return(rect2.Contains(gUIMousePosition)); }
bool IsGUIMousePosition() { Vector2 pos = NgLayout.GetGUIMousePosition(); if (FxmTestMain.inst.GetFXMakerControls().GetActionToolbarRect().Contains(pos)) { return(true); } if (new Rect(0, 0, Screen.width, Screen.height / 10 + 30).Contains(pos)) { return(true); } if (new Rect(0, 0, 40, Screen.height).Contains(pos)) { return(true); } return(false); }
public static int GetGridHoverIndex(Rect windowRect, Rect listRect, Rect gridRect, int nCount, int nColumn, GUIStyle style) { int num = (style != null) ? style.margin.left : 0; int num2 = nCount / nColumn + ((0 >= nCount % nColumn) ? 0 : 1); float num3 = gridRect.width / (float)nColumn; float num4 = gridRect.height / (float)num2; Vector2 point = NgLayout.GetGUIMousePosition() - new Vector2(windowRect.x, windowRect.y); if (!listRect.Contains(point)) { return(-1); } for (int i = 0; i < nCount; i++) { Rect rect = new Rect(listRect.x + num3 * (float)(i % nColumn) + (float)num, listRect.y + num4 * (float)(i / nColumn) + (float)num, num3 - (float)(num * 2), num4 - (float)(num * 2)); if (rect.Contains(point)) { return(i); } } return(-1); }
private void UpdatePosition(Transform camera) { if (this.m_bHandEnable) { if (Input.GetMouseButtonDown(this.m_nMoveInputIndex)) { this.m_OldMousePos = Input.mousePosition; this.m_bLeftClick = true; } if (this.m_bLeftClick && Input.GetMouseButton(this.m_nMoveInputIndex)) { Vector3 mousePosition = Input.mousePosition; float worldPerScreenPixel = NgLayout.GetWorldPerScreenPixel(this.m_TargetTrans.transform.position); this.m_MovePostion += (this.m_OldMousePos - mousePosition) * worldPerScreenPixel; this.m_OldMousePos = mousePosition; } if (Input.GetMouseButtonUp(this.m_nMoveInputIndex)) { this.m_bLeftClick = false; } } camera.Translate(this.m_MovePostion, Space.Self); }
// ------------------------------------------------------------------------------------------- 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); 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); 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); 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(); }
// ========================================================================================================== 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 static Rect GetCursorTooltipRect(Vector2 size) { return(NgLayout.ClampWindow(new Rect(Input.get_mousePosition().x + 15f, (float)Screen.get_height() - Input.get_mousePosition().y + 80f, size.x, size.y))); }
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(); } } }
bool DrawOriginalGizmo(Transform selTrans, bool bLocal) { float fLineLen = NgLayout.GetWorldPerScreenPixel(FXMakerEffect.inst.m_CurrentEffectRoot.transform.position) * (Screen.width * m_fGizmoLinePerScreen * m_fWorldLineRatio); float fCapSize = fLineLen * 0.07f * m_fCapSizeRatio; Vector3 cubeSize = Vector3.one * fCapSize; bool bSelected = false; // check active if ((((GIZMO_TYPE)m_nGizmoTypeIndex) != GIZMO_TYPE.HAND && ((GIZMO_TYPE)m_nGizmoTypeIndex) != GIZMO_TYPE.NONE) && m_bClick == false) { AXIS nActiveAxis = AXIS.NONE; float fStartClickLen = fLineLen / 4.0f; if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.X, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.X, bLocal) * fLineLen) < m_fActiveDist) { nActiveAxis = AXIS.X; } if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.Y, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.Y, bLocal) * fLineLen) < m_fActiveDist) { nActiveAxis = AXIS.Y; } if (HandleUtility.DistanceToLine(GetPosition(selTrans) + GetDirect(selTrans, AXIS.Z, bLocal) * fStartClickLen, GetPosition(selTrans) + GetDirect(selTrans, AXIS.Z, bLocal) * fLineLen) < m_fActiveDist) { nActiveAxis = AXIS.Z; } if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.SCALE) { if (HandleUtility.DistanceToLine(GetPosition(selTrans), GetPosition(selTrans)) < m_fActiveDist) { nActiveAxis = AXIS.A; } } if (nActiveAxis != AXIS.NONE) { m_nActiveAxis = nActiveAxis; m_bActiveLocal = bLocal; bSelected = true; } else { m_nActiveAxis = AXIS.NONE; } } // draw Selected gizmo DrawGizmoAxis(AXIS.X, bLocal, fLineLen, fCapSize); DrawGizmoAxis(AXIS.Y, bLocal, fLineLen, fCapSize); DrawGizmoAxis(AXIS.Z, bLocal, fLineLen, fCapSize); // World Center Sphere Gizmos.color = Color.yellow; if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.HAND) { Gizmos.color = new Color(Gizmos.color.r, Gizmos.color.g, Gizmos.color.b, m_fHandAlpha); } Gizmos.DrawSphere(Vector3.zero, cubeSize.x / 2.0f); // selected center if (((GIZMO_TYPE)m_nGizmoTypeIndex) == GIZMO_TYPE.SCALE) { if (m_nActiveAxis == AXIS.A && m_bActiveLocal == bLocal) { Gizmos.color = Color.white; } else { Gizmos.color = Color.cyan; } Gizmos.DrawCube(GetPosition(selTrans), cubeSize); } // Gizmo tooltip if (IsLocalSpace()) { m_GizmoTooltip = "GizmosLength = " + fLineLen.ToString("0.000") + " , long=Local"; } else { m_GizmoTooltip = "GizmosLength = " + fLineLen.ToString("0.000") + " , long=World, shot=Local"; } FXMakerMain.inst.SetEmptyTooltip(m_GizmoTooltip); return(bSelected); }
// Update is called once per frame void Update() { m_bUnityGizmos = false; // check shotkey if (GUI.GetNameOfFocusedControl() != "TextField") { if (Input.GetKeyDown(KeyCode.Q)) { SetGizmoType(0); } if (Input.GetKeyDown(KeyCode.W)) { SetGizmoType(1); } if (Input.GetKeyDown(KeyCode.E)) { SetGizmoType(2); } if (Input.GetKeyDown(KeyCode.R)) { SetGizmoType(3); } if (Input.GetKeyDown(KeyCode.T)) { SetGizmoType(4); } if (Input.GetKeyDown(KeyCode.Y)) { m_bWorldSpace = !m_bWorldSpace; } } GameObject selObj = FXMakerMain.inst.GetFXMakerHierarchy().GetSelectedGameObject(); if (selObj == null) { return; } m_SelectedTransform = selObj.transform; // check click if (m_nActiveAxis != AXIS.NONE) { if (Input.GetMouseButtonDown(0)) { m_OldMousePos = Input.mousePosition; m_OldOriScale = m_SelectedTransform.localScale; m_OldInsScale = (GetInstanceObject() == null ? Vector3.one : GetInstanceObject().transform.localScale); m_OldGizmoLineLength = NgLayout.GetWorldPerScreenPixel(FXMakerEffect.inst.m_CurrentEffectRoot.transform.position) * (Screen.width * m_fGizmoLinePerScreen * m_fWorldLineRatio); m_SaveRotate = Vector3.zero; m_bClick = true; if (m_nGizmoTypeIndex == (int)GIZMO_TYPE.POSITION || m_nGizmoTypeIndex == (int)GIZMO_TYPE.ROTATION || m_nGizmoTypeIndex == (int)GIZMO_TYPE.SCALE) { FXMakerEffect.inst.SetChangePrefab(); } } if (m_bClick && Input.GetMouseButton(0)) { Vector3 currMousePos = Input.mousePosition; Vector3 prevWorldPos = NgLayout.GetScreenToWorld(m_SelectedTransform.transform.position, m_OldMousePos); Vector3 currWorldPos = NgLayout.GetScreenToWorld(m_SelectedTransform.transform.position, currMousePos); if (IsLocalSpace()) { Transform tempTrans = GetTempTransform(); tempTrans.rotation = m_SelectedTransform.rotation; currWorldPos = tempTrans.InverseTransformPoint(currWorldPos); prevWorldPos = tempTrans.InverseTransformPoint(prevWorldPos); } switch (((GIZMO_TYPE)m_nGizmoTypeIndex)) { case GIZMO_TYPE.POSITION: { switch (m_nActiveAxis) { case AXIS.X: AddTranslate(currWorldPos.x - prevWorldPos.x, 0, 0, m_bActiveLocal); break; case AXIS.Y: AddTranslate(0, currWorldPos.y - prevWorldPos.y, 0, m_bActiveLocal); break; case AXIS.Z: { if (m_bFixedSide) { AddTranslate(currWorldPos.x - prevWorldPos.x, 0, 0, m_bActiveLocal); AddTranslate(0, currWorldPos.y - prevWorldPos.y, 0, m_bActiveLocal); } else { AddTranslate(0, 0, currWorldPos.z - prevWorldPos.z, m_bActiveLocal); } break; } } break; } case GIZMO_TYPE.ROTATION: { switch (m_bFixedSide ? AXIS.Z : m_nActiveAxis) { case AXIS.X: AddRotation(currWorldPos.z - prevWorldPos.z, 0, 0, m_bActiveLocal); break; case AXIS.Y: AddRotation(0, currWorldPos.x - prevWorldPos.x, 0, m_bActiveLocal); break; case AXIS.Z: AddRotation(0, 0, prevWorldPos.x - currWorldPos.x, m_bActiveLocal); break; } break; } case GIZMO_TYPE.SCALE: { float fScaleDist; switch (m_nActiveAxis) { case AXIS.X: fScaleDist = currWorldPos.x - prevWorldPos.x; AddScale(fScaleDist / m_OldGizmoLineLength, 0, 0); break; case AXIS.Y: fScaleDist = currWorldPos.y - prevWorldPos.y; AddScale(0, fScaleDist / m_OldGizmoLineLength, 0); break; case AXIS.Z: fScaleDist = currWorldPos.z - prevWorldPos.z; AddScale(0, 0, fScaleDist / m_OldGizmoLineLength); break; case AXIS.A: { fScaleDist = (currMousePos.x - m_OldMousePos.x) * NgLayout.GetWorldPerScreenPixel(selObj.transform.position); if (m_bFixedSide) { AddScale(fScaleDist / m_OldGizmoLineLength, fScaleDist / m_OldGizmoLineLength, 0); } else { AddScale(fScaleDist / m_OldGizmoLineLength, fScaleDist / m_OldGizmoLineLength, fScaleDist / m_OldGizmoLineLength); } break; } } break; } } m_OldMousePos = currMousePos; } if (Input.GetMouseButtonUp(0)) { m_nActiveAxis = AXIS.NONE; m_bClick = false; } FXMakerMain.inst.GetFXMakerMouse().SetHandControl(m_bClick == false); } }
public static Rect GetSumRect(Rect rect1, Rect rect2) { return(NgLayout.GetOffsetRect(rect1, Mathf.Min(0f, rect2.xMin - rect1.xMin), Mathf.Min(0f, rect2.yMin - rect1.yMin), Mathf.Max(0f, rect2.xMax - rect1.xMax), Mathf.Max(0f, rect2.yMax - rect1.yMax))); }
public static Rect GetSumRect(Rect rect1, Rect rect2) { return(NgLayout.GetOffsetRect(rect1, Mathf.Min(0f, rect2.get_xMin() - rect1.get_xMin()), Mathf.Min(0f, rect2.get_yMin() - rect1.get_yMin()), Mathf.Max(0f, rect2.get_xMax() - rect1.get_xMax()), Mathf.Max(0f, rect2.get_yMax() - rect1.get_yMax()))); }