private int Compare(SortCompareData lp, SortCompareData rp)
    {
        QuestSortData questSortData  = lp as QuestSortData;
        QuestSortData questSortData2 = rp as QuestSortData;

        if (questSortData == null || questSortData2 == null)
        {
            return(0);
        }
        float num   = questSortData.itemData.remainTimes.Min();
        float num2  = questSortData2.itemData.remainTimes.Min();
        bool  flag  = num < SHOW_QUEST_REMAIN_LIMIT_SECOND;
        bool  flag2 = num2 < SHOW_QUEST_REMAIN_LIMIT_SECOND;

        if (lp.IsAbsFirst() != rp.IsAbsFirst())
        {
            return((!lp.IsAbsFirst()) ? 1 : (-1));
        }
        if (flag != flag2)
        {
            return((!flag) ? 1 : (-1));
        }
        int num3 = questSortData2.GetRarity() - questSortData.GetRarity();

        if (num3 == 0)
        {
            return((int)(questSortData2.GetUniqID() - questSortData.GetUniqID()));
        }
        return(num3);
    }
    private void UpdateGirdListItemQuest(int i, Transform t, bool is_recycle)
    {
        //IL_0427: Unknown result type (might be due to invalid IL or missing references)
        //IL_044c: Unknown result type (might be due to invalid IL or missing references)
        List <GameSectionHistory.HistoryData> historyList = MonoBehaviourSingleton <GameSceneManager> .I.GetHistoryList();

        bool flag = historyList.Any((GameSectionHistory.HistoryData h) => h.sectionName.StartsWith("GuildRequest"));

        SetActive(t, true);
        SetEvent(t, "SELECT_ORDER", i);
        QuestSortData questSortData = questGridDatas[i].questSortData;
        UIScrollView  component     = GetCtrl(UI.SCR_ORDER_QUEST).GetComponent <UIScrollView>();
        QuestInfoData info          = questSortData.itemData.infoData;

        if (flag)
        {
            SetActive(t, UI.TWN_DIFFICULT_STAR, false);
            SetActive(t, UI.TXT_NEED_POINT, true);
            string text = string.Format(StringTable.Get(STRING_CATEGORY.GUILD_REQUEST, 6u), MonoBehaviourSingleton <GuildRequestManager> .I.GetNeedPoint(info.questData.tableData.rarity), MonoBehaviourSingleton <GuildRequestManager> .I.GetNeedTimeWithFormat(info.questData.tableData.rarity));
            SetLabelText(t, UI.TXT_NEED_POINT, text);
        }
        else
        {
            SetActive(t, UI.TWN_DIFFICULT_STAR, false);
            SetActive(t, UI.TXT_NEED_POINT, false);
        }
        EnemyTable.EnemyData enemyData = Singleton <EnemyTable> .I.GetEnemyData((uint)info.questData.tableData.GetMainEnemyID());

        QuestSortData questSortData2 = questSortData;
        ItemIcon      icon           = ItemIcon.Create(questSortData2.GetIconType(), questSortData2.GetIconID(), questSortData2.GetRarity(), FindCtrl(t, UI.OBJ_ENEMY), questSortData2.GetIconElement(), null, -1, null, 0, false, -1, false, null, false, 0, 0, false, GET_TYPE.PAY);

        icon.SetEnableCollider(false);
        SetActive(t, UI.SPR_ELEMENT_ROOT, enemyData.element != ELEMENT_TYPE.MAX);
        SetElementSprite(t, UI.SPR_ELEMENT, (int)enemyData.element);
        SetElementSprite(t, UI.SPR_WEAK_ELEMENT, (int)enemyData.weakElement);
        SetActive(t, UI.STR_NON_WEAK_ELEMENT, enemyData.weakElement == ELEMENT_TYPE.MAX);
        SetLabelText(t, UI.LBL_QUEST_NAME, info.questData.tableData.questText);
        int num = 1;
        ClearStatusQuestEnemySpecies clearStatusQuestEnemySpecies = MonoBehaviourSingleton <QuestManager> .I.GetClearStatusQuestEnemySpecies(info.questData.tableData.questID);

        if (clearStatusQuestEnemySpecies != null)
        {
            num = clearStatusQuestEnemySpecies.questStatus;
        }
        int value = i + 100;

        SetToggleGroup(t, UI.OBJ_ICON_NEW, value);
        SetToggleGroup(t, UI.OBJ_ICON_CLEARED, value);
        SetToggleGroup(t, UI.OBJ_ICON_COMPLETE, value);
        CLEAR_STATUS cLEAR_STATUS = (CLEAR_STATUS)num;

        if (cLEAR_STATUS != CLEAR_STATUS.NEW)
        {
            SetToggle(t, UI.OBJ_ICON_NEW, false);
            SetToggle(t, UI.OBJ_ICON_CLEARED, false);
            SetToggle(t, UI.OBJ_ICON_COMPLETE, false);
            SetActive(t, UI.OBJ_ICON_ROOT, false);
            SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_NEW, null);
            SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_COMPLETE, null);
        }
        else
        {
            SetActive(t, UI.OBJ_ICON_ROOT, true);
            SetToggle(t, UI.OBJ_ICON_NEW, true);
            SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_COMPLETE, null);
            SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_NEW, "ef_ui_questselect_new");
        }
        int num2 = info.questData.num;
        int num3 = 0;

        if (MonoBehaviourSingleton <UserInfoManager> .I.isGuildRequestOpen)
        {
            num3 = (from g in MonoBehaviourSingleton <GuildRequestManager> .I.guildRequestData.guildRequestItemList
                    where g.questId == (int)info.questData.tableData.questID
                    select g).Count();
        }
        int num4 = num2 - num3;

        SetLabelText(t, UI.LBL_ORDER_NUM, num4.ToString());
        if (num4 <= 0)
        {
            t.GetComponent <UIButton>().isEnabled = false;
        }
        Transform val = FindCtrl(t, UI.OBJ_FRAME);

        if (val != null)
        {
            UIPanel uiPanel = val.get_gameObject().GetComponent <UIPanel>();
            if (uiPanel == null)
            {
                uiPanel       = val.get_gameObject().AddComponent <UIPanel>();
                uiPanel.depth = component.panel.depth + 1;
            }
            uiPanel.widgetsAreStatic = false;
            if (isScrollViewReady)
            {
                PanelToStatic(icon, uiPanel);
            }
            else
            {
                onScrollViewReady = (Action)Delegate.Combine(onScrollViewReady, (Action) delegate
                {
                    PanelToStatic(icon, uiPanel);
                });
            }
        }
        QuestItemInfo itemData   = questSortData.itemData;
        bool          is_visible = false;

        foreach (float remainTime in itemData.remainTimes)
        {
            float num5 = remainTime;
            if (num5 < SHOW_QUEST_REMAIN_LIMIT_SECOND)
            {
                is_visible = true;
                break;
            }
        }
        SetLabelText(t, UI.LBL_REMAIN, StringTable.Get(STRING_CATEGORY.GATE_QUEST_NAME, 1u));
        SetActive(t, UI.LBL_REMAIN, is_visible);
    }
    protected virtual void ShowSelectUI()
    {
        //IL_0240: Unknown result type (might be due to invalid IL or missing references)
        //IL_024f: Unknown result type (might be due to invalid IL or missing references)
        int num  = (!isInGameScene && TutorialStep.HasQuestSpecialUnlocked()) ? 1 : 2;
        int num2 = (showMode != 0) ? num : 0;
        int num3 = (showMode != SHOW_MODE.QUEST) ? num : 0;
        int num4 = (showMode != SHOW_MODE.ORDER) ? num : 0;

        SetActive((Enum)UI.OBJ_DELIVERY_ROOT, showMode == SHOW_MODE.DELIVERY);
        SetActive((Enum)UI.OBJ_QUEST_ROOT, showMode == SHOW_MODE.QUEST);
        SetActive((Enum)UI.OBJ_ORDER_ROOT, showMode == SHOW_MODE.ORDER);
        SetButtonSprite((Enum)UI.BTN_DELIVERY, "QuestTabBtnBase" + SPR_ON_OFF[num2], true);
        SetSprite((Enum)UI.SPR_DELIVERY_TEXT, "QuestTabBtnText" + SPR_INDEX[0] + SPR_ON_OFF[num2]);
        SetSprite((Enum)UI.SPR_DELIVERY_ICON, "QuestTabBtnIcon" + SPR_INDEX[0] + SPR_ON_OFF[num2]);
        SetButtonSprite((Enum)UI.BTN_QUEST, "QuestTabBtnBase" + SPR_ON_OFF[num3], true);
        SetSprite((Enum)UI.SPR_QUEST_TEXT, "QuestTabBtnText" + SPR_INDEX[1] + SPR_ON_OFF[num3]);
        SetSprite((Enum)UI.SPR_QUEST_ICON, "QuestTabBtnIcon" + SPR_INDEX[1] + SPR_ON_OFF[num3]);
        SetButtonSprite((Enum)UI.BTN_ORDER, "QuestTabBtnBase" + SPR_ON_OFF[num4], true);
        SetSprite((Enum)UI.SPR_ORDER_TEXT, "QuestTabBtnText" + SPR_INDEX[2] + SPR_ON_OFF[num4]);
        SetSprite((Enum)UI.SPR_ORDER_ICON, "QuestTabBtnIcon" + SPR_INDEX[2] + SPR_ON_OFF[num4]);
        if (!TutorialStep.HasQuestSpecialUnlocked())
        {
            SetButtonEnabled((Enum)UI.BTN_QUEST, false);
            SetButtonEnabled((Enum)UI.BTN_ORDER, false);
            SetActive((Enum)UI.BTN_EVENT, false);
        }
        if (!isInGameScene)
        {
            SetRenderNPCModel((Enum)UI.TEX_NPCMODEL, 0, MonoBehaviourSingleton <OutGameSettingsManager> .I.homeScene.questCenterNPCPos, MonoBehaviourSingleton <OutGameSettingsManager> .I.homeScene.questCenterNPCRot, MonoBehaviourSingleton <OutGameSettingsManager> .I.homeScene.questCenterNPCFOV, (Action <NPCLoader>)null);
            SetLabelText((Enum)UI.LBL_NPC_MESSAGE, npcText);
        }
        SetActive((Enum)UI.OBJ_NPC_MESSAGE, !isInGameScene);
        if (showMode == SHOW_MODE.DELIVERY)
        {
            SetActive((Enum)UI.SPR_TAB_NORMAL, UI.BTN_TAB_NORMAL == selectedTab);
            SetActive((Enum)UI.SPR_TAB_DAILY, UI.BTN_TAB_DAILY == selectedTab);
            SetActive((Enum)UI.SPR_TAB_WEEKLY, UI.BTN_TAB_WEEKLY == selectedTab);
            SetButtonSprite((Enum)UI.BTN_TAB_NORMAL, (selectedTab != UI.BTN_TAB_NORMAL) ? "PickeShopBtn_Normal_off" : "PickeShopBtn_Green_on", false);
            SetButtonSprite((Enum)UI.BTN_TAB_DAILY, (selectedTab != UI.BTN_TAB_DAILY) ? "PickeShopBtn_Normal_off" : "PickeShopBtn_Green_on", false);
            SetButtonSprite((Enum)UI.BTN_TAB_WEEKLY, (selectedTab != UI.BTN_TAB_WEEKLY) ? "PickeShopBtn_Normal_off" : "PickeShopBtn_Green_on", false);
            SetNPCMessage(selectedTab);
            switch (selectedTab)
            {
            case UI.BTN_TAB_NORMAL:
                SetDeliveryList(normalDeliveryInfo);
                break;

            case UI.BTN_TAB_DAILY:
                SetDeliveryList(dailyDeliveryInfo);
                break;

            case UI.BTN_TAB_WEEKLY:
                SetDeliveryList(weeklyDeliveryInfo);
                break;
            }
        }
        else if (showMode == SHOW_MODE.ORDER)
        {
            if (questItemAry == null && MonoBehaviourSingleton <InventoryManager> .I.questItemInventory.GetCount() > 0)
            {
                List <QuestItemInfo> list = new List <QuestItemInfo>();
                MonoBehaviourSingleton <InventoryManager> .I.ForAllQuestInvetory(delegate(QuestItemInfo item)
                {
                    if (item.infoData.questData.num > 0)
                    {
                        list.Add(item);
                    }
                });

                questItemAry = list.ToArray();
                GetCtrl(UI.GRD_ORDER_QUEST).DestroyChildren();
            }
            if (questItemAry == null || questItemAry.Length == 0)
            {
                SetActive((Enum)UI.BTN_SORT, false);
                SetActive((Enum)UI.GRD_ORDER_QUEST, false);
                SetActive((Enum)UI.STR_ORDER_NON_LIST, true);
            }
            else
            {
                questSortData = sortSettings.CreateSortAry <QuestItemInfo, QuestSortData>(questItemAry);
                SetActive((Enum)UI.GRD_ORDER_QUEST, true);
                SetActive((Enum)UI.STR_ORDER_NON_LIST, false);
                SetActive((Enum)UI.BTN_SORT, true);
                SetLabelText((Enum)UI.LBL_SORT, sortSettings.GetSortLabel());
                SetToggle((Enum)UI.TGL_ICON_ASC, sortSettings.orderTypeAsc);
                SetDynamicList((Enum)UI.GRD_ORDER_QUEST, "QuestListOrderItem", questSortData.Length, false, (Func <int, bool>) null, (Func <int, Transform, Transform>) null, (Action <int, Transform, bool>) delegate(int i, Transform t, bool is_recycle)
                {
                    QuestSpecialSelect questSpecialSelect2 = this;
                    SetActive(t, true);
                    SetEvent(t, "SELECT_ORDER", i);
                    QuestInfoData info2 = this.questSortData[i].itemData.infoData;
                    int num9            = (int)(info2.questData.tableData.difficulty + 1);
                    int l = 0;
                    for (int num10 = difficult.Length; l < num10; l++)
                    {
                        SetActive(t, difficult[l], l < num9);
                    }
                    if (!is_recycle)
                    {
                        ResetTween(t, UI.TWN_DIFFICULT_STAR, 0);
                        PlayTween(t, UI.TWN_DIFFICULT_STAR, true, null, false, 0);
                    }
                    EnemyTable.EnemyData enemyData2 = Singleton <EnemyTable> .I.GetEnemyData((uint)info2.questData.tableData.GetMainEnemyID());
                    QuestSortData questSortData     = this.questSortData[i];
                    ItemIcon itemIcon2 = ItemIcon.Create(questSortData.GetIconType(), questSortData.GetIconID(), questSortData.GetRarity(), FindCtrl(t, UI.OBJ_ENEMY), questSortData.GetIconElement(), null, -1, null, 0, false, -1, false, null, false, 0, 0, false, GET_TYPE.PAY);
                    itemIcon2.SetEnableCollider(false);
                    SetActive(t, UI.SPR_ELEMENT_ROOT, enemyData2.element != ELEMENT_TYPE.MAX);
                    SetElementSprite(t, UI.SPR_ELEMENT, (int)enemyData2.element);
                    SetElementSprite(t, UI.SPR_WEAK_ELEMENT, (int)enemyData2.weakElement);
                    SetActive(t, UI.STR_NON_WEAK_ELEMENT, enemyData2.weakElement == ELEMENT_TYPE.MAX);
                    SetLabelText(t, UI.LBL_QUEST_NAME, info2.questData.tableData.questText);
                    int num11 = 1;
                    ClearStatusQuest clearStatusQuest2 = MonoBehaviourSingleton <QuestManager> .I.clearStatusQuest.Find((ClearStatusQuest data) => info2.questData.tableData.questID == data.questId);
                    if (clearStatusQuest2 != null)
                    {
                        num11 = clearStatusQuest2.questStatus;
                    }
                    int value2 = i + 100;
                    SetToggleGroup(t, UI.OBJ_ICON_NEW, value2);
                    SetToggleGroup(t, UI.OBJ_ICON_CLEARED, value2);
                    SetToggleGroup(t, UI.OBJ_ICON_COMPLETE, value2);
                    switch (num11)
                    {
                    default:
                        SetToggle(t, UI.OBJ_ICON_NEW, false);
                        SetToggle(t, UI.OBJ_ICON_CLEARED, false);
                        SetToggle(t, UI.OBJ_ICON_COMPLETE, false);
                        break;

                    case 1:
                        SetToggle(t, UI.OBJ_ICON_NEW, true);
                        SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_NEW, "ef_ui_questselect_new");
                        break;

                    case 3:
                        SetToggle(t, UI.OBJ_ICON_CLEARED, true);
                        break;

                    case 4:
                        SetToggle(t, UI.OBJ_ICON_COMPLETE, true);
                        SetVisibleWidgetEffect(UI.SCR_ORDER_QUEST, t, UI.SPR_ICON_COMPLETE, "ef_ui_questselect_complete");
                        break;
                    }
                    SetLabelText(t, UI.LBL_ORDER_NUM, info2.questData.num.ToString());
                    SetActive(t, UI.LBL_REMAIN, false);
                });
            }
        }
        else if (showMode == SHOW_MODE.QUEST)
        {
            if (questInfo == null || questInfo.Length == 0)
            {
                SetActive((Enum)UI.GRD_QUEST, false);
                SetActive((Enum)UI.STR_QUEST_NON_LIST, true);
            }
            else
            {
                SetActive((Enum)UI.STR_QUEST_NON_LIST, false);
                SetActive((Enum)UI.GRD_QUEST, true);
                SetDynamicList((Enum)UI.GRD_QUEST, "QuestListItem", questInfo.Length, false, (Func <int, bool>) null, (Func <int, Transform, Transform>) null, (Action <int, Transform, bool>) delegate(int i, Transform t, bool is_recycle)
                {
                    QuestSpecialSelect questSpecialSelect = this;
                    SetEvent(t, "SELECT_QUEST", i);
                    QuestInfoData info = questInfo[i];
                    int num5           = (int)(info.questData.tableData.difficulty + 1);
                    int j = 0;
                    for (int num6 = difficult.Length; j < num6; j++)
                    {
                        SetActive(t, difficult[j], j < num5);
                    }
                    if (!is_recycle)
                    {
                        ResetTween(t, UI.TWN_DIFFICULT_STAR, 0);
                        PlayTween(t, UI.TWN_DIFFICULT_STAR, true, null, false, 0);
                    }
                    EnemyTable.EnemyData enemyData = Singleton <EnemyTable> .I.GetEnemyData((uint)info.questData.tableData.GetMainEnemyID());
                    if (enemyData != null)
                    {
                        SetActive(t, UI.OBJ_ENEMY, true);
                        int iconId         = enemyData.iconId;
                        RARITY_TYPE?rarity = (info.questData.tableData.questType != QUEST_TYPE.ORDER) ? null : new RARITY_TYPE?(info.questData.tableData.rarity);
                        ItemIcon itemIcon  = ItemIcon.Create(ITEM_ICON_TYPE.QUEST_ITEM, iconId, rarity, FindCtrl(t, UI.OBJ_ENEMY), enemyData.element, null, -1, null, 0, false, -1, false, null, false, 0, 0, false, GET_TYPE.PAY);
                        itemIcon.SetEnableCollider(false);
                        SetActive(t, UI.SPR_ELEMENT_ROOT, enemyData.element != ELEMENT_TYPE.MAX);
                        SetElementSprite(t, UI.SPR_ELEMENT, (int)enemyData.element);
                        SetElementSprite(t, UI.SPR_WEAK_ELEMENT, (int)enemyData.weakElement);
                        SetActive(t, UI.STR_NON_WEAK_ELEMENT, enemyData.weakElement == ELEMENT_TYPE.MAX);
                    }
                    else
                    {
                        SetActive(t, UI.OBJ_ENEMY, false);
                        SetElementSprite(t, UI.SPR_WEAK_ELEMENT, 6);
                        SetActive(t, UI.STR_NON_WEAK_ELEMENT, true);
                    }
                    SetLabelText(t, UI.LBL_QUEST_NUM, string.Empty);
                    SetLabelText(t, UI.LBL_QUEST_NAME, info.questData.tableData.questText);
                    if (!info.isExistMission)
                    {
                        SetActive(t, UI.OBJ_MISSION_INFO_ROOT, false);
                    }
                    else
                    {
                        SetActive(t, UI.OBJ_MISSION_INFO_ROOT, true);
                        int k = 0;
                        for (int num7 = info.missionData.Length; k < num7; k++)
                        {
                            SetActive(t, ui_top_crown[k], info.missionData[k] != null);
                            if (info.missionData[k] != null)
                            {
                                SetActive(t, ui_crown[k], info.missionData[k].state >= CLEAR_STATUS.CLEAR);
                            }
                        }
                    }
                    int num8 = 1;
                    ClearStatusQuest clearStatusQuest = MonoBehaviourSingleton <QuestManager> .I.clearStatusQuest.Find((ClearStatusQuest data) => info.questData.tableData.questID == data.questId);
                    if (clearStatusQuest != null)
                    {
                        num8 = clearStatusQuest.questStatus;
                    }
                    int value = i + 100;
                    SetToggleGroup(t, UI.OBJ_ICON_NEW, value);
                    SetToggleGroup(t, UI.OBJ_ICON_CLEARED, value);
                    SetToggleGroup(t, UI.OBJ_ICON_COMPLETE, value);
                    switch (num8)
                    {
                    default:
                        SetToggle(t, UI.OBJ_ICON_NEW, false);
                        SetToggle(t, UI.OBJ_ICON_CLEARED, false);
                        SetToggle(t, UI.OBJ_ICON_COMPLETE, false);
                        break;

                    case 1:
                        SetToggle(t, UI.OBJ_ICON_NEW, true);
                        SetVisibleWidgetEffect(UI.SCR_NORMAL_QUEST, t, UI.SPR_ICON_NEW, "ef_ui_questselect_new");
                        break;

                    case 3:
                        SetToggle(t, UI.OBJ_ICON_CLEARED, true);
                        break;

                    case 4:
                        SetToggle(t, UI.OBJ_ICON_COMPLETE, true);
                        SetVisibleWidgetEffect(UI.SCR_NORMAL_QUEST, t, UI.SPR_ICON_COMPLETE, "ef_ui_questselect_complete");
                        break;
                    }
                });
            }
        }
    }