Exemplo n.º 1
0
        /// <summary>
        /// 初始化FairyGUI,配置全局参数。
        /// </summary>
        public void Awake()
        {
            Instance         = this;
            baseUIContainer  = ComponentFactory.Create <FairyGUIContainer>();
            _LayerDictionary = new Dictionary <FairyGUIType, List <FairyGUIBaseUI> >();
            _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_FIXED, new List <FairyGUIBaseUI>());
            _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_POPUP, new List <FairyGUIBaseUI>());

            //加载UI包
#if UNITY_EDITOR
            //  UIPackage.AddPackage("UI/ASource");
#else
            //ResourcesComponent resourcesComponent = Game.Scene.GetComponent<ResourcesComponent>();
            //resourcesComponent.LoadOneBundle($"ui");
            //ABInfo abInfo = resourcesComponent.GetABInfoByName("ui");
            //UIPackage.AddPackage(abInfo.AssetBundle);
#endif
            //UI的配置
            //Groot的参数初始化
            //GRoot.inst.SetContentScaleFactor(1136, 640, ScreenMatchMode.MatchWidthOrHeight);
            // Game.Scene.GetComponent<ResourcesComponent>().LoadBundle("uiaudio.unity3d");

            //UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAssetByURL("ui://ASource/buttonclick");
            //GameObject bunddleObject = (GameObject)Game.Scene.GetComponent<ResourcesComponent>().GetAsset("uiaudio.unity3d", "UIAudio");
            //UIConfig.buttonSound =bunddleObject.Get<AudioClip>("ButtonClickAudio");
            //UIConfig.modalLayerColor = new Color(186f, 85f, 211f, 0.4f);
        }
Exemplo n.º 2
0
 /// <summary>
 /// 初始化FairyGUI
 /// </summary>
 public void Awake()
 {
     MonoInstance     = ETModel.Game.Scene.GetComponent <ETModel.FairyGUIComponent>();
     baseUIContainer  = ComponentFactory.Create <FairyGUIContainer>();
     _LayerDictionary = new Dictionary <FairyGUIType, List <FairyGUIBaseUI> >();
     _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_FIXED, new List <FairyGUIBaseUI>());
     _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_POPUP, new List <FairyGUIBaseUI>());
 }