Exemplo n.º 1
0
    // -------------------------------------------------------------------------------------------
    void OnGUI()
    {
        FXMakerMain.inst.OnGUIStart();
        // Menu Toolbar UI ------------------------------------------------------
        FXMakerMain.inst.AutoFocusWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.TOP_CENTER), FXMakerLayout.GetMenuToolbarRect(), winMenuToolbar, "MainToolbar - Backgroud");

        // Menu Edit UI ---------------------------------------------------------
        FXMakerMain.inst.AutoFocusWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.TOP_RIGHT), FXMakerLayout.GetMenuTopRightRect(), winMenuEdit, (m_CurrentBackgroundInfo != null ? m_BackgroundContents[m_nBackgroundIndex].text : "Not Select"));

        // List Window ---------------------------------------------
        if (m_CurrentBackgroundInfo != null)
        {
            for (int n = 0; n < m_CloneTypeCount + m_ReferenceTypeCount; n++)
            {
                GameObject settingObj = m_CurrentBackgroundInfo.GetChildObject(n);
                Rect       rect;

                if (n < m_CloneTypeCount)
                {
                    rect = FXMakerLayout.GetResListRect(n);
                    if (settingObj != null)
                    {
                        rect.height = 160;
                    }
                }
                else
                {
                    rect = GetBackgroundPrefabRect(FXMakerLayout.GetResListRect(0), n - m_CloneTypeCount);
                }
                FXMakerMain.inst.AutoFocusWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.RESOURCE_START) + n, rect, winResourceList, m_ResourceSubDir[n]);
            }
        }

        FXMakerMain.inst.OnGUIEnd();
    }
Exemplo n.º 2
0
    void winModalMessage(int id)
    {
        Rect baseRect   = FXMakerLayout.GetModalMessageRect();
        Rect msgRect    = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 10, 1, 5);
        Rect buttonRect = FXMakerLayout.GetChildVerticalRect(baseRect, 0, 10, 6, 3);

        switch (m_ModalType)
        {
        case FXMakerLayout.MODAL_TYPE.MODAL_NONE: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_MSG: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_OK: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_YESNO: break;

        case FXMakerLayout.MODAL_TYPE.MODAL_OKCANCEL:
        {
            GUI.Label(FXMakerLayout.GetInnerHorizontalRect(msgRect, 10, 1, 9), m_ModalMessage);
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 14, 2, 4), "OK"))
            {
                m_nModalMessageValue = FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_OK;
            }
            if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(buttonRect, 14, 8, 4), "CANCEL"))
            {
                m_nModalMessageValue = FXMakerLayout.MODALRETURN_TYPE.MODALRETURN_CANCEL;
            }
            break;
        }
        }
    }
Exemplo n.º 3
0
    protected void DrawPreviewTexture()
    {
//		if (128 < texture.width)
//			 m_nPreviewWidth = 266;
//		else m_nPreviewWidth = 160;
        m_nPreviewWidth = 160;

        bool     bShowRight  = (Screen.width / 2 < m_PopupPosition.x);
        GUIStyle styleButton = GUI.skin.GetStyle("Preview_ImageOnly");
        Rect     baseRect    = GetPopupRect();
        Rect     previewRect;

        previewRect = new Rect((bShowRight ? baseRect.x - m_nPreviewWidth + 2 : baseRect.x + baseRect.width), baseRect.y, m_nPreviewWidth, m_nPreviewWidth);
        GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 1, previewRect, winPreview, new GUIContent(m_PreviewTexture), styleButton);
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 1);

        styleButton = GUI.skin.GetStyle("Preview_TextOnly");
        previewRect = new Rect((bShowRight ? baseRect.x - m_nPreviewWidth + 4 - m_nPreviewWidth / 2 + m_nPreviewCaptionHeight : baseRect.x + baseRect.width + m_nPreviewWidth), baseRect.y, m_nPreviewWidth / 2 - m_nPreviewCaptionHeight, m_nPreviewWidth / 2);
        GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 2, previewRect, winColor, "Color", styleButton);
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 2);

        previewRect = new Rect((bShowRight ? baseRect.x - m_nPreviewWidth + 4 - m_nPreviewWidth / 2 + m_nPreviewCaptionHeight : baseRect.x + baseRect.width + m_nPreviewWidth), baseRect.y + m_nPreviewWidth / 2, m_nPreviewWidth / 2 - m_nPreviewCaptionHeight, m_nPreviewWidth / 2);
        GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 3, previewRect, winAlpha, "Alpha ", styleButton);
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 3);
    }
