Ejemplo n.º 1
0
        public override void AfterPlayerEnterOver(ObjPlayer player)
        {
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }

            if (mPlayerInfo.ContainsKey(player.ObjId))
            {
                return;
            }

            mPlayerInfo.Add(player.ObjId, player.GetName());
            mPlayers.Add(player);

            // 限制buff
            player.AddBuff(3001, 1, player);
            // 同步位置
            player.SyncCharacterPostion();

            if (Trggers[(int)eDungeonTimerType.WaitStart] == null)
            {
                StartTimer(eDungeonTimerType.WaitStart, DateTime.Now.AddSeconds(5), TimeOverStart);
            }
            NotifyDungeonTime(player, eDungeonTimerType.WaitStart);

            OnTriggerStartWarn(player);
        }
Ejemplo n.º 2
0
        public override void OnPlayerLeave(ObjPlayer player)
        {
            base.OnPlayerLeave(player);

            //恢复满血满蓝
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }

            var campId = player.GetCamp();

            if (campId == -1)
            {
                player.SetCamp(0);
                return;
            }
            var camp = Camps[campId];

            camp.Players.Remove(player);
            player.SetCamp(0);

            CoroutineFactory.NewCoroutine(PlayerLeave, player).MoveNext();
        }
Ejemplo n.º 3
0
 private void ResetPlayer(ObjPlayer player)
 {
     if (player.IsDead())
     {
         player.Relive();
     }
     else
     {
         player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
         player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
     }
 }
Ejemplo n.º 4
0
        public override void AfterPlayerEnterOver(ObjPlayer player)
        {
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }

            ChangeDifficulty(PlayerCount);

            mPlayer = player;
            pvpId   = player.mDbData.P1vP1CharacterId;
            if (mAutoPlayer == null)
            {
                if (mHasHold)
                {
                    if (Trggers[(int)eDungeonTimerType.WaitStart] == null)
                    {
                        StartTimer(eDungeonTimerType.WaitStart, DateTime.Now.AddSeconds(5), TimeOverStart);
                    }
                    NotifyDungeonTime(player, eDungeonTimerType.WaitStart);
                    Exdata = 1;
                }
                else
                {
                    StartDungeon();
                    Exdata = 0;
                }

                player.AddBuff(3001, 1, player);
                if (StaticData.IsRobot(pvpId))
                {
                    var tbScene = Table.GetScene(TypeId);
                    mAutoPlayer = CreateAutoPlayer((int)pvpId,
                                                   new Vector2((float)tbScene.PVPPosX, (float)tbScene.PVPPosZ), new Vector2(1, 0));
                    mAutoPlayer.AddBuff(3001, 1, mAutoPlayer);
                }
                else
                {
                    CoroutineFactory.NewCoroutine(GetAutoPlayerInScene, pvpId).MoveNext();
                }
            }
        }
Ejemplo n.º 5
0
 public override void OnPlayerLeave(ObjPlayer player)
 {
     if (State <= eDungeonState.Start)
     {
         var result = new FubenResult();
         result.CompleteType = (int)eDungeonCompleteType.Quit;
         Complete(player.ObjId, result);
     }
     if (player.IsDead())
     {
         player.Relive();
     }
     else
     {
         player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
         player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
     }
 }
Ejemplo n.º 6
0
        public override void OnPlayerLeave(ObjPlayer player)
        {
            //修改副本难度
            ChangeDifficulty(PlayerCount);

            if (State <= eDungeonState.Start)
            {
                var result = new FubenResult();
                result.CompleteType = (int)eDungeonCompleteType.Quit;
                Complete(player.ObjId, result);
            }
            if (player.IsDead())
            {
                player.Relive();
            }
            else
            {
                player.Attr.SetDataValue(eAttributeType.HpNow, player.Attr.GetDataValue(eAttributeType.HpMax));
                player.Attr.SetDataValue(eAttributeType.MpNow, player.Attr.GetDataValue(eAttributeType.MpMax));
            }
            PlayerLog.WriteLog(player.ObjId, "CloseDungeon character is full! c={0}", player.ObjId);
            CoroutineFactory.NewCoroutine(CloseDungeon).MoveNext();
        }
Ejemplo n.º 7
0
        public IEnumerator ResultOver(Coroutine co, ObjPlayer player, bool end = false)
        {
            if (mIsEnd)
            {// 已经结算过了
                yield break;
            }
            mIsEnd = true;

            ulong winnerId = 0;

            foreach (var objPlayer in mPlayerInfo)
            {
                if (objPlayer.Key != player.ObjId)
                {
                    winnerId = objPlayer.Key;
                    break;
                }
            }
            if (0 == winnerId)
            {//异常了??
                yield break;
            }

            // 世界广播
            string content;
            var    args = new List <string>();

            if (end)
            {
                //平手
                args.Add(mPlayerInfo[winnerId]);
                args.Add(player.GetName());
                content = Utils.WrapDictionaryId(100003326, args);
            }
            else
            {
                if (player.IsDead())
                {
                    //胜负
                    args.Add(mPlayerInfo[winnerId]);
                    args.Add(player.GetName());
                    content = Utils.WrapDictionaryId(100003327, args);
                }
                else
                {
                    //放弃
                    args.Add(player.GetName());
                    args.Add(mPlayerInfo[winnerId]);
                    content = Utils.WrapDictionaryId(100003325, args);
                }
            }

            var msg2 = SceneServer.Instance.ChatAgent.SSBroadcastAllServerMsg(player.ObjId, (int)eChatChannel.SystemScroll, player.GetName(), new ChatMessageContent {
                Content = content
            });

            yield return(msg2.SendAndWaitUntilDone(co));

            // 5秒后自动关闭
            if (false == end)
            {
                EnterAutoClose(5);
            }
        }