예제 #1
0
    private void LoadLevelListContent(LevelConfig config, LevelConfig nextConfig, int i, int count)
    {
        ////设置星星数量
        //if(!XPlayerPrefs.HasKey(config.LevelId.ToString()+numStar))
        //{
        //    XPlayerPrefs.SetInt(config.LevelId.ToString() + numStar, 0);
        //}

        if (config.LevelType == 2)
        {
            return;
        }
        //新的主题
        if (curTheme != config.LevelTheme)
        {
            curTheme   = config.LevelTheme;
            curHeight += offsetMenu;
            menu       = ResMgr.LoadGameObject(menuPath);
            menu.transform.SetParent(LevelContent.transform);
            menu.transform.localPosition = Vector3.zero - new Vector3(0, curHeight, 0);
            menu.transform.localScale    = LevelContent.localScale;
            LoadMenu(menu, config.LevelTheme);
            themeCnt++;
            levelCnt = 0;
        }
        int cnt = levelCnt % 3;

        if (cnt == 0)
        {
            curHeight += offsetY;
        }
        levelBtn = ResMgr.LoadGameObject(levelBtnPath);
        levelBtn.transform.SetParent(LevelContent.transform);
        levelBtn.transform.localPosition = Vector3.zero - new Vector3((cnt - 1) * offsetX * -1, curHeight, 0);
        levelBtn.transform.localScale    = LevelContent.localScale;

        UILevelBtn UIBtn = levelBtn.GetComponent <UILevelBtn>();

        if (cnt == 1)
        {
            UIBtn.line.SetActive(true);
        }
        LoadLevelBtn(UIBtn, config.LevelId, config.LevelPicture.ToString(), levelCnt, themeCnt);
        UIBtn.setLevelID(config.LevelId);
        UIBtn.setThemeID(config.LevelTheme);
        //if (count > i + 1)
        //{
        //    UIBtn.setNextLevelID(config.LevelId+1);
        //    if (config.LevelTheme != nextConfig.LevelTheme)
        //        UIBtn.setNextThemeID(nextConfig.LevelTheme);
        //    else
        //        UIBtn.setNextThemeID(config.LevelTheme);
        //}
        //else
        //{
        //    UIBtn.setNextLevelID(0);
        //    UIBtn.setNextThemeID("null");
        //}
        levelCnt++;
    }
예제 #2
0
    private GameObject LoadUI(int uiid)
    {
        string str = UIUtil.GetUITypeName(uiid);

        if (string.IsNullOrEmpty(str))
        {
            return(null);
        }
        sb.Clear();
        sb.Append(string.Format(m_UIPath, str));
        return(ResMgr.LoadGameObject(sb.ToString()));
    }
예제 #3
0
    protected override void Init()
    {
        kernel = GameKernel.GetInstance();

        m_uistacks   = new Stack <int>();
        m_uicache    = new UIBase[(int)UIPageEnum.Max];
        m_tips_cache = new List <int>();
        sb           = new StringBuilder(256);

        //生成uiroot
        GameObject temp = ResMgr.LoadGameObject(string.Format(m_UIPath, m_root_tag));

        //Debug.Log(string.Format(m_UIPath, m_root_tag));
        m_uiRoot = temp.GetComponentInChildren <UIBase>();
        m_canvas = m_uiRoot.GetComponent <Canvas>();

        //Debug.Log("init the muiRoot");
        GameObject.DontDestroyOnLoad(temp);
        //生成背景遮罩
        temp     = ResMgr.LoadGameObject(string.Format(m_UIPath, m_mask_tag), m_uiRoot.transform);
        m_bgMask = temp.GetComponent <UIMask>();
        m_bgMask.Hide();
    }