static void DrawContentPlatfom() { EditorGUI.BeginChangeCheck(); var targetGroupList = PlatformUtils.GetSupportList(); GUILayout.BeginVertical(EditorStyles.helpBox); GUILayout.Label(S._Selectplatformtouse); foreach (var t in targetGroupList) { EditorGUI.BeginChangeCheck(); var _b = HEditorGUILayout.ToggleLeft(P.GetPlatform(t).enable, t.Icon(), t.GetName()); if (EditorGUI.EndChangeCheck()) { P.GetPlatform(t).enable = _b; BuildAssistWindow.ChangeActiveTarget(); } } GUILayout.EndVertical(); if (EditorGUI.EndChangeCheck()) { s_changed = true; } }
public static void ChangeActiveTarget() { if (!P.GetPlatform(P.i.selectBuildTargetGroup).enable) { //int cur = (int)P.i.selectBuildTargetGroup; var lst = PlatformUtils.GetSupportList(); int cur = lst.IndexOf(P.i.selectBuildTargetGroup); bool finded = false; int idx = cur - 1; while (0 <= idx) { if (P.GetPlatform(lst[idx]).enable) { finded = true; goto find; } idx--; } idx = cur + 1; while (idx < lst.Count) { if (P.GetPlatform(lst[idx]).enable) { finded = true; goto find; } idx++; } find: if (finded) { P.i.selectBuildTargetGroup = lst[idx]; } else { P.i.selectBuildTargetGroup = BuildTargetGroup.Unknown; } P.Save(); } s_window.MakeDrawBuildTarget(); Repaint(); }
/// <summary> /// ツールバーを描画します /// </summary> void DrawToolBar() { GUILayout.BeginHorizontal(Styles.toolbar); EditorGUI.BeginChangeCheck(); P.i.selectScene = HGUILayoutToolbar.Toggle(P.i.selectScene, EditorHelper.TempContent("Scenes in Build"), Styles.toolbarButtonBold); if (EditorGUI.EndChangeCheck()) { P.Save(); } var lst = m_supportBuildTarget.Where(x => P.GetPlatform(x).enable).ToArray(); var reo = Styles.toolbarbutton.padding; var active = UnityEditorUserBuildSettings.activeBuildTargetGroup; for (int i = 0; i < lst.Length; i++) { var s = lst[i]; EditorGUI.BeginChangeCheck(); var style = Styles.toolbarbutton; if (active == s) { style = Styles.toolbarbuttonActive; } var cont = EditorHelper.TempContent(s.GetShortName(), s.Icon()); var size = style.CalcSize(cont); size.x -= 8; EditorGUI.BeginChangeCheck(); HGUILayoutToolbar.Toggle(P.i.selectBuildTargetGroup == s && P.i.selectScene == false, cont, style, GUILayout.Width(size.x)); if (EditorGUI.EndChangeCheck()) { P.i.selectScene = false; } if (active == s) { var rc = GUILayoutUtility.GetLastRect(); rc.x -= 4; rc = rc.AlignCenterH(16); if (EditorHelper.IsDefine("UNITY_2019_3_OR_NEWER")) { rc.y += 1; } GUI.DrawTexture(rc.AlignR(16), EditorIcon.SceneAsset, ScaleMode.ScaleToFit); } if (EditorGUI.EndChangeCheck()) { P.i.selectBuildTargetGroup = s; P.Save(); ChangeActiveTarget(); } } GUILayout.FlexibleSpace(); if (_enableBuildReport) { if (HGUILayoutToolbar.Button("Build Report")) { EditorApplication.ExecuteMenuItem(Window_Show_Build_Report); } } if (HGUILayoutToolbar.Button(Styles.iconSettings)) { PreferenceWindow.Open(this); } GUILayout.EndHorizontal(); }