Ejemplo n.º 1
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.º 2
0
        public override void CompleteToAll(FubenResult result, int seconds = 20)
        {
            if (State > eDungeonState.Start)
            {
                return;
            }

            var args = result.Args;

            //statistic
            foreach (var pair in mStatistic)
            {
                args.Add(pair.Value.x);
                args.Add(pair.Value.y);
            }

            foreach (var objPlayer in EnumAllPlayer())
            {
                Complete(objPlayer.ObjId, result);
            }

            EnterAutoClose(seconds);
        }
Ejemplo n.º 3
0
        //战斗结束
        private void BattleOver(int campId)
        {
            //关闭所有的timer
            foreach (var c in Camps)
            {
                DeleteTimer(c.Value.Timer);
            }

            var winCamp = Camps[campId];
            var result  = new FubenResult();

            result.Args.Add(winCamp.AllianceId);
            PushActionToAllPlayer(p =>
            {
                result.CompleteType = (int)(p.GetCamp() == campId
                    ? eDungeonCompleteType.Success
                    : eDungeonCompleteType.Failed);
                Complete(p.ObjId, result);
            });

            EnterAutoClose();

            CoroutineFactory.NewCoroutine(NotifyResultToTeamServer, winCamp.AllianceId).MoveNext();
        }
Ejemplo n.º 4
0
        public override void CompleteToAll(FubenResult result, int seconds = 20)
        {
            DealWithQuitPlayers(result);

            base.CompleteToAll(result, seconds);
        }
