Example #1
0
    /// <summary>
    /// parsing excel data into current format
    /// </summary>
    /// <param name="itm">target</param>
    /// <param name="repItm">source</param>
    /// <returns> parsed item </returns>
    public new static AbstractObject Parse(AbstractObject itm, ExcelLoading.AbstractObject repItm)
    {
        ExcelLoading.ItemItem rep = (ExcelLoading.ItemItem)repItm;
        Items itms = (Items)itm;

        itms.m_bug = rep.bug;
        itms.m_bugFixingPerPerson = rep.bug_fixing_per_second;
        itms.m_isItDestroyable    = true;
        itms.m_tooltipDamaged     = Localization.GetLocalization().m_ui.m_itemsDamaged;

        string[] crtc = rep.critical.Split(' ');
        itms.m_critical = uint.Parse(crtc[2]);
        string[] effTps = rep.effect_type.Split(';');
        foreach (string effect in effTps)
        {
            try
            {
                string[]    parts       = effect.Split('*');
                string      effName     = parts[0].Trim();
                float       effValue    = FloatParse(parts[1].Trim());
                ItemsEffect itemsEffect = effName.CheckType() ?
                                          new ContainerEffect(effName, effValue, itms)
                    : new ItemsEffect(effName, effValue, itms);

                itms.m_effects.Add(effName, itemsEffect);
                Productions.AddTools(itemsEffect, effName);

                if (itemsEffect.GetType() == typeof(ContainerEffect))
                {
                    itms.m_containerEffect = itemsEffect as ContainerEffect;
                    Camera.main.GetComponent <Storage>().AddStorageItem(itms);
                }
                if (itemsEffect.m_name == "happy" || itemsEffect.m_name == "maxHappy")
                {
                    itms.m_happyEffect = itemsEffect;
                }
            }
            catch (Exception ex)
            {
                Debug.Log(ex.Message);
            }
        }

        return(GameMaterial.Parse(itm, repItm));
    }