コード例 #1
0
    public T GetDataByDName <T>(string dName) where T : BaseStaticData
    {
        List <T> curDataList = StaticDataManager.GetDataList <T>();

        foreach (T dataItem in curDataList)
        {
            if (dataItem.displayName == dName)
            {
                return(dataItem);
            }
        }
        return(null);
    }
コード例 #2
0
 private void LoadDropDown <T>(Dropdown curDropdown, string currentDataId) where T : BaseStaticData
 {
     if (curDropdown != null)
     {
         curDropdown.ClearOptions();
         List <T>      curList  = StaticDataManager.GetDataList <T>();
         List <string> dNames   = new List <string>();
         int           index    = 0;
         int           selIndex = 0;
         foreach (T item in curList)
         {
             dNames.Add(item.displayName);
             if (currentDataId != "" && currentDataId == item.id)
             {
                 selIndex = index;
             }
             index++;
         }
         curDropdown.AddOptions(dNames);
         curDropdown.value = selIndex;
     }
 }
コード例 #3
0
 public List <WeaponData> GetWeapons()
 {
     return(StaticDataManager.GetDataList <WeaponData>());
 }