コード例 #1
0
    public void Init(int chapterid, int awardindex, bool bComplete, bool bHaveGot)
    {
        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(chapterid, 0);

        if (tabChapter == null)
        {
            return;
        }

        if (awardindex < 0 || awardindex >= tabChapter.getLevelAwardCount())
        {
            return;
        }

        if (bComplete)
        {
            m_BoxDisable.SetActive(false);
            m_BoxCanGet.SetActive(!bHaveGot);
            m_BoxHaveGot.SetActive(bHaveGot);
        }
        else
        {
            m_BoxDisable.SetActive(true);
            m_BoxCanGet.SetActive(false);
            m_BoxHaveGot.SetActive(false);
        }

        m_ChapterId  = chapterid;
        m_AwardIndex = awardindex;
    }
コード例 #2
0
    void OnBoxClick()
    {
        if (false == m_BoxCanGet.activeInHierarchy)
        {
            return;
        }

        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(m_ChapterId, 0);

        if (tabChapter == null)
        {
            return;
        }

        if (m_AwardIndex < 0 || m_AwardIndex >= JuQingCopySceneData.ChapterAwardStarReq.Length)
        {
            return;
        }

        GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.ReqChapterAward(m_ChapterId, m_AwardIndex);

        if (JuQingWindow.Instance() != null && JuQingWindow.Instance().NewPlayerGuideIndex == 2)
        {
            JuQingWindow.Instance().NewPlayerGuideIndex = GlobeVar.INVALID_ID;
            if (NewPlayerGuidLogic.Instance())
            {
                NewPlayerGuidLogic.CloseWindow();
            }
        }
    }
コード例 #3
0
    void OnBoxClick()
    {
        if (false == m_BoxCanGet.activeInHierarchy)
        {
            return;
        }

        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(m_ChapterId, 0);

        if (tabChapter == null)
        {
            return;
        }

        if (m_AwardIndex < 0 || m_AwardIndex >= tabChapter.getLevelAwardCount())
        {
            return;
        }

        GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.ReqChapterLevelAward(m_ChapterId, m_AwardIndex);

        if (JuQingWindow.Instance() != null && JuQingWindow.Instance().NewPlayerGuideIndex == 1)
        {
            if (GameManager.gameManager.PlayerDataPool.JuQingCopySceneData != null)
            {
                // 算总星星数的 应该可以提出个函数来
                List <StoryCopySceneChapterInfo> chapterInfoList = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetChapterInfoList();
                if (chapterInfoList == null || chapterInfoList.Count <= 0)
                {
                    JuQingWindow.Instance().NewPlayerGuideIndex = GlobeVar.INVALID_ID;
                    NewPlayerGuidLogic.CloseWindow();
                    return;
                }

                int nTotalStarCount = 0;
                StoryCopySceneChapterInfo currentChapterInfo = chapterInfoList[0];
                for (int i = 0; i < currentChapterInfo._ContaindLevelList.Count; i++)
                {
                    int levelID    = currentChapterInfo._ContaindLevelList[i];
                    int nStarCount = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(levelID).GetStarCount();
                    nTotalStarCount += nStarCount;
                }

                if (nTotalStarCount < JuQingCopySceneData.ChapterAwardStarReq[0])
                {
                    JuQingWindow.Instance().NewPlayerGuideIndex = GlobeVar.INVALID_ID;
                    NewPlayerGuidLogic.CloseWindow();
                    return;
                }

                JuQingWindow.Instance().NewPlayerGuide(2);
            }
        }
    }