Exemplo n.º 4
0
    protected bool DrawTrimTexture(Rect drawRect, bool bSelEnable, Material srcMat, NcSpriteFactory.NcFrameInfo[] ncSpriteFrameInfos, int nStartFrame, int nFrameCount, int nSelFrameIndex, out int nClickFrameIndex)
    {
        nClickFrameIndex = 0;
        GUI.DrawTexture(drawRect, srcMat.mainTexture, ScaleMode.StretchToFill, true);

        if (ncSpriteFrameInfos == null)
        {
            return(false);
        }
        Event ev = Event.current;

        if (ncSpriteFrameInfos != null)
        {
            for (int n = Mathf.Max(nStartFrame, 0); n < Mathf.Min(nStartFrame + nFrameCount, ncSpriteFrameInfos.Length); n++)
            {
                Rect uvRect = ncSpriteFrameInfos[n].m_TextureUvOffset;
                // draw indexRect
                Rect currRect = new Rect(drawRect.x + uvRect.xMin * drawRect.width, drawRect.y + (1 - uvRect.yMin - uvRect.height) * drawRect.height, uvRect.width * drawRect.width, uvRect.height * drawRect.height);
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(currRect, 0), ((nStartFrame + nSelFrameIndex == n && bSelEnable) ? Color.green : Color.red), 1, false);

                // Change selIndex
                if (bSelEnable && (ev.type == EventType.MouseDown && ev.button == 0) && currRect.Contains(ev.mousePosition))
                {
                    nClickFrameIndex = n - nStartFrame;
                    Repaint();
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 5
0
    void UpdatePosition(Transform camera)
    {
        if (m_bHandEnable)
        {
            if (GetLeftButtonDown())
            {
                m_OldMousePos = Input.mousePosition;
                m_bLeftClick  = true;
            }

            if (m_bLeftClick && GetLeftButton())
            {
                Vector3 currMousePos = Input.mousePosition;
                float   worldlen     = FXMakerLayout.GetWorldPerScreenPixel(m_TargetTrans.transform.position);

                m_MovePostion += (m_OldMousePos - currMousePos) * worldlen;
                m_OldMousePos  = currMousePos;
            }
            if (GetLeftButtonUp())
            {
                m_bLeftClick = false;
            }
        }

        camera.Translate(m_MovePostion, Space.Self);
    }
Exemplo n.º 6
0
    void DrawGuiGizmoAxis(AXIS drawAxis, float fLineLen, bool bDrawLocalAxis)
    {
        Vector3 vecDirect = Vector3.zero;
        Vector3 vecPos    = Vector3.zero;
        Color   color     = Color.white;

        if (Camera.main == null)
        {
            return;
        }

        // set color
        switch (drawAxis)
        {
        case AXIS.X: color = Color.red;                 break;

        case AXIS.Y: color = Color.green;               break;

        case AXIS.Z: color = Color.blue;                break;
        }

        // draw line
        float     fDist     = FXMakerMain.inst.GetFXMakerMouse().m_fDistance;
        Rect      baseRect  = FXMakerLayout.GetEffectHierarchyRect();
        Vector3   guiCenPos = new Vector3(Screen.width / 2, Screen.height / 2, fDist);
        Vector3   guiPos    = new Vector3(baseRect.x - 50, baseRect.y + 30) - guiCenPos;
        Transform tempTrans = GetTempTransform();

        tempTrans.position = Camera.main.ScreenToWorldPoint(guiCenPos);
        vecDirect          = tempTrans.position + GetDirect(tempTrans, drawAxis, true) * fDist / 20;
        vecPos             = Camera.main.WorldToScreenPoint(vecDirect);
        vecPos.y           = Screen.height - vecPos.y;
        NgGUIDraw.DrawLine(guiPos + guiCenPos, guiPos + vecPos, color, 3, true);
    }
Exemplo n.º 7
0
	void OnHoverCommand_Button(string cmd)
	{
		if (cmd == "ShowThumbCaptureRect")
			NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(FXMakerCapture.GetThumbCaptureRect(), 5), new Color(0.8f, 0, 0), 2, false);
// 		if (cmd == "ShowSpriteCaptureRect")
// 			NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(FXMakerCapture.GetSpriteCaptureRect(), 5), new Color(0.8f, 0, 0), 2, false);
	}
Exemplo n.º 8
0
	// -------------------------------------------------------------------------------------------
	void winMenuChange(int id)
	{
		int nVirticlaCount = 0;

		if ((FXMakerLayout.m_bMinimizeAll || FXMakerLayout.m_bMinimizeTopMenu) == false)
		{
			// change button
			if (GUI.Button(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 3, 0, 1), FXMakerTooltip.GetHcToolMain("go "+(m_nToolIndex==0 ? "PrefabTool" : "Background"))))
				SetActiveTool(m_nToolIndex == 0 ? 1 : 0);
			// Capture
			if (GUI.Button(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 3, 1, 1), FXMakerTooltip.GetHcToolMain("FullCapture", FXMakerCapture.GetCaptureScreenShotDir())))
			{
				if (Input.GetMouseButtonUp(1))
				{
					Debug.Log(FXMakerCapture.GetCaptureScreenShotDir());
					EditorUtility.OpenWithDefaultApp(FXMakerCapture.GetCaptureScreenShotDir());
				}
 				else FXMakerCapture.CaptureScreenShot();
			}
			nVirticlaCount = 2;
		} else nVirticlaCount = 0;

		// Reload Project Data
		if (GUI.Button(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 1+nVirticlaCount, nVirticlaCount, 1), 2, 0, 1), FXMakerTooltip.GetHcToolMain("LoadPrj")))
			LoadTool("Loaded Project");
		// Save Project Data
		FXMakerEffect fxMakerEffect = GetComponent<FXMakerEffect>();
		bool bEnable = (fxMakerEffect != null && GetComponent<FXMakerEffect>().IsReadOnlyFolder() == 0);
		if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerHorizontalRect(FXMakerLayout.GetChildVerticalRect(FXMakerLayout.GetMenuChangeRect(), 0, 1+nVirticlaCount, nVirticlaCount, 1), 2, 1, 1), FXMakerTooltip.GetHcToolMain("SavePrj"), bEnable))
			SaveTool("Saved Prjoect", true);
		SaveTooltip();
	}
    public override void OnGUIPopup()
    {
        base.OnGUIPopup();
        // Popup Window ---------------------------------------------------------
//		FXMakerMain.inst.PopupFocusWindow(NgLayout.GetWindowId(NgLayout.WINDOWID.POPUP), GetPopupRect(), winPopup, m_CaptionName);
        FXMakerMain.inst.ModalMsgWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP), GetPopupRect(), winPopup, m_CaptionName);
    }
