示例#1
0
    public static void OnExchange(int count)
    {
        PktExchangeRequest pkt = new PktExchangeRequest();

        pkt.count = count;
        pkt.eType = PktExchangeRequest.EType.Gold;
        AClientApp.RemoteCall <PktExchangeResult>(pkt, ExchangeCb);
    }
        private void GameHandler_ExchangeRequest(IResponer responer, PktExchangeRequest vo)
        {
            var player = APlayerManager.Instance.OnGetPlayerByConn(responer.playerConnDesc);

            if (player == null)
            {
                return;
            }
            if (SCommonds.IsEnough(player.psid, InitValueDefs.money, vo.count))
            {
                SCommonds.Use("Exchange", player.psid, InitValueDefs.money, -vo.count);
                SCommonds.AddItem("Exchange", player.psid, InitValueDefs.gold, vo.count * 10);
            }
        }