Esempio n. 1
0
 /// <summary> Panel to show all active "Values" and thier values while playing </summary>
 /// <param name="inlineHelp">Should help be displayed?</param>
 void ValuesPanel(bool inlineHelp)
 {
     ++EditorGUI.indentLevel;
     EditorGUILayout.BeginHorizontal();
     {
         if (m_editorUtils.Button("AddValueButton", GUILayout.Width(40)) && !string.IsNullOrEmpty(tmpValueName))
         {
             AmbienceManager.SetValue(tmpValueName, tmpValueValue);
             tmpValueName  = "";
             tmpValueValue = 0f;
         }
         tmpValueName = GUILayout.TextField(tmpValueName, GUILayout.ExpandWidth(true)); //GUILayout.Width(Mathf.Clamp(EditorStyles.textField.CalcSize(new GUIContent(tmpValueName + "|")).x, 80f, EditorGUIUtility.currentViewWidth * 0.5f)));
         //tmpValueValue = EditorGUILayout.Slider(tmpValueValue, 0f, 1f);
     }
     EditorGUILayout.EndHorizontal();
     foreach (KeyValuePair <string, float> Value in AmbienceManager.GetValues())
     {
         EditorGUILayout.BeginHorizontal();
         {
             if (m_editorUtils.Button("RemoveValueButton", GUILayout.Width(40)))
             {
                 AmbienceManager.RemoveValue(Value.Key);
             }
             string label = Value.Key;
             if (label.Length > 25)
             {
                 label = label.Substring(0, 25);
             }
             GUILayout.Label(new GUIContent(label, Value.Key), GUILayout.ExpandWidth(false));
             EditorGUI.BeginChangeCheck();
             float tmpVal = EditorGUILayout.Slider(Value.Value, 0f, 1f, GUILayout.ExpandWidth(true));
             if (EditorGUI.EndChangeCheck())
             {
                 AmbienceManager.SetValue(Value.Key, tmpVal);
             }
         }
         EditorGUILayout.EndHorizontal();
     }
     --EditorGUI.indentLevel;
 }