Beispiel #1
0
        /// <summary> 获取对手是否失败 </summary>
        /// <param name="userid">当前玩家用户Id</param>
        /// <param name="rivalcamp">对手阵营</param>
        /// <returns>是否失败</returns>
        private bool IsGetRival(Int64 userid, int rivalcamp)
        {
            var rival = GetRival(rivalcamp);

            if (rival == null)
            {
                return(true);
            }
            var f = GetFightResult(userid, rival.user_id);

            if (f.Result != ResultType.SUCCESS)
            {
                return(true);
            }
            if (!Variable.OnlinePlayer.ContainsKey(userid))
            {
                return(false);
            }
            if (!Variable.OnlinePlayer.ContainsKey(rival.user_id))
            {
                return(false);
            }
            var session      = Variable.OnlinePlayer[userid] as TGGSession;
            var rivalsession = Variable.OnlinePlayer[rival.user_id] as TGGSession;

            PUSH_FIGHT.GetInstance().CommandStart(session, f.Ofight);      //发给自己
            PUSH_FIGHT.GetInstance().CommandStart(rivalsession, f.Rfight); //发给对方
            if (f.Iswin)
            {
                var pdata = Variable.Activity.Siege.PlayerData.FirstOrDefault(m => m.user_id == userid);
                if (pdata == null)
                {
                    return(false);
                }
                var rivaldata = Variable.Activity.Siege.PlayerData.FirstOrDefault(m => m.user_id == rival.user_id);
                if (rivaldata == null)
                {
                    return(false);
                }
                pdata.ismatching = true;
                rivaldata.state  = (int)SiegePlayerType.EXIT_DEFEND; //自己赢了
            }
            else
            {
                var time = Variable.Activity.Siege.BaseData.AShotTime;  //守方赢了
                RivalStateUpdate(rival.user_id, ((f.ShotCount * time) + 10000));
            }
            return(false);
        }
Beispiel #2
0
        /// <summary> 战斗双方推送 </summary>
        /// <param name="session">session</param>
        /// <param name="vo">vo</param>
        private void PushFight(TGGSession session, FightVo vo)
        {
            if (!Variable.OnlinePlayer.ContainsKey(session.Fight.Rival))
            {
                return;
            }
            var _session = Variable.OnlinePlayer[session.Fight.Rival] as TGGSession;
            var _vo      = vo.CloneEntity();
            int count    = _vo.moves.Sum(item => item.Count());
            var user     = session.Player.User;

            _vo.isWin = !_vo.isWin;
            if (!_vo.isWin)
            {
                Common.GetInstance().GetSiegePlayer(user.id, user.player_camp).state = (int)SiegePlayerType.EXIT_DEFEND;
            }
            PUSH_FIGHT.GetInstance().CommandStart(session, vo);   //发给自己
            PUSH_FIGHT.GetInstance().CommandStart(_session, _vo); //发给对方
            var time = Variable.Activity.Siege.BaseData.AShotTime;

            RivalStateUpdate(session.Fight.Rival, (count * time));
        }
Beispiel #3
0
 /// <summary>PUSH_FIGHT单体模式</summary>
 public static PUSH_FIGHT GetInstance()
 {
     return(ObjInstance ?? (ObjInstance = new PUSH_FIGHT()));
 }