com.typhoon.unitysdk 1.0.35 → 1.0.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/Editor/ApplyTool.cs +28 -2
  2. package/Editor/ExportModule.cs +1 -0
  3. package/Editor/GUIDrawer.cs +16 -0
  4. package/Editor/PluginModuleInstaller.cs +36 -16
  5. package/Editor/PreferencesWindow.cs +1 -1
  6. package/Editor/PublishProcess.cs +5 -4
  7. package/Editor/PublishSetting.cs +3 -0
  8. package/Editor/PublishSettingGUIDrawer.cs +27 -1
  9. package/Editor/PublishTool.cs +3 -3
  10. package/Editor/PublishWindow.cs +1 -3
  11. package/Editor/Texture/age_12.png +0 -0
  12. package/Editor/Texture/age_12.png.meta +144 -0
  13. package/Editor/Texture/age_16.png +0 -0
  14. package/Editor/Texture/age_16.png.meta +144 -0
  15. package/Editor/Texture/age_8.png +0 -0
  16. package/Editor/Texture/age_8.png.meta +144 -0
  17. package/Editor/UniEditor.cs +184 -68
  18. package/Editor/VivoMiniConfig.cs +186 -5
  19. package/Editor/WxMiniConfig.cs +5 -3
  20. package/Editor/bats/create-sign.bat +3 -2
  21. package/Editor/dll/AlphaFS.dll +0 -0
  22. package/Editor/dll/AlphaFS.dll.meta +33 -0
  23. package/Editor/dll/PNGCompressor.dll +0 -0
  24. package/Editor/dll/PNGCompressor.dll.meta +33 -0
  25. package/Editor/dll.meta +8 -0
  26. package/Runtime/AgeLevel.cs +12 -0
  27. package/Runtime/AgeLevel.cs.meta +11 -0
  28. package/Runtime/AndroidInstance.cs +1 -1
  29. package/Runtime/Extension.cs +8 -2
  30. package/Runtime/TyphoonSdk.cs +1 -0
  31. package/Runtime/TyphoonSdkCallback.cs +11 -5
  32. package/Sources~/Package/ChinaAndroid.unitypackage +0 -0
  33. package/Sources~/Package/Douyin.unitypackage +0 -0
  34. package/Sources~/Package/GooglePlay.unitypackage +0 -0
  35. package/Sources~/Package/VivoMini.unitypackage +0 -0
  36. package/Sources~/Package/VivoMini.unitypackage.manifest +244 -0
  37. package/Sources~/Package/WxMini.unitypackage +0 -0
  38. package/Sources~/Package//345/270/270/347/224/250/346/211/223/345/214/205/351/205/215/347/275/256.unitypackage +0 -0
  39. package/package.json +1 -1
  40. /package/Editor/{XGameDotNetZip.dll → dll/XGameDotNetZip.dll} +0 -0
  41. /package/Editor/{XGameDotNetZip.dll.meta → dll/XGameDotNetZip.dll.meta} +0 -0
