Example #1
0
    private IEnumerator DoInitialize()
    {
        EventData eventData = GameSection.GetEventData() as EventData;

        if (eventData == null)
        {
            base.Initialize();
        }
        else
        {
            uint regionId = eventData.regionId;
            fromBoss_   = eventData.fromBoss;
            toBoss_     = eventData.toBoss;
            portalData_ = Singleton <FieldMapTable> .I.GetPortalData(eventData.portalId);

            if (portalData_ == null)
            {
                base.Initialize();
            }
            else
            {
                LoadingQueue loadQueue                = new LoadingQueue(this);
                LoadObject   loadedExploreMapFrame    = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMapFrame", false);
                LoadObject   loadedExploreMap         = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMap_" + regionId.ToString("D3"), false);
                LoadObject   loadedPlayerMarker       = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExplorePlayerMarker", false);
                LoadObject   loadedCircle             = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreCircle", false);
                LoadObject   loadedBattleIcon         = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreBattleMarker", false);
                LoadObject   loadedFootprint          = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreTraceMarker", false);
                LoadObject   loadedEncounterBossCutIn = null;
                if (toBoss_)
                {
                    loadedEncounterBossCutIn = loadQueue.Load(RESOURCE_CATEGORY.UI, "InGameFieldQuestWarning", false);
                }
                if (loadQueue.IsLoading())
                {
                    yield return((object)loadQueue.Wait());
                }
                if (null == loadedExploreMap.loadedObject)
                {
                    base.Initialize();
                }
                else
                {
                    if (loadedEncounterBossCutIn != null)
                    {
                        fieldQuestWarningRoot = ResourceUtility.Realizes(loadedEncounterBossCutIn.loadedObject, -1).get_gameObject();
                        UIPanel panel2 = fieldQuestWarningRoot.GetComponentInChildren <UIPanel>();
                        if (panel2 != null)
                        {
                            panel2.depth = 12000;
                        }
                        if (MonoBehaviourSingleton <UIInGameFieldQuestWarning> .IsValid())
                        {
                            MonoBehaviourSingleton <UIInGameFieldQuestWarning> .I.Load(loadQueue);
                        }
                    }
                    mapFrame_ = ResourceUtility.Realizes(loadedExploreMapFrame.loadedObject, base._transform, -1);
                    if (toBoss_)
                    {
                        UIPanel panel = mapFrame_.GetComponent <UIPanel>();
                        panel.renderQueue         = UIPanel.RenderQueue.StartAt;
                        panel.startingRenderQueue = 2900;
                    }
                    map_ = ResourceUtility.Realizes(loadedExploreMap.loadedObject, mapFrame_, -1);
                    Transform map = map_.FindChild("Map");
                    map.get_gameObject().SetActive(true);
                    mapRoot_ = map_.GetComponent <ExploreMapRoot>();
                    ExploreMapLocation[] locations = mapRoot_.locations;
                    for (int k = 0; k < locations.Length; k++)
                    {
                        Transform active   = locations[k].get_transform().FindChild("ExploreSpotActive");
                        Transform inactive = locations[k].get_transform().FindChild("ExploreSpotInactive");
                        Transform sonar    = locations[k].get_transform().FindChild("ExploreSpotSonar");
                        active.get_gameObject().SetActive(true);
                        inactive.get_gameObject().SetActive(false);
                        List <FieldMapTable.FieldGimmickPointTableData> gimmicks = Singleton <FieldMapTable> .I.GetFieldGimmickPointListByMapID((uint)locations[k].mapId);

                        if (gimmicks != null && sonar != null)
                        {
                            for (int i = 0; i < gimmicks.Count; i++)
                            {
                                if (gimmicks[i].gimmickType == FieldMapTable.FieldGimmickPointTableData.GIMMICK_TYPE.SONAR)
                                {
                                    active.get_gameObject().SetActive(false);
                                    inactive.get_gameObject().SetActive(false);
                                    sonar.get_gameObject().SetActive(true);
                                }
                            }
                        }
                    }
                    mapRoot_.UpdatePortals(false);
                    from_ = mapRoot_.FindLocation((int)portalData_.srcMapID);
                    to_   = mapRoot_.FindLocation((int)portalData_.dstMapID);
                    if (null == to_)
                    {
                        base.Initialize();
                    }
                    else
                    {
                        ExploreMapFrame frame = mapFrame_.GetComponent <ExploreMapFrame>();
                        frame.SetMap(mapRoot_);
                        RegionTable.Data regionData = Singleton <RegionTable> .I.GetData(regionId);

                        if (regionData != null)
                        {
                            frame.SetCaption(regionData.regionName);
                        }
                        for (int j = 0; j < playerMarkers_.Length; j++)
                        {
                            playerMarkers_[j] = ResourceUtility.Realizes(loadedPlayerMarker.loadedObject, mapFrame_, -1);
                            ExplorePlayerMarker marker = playerMarkers_[j].GetComponent <ExplorePlayerMarker>();
                            if (null != marker)
                            {
                                marker.SetIndex(j);
                            }
                            marker.get_gameObject().SetActive(false);
                        }
                        selfMarker_ = playerMarkers_[0];
                        Transform bg = mapFrame_.FindChild("BG");
                        bg.get_gameObject().SetActive(true);
                        bgEventListener = UIEventListener.Get(bg.get_gameObject());
                        mapFrame_.FindChild("TaptoSkip").get_gameObject().SetActive(!toBoss_);
                        mapFrame_.FindChild("CaptionRoot/Close").get_gameObject().SetActive(false);
                        mapRoot_.SetMarkers(playerMarkers_, false);
                        ExploreStatus.TraceInfo[] traceHistory = MonoBehaviourSingleton <QuestManager> .I.GetBossTraceHistory();

                        if (traceHistory != null && traceHistory.Length > 0)
                        {
                            Transform lastFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, map_, -1);
                            ExploreStatus.TraceInfo lastInfo = traceHistory[traceHistory.Length - 1];
                            Vector3 lastPos = mapRoot_.GetPositionOnMap(lastInfo.mapId);
                            lastFootprint.set_localPosition(new Vector3(lastPos.x + MarkerOffsetX, lastPos.y + MarkerOffsetY, lastPos.z));
                            lastFootprint.get_gameObject().SetActive(true);
                            if (traceHistory.Length > 1)
                            {
                                Transform lastSecondFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, map_, -1);
                                ExploreStatus.TraceInfo lastSecondInfo = traceHistory[traceHistory.Length - 2];
                                Vector3 lastSecondPos = mapRoot_.GetPositionOnMap(lastSecondInfo.mapId);
                                lastSecondFootprint.set_localPosition(new Vector3(lastSecondPos.x + MarkerOffsetX, lastSecondPos.y + MarkerOffsetY, lastSecondPos.z));
                                lastSecondFootprint.get_gameObject().SetActive(true);
                            }
                        }
                        redCircle = ResourceUtility.Realizes(loadedCircle.loadedObject, map_, -1);
                        redCircle.set_localScale(new Vector3(0.6f, 0.6f, 0.6f));
                        battleIcon = ResourceUtility.Realizes(loadedBattleIcon.loadedObject, map_, -1);
                        if (mapRoot_.showBattleMarker)
                        {
                            int bossMapId = MonoBehaviourSingleton <QuestManager> .I.GetExploreBossAppearMapId();

                            Vector3 pos = mapRoot_.GetPositionOnMap(bossMapId);
                            redCircle.set_localPosition(pos);
                            battleIcon.set_localPosition(new Vector3(pos.x + MarkerOffsetX, pos.y + MarkerOffsetY, pos.z));
                            TweenAlpha tweenAlpha = redCircle.GetComponent <TweenAlpha>();
                            if (null != tweenAlpha)
                            {
                                tweenAlpha.from = tweenAlpha.to;
                            }
                            redCircle.get_gameObject().SetActive(true);
                            battleIcon.get_gameObject().SetActive(true);
                        }
                        else
                        {
                            redCircle.get_gameObject().SetActive(false);
                            battleIcon.get_gameObject().SetActive(false);
                        }
                        base.Initialize();
                    }
                }
            }
        }
    }
