PackPlatformBaseGUI.cs 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. using System;
  2. using System.Collections;
  3. using System.Collections.Generic;
  4. using System.IO;
  5. using UnityEngine;
  6. using UnityEditor;
  7. namespace Pack
  8. {
  9. public partial class PackPlatformBase
  10. {
  11. private FileReorderableList m_SplashScreenReorderableList;
  12. private static int[] s_ObscureOffsetValues = new int[]
  13. {
  14. 0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31
  15. };
  16. protected bool IsBuildRes = true;
  17. public void DrawGUI(bool editable, PackPlatformBase sourcePackPlatform)
  18. {
  19. PackGUI.BeginChangeLabelWidth(250);
  20. EditorGUI.BeginDisabledGroup(!editable);
  21. EditorGUILayout.BeginVertical();
  22. EditorGUILayout.BeginVertical(PackGUI.styles.box);
  23. EditorGUILayout.LabelField("基本信息", PackGUI.styles.boldLabel);
  24. EditorGUI.indentLevel += 1;
  25. EditorGUILayout.Space();
  26. PackGUI.DrawDelayedTextField("渠道名字", sourcePackPlatform.channelName, ref channelName, true);
  27. PackGUI.DrawDelayedTextField("游戏名字", sourcePackPlatform.appName, ref appName, true);
  28. PackGUI.DrawDelayedTextField("发布名字", sourcePackPlatform.distributeName, ref distributeName, true);
  29. PackGUI.DrawDelayedIntField("唯一名字(工具打包时使用名字)", "目前使用规则\n目标平台 * 10000000 + 渠道 * 1000 + 对应版本", sourcePackPlatform.channelUniqueId, ref channelUniqueId, true);
  30. PackGUI.DrawDelayedTextField("游戏bundleId", sourcePackPlatform.bundleId, ref bundleId, true);
  31. PackGUI.DrawVersionCodeField("App版本号", false, sourcePackPlatform.gameVersionCode, ref gameVersionCode);
  32. PackGUI.DrawVersionCodeField("Res版本号", false, sourcePackPlatform.resVersionCode, ref resVersionCode);
  33. PackGUI.DrawSelectFolderField("AppIcon的路径", Application.dataPath + PackConstant.AppIconSourcePath, sourcePackPlatform.iconRelativePath, ref iconRelativePath);
  34. PackGUI.DrawToggleField("打包资源","1111",false,ref IsBuildRes);
  35. EditorGUI.indentLevel -= 1;
  36. EditorGUILayout.EndVertical();
  37. if (HasPlatformGameGUI())
  38. {
  39. EditorGUILayout.Space();
  40. EditorGUILayout.BeginVertical(PackGUI.styles.box);
  41. EditorGUILayout.LabelField("游戏信息", PackGUI.styles.boldLabel);
  42. EditorGUI.indentLevel += 1;
  43. DrawPlatformGameGUI(editable, sourcePackPlatform);
  44. EditorGUI.indentLevel -= 1;
  45. EditorGUILayout.EndVertical();
  46. }
  47. if (HasPlatformSpecialGUI())
  48. {
  49. EditorGUILayout.Space();
  50. EditorGUILayout.BeginVertical(PackGUI.styles.box);
  51. EditorGUILayout.LabelField("其它信息", PackGUI.styles.boldLabel);
  52. EditorGUI.indentLevel += 1;
  53. DrawPlatformSpecialGUI(editable, sourcePackPlatform);
  54. EditorGUI.indentLevel -= 1;
  55. EditorGUILayout.EndVertical();
  56. }
  57. EditorGUILayout.Space();
  58. EditorGUILayout.BeginVertical(PackGUI.styles.box);
  59. EditorGUILayout.BeginHorizontal();
  60. EditorGUILayout.LabelField("打包后的App路径", PackGUI.styles.boldLabel);
  61. PackGUI.BeginChangeEnabled(true);
  62. if (GUILayout.Button("打开文件夹", PackGUI.styles.miniButton, GUILayout.Width(110)))
  63. {
  64. string curAbsPath = GetBuildOutputPath();
  65. if (File.Exists(curAbsPath))
  66. {
  67. EditorUtility.OpenWithDefaultApp(Path.GetDirectoryName(curAbsPath));
  68. }
  69. else if (Directory.Exists(curAbsPath))
  70. {
  71. EditorUtility.OpenWithDefaultApp(curAbsPath);
  72. }
  73. else
  74. {
  75. EditorUtility.DisplayDialog("提示", "还未编译过,无法找到该文件或文件夹", "好的");
  76. }
  77. }
  78. PackGUI.EndChangeEnabled();
  79. EditorGUILayout.EndHorizontal();
  80. EditorGUI.indentLevel += 1;
  81. EditorGUILayout.LabelField(GetBuildOutputPath(), PackGUI.styles.label);
  82. EditorGUILayout.Space();
  83. EditorGUI.indentLevel -= 1;
  84. EditorGUILayout.EndVertical();
  85. EditorGUILayout.Space();
  86. EditorGUILayout.EndVertical();
  87. PackGUI.EndAllChangeGUIBgColor();
  88. EditorGUI.EndDisabledGroup();
  89. PackGUI.EndAllChangeLabelWidth();
  90. }
  91. public virtual void DrawVersionCodeGUI(bool editable, PackPlatformBase sourcePackPlatform)
  92. {
  93. PackGUI.BeginChangeLabelWidth(220);
  94. PackGUI.BeginChangeEnabled(editable);
  95. EditorGUILayout.BeginVertical(PackGUI.styles.box);
  96. EditorGUILayout.LabelField(GetChannelUniqueName() + " " + channelUniqueId, PackGUI.styles.boldLabel);
  97. EditorGUILayout.Space();
  98. EditorGUI.indentLevel += 1;
  99. PackGUI.DrawVersionCodeField("App版本号", false, sourcePackPlatform.gameVersionCode, ref gameVersionCode);
  100. PackGUI.DrawVersionCodeField("Res版本号", false, sourcePackPlatform.resVersionCode, ref resVersionCode);
  101. EditorGUI.indentLevel -= 1;
  102. EditorGUILayout.EndVertical();
  103. PackGUI.EndChangeEnabled();
  104. PackGUI.EndChangeLabelWidth();
  105. }
  106. protected virtual bool HasPlatformGameGUI()
  107. {
  108. return true;
  109. }
  110. protected virtual void DrawPlatformGameGUI(bool editable, PackPlatformBase sourcePackPlatform)
  111. {
  112. }
  113. protected virtual bool HasPlatformSpecialGUI()
  114. {
  115. return false;
  116. }
  117. protected virtual void DrawPlatformSpecialGUI(bool editable, PackPlatformBase sourcePackPlatform)
  118. {
  119. }
  120. }
  121. }