コード例 #1
0
 private static string PrettyTemplateKeyName(string name)
 {
     string[] strArray = name.Split('_');
     strArray[0] = WebTemplateManagerBase.UppercaseFirst(strArray[0].ToLower());
     for (int index = 1; index < strArray.Length; ++index)
     {
         strArray[index] = strArray[index].ToLower();
     }
     return(string.Join(" ", strArray));
 }
コード例 #2
0
 private static string PrettyTemplateKeyName(string name)
 {
     string[] array = name.Split(new char[]
     {
         '_'
     });
     array[0] = WebTemplateManagerBase.UppercaseFirst(array[0].ToLower());
     for (int i = 1; i < array.Length; i++)
     {
         array[i] = array[i].ToLower();
     }
     return(string.Join(" ", array));
 }
コード例 #3
0
 public void SelectionUI(SerializedProperty templateProp)
 {
     if (WebTemplateManagerBase.s_Styles == null)
     {
         WebTemplateManagerBase.s_Styles = new WebTemplateManagerBase.Styles();
     }
     if (this.TemplateGUIThumbnails.Length < 1)
     {
         GUILayout.Label(EditorGUIUtility.TextContent("No templates found."), new GUILayoutOption[0]);
     }
     else
     {
         int  num     = Mathf.Min((int)Mathf.Max(((float)Screen.width - 30f) / 80f, 1f), this.TemplateGUIThumbnails.Length);
         int  num2    = Mathf.Max((int)Mathf.Ceil((float)this.TemplateGUIThumbnails.Length / (float)num), 1);
         bool changed = GUI.changed;
         templateProp.stringValue = this.Templates[WebTemplateManagerBase.ThumbnailList(GUILayoutUtility.GetRect((float)num * 80f, (float)num2 * 100f, new GUILayoutOption[]
         {
             GUILayout.ExpandWidth(false)
         }), this.GetTemplateIndex(templateProp.stringValue), this.TemplateGUIThumbnails, num)].ToString();
         bool flag     = !changed && GUI.changed;
         bool changed2 = GUI.changed;
         GUI.changed = false;
         string[] templateCustomKeys = PlayerSettings.templateCustomKeys;
         for (int i = 0; i < templateCustomKeys.Length; i++)
         {
             string text  = templateCustomKeys[i];
             string text2 = PlayerSettings.GetTemplateCustomValue(text);
             text2 = EditorGUILayout.TextField(WebTemplateManagerBase.PrettyTemplateKeyName(text), text2, new GUILayoutOption[0]);
             PlayerSettings.SetTemplateCustomValue(text, text2);
         }
         if (GUI.changed)
         {
             templateProp.serializedObject.Update();
         }
         GUI.changed |= changed2;
         if (flag)
         {
             GUIUtility.hotControl      = 0;
             GUIUtility.keyboardControl = 0;
             templateProp.serializedObject.ApplyModifiedProperties();
             PlayerSettings.templateCustomKeys = this.Templates[this.GetTemplateIndex(templateProp.stringValue)].CustomKeys;
             templateProp.serializedObject.Update();
         }
     }
 }
コード例 #4
0
 public void SelectionUI(SerializedProperty templateProp)
 {
     if (WebTemplateManagerBase.s_Styles == null)
     {
         WebTemplateManagerBase.s_Styles = new WebTemplateManagerBase.Styles();
     }
     if (this.TemplateGUIThumbnails.Length < 1)
     {
         GUILayout.Label(EditorGUIUtility.TextContent("No templates found."));
     }
     else
     {
         int  maxRowItems = Mathf.Min((int)Mathf.Max((float)(((double)Screen.width - 30.0) / 80.0), 1f), this.TemplateGUIThumbnails.Length);
         int  num         = Mathf.Max((int)Mathf.Ceil((float)this.TemplateGUIThumbnails.Length / (float)maxRowItems), 1);
         bool changed1    = GUI.changed;
         templateProp.stringValue = this.Templates[WebTemplateManagerBase.ThumbnailList(GUILayoutUtility.GetRect((float)((double)maxRowItems * 80.0), (float)((double)num * 100.0), new GUILayoutOption[1]
         {
             GUILayout.ExpandWidth(false)
         }), this.GetTemplateIndex(templateProp.stringValue), this.TemplateGUIThumbnails, maxRowItems)].ToString();
         bool flag     = !changed1 && GUI.changed;
         bool changed2 = GUI.changed;
         GUI.changed = false;
         foreach (string templateCustomKey in PlayerSettings.templateCustomKeys)
         {
             string templateCustomValue = PlayerSettings.GetTemplateCustomValue(templateCustomKey);
             string str = EditorGUILayout.TextField(WebTemplateManagerBase.PrettyTemplateKeyName(templateCustomKey), templateCustomValue, new GUILayoutOption[0]);
             PlayerSettings.SetTemplateCustomValue(templateCustomKey, str);
         }
         if (GUI.changed)
         {
             templateProp.serializedObject.Update();
         }
         GUI.changed |= changed2;
         if (!flag)
         {
             return;
         }
         GUIUtility.hotControl      = 0;
         GUIUtility.keyboardControl = 0;
         templateProp.serializedObject.ApplyModifiedProperties();
         PlayerSettings.templateCustomKeys = this.Templates[this.GetTemplateIndex(templateProp.stringValue)].CustomKeys;
         templateProp.serializedObject.Update();
     }
 }
コード例 #5
0
        private static int ThumbnailList(Rect rect, int selection, GUIContent[] thumbnails, int maxRowItems)
        {
            int num    = 0;
            int index1 = 0;

            while (index1 < thumbnails.Length)
            {
                for (int index2 = 0; index2 < maxRowItems && index1 < thumbnails.Length; ++index1)
                {
                    if (WebTemplateManagerBase.ThumbnailListItem(new Rect(rect.x + (float)index2 * 80f, rect.y + (float)num * 100f, 80f, 100f), index1 == selection, thumbnails[index1]))
                    {
                        selection = index1;
                    }
                    ++index2;
                }
                ++num;
            }
            return(selection);
        }
コード例 #6
0
        private static int ThumbnailList(Rect rect, int selection, GUIContent[] thumbnails, int maxRowItems)
        {
            int num = 0;
            int i   = 0;

            while (i < thumbnails.Length)
            {
                int num2 = 0;
                while (num2 < maxRowItems && i < thumbnails.Length)
                {
                    if (WebTemplateManagerBase.ThumbnailListItem(new Rect(rect.x + (float)num2 * 80f, rect.y + (float)num * 100f, 80f, 100f), i == selection, thumbnails[i]))
                    {
                        selection = i;
                    }
                    num2++;
                    i++;
                }
                num++;
            }
            return(selection);
        }