void SetTitle(int ChapterID)
    {
        if (ChapterID == Core.Data.newDungeonsManager.startChapterID)
        {
            if (Btn_Left.activeSelf)
            {
                Btn_Left.SetActive(false);
            }
        }
        else if (ChapterID == Core.Data.newDungeonsManager.endChapterID)
        {
            if (Btn_Right.activeSelf)
            {
                Btn_Right.SetActive(false);
            }
        }
        else
        {
            if (!Btn_Left.activeSelf)
            {
                Btn_Left.SetActive(true);
            }
            if (!Btn_Right.activeSelf)
            {
                Btn_Right.SetActive(true);
            }
        }

        NewChapter chapter = null;

        if (list_chapter.TryGetValue(ChapterID, out chapter))
        {
            Lab_Title.text = chapter.config.name;
        }
    }
示例#2
0
        /// <summary>
        /// 添加课程章节
        /// </summary>
        /// <param name="courseId">所属课程</param>
        /// <param name="parentId">父章节</param>
        /// <param name="title">标题</param>
        /// <param name="content">内容</param>
        /// <param name="video">视频地址</param>
        /// <returns></returns>
        public bool Add(long courseId, long parentId, string title, string content, string video)
        {
            var chapter = new NewChapter
            {
                CourseId = courseId,
                ParentId = parentId,
                Title    = title,
                Content  = content,
                Video    = video
            };

            return(chapter.Save());
        }
    void MoveFinished()
    {
        #region 设置箭头的坐标
        SetJianTouPos(CurOpenFloor);
        #endregion

        int MapID = System.Convert.ToInt32(uicenter.centeredObject.name);
        points.SetBright(MapID);

        CurMapIndex = MapID;

        #region 设置标题
        SetTitle(GetChapterIDByMapID(CurMapIndex));
        #endregion


        int LastMapID = int.Parse(List_Maps[List_Maps.Count - 1].gameObject.name);
        if (CurMapIndex == LastMapID)
        {
            JCPVEPlotMap map = List_Maps[0];
            //map.gameObject.name = (CurMapIndex+1).ToString();
            Vector3 pos = List_Maps[List_Maps.Count - 1].transform.localPosition;
            pos.x += uiGrid.cellWidth;
            map.transform.localPosition = pos;
            NewChapter nchapter = null;
            list_chapter.TryGetValue(30100 + (CurMapIndex + 1) * 100, out nchapter);
            map.SetMap(nchapter);
            List_Maps.RemoveAt(0);
            List_Maps.Add(map);
        }
        else
        {
            int FristMapID = int.Parse(List_Maps[0].gameObject.name);
            if (CurMapIndex == FristMapID)
            {
                JCPVEPlotMap map = List_Maps[List_Maps.Count - 1];
                //map.gameObject.name = (CurMapIndex-1).ToString();
                Vector3 pos = List_Maps[0].transform.localPosition;
                pos.x -= uiGrid.cellWidth;
                map.transform.localPosition = pos;
                NewChapter nchapter = null;
                list_chapter.TryGetValue(30100 + (CurMapIndex - 1) * 100, out nchapter);
                map.SetMap(nchapter);
                List_Maps.RemoveAt(List_Maps.Count - 1);
                List_Maps.Insert(0, map);
            }
        }
        _uiscrollview.enabled = true;
    }
    //当前地图是否已通关
    public bool isPassCurMap(int MapID)
    {
        int        ChapterID = GetChapterIDByMapID(MapID);
        NewChapter chapter   = null;

        if (NDManager.ChapterList.TryGetValue(ChapterID, out chapter))
        {
            int[] floorID = chapter.config.floorID;
            if (floorID.Length > 0)
            {
                return(!(NDManager.lastFloorId < floorID[floorID.Length - 1]));
            }
        }
        return(false);
    }
    //如果地图已经存在了,这个时候要跳转到某个一关卡时使用这个函数
    public void OpenPVEWhenExist(int floorID)
    {
        int MapPointCount = LastFloorBelongMapID + 1;

        if (tempOpenFloorID > 0)
        {
            //临时跳转
            if (FloorList.TryGetValue(tempOpenFloorID, out CurOpenFloor))
            {
                ArrowAtMapID = (CurOpenFloor.BelongChapterID - NDManager.startChapterID) / 100;
            }

            CurMapIndex = ArrowAtMapID;

            //创建点
            points.Refresh(MapPointCount);
            points.SetBright(ArrowAtMapID);

//			uicenter.onFinished += MoveFinished;
//			uicenter.onStartMove += MoveStarted;

            #region 初始化最近的三张地图
            for (int i = -1; i <= 1; i++)
            {
                NewChapter nchapter  = null;
                int        chapterID = 30100 + (ArrowAtMapID + i) * 100;
                list_chapter.TryGetValue(chapterID, out nchapter);
                List_Maps[i + 1].SetMap(nchapter);
                if (i == 0)
                {
                    SetTitle(chapterID);
                }
            }
            if (CurMapIndex == 0 && !isUnlockMap(1, false))
            {
                _uiscrollview.enabled = false;
            }
            #endregion

            #region 设置箭头的坐标
            SetJianTouPos(CurOpenFloor);
            #endregion
        }
    }
