/*创建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(); }
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(); } }
void SetItem() { TemporyData temp = Core.Data.temper; List <BanBattleRole> atksidelist = BanBattleManager.Instance.GetRoleList(BanBattleRole.Group.Attack); List <BanBattleRole> defsidelist = BanBattleManager.Instance.GetRoleList(BanBattleRole.Group.Defense); NewFloor floor = Core.Data.newDungeonsManager.curFightingFloor; bool side = false; if (floor != null) { side = floor.config.FightType == 0; } int itemNum = atksidelist.Count > defsidelist.Count ? atksidelist.Count : defsidelist.Count; RED.RemoveChildsImmediate(_grid.transform); for (int i = 0; i < itemNum; ++i) { GameObject pbitem = FhjLoadPrefab.GetPrefab(_prefabItem); UIConflictItem item = NGUITools.AddChild(_grid.gameObject, pbitem).GetComponent <UIConflictItem>(); item.gameObject.name = "item" + i; if (atksidelist.Count > i) { if (temp.currentBattleType == TemporyData.BattleType.BossBattle) { item._atkPart.SetData(atksidelist [i], side); } else if (temp.currentBattleType == TemporyData.BattleType.FinalTrialBuou) { item._atkPart.SetData(atksidelist [i], false); } else if (temp.currentBattleType == TemporyData.BattleType.PVPVideo) { bool att = temp.PvpVideo_AttackOrDefense == 1; item._atkPart.SetData(atksidelist [i], att); } else { item._atkPart.SetData(atksidelist [i], true); } } else { item._atkPart.gameObject.SetActive(false); } if (defsidelist.Count > i) { if (temp.currentBattleType == TemporyData.BattleType.BossBattle) { item._defPart.SetData(defsidelist [i], !side); } else if (temp.currentBattleType == TemporyData.BattleType.FinalTrialBuou) { item._defPart.SetData(defsidelist [i], true); } else if (temp.currentBattleType == TemporyData.BattleType.PVPVideo) { bool def = temp.PvpVideo_AttackOrDefense == 1; item._defPart.SetData(defsidelist [i], !def); } else { item._defPart.SetData(defsidelist [i], false); } } else { item._defPart.gameObject.SetActive(false); } } _grid.Reposition(); }
public void InitFloorItems(IEnumerable <Floor> list, int floorID) { if (list != null) { if (floorItem == null) { floorItem = FhjLoadPrefab.GetPrefab(FhjPrefabsName.UIFloorItem); } if (bossItem == null) { bossItem = NGUITools.AddChild(floorRoot.gameObject, FhjLoadPrefab.GetPrefab(FhjPrefabsName.UIFloorBossItem)).GetComponent <UIFloorBossItem>(); bossItem.gameObject.name = "z" + bossItem.gameObject.name; bossItem.OnClickedItem = ClickFloorItem; bossItem.OnClickedReward = ClickFloorReward; bossItem.OnOpenContent = ShowFloor; bossItem.OnLookDesInfo = ShowDesInfo; } int index = 0; foreach (Floor itemData in list) { if (itemData != null) { UIFloorItem _item = null; bool isBoos = itemData.config.isBoss > 0; if (isBoos) { _item = bossItem; } else { if (floorList.Count > index) { _item = floorList[index]; _item.gameObject.SetActive(true); } else { _item = NGUITools.AddChild(floorRoot.gameObject, floorItem).GetComponent <UIFloorItem>(); _item.OnClickedItem = ClickFloorItem; _item.OnOpenContent = ShowFloor; _item.OnLookDesInfo += ShowDesInfo; _item.gameObject.name = _item.gameObject.name.Substring(0, _item.gameObject.name.IndexOf("(")) + ((char)(index + 'A')).ToString(); floorList.Add(_item); } } if (_item != null) { _item.InitItem(itemData, ++index); _item.FoldContent(true); if (itemData.config.ID == floorID) { // jump = true; jumpFloorIndex = index - 1; } } } } for (int i = index - 1; i < floorList.Count; ++i) { floorList[i].gameObject.SetActive(false); } floorRoot.repositionNow = true; _floorScroll.ResetPosition(); StartCoroutine(NextFrame()); } }