UILobbyFactory.cs 714 字节
Newer Older
T
tanghai 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13
using System;
using Model;
using UnityEngine;

namespace Hotfix
{
    [UIFactory((int)UIType.Lobby)]
    public class UILobbyFactory : IUIFactory
    {
        public UI Create(Scene scene, UIType type, GameObject gameObject)
        {
	        try
	        {
14
				GameObject bundleGameObject = ((GameObject)Resources.Load("UI")).Get<GameObject>("UILobby");
T
tanghai 已提交
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
				GameObject lobby = UnityEngine.Object.Instantiate(bundleGameObject);
				lobby.layer = LayerMask.NameToLayer(LayerNames.UI);
				UI ui = new UI(scene, type, null, lobby);

				ui.AddComponent<UILobbyComponent>();
				return ui;
	        }
	        catch (Exception e)
	        {
				Log.Error(e.ToStr());
		        return null;
	        }
		}
    }
}