public void OnPlayerLeave(DungeonScene _this, ObjPlayer player) { Scene.GetImpl().OnPlayerLeave(_this, player); //修改副本难度 _this.ChangeDifficulty(_this.PlayerCount); }
private IEnumerator NotifySceneFinishedCoroutine(Coroutine co, DungeonScene _this) { //通知broke,我已经要关闭了 var msg = SceneServer.Instance.SceneAgent.NotifySceneFinished(0, _this.Guid); yield return(msg.SendAndWaitUntilDone(co)); }
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); } }
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); }
public void CloseTimer(DungeonScene _this, eDungeonTimerType type) { if (_this.Trggers[(int)type] != null) { _this.DeleteTimer(_this.Trggers[(int)type]); _this.Trggers[(int)type] = null; } }
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); } }
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()); } }
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); }
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)); }
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); }
public double GetDungeonTimeProgress(DungeonScene _this) { var t = DateTime.Now; if (t > _this.EndTime) { return(0); } else { return((_this.EndTime - t).TotalMinutes); } }
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); } }
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; } }
// 触发黑市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]); } } } }
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); } } }
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); }); }
private void NotifySceneFinished(DungeonScene _this) { CoroutineFactory.NewCoroutine(NotifySceneFinishedCoroutine, _this).MoveNext(); }
public void TimeOverStart(DungeonScene _this) { _this.StartDungeon(); }
public void AfterPlayerEnterOver(DungeonScene _this, ObjPlayer player) { Scene.GetImpl().AfterPlayerEnterOver(_this, player); }
public void Complete(DungeonScene _this, ulong playerId, FubenResult result) { CoroutineFactory.NewCoroutine(CompleteCoroutine, _this, playerId, result).MoveNext(); }
public virtual void StartDungeon(DungeonScene _this) { _this.State = eDungeonState.Start; //通知客户端更新倒计时显示 _this.NotifyDungeonTime(eDungeonTimerType.WaitEnd); }
public void TimeOverEnd(DungeonScene _this) { _this.RemoveAllNPC(); _this.EndDungeon(); }
public void TimeOverClose(DungeonScene _this) { CoroutineFactory.NewCoroutine(_this.CloseDungeon).MoveNext(); }
public virtual void EndDungeon(DungeonScene _this) { _this.EnterAutoClose(); }