@@ -0,0 +1,144 @@
1
+ fileFormatVersion: 2
2
+ guid: 0b7f2e52983b2114eb2a72ed03a0c107
3
+ TextureImporter:
4
+ internalIDToNameTable: []
5
+ externalObjects: {}
6
+ serializedVersion: 11
7
+ mipmaps:
8
+ mipMapMode: 0
9
+ enableMipMap: 1
10
+ sRGBTexture: 1
11
+ linearTexture: 0
12
+ fadeOut: 0
13
+ borderMipMap: 0
14
+ mipMapsPreserveCoverage: 0
15
+ alphaTestReferenceValue: 0.5
16
+ mipMapFadeDistanceStart: 1
17
+ mipMapFadeDistanceEnd: 3
18
+ bumpmap:
19
+ convertToNormalMap: 0
20
+ externalNormalMap: 0
21
+ heightScale: 0.25
22
+ normalMapFilter: 0
23
+ isReadable: 0
24
+ streamingMipmaps: 0
25
+ streamingMipmapsPriority: 0
26
+ vTOnly: 0
27
+ grayScaleToAlpha: 0
28
+ generateCubemap: 6
29
+ cubemapConvolution: 0
30
+ seamlessCubemap: 0
31
+ textureFormat: 1
32
+ maxTextureSize: 2048
33
+ textureSettings:
34
+ serializedVersion: 2
35
+ filterMode: 1
36
+ aniso: 1
37
+ mipBias: 0
38
+ wrapU: 0
39
+ wrapV: 0
40
+ wrapW: 0
41
+ nPOTScale: 1
42
+ lightmap: 0
43
+ compressionQuality: 50
44
+ spriteMode: 0
45
+ spriteExtrude: 1
46
+ spriteMeshType: 1
47
+ alignment: 0
48
+ spritePivot: {x: 0.5, y: 0.5}
49
+ spritePixelsToUnits: 100
50
+ spriteBorder: {x: 0, y: 0, z: 0, w: 0}
51
+ spriteGenerateFallbackPhysicsShape: 1
52
+ alphaUsage: 1
53
+ alphaIsTransparency: 1
54
+ spriteTessellationDetail: -1
55
+ textureType: 0
56
+ textureShape: 1
57
+ singleChannelComponent: 0
58
+ flipbookRows: 1
59
+ flipbookColumns: 1
60
+ maxTextureSizeSet: 0
61
+ compressionQualitySet: 0
62
+ textureFormatSet: 0
63
+ ignorePngGamma: 0
64
+ applyGammaDecoding: 0
65
+ platformSettings:
66
+ - serializedVersion: 3
67
+ buildTarget: DefaultTexturePlatform
68
+ maxTextureSize: 2048
69
+ resizeAlgorithm: 0
70
+ textureFormat: -1
71
+ textureCompression: 1
72
+ compressionQuality: 50
73
+ crunchedCompression: 0
74
+ allowsAlphaSplitting: 0
75
+ overridden: 0
76
+ androidETC2FallbackOverride: 0
77
+ forceMaximumCompressionQuality_BC6H_BC7: 0
78
+ - serializedVersion: 3
79
+ buildTarget: Standalone
80
+ maxTextureSize: 2048
81
+ resizeAlgorithm: 0
82
+ textureFormat: -1
83
+ textureCompression: 1
84
+ compressionQuality: 50
85
+ crunchedCompression: 0
86
+ allowsAlphaSplitting: 0
87
+ overridden: 0
88
+ androidETC2FallbackOverride: 0
89
+ forceMaximumCompressionQuality_BC6H_BC7: 0
90
+ - serializedVersion: 3
91
+ buildTarget: iPhone
92
+ maxTextureSize: 2048
93
+ resizeAlgorithm: 0
94
+ textureFormat: -1
95
+ textureCompression: 1
96
+ compressionQuality: 50
97
+ crunchedCompression: 0
98
+ allowsAlphaSplitting: 0
99
+ overridden: 0
100
+ androidETC2FallbackOverride: 0
101
+ forceMaximumCompressionQuality_BC6H_BC7: 0
102
+ - serializedVersion: 3
103
+ buildTarget: WebGL
104
+ maxTextureSize: 2048
105
+ resizeAlgorithm: 0
106
+ textureFormat: -1
107
+ textureCompression: 1
108
+ compressionQuality: 50
109
+ crunchedCompression: 0
110
+ allowsAlphaSplitting: 0
111
+ overridden: 0
112
+ androidETC2FallbackOverride: 0
113
+ forceMaximumCompressionQuality_BC6H_BC7: 0
114
+ - serializedVersion: 3
115
+ buildTarget: Android
116
+ maxTextureSize: 2048
117
+ resizeAlgorithm: 0
118
+ textureFormat: -1
119
+ textureCompression: 1
120
+ compressionQuality: 50
121
+ crunchedCompression: 0
122
+ allowsAlphaSplitting: 0
123
+ overridden: 0
124
+ androidETC2FallbackOverride: 0
125
+ forceMaximumCompressionQuality_BC6H_BC7: 0
126
+ spriteSheet:
127
+ serializedVersion: 2
128
+ sprites: []
129
+ outline: []
130
+ physicsShape: []
131
+ bones: []
132
+ spriteID:
133
+ internalID: 0
134
+ vertices: []
135
+ indices:
136
+ edges: []
137
+ weights: []
138
+ secondaryTextures: []
139
+ spritePackingTag:
140
+ pSDRemoveMatte: 0
141
+ pSDShowRemoveMatteOption: 0
142
+ userData:
143
+ assetBundleName:
144
+ assetBundleVariant:
@@ -4,9 +4,11 @@ using System.Diagnostics;
4
4
  using System.IO;
