Beispiel #1
0
        // -------------------------------------------------------------------------------
        // Init
        // -------------------------------------------------------------------------------
        public void Init(GameObject _parent = null, int level = 1)
        {
            base.Init(_parent);

            syncCurrencies.Clear();

            foreach (BaseCurrency currency in defaultCurrencies)
            {
                if (currency.template != null)
                {
                    SCurrency sCurrency = new SCurrency(currency.template.GetId, currency.value.Get(level));
                    syncCurrencies.Add(sCurrency);
                }
            }
        }
Beispiel #2
0
        // -------------------------------------------------------------------------------
        // Load
        // -------------------------------------------------------------------------------
        public override void Load(BaseDataTable data)
        {
            syncCurrencies.Clear();

            for (int i = 0; i < data.Rows.Count; ++i)
            {
                TemplateCurrency tmpl;

                if (DataManager.dictCurrency.TryGetValue(data.GetIdHash(i), out tmpl))
                {
                    SCurrency sCurrency = new SCurrency(tmpl.GetId, data.GetLongAsInt(DatabaseManager.fieldValue, i));
                    syncCurrencies.Add(sCurrency);
                }
                else
                {
                    Debug.LogWarning("Skipped template '" + data.GetString(DatabaseManager.fieldName) + "' as it was not found in Library.");
                }
            }

            data.Cleanup();
        }