示例#6
0
    void Start()
    {
        //		Debug.LogError(fData.config.ID+"  ------->  "+ fData.BelongChapterID.ToString());
        if (fData != null)
        {
            //跳到章节 id
            //NewChapterData  newCD = Core.Data.newDungeonsManager.ReverseToChapter(fData.ID);
            NewChapter newCD = null;
            if (Core.Data.newDungeonsManager.ChapterList.TryGetValue(fData.BelongChapterID, out newCD))
            {
                int ChapterId = 0;
                if (newCD != null)
                {
                    ChapterId = newCD.config.ID;
                    int tNum = ChapterId + 10000;
                    lblTitle.text   = string.Format(Core.Data.stringManager.getString(7323), Core.Data.stringManager.getString(tNum));
                    lblChapter.text = fData.config.name;
                }

                lblShop.gameObject.SetActive(false);
                lblLock.gameObject.SetActive(true);
                if (fData.config.ID > Core.Data.newDungeonsManager.lastFloorId)
                {
                    lblLock.color = Color.red;
                    lblLock.text  = Core.Data.stringManager.getString(7325);
                }
                else
                {
                    lblLock.color = Color.yellow;
                    lblLock.text  = Core.Data.dungeonsManager.GetBossShowContent(fData.config.ID);
                }
            }
        }
        else
        {
            lblLock.gameObject.SetActive(false);
            lblShop.gameObject.SetActive(true);
            lblTitle.gameObject.SetActive(false);
            lblChapter.gameObject.SetActive(false);
            lblShop.text = Core.Data.stringManager.getString(7322);
        }
    }
示例#7
0
    void InitData()
    {
        //转换完整章节信息结构<包含网络信息>
        ChapterList = new Dictionary <int, NewChapter>();
        FloorList   = new Dictionary <int, NewFloor>();

        //转换完整小关卡信息结构<包含网络信息>
        foreach (int key in FloorConfigList.Keys)
        {
            NewFloor floor = new NewFloor();
            floor.config = FloorConfigList[key];
            FloorList.Add(key, floor);
        }

        int ChapterPlotCount = 0;

        foreach (int key in ChapterConfigList.Keys)
        {
            if (key / 10000 == 3)
            {
                ChapterPlotCount++;
            }

            NewChapter chapter = new NewChapter();
            chapter.config = ChapterConfigList[key];
            ChapterList.Add(key, chapter);
            int[] floorid = chapter.config.floorID;
            foreach (int id in floorid)
            {
                NewFloor floordata = null;
                if (FloorList.TryGetValue(id, out floordata))
                {
                    floordata.BelongChapterID = key;
                }
            }
        }

        endChapterID = startChapterID + (ChapterPlotCount - 1) * 100;
    }
    //查看地图是否达到解锁条件
    public bool isUnlockMap(int MapID, bool ShowPrompt = true)
    {
        int        TargetChapterID = GetChapterIDByMapID(MapID);
        NewChapter chapter         = null;
        NewFloor   floor           = null;

        if (NDManager.ChapterList.TryGetValue(TargetChapterID, out chapter))
        {
            if (chapter.config.floorID.Length > 0)
            {
                int floorID = chapter.config.floorID[0];
                if (NDManager.FloorList.TryGetValue(floorID, out floor))
                {
                    if (Core.Data.playerManager.Lv >= floor.config.Unlock)
                    {
                        return(true);
                    }
                }
            }
        }

        if (ShowPrompt)
        {
            if (chapter != null)
            {
                if (floor == null)
                {
                    SQYAlertViewMove.CreateAlertViewMove(Core.Data.stringManager.getString(9109));
                }
                else
                {
                    string temp_str = Core.Data.stringManager.getString(9110);
                    temp_str = temp_str.Replace("{}", floor.config.Unlock.ToString());
                    SQYAlertViewMove.CreateAlertViewMove(temp_str);
                }
            }
        }
        return(false);
    }
    void Start()
    {
        NDManager    = Core.Data.newDungeonsManager;
        list_chapter = NDManager.ChapterList;
        FloorList    = NDManager.FloorList;

        CreateMapObjectPool();

        uicenter = uiGrid.GetComponent <JCUICenterOnChild>();

        //地图点数(数量)
        int MapPointCount = LastFloorBelongMapID + 1;

        //计算开启关所在地图<章节>
        if (tempOpenFloorID > 0)
        {
            //临时跳转
            if (FloorList.TryGetValue(tempOpenFloorID, out CurOpenFloor))
            {
                ArrowAtMapID = (CurOpenFloor.BelongChapterID - NDManager.startChapterID) / 100;
            }
        }
        else
        {
            //正常跳转到最新关
            int CurOpenFloorID = NDManager.lastFloorId + 1;
            if (CurOpenFloorID > 60548)
            {
                CurOpenFloorID = 60548;
            }
            //如果关卡存在
            if (FloorList.TryGetValue(CurOpenFloorID, out CurOpenFloor))
            {
                //计算箭头所在地图
                ArrowAtMapID = (CurOpenFloor.BelongChapterID - NDManager.startChapterID) / 100;
                //如果箭头所在地图没有解锁
                while (!isUnlockMap(ArrowAtMapID, false) && CurOpenFloorID > NDManager.startFloorID)
                {
                    CurOpenFloorID--;
                    if (FloorList.TryGetValue(CurOpenFloorID, out CurOpenFloor))
                    {
                        ArrowAtMapID  = (CurOpenFloor.BelongChapterID - NDManager.startChapterID) / 100;
                        MapPointCount = ArrowAtMapID + 1;
                    }
                }
            }
        }

        CurMapIndex = ArrowAtMapID;

        //创建点
        points.Refresh(MapPointCount);
        points.SetBright(ArrowAtMapID);

        uicenter.onFinished  += MoveFinished;
        uicenter.onStartMove += MoveStarted;

        #region 初始化最近的三张地图
        for (int i = -1; i <= 1; i++)
        {
            NewChapter nchapter  = null;
            int        chapterID = 30100 + (ArrowAtMapID + i) * 100;
            list_chapter.TryGetValue(chapterID, out nchapter);
            List_Maps[i + 1].SetMap(nchapter);
            if (i == 0)
            {
                SetTitle(chapterID);
            }
        }
        if (CurMapIndex == 0 && !isUnlockMap(1, false))
        {
            _uiscrollview.enabled = false;
        }
        #endregion

        #region 设置箭头的坐标
        SetJianTouPos(CurOpenFloor);
        #endregion


        //检测最新漫画 是否 下载
        if (Core.Data.usrManager.UserConfig.cartoon == 1)
        {
            UIDownloadTexture ud = new UIDownloadTexture();
            StartCoroutine(ud.PreDownload((Core.Data.newDungeonsManager.lastFloorId + 2).ToString() + "-1.jpg"));
            StartCoroutine(ud.PreDownload((Core.Data.newDungeonsManager.lastFloorId + 2).ToString() + "-2.jpg"));
        }
    }
