示例#1
0
    public void Initialize(FieldMapPortalInfo portal_info)
    {
        portalInfo   = portal_info;
        portalData   = portalInfo.portalData;
        portalID     = portalData.portalID;
        isClearOrder = (FieldManager.IsOpenPortalClearOrder(portalData) || FieldManager.IsOpenPortal(portalData));
        if (GameSaveData.instance.isNewReleasePortal(portalID) && FieldManager.IsOpenPortal(portalData))
        {
            GameSaveData.instance.newReleasePortals.Remove(portalID);
        }
        isUnlockedTime = portal_info.portalData.isUnlockedTime();
        isToHardMap    = FieldManager.IsToHardPortal(portalData);
        nowPoint       = portal_info.GetNowPortalPoint();
        maxPoint       = (int)portal_info.GetMaxPortalPoint();
        isFull         = portal_info.IsFull();
        viewType       = VIEW_TYPE.NORMAL;
        if (!isClearOrder || !isUnlockedTime)
        {
            viewType = VIEW_TYPE.NOT_CLEAR_ORDER;
        }
        else if (portalData.dstMapID == 0)
        {
            viewType = VIEW_TYPE.TO_HOME;
        }
        else if (!MonoBehaviourSingleton <WorldMapManager> .I.IsTraveledPortal(portalData))
        {
            viewType = VIEW_TYPE.NOT_TRAVELED;
        }
        else if (isToHardMap)
        {
            viewType = VIEW_TYPE.TO_HARD_MAP;
        }
        if (portalData.dstQuestID != 0)
        {
            if (portalData.dstMapID != 0)
            {
                int num = 0;
                ClearStatusQuest clearStatusQuest = MonoBehaviourSingleton <QuestManager> .I.clearStatusQuest.Find((ClearStatusQuest data) => data.questId == portalData.dstQuestID);

                if (clearStatusQuest != null)
                {
                    num = clearStatusQuest.questStatus;
                }
                if (num != 3 && num != 4)
                {
                    isLock  = true;
                    isQuest = true;
                }
            }
            else
            {
                isQuest = true;
            }
        }
        CreateView();
        if (MonoBehaviourSingleton <DropTargetMarkerManeger> .IsValid())
        {
            MonoBehaviourSingleton <DropTargetMarkerManeger> .I.CheckTarget(this);
        }
    }
 public void OnDiff(BaseModelDiff.DiffFieldPortal diff)
 {
     if (!QuestManager.IsValidExplore())
     {
         bool flag = false;
         if (Utility.IsExist(diff.add))
         {
             int i = 0;
             for (int count = diff.add.Count; i < count; i++)
             {
                 FieldMapPortalInfo fieldMapPortalInfo = current.fieldPortalInfoList.Find((FieldMapPortalInfo p) => p.IsValid() && p.portalData.portalID == diff.add[i].pId);
                 if (fieldMapPortalInfo != null)
                 {
                     fieldMapPortalInfo.fieldPortal = diff.add[i];
                     flag |= fieldMapPortalInfo.IsFull();
                 }
             }
         }
         if (Utility.IsExist(diff.update))
         {
             int j = 0;
             for (int count2 = diff.update.Count; j < count2; j++)
             {
                 FieldMapPortalInfo fieldMapPortalInfo2 = current.fieldPortalInfoList.Find((FieldMapPortalInfo p) => p.IsValid() && p.portalData.portalID == diff.update[j].pId);
                 if (fieldMapPortalInfo2 != null)
                 {
                     if (fieldMapPortalInfo2.fieldPortal != null)
                     {
                         fieldMapPortalInfo2.fieldPortal.used  = diff.update[j].used;
                         fieldMapPortalInfo2.fieldPortal.point = diff.update[j].point;
                     }
                     else
                     {
                         fieldMapPortalInfo2.fieldPortal = MonoBehaviourSingleton <WorldMapManager> .I.GetFieldPortal(diff.update[j].pId);
                     }
                     flag |= fieldMapPortalInfo2.IsFull();
                 }
             }
         }
         if (flag)
         {
             _ResetPortalPointToIndex(0);
         }
     }
 }
    public bool AddPortalPointToPortalInfo(FieldMapPortalInfo portalInfo, int addPoint)
    {
        FieldPortal fieldPortal = portalInfo.fieldPortal;

        if (fieldPortal == null)
        {
            fieldPortal = MonoBehaviourSingleton <WorldMapManager> .I.GetFieldPortal((int)portalInfo.portalData.portalID);

            if (fieldPortal == null)
            {
                fieldPortal       = new FieldPortal();
                fieldPortal.pId   = (int)portalInfo.portalData.portalID;
                fieldPortal.used  = false;
                fieldPortal.point = 0;
            }
            else if (QuestManager.IsValidExplore())
            {
                FieldPortal fieldPortal2 = new FieldPortal();
                fieldPortal2.pId   = fieldPortal.pId;
                fieldPortal2.used  = fieldPortal.used;
                fieldPortal2.point = fieldPortal.point;
                fieldPortal        = fieldPortal2;
            }
            portalInfo.fieldPortal = fieldPortal;
        }
        fieldPortal.point += addPoint;
        if (!portalInfo.IsFull())
        {
            return(false);
        }
        _ResetPortalPointToIndex(current.portalPointToIndex);
        if (QuestManager.IsValidExplore())
        {
            _ResetPortalPointToIndex(0);
        }
        return(true);
    }