Exemplo n.º 1
0
 private void GuiButtons()
 {
     GUILayout.Space(8);
     GUILayout.BeginHorizontal();
     if (GUILayout.Button("Add"))
     {
         LodUtil.Add <LodNode>(ref odData.nodes, new LodNode("role"));
     }
     if (GUILayout.Button("Save"))
     {
         odData.Save();
     }
     GUILayout.EndHorizontal();
 }
Exemplo n.º 2
0
        private void OnGUI()
        {
            var initiallyEnabled = GUI.enabled;

            if (SelectedLOD >= m_NumberOfLODs)
            {
                SelectedLOD = m_NumberOfLODs - 1;
            }
            GUILayout.BeginVertical();
            GUILayout.Space(10);

            GUILayout.BeginHorizontal();
            GUILayout.Label("Select Role: ");

            role_pop = EditorGUILayout.Popup(role_pop, roles);
            GUILayout.Space(8);
            if (GUILayout.Button("load"))
            {
                LoadRole(lodNode);
                UpdateInfo();
            }
            if (GUILayout.Button("save"))
            {
                float[] levels = m_LODs.Where(x => x.screenPercentage > 0 && x.screenPercentage < 1).Select(x => x.screenPercentage).ToArray();
                string  prefab = lodNode.prefab;
                config.AddorUpdate(prefab, levels);
                config.Save();
                LodExport.Export(m_LODs.ToArray(), lodNode);

                LodUtil.ReLoad(m_LODs, lodNode);
                return;
            }
            GUILayout.EndHorizontal();
            GUILayout.Space(18);

            var sliderBarPosition = GUILayoutUtility.GetRect(0, LODGUI.kSliderBarHeight, GUILayout.ExpandWidth(true));
            var lods = LODGUI.CreateLODInfos(m_NumberOfLODs, sliderBarPosition,
                                             i => string.Format("LOD {0}", i),
                                             i => m_LODs[i].screenPercentage);

            DrawLODLevelSlider(sliderBarPosition, lods);
            GUILayout.Space(LODGUI.kSliderBarBottomMargin);

            if (QualitySettings.lodBias != 1.0f)
            {
                EditorGUILayout.HelpBox(string.Format("Active LOD bias is {0:0.0#}. Distances are adjusted accordingly.", QualitySettings.lodBias), MessageType.Warning);
            }

            GUILayout.Space(8);
            GUILayout.Label(SelectedLOD < 0 ? "Culled" : "LOD " + SelectedLOD, LODGUI.selectStyle);
            GUILayout.Space(8);
            if (SelectedLOD >= 0)
            {
                var direct = m_LODs[SelectedLOD].GUI(m_direct);
                if (m_direct != direct)
                {
                    m_direct = direct;
                    UpdateBehavic();
                }
            }
            GUILayout.EndVertical();
        }