Exemplo n.º 10
0
    public bool IsGUIMousePosition()
    {
        Rect rect = new Rect();

        if (IsShowCurrentFolderPopup())
        {
            rect = FxmPopupManager.inst.GetCurrentFolderPopup().GetPopupRect();
        }
        if (IsShowHierarchyPopup())
        {
            rect = m_CurrentHierarchyPopup.GetPopupRect();
        }
        if (IsShowCurrentMenuPopup())
        {
            rect = m_CurrentMenuPopup.GetPopupRect();
        }
        if (IsShowSpritePopup())
        {
            rect = m_CurrentSpritePopup.GetPopupRect();
        }

        if (rect.Contains(FXMakerLayout.GetGUIMousePosition()))
        {
            return(true);
        }
        return(false);
    }
Exemplo n.º 11
0
    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_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())
        {
            GetFXMakerMain().CreateCurrentInstanceEffect(true);
        }
        // ---------------------------------------------------------------------
        if (GUI.tooltip != "")
        {
            m_LastTooltip = GUI.tooltip;
        }
        HelpBox(m_LastTooltip);
    }
Exemplo n.º 12
0
 protected void winAlpha(int id)
 {
     if (m_PreviewTexture != null)
     {
         Rect rect = FXMakerLayout.GetOffsetRect(new Rect(0, m_nPreviewCaptionHeight, m_nPreviewWidth / 2 - m_nPreviewCaptionHeight, m_nPreviewWidth / 2 - m_nPreviewCaptionHeight), -4);
         EditorGUI.DrawTextureAlpha(rect, m_PreviewTexture);
     }
 }
