public void SelectionUI(SerializedProperty templateProp) { if (s_Styles == null) { s_Styles = new Styles(); } if (TemplateGUIThumbnails.Length < 1) { GUILayout.Label(EditorGUIUtility.TrTextContent("No templates found.")); } else { int numCols = Mathf.Min((int)Mathf.Max((Screen.width - kWebTemplateGridPadding * 2.0f) / kThumbnailSize, 1.0f), TemplateGUIThumbnails.Length); int numRows = Mathf.Max((int)Mathf.Ceil((float)TemplateGUIThumbnails.Length / (float)numCols), 1); bool wasChanged = GUI.changed; templateProp.stringValue = Templates[ ThumbnailList( GUILayoutUtility.GetRect(numCols * kThumbnailSize, numRows * (kThumbnailSize + kThumbnailLabelHeight), GUILayout.ExpandWidth(false)), GetTemplateIndex(templateProp.stringValue), TemplateGUIThumbnails, numCols )].ToString(); bool templateChanged = !wasChanged && GUI.changed; bool orgChanged = GUI.changed; GUI.changed = false; foreach (string key in PlayerSettings.templateCustomKeys) { string value = PlayerSettings.GetTemplateCustomValue(key); value = EditorGUILayout.TextField(PrettyTemplateKeyName(key), value); PlayerSettings.SetTemplateCustomValue(key, value); } if (GUI.changed) { templateProp.serializedObject.Update(); } GUI.changed |= orgChanged; if (templateChanged) { GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; templateProp.serializedObject.ApplyModifiedProperties(); PlayerSettings.templateCustomKeys = Templates[GetTemplateIndex(templateProp.stringValue)].CustomKeys; templateProp.serializedObject.Update(); } } }
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(); } } }
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(); } }
public void SelectionUI(SerializedProperty templateProp) { if (s_Styles == null) { s_Styles = new Styles(); } if (this.TemplateGUIThumbnails.Length < 1) { GUILayout.Label(EditorGUIUtility.TextContent("No templates found."), new GUILayoutOption[0]); } else { int maxRowItems = Mathf.Min((int)Mathf.Max((float)((Screen.width - 30f) / 80f), (float)1f), this.TemplateGUIThumbnails.Length); int num2 = Mathf.Max((int)Mathf.Ceil(((float)this.TemplateGUIThumbnails.Length) / ((float)maxRowItems)), 1); bool changed = GUI.changed; GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.ExpandWidth(false) }; templateProp.stringValue = this.Templates[ThumbnailList(GUILayoutUtility.GetRect((float)(maxRowItems * 80f), (float)(num2 * 100f), options), this.GetTemplateIndex(templateProp.stringValue), this.TemplateGUIThumbnails, maxRowItems)].ToString(); bool flag2 = !changed && GUI.changed; bool flag3 = GUI.changed; GUI.changed = false; foreach (string str in PlayerSettings.templateCustomKeys) { string templateCustomValue = PlayerSettings.GetTemplateCustomValue(str); templateCustomValue = EditorGUILayout.TextField(PrettyTemplateKeyName(str), templateCustomValue, new GUILayoutOption[0]); PlayerSettings.SetTemplateCustomValue(str, templateCustomValue); } if (GUI.changed) { templateProp.serializedObject.Update(); } GUI.changed |= flag3; if (flag2) { GUIUtility.hotControl = 0; GUIUtility.keyboardControl = 0; templateProp.serializedObject.ApplyModifiedProperties(); PlayerSettings.templateCustomKeys = this.Templates[this.GetTemplateIndex(templateProp.stringValue)].CustomKeys; templateProp.serializedObject.Update(); } } }