Exemplo n.º 1
0
    public void UnlockEntry(string entryName)
    {
        BiologEntry entry = GameContext.Instance.GameData.BiologData.Entries.Find((e) => e.EntryName.Equals(entryName));

        if (entry != null)
        {
            if (!_unlockedEntries.Contains(entry))
            {
                AnalyticsLogger.Instance.AddLogEntry(new BiologEntryUnlockedLogEntry(GameContext.Instance.Player.UserGuid, entry));
                _unlockedEntries.Add(entry);
                if (!_dataStorage.HasKeyForString(entryName))
                {
                    _dataStorage.Store(entryName, "x");
                    _dataStorage.WriteData();
                }

                if (BiologEntryUnlocked != null)
                {
                    BiologEntryUnlocked(entry, true);
                }
            }
            if (BiologEntryScanned != null)
            {
                BiologEntryScanned(entry, true);
            }
        }
        else
        {
            DebugFormatter.LogError(this, "Attempting to unlock Biolog entry {0}, but entry could not be found in BiologData.", entryName);
        }
    }
Exemplo n.º 2
0
#pragma warning restore 0067, 0649

    public override void OnEvent(ExecutionContext context)
    {
        if (_saveDataType == SaveDataType.SaveFile)
        {
            IPersistentDataStorage data = GameContext.Instance.Player.PersistentStorage;
            if (!data.HasKeyForInt(_key))
            {
                data.Store(_key, _defaultValue);
            }

            int value = data.RecallInt(_key);
            data.Store(_key, value + _incrementAmount);

            if (_writeImmediately)
            {
                data.WriteData();
            }
        }
        else
        {
            IDataStorage data = GameContext.Instance.Player.SessionStorage;
            if (!data.HasKeyForInt(_key))
            {
                data.Store(_key, _defaultValue);
            }

            int value = data.RecallInt(_key);
            data.Store(_key, value + _incrementAmount);
        }
    }