Exemplo n.º 13
0
	public bool IsGUIMousePosition()
	{
		if (FxmPopupManager.inst.IsShowPopup())
			return FxmPopupManager.inst.IsGUIMousePosition();
		if (FXMakerLayout.GetMenuGizmoRect().Contains(FXMakerLayout.GetGUIMousePosition()))
			return true;
		return (m_nLastFocusWindow != FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.TOP_RIGHT) && 0 < m_nLastFocusWindow);
	}
Exemplo n.º 14
0
 // OnGUI ----------------------------------------------------------------------------------
 public void OnGUIToolMessage()
 {
     FxmPopupManager.inst.ShowToolMessage(m_ToolMessage);
     if (m_ToolMessage != "")
     {
         GUI.Box(FXMakerLayout.GetToolMessageRect(), m_ToolMessage);
     }
 }
Exemplo n.º 15
0
 public void OnGUIModalMessage()
 {
     if (FxmPopupManager.inst.IsShowModalMessage())
     {
         FXMakerMain.inst.ModalMsgWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.MODAL_MSG), FXMakerLayout.GetModalMessageRect(), winModalMessage, "");
         GUI.enabled = false;
     }
 }
Exemplo n.º 16
0
    // ==========================================================================================================
    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();
    }
Exemplo n.º 17
0
	// tooltip -------------------------------------------------------------
	void ProcessTooltip()
	{
		if (FxmPopupManager.inst.IsShowModalMessage() == false)
		{
			if (m_PriorityTooltip != "")
				m_Tooltip = m_PriorityTooltip;

			if (m_Tooltip != "")
			{
				if (0 < m_Tooltip.Trim().Length)
				{
					string tooltip = "";

					// HintRect
					tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HintRect, m_Tooltip);
					if (tooltip != "")
						if (FXMakerOption.inst.m_bHintRedBox)
							FxmPopupManager.inst.ShowHintRect(FXMakerTooltip.GetHintRect(tooltip));

					// HoverCommand_Button
					tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HoverCommand_Button, m_Tooltip);
					if (tooltip != "")
						OnHoverCommand_Button(tooltip);

					// HoverCommand_Popup Object
					tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.HoverCommand_Popup, m_Tooltip);
					if (tooltip != "")
						OnHoverCommand_Popup(System.Convert.ToInt32(tooltip));
					else OnHoverCommand_Popup(0);

					// Cursor Shot Tooltip
					tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.CursorTooltip, m_Tooltip);
					if (tooltip != "")
						FxmPopupManager.inst.ShowCursorTooltip(tooltip);

					// Bottom Long Tooltip
					tooltip = FXMakerTooltip.GetTooltip(FXMakerTooltip.TOOLTIPSPLIT.Tooltip, m_Tooltip);
					if (tooltip != "")
						FxmPopupManager.inst.ShowBottomTooltip(tooltip);

					FxmPopupManager.inst.UpdateBringWindow();
				}

				if (m_nOnGUICallCount == 2)
				{
					m_Tooltip = "";
					m_PriorityTooltip = "";
				}
			} else {
// 				OnHoverCommand_Hierarchy(0);
				string msg = m_EmptyTooltip;
				FXMakerEffect fxMakerEffect = GetComponent<FXMakerEffect>();
				if (fxMakerEffect != null && 0 < GetComponent<FXMakerEffect>().IsReadOnlyFolder())
					msg += "\n" + FXMakerTooltip.GetHsToolMessage("FOLDER_READONLY_BOTTOM", "");
				GUI.Label(FXMakerLayout.GetTooltipRect(), msg);
			}
		}
	}
Exemplo n.º 18
0
    // Tooltip window -------------------------------------------------------------------------
    public void ShowHintRect(Rect hintRect)
    {
//		NgGUIDraw.DrawBox(hintRect, NgLayout.m_ColorHelpBox, 1, false);
        GUIStyle style = GUI.skin.GetStyle("HintRect_Window");

        GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.HINTRECT) + m_nHintRectCount, hintRect, winEmpty, "", style);
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.HINTRECT) + m_nHintRectCount);
        m_nHintRectCount++;
    }
