Exemple #1
0
    public static UI_ListItem InitListItem(GameObject itemObj)
    {
        itemObj.SetActive(false);
        GameObject gameObject = Instantiate(itemObj, itemObj.transform.parent);

        gameObject.SetActive(true);
        UI_ListItem uI_ListItem = gameObject.GetComponent <UI_ListItem>();

        return(uI_ListItem);
    }
    private void SetMapList(int startMap)
    {
        List <int> mapList = new List <int>()
        {
            startMap
        };

        for (int i = 0; i < 100; i++)
        {
            int nextMap = Cfg_Map.GetCfg(startMap).NextMap;
            if (nextMap != 0)
            {
                mapList.Add(nextMap);
                startMap = nextMap;
            }
            else
            {
                break;
            }
        }
        bool lastMapIsPass = true;

        foreach (var map in mapList)
        {
            UI_ListItem = UIBase.InitListItem(MapListObj);
            UI_ListItem.Texts[0].text = Cfg_Map.GetCfg(map).Name;
            UI_ListItem.Texts[1].text = Cfg_Map.GetCfg(map).Des;
            bool IsPass = AlreadyPass.Contains(map);
            UI_ListItem.Objs[0].SetActive(!IsPass && lastMapIsPass);
            UI_ListItem.Objs[1].SetActive(IsPass || !lastMapIsPass);
            if (IsPass && lastMapIsPass)
            {
                UI_ListItem.Texts[2].text = "已通关";
            }
            else
            {
                UI_ListItem.Texts[2].text = "需通关上一关";
            }
            lastMapIsPass = IsPass;
            UI_ListItem.btns[0].onClick.AddListener(delegate()
            {
                gameObject.SetActive(false);
                GenerateMap.CurrentMapId = map;
            });
            SetMonsterList(map, UI_ListItem.Objs[2]);
        }
        UIBase.ResetListPos(MapListObj, 1);
    }
Exemple #3
0
 private void SetItemList()
 {
     foreach (Item item in ItemData)
     {
         UI_ListItem = UIBase.InitListItem(ItemObj);
         UI_ListItem.Objs[0].SetActive(true);
         UI_ListItem.Texts[0].text = item.itemNum.ToString();
         string Asset = COMMON.ItemIconPath + Cfg_Item.GetCfg(item.itemId).AssetName;
         UIBase.SetImageSpite(UI_ListItem.Images[0], Asset);
     }
     for (int i = 0; i < Mathf.Max(ItemData.Count, DefaultNum - ItemData.Count); i++)
     {
         UI_ListItem = UIBase.InitListItem(ItemObj);
         UI_ListItem.Objs[0].SetActive(false);
     }
 }
Exemple #4
0
    public void ShowAttrChange(int value, Vector3 pos, int type = 2)
    {
        if (AllListShow.ContainsKey(pos))
        {
            UI_ListItem = UIBase.InitListItem(GetItemObj(AllListShow[pos]));
        }
        else
        {
            ListObj.SetActive(true);
            GameObject obj = Instantiate(ListObj, ListObj.transform.parent);
            AllListShow.Add(pos, obj);
            UI_ListItem = UIBase.InitListItem(GetItemObj(AllListShow[pos]));
            ListObj.SetActive(false);
        }
        Vector3 objPos = Camera.main.WorldToScreenPoint(pos);

        AllListShow[pos].transform.position = objPos;
        UI_ListItem.Texts[0].text           = value.ToString();
        UI_ListItem.Objs[type].SetActive(true);
        Destroy(UI_ListItem.gameObject, 5);
    }
 private void SetChapterList()
 {
     foreach (var item in Cfg_Chapter.GetAllCfg())
     {
         UI_ListItem = UIBase.InitListItem(ChapterListObj);
         UI_ListItem.Texts[0].text = item.Name;
         string Asset = COMMON.ChapterIconPath + item.Asset;
         UIBase.SetImageSpite(UI_ListItem.Images[0], Asset);
         if (!AlreadyPass.Contains(item.NeedMap))
         {
             COMMON.SetImageGray(UI_ListItem.Images[0]);
         }
         UI_ListItem.btns[0].onClick.AddListener(delegate()
         {
             if (!AlreadyPass.Contains(item.NeedMap))
             {
                 UIBase.Addtips("请先通关上一章节!");
                 return;
             }
             OpenMapList(item.StartMap);
             MapList_ChapterName.text = item.Name;
         });
     }
 }
Exemple #6
0
 public void AddTips(string tips)
 {
     UI_ListItem = UIBase.InitListItem(tipsObj);
     UI_ListItem.Texts[0].text = tips;
     Destroy(UI_ListItem.gameObject, DisappearTime);
 }