예제 #1
0
        public void OnPlayerLeave(DungeonScene _this, ObjPlayer player)
        {
            Scene.GetImpl().OnPlayerLeave(_this, player);

            //修改副本难度
            _this.ChangeDifficulty(_this.PlayerCount);
        }
예제 #2
0
        private IEnumerator NotifySceneFinishedCoroutine(Coroutine co, DungeonScene _this)
        {
            //通知broke,我已经要关闭了
            var msg = SceneServer.Instance.SceneAgent.NotifySceneFinished(0, _this.Guid);

            yield return(msg.SendAndWaitUntilDone(co));
        }
예제 #3
0
        public void OnPlayerEnter(DungeonScene _this, ObjPlayer player)
        {
            Scene.GetImpl().OnPlayerEnter(_this, player);

            //修改副本难度
            _this.ChangeDifficulty(_this.PlayerCount);

            var now = DateTime.Now;

            if (_this.GetTriggerTime(eDungeonTimerType.WaitStart) > now)
            {
                _this.NotifyDungeonTime(player, eDungeonTimerType.WaitStart);
            }
            else if (_this.GetTriggerTime(eDungeonTimerType.WaitExtraTimeStart) > now)
            {
                _this.NotifyDungeonTime(player, eDungeonTimerType.WaitExtraTimeStart);
            }
            else if (_this.GetTriggerTime(eDungeonTimerType.WaitEnd) > now)
            {
                _this.NotifyDungeonTime(player, eDungeonTimerType.WaitEnd);
            }
            else
            {
                _this.NotifyDungeonTime(player, eDungeonTimerType.WaitClose);
            }
        }
예제 #4
0
 public void EnterAutoClose(DungeonScene _this, int seconds = 20)
 {
     _this.State = eDungeonState.WillClose;
     _this.StartTimer(eDungeonTimerType.WaitClose, DateTime.Now.AddSeconds(seconds),
                      () => { _this.TimeOverClose(); });
     _this.NotifyDungeonTime(eDungeonTimerType.WaitClose);
     NotifySceneFinished(_this);
 }
예제 #5
0
 public void CloseTimer(DungeonScene _this, eDungeonTimerType type)
 {
     if (_this.Trggers[(int)type] != null)
     {
         _this.DeleteTimer(_this.Trggers[(int)type]);
         _this.Trggers[(int)type] = null;
     }
 }
예제 #6
0
        public void RemoveObj(DungeonScene _this, int id)
        {
            var toRemoveList = (from obj in _this.mObjDict where obj.Value.TypeId == id select obj.Value).ToList();

            foreach (var obj in toRemoveList)
            {
                _this.LeaveScene(obj);
            }
        }
예제 #7
0
        public void NotifyDungeonTime(DungeonScene _this, ObjPlayer player, eDungeonTimerType type)
        {
            var trigger = _this.Trggers[(int)type];

            if (trigger != null && trigger.T != null)
            {
                player.Proxy.NotifyDungeonTime((int)_this.State, (ulong)trigger.Time.ToBinary());
            }
        }
예제 #8
0
        public void OnCreate(DungeonScene _this)
        {
            var fubenId = _this.TableSceneData.FubenId;

            _this.mFubenRecord       = Table.GetFuben(fubenId);
            _this.isNeedDamageModify = _this.mFubenRecord.IsDyncDifficulty == 1;
            _this.StartTimer(eDungeonTimerType.SafeClose, DateTime.Now.AddHours(1), () => { _this.TimeOverClose(); });

            TrigerBusinessman(_this);
        }
예제 #9
0
        public DateTime GetTriggerTime(DungeonScene _this, eDungeonTimerType type)
        {
            var trigger = _this.Trggers[(int)type];

            if (trigger != null && trigger.T != null)
            {
                return(trigger.Time);
            }
            return(DateTime.Now.AddYears(-10));
        }
예제 #10
0
        public virtual void CompleteToAll(DungeonScene _this, FubenResult result, int seconds = 20)
        {
            _this.PushActionToAllPlayer(player =>
            {
                if (player != null)
                {
                    _this.Complete(player.ObjId, result);
                }
            });

            _this.EnterAutoClose(seconds);
        }
예제 #11
0
        public double GetDungeonTimeProgress(DungeonScene _this)
        {
            var t = DateTime.Now;

            if (t > _this.EndTime)
            {
                return(0);
            }
            else
            {
                return((_this.EndTime - t).TotalMinutes);
            }
        }
예제 #12
0
        private IEnumerator CompleteCoroutine(Coroutine coroutine,
                                              DungeonScene _this,
                                              ulong playerId,
                                              FubenResult result)
        {
            var trigger = _this.Trggers[(int)eDungeonTimerType.WaitEnd];
            var useSec  = 0;

            if (trigger != null)
            {
                var closeTime = trigger.Time;
                useSec = (int)(_this.mFubenRecord.TimeLimitMinutes * 60 - (int)closeTime.GetDiffSeconds(DateTime.Now));
                if (useSec < 0)
                {
                    useSec = 0;
                }
            }
            result.FubenId    = _this.TableSceneData.FubenId;
            result.UseSeconds = useSec;
            var msg = SceneServer.Instance.LogicAgent.CompleteFuben(playerId, result);

            yield return(msg.SendAndWaitUntilDone(coroutine));

            //后台统计
            try
            {
                var tbFuben   = Table.GetFuben(result.FubenId);
                var character = _this.FindCharacter(playerId);
                if (tbFuben != null && character != null)
                {
                    var level = character.GetLevel();
                    var v     = string.Format("fuben#{0}|{1}|{2}|{3}|{4}|{5}|{6}|{7}",
                                              playerId,
                                              result.FubenId,
                                              tbFuben.Name,
                                              tbFuben.AssistType,
                                              1, // 0  进入   1 完成   2 退出
                                              DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss"),
                                              level,
                                              character.Attr.GetFightPoint()
                                              ); // 时间
                    PlayerLog.Kafka(v);
                }
            }
            catch (Exception e)
            {
                Logger.Error(e.Message);
            }
        }
