public async ETTask AddPackageAsync(string type) { if (this.packages.ContainsKey(type)) { return; } TextAsset desTextAsset = await ResourcesComponent.Instance.LoadAssetAsync <TextAsset>(ABPathUtilities.GetFGUIDesPath($"{type}_fui")); packages.Add(type, UIPackage.AddPackage(desTextAsset.bytes, type, LoadPackageInternalAsync)); }
void Awake() { UIConfig.defaultFont = "test"; FairyGUI.FontManager.RegisterFont(FontManager.GetFont("Microsoft Yahei"), "迷你简准圆"); GRoot.inst.SetContentScaleFactor(1136, 640); LoadRes(() => { UIPackage.AddPackage("MainPack", GetRes); CreateCom(); }); }
public BagScene() { UIPackage.AddPackage("UI/Bag"); UIObjectFactory.SetLoaderExtension(typeof(MyGLoader)); _mainView = UIPackage.CreateObject("Bag", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); _bagWindow = new BagWindow(); _mainView.GetChild("bagBtn").onClick.Add(() => { _bagWindow.Show(); }); }
static List <Info> CreateInfo(string path) { List <Info> infos = new List <Info>(); var pkg = UIPackage.AddPackage(path); var items = pkg.GetItems(); foreach (var item in items) { GComponent gcomp = pkg.CreateObject(item.name).asCom; CollectUIElements(gcomp, infos); } return(infos); }
void Awake() { compContainer = LayersMgr.Instance.GetTopLayer(); UIPackage.AddPackage("Loader/Loader"); if (AppConst.ShowCompanyNameWithTips == true) { this.ShowGamePrompt(); } else { this.ShowLoader(); } }
/// <summary> /// 进入场景 /// </summary> public void Enter() { //加载资源 for (int i = 0; i < AssetsGroup.Length; i++) { if (!string.IsNullOrEmpty(AssetsGroup[i])) { UIPackage.AddPackage(AssetsGroup[i]); } } UiManager.Instance.ShowWind(FirstWinName); FairyGUI.GRoot.inst.touchable = true; }
public void AddPackage(string pname) { if (!packages.ContainsKey(pname)) { UIPackage.AddPackage(pname); packages.Add(pname, 1); } else { packages[pname]++; } }
public static void Tip(string content) { if (tip == null) { #if UNITY_EDITOR UIPackage.AddPackage("UI/Common"); #endif tip = UIPackage.CreateObject("Common", "Tip").asCom; } tip.GetChild("textContent").asTextField.text = content; GRoot.inst.ShowPopup(tip); tip.Center(); }
private void Start() { initUI(); UIPackage.AddPackage("UI/" + _packageName); UIPanel uiPanel = gameObject.AddComponent <UIPanel>(); uiPanel.packageName = _packageName; uiPanel.componentName = _componentName; uiPanel.fitScreen = FitScreen.FitSize; uiPanel.CreateUI(); _view = GetComponent <UIPanel>().ui; onOpen(); }
private static T CreateView <T>(string packageName, string uiName) where T : GUIBase { GUIBase view = System.Activator.CreateInstance(typeof(T)) as GUIBase; if (view == null) { return(null); } string packageBundleName = string.Format("ui/{0}.bundle", packageName.ToLower()); LoadedAssetBundle loadedassetBundle = AssetLoadManager.LoadAssetBundle(packageBundleName); if (loadedassetBundle == null && AssetLoadManager.SimulateAssetBundleInEditor == false) { return(null); } PackageInfo package; if (!packageDic.TryGetValue(packageName, out package)) { package = new PackageInfo(packageName); packageDic.Add(packageName, package); } else { package.referencedCount++; } UIPackage.AddPackage(packageName, (string name, string extension, System.Type type) => { if (loadedassetBundle != null) { return(loadedassetBundle.assetBundle.LoadAsset(name, type)); } else if (AssetLoadManager.SimulateAssetBundleInEditor) { return(AssetLoadManager.LoadAsset(packageBundleName, name, type)); } return(null); }); view.uiName = uiName; view.packageName = packageName; view.Start(); uiViewDic.Add(uiName, view); return(view as T); }
public TreeViewScene() { UIPackage.AddPackage("UI/TreeView"); _mainView = UIPackage.CreateObject("TreeView", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); AddChild(_mainView); _folderURL1 = "ui://TreeView/folder_closed"; _folderURL2 = "ui://TreeView/folder_opened"; _fileURL = "ui://TreeView/file"; _treeView = new TreeView(_mainView.GetChild("tree").asList); _treeView.onClickNode.Add(__clickNode); _treeView.treeNodeRender = RenderTreeNode; TreeNode topNode = new TreeNode(true); topNode.data = "I'm a top node"; _treeView.root.AddChild(topNode); for (int i = 0; i < 5; i++) { TreeNode node = new TreeNode(false); node.data = "Hello " + i; topNode.AddChild(node); } TreeNode aFolderNode = new TreeNode(true); aFolderNode.data = "A folder node"; topNode.AddChild(aFolderNode); for (int i = 0; i < 5; i++) { TreeNode node = new TreeNode(false); node.data = "Good " + i; aFolderNode.AddChild(node); } for (int i = 0; i < 3; i++) { TreeNode node = new TreeNode(false); node.data = "World " + i; topNode.AddChild(node); } TreeNode anotherTopNode = new TreeNode(false); anotherTopNode.data = new string[] { "I'm a top node too", "ui://TreeView/heart" }; _treeView.root.AddChild(anotherTopNode); }
// Use this for initialization void Start1() { //GComponent view = UIPackage.CreateObject("DialogPanel", "Main") as GComponent; UIPackage.AddPackage("DialogPanel"); gameObject.transform.position = new Vector3(0f, 0f, 0f); gameObject.AddComponent <UIPanel>(); gameObject.layer = 5; UIPanel panel = gameObject.GetComponent <UIPanel>(); panel.packageName = "DialogPanel"; panel.componentName = "Main"; panel.CreateUI(); GComponent view = panel.ui; }
void Start() { #if UNITY_WEBPLAYER || UNITY_WEBGL || UNITY_STANDALONE_WIN || UNITY_STANDALONE_OSX || UNITY_EDITOR CopyPastePatch.Apply(); #endif Application.targetFrameRate = 60; GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(OnKeyDown); UIPackage.AddPackage("UI/Basics"); #if UNITY_5 //Use the font names directly UIConfig.defaultFont = "Droid Sans,Droid Sans Fallback,Microsoft YaHei"; #else //Need to put a ttf file into Resources folder. Here is the file name of the ttf file. UIConfig.defaultFont = "afont"; #endif UIConfig.verticalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_VT"); UIConfig.horizontalScrollBar = UIPackage.GetItemURL("Basics", "ScrollBar_HZ"); UIConfig.popupMenu = UIPackage.GetItemURL("Basics", "PopupMenu"); UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAsset("Basics", "click"); _mainView = UIPackage.CreateObject("Basics", "Main").asCom; _mainView.fairyBatching = true; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); _backBtn = _mainView.GetChild("btn_Back"); _backBtn.visible = false; _backBtn.onClick.Add(onClickBack); _demoContainer = _mainView.GetChild("container").asCom; _viewController = _mainView.GetController("c1"); _demoObjects = new Dictionary <string, GComponent>(); int cnt = _mainView.numChildren; for (int i = 0; i < cnt; i++) { GObject obj = _mainView.GetChildAt(i); if (obj.group != null && obj.group.name == "btns") { obj.onClick.Add(runDemo); } } }
public IEnumerator LoadUI(string path) { AssetBundle assetBundle = GetAssetBoundle(path + ".assetbundle"); if (assetBundle != null) { UIPackage.AddPackage(assetBundle); } else { UIPackage.AddPackage(path); } yield return(null); }
public void AddPackage(string type) { #if UNITY_EDITOR UIPackage uiPackage = UIPackage.AddPackage($"{FUI_PACKAGE_DIR}/{type}"); #else string uiBundleName = type.StringToAB(); ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>(); resourcesComponent.LoadBundle(uiBundleName); AssetBundle assetBundle = resourcesComponent.GetAssetBundle(uiBundleName); UIPackage uiPackage = UIPackage.AddPackage(assetBundle); #endif this.packages.Add(type, uiPackage); }
public JoystickScene() { UIPackage.AddPackage("UI/Joystick"); _mainView = UIPackage.CreateObject("Joystick", "Main").asCom; _mainView.MakeFullScreen(); _mainView.AddRelation(GRoot.inst, RelationType.Size); AddChild(_mainView); _text = _mainView.GetChild("n9").asTextField; _joystick = new JoystickModule(_mainView); _joystick.onMove.Add(__joystickMove); _joystick.onEnd.Add(__joystickEnd); }
public override void LoadFairyUIPackage(string packageName, Action <UIPackage> callback) { string assetpath = ResHelper.UI_PATH + packageName; UIPackage uiPackage = UIPackage.AddPackage(assetpath, (string name, string extension, System.Type type, out FairyGUI.DestroyMethod destroyMethod) => { destroyMethod = FairyGUI.DestroyMethod.None; UObject obj = UnityEditor.AssetDatabase.LoadAssetAtPath(name + extension, type); return(obj); }); callback(uiPackage); }
private void Awake() { //先加载公用基础包,因为其他包对基础包有依赖 UIPackage.AddPackage("UI/PublicPackage00"); UIPackage.AddPackage("UI/PublicPackage01"); var scene = FScene.CreateFScene <MatchGameRankScene>(FSceneDefine.MatchSyzzFSceneConfig); scene.Open(null); luaEnv = new LuaEnv(); // luaEnv.AddLoader(LuaSciptLoader); luaEnv.DoString("CS.UnityEngine.Debug.Log('lua hello world')"); luaEnv.DoString("require 'Main'"); luaEnv.Dispose(); }
public DemoScene() { UIPackage.AddPackage("UI/MainMenu"); //add a closebutton to scene GObject closeButton = UIPackage.CreateObject("MainMenu", "CloseButton"); closeButton.SetPosition(GRoot.inst.width - closeButton.width - 10, GRoot.inst.height - closeButton.height - 10); closeButton.AddRelation(GRoot.inst, RelationType.Right_Right); closeButton.AddRelation(GRoot.inst, RelationType.Bottom_Bottom); closeButton.sortingOrder = 100000; closeButton.onClick.Add(OnClose); GRoot.inst.AddChild(closeButton); }
// Start is called before the first frame update void Start() { UIPackage.AddPackage("FGUI/Res_Main"); UIPackage.AddPackage("FGUI/Res_Game"); UIPackage.AddPackage("FGUI/Res_Component_public"); GRoot.inst.SetContentScaleFactor(1920, 1080, UIContentScaler.ScreenMatchMode.MatchWidthOrHeight); //各个系统,并且按照顺序 if (currentUIManager == null) { currentUIManager = new UIManager(); currentUIManager.OutGameMange(); } currentUIManager.UIPanelDict[UIPanelType.Loading].Show(); }
/// <summary> /// 增加一个包 /// </summary> /// <param name="assetPath">资源包路径</param> /// <returns>FairyGUI UIPackage</returns> public UIPackage AddPackage(string assetPath) { IObject obj = null; var package = UIPackage.AddPackage(assetPath, (name, extension, type) => { obj = Resources.Load(name + extension, type); return(obj == null ? null : obj.Original); }); if (package != null && obj != null) { obj.Get(package); } return(package); }
public async ETTask AddPackageAsync(string type) { #if UNITY_EDITOR await ETTask.CompletedTask; UIPackage uiPackage = UIPackage.AddPackage($"{FUI_PACKAGE_DIR}/{type}"); #else string uiBundleName = type.StringToAB(); ResourcesComponent resourcesComponent = Game.Scene.GetComponent <ResourcesComponent>(); await resourcesComponent.LoadBundleAsync(uiBundleName); AssetBundle assetBundle = resourcesComponent.GetAssetBundle(uiBundleName); UIPackage uiPackage = UIPackage.AddPackage(assetBundle); #endif this.packages.Add(type, uiPackage); }
void Start() { Application.targetFrameRate = 60; GRoot.inst.SetContentScaleFactor(1136, 640); Stage.inst.onKeyDown.Add(OnKeyDown); UIPackage.AddPackage("UI/HitTest"); _mainView = UIPackage.CreateObject("HitTest", "Main").asCom; _mainView.SetSize(GRoot.inst.width, GRoot.inst.height); _mainView.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(_mainView); cube = GameObject.Find("Cube").transform; Stage.inst.onTouchBegin.Add(OnTouchBegin); }
void Awake() { #if (UNITY_5 || UNITY_5_3_OR_NEWER) //Use the font names directly UIConfig.defaultFont = "Microsoft YaHei"; #else //Need to put a ttf file into Resources folder. Here is the file name of the ttf file. UIConfig.defaultFont = "afont"; #endif UIPackage.AddPackage("UI/Basics"); UIConfig.verticalScrollBar = "ui://Basics/ScrollBar_VT"; UIConfig.horizontalScrollBar = "ui://Basics/ScrollBar_HZ"; UIConfig.popupMenu = "ui://Basics/PopupMenu"; UIConfig.buttonSound = (NAudioClip)UIPackage.GetItemAsset("Basics", "click"); }
private void FindDependencies(string packageName) { UIPackage uiPackage = UIPackage.AddPackage(Utility.Text.Format("Assets/GameMain/FGuiResource/{0}/{0}", packageName)); for (int i = 0; i < uiPackage.dependencies.Length; i++) { if (m_FguiDependenciesList.Contains(uiPackage.dependencies[i]["name"])) { continue; } m_FguiDependenciesList.Add(uiPackage.dependencies[i]["name"]); FindDependencies(uiPackage.dependencies[i]["name"]); } }
public static void AddUIPackage(string pkgName) { ResourceItem item = ResourceManger.Instance.LoadResourceUI(pkgName); UIPackage pkg = null; #if UNITY_EDITOR if (!ResourceManger.Instance.m_LoadFromAssetBundle) { pkg = UIPackage.AddPackage(item.m_AssetName); } #endif if (pkg == null) { UIPackage.AddPackage(item.m_AssetBundle); } }
public static UILoginButton CreateInstance() { UIPackage.AddPackage(UIPathTools.CombineMainPackagePath(PackageName)); BindPackageItemExtension(); object gObject = UIPackage.CreateObjectFromURL(URL); if (gObject is UILoginButton) { return(gObject as UILoginButton); } else { UnityEngine.Debug.LogError(" Init Faild !!!PackageName:" + PackageName + " ResName : " + ResName); return(null); } }
// Use this for initialization void Start() { Application.targetFrameRate = 60; UIPackage.AddPackage("LoopList"); _mainView = this.GetComponent <UIPanel>().ui; _list = _mainView.GetChild("list").asList; _list.SetVirtualAndLoop(); _list.itemRenderer = RenderListItem; _list.numItems = 5; _list.scrollPane.onScroll.Add(DoSpecialEffect); DoSpecialEffect(); }
void Awake() { Instance = this; DontDestroyOnLoad(this.gameObject); MyLog.Init(LogLevel.Log, 1000); UIConfig.defaultFont = "Microsoft YaHei"; UIPackage.AddPackage("wuxia"); LoadConfigs(); mEventDispatch = new EventDispatcher(); //UIConfig.verticalScrollBar = "ui://Basics/ScrollBar_VT"; //UIConfig.horizontalScrollBar = "ui://Basics/ScrollBar_HZ"; //UIConfig.popupMenu = "ui://Basics/PopupMenu"; //UIConfig.buttonSound = (AudioClip)UIPackage.GetItemAsset("Basics", "click"); }
void Awake() { RemoveMessage(this, MessageList); RegisterMessage(this, MessageList); gameManager = new GameManager(); GRoot.inst.SetContentScaleFactor(AppConst.designResolutionX, AppConst.designResolutionY, UIContentScaler.ScreenMatchMode.MatchWidth); UIPackage.AddPackage("UI/Login"); view = UIPackage.CreateObject("login", "AppViewBg").asCom; view.SetSize(GRoot.inst.width, GRoot.inst.height); view.AddRelation(GRoot.inst, RelationType.Size); GRoot.inst.AddChild(view); //版本号 // this.updateDetail = view.GetChild ("n15").asTextField; }