Example #1
0
    public ERewardState GetChapterRewardStateByAwardIndex(int chapter, int index)
    {
        if (!DataDBSMainChapter.ContainsKey(chapter))
        {
            return(ERewardState.NOT_RECEIVE);
        }
        XMainChapter     vo = DataDBSMainChapter.GetDataById(chapter);
        DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter);
        int starNum         = GetChapterStarNumByChapter(chapter);

        if (starNum < db.Stars[index])
        {
            return(ERewardState.NOT_RECEIVE);
        }
        int s = 0;

        switch (index)
        {
        case 0:
            s = vo.Award1;
            break;

        case 1:
            s = vo.Award2;
            break;

        case 2:
            s = vo.Award3;
            break;
        }
        return(s == 1 ? ERewardState.HAS_RECEIVE : ERewardState.CAN_RECEIVE);
    }
Example #2
0
    private void ShowDialogueContent(DDialogue db)
    {
        string replaceName = string.Empty;

        switch (db.ContentType)
        {
        case EDialogueContentType.TYPE_NONE:
        {
            replaceName = string.Empty;
        }
        break;

        case EDialogueContentType.TYPE_PLAYER:
        {
            Character c = GTWorld.Main;
            replaceName = c == null ? string.Empty : c.Name;
        }
        break;

        case EDialogueContentType.TYPE_ACTOR:
        {
            DActor actorDB = ReadCfgActor.GetDataById(db.ContentID);
            replaceName = actorDB == null ? string.Empty : actorDB.Name;
        }
        break;

        case EDialogueContentType.TYPE_ITEM:
        {
            DItem itemDB = ReadCfgItem.GetDataById(db.ContentID);
            replaceName = itemDB == null ? string.Empty : itemDB.Name;
        }
        break;

        case EDialogueContentType.TYPE_MAP:
        {
            DCopyMainChapter worldDB = ReadCfgCopyMainChapter.GetDataById(db.ContentID);
            replaceName = worldDB == null ? string.Empty : worldDB.Name;
        }
        break;
        }
        dlgContent.text = db.Content.Replace("%p%", replaceName);

        switch (db.ContentShowType)
        {
        case EDialogueContentShowType.Normal:
            dlgContent.GetComponent <TypewriterEffect>().enabled = false;
            break;

        case EDialogueContentShowType.Effect:
            dlgContent.GetComponent <TypewriterEffect>().enabled = true;
            dlgContent.GetComponent <TypewriterEffect>().ResetToBeginning();
            break;
        }
    }
Example #3
0
    private void ShowViewByChapter(int chapter)
    {
        this.chapter = chapter;
        DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter);
        int enterIndex             = MLRaid.Instance.GetMaxCanEnterCopyIndex(copyDifficulty, chapter);

        for (int i = 0; i < 3; i++)
        {
            boxStarNums[i].text = chapterDB.Stars[i].ToString();
            ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, i);
            switch (rewardState)
            {
            case ERewardState.NOT_RECEIVE:
            case ERewardState.CAN_RECEIVE:
                boxStates[i].spriteName = "613";
                break;

            case ERewardState.HAS_RECEIVE:
                boxStates[i].spriteName = "614";
                break;
            }
        }
        chapterName.text = chapterDB.Name;
        for (int i = 0; i < copyItems.Count; i++)
        {
            ItemCopy tab = copyItems[i];
            if (i < chapterDB.Copys.Length)
            {
                tab.item.SetActive(true);
                Color color = i < enterIndex ? Color.white : Color.cyan;
                tab.icon.color = color;
                for (int k = 0; k < tab.stars.Length; k++)
                {
                    tab.stars[k].color = color;
                }
                int   copyID  = chapterDB.Copys[i];
                DCopy db      = ReadCfgCopy.GetDataById(copyID);
                int   starNum = MLRaid.Instance.GetCopyStarNumById(copyID);
                tab.copyName.text  = db.Name;
                tab.copyName.color = i < enterIndex ? Color.yellow : Color.gray;
                tab.item.transform.localPosition = chapterDB.CopyPosArray[i];
                GTItemHelper.ShowStarNum(tab.stars, starNum);
            }
            else
            {
                copyItems[i].item.SetActive(false);
            }
        }
        btnPrev.SetActive(chapter > DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID);
        btnNext.SetActive(chapter < DCopyMainChapter.MAINCOPY_ED_CHAPTER_ID);
    }