5
5
  using System.Linq;
6
6
  using System.Text;
7
+ using System.Threading.Tasks;
7
8
  using UnityEditor;
8
9
  using UnityEngine;
9
10
  using Debug = UnityEngine.Debug;
11
+ using AlphaDirectory = Alphaleonis.Win32.Filesystem.Directory;
10
12
 
11
13
  namespace TyphoonUnitySDK
12
14
  {
@@ -219,13 +221,11 @@ namespace TyphoonUnitySDK
219
221
  var assemblies = AppDomain.CurrentDomain.GetAssemblies();
220
222
  foreach (var element in assemblies)
221
223
  {
222
- var types = element.GetTypes();
223
- foreach (var type in types)
224
+ var type = element.GetType(typeName);
225
+
226
+ if (type != null)
224
227
  {
225
- if (type.FullName == typeName)
226
- {
227
- return type;
228
- }
228
+ return type;
229
229
  }
230
230
  }
231
231
 
@@ -412,6 +412,81 @@ namespace TyphoonUnitySDK
412
412
  }
413
413
  }
414
414
 
415
+
416
+ /// <summary>
417
+ /// 复制文件夹,带进度
418
+ /// </summary>
419
+ public static async Task CopyFolderWithProcess(string from, string to, Action<float> onProcess, Action complete,
420
+ int stepUnit = 200)
421
+ {
422
+ var dir = new HashSet<string>();
423
+ var files = new Dictionary<string, string>();
424
+ GetCopyFolderManifest(from, to, dir, files);
425
+ var total = dir.Count + files.Count;
426
+ var current = 0;
427
+ var step = 0;
428
+ if (total <= 0)
429
+ {
430
+ complete?.Invoke();
431
+ return;
432
+ }
433
+
434
+ foreach (var element in dir)
435
+ {
436
+ current += 1;
437
+ step += 1;
438
+ if (!Directory.Exists(element))
439
+ {
440
+ Directory.CreateDirectory(element);
441
+ }
442
+
443
+ if (step > stepUnit)
444
+ {
445
+ step = 0;
446
+ onProcess?.Invoke((float)current / total);
447
+ await Task.Yield();
448
+ }
449
+ }
450
+
451
+ foreach (var element in files)
452
+ {
453
+ current += 1;
454
+ step += 1;
455
+ var copyFrom = element.Key;
456
+ var copyTo = element.Value;
457
+ File.Copy(copyFrom, copyTo, true);
458
+ if (step > stepUnit)
459
+ {
460
+ step = 0;
461
+ onProcess?.Invoke((float)current / total);
462
+ await Task.Yield();
463
+ }
464
+ }
465
+
466
+ complete?.Invoke();
467
+ }
468
+
469
+
470
+ private static void GetCopyFolderManifest(string from, string to, HashSet<string> dirData,
471
+ Dictionary<string, string> filesData)
472
+ {
473
+ dirData.Add(to);
474
+ var info = new DirectoryInfo(from);
475
+ var files = info.GetFiles("*", SearchOption.TopDirectoryOnly);
476
+ var dir = info.GetDirectories("*", SearchOption.TopDirectoryOnly);
477
+ foreach (var element in files)
478
+ {
479
+ var copyTo = $"{to}/{element.Name}";
480
+ filesData[element.FullName] = copyTo;
481
+ }
482
+
483
+ foreach (var element in dir)
484
+ {
485
+ var copyDir = $"{to}/{element.Name}";
486
+ GetCopyFolderManifest(element.FullName, copyDir, dirData, filesData);
487
+ }
488
+ }
489
+
415
490
  /// <summary>
