PackPlatformBaseGUI.cs 5.8 KB

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