Пример #1
0
    /// <summary>
    /// Метод конвертации базовых объектов в игровые
    /// </summary>
    /// <returns>Игровые объекты</returns>
    private List <UpgradeObjectItem> ConvertBaseObjectXmlToObjectList()
    {
        List <UpgradeObjectItem>  allUpgradeObjectItems = new List <UpgradeObjectItem>();
        List <newAssignment_Item> xmlNewItemsAssignment = xmlUpgrades.Upgrade_Items.New_Items.UpgradeNewAssignment_Items.newAssignment_Items;

        foreach (var baseNewItem in baseUpgradeObjectItems)
        {
            try {
                UpgradeObjectItem upgradeObjectItem = UpgradeObjectItem.ConvertUpgradeBaseObject(baseNewItem);
                upgradeObjectItem.OpenIds = xmlNewItemsAssignment.Where(x => x.IdUpgrade == baseNewItem.Id).Select(x => x.IdNew).ToArray();
                allUpgradeObjectItems.Add(upgradeObjectItem);
            }
            catch (Exception ex) {
                Debug.LogError(ex.Message);
                continue;
            }
        }

        return(allUpgradeObjectItems);
    }