416
491
  /// 尝试删除文件夹
417
492
  /// </summary>
@@ -539,6 +614,7 @@ namespace TyphoonUnitySDK
539
614
  conf = conf.Replace("/", "\\");
540
615
  code = code.Replace("$OPENSSL_BIN$", bin);
541
616
  code = code.Replace("$OPENSSL_CONF$", conf);
617
+ code = code.Replace("$SIGN$", $"{ToWindowsExplorerFullPath("sign")}");
542
618
  File.WriteAllText(bat, code);
543
619
  if (!File.Exists(bat))
544
620
  {
@@ -547,99 +623,139 @@ namespace TyphoonUnitySDK
547
623
  else
548
624
  {
549
625
  RunBat(bat);
550
- // if (File.Exists(private_pem) && File.Exists(certificate_pem))
551
- // {
552
- // var private_pem_to = $"sign/{Path.GetFileName(private_pem)}";
553
- // var certificate_pem_to = $"sign/{Path.GetFileName(certificate_pem)}";
554
- // File.Copy(private_pem, private_pem_to, true);
555
- // File.Copy(certificate_pem, certificate_pem_to, true);
556
- // Debug.Log("生成成功");
557
- // }
558
- // else
559
- // {
560
- // throw new Exception($"生成失败,找不到:{private_pem} 或 {certificate_pem}");
561
- // }
562
626
  }
563
627
  }
564
628
  }
565
629
 
566
630
 
567
631
  /// <summary>
568
- /// 执行批处理
632
+ /// 转windows全路径
569
633
  /// </summary>
570
- public static void RunBat(string path, string args = "", Action complete = null)
634
+ public static string ToWindowsExplorerFullPath(string path)
571
635
  {
572
- // var bat = Path.GetFullPath(path);
573
- // var dir = Path.GetDirectoryName(bat);
574
- // using (Process p = new Process())
575
- // {
576
- // p.StartInfo.FileName = bat;
577
- // p.StartInfo.Arguments = args;
578
- // p.StartInfo.CreateNoWindow = false;
579
- // p.StartInfo.UseShellExecute = false;
580
- // p.StartInfo.RedirectStandardOutput = true;
581
- // p.StartInfo.WorkingDirectory = dir;
582
- // p.Start();
583
- // p.WaitForExit();
584
- // UnityEngine.Debug.Log(p.StandardOutput.ReadToEnd());
585
- // p.Close();
586
- // complete?.Invoke();
587
- // }
636
+ return Path.GetFullPath(path).Replace("/", "\\");
637
+ }
588
638
 
639
+ /// <summary>
640
+ /// 转untiy全路径
641
+ /// </summary>
642
+ public static string ToUnityRelativePath(string path)
643
+ {
644
+ if (string.IsNullOrEmpty(path))
645
+ {
646
+ return "";
647
+ }
648
+
649
+ return Path.GetFullPath(path).Replace("/", "\\").Replace(
650
+ $"{Path.GetDirectoryName(Application.dataPath)}\\", "")
651
+ .Replace("\\", "/");
652
+ }
589
653
 
590
- using (var process = Process.Start("explorer", $"\"{Path.GetFullPath(path)}\" {args}"))
654
+
655
+ /// <summary>
656
+ /// 反射获取有效的枚举
657
+ /// </summary>
658
+ public static T[] GetValidEnumValues<T>() where T : Enum
659
+ {
660
+ var type = typeof(T);
661
+ var match = new HashSet<string>();
662
+ var names = Enum.GetNames(typeof(T));
663
+ foreach (var element in names)
664
+ {
665
+ var fieldInfo = type.GetField(element);
666
+ // 检查特性是否废弃
667
+ if (fieldInfo.GetCustomAttributes(typeof(ObsoleteAttribute), false).Length > 0)
668
+ {
669
+ continue;
670
+ }
671
+ else
672
+ {
673
+ match.Add(fieldInfo.Name);
674
+ }
675
+ }
676
+
677
+ List<T> result = new List<T>();
678
+ foreach (var value in match)
591
679
  {
680
+ result.Add((T)Enum.Parse(typeof(T), value));
592
681
  }
682
+
683
+ return result.ToArray();
593
684
  }
