Exemple #1
0
        //---------------------------------------------------------------------
        // 收到玩家赠送的筹码
        public Task s2sProxyGivePlayerChip(PlayerInfo player_info, int chip)
        {
            GivePlayerChip give_chip = new GivePlayerChip();

            give_chip.player_info = player_info;
            give_chip.chip        = chip;

            int chip_cur = CoActor.Def.PropGold.get();

            if (chip >= 100000)
            {
                chip_cur += chip;
                CoActor.Def.PropGold.set(chip_cur);
            }

            PlayerNotify player_notify;

            player_notify.id   = PlayerNotifyId.GivePlayerChip;
            player_notify.data = EbTool.protobufSerialize <GivePlayerChip>(give_chip);

            MethodData notify_data = new MethodData();

            notify_data.method_id = MethodType.s2cPlayerNotify;
            notify_data.param1    = EbTool.protobufSerialize <PlayerNotify>(player_notify);
            var grain        = Entity.getUserData <GrainCellPlayer>();
            var grain_player = grain.GF.GetGrain <ICellPlayer>(new Guid(Entity.Guid));

            grain_player.s2sNotify(notify_data);

            return(TaskDone.Done);
        }
Exemple #2
0
        //-------------------------------------------------------------------------
        // 请求赠送玩家筹码
        public void requestGivePlayerChip(string player_etguid, int chip)
        {
            PlayerInfo player_info = new PlayerInfo();

            player_info.player_etguid = player_etguid;

            GivePlayerChip give_chip = new GivePlayerChip();

            give_chip.player_info = player_info;
            give_chip.chip        = chip;

            PlayerRequest player_request;

            player_request.id   = PlayerRequestId.GivePlayerChip;
            player_request.data = EbTool.protobufSerialize <GivePlayerChip>(give_chip);
            DefaultRpcSession.rpc((ushort)MethodType.c2sPlayerRequest, player_request);
        }