Example #2
0
    private IEnumerator DoInitialize()
    {
        uint         regionId              = MonoBehaviourSingleton <FieldManager> .I.currentMapData.regionId;
        LoadingQueue loadQueue             = new LoadingQueue(this);
        LoadObject   loadedExploreMapFrame = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMapFrame", false);
        LoadObject   loadedExploreMap      = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreMap_" + regionId.ToString("D3"), false);
        LoadObject   loadedPlayerMarker    = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExplorePlayerMarker", false);
        LoadObject   loadedCircle          = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreCircle", false);
        LoadObject   loadedBattleIcon      = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreBattleMarker", false);
        LoadObject   loadedFootprint       = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreTraceMarker", false);
        LoadObject   loadedFindIcon        = null;
        LoadObject   loadedDirSonar        = null;
        LoadObject   loadedSonarTexture    = null;

        if (openType == OPEN_MAP_TYPE.SONAR)
        {
            loadedFindIcon     = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreExclametionMarker", false);
            loadedDirSonar     = loadQueue.Load(RESOURCE_CATEGORY.EFFECT_UI, "ef_ui_sonar_02", false);
            loadedSonarTexture = loadQueue.Load(RESOURCE_CATEGORY.WORLDMAP, "ExploreSonarTexture", false);
            CacheAudio(loadQueue);
        }
        if (loadQueue.IsLoading())
        {
            yield return((object)loadQueue.Wait());
        }
        Transform exploreMapFrame = ResourceUtility.Realizes(loadedExploreMapFrame.loadedObject, base._transform, -1);
        Transform exploreMap      = ResourceUtility.Realizes(loadedExploreMap.loadedObject, exploreMapFrame, -1);
        Transform map             = exploreMap.FindChild("Map");

        map.get_gameObject().SetActive(true);
        mapRoot_ = exploreMap.GetComponent <ExploreMapRoot>();
        ExploreMapLocation[] locations = mapRoot_.locations;
        for (int k = 0; k < locations.Length; k++)
        {
            Transform active   = locations[k].get_transform().FindChild("ExploreSpotActive");
            Transform inactive = locations[k].get_transform().FindChild("ExploreSpotInactive");
            Transform sonar    = locations[k].get_transform().FindChild("ExploreSpotSonar");
            active.get_gameObject().SetActive(true);
            inactive.get_gameObject().SetActive(false);
            List <FieldMapTable.FieldGimmickPointTableData> gimmicks = Singleton <FieldMapTable> .I.GetFieldGimmickPointListByMapID((uint)locations[k].mapId);

            if (gimmicks != null && sonar != null)
            {
                for (int i = 0; i < gimmicks.Count; i++)
                {
                    if (gimmicks[i].gimmickType == FieldMapTable.FieldGimmickPointTableData.GIMMICK_TYPE.SONAR)
                    {
                        active.get_gameObject().SetActive(false);
                        inactive.get_gameObject().SetActive(false);
                        sonar.get_gameObject().SetActive(true);
                    }
                }
            }
        }
        mapRoot_.UpdatePortals(false);
        ExploreMapFrame frame = exploreMapFrame.GetComponent <ExploreMapFrame>();

        frame.SetMap(mapRoot_);
        RegionTable.Data regionData = Singleton <RegionTable> .I.GetData(regionId);

        if (regionData != null)
        {
            frame.SetCaption(regionData.regionName);
        }
        for (int j = 0; j < playerMarkers_.Length; j++)
        {
            playerMarkers_[j] = ResourceUtility.Realizes(loadedPlayerMarker.loadedObject, exploreMapFrame, -1);
            ExplorePlayerMarker marker = playerMarkers_[j].GetComponent <ExplorePlayerMarker>();
            if (null != marker)
            {
                marker.SetIndex(j);
            }
            marker.get_gameObject().SetActive(false);
        }
        mapRoot_.SetMarkers(playerMarkers_, false);
        ExploreStatus.TraceInfo[] traceHistory = MonoBehaviourSingleton <QuestManager> .I.GetBossTraceHistory();

        if (traceHistory != null && traceHistory.Length > 0)
        {
            Transform lastFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, exploreMap, -1);
            ExploreStatus.TraceInfo lastInfo = traceHistory[traceHistory.Length - 1];
            Vector3 lastPos = mapRoot_.GetPositionOnMap(lastInfo.mapId);
            lastFootprint.set_localPosition(new Vector3(lastPos.x + 22f, lastPos.y + 33f, lastPos.z));
            lastFootprint.get_gameObject().SetActive(true);
            if (traceHistory.Length > 1)
            {
                Transform lastSecondFootprint          = ResourceUtility.Realizes(loadedFootprint.loadedObject, exploreMap, -1);
                ExploreStatus.TraceInfo lastSecondInfo = traceHistory[traceHistory.Length - 2];
                Vector3 lastSecondPos = mapRoot_.GetPositionOnMap(lastSecondInfo.mapId);
                lastSecondFootprint.set_localPosition(new Vector3(lastSecondPos.x + 22f, lastSecondPos.y + 33f, lastSecondPos.z));
                lastSecondFootprint.get_gameObject().SetActive(true);
            }
        }
        redCircle = ResourceUtility.Realizes(loadedCircle.loadedObject, exploreMap, -1);
        redCircle.set_localScale(new Vector3(0.6f, 0.6f, 0.6f));
        battleIcon = ResourceUtility.Realizes(loadedBattleIcon.loadedObject, exploreMap, -1);
        if (mapRoot_.showBattleMarker && openType != OPEN_MAP_TYPE.SONAR)
        {
            int bossMapId = MonoBehaviourSingleton <QuestManager> .I.GetExploreBossAppearMapId();

            Vector3 pos = mapRoot_.GetPositionOnMap(bossMapId);
            redCircle.set_localPosition(pos);
            battleIcon.set_localPosition(new Vector3(pos.x + 22f, pos.y + 33f, pos.z));
            TweenAlpha tweenAlpha = redCircle.GetComponent <TweenAlpha>();
            if (null != tweenAlpha)
            {
                tweenAlpha.from = tweenAlpha.to;
            }
            redCircle.get_gameObject().SetActive(true);
            battleIcon.get_gameObject().SetActive(true);
        }
        else
        {
            redCircle.get_gameObject().SetActive(false);
            battleIcon.get_gameObject().SetActive(false);
        }
        if (openType == OPEN_MAP_TYPE.SONAR)
        {
            tapToSkip = Utility.FindChild(exploreMapFrame, "TaptoSkip");
            Transform backGround = Utility.FindChild(exploreMapFrame, "BG");
            backGround.get_gameObject().SetActive(true);
            bgEventListener = UIEventListener.Get(backGround.get_gameObject());
            Transform close = Utility.FindChild(exploreMapFrame, "CaptionRoot/Close");
            if (close != null)
            {
                close.get_gameObject().SetActive(false);
            }
            findIcon = ResourceUtility.Realizes(loadedFindIcon.loadedObject, exploreMap, -1);
            findIcon.get_gameObject().SetActive(false);
            sonarTexture = ResourceUtility.Realizes(loadedSonarTexture.loadedObject, exploreMap, -1);
            UITexture       uiTex         = sonarTexture.get_gameObject().GetComponentInChildren <UITexture>();
            UIRenderTexture renderTexture = UIRenderTexture.Get(uiTex, mapRoot_.GetSonarFov(), false, -1);
            renderTexture.modelTransform.set_localPosition(new Vector3(0f, 0f, 150f));
            sonarDirEffect = ResourceUtility.Realizes(loadedDirSonar.loadedObject, renderTexture.modelTransform, renderTexture.renderLayer);
            sonarDirEffect.set_localScale(Vector2.op_Implicit(mapRoot_.GetSonarScale()));
            sonarDirEffect.get_gameObject().SetActive(false);
            renderTexture.Enable(0.25f);
            renderTexture.renderCamera.set_backgroundColor(mapRoot_.sonarBackGroundColor);
            mapRoot_.SetDirectionSonar(sonarDirEffect.get_gameObject());
        }
        base.Initialize();
    }