コード例 #1
0
 private void TryGiveCS(IPlayer player, double amount)
 {
     if (CashSystem.Call <bool>("AddTransaction", ulong.Parse(player.Id), config.CashSystemCurrency, amount, "Starter Money"))
     {
         data.Players.Add(player.Id);
     }
 }
コード例 #2
0
        private double GetPlayerCash(ulong userId, string currency)
        {
            object checkedPoints = CashSystem?.Call("GetBalance", userId, currency);

            if (checkedPoints is double)
            {
                double val = (double)checkedPoints;
                if (double.IsNaN(val))
                {
                    return(0);
                }

                return(val);
            }

            return(0);
        }
コード例 #3
0
        private void MagicPanelRegisterPanels()
        {
            if (MagicPanel == null)
            {
                PrintError("Missing plugin dependency MagicPanel: https://umod.org/plugins/magic-panel");
                return;
            }

            if (CashSystem == null)
            {
                PrintError("Missing plugin dependency CashSystem: https://umod.org/plugins/cash-system");
                return;
            }

            MagicPanel?.Call("RegisterPlayerPanel", this, Name, JsonConvert.SerializeObject(_pluginConfig.PanelSettings), nameof(GetPanel));
            _currencies = CashSystem.Call <List <string> >("GetCurrencies");
            InvokeHandler.Instance.InvokeRepeating(UpdatePlayerCash, Random.Range(0, _pluginConfig.UpdateRate), _pluginConfig.UpdateRate);
        }