594
685
 
686
+ // /// <summary>
687
+ // /// 执行批处理
688
+ // /// </summary>
689
+ // public static void RunBat(string path, string args = "", Action complete = null)
690
+ // {
691
+ // using (var process = Process.Start("explorer", $"\"{Path.GetFullPath(path)}\" {args}"))
692
+ // {
693
+ // }
694
+ //
695
+ // }
696
+
595
697
 
596
698
  /// <summary>
597
699
  /// 执行批处理
598
700
  /// </summary>
599
- public static void Run(string batPath, params string[] args)
701
+ public static void RunBat(string batFile)
600
702
  {
601
- //获取批处理
602
- if (!File.Exists(batPath))
703
+ if (!File.Exists(batFile))
603
704
  {
604
- throw new Exception($"丢失 {batPath}");
705
+ Debug.LogError("bat文件不存在:" + batFile);
605
706
  }
606
-
607
- string inputArg = string.Empty;
608
- if (args != null)
707
+ else
609
708
  {
610
- StringBuilder sb = new StringBuilder();
611
- foreach (var element in args)
709
+ var workingDir = Path.GetDirectoryName(batFile);
710
+ var fileName = Path.GetFileName(batFile);
711
+ Process proc = null;
712
+ try
612
713
  {
613
- sb.Append(element);
614
- sb.Append(',');
714
+ proc = new Process();
715
+ proc.StartInfo.WorkingDirectory = workingDir;
716
+ proc.StartInfo.FileName = fileName;
717
+ // proc.StartInfo.RedirectStandardOutput = true;
718
+ // proc.StartInfo.UseShellExecute = false;
719
+ //proc.StartInfo.Arguments = args;
720
+ //proc.StartInfo.CreateNoWindow = true;
721
+ //proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;//disable dos window
722
+ proc.Start();
723
+ proc.WaitForExit();
724
+ proc.Close();
725
+ // var output = proc.StandardOutput.ReadToEnd();
726
+ // Debug.Log(output);
615
727
  }
616
-
617
- inputArg = sb.ToString();
618
- if (inputArg.EndsWith(","))
728
+ catch (Exception ex)
619
729
  {
620
- inputArg.Remove(inputArg.Length - 1, 1);
730
+ Debug.LogFormat("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
621
731
  }
622
732
  }
733
+ }
623
734
 
624
- FileInfo info = new FileInfo(batPath);
625
- batPath = info.FullName;
626
- try
627
- {
628
- using (Process proc = new Process())
629
- {
630
- proc.StartInfo.FileName = batPath;
631
- proc.StartInfo.WorkingDirectory = info.Directory.FullName;
632
- if (inputArg.Length > 0)
633
- {
634
- proc.StartInfo.Arguments = inputArg;
635
- }
636
735
 
637
- proc.Start();
638
- }
736
+ /// <summary>
737
+ /// 删除文件夹适配长路径
738
+ /// </summary>
739
+ public static void DeleteFolder(string path, bool recursive = true)
740
+ {
741
+ var fullPath = Path.GetFullPath(path);
742
+ fullPath = fullPath.Replace("/", "\\");
743
+ if (Directory.Exists(fullPath))
744
+ {
745
+ AlphaDirectory.Delete(fullPath, recursive);
639
746
  }
640
- catch (Exception ex)
747
+ }
748
+
749
+ /// <summary>
750
+ /// 删除文件,适配长路径
751
+ /// </summary>
752
+ public static void DeleteFile(string path)
753
+ {
754
+ var fullPath = Path.GetFullPath(path);
755
+ fullPath = fullPath.Replace("/", "\\");
756
+ if (File.Exists(fullPath))
641
757
  {
642
- Console.WriteLine("Exception Occurred :{0},{1}", ex.Message, ex.StackTrace.ToString());
758
+ Alphaleonis.Win32.Filesystem.File.Delete(path, true);
643
759
  }
644
760
  }
645
761
  }
@@ -13,6 +13,7 @@ namespace TyphoonUnitySDK
13
13
  {
14
14
  //微信小游戏进阶设置
15
15
  private static bool _wxMiniConfigAdvanceFoldout = false;
16
+ private static Vector2 _scrollPrivacyPolicy;
16
17
 
17
18
  public static Dictionary<string, Func<VivoMiniConfig, bool>> OverrideDrawGUIConfig =
18
19
  new Dictionary<string, Func<VivoMiniConfig, bool>>()
@@ -30,16 +31,175 @@ namespace TyphoonUnitySDK
30
31
  { nameof(VivoMiniConfig.CDN), DrawProperty_CDN },
31
32
  { nameof(VivoMiniConfig.PrivatePem), DrawProperty_PrivatePem },
32
33
  { nameof(VivoMiniConfig.CertificatePem), DrawProperty_CertificatePem },
34
+ { nameof(VivoMiniConfig.BannerEnable), DrawProperty_BannerEnable },
35
+ { nameof(VivoMiniConfig.BannerPosId), DrawProperty_BannerPosId },
36
+ { nameof(VivoMiniConfig.BannerInterval), DrawProperty_BannerInterval },
37
+ { nameof(VivoMiniConfig.BannerBottom), DrawProperty_BannerBottom },
38
+ { nameof(VivoMiniConfig.IntersEnable), DrawProperty_IntersEnable },
39
+ { nameof(VivoMiniConfig.IntersPosId), DrawProperty_IntersPosId },
40
+ { nameof(VivoMiniConfig.IntersInterval), DrawProperty_IntersInterval },
41
+ { nameof(VivoMiniConfig.VideoEnable), DrawProperty_VideoEnable },
42
+ { nameof(VivoMiniConfig.VideoPosId), DrawProperty_VideoPosId },
43
+ { nameof(VivoMiniConfig.VideoResetIntersCool), DrawProperty_VideoResetIntersCool },
44
+ { nameof(VivoMiniConfig.PrivacyPolicyFile), DrawProperty_PrivacyPolicy },
45
+ { nameof(VivoMiniConfig.AgeLevel), DrawProperty_AgeLevel },
33
46
  };
34
47
 
48
+ private static bool DrawProperty_AgeLevel(VivoMiniConfig arg)
49
+ {
50
+ GUILayout.Space(3);
51
+ GUILayout.BeginHorizontal();
52
+ GUILayout.Label("适龄提醒", GUILayout.Width(146));
53
+ if (GUILayout.Button(arg.AgeLevel.ToString(), "PopUp"))
54
+ {
55
+ var menu = new GenericMenu();
56
+ var options = UniEditor.GetValidEnumValues<AgeLevel>();
57
+ foreach (var option in options)
58
+ {
59
+ menu.AddItem(new GUIContent(option.ToString()), false, () => { arg.AgeLevel = option; });
60
+ }
61
+
62
+ menu.ShowAsContext();
63
+ }
64
+
65
+ GUILayout.EndHorizontal();
66
+ return true;
67
+ }
68
+
69
+ private static bool DrawProperty_PrivacyPolicy(VivoMiniConfig arg)
70
+ {
71
+ GUILayout.Space(10);
72
+ GUILayout.Label("隐私政策", Styles.rbold_title);
73
+ GUILayout.BeginHorizontal();
74
+ GUILayout.Label("文案", GUILayout.Width(146));
75
+ arg.PrivacyPolicyFile =
76
+ EditorGUILayout.ObjectField(arg.PrivacyPolicyFile, typeof(TextAsset), false) as TextAsset;
77
+ GUILayout.EndHorizontal();
78
+ return true;
79
+ }
80
+
81
+ private static bool DrawProperty_VideoResetIntersCool(VivoMiniConfig arg)
82
+ {
83
+ if (!arg.VideoEnable)
84
+ {
85
+ return true;
86
+ }
87
+
88
+ arg.VideoResetIntersCool = EditorGUILayout.IntField("激励后x秒不弹插页(-1不控制)", arg.VideoResetIntersCool);
89
+ return true;
90
+ }
91
+
92
+ private static bool DrawProperty_VideoPosId(VivoMiniConfig arg)
93
+ {
94
+ if (!arg.VideoEnable)
95
+ {
96
+ return true;
97
+ }
98
+
99
+ arg.VideoPosId = EditorGUILayout.TextField("激励视频 PosId", arg.VideoPosId);
100
+ return true;
101
+ }
102
+
103
+ private static bool DrawProperty_VideoEnable(VivoMiniConfig arg)
104
+ {
105
+ GUILayout.Space(5);
106
+ GUILayout.BeginHorizontal();
107
+ GUILayout.Label("激励视频开关", GUILayout.Width(146));
108
+ GUIDrawer.DrawPopUpToggle(arg.VideoEnable, (v) => arg.VideoEnable = v);
109
+ GUILayout.EndHorizontal();
110
+ return true;
111
+ }
112
+
113
+ private static bool DrawProperty_IntersInterval(VivoMiniConfig arg)
114
+ {
115
+ if (!arg.IntersEnable)
116
+ {
117
+ return true;
118
+ }
119
+
120
+ arg.IntersInterval = EditorGUILayout.IntField("插页冷却间隔(秒)", arg.IntersInterval);
121
+ return true;
122
+ }
123
+
124
+ private static bool DrawProperty_IntersPosId(VivoMiniConfig arg)
125
+ {
126
+ if (!arg.IntersEnable)
127
+ {
128
+ return true;
129
+ }
130
+
131
+ arg.IntersPosId = EditorGUILayout.TextField("插页 PosId", arg.IntersPosId);
132
+ return true;
133
+ }
134
+
135
+ private static bool DrawProperty_IntersEnable(VivoMiniConfig arg)
136
+ {
137
+ GUILayout.Space(5);
138
+ GUILayout.BeginHorizontal();
139
+ GUILayout.Label("插页开关", GUILayout.Width(146));
140
+ GUIDrawer.DrawPopUpToggle(arg.IntersEnable, (v) => arg.IntersEnable = v);
141
+ GUILayout.EndHorizontal();
142
+ return true;
143
+ }
144
+
145
+ private static bool DrawProperty_BannerBottom(VivoMiniConfig arg)
146
+ {
147
+ if (!arg.BannerEnable)
148
+ {
149
+ return true;
150
+ }
151
+
152
+ GUILayout.BeginHorizontal();
153
+ GUILayout.Label("Banner样式", GUILayout.Width(146));
154
+ GUIDrawer.DrawPopUpToggleCustomTxt(arg.BannerBottom, (v) => arg.BannerBottom = v, "底部", "顶部");
155
+ GUILayout.EndHorizontal();
156
+ return true;
157
+ }
158
+
159
+ private static bool DrawProperty_BannerInterval(VivoMiniConfig arg)
160
+ {
161
+ if (!arg.BannerEnable)
162
+ {
163
+ return true;
164
+ }
165
+
166
+ arg.BannerInterval = EditorGUILayout.IntSlider("Banner刷新间隔(秒)", arg.BannerInterval, 30, 120);
167
+ return true;
168
+ }
169
+
170
+ private static bool DrawProperty_BannerPosId(VivoMiniConfig arg)
171
+ {
172
+ if (!arg.BannerEnable)
173
+ {
174
+ return true;
175
+ }
176
+
177
+ arg.BannerPosId = EditorGUILayout.TextField("Banner PosId", arg.BannerPosId);
178
+ return true;
179
+ }
180
+
181
+ private static bool DrawProperty_BannerEnable(VivoMiniConfig arg)
182
+ {
183
+ GUILayout.Space(10);
184
+ GUILayout.Label("广告参数", Styles.rbold_title);
185
+ GUILayout.BeginHorizontal();
186
+ GUILayout.Label("Banner开关", GUILayout.Width(146));
187
+ GUIDrawer.DrawPopUpToggle(arg.BannerEnable, (v) => arg.BannerEnable = v);
188
+ GUILayout.EndHorizontal();
189
+ return true;
190
+ }
191
+
35
192
  private static bool DrawProperty_CertificatePem(VivoMiniConfig arg)
36
193
  {
37
194
  GUILayout.BeginHorizontal();
38
195
  arg.CertificatePem = EditorGUILayout.TextField("certificate.pem", arg.CertificatePem);
39
196
  if (GUILayout.Button("选择", GUILayout.Width(60)))
40
197
  {
41
- var file = EditorUtility.OpenFilePanel("请选择certificate.pem", Application.dataPath, ".pem");
42
- arg.CertificatePem = file;
198
+ var file = EditorUtility.OpenFilePanel("请选择certificate.pem", Application.dataPath, "pem");
199
+ if (!string.IsNullOrEmpty(file))
200
+ {
201
+ arg.CertificatePem = UniEditor.ToUnityRelativePath(file);
202
+ }
43
203
  }
44
204
 
45
205
  GUILayout.EndHorizontal();
@@ -70,8 +230,12 @@ namespace TyphoonUnitySDK
70
230
  arg.PrivatePem = EditorGUILayout.TextField("private.pem", arg.PrivatePem);
71
231
  if (GUILayout.Button("选择", GUILayout.Width(60)))
72
232
  {
73
- var file = EditorUtility.OpenFilePanel("请选择private.pem", Application.dataPath, ".pem");
74
- arg.PrivatePem = file;
233
+ var file = EditorUtility.OpenFilePanel("请选择private.pem", Application.dataPath, "pem");
234
+ if (!string.IsNullOrEmpty(file))
235
+ {
236
+ //尝试转成相对路径
237
+ arg.PrivatePem = UniEditor.ToUnityRelativePath(file);
238
+ }
75
239
  }
76
240
 
77
241
  GUILayout.EndHorizontal();
@@ -152,7 +316,7 @@ namespace TyphoonUnitySDK
152
316
  private static bool DrawProperty_LoadBackground(VivoMiniConfig arg)
153
317
  {
154
318
  arg.LoadBackground =
155
- (Texture)EditorGUILayout.ObjectField("加载背景(可选)", arg.LoadBackground, typeof(Texture), false);
319
+ (Texture)EditorGUILayout.ObjectField("加载背景(推荐512*1024)", arg.LoadBackground, typeof(Texture), false);
156
320
  return true;
157
321
  }
158
322
 
@@ -286,6 +450,23 @@ namespace TyphoonUnitySDK
286
450
  public int VersionCode = 1; //版本号
287
451
  public string CDN = "https://xxx.xx.xx";
288
452
 
453
+ [Header("广告参数")] public bool BannerEnable = false; //开关,[bool]
454
+ public int BannerInterval = 30; //刷新间隔(单位秒)不小于30s[number]
455
+ public string BannerPosId = ""; //banner广告位ID,[string]
456
+ public bool BannerBottom = true; //1表示底部banner,0表示顶部banner[number]
457
+
458
+ public bool IntersEnable = false; //开关[bool]
459
+ public int IntersInterval = 30; //插屏冷却时间(单位秒)[number]
460
+ public string IntersPosId = ""; //插屏广告位ID[string]
461
+
462
+ public bool VideoEnable = false; //开关[bool]
463
+ public int VideoResetIntersCool = 40; //播放视频广告后x秒后不弹出插页广告,-1为不控制[number]
464
+ public string VideoPosId = ""; //插屏广告位ID[string]
465
+
466
+ public TextAsset PrivacyPolicyFile; //隐私协议
467
+
468
+ public AgeLevel AgeLevel = AgeLevel.Age8; //适龄提醒
469
+
289
470
  public string GetFinalCDN()
290
471
  {
291
472
  var result = CDN.Replace("[版本号]", VersionCode.ToString());