Exemplo n.º 19
0
	void Update()
	{
		CaptureSpriteImage();

//  		NgSerialized.LogPropertis(transform, true);

//		Debug.Log(NgAssembly.GetPropertyValue(new SerializedObject(transform), "m_LocalEulerAnglesHint.x"));
// 		NgAssembly.SetPropertyValue(new SerializedObject(transform), "m_LocalEulerAnglesHint.x", (float)1000, true);
// 		Debug.Log(NgAssembly.GetPropertyValue(new SerializedObject(transform), "m_LocalEulerAnglesHint.x"));
// 		if (FXMakerHierarchy.inst.GetSelectedGameObject() != null && FXMakerHierarchy.inst.GetSelectedGameObject().renderer != null)
// 			NgAssembly.GetPropertis(FXMakerHierarchy.inst.GetSelectedGameObject().renderer);

		m_nUnityFrameCount++;
		m_nOnGUICallCount	= 0;
		m_bPrevPopupWindow	= m_bLastPopupWindow;
		SetFocusInputKey(0);		// 사용안된 키값 지우기

		// Original Unactive
		UnactiveOriginalObject();

		// main Camera Check
		if (Camera.mainCamera == null)
			FxmPopupManager.inst.ShowToolMessage("MainCamera not Found");

		// ShotKey
		if (Input.GetKey(KeyCode.LeftArrow))
			m_keyLastInput = FXMakerLayout.GetVaildInputKey(KeyCode.LeftArrow, Input.GetKeyDown(KeyCode.LeftArrow));
		if (Input.GetKey(KeyCode.RightArrow))
			m_keyLastInput = FXMakerLayout.GetVaildInputKey(KeyCode.RightArrow, Input.GetKeyDown(KeyCode.RightArrow));
		if (Input.GetKey(KeyCode.UpArrow))
			m_keyLastInput = FXMakerLayout.GetVaildInputKey(KeyCode.UpArrow, Input.GetKeyDown(KeyCode.UpArrow));
		if (Input.GetKey(KeyCode.DownArrow))
			m_keyLastInput = FXMakerLayout.GetVaildInputKey(KeyCode.DownArrow, Input.GetKeyDown(KeyCode.DownArrow));
		if (Input.GetKeyUp(KeyCode.Delete))
			m_keyLastInput = KeyCode.Delete;

		// Thumb Capture
		if (0 < m_nStartThumbCapture)
		{
			if (30 < m_nStartThumbCapture)
			{
				if (m_nToolIndex == 0)
				{
					StartCoroutine(FXMakerCapture.EndSaveBackThumbCoroutine());
				} else {
					StartCoroutine(FXMakerCapture.EndSaveEffectThumbCoroutine());
				}
				m_nStartThumbCapture = 0;
			} else {
				m_nStartThumbCapture++;
			}
		}

// 		if (Input.GetKey(KeyCode.LeftArrow))
// 			SendMessage("aa");
	}
Exemplo n.º 20
0
    public override bool ShowPopupWindow(Object selObj)
    {
        m_nButtonCount   = 20;
        m_PopupPosition  = FXMakerLayout.GetGUIMousePosition();
        m_SelectedObject = selObj;
        enabled          = true;

        base.ShowPopupWindow(null);
        return(enabled);
    }
Exemplo n.º 21
0
    // Property -------------------------------------------------------------------------
    public bool ShowPopupWindow()
    {
        m_PopupPosition      = FXMakerLayout.GetGUIMousePosition();
        m_SelectedPrefabName = FXMakerMain.inst.GetOriginalEffectPrefab().name;
        enabled = true;

        LoadPrefs();
        base.ShowPopupWindow(null);
        return(enabled);
    }
Exemplo n.º 22
0
    protected void winAlpha1(int id)
    {
        Texture tex = NgMaterial.GetTexture(m_SelectedMaterial, true);

        if (tex != null)
        {
            Rect rect = FXMakerLayout.GetOffsetRect(new Rect(0, m_nPreviewCaptionHeight, m_nPreviewMaterialWidth - m_nPreviewCaptionHeight, m_nPreviewMaterialWidth - m_nPreviewCaptionHeight), -4);
            EditorGUI.DrawTextureAlpha(rect, tex);
        }
    }