コード例 #4
0
    public void Init(int chapterid, int awardindex, int totalstar, bool bHaveGot, bool bHide)
    {
        if (awardindex != 0 && awardindex != 1)
        {
            bHide = false;
        }
        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(chapterid, 0);

        if (tabChapter == null)
        {
            return;
        }

        if (awardindex < 0 || awardindex >= JuQingCopySceneData.ChapterAwardStarReq.Length)
        {
            return;
        }

        m_bHaveGot = bHaveGot;

        if (totalstar >= JuQingCopySceneData.ChapterAwardStarReq[awardindex])
        {
            m_bCanGet = !bHaveGot;
            m_BoxDisable.SetActive(false);
            m_BoxCanGet.SetActive(!bHaveGot);
            if (bHide)
            {
                m_BoxCanGetEffect.SetActive(false);
            }
            else
            {
                m_BoxCanGetEffect.SetActive(!bHaveGot);
            }
            m_BoxHaveGot.SetActive(bHaveGot);
            m_StarEmpty.SetActive(false);
            m_StarEnough.SetActive(true);
        }
        else
        {
            m_bCanGet = false;
            m_BoxDisable.SetActive(true);
            m_BoxCanGet.SetActive(false);
            m_BoxCanGetEffect.SetActive(false);
            m_BoxHaveGot.SetActive(false);
            m_StarEmpty.SetActive(true);
            m_StarEnough.SetActive(false);
        }

        m_ChapterId  = chapterid;
        m_AwardIndex = awardindex;
    }
コード例 #5
0
    Tab_StoryCopySceneAward GetChapterAwardTab()
    {
        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(m_ChapterId, 0);

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

        int nAwardId = GlobeVar.INVALID_ID;

        if (m_AwardIndex < 0 || m_AwardIndex >= tabChapter.getAwardCount())
        {
            return(null);
        }

        nAwardId = tabChapter.GetAwardbyIndex(m_AwardIndex);


        Tab_StoryCopySceneAward tabAward = TableManager.GetStoryCopySceneAwardByID(nAwardId, 0);

        return(tabAward);
    }
コード例 #6
0
    public void ShowStarBoxTip(int chapterid, int awardindex, BoxType type)
    {
        Tab_StoryCopySceneChapter tabChapter = TableManager.GetStoryCopySceneChapterByID(chapterid, 0);

        if (tabChapter == null)
        {
            return;
        }

        int nAwardId = GlobeVar.INVALID_ID;

        if (type == BoxType.ChapterAward)
        {
            if (awardindex < 0 || awardindex >= tabChapter.getAwardCount())
            {
                return;
            }

            nAwardId = tabChapter.GetAwardbyIndex(awardindex);
        }
        else if (type == BoxType.LevelAward)
        {
            if (awardindex < 0 || awardindex >= tabChapter.getLevelAwardCount())
            {
                return;
            }

            nAwardId = tabChapter.GetLevelAwardbyIndex(awardindex);
        }

        Tab_StoryCopySceneAward tabAward = TableManager.GetStoryCopySceneAwardByID(nAwardId, 0);

        if (tabAward == null)
        {
            return;
        }

        m_StarBoxTip.SetActive(true);

        for (int i = 0; i < m_StarBoxTipItem.Length; i++)
        {
            m_StarBoxTipItem[i].ClearInfo();
            m_StarBoxTipItem[i].gameObject.SetActive(false);
        }

        // 和任务奖励一样顺序 物品(最多4个) 玩家经验 宠物经验 金钱
        int nItemIndex = 0;

        // 物品
        if (tabAward.getItemIDCount() > 0)
        {
            for (int i = 0; i < tabAward.getItemIDCount(); i++)
            {
                Tab_CommonItem tabItem = TableManager.GetCommonItemByID(tabAward.GetItemIDbyIndex(i), 0);
                if (tabItem != null && tabAward.GetItemNumbyIndex(i) > 0 && nItemIndex < m_StarBoxTipItem.Length)
                {
                    int nItemCount = tabAward.GetItemNumbyIndex(i);
                    m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true);
                    m_StarBoxTipItem[nItemIndex].InitInfo_Item(tabItem.Id, null, nItemCount > 1 ? nItemCount.ToString() : "", nItemCount > 1);
                    nItemIndex += 1;
                }
            }
        }

        // 玩家经验
        if (tabAward.Exp > 0 && nItemIndex < m_StarBoxTipItem.Length)
        {
            m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true);
            m_StarBoxTipItem[nItemIndex].InitInfo_PlayerExp(tabAward.Exp.ToString());
            nItemIndex += 1;
        }

        // 宠物经验
        if (tabAward.FellowExp > 0 && nItemIndex < m_StarBoxTipItem.Length)
        {
            m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true);
            m_StarBoxTipItem[nItemIndex].InitInfo_FellowExp(tabAward.FellowExp.ToString());
            nItemIndex += 1;
        }

        // 金钱
        if (tabAward.Coin > 0 && nItemIndex < m_StarBoxTipItem.Length)
        {
            m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true);
            m_StarBoxTipItem[nItemIndex].InitInfo_Coin(null, tabAward.Coin.ToString(), true);
            nItemIndex += 1;
        }
        if (tabAward.BindYuanBao > 0 && nItemIndex < m_StarBoxTipItem.Length)
        {
            m_StarBoxTipItem[nItemIndex].gameObject.SetActive(true);
            m_StarBoxTipItem[nItemIndex].InitInfo_YuanbaoBind(null, tabAward.BindYuanBao.ToString(), true);
            nItemIndex += 1;
        }

        if (m_StarBoxTipItemGrid.GetComponent <UIGrid>() != null)
        {
            m_StarBoxTipItemGrid.GetComponent <UIGrid>().Reposition();
        }

        // grid一排显示4个 根据奖励数量动态调tips位置和大小
        if (nItemIndex > 4)
        {
            m_StarBoxTipBG.height = 200;
            m_StarBoxTipBG.transform.localPosition = Vector3.zero;
            if (type == BoxType.ChapterAward)
            {
                m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_ChapterAward[awardindex], -100, 0);
            }
            else if (type == BoxType.LevelAward)
            {
                m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_LevelAward[awardindex], 150, 0);
            }
        }
        else
        {
            m_StarBoxTipBG.height = 134;
            m_StarBoxTipBG.transform.localPosition = new Vector3(0, 33, 0);
            if (type == BoxType.ChapterAward)
            {
                m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_ChapterAward[awardindex], -166, 0);
            }
            else if (type == BoxType.LevelAward)
            {
                m_StarBoxTip.transform.localPosition = new Vector3(StarBoxTipPosX_LevelAward[awardindex], 84, 0);
            }
        }
    }
