Ejemplo n.º 1
0
    //初始化
    void Init()
    {
        Chapter         chapterData = null;
        DungeonsManager dm          = Core.Data.dungeonsManager;


        if (dm.ChapterList.TryGetValue(this.ChapterID, out chapterData))
        {
            int[] cityID    = chapterData.config.cityID;
            int   cityCount = cityID.Length;
            CreateElement(cityCount);
            //赋值
            for (int i = 0; i < cityCount; i++)
            {
                City city = null;
                if (dm.CityList.TryGetValue(cityID[i], out city))
                {
                    int[] floorID = city.config.floorID;
                    if (floorID.Length > 0)
                    {
                        Floor floor = null;
                        if (dm.FloorList.TryGetValue(floorID[floorID.Length - 1], out floor))
                        {
                            Elements[i].gameObject.SetActive(true);
                            Elements[i].SetData(floor, city);
                        }
                    }
                }
            }
        }
        uiTable.repositionNow = true;
    }
Ejemplo n.º 2
0
    public void Refresh()
    {
        _CanEnter = true;
        MarkSprite.gameObject.SetActive(false);
        Btn_Drop.enabled = true;

        DungeonsManager dm          = Core.Data.dungeonsManager;
        int             lastfloorid = dm.lastFloorId;


        int         currchapter = System.Convert.ToInt32(gameObject.name);
        ChapterData chapter     = dm.reverseToChapterMore(lastfloorid);

        if (chapter != null)
        {
            //Debug.Log(" chapter ="+chapter.ID.ToString() +"  currchapter ="+ currchapter.ToString());
            if (currchapter - chapter.ID == 100)
            {
                uinew.enabled = true;
            }
            else
            {
                uinew.enabled = false;
            }
        }
    }
Ejemplo n.º 3
0
    /*创建CityFloor所有元素
     * */
    public void ShowCityFloorView(Chapter _chapter, GameObject root)
    {
        if (Core.Data.temper != null && Core.Data.playerManager.Lv > Core.Data.temper.mPreLevel)
        {
            LevelUpUI.OpenUI();
            Core.Data.temper.mPreLevel = Core.Data.playerManager.Lv;
            Core.Data.temper.mPreVipLv = Core.Data.playerManager.curVipLv;
        }

        if (cityFloorManager == null)
        {
#if FB2
            //FhjLoadPrefab.GetPrefab("pbUICityFloorManager2")
            cityFloorManager = (UnityEngine.Object.Instantiate(FhjLoadPrefab.GetPrefab("pbUICityFloorManager2")) as GameObject).GetComponent <UICityFloorManager>();
#else
            cityFloorManager = FhjLoadPrefab.GetPrefabClass <UICityFloorManager>();
#endif
            cityFloorManager.OnClickedCityItem  = ClickCityItem;
            cityFloorManager.OnClickedFloorItem = ClickFloorItem;
            cityFloorManager.onBossDesInfoClick = ClickBossDesInfo;
            Transform t = cityFloorManager.transform;
            t.parent        = root.transform;
            t.localPosition = Vector3.back * 10;
            t.localRotation = Quaternion.identity;
            t.localScale    = Vector3.one;
        }

        DungeonsManager dm = Core.Data.dungeonsManager;
        chapter = _chapter;
        if (chapter != null)
        {
            citys = new List <City>();
            foreach (int cityId in chapter.config.cityID)
            {
                citys.Add(dm.CityList[cityId]);
            }
        }
        cityFloorManager.UpdateChapterName(chapter.config.name);
        cityFloorManager.InitCityItems(_chapter.config.cityID);


        if (chapter.toFightCity != null)
        {
            SelectCity(chapter.toFightCity);
        }
        else
        {
            SelectCity(dm.CityList[chapter.toFightCityId]);
        }

        UpdateCityItemsState();
        UpdateFloorItemsState();
    }
