private void Start() { if (!RunInEditor) { return; } //设置默认UI _uiContext = new UIContextBase() { AssetPath = $"{_prefixPath}/{name}.prefab", Name = $"{name}", Multiple = false }; //加载UIAdpterSystem GameFrameworkMode.GetModule <XLuaManager>().DoMainLua("UIAdpterSystem"); //添加一些默认的全局变量 GameFrameworkMode.GetModule <XLuaManager>().DoString( $"require \"class\"\n" + $"json = require \"json\"\n" + $"require \"UIView\"\n" + $"cs_coroutine = require \"cs_coroutine\"\n" + $"require \"SpineSystem\"\n" + $"Vector2 = CS.UnityEngine.Vector2\n" + $"Vector3 = CS.UnityEngine.Vector3\n" + $"Color = CS.UnityEngine.Color\n" + $"Input = CS.UnityEngine.Input\n" + $"RectTransform = CS.UnityEngine.RectTransform\n" + $"GameObject = CS.UnityEngine.GameObject\n" + $"Transform = CS.UnityEngine.Transform\n" + $"GE = CS.UnityEngine\n" + $"UGUI = CS.UnityEngine.UI\n" + $"GF = CS.Wanderer.GameFramework\n" + $"GameMode = GF.GameMode\n" + $"RectTransformUtility = CS.UnityEngine.RectTransformUtility\n" + $"require \"Resource\"\n" + $"Image = CS.UnityEngine.UI.Image\n" + $"require \"Utility\"\n" + $"require \"AudioSystem\"\n" + $"", "XLuaUIViewRunInUnityEditor_PreRequire"); //UIView的生命周期回调 _uiView.OnInit(_uiContext); _uiView.OnEnter(_uiContext, null, null); }
private static void OnAwakeAfter() { Debug.Log($"GameMode OnAwakeAfter"); XLua = GameFrameworkMode.GetModule <XLuaManager>(); Ads = GameFrameworkMode.GetModule <AdsManager>(); }
//获取所有的lua脚本的路径 private void GetAllLuaAssetsPath() { string luaPathPrefix = _luaPathPrefix.ToLower(); _allLuaAssetPaths = GameFrameworkMode.GetModule <ResourceManager>().Asset.AllAssetPaths.FindAll(x => x.StartsWith(luaPathPrefix)); }