示例#1
0
    private GHUD GenHUD(HUDType a_HUDType)
    {
        HUDInfo hudInfo = DbMgr.s_Instance.GetHUDInfo(a_HUDType);

        if (hudInfo == null)
        {
            return(null);
        }

        GameObject hudPref = Resources.Load <GameObject>(hudInfo.m_PrefPath);

        if (hudPref == null)
        {
            return(null);
        }

        // instantiate & init new HUD
        GameObject hudObj = Instantiate(hudPref, transform);
        GHUD       gHUD   = hudObj.GetComponent <GHUD>();

        gHUD.OnCreateObj();
        gHUD.Init(hudInfo);
        m_lHUD.Add(gHUD);

        return(gHUD);
    }