Exemplo n.º 1
0
    //创建地图
    void CreateMap()
    {
        Object prefab = PrefabLoader.loadFromPack("JC/JCPVEPlotMap");

        if (prefab != null)
        {
            Dictionary <int, NewChapter> list_chapter = Core.Data.newDungeonsManager.ChapterList;
            int i = -1;
            foreach (NewChapter data in list_chapter.Values)
            {
                i++;
                GameObject map = Instantiate(prefab) as GameObject;
                map.transform.parent        = uiGrid.transform;
                map.transform.localPosition = new Vector3(uiGrid.cellWidth * i, 0, 0);
                map.transform.localScale    = Vector3.one;
                map.name = i.ToString();
                JCPVEPlotMap jcmap = map.GetComponent <JCPVEPlotMap>();
                if (jcmap != null)
                {
                    jcmap.SetMap(data);
                    List_Maps.Add(jcmap);
                }
                map.SetActive(false);
            }
        }
    }
Exemplo n.º 2
0
    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;
    }
Exemplo n.º 3
0
    //创建地图对象池
    void CreateMapObjectPool()
    {
        Object prefab = PrefabLoader.loadFromPack("JC/JCPVEPlotMap");

        for (int i = -1; i < 2; i++)
        {
            GameObject map = Instantiate(prefab) as GameObject;
            map.transform.parent        = uiGrid.transform;
            map.transform.localPosition = new Vector3(uiGrid.cellWidth * i, 0, 0);
            map.transform.localScale    = Vector3.one;
            map.name = i.ToString();
            JCPVEPlotMap jcmap = map.GetComponent <JCPVEPlotMap>();
            if (jcmap != null)
            {
                //jcmap.SetMap(data);
                List_Maps.Add(jcmap);
            }
            //map.SetActive(false);
        }
    }