Exemplo n.º 1
0
    void BuildResourceContents()
    {
        CancelInvoke("BuildResourceContents");
        if (enabled == false)
        {
            return;
        }
        int nNotLoadPreviewCount = 0;

        for (int n = 0; n < m_CloneTypeCount; n++)
        {
            for (int i = 0; i < m_ClonePrefabs[n].Length; i++)
            {
                if (m_CloneContents[n][i] == null)
                {
                    m_CloneContents[n][i]         = new GUIContent();
                    m_CloneContents[n][i].text    = m_ClonePrefabs[n][i].name;
                    m_CloneContents[n][i].tooltip = FXMakerTooltip.GetHsToolBackground("RESOURCE_HOVER", m_ClonePrefabs[n][i].name);
                }
                if (m_CloneContents[n][i].image == null)
                {
                    m_CloneContents[n][i].image = FXMakerMain.inst.GetPrefabThumbTexture(m_ClonePrefabs[n][i]);
                }
                if (m_CloneContents[n][i].image == null)
                {
                    nNotLoadPreviewCount++;
                }
            }
        }
        if (0 < nNotLoadPreviewCount)
        {
            Invoke("BuildResourceContents", FXMakerLayout.m_fReloadPreviewTime);
        }
    }
Exemplo n.º 2
0
    public void LoadProject()
    {
        NgUtil.LogDevelop("LoadProject - FxmBackMain");
        // group 弃歹甸 捞抚 阂矾坷扁
        if (m_bGroupFoler)
        {
            string[] groupFolerStrings = NgAsset.GetFolderList(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), null, null, FXMakerOption.inst.m_nMinTopToolbarCount, out m_nGroupCount);
            m_GroupFolerContents = NgConvert.StringsToContents(groupFolerStrings);
            for (int n = 0; n < m_GroupFolerContents.Length; n++)
            {
                if (m_GroupFolerContents[n].text == null)
                {
                    m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("EMPTYGROUP_HOVER", FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS));
                }
                else
                {
                    m_GroupFolerContents[n].tooltip = FXMakerTooltip.GetHsToolBackground("GROUP_HOVER", m_GroupFolerContents[n].text);
                }
            }
        }
        else
        {
            m_GroupFolerContents    = new GUIContent[1];
            m_GroupFolerContents[0] = new GUIContent("", "");
            m_nGroupCount           = 1;
        }

        // 固府 沥狼等 府家胶 肺靛
        LoadResourceFolder();
        // 捞傈 急琶沥焊 贸府
        int nGroupIndex      = 0;
        int nBackgroundIndex = 0;

        if (FXMakerLayout.m_bDevelopPrefs == false)
        {
            nGroupIndex      = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nGroupIndex", 0);
            nBackgroundIndex = UnityEditor.EditorPrefs.GetInt("FXMakerBackground.m_nBackgroundIndex", 0);
        }
        SelectToolbar(nGroupIndex, nBackgroundIndex);

        // default Background
        if (m_CurrentBackgroundInfo == null)
        {
            SelectToolbar(0, 0);
        }
    }
Exemplo n.º 3
0
    // BackgroundFolder郴狼 prefab list客 捞抚备己窍扁, selectPrefabPath甫 瘤沥且 版快 BackgroundIndex 府畔
    int LoadBackgroundFolder(string selectPrefabPath)
    {
//      Debug.Log(selectPrefabPath);
        NgUtil.ClearObjects(m_BackgroundPrefabs);
        m_nBackgroundCount = 0;

        // load Group
        if (0 < m_nGroupCount)
        {
            // load Background Folder
            string loaddir = NgFile.CombinePath(FXMakerMain.inst.GetResourceDir(FXMakerMain.TOOLDIR_TYPE.BACKGROUNDPREFABS), m_GroupFolerContents[m_nGroupIndex].text);
//          Debug.Log(loaddir);
            m_BackgroundPrefabs  = NgAsset.GetPrefabList(loaddir, false, true, 0, out m_nBackgroundCount);
            m_BackgroundContents = new GUIContent[Mathf.Max(m_nBackgroundCount, FXMakerOption.inst.m_nMinBottomToolbarCount)];
            for (int n = 0; n < m_BackgroundPrefabs.Length; n++)
            {
                GUIContent econ = new GUIContent();
                econ.image              = FXMakerMain.inst.GetPrefabThumbTexture(m_BackgroundPrefabs[n]);
                econ.text               = m_BackgroundPrefabs[n].name;
                econ.tooltip            = FXMakerTooltip.GetHsToolBackground("BACKGROUND_HOVER", m_BackgroundPrefabs[n].name);
                m_BackgroundContents[n] = econ;
            }
            for (int n = m_BackgroundPrefabs.Length; n < FXMakerOption.inst.m_nMinBottomToolbarCount; n++)
            {
                GUIContent econ = new GUIContent();
                econ.image              = null;
                econ.text               = "";
                econ.tooltip            = FXMakerTooltip.GetHsToolBackground("EMPTYBACKGROUND_HOVER", "");
                m_BackgroundContents[n] = econ;
            }

            // select prefab
            if (selectPrefabPath != "")
            {
                return(NgAsset.FindPathIndex(loaddir, selectPrefabPath, "prefab"));
            }
        }
        else
        {
        }
        return(-1);
    }
Exemplo n.º 4
0
    // ==========================================================================================================
    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();
    }