Exemplo n.º 23
0
    protected bool DrawTrimTexture(Rect drawRect, bool bSelEnable, Material srcMat, NcSpriteFactory ncSpriteFactory, int nSelFactoryIndex, int nSelFrameIndex, bool bRotateRight, out int nClickFactoryIndex, out int nClickFrameIndex)
    {
//		FXMakerLayout.GetOffsetRect(rect, 0, 5, 0, -5);
        Texture srcTex = srcMat.mainTexture;

        GUI.DrawTexture(drawRect, srcTex, ScaleMode.StretchToFill, true);

        Event ev = Event.current;

        for (int n = 0; n < ncSpriteFactory.GetSpriteNodeCount(); n++)
        {
            NcSpriteFactory.NcSpriteNode ncSpriteNode = ncSpriteFactory.GetSpriteNode(n);
            if (ncSpriteNode.IsEmptyTexture())
            {
                continue;
            }

            for (int fc = 0; fc < ncSpriteNode.m_nFrameCount; fc++)
            {
                Color color;
                Rect  uvRect = ncSpriteFactory.GetSpriteUvRect(n, fc);
                // draw indexRect
                Rect currRect = new Rect(drawRect.x + uvRect.xMin * drawRect.width, drawRect.y + (1 - uvRect.yMin - uvRect.height) * drawRect.height, uvRect.width * drawRect.width, uvRect.height * drawRect.height);
                if (nSelFactoryIndex == n)
                {
                    color = (nSelFrameIndex == fc ? Color.green : Color.red);
                }
                else
                {
                    color = Color.yellow;
                }
                NgGUIDraw.DrawBox(FXMakerLayout.GetOffsetRect(currRect, 0), color, 1, false);

                // Change selIndex
                if (bSelEnable && (ev.type == EventType.MouseDown) && currRect.Contains(ev.mousePosition))
                {
//					m_Sel.SetSpriteFactoryIndex(n, fc, false);
                    nClickFactoryIndex = n;
                    nClickFrameIndex   = fc;
                    // Rotate
                    if (bRotateRight && ev.button == 1)
                    {
                        (target as NcEffectBehaviour).transform.Rotate(0, 180, 0);
                    }
                    Repaint();
                    return(true);
                }
            }
        }
        nClickFactoryIndex = 0;
        nClickFrameIndex   = 0;
        return(false);
    }
Exemplo n.º 24
0
    void DrawCurve(int nIndex, Rect gridRect, int nColumn, int nRow, NcCurveAnimation.NcInfoCurve curveInfo, GUIStyle styleButton)
    {
        int   nMargin       = styleButton.margin.left;
        int   nImageMargin  = 3;
        float fButtonWidth  = (gridRect.width / m_nObjectColumn);
        float fButtonHeight = (m_fButtonAspect * fButtonWidth);

        Rect buttonRect = new Rect(fButtonWidth * nColumn + nMargin, fButtonHeight * nRow + nMargin, fButtonWidth - nMargin * 2, fButtonHeight - nMargin * 2);

        buttonRect = FXMakerLayout.GetOffsetRect(buttonRect, -nImageMargin);
        EditorGUIUtility.DrawCurveSwatch(buttonRect, curveInfo.m_AniCurve, null, Color.green, Color.black, curveInfo.GetFixedDrawRange());
    }
    public bool ShowPopupWindow(string[] displayedMenu, bool[] eabledMenu)
    {
        m_DisplayedMenu  = displayedMenu;
        m_EnabledMenu    = eabledMenu;
        m_nSelectedIndex = -1;
        m_nLineCount     = GetLineCount();
        m_PopupPosition  = FXMakerLayout.GetGUIMousePosition();
        enabled          = true;

        base.ShowPopupWindow(null);
        return(enabled);
    }
Exemplo n.º 26
0
 public override void OnGUIPopup()
 {
     if (m_CurrentCurveAnimation.GetCurveInfo(m_OriCurveInfoIndex) == null)
     {
         ClosePopup(false);
     }
     else
     {
         base.OnGUIPopup();
         // Popup Window ---------------------------------------------------------
         FXMakerMain.inst.ModalMsgWindow(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP), GetPopupRect(), winPopup, "NcInfoCurve");
     }
 }
