Ejemplo n.º 1
0
    protected void winPopup(int id)
    {
        Rect baseRect = GetPopupRect();

//      if (UnscreenClose())
//          return;

        // --------------------------------------------------------------------------------
        int  nProjectRows = m_nProjectCount / m_nProjectColumn + (0 < (m_nProjectCount % m_nProjectColumn) ? 1 : 0);
        int  nGroupRows   = m_nGroupCount / m_nGroupColumn + (0 < (m_nGroupCount % m_nGroupColumn) ? 1 : 0);
        int  nTopHeight   = (nProjectRows + (m_bOptionRecursively ? 0 : nGroupRows) + 2) * m_nMenuButtonHeight + m_nMenuButtonHeight / 2;
        Rect topRect      = FXMakerLayout.GetChildTopRect(baseRect, 0, nTopHeight);
        Rect scrollRect   = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1);
        Rect bottomRect   = FXMakerLayout.GetChildBottomRect(baseRect, m_nBottomHeight);

        // left Align ----------------------------------------------------------------
        if (m_bShowLeftPopup)
        {
            m_bShowLeftPopup = GUI.Toggle(new Rect(baseRect.width - 50, 1, baseRect.width, 16), m_bShowLeftPopup, "Left");
            if (GUI.changed)
            {
                EditorPrefs.SetBool(m_PrefsName + ".m_bShowLeftPopup", m_bShowLeftPopup);
            }
        }
        else
        {
            m_bShowLeftPopup = !GUI.Toggle(new Rect(3, 1, baseRect.width, 16), !m_bShowLeftPopup, "Right");
            if (GUI.changed)
            {
                EditorPrefs.SetBool(m_PrefsName + ".m_bShowLeftPopup", m_bShowLeftPopup);
            }
        }
        GUI.changed = false;

        bottomRect.y      -= 3;
        scrollRect.height -= (m_nBottomHeight + 3);
        DrawFolderList(topRect);
        DrawObjectList(scrollRect);
        DrawBottomRect(bottomRect);

        FXMakerMain.inst.SaveTooltip();
    }
Ejemplo n.º 2
0
    // ==========================================================================================================
    void winPopup(int id)
    {
        Rect     baseRect  = GetPopupRect();
        GUIStyle styleList = GUI.skin.GetStyle("List_Box");

        if (UnfocusClose(baseRect, 0, 0, 0, 0))
        {
            return;
        }

        // --------------------------------------------------------------------------------
        int  nMargin    = 5;
        int  nTopHeight = 25;
        Rect topRect    = FXMakerLayout.GetChildTopRect(baseRect, -nMargin, nTopHeight);
        Rect bottomRect = FXMakerLayout.GetChildVerticalRect(baseRect, nTopHeight, 1, 0, 1);
        Rect leftRect   = FXMakerLayout.GetInnerHorizontalRect(bottomRect, 6, 0, 6);

        // top - Name ----------------------------------------------------------------------------
        topRect = FXMakerLayout.GetOffsetRect(topRect, -nMargin / 2);
        GUI.Box(FXMakerLayout.GetOffsetRect(topRect, 0, -2, 0, 2), "");
        Rect nameRect = FXMakerLayout.GetInnerVerticalRect(topRect, 2, 0, 2);

        GUI.Label(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 0, 1), "Name");
        GUI.SetNextControlName("TextField");
//      FXMakerMain.inst.ToggleGlobalLangSkin(true);
        string newName = FXMakerLayout.GUITextField(FXMakerLayout.GetInnerHorizontalRect(nameRect, 5, 1, 4), m_SelectedTransform.name, m_SelectedTransform.gameObject != FXMakerMain.inst.GetOriginalEffectObject());

//      FXMakerMain.inst.ToggleGlobalLangSkin(false);
        if (m_SelectedTransform.name != newName)
        {
            m_SelectedTransform.name = newName;
            if (newName.Trim() != "" && m_SelectedTransform.gameObject == FXMakerMain.inst.GetOriginalEffectObject())
            {
                FXMakerEffect.inst.RenameCurrentPrefab(newName);
            }
        }
        if (Event.current.type == EventType.KeyDown && Event.current.character == '\n')
        {
            ClosePopup(true);
        }

        // left ----------------------------------------------------------------------------
        leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin / 2);
        GUI.Box(leftRect, "");
        leftRect = FXMakerLayout.GetOffsetRect(leftRect, -nMargin);
        Rect scrollRect     = FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 2, 15);
        int  scrollBarWidth = 13;
        int  nCellHeight    = 18;

        scrollRect.width -= scrollBarWidth;
        GUI.Box(scrollRect, "");

        // folder list
//		m_nGroupIndex		= GUI.SelectionGrid(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length);
        m_nGroupIndex = FXMakerLayout.TooltipSelectionGrid(GetPopupRect(), FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 0, 2), m_nGroupIndex, m_GroupContents, m_GroupContents.Length);

        if (GUI.changed)
        {
            LoadScriptList();
        }

        // script list
        Rect listRect = new Rect(0, 0, scrollRect.width - 1, nCellHeight * m_ScriptScrings.Length);

        m_PopupScrollPos = GUI.BeginScrollView(scrollRect, m_PopupScrollPos, listRect);
        GUI.changed      = false;
//		m_nPopupListIndex	= GUI.SelectionGrid(listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList);
        m_nPopupListIndex = FXMakerLayout.TooltipSelectionGrid(FXMakerLayout.GetOffsetRect(GetPopupRect(), 0, -m_PopupScrollPos.y), scrollRect, listRect, m_nPopupListIndex, m_ScriptContents, 1, styleList);

        if (GUI.changed && Input.GetMouseButtonUp(1))
        {
            AddScript(m_ScriptScrings[m_nPopupListIndex]);
        }

        GUI.EndScrollView();

        // Add script button
        if (0 <= m_nPopupListIndex && m_nPopupListIndex < m_ScriptContents.Length)
        {
            if (FXMakerLayout.GUIButton(FXMakerLayout.GetInnerVerticalRect(leftRect, 20, 17, 3), GetHelpContent("Add Component "), (m_ScriptScrings[m_nPopupListIndex] != "")))
            {
                AddScript(m_ScriptScrings[m_nPopupListIndex]);
                if (Input.GetMouseButtonUp(0))
                {
                    ClosePopup(true);
                }
            }
        }

        FXMakerMain.inst.SaveTooltip();
    }