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));
        }
예제 #2
0
    void Awake()
    {
        UIConfig.defaultFont = "test";
        FairyGUI.FontManager.RegisterFont(FontManager.GetFont("Microsoft Yahei"), "迷你简准圆");
        GRoot.inst.SetContentScaleFactor(1136, 640);

        LoadRes(() =>
        {
            UIPackage.AddPackage("MainPack", GetRes);
            CreateCom();
        });
    }
예제 #3
0
        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(); });
        }
예제 #4
0
    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);
    }
예제 #5
0
 void Awake()
 {
     compContainer = LayersMgr.Instance.GetTopLayer();
     UIPackage.AddPackage("Loader/Loader");
     if (AppConst.ShowCompanyNameWithTips == true)
     {
         this.ShowGamePrompt();
     }
     else
     {
         this.ShowLoader();
     }
 }
예제 #6
0
 /// <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;
 }
예제 #7
0
        public void AddPackage(string pname)
        {
            if (!packages.ContainsKey(pname))
            {
                UIPackage.AddPackage(pname);

                packages.Add(pname, 1);
            }
            else
            {
                packages[pname]++;
            }
        }
예제 #8
0
        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();
        }
예제 #9
0
    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();
    }
예제 #10
0
    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);
    }
예제 #11
0
        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);
        }
예제 #12
0
    // 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;
    }
예제 #13
0
    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);
            }
        }
    }
예제 #14
0
    public IEnumerator LoadUI(string path)
    {
        AssetBundle assetBundle = GetAssetBoundle(path + ".assetbundle");

        if (assetBundle != null)
        {
            UIPackage.AddPackage(assetBundle);
        }
        else
        {
            UIPackage.AddPackage(path);
        }
        yield return(null);
    }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
        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);
        }
예제 #18
0
    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();
    }
예제 #19
0
        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);
        }
예제 #20
0
    // 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();
    }
예제 #21
0
        /// <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);
        }
예제 #22
0
        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);
        }
예제 #23
0
    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);
    }
예제 #24
0
    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");
    }
예제 #25
0
        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"]);
            }
        }
예제 #26
0
    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);
        }
    }
예제 #27
0
        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();
    }
예제 #29
0
    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");
    }
예제 #30
0
    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;
    }