Exemplo n.º 27
0
    protected void DrawPreviewMaterial(int nIndex, Texture texture)
    {
        m_nPreviewMaterialWidth = 72;

        bool     bShowRight  = (Screen.width / 2 < m_PopupPosition.x);
        GUIStyle styleButton = GUI.skin.GetStyle("Preview_ImageOnly");
        Rect     baseRect    = GetPopupRect();
        Rect     previewRect;
        Texture  oldTexture = m_PreviewTexture;
        int      nMainWidth = m_nPreviewMaterialWidth;

        m_PreviewTexture = texture;
        if (nIndex == 0)
        {
            baseRect.y = baseRect.height - m_nPreviewMaterialWidth * 2;
        }
        else
        {
            baseRect.y = baseRect.height - m_nPreviewMaterialWidth * 1;
        }

//      previewRect	= new Rect((bShowRight ? baseRect.x-m_nPreviewMaterialWidth+2 : baseRect.x+baseRect.width), baseRect.y, m_nPreviewMaterialWidth, m_nPreviewMaterialWidth);
//      GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP)+10+nIndex, previewRect, winPreview0, new GUIContent(texture), styleButton);
//      GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP)+10+nIndex);
        nMainWidth = 0;

        styleButton = GUI.skin.GetStyle("Preview_TextOnly");
        previewRect = new Rect((bShowRight ? baseRect.x - nMainWidth + 2 - (m_nPreviewMaterialWidth - m_nPreviewCaptionHeight) * 1 : baseRect.x + baseRect.width - 2 + nMainWidth), baseRect.y, m_nPreviewMaterialWidth - m_nPreviewCaptionHeight, m_nPreviewMaterialWidth);
        if (nIndex == 0)
        {
            GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 20 + nIndex, previewRect, winColor0, "Color0", styleButton);
        }
        else
        {
            GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 20 + nIndex, previewRect, winColor1, "Color1", styleButton);
        }
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 20 + nIndex);

        previewRect = new Rect((bShowRight ? baseRect.x - nMainWidth + 2 - (m_nPreviewMaterialWidth - m_nPreviewCaptionHeight) * 2 : baseRect.x + baseRect.width - 4 + nMainWidth + m_nPreviewMaterialWidth - m_nPreviewCaptionHeight), baseRect.y, m_nPreviewMaterialWidth - m_nPreviewCaptionHeight, m_nPreviewMaterialWidth);
        if (nIndex == 0)
        {
            GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 30 + nIndex, previewRect, winAlpha0, "Alpha0", styleButton);
        }
        else
        {
            GUI.Window(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 30 + nIndex, previewRect, winAlpha1, "Alpha1", styleButton);
        }
        GUI.BringWindowToFront(FXMakerLayout.GetWindowId(FXMakerLayout.WINDOWID.POPUP) + 30 + nIndex);

        m_PreviewTexture = oldTexture;
    }
Exemplo n.º 28
0
    public override void OnInspectorGUI()
    {
        AddScriptNameField(m_Sel);
        m_UndoManager.CheckUndo();

        Rect rect;

        // --------------------------------------------------------------
        bool bClickButton = false;

        EditorGUI.BeginChangeCheck();
        {
            m_Sel.m_fUserTag = EditorGUILayout.FloatField(GetCommonContent("m_fUserTag"), m_Sel.m_fUserTag);

            m_Sel.m_AddForce    = EditorGUILayout.Vector3Field("m_AddForce", m_Sel.m_AddForce, null);
            m_Sel.m_RandomRange = EditorGUILayout.Vector3Field("m_RandomRange", m_Sel.m_RandomRange, null);
            m_Sel.m_ForceMode   = (ForceMode)EditorGUILayout.EnumPopup(GetHelpContent("m_ForceMode"), m_Sel.m_ForceMode, GUILayout.MaxWidth(Screen.width));

            // check

            // --------------------------------------------------------------
            if (m_Sel.GetComponent <Rigidbody>() == false)
            {
                EditorGUILayout.Space();
                rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(m_fButtonHeight));
                {
                    FXMakerLayout.GUIColorBackup(FXMakerLayout.m_ColorHelpBox);
                    if (FXMakerLayout.GUIButton(rect, GetHelpContent("Add RigidBody Component"), true))
                    {
                        m_Sel.gameObject.AddComponent <Rigidbody>();
                    }
                    FXMakerLayout.GUIColorRestore();
                    GUILayout.Label("");
                }
                EditorGUILayout.EndHorizontal();
            }
        }
        m_UndoManager.CheckDirty();
        // --------------------------------------------------------------
        if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain())
        {
            OnEditComponent();
        }
        // ---------------------------------------------------------------------
        if (GUI.tooltip != "")
        {
            m_LastTooltip = GUI.tooltip;
        }
        HelpBox(m_LastTooltip);
    }
