webzepetoku commited on
Commit
9057489
Β·
verified Β·
1 Parent(s): e3b43f0

Update UnityProject/Assets/TestBuilder.cs

Browse files
Files changed (1) hide show
  1. UnityProject/Assets/TestBuilder.cs +71 -1
UnityProject/Assets/TestBuilder.cs CHANGED
@@ -2,10 +2,15 @@ using UnityEngine;
2
  using UnityEditor;
3
  using System;
4
  using System.IO;
 
 
5
  using UnityMeshSimplifier;
6
 
7
  public class TestBuilder
8
  {
 
 
 
9
  public static void ManualConvert()
10
  {
11
  try
@@ -45,7 +50,72 @@ public class TestBuilder
45
  }
46
  catch (Exception e)
47
  {
48
- Debug.LogError($"πŸ’€ [ERROR FATAL] {e.ToString()}");
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
49
  EditorApplication.Exit(1);
50
  }
51
  }
 
2
  using UnityEditor;
3
  using System;
4
  using System.IO;
5
+ using System.Linq;
6
+ using System.Reflection;
7
  using UnityMeshSimplifier;
8
 
9
  public class TestBuilder
10
  {
11
+ // ==========================================
12
+ // FASE 1: MINIFY MESH
13
+ // ==========================================
14
  public static void ManualConvert()
15
  {
16
  try
 
50
  }
51
  catch (Exception e)
52
  {
53
+ Debug.LogError($"πŸ’€ [ERROR FATAL FASE 1] {e.ToString()}");
54
+ EditorApplication.Exit(1);
55
+ }
56
+ }
57
+
58
+ // ==========================================
59
+ // FASE 2: UPLOAD ZEPETO (Dengan Jaring Pengaman)
60
+ // ==========================================
61
+ public static void ZepetoUploadPhase()
62
+ {
63
+ try
64
+ {
65
+ Debug.Log("πŸš€ [CLI] Memulai Fase 2: Eksekusi Pengepakan & Upload ZEPETO...");
66
+
67
+ Type zepetoType = null;
68
+
69
+ // Pencarian Aman (Safe Reflection)
70
+ foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
71
+ {
72
+ try
73
+ {
74
+ var types = assembly.GetTypes();
75
+ var foundType = types.FirstOrDefault(t => t != null && t.Name == "ZepetoPackageCliBuilder");
76
+ if (foundType != null)
77
+ {
78
+ zepetoType = foundType;
79
+ break;
80
+ }
81
+ }
82
+ catch (ReflectionTypeLoadException e)
83
+ {
84
+ var foundType = e.Types.FirstOrDefault(t => t != null && t.Name == "ZepetoPackageCliBuilder");
85
+ if (foundType != null)
86
+ {
87
+ zepetoType = foundType;
88
+ break;
89
+ }
90
+ }
91
+ catch (Exception) {}
92
+ }
93
+
94
+ if (zepetoType != null)
95
+ {
96
+ MethodInfo buildMethod = zepetoType.GetMethod("BuildWithArgs", BindingFlags.Public | BindingFlags.Static);
97
+ if (buildMethod != null)
98
+ {
99
+ Debug.Log("βœ… [CLI] Memanggil ZepetoPackageCliBuilder.BuildWithArgs()...");
100
+ buildMethod.Invoke(null, null);
101
+ // Dibiarkan tanpa Exit(0) agar thread asinkron ZEPETO bisa berjalan untuk Upload
102
+ }
103
+ else
104
+ {
105
+ Debug.LogError("πŸ’€ [ERROR FASE 2] Method BuildWithArgs tidak ditemukan di class ZepetoPackageCliBuilder!");
106
+ EditorApplication.Exit(1);
107
+ }
108
+ }
109
+ else
110
+ {
111
+ Debug.LogError("πŸ’€ [ERROR FASE 2] Class ZepetoPackageCliBuilder tidak ditemukan! Pastikan library Zepeto sudah ter-load di Fase 2.");
112
+ EditorApplication.Exit(1);
113
+ }
114
+ }
115
+ catch (Exception e)
116
+ {
117
+ // Jika ZEPETO gagal (misal karena mendeteksi Item vs World), pesan aslinya akan tercetak di sini
118
+ Debug.LogError($"πŸ’€ [ERROR FATAL FASE 2 ASLI] {e.ToString()}");
119
  EditorApplication.Exit(1);
120
  }
121
  }