示例#10
0
    public void SetMap(NewChapter chapterData)
    {
        if (chapterData == null)
        {
            gameObject.SetActive(false);
            return;
        }

        if (!gameObject.activeSelf)
        {
            gameObject.SetActive(true);
        }
        int MapID = (chapterData.config.ID - 30100) / 100;

        gameObject.name = MapID.ToString();

        NewChapterData configdata = chapterData.config;

        //JCPVEPlotController.Instance.Lab_Title.text = configdata.name;
        Spr_Map.spriteName     = configdata.mapID;
        Spr_MapPath.spriteName = configdata.pathMapID;
        Spr_MapPath.MakePixelPerfect();
        Spr_MapPath.transform.localScale = new Vector3(2.048081f, 2.048081f, 1f);
        mask.color = chapterData.color;
        int[] floorID = configdata.floorID;

        Spr_MapPath.transform.localPosition = chapterData.pathPosition;


        #region 建筑物
        if (bulidings.Count < floorID.Length)
        {
            int    cha    = floorID.Length - bulidings.Count;
            Object prefab = PrefabLoader.loadFromPack("JC/JCPVEPlotBuilding");
            for (int i = 0; i < cha; i++)
            {
                if (prefab != null)
                {
                    GameObject buliding = Instantiate(prefab) as GameObject;
                    buliding.transform.parent     = MapGrid.transform;
                    buliding.transform.localScale = Vector3.one;
                    JCPVEPlotFloor script = buliding.GetComponent <JCPVEPlotFloor>();
                    bulidings.Add(script);
                }
            }
        }
        if (floorID.Length > 0)
        {
            Dictionary <int, NewFloor> FloorList = Core.Data.newDungeonsManager.FloorList;
            int i = 0;
            for (; i < floorID.Length; i++)
            {
                NewFloor floorData = null;
                if (FloorList.TryGetValue(floorID[i], out floorData))
                {
                    bulidings[i].name = floorID[i].ToString();
                    if (bulidings[i] != null)
                    {
                        bulidings[i].SetData(floorData);
                        if (!JCPVEPlotController.Instance.Dic_Floors.ContainsKey(floorID[i]))
                        {
                            JCPVEPlotController.Instance.Dic_Floors.Add(floorID[i], bulidings[i]);
                        }
                        else
                        {
                            JCPVEPlotController.Instance.Dic_Floors[floorID[i]] = bulidings[i];
                        }
                    }
                }
            }
            for (; i < bulidings.Count; i++)
            {
                bulidings[i].SetData(null);
            }
        }
        #endregion

        #region 一切没有解锁的或不能访问的状态一律隐藏
        if (!JCPVEPlotController.Instance.isUnlockMap((chapterData.config.ID - 30100) / 100, false))
        {
            gameObject.SetActive(false);
        }
        if (MapID > 0)
        {
            //如果之前一关没有通关
            if (!JCPVEPlotController.Instance.isPassCurMap(MapID - 1))
            {
                gameObject.SetActive(false);
            }
        }
        #endregion
    }