12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using UnityEngine;
- using XGame;
- using XGame.Framework.Asyncs;
- using XGame.Framework.FGUI;
- using XGame.Framework.Loadable;
- using XGame.Framework.Nodes;
- namespace FL.Nodes
- {
- public class ShaderComponent : NodeComponent, ILoadAsyncHandle
- {
- public override void OnEnable(object intent)
- {
- }
- public override void OnDisable()
- {
- }
- void ILoadAsyncHandle.OnLoadAsync(IAsyncGroup group)
- {
- //TODO 需要做预下载
- var async = Context.Asset.LoadAsync<ShaderVariantCollection>("gameshadervariants");
- async.On(_ =>
- {
- var svc = async.Result;
- if (svc == null)
- return;
- svc.WarmUp();
- Log.Debug($"ShaderVariantCollection WarmUp.");
- Context.Asset.Recycle(svc);
- });
- async.Join(group);
- FairyGUI.UIConfig.defaultFont = AddressableDefine.font_alimama;
- (Context.UI as IPackageHandle).LoadFontAsync(AddressableDefine.font_alimama).Join(group);
- (Context.UI as IPackageHandle).LoadFontAsync(AddressableDefine.font_dengjishuzi).Join(group);
- }
- void ILoadAsyncHandle.OnUnloadAsync(IAsyncGroup group)
- {
- }
- }
- }
|