Exemplo n.º 29
0
    void DrawOverBox(Rect gridRect, GUIStyle styleButton, int nObjectIndex, Color color, int nImageMargin)
    {
        int nColumn = nObjectIndex % m_nObjectColumn;
        int nRow    = nObjectIndex / m_nObjectColumn;

        int   nMargin       = styleButton.margin.left;
        float fButtonWidth  = ((gridRect.width + (nMargin * 2)) / m_nObjectColumn);
        float fButtonHeight = (m_fButtonAspect * fButtonWidth) - 1f;

        Rect buttonRect = new Rect(fButtonWidth * nColumn + nMargin, fButtonHeight * nRow + nMargin, fButtonWidth - nMargin * 2, fButtonHeight - nMargin * 2);

        buttonRect = FXMakerLayout.GetOffsetRect(buttonRect, nImageMargin);
        NgGUIDraw.DrawBox(buttonRect, color, 2, false);
    }
    public override void OnInspectorGUI()
    {
        AddScriptNameField(m_Sel);
        m_UndoManager.CheckUndo();
        // --------------------------------------------------------------
        bool bClickButton = false;

        EditorGUI.BeginChangeCheck();
        {
//			DrawDefaultInspector();
            m_Sel.m_fScrollSpeedX  = EditorGUILayout.FloatField(GetHelpContent("m_fScrollSpeedX"), m_Sel.m_fScrollSpeedX);
            m_Sel.m_fScrollSpeedY  = EditorGUILayout.FloatField(GetHelpContent("m_fScrollSpeedY"), m_Sel.m_fScrollSpeedY);
            m_Sel.m_fTilingX       = EditorGUILayout.FloatField(GetHelpContent("m_fTilingX"), m_Sel.m_fTilingX);
            m_Sel.m_fTilingY       = EditorGUILayout.FloatField(GetHelpContent("m_fTilingY"), m_Sel.m_fTilingY);
            m_Sel.m_fOffsetX       = EditorGUILayout.FloatField(GetHelpContent("m_fOffsetX"), m_Sel.m_fOffsetX);
            m_Sel.m_fOffsetY       = EditorGUILayout.FloatField(GetHelpContent("m_fOffsetY"), m_Sel.m_fOffsetY);
            m_Sel.m_bFixedTileSize = EditorGUILayout.Toggle(GetHelpContent("m_bFixedTileSize"), m_Sel.m_bFixedTileSize);
            m_Sel.m_bRepeat        = EditorGUILayout.Toggle(GetHelpContent("m_bRepeat"), m_Sel.m_bRepeat);

            // Texture --------------------------------------------------------------
            Rect rect = EditorGUILayout.BeginHorizontal(GUILayout.Height(150));
            {
                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);
                }
                GUI.Box(rect, "");
            }
            EditorGUILayout.EndHorizontal();
        }
        m_UndoManager.CheckDirty();
        // --------------------------------------------------------------
        if ((EditorGUI.EndChangeCheck() || bClickButton) && GetFXMakerMain())
        {
            GetFXMakerMain().CreateCurrentInstanceEffect(true);
        }
        // ---------------------------------------------------------------------
        if (GUI.tooltip != "")
        {
            m_LastTooltip = GUI.tooltip;
        }
        HelpBox(m_LastTooltip);
    }
Exemplo n.º 31
0
    public static void WindowDescription(Rect popupRect, FXMakerLayout.WINDOWID winId, FxmPopup popup)
    {
        CheckValid(WindowDescriptionStr);

        Vector2	mousePos	= FXMakerLayout.GetGUIMousePosition();
        Rect	rectDesc	= FXMakerLayout.GetInnerTopRect(popupRect, 0, 19);
        string	tooltip		= "";

        if (rectDesc.Contains(mousePos) && GUI.enabled && (popup == null || popup.GetPopupRect().Contains(mousePos) == false))
        {
            switch (winId)
            {
                case FXMakerLayout.WINDOWID.TOP_CENTER			: tooltip = "MainToolbar\n" + WindowDescriptionStr[GetLang(), 0];			break;
                case FXMakerLayout.WINDOWID.EFFECT_LIST			: tooltip = "PREFAB_LIST\n" + WindowDescriptionStr[GetLang(), 1];			break;
                case FXMakerLayout.WINDOWID.EFFECT_HIERARCHY	: tooltip = "PREFAB_HIERARCHY\n" + WindowDescriptionStr[GetLang(), 2];		break;
                case FXMakerLayout.WINDOWID.EFFECT_CONTROLS		: tooltip = "PREFAB_CONTROLS\n" + WindowDescriptionStr[GetLang(), 3];		break;
                default: return;
            }
            FXMakerMain.inst.SaveTooltip(Tooltip(tooltip));
        }
    }