コード例 #7
0
    void UpdateLevels()
    {
        UpdateBuyCount();

//        for (int i = 0; i < m_LevelArrowNor.Length && i < m_LevelArrowDis.Length; i++ )
//        {
//            m_LevelArrowNor[i].SetActive(false);
//            m_LevelArrowDis[i].SetActive(false);
//        }

        if (currentSelectedChapterIdx < 1)
        {
            currentSelectedChapterIdx = 1;
        }
        //StoryCopySceneScoreInfo lastScore = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetAndClearLastScore();
        var chapterInfoList = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetChapterInfoList();

        if (chapterInfoList == null || currentSelectedChapterIdx <= 0 || currentSelectedChapterIdx > chapterInfoList.Count)
        {
            return;
        }
        StoryCopySceneChapterInfo currentChapterInfo = chapterInfoList[currentSelectedChapterIdx - 1];

        Tab_StoryCopySceneChapter chapter = TableManager.GetStoryCopySceneChapterByID(currentChapterInfo.m_nID, 0);

        if (chapter != null)
        {
            ChapterTitleLabel.text = chapter.ChapterName;
        }

        m_nTotalStar = 0;
        for (int i = 0; i < 4; i++)
        {
            JuQingLevelItem item = null;
            switch (i)
            {
            case 0:
            {
                item = Level1;
                break;
            }

            case 1:
            {
                item = Level2;
                break;
            }

            case 2:
            {
                item = Level3;
                break;
            }

            case 3:
            {
                item = Level4;
                break;
            }
            }

            if (item == null)
            {
                continue;
            }

            if (i >= currentChapterInfo._ContaindLevelList.Count)
            {
                item.gameObject.SetActive(false);
                continue;
            }

            item.gameObject.SetActive(true);
            int levelID    = currentChapterInfo._ContaindLevelList [i];
            int nStarCount = GameManager.gameManager.PlayerDataPool.JuQingCopySceneData.GetLevelByLevelID(levelID).GetStarCount();
            item.Init(currentSelectedChapterIdx, levelID);
            m_nTotalStar += nStarCount;
        }

        UpdateChapterAward();
    }