コード例 #1
0
        public static void SetBalanceForUser(string uid, int value)
        {
            MySettings settings = Instance.Settings;

            CheckUserHasData(uid);
            value = Math.Max(0, Math.Min(settings.EcoHardBalanceLimit, value));
            settings.UserBalances[uid] = value;
            settings.DelayedSave();
        }
コード例 #2
0
        private static void CheckUserHasData(string uid)
        {
            MySettings settings = Instance.Settings;

            if (!settings.UserBalances.ContainsKey(uid))
            {
                settings.UserBalances.Add(uid, 0);
                settings.DelayedSave();
            }
        }