Ejemplo n.º 5
0
        private void EnterPhase()
        {
            Log(Logger, "EnterPhase:LogidId = {0}", mFubenLogicRecord.Id);

            //把该阶段的完成条件组织一下
            mPhaseRequirementDic.Clear();
            mPhaseRequirements.Clear();
            for (int i = 0, imax = FubenLogicRecord.SwitchState.Length; i < imax; ++i)
            {
                var type    = (EnterPhaseRequireType)FubenLogicRecord.SwitchState[i];
                var param1  = FubenLogicRecord.SwitchParam1[i];
                var param2  = FubenLogicRecord.SwitchParam2[i];
                var infoIdx = FubenLogicRecord.SwitchInfoPa[i];
                if ((int)type == -1)
                {
                    break;
                }

                var realType = type == EnterPhaseRequireType.KillMonsterGroup ? EnterPhaseRequireType.KillMonster : type;
                Dictionary <int, EnterPhaseRequireStruct> requireDic;
                if (!mPhaseRequirementDic.TryGetValue(realType, out requireDic))
                {
                    requireDic = new Dictionary <int, EnterPhaseRequireStruct>();
                    mPhaseRequirementDic.Add(realType, requireDic);
                }
                var require = new EnterPhaseRequireStruct(param1, param2, infoIdx);
                mPhaseRequirements.Add(require);
                switch (type)
                {
                case EnterPhaseRequireType.KillMonsterGroup:
                {
                    var tbSkillUpgrading = Table.GetSkillUpgrading(param1);
                    foreach (var monsterId in tbSkillUpgrading.Values)
                    {
                        requireDic.Add(monsterId, require);
                    }
                }
                break;

                default:
                {
                    requireDic.Add(param1, require);
                }
                break;
                }
            }

            //执行进入该阶段的操作
            for (int i = 0, imax = FubenLogicRecord.EnterStage.Length; i < imax; ++i)
            {
                var type   = FubenLogicRecord.EnterStage[i];
                var param1 = FubenLogicRecord.EnterParam1[i];
                var param2 = FubenLogicRecord.EnterParam2[i];
                if (type == -1)
                {
                    break;
                }
                switch ((EnterPhaseOperateType)type)
                {
                case EnterPhaseOperateType.CreateMonster:
                {
                    var tbSkillUpgrading = Table.GetSkillUpgrading(param1);
                    foreach (var sceneNpcId in tbSkillUpgrading.Values)
                    {
                        CreateMonsters(sceneNpcId, param2);
                    }
                }
                break;

                case EnterPhaseOperateType.IntermittentCreateMonster:
                {
                    DoIntermittentCreateMonster(param1, param2);
                }
                break;

                case EnterPhaseOperateType.KillMonster:
                {
                    if (param2 > 0)
                    {
                        CreateTimer(DateTime.Now.AddMilliseconds(param2), () => { RemoveObj(param1); });
                    }
                    else
                    {
                        RemoveObj(param1);
                    }
                }
                break;

                case EnterPhaseOperateType.OpenGate:
                {
                    var tbArea = Table.GetTriggerArea(param1);
                    if (tbArea == null)
                    {
                        break;
                    }
                    BroadcastSceneAction(tbArea);
                    if (tbArea.OffLineTrigger != -1)
                    {
                        Exdata = BitFlag.IntSetFlag(Exdata, tbArea.OffLineTrigger);
                    }
                }
                break;

                case EnterPhaseOperateType.NotifyCountDown:
                {
                    PushActionToAllPlayer(
                        player =>
                        {
                            player.Proxy.NotifyCountdown((ulong)DateTime.Now.AddSeconds(param1).ToBinary(), param2);
                        });
                }
                break;

                case EnterPhaseOperateType.NotifyBattleReminder:
                {
//通知客户端显示相关信息
                    PushActionToAllPlayer(
                        player => { player.Proxy.NotifyBattleReminder(19, Utils.WrapDictionaryId(param1), param2); });
                }
                break;

                case EnterPhaseOperateType.RemoveBuff:
                {
                    foreach (
                        var character in mObjDict.Values.Where(obj => obj.TypeId == param1).Cast <ObjCharacter>())
                    {
                        var datas = character.BuffList.GetBuffById(param2);
                        foreach (var data in datas)
                        {
                            MissBuff.DoEffect(this, character, data);
                            character.DeleteBuff(data, eCleanBuffType.EffectOver);
                        }
                    }
                }
                break;

                case EnterPhaseOperateType.WaitTime:
                {
                    SceneServerControl.Timer.CreateTrigger(DateTime.Now.AddMilliseconds(param1),
                                                           () => { AccomplishPhaseRequire(EnterPhaseRequireType.Wait, param1); });
                }
                break;

                case EnterPhaseOperateType.NotifyStartWarning:
                {
                    PushActionToAllPlayer(
                        player =>
                        {
                            player.Proxy.NotifyStartWarning((ulong)DateTime.Now.AddSeconds(param1).ToBinary());
                        });
                }
                break;

                case EnterPhaseOperateType.SwitchState:
                {
                    var now         = DateTime.Now;
                    var targetState = (eDungeonState)param1;
                    switch (targetState)
                    {
                    case eDungeonState.Start:
                    {
                        var startTime = now.AddSeconds(param2);
                        StartTimer(eDungeonTimerType.WaitStart, startTime, TimeOverStart);
                        StartTimer(eDungeonTimerType.WaitEnd,
                                   startTime.AddMinutes(mFubenRecord.TimeLimitMinutes), TimeOverEnd);
                    }
                    break;

                    case eDungeonState.WillClose:
                        break;

                    case eDungeonState.Closing:
                    {
                        var result = new FubenResult();
                        result.CompleteType = (int)eDungeonCompleteType.Success;
                        CompleteToAll(result, param2);

                        SendFubenInfo();
                    }
                    break;

                    default:
                    {
                        Debug.Assert(false, "Type Error:" + targetState.ToString());
                    }
                    break;
                    }
                }
                break;
                }
            }

            //准备一下要发给客户端的数据结构
            FubenLogicRecord oldRecord = null;

            if (mFubenInfoMsg.LogicId != -1)
            {
                oldRecord = Table.GetFubenLogic(mFubenInfoMsg.LogicId);
            }
            var units = mFubenInfoMsg.Units;

            mFubenInfoMsg.LogicId = FubenLogicRecord.Id;
            mIsFubenInfoDirty     = true;
            for (int i = 0, imax = FubenLogicRecord.FubenInfo.Length; i < imax; i++)
            {
                var type = (eFubenInfoType)FubenLogicRecord.FubenInfo[i];
                if ((int)type == -1)
                {
                    units.RemoveRange(i, units.Count - i);
                    break;
                }

                var infoValue = 0;
                if (type == eFubenInfoType.Percent)
                {
                    infoValue = 100;
                }
                if (i < units.Count)
                {
                    var unit = units[i];
                    if (FubenLogicRecord.IsClearCount == 0 && oldRecord != null && (int)type == oldRecord.FubenInfo[i])
                    {
//如果上一阶段的type和这一阶段的type一样,且IsClearCount == 0,不清计数
                    }
                    else
                    {
//否则,清计数
                        if (unit.Params.Count > 0)
                        {
                            unit.Params[0] = infoValue;
                        }
                    }
                }
                else
                {
                    var unit = new FubenInfoUnit();
                    unit.Index = i;
                    unit.Params.Add(infoValue);
                    units.Add(unit);

                    switch (type)
                    {
                    case eFubenInfoType.Percent:
                    {
                        var pars = unit.Params;
                        if (pars.Count < 2)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.StrongpointInfo:
                    {
                        var pars = unit.Params;
                        for (var j = 0; j < 3; ++j)
                        {
                            if (j < pars.Count)
                            {
                                pars[j] = -1;
                            }
                            else
                            {
                                pars.Add(-1);
                            }
                        }
                    }
                    break;

                    case eFubenInfoType.ShowDictionary2:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 2; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.ShowDictionary3:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 3; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.AllianceWarInfo:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 3; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;

                    case eFubenInfoType.AllianceWarState:
                    {
                        var pars = unit.Params;
                        for (var j = pars.Count; j < 2; ++j)
                        {
                            pars.Add(0);
                        }
                    }
                    break;
                    }
                }
            }
        }
Ejemplo n.º 6
0
    public IEnumerator DungeonCompleteCoroutine(FubenResult result)
    {
        var e1 = new DungeonFightOver();

        EventDispatcher.Instance.DispatchEvent(e1);
        EventDispatcher.Instance.DispatchEvent(new ActivityAndDungeonCombatResultEvent((eDungeonCompleteType)result.CompleteType));
        if (result.FubenId == GameUtils.GetElfModelDisplayFubenId())
        { // 特殊处理
            yield return(new WaitForSeconds(0.8f));

            UIManager.Instance.GetController(UIConfig.ElfUI).CallFromOtherClass("ElfDisplay", null);
            yield break;
        }
        var fubenId    = result.FubenId;
        var tbFuben    = Table.GetFuben(fubenId);
        var assistType = (eDungeonAssistType)tbFuben.AssistType;

        if (assistType == eDungeonAssistType.ClimbingTower)
        {
            yield return(new WaitForSeconds(0.5f));
        }
        else
        {
            yield return(new WaitForSeconds(GameUtils.DungeonShowDelay / 1000.0f));
        }
        var completeType = (eDungeonCompleteType)result.CompleteType;
        var useSec       = result.UseSeconds;
        var args         = result.Args;
        var drawResult   = result.Draw;
        var eraId        = result.EraId;

        var tbScene = Table.GetScene(GameLogic.Instance.Scene.SceneTypeId);

        if (tbScene != null && tbScene.FubenId != fubenId)
        {
            yield break;
        }

        if (completeType == eDungeonCompleteType.Success)
        {
            PlatformHelper.UMEvent("Fuben", "Complete", fubenId);
        }

        var e2 = new DungeonFightOverLater();

        EventDispatcher.Instance.DispatchEvent(e2);

        switch (assistType)
        {
        case eDungeonAssistType.Story:     //剧情副本
        {
            if (completeType == eDungeonCompleteType.Success)
            {
                var e = new Show_UI_Event(UIConfig.DungeonResult, new DungeonResultArguments
                    {
                        FubenId   = fubenId,
                        Second    = useSec,
                        DrawId    = drawResult.DrawId,
                        DrawIndex = drawResult.SelectIndex,
                        EraId     = eraId
                    });
                EventDispatcher.Instance.DispatchEvent(e);
            }
        }
        break;

        case eDungeonAssistType.Team:     //组队副本
        {
            if (completeType == eDungeonCompleteType.Success)
            {
                {
                    var e = new Show_UI_Event(UIConfig.DungeonRewardFrame, new DungeonRewardArguments
                        {
                            Seconds = useSec,
                            FubenId = fubenId
                        });
                    EventDispatcher.Instance.DispatchEvent(e);
                }

                {
                    var e = new UIEvent_DungeonReward(result.Draw);
                    EventDispatcher.Instance.DispatchEvent(e);
                }
            }
        }
        break;

        case eDungeonAssistType.DevilSquare:     //恶魔广场
        case eDungeonAssistType.BloodCastle:     //血色城堡
        {
            var e = new Show_UI_Event(UIConfig.ActivityRewardFrame, new ActivityRewardArguments
                {
                    Seconds      = useSec,
                    CompleteType = completeType,
                    PlayerLevel  = args[0],
                    FubenId      = fubenId
                });

            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case eDungeonAssistType.WorldBoss:     //世界boss
        {
            var e = new Show_UI_Event(UIConfig.BossRewardFrame, new BossRewardArguments
                {
                    Seconds      = useSec,
                    CompleteType = completeType,
                    Items        = drawResult.Items
                });
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case eDungeonAssistType.CityExpMulty:
        case eDungeonAssistType.CityGoldSingle:
        case eDungeonAssistType.CityExpSingle:
        case eDungeonAssistType.FrozenThrone:
        case eDungeonAssistType.OrganRoom:
        case eDungeonAssistType.CastleCraft1:
        case eDungeonAssistType.CastleCraft2:
        case eDungeonAssistType.CastleCraft3:
        case eDungeonAssistType.CastleCraft4:
        case eDungeonAssistType.CastleCraft5:
        case eDungeonAssistType.CastleCraft6:
        case eDungeonAssistType.AllianceWar:
        {
            if (args.Count > 0)
            {
                if (fubenId == 6100 || fubenId == 1019 || fubenId == 1050 || fubenId == 1020 || fubenId == 1021 ||
                    fubenId == 1022 || fubenId == 1023 || fubenId == 1030)
                {
                    var e = new Show_UI_Event(UIConfig.DungeonResult, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec,
                            EraId   = result.EraId
                        });
                    EventDispatcher.Instance.DispatchEvent(e);

                    var evn = new UIEvent_NewCityDungeonResult((int)completeType, result.SceneAddExp, fubenId, useSec, args);
                    EventDispatcher.Instance.DispatchEvent(evn);
                }
                else
                {
                    var e = new Show_UI_Event(UIConfig.DungeonResult, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec,
                            EraId   = result.EraId
                        });
                    EventDispatcher.Instance.DispatchEvent(e);

                    var leaderName = "";
                    if (result.Strs.Count > 0)
                    {
                        leaderName = result.Strs[0];
                    }
                    var evn = new UIEvent_CityDungeonResult(useSec, args, leaderName);
                    EventDispatcher.Instance.DispatchEvent(evn);
                }
            }
        }
        break;

        case eDungeonAssistType.MieShiWar:
        {
            if (completeType == eDungeonCompleteType.Success)
            {
                if (args.Count > 0)
                {
                    Show_UI_Event eventMonster = new Show_UI_Event(UIConfig.MishiResultUI, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec,
                            EraId   = result.EraId
                        });
                    EventDispatcher.Instance.DispatchEvent(eventMonster);
                }
            }
            else
            {
                if (args.Count > 0)
                {
                    Show_UI_Event eventMonster = new Show_UI_Event(UIConfig.MishiResultUI, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec,
                            EraId   = result.EraId
                        });
                    EventDispatcher.Instance.DispatchEvent(eventMonster);
                }
            }

            var leaderName = "";
            if (result.Strs.Count > 0)
            {
                leaderName = result.Strs[0];
            }
            var evn = new UIEvent_CityDungeonResult(useSec, args, leaderName);
            EventDispatcher.Instance.DispatchEvent(evn);
        }
        break;

        case eDungeonAssistType.ClimbingTower:
        {
            var e = new Show_UI_Event(UIConfig.ClimbingTowerRewardUI, new TowerRewardUIArguments
                {
                    Result  = (int)completeType,
                    FubenId = result.FubenId,
                    IsFirst = args[0]
                });
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case eDungeonAssistType.Chiji:
        {
            var e = new Show_UI_Event(UIConfig.ChickenRewardUI, new ChickenRewardUIArgument
                {
                    FubenId = result.FubenId,
                    Rank    = result.Args[0],
                    Items   = result.Draw.Items
                });
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        default:
            break;
        }
    }
Ejemplo n.º 7
0
 public virtual void CompleteToAll(FubenResult result, int seconds = 20)
 {
     mImpl.CompleteToAll(this, result, seconds);
 }
Ejemplo n.º 8
0
        //public void EnterEmptyClose(int seconds = 180)
        //{
        //    mImpl.EnterEmptyClose(this,seconds);
        //}

        //public void LeaveEmptyClose()
        //{
        //    mImpl.LeaveEmptyClose(this);
        //}

        public virtual void Complete(ulong playerId, FubenResult result)
        {
            mImpl.Complete(this, playerId, result);
        }
Ejemplo n.º 9
0
 public void Complete(DungeonScene _this, ulong playerId, FubenResult result)
 {
     CoroutineFactory.NewCoroutine(CompleteCoroutine, _this, playerId, result).MoveNext();
 }
Ejemplo n.º 10
0
    public IEnumerator DungeonCompleteCoroutine(FubenResult result)
    {
        var e1 = new DungeonFightOver();

        EventDispatcher.Instance.DispatchEvent(e1);
        yield return(new WaitForSeconds(GameUtils.DungeonShowDelay / 1000.0f));

        var fubenId      = result.FubenId;
        var completeType = (eDungeonCompleteType)result.CompleteType;
        var useSec       = result.UseSeconds;
        var args         = result.Args;
        var drawResult   = result.Draw;

        var tbScene = Table.GetScene(GameLogic.Instance.Scene.SceneTypeId);

        if (tbScene != null && tbScene.FubenId != fubenId)
        {
            yield break;
        }

        if (completeType == eDungeonCompleteType.Success)
        {
            PlatformHelper.UMEvent("Fuben", "Complete", fubenId);
        }

        var tbFuben    = Table.GetFuben(fubenId);
        var assistType = (eDungeonAssistType)tbFuben.AssistType;

        switch (assistType)
        {
        case eDungeonAssistType.Story:     //剧情副本
        {
            if (completeType == eDungeonCompleteType.Success)
            {
                var e = new Show_UI_Event(UIConfig.DungeonResult, new DungeonResultArguments
                    {
                        FubenId   = fubenId,
                        Second    = useSec,
                        DrawId    = drawResult.DrawId,
                        DrawIndex = drawResult.SelectIndex
                    });
                EventDispatcher.Instance.DispatchEvent(e);
            }
        }
        break;

        case eDungeonAssistType.Team:     //组队副本
        {
            {
                var e = new Show_UI_Event(UIConfig.DungeonRewardFrame, new DungeonRewardArguments
                    {
                        Seconds = useSec,
                        FubenId = fubenId
                    });

                EventDispatcher.Instance.DispatchEvent(e);
            }
            {
                var e = new UIEvent_DungeonReward(result.Draw);
                EventDispatcher.Instance.DispatchEvent(e);
            }
        }
        break;

        case eDungeonAssistType.DevilSquare:     //恶魔广场
        case eDungeonAssistType.BloodCastle:     //血色城堡
        {
            var e = new Show_UI_Event(UIConfig.ActivityRewardFrame, new ActivityRewardArguments
                {
                    Seconds      = useSec,
                    CompleteType = completeType,
                    PlayerLevel  = args[0],
                    FubenId      = fubenId
                });

            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case eDungeonAssistType.WorldBoss:     //世界boss
        {
            var e = new Show_UI_Event(UIConfig.BossRewardFrame, new BossRewardArguments
                {
                    Seconds      = useSec,
                    CompleteType = completeType,
                    Items        = drawResult.Items
                });
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        case eDungeonAssistType.CityExpMulty:
        case eDungeonAssistType.CityGoldSingle:
        case eDungeonAssistType.CityExpSingle:
        case eDungeonAssistType.FrozenThrone:
        case eDungeonAssistType.OrganRoom:
        case eDungeonAssistType.CastleCraft1:
        case eDungeonAssistType.CastleCraft2:
        case eDungeonAssistType.CastleCraft3:
        case eDungeonAssistType.CastleCraft4:
        case eDungeonAssistType.CastleCraft5:
        case eDungeonAssistType.CastleCraft6:
        case eDungeonAssistType.AllianceWar:
        {
            if (args.Count > 0)
            {
                var e = new Show_UI_Event(UIConfig.DungeonResult, new DungeonResultArguments
                    {
                        FubenId = fubenId,
                        Second  = useSec
                    });
                EventDispatcher.Instance.DispatchEvent(e);

                var leaderName = "";
                if (result.Strs.Count > 0)
                {
                    leaderName = result.Strs[0];
                }
                var evn = new UIEvent_CityDungeonResult(useSec, args, leaderName);
                EventDispatcher.Instance.DispatchEvent(evn);
            }
        }
        break;

        case eDungeonAssistType.MieShiWar:
        {
            if (completeType == eDungeonCompleteType.Success)
            {
                if (args.Count > 0)
                {
                    Show_UI_Event eventMonster = new Show_UI_Event(UIConfig.MishiResultUI, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec
                        });
                    EventDispatcher.Instance.DispatchEvent(eventMonster);
                }
            }
            else
            {
                if (args.Count > 0)
                {
                    Show_UI_Event eventMonster = new Show_UI_Event(UIConfig.MishiResultUI, new DungeonResultArguments
                        {
                            FubenId = fubenId,
                            Second  = useSec
                        });
                    EventDispatcher.Instance.DispatchEvent(eventMonster);
                }
            }

            var leaderName = "";
            if (result.Strs.Count > 0)
            {
                leaderName = result.Strs[0];
            }
            var evn = new UIEvent_CityDungeonResult(useSec, args, leaderName);
            EventDispatcher.Instance.DispatchEvent(evn);
        }
        break;

        case eDungeonAssistType.ClimbingTower:
        {
            var e = new Show_UI_Event(UIConfig.ClimbingTowerRewardUI, new BlockLayerArguments
                {
                    Type = (int)completeType
                });
            EventDispatcher.Instance.DispatchEvent(e);
        }
        break;

        default:
            break;
        }
    }