using ET; using libx; using Sirenix.OdinInspector; using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Text; using System.Threading; using System.Threading.Tasks; using UnityEditor; using UnityEngine; namespace Cal { [ExecuteInEditMode] [UnityEditor.InitializeOnLoad] public class Setuper { public Setuper(string key,string keyIV,string _xorKey) { this.key = key; this.keyIV = keyIV; this._xorKey = _xorKey; EditorApplication.update += Update; Start(); } private void Start() { Define.hasView = false; StartAsync().Coroutine(); } public string key; public string keyIV; public string _xorKey; public byte[] xorKey; private async ETVoid StartAsync() { try { SynchronizationContext.SetSynchronizationContext(ThreadSynchronizationContext.Instance); string[] assemblyNames = { "Unity.Model.dll", /* "Unity.Hotfix.dll" */}; foreach (Assembly assembly in AppDomain.CurrentDomain.GetAssemblies()) { string assemblyName = assembly.ManifestModule.Name; if (!assemblyNames.Contains(assemblyName)) { continue; } Game.EventSystem.Add(assembly); } xorKey = Encoding.UTF8.GetBytes(_xorKey); Game.EventSystem.Publish(new ET.EventType.AppStart { key = key, keyIV = keyIV, xorKey = xorKey, }).Coroutine(); } catch (Exception e) { Log.Error(e); } } private void Update() { Game.Update(); Game.LateUpdate(); Game.FrameFinish(); } public void Close() { EditorApplication.update -= Update; Game.Close(); } } }