Exemplo n.º 1
0
        static int _m_HandleBattleEnd(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                BattleServer.Battle.BattleManager __cl_gen_to_be_invoked = (BattleServer.Battle.BattleManager)translator.FastGetCSObj(L, 1);



                {
                    BattleServer.Battle.Battle battle = (BattleServer.Battle.Battle)translator.GetObject(L, 2, typeof(BattleServer.Battle.Battle));
                    ulong gcNID = LuaAPI.lua_touint64(L, 3);
                    Protos.GC2BS_EndBattle endBattle = (Protos.GC2BS_EndBattle)translator.GetObject(L, 4, typeof(Protos.GC2BS_EndBattle));

                    __cl_gen_to_be_invoked.HandleBattleEnd(battle, gcNID, endBattle);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
Exemplo n.º 2
0
        public ErrorCode OnGc2BsEndBattle(NetSessionBase session, Google.Protobuf.IMessage message)
        {
            BSUser user = BS.instance.userMgr.GetUser(session.id);

            if (user != null)
            {
                Protos.GC2BS_EndBattle request = (Protos.GC2BS_EndBattle)message;
                BS.instance.battleMgr.HandleBattleEnd(user.battle, user.gcNID, request);
            }
            return(ErrorCode.Success);
        }
Exemplo n.º 3
0
        internal void Add(ulong gcNID, Protos.GC2BS_EndBattle endBattle)
        {
            //检查玩家是否重复提交
            if (this._playerSnapshots.Any(snapshot => snapshot.gcNID == gcNID))
            {
                Logger.Error($"user:{gcNID} duplicate commit snapshot!");
                return;
            }

            PlayerSnapshot playerSnapshot = new PlayerSnapshot();

            playerSnapshot.gcNID = gcNID;
            playerSnapshot.data  = endBattle.Snapshot;
            playerSnapshot.crc   = CRC32.Compute(endBattle.Snapshot.ToByteArray());
            this._playerSnapshots.Add(playerSnapshot);
        }
Exemplo n.º 4
0
 /// <summary>
 /// 处理战场结束
 /// </summary>
 public void HandleBattleEnd(ulong gcNID, Protos.GC2BS_EndBattle endBattle) => this._battleEndProcessor.Add(gcNID, endBattle);
Exemplo n.º 5
0
 public void HandleBattleEnd(Battle battle, ulong gcNID, Protos.GC2BS_EndBattle endBattle) =>
 battle.HandleBattleEnd(gcNID, endBattle);