Example #4
0
    public int GetChapterStarNumByChapter(int chapter)
    {
        int starNum = 0;

        if (DataDBSMainChapter.ContainsKey(chapter))
        {
            DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter);
            for (int i = 0; i < db.Copys.Length; i++)
            {
                starNum += GetCopyStarNumById(db.Copys[i]);
            }
        }
        return(starNum);
    }
Example #5
0
    private void OnBoxClick(GameObject go)
    {
        GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
        int index           = go.name.ToInt32() - 1;
        DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter);

        GTWindowManager.Instance.OpenWindow(EWindowID.UIAwardBox);
        UIAwardBox   window = (UIAwardBox)GTWindowManager.Instance.GetWindow(EWindowID.UIAwardBox);
        ERewardState state  = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index);

        UIEventListener.VoidDelegate doReceive = delegate(GameObject w)
        {
            GTNetworkSend.Instance.TryMainCopyReceiveReward(chapter, index);
        };
        window.ShowAwardById(db.Awards[index], state, doReceive);
    }
Example #6
0
    private void OnCopyClick(GameObject go)
    {
        GTAudioManager.Instance.PlayEffectAudio(GTAudioKey.SOUND_UI_CLICK);
        DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter);
        int enterIndex      = MLRaid.Instance.GetMaxCanEnterCopyIndex(copyDifficulty, chapter);
        int index           = go.name.ToInt32();

        if (index > enterIndex)
        {
            GTItemHelper.ShowTip("未通关前置关卡");
            return;
        }
        GTWindowManager.Instance.OpenWindow(EWindowID.UIMainCopy);
        UIMainCopy window = (UIMainCopy)GTWindowManager.Instance.GetWindow(EWindowID.UIMainCopy);

        window.ShowViewById(copyDifficulty, chapter, db.Copys[index - 1]);
    }
Example #7
0
    public void TryMainCopyReceiveReward(int chapter, int index)
    {
        ERewardState rewardState = MLRaid.Instance.GetChapterRewardStateByAwardIndex(chapter, index);

        switch (rewardState)
        {
        case ERewardState.NOT_RECEIVE:
            GTItemHelper.ShowTip("未达成条件");
            return;

        case ERewardState.HAS_RECEIVE:
            GTItemHelper.ShowTip("奖励已领取");
            return;
        }
        DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(chapter);
        DAward           awardDB   = ReadCfgAward.GetDataById(chapterDB.Awards[index]);

        if (GTItemHelper.CheckBagFull(awardDB.MaxDropNum))
        {
            return;
        }
    }
Example #8
0
    public int GetMaxCanEnterChapter(int difficulty)
    {
        int chapter = 0;

        if (DataDBSRaid.ContainsKey(difficulty))
        {
            XRaid            raid      = DataDBSRaid.GetDataById(difficulty);
            DCopyMainChapter chapterDB = ReadCfgCopyMainChapter.GetDataById(raid.MaxChapter);
            if (chapterDB.Copys[chapterDB.Copys.Length - 1] == raid.MaxCopyId)
            {
                chapter = GetNextChapter(raid.MaxChapter);
            }
            else
            {
                chapter = raid.MaxChapter;
            }
        }
        else
        {
            chapter = DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID;
        }
        return(chapter);
    }
Example #9
0
    public int GetMaxCanEnterCopyIndex(int difficulty, int chapter)
    {
        int maxCopyID       = GetMaxCopyIDByDifficulty(difficulty);
        int maxChapter      = GetMaxChapterByDifficulty(difficulty);
        DCopyMainChapter db = ReadCfgCopyMainChapter.GetDataById(chapter);

        if (maxChapter == 0 && chapter == DCopyMainChapter.MAINCOPY_ST_CHAPTER_ID)
        {
            return(1);
        }
        if (maxChapter > chapter)
        {
            return(db.Copys.Length);
        }
        if (maxChapter == chapter)
        {
            if (maxCopyID >= 0)
            {
                int index = 1;
                for (int i = 0; i < db.Copys.Length; i++)
                {
                    if (db.Copys[i] <= maxCopyID)
                    {
                        index++;
                    }
                    else
                    {
                        break;
                    }
                }
                index = index > db.Copys.Length ? db.Copys.Length : index;
                return(index);
            }
        }
        return(0);
    }