Пример #1
0
 public void AddUIPackage()
 {
     UIPackage.AddPackage("FairyGUIPak/Package1");
     UIPackage.AddPackage("FairyGUIPak/Details");
     UIPackage.AddPackage("FairyGUIPak/FVideoPlayer");
     UIPackage.AddPackage("FairyGUIPak/P12_1");
     UIPackage.AddPackage("FairyGUIPak/P13_1_2");
 }
Пример #2
0
        public void Loadpackage(string name, System.Action <UIPackage> cb)
        {
            Debug.Log("$$ load package :" + name);
            var pak = UIPackage.AddPackage(string.Concat("FairyGUIPak/", name));

            if (!packagesWithId.ContainsKey(pak.id))
            {
                packagesWithId[pak.id] = pak;
            }
            cb(pak);
        }
Пример #3
0
        public override void OnSingletonInit()
        {
            base.OnSingletonInit();
            // preload fairyGUI type mapping
            var types = System.Reflection.Assembly.GetExecutingAssembly().GetTypes();
            int len   = types.Length;

            for (int i = 0; i < len; i++)
            {
                var type  = types[i];
                var attrs = type.GetCustomAttributes(typeof(UIFrame.UIAttributes.UIPackageItemIDAttribute), true);
                if (attrs.Length > 0)
                {
                    foreach (var att in attrs)
                    {
                        var a            = att as UIFrame.UIAttributes.UIPackageItemIDAttribute;
                        var constructors = a.type.GetConstructors(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static);
                        if (constructors.Length > 0)
                        {
                            constructors[0].Invoke(null);
                            //Debug.Log(a.type.FullName);
                        }
                    }
                }
            }
#if _CREATE_LISTITEM_FROMPOOL_
            FairyGUI.Stage.inst.CreatePoolManager("ListPool");
#endif
            UIPackage.AddPackage("FairyGUIPak/Common");
            //AddUIPackage();

            //FairyGUI.UIConfig.defaultFont = "Microsoft YaHei, SimHei";
            //设置默认字体为黑体
            FairyGUI.UIConfig.defaultFont = "simhei";
            //获取simhei(黑体的英文名)字体
            var loadedSimhei = FairyGUI.FontManager.GetFont("simhei");
            //为黑体字体设置中文别名
            FairyGUI.FontManager.RegisterFont(loadedSimhei, @"黑体");
        }