Ejemplo n.º 4
0
    public void InitCityItems(int[] citys)
    {
        if (citys != null && citys.Length > 0)
        {
            if (cityItem == null)
            {
                cityItem = FhjLoadPrefab.GetPrefab(FhjPrefabsName.UICityItem);
            }

            DungeonsManager dm    = Core.Data.dungeonsManager;
            int             index = 0;
            foreach (int cityId in citys)
            {
                City itemData = dm.CityList[cityId];

                if (itemData != null)
                {
                    UICityItem _item = null;
                    if (cityList.Count > index)
                    {
                        _item = cityList[index];
                        _item.gameObject.SetActive(true);
                    }
                    else
                    {
                        _item = NGUITools.AddChild(cityRoot.gameObject, cityItem).GetComponent <UICityItem>();
                        _item.gameObject.name = _item.gameObject.name.Substring(0, _item.gameObject.name.IndexOf("(")) + ((char)(index + 'A')).ToString();
                        cityList.Add(_item);
                    }

                    if (_item != null)
                    {
                        _item.InitItem(itemData);
                        _item.OnClickedItem = ClickCityItem;
                        ++index;
                    }
#if FB2
                    _item.SetImage(itemData.config.ID);
#endif
                }
            }

            for (int i = index; i < cityList.Count; ++i)
            {
                cityList[i].gameObject.SetActive(false);
            }
            cityRoot.repositionNow = true;
            _cityScroll.ResetPosition();
        }
    }
    public void Refresh()
    {
        DungeonsManager dm = Core.Data.dungeonsManager;

        int i = 0;

        foreach (Chapter kp in dm.ChapterList.Values)
        {
            if (kp.config.ID == dm.fightChapterId)
            {
                _MyShowList [i].Refresh();
                return;
            }
            i++;
        }
    }
    void Start()
    {
        isRunStart = true;
//		Debug.Log("---------Start---------");

        GameObject obj = PrefabLoader.loadFromPack("GX/pbChapterShowCell") as GameObject;

        ChapterShowCellScript script = null;

        DungeonsManager dm = Core.Data.dungeonsManager;

        _MyShowList = new List <ChapterShowCellScript> ();

        int i = 0;

        foreach (Chapter kp in dm.ChapterList.Values)
        {
            script = (NGUITools.AddChild(ShowRoot, obj)).GetComponent <ChapterShowCellScript> ();
            _MyShowList.Add(script);
            i++;
            if (i < 9)
            {
                script.ChapterSprite.atlas = cptAtlsv1;
            }
            else
            {
                script.ChapterSprite.atlas = cptAtlsv2;
            }

            script.Show(kp, Core.Data.stringManager.getString(20001).Replace("#", i.ToString()), "A3Cpt" + i.ToString());

            script.gameObject.name = kp.config.ID.ToString();
//			if (kp.config.ID == dm.fightChapterId)
//			{
//				script.Refresh ();
//			}
        }

        UIGrid grid = ShowRoot.GetComponent <UIGrid>();

        if (grid != null)
        {
            grid.repositionNow = true;
        }
        Refresh();
    }
Ejemplo n.º 7
0
    public bool SelectCity(City _city)
    {
        _city.isOpen = true;

        if (Core.Data.dungeonsManager.CityList.ContainsKey(_city.config.ID))
        {
            _city.toFightFloorId = Core.Data.dungeonsManager.CityList[_city.config.ID].toFightFloorId;
        }


        //Debug.Log(">>>>>>>>>>>>>city["+_city.config.ID.ToString()+"].toFightFloorId="+_city.toFightFloorId.ToString());

        currCity = _city;
        DungeonsManager dm = Core.Data.dungeonsManager;

        floors = new List <Floor>();
        foreach (int floorId in currCity.config.floorID)
        {
            floors.Add(dm.FloorList[floorId]);
        }

        if (cityFloorManager != null)
        {
            UpdateCityItemsState();
            int index = GetCityIndex(currCity);
            cityFloorManager.JumpToCity(index, citys.Count);
        }

        if (currCity.toFightFloorId == 0)
        {
            currCity.toFightFloorId = floors[0].config.ID;
//			Debug.Log("JC---->SelectCity---->"+currCity.toFightFloorId.ToString());
        }
        if (cityFloorManager != null)
        {
            cityFloorManager.InitFloorItems(floors, currCity.toFightFloorId);
            StartFloor(GetFloor(currCity.toFightFloorId));
        }

        return(true);
    }
Ejemplo n.º 8
0
    //直接跳转副本的某一关
    public bool JumpToFB(int floodID)
    {
        DungeonsManager dm = Core.Data.dungeonsManager;

        //Debug.Log("floodID="+floodID+"    dm.lastFloorId="+dm.lastFloorId);
        if (floodID > dm.lastFloorId)
        {
            return(false);
        }
        int     cityid    = dm.reverseToCity(floodID).ID;
        int     chapterid = dm.reverseToChapter(cityid).ID;
        Chapter c         = (Chapter)dm.ChapterList [chapterid].Clone();

        c.toFightCityId = cityid;
        c.toFightCity   = new City();
        c.toFightCity   = dm.CityList [cityid];
        c.toFightCity.toFightFloorId = floodID;

        DBUIController.mDBUIInstance.SetViewStateWithData(RUIType.EMViewState.S_CityFloor, c);
        return(true);
    }