예제 #13
0
 public void StartTimer(DungeonScene _this, eDungeonTimerType type, DateTime time, Action act, int interval = -1)
 {
     if (_this.Trggers[(int)type] != null)
     {
         _this.DeleteTimer(_this.Trggers[(int)type]);
     }
     _this.Trggers[(int)type] = _this.CreateTimer(time, act, interval);
     if (type == eDungeonTimerType.WaitStart)
     {
         _this.StartTime = time;
     }
     if (type == eDungeonTimerType.WaitEnd)
     {
         _this.EndTime = time;
     }
 }
예제 #14
0
        // 触发黑市npc
        public void TrigerBusinessman(DungeonScene _this)
        {
            var sceneNpcId = _this.mFubenRecord.BusinessManSceneId;
            var pr         = _this.mFubenRecord.BusinessManPR;

            if (sceneNpcId >= 0 && pr >= 0 && MyRandom.Random(10000) < pr)
            {
                _this.CreateSceneNpc(sceneNpcId);

                // 初始化商店物品数量
                var sceneNpc = Table.GetSceneNpc(sceneNpcId);
                if (sceneNpc == null)
                {
                    return;
                }

                var npc = Table.GetNpcBase(sceneNpc.DataID);
                if (npc == null)
                {
                    return;
                }

                _this.MapShopItems.Clear();
                foreach (var serviceId in npc.Service)
                {
                    if (serviceId >= 0)
                    {
                        var serviceR = Table.GetService(serviceId);
                        if (serviceR == null || serviceR.Param[0] < 0)
                        {
                            continue;
                        }

                        var shopType = serviceR.Param[0];
                        _this.MapShopItems[shopType] = new Dictionary <int, int>();
                        SceneServer.Instance.ServerControl.InitFubenStoreCounts(shopType, _this.MapShopItems[shopType]);
                    }
                }
            }
        }
예제 #15
0
        public virtual IEnumerator CloseDungeon(Coroutine coroutine, DungeonScene _this)
        {
            _this.State = eDungeonState.Closing;

            //通知broke,我已经要关闭了
            var msg = SceneServer.Instance.SceneAgent.NotifySceneFinished(0, _this.Guid);

            yield return(msg.SendAndWaitUntilDone(coroutine));

            var playerIds = new Uint64Array();

            playerIds.Items.AddRange(_this.mPlayerDict.Keys);
            if (playerIds.Items.Count > 0 && _this.dicGetRewardPlayers.ContainsKey(playerIds.Items[0]) == false)
            {
                var msg2 = SceneServer.Instance.LogicAgent.NotifyDungeonClose(playerIds.Items[0], _this.TypeId, playerIds);
                yield return(msg2.SendAndWaitUntilDone(coroutine));
            }
            //把玩家都踢出去
            var array = _this.mPlayerDict.Values.ToArray();

            foreach (var player in array)
            {
                var co = CoroutineFactory.NewSubroutine(player.ExitDungeon, coroutine);
                if (co.MoveNext())
                {
                    yield return(co);
                }
            }

            //关闭副本
            {
                var co = CoroutineFactory.NewSubroutine(_this.TryDeleteScene, coroutine, RemoveScene.SceneClose);
                if (co.MoveNext())
                {
                    yield return(co);
                }
            }
        }
예제 #16
0
        public void OnNpcDie(DungeonScene _this, ObjNPC npc, ulong characterId)
        {
            var idx = _this.MapNpcRecords.FindIndex(r => r.NpcID == npc.TypeId);

            if (idx == -1)
            {
                return;
            }
            var info = _this.MapNpcInfo.Data[idx];

            info.Alive = false;
            var data = new MapNpcInfos();

            data.Data.Add(info);
            _this.PushActionToAllPlayer(p =>
            {
                if (p.Proxy == null)
                {
                    return;
                }
                p.Proxy.NotifyNpcStatus(data);
            });
        }
예제 #17
0
 private void NotifySceneFinished(DungeonScene _this)
 {
     CoroutineFactory.NewCoroutine(NotifySceneFinishedCoroutine, _this).MoveNext();
 }
예제 #18
0
 public void TimeOverStart(DungeonScene _this)
 {
     _this.StartDungeon();
 }
예제 #19
0
 public void AfterPlayerEnterOver(DungeonScene _this, ObjPlayer player)
 {
     Scene.GetImpl().AfterPlayerEnterOver(_this, player);
 }
예제 #20
0
 public void Complete(DungeonScene _this, ulong playerId, FubenResult result)
 {
     CoroutineFactory.NewCoroutine(CompleteCoroutine, _this, playerId, result).MoveNext();
 }
예제 #21
0
 public virtual void StartDungeon(DungeonScene _this)
 {
     _this.State = eDungeonState.Start;
     //通知客户端更新倒计时显示
     _this.NotifyDungeonTime(eDungeonTimerType.WaitEnd);
 }
예제 #22
0
 public void TimeOverEnd(DungeonScene _this)
 {
     _this.RemoveAllNPC();
     _this.EndDungeon();
 }
예제 #23
0
 public void TimeOverClose(DungeonScene _this)
 {
     CoroutineFactory.NewCoroutine(_this.CloseDungeon).MoveNext();
 }
예제 #24
0
 public virtual void EndDungeon(DungeonScene _this)
 {
     _this.EnterAutoClose();
 }