Ejemplo n.º 1
0
 public UICityFloorManager JumpToFloor(int _index, bool reset = false)
 {
     if (floorList != null)
     {
         UIFloorItem _item = null;
         if (floorList.Count > _index)
         {
             _item = floorList[_index];
         }
         else
         {
             _item = bossItem;
         }
         _item.FoldContent(false);
         cityFloor.SetFloorName(_item.data.config.name);
         StartCoroutine(JumpToFloor(_item.transform, reset));
     }
     return(this);
 }
Ejemplo n.º 2
0
    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());
        }
    }