Ejemplo n.º 1
0
    public void QuestUpdate()
    {
        this.m_kQuestList.Clear();
        List <USER_CURRENT_QUEST_INFO> list = new List <USER_CURRENT_QUEST_INFO>();

        foreach (USER_CURRENT_QUEST_INFO current in NrTSingleton <NkQuestManager> .Instance.GetMainlist())
        {
            list.Add(current);
        }
        foreach (USER_CURRENT_QUEST_INFO current2 in NrTSingleton <NkQuestManager> .Instance.GetSublist())
        {
            list.Add(current2);
        }
        float num  = 0f;
        int   num2 = 0;

        foreach (USER_CURRENT_QUEST_INFO current3 in list)
        {
            if (!(current3.strQuestUnique == string.Empty))
            {
                string strQuestUnique = current3.strQuestUnique;
                if (strQuestUnique != string.Empty)
                {
                    CQuestGroup questGroupByQuestUnique = NrTSingleton <NkQuestManager> .Instance.GetQuestGroupByQuestUnique(strQuestUnique);

                    if (questGroupByQuestUnique != null)
                    {
                        CQuest questByQuestUnique = NrTSingleton <NkQuestManager> .Instance.GetQuestByQuestUnique(strQuestUnique);

                        if (questByQuestUnique != null)
                        {
                            float num3 = 80f;
                            int   num4 = 0;
                            for (int i = 0; i < 3; i++)
                            {
                                if (0 < questByQuestUnique.GetQuestCommon().cQuestCondition[i].i32QuestCode)
                                {
                                    num4++;
                                }
                            }
                            if (num4 == 1)
                            {
                                this.m_kQuestList.SetColumnData("Mobile/DLG/Main/nlb_questlist_columndata" + NrTSingleton <UIDataManager> .Instance.AddFilePath);
                            }
                            else if (num4 == 2)
                            {
                                this.m_kQuestList.SetColumnData("Mobile/DLG/Main/nlb_questlist2_columndata" + NrTSingleton <UIDataManager> .Instance.AddFilePath);
                                num3 = 120f;
                            }
                            else if (num4 == 3)
                            {
                                this.m_kQuestList.SetColumnData("Mobile/DLG/Main/nlb_questlist3_columndata" + NrTSingleton <UIDataManager> .Instance.AddFilePath);
                                num3 = 160f;
                            }
                            num += num3;
                            this.m_kQuestList.LineHeight = num3;
                            NewListItem newListItem = new NewListItem(this.m_kQuestList.ColumnNum, true, string.Empty);
                            this.ShowTouchButton(questByQuestUnique);
                            string   text  = string.Empty;
                            string[] array = new string[3];
                            text = questByQuestUnique.GetGiveQuestNpcName();
                            if (!(text != string.Empty))
                            {
                                string msg = string.Format("Quest Give Npc Name == Blank, unique = {0}, charcode = {1}", questByQuestUnique.GetQuestUnique(), questByQuestUnique.GetQuestCommon().i32QuestCharKind);
                                NrTSingleton <NrMainSystem> .Instance.Alert(msg);

                                return;
                            }
                            CSelQuestInfo cSelQuestInfo = new CSelQuestInfo();
                            cSelQuestInfo.m_bComplete          = true;
                            cSelQuestInfo.m_SeldQuestCondition = questByQuestUnique.GetQuestCommon().cQuestCondition[0];
                            cSelQuestInfo.m_SelQuest           = questByQuestUnique;
                            cSelQuestInfo.bType = 0;
                            CQuestGroup questGroupByQuestUnique2 = NrTSingleton <NkQuestManager> .Instance.GetQuestGroupByQuestUnique(questByQuestUnique.GetQuestUnique());

                            if (questGroupByQuestUnique2 != null)
                            {
                                if (NrTSingleton <NkQuestManager> .Instance.GetToggleQuestUnique())
                                {
                                    text = NrTSingleton <UIDataManager> .Instance.GetString(this.m_ColorTitle, questByQuestUnique.GetQuestTitle(), "(", questByQuestUnique.GetQuestUnique().ToString(), ")");
                                }
                                else
                                {
                                    text = NrTSingleton <UIDataManager> .Instance.GetString(this.m_ColorTitle, questByQuestUnique.GetQuestTitle());
                                }
                                newListItem.SetListItemData(3, text, cSelQuestInfo, null, null);
                            }
                            for (int j = 0; j < 3; j++)
                            {
                                if (0 < questByQuestUnique.GetQuestCommon().cQuestCondition[j].i32QuestCode)
                                {
                                    array[j] = questByQuestUnique.GetConditionText(current3.i64ParamVal[j], j);
                                    if (string.Empty != array[j])
                                    {
                                        string conditionText = questByQuestUnique.GetConditionText(current3.i64ParamVal[j], j);
                                        string empty         = string.Empty;
                                        bool   bTitle        = NrTSingleton <CTextParser> .Instance.ChangeQuestConditionText(conditionText, out empty);

                                        if (NrTSingleton <NkQuestManager> .Instance.GetToggleQuestUnique())
                                        {
                                            array[j] = string.Concat(new object[]
                                            {
                                                empty,
                                                "(",
                                                questByQuestUnique.GetQuestCommon().cQuestCondition[j].i32QuestCode,
                                                ")"
                                            });
                                        }
                                        else
                                        {
                                            array[j] = empty;
                                        }
                                        CSelQuestInfo cSelQuestInfo2 = new CSelQuestInfo();
                                        int           index          = 5;
                                        if (j == 0)
                                        {
                                            index = 5;
                                        }
                                        else if (j == 1)
                                        {
                                            index = 10;
                                        }
                                        else if (j == 2)
                                        {
                                            index = 13;
                                        }
                                        if (questByQuestUnique.CheckCondition(questByQuestUnique.GetQuestCommon().cQuestCondition[j].i64Param, ref current3.i64ParamVal[j], j) && current3.bFailed == 0)
                                        {
                                            cSelQuestInfo2.m_bComplete          = true;
                                            cSelQuestInfo2.m_SeldQuestCondition = questByQuestUnique.GetQuestCommon().cQuestCondition[j];
                                            cSelQuestInfo2.m_SelQuest           = questByQuestUnique;
                                            cSelQuestInfo2.bType  = 1;
                                            cSelQuestInfo2.bTitle = bTitle;
                                            cSelQuestInfo2.strCon = conditionText;
                                            newListItem.SetListItemData(index, this.m_ColorComplte + array[j], cSelQuestInfo2, null, null);
                                        }
                                        else
                                        {
                                            cSelQuestInfo2.m_bComplete          = false;
                                            cSelQuestInfo2.m_SeldQuestCondition = questByQuestUnique.GetQuestCommon().cQuestCondition[j];
                                            cSelQuestInfo2.m_SelQuest           = questByQuestUnique;
                                            cSelQuestInfo2.bType  = 1;
                                            cSelQuestInfo2.bTitle = bTitle;
                                            cSelQuestInfo2.strCon = conditionText;
                                            newListItem.SetListItemData(index, this.m_ColorNormal + array[j], cSelQuestInfo2, null, null);
                                        }
                                    }
                                }
                            }
                            if (questGroupByQuestUnique.GetQuestType() == 2)
                            {
                                newListItem.SetListItemData(7, string.Empty, questByQuestUnique, new EZValueChangedDelegate(this.ClickCancelQuest), null);
                            }
                            else
                            {
                                newListItem.SetListItemData(6, false);
                                newListItem.SetListItemData(7, false);
                            }
                            newListItem.Data = strQuestUnique;
                            this.m_kQuestList.Add(newListItem);
                            if (0 < num2)
                            {
                                num += this.m_kQuestList.itemSpacing;
                            }
                            num2++;
                        }
                    }
                }
            }
        }
        NrMyCharInfo kMyCharInfo = NrTSingleton <NkCharManager> .Instance.m_kMyCharInfo;

        if (kMyCharInfo != null)
        {
            ChallengeTable sequenceChallengeTable = NrTSingleton <ChallengeManager> .Instance.GetSequenceChallengeTable();

            if (sequenceChallengeTable != null && (int)sequenceChallengeTable.m_nLevel <= kMyCharInfo.GetLevel())
            {
                UserChallengeInfo userChallengeInfo = kMyCharInfo.GetUserChallengeInfo();
                if (userChallengeInfo != null && userChallengeInfo.GetLoadData())
                {
                    Challenge_Info userChallengeInfo2 = userChallengeInfo.GetUserChallengeInfo(sequenceChallengeTable.m_nUnique);
                    num += 80f;
                    this.m_kQuestList.LineHeight = 80f;
                    NewListItem newListItem2 = new NewListItem(this.m_kQuestList.ColumnNum, true, string.Empty);
                    newListItem2.SetListItemData(0, "Win_T_QuestTitleBK2", null, null, null);
                    newListItem2.SetListItemData(2, "Win_I_QuestMark02", null, null, null);
                    newListItem2.SetListItemData(3, this.m_ColorTitle + NrTSingleton <NrTextMgr> .Instance.GetTextFromChallenge(sequenceChallengeTable.m_szTitleTextKey), null, null, null);
                    string str = string.Empty;
                    string textFromChallenge = NrTSingleton <NrTextMgr> .Instance.GetTextFromChallenge(sequenceChallengeTable.m_kRewardInfo[0].m_szConditionTextKey);

                    if (textFromChallenge.Contains("count"))
                    {
                        if (userChallengeInfo2 == null)
                        {
                            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref str, new object[]
                            {
                                textFromChallenge,
                                "count",
                                sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount,
                                "count1",
                                0,
                                "count2",
                                sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount
                            });

                            newListItem2.SetListItemData(5, this.m_ColorNormal + str, null, null, null);
                        }
                        else if (userChallengeInfo2.m_nValue >= (long)sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount)
                        {
                            NrTSingleton <CTextParser> .Instance.ReplaceParam(ref str, new object[]
                            {
                                textFromChallenge,
                                "count",
                                sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount,
                                "count1",
                                userChallengeInfo2.m_nValue,
                                "count2",
                                sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount
                            });

                            newListItem2.SetListItemData(5, this.m_ColorComplte + str, null, null, null);
                        }
                    }
                    else
                    {
                        str = textFromChallenge;
                        if (userChallengeInfo2 == null)
                        {
                            newListItem2.SetListItemData(5, this.m_ColorNormal + str, null, null, null);
                        }
                        else if (userChallengeInfo2.m_nValue >= (long)sequenceChallengeTable.m_kRewardInfo[0].m_nConditionCount)
                        {
                            newListItem2.SetListItemData(5, this.m_ColorComplte + str, null, null, null);
                        }
                        else
                        {
                            newListItem2.SetListItemData(5, this.m_ColorNormal + str, null, null, null);
                        }
                    }
                    newListItem2.SetListItemData(6, false);
                    newListItem2.SetListItemData(7, false);
                    newListItem2.Data = sequenceChallengeTable.m_nUnique.ToString() + this.m_ChallengeUniqueDistinguish;
                    this.m_kQuestList.Add(newListItem2);
                }
            }
        }
        base.SetSize(base.GetSizeX(), num);
        this.m_kQuestList.ResizeViewableArea(this.m_kQuestList.GetSize().x, num);
        NrTSingleton <NkQuestManager> .Instance.UpdateClientNpc(0);
    }