Exemplo n.º 1
0
        public PartBusiness(Part part)
        {
            m_part = part;

            m_winers = new ConcurrentDictionary<int, int>(Environment.ProcessorCount * 2, 512);
            m_lWiners = new ConcurrentDictionary<int, int>(Environment.ProcessorCount * 2, 512);
            m_playerInto = new ConcurrentDictionary<int, int>(Environment.ProcessorCount * 2, 512);

            m_scenes = new List<SceneBusiness>();
            for (int i = 0; i < part.Maps.Count; i++)
            {
                SceneBusiness scene;
                if (ScenesProxy.TryGetScene(part.Maps[i], out scene))
                {
                    if (i == 0)
                    {
                        m_mainScene = scene;
                    }
                    m_scenes.Add(scene);
                }
            }

            m_elements = new List<string>();
            ArrayList goods = part.Value.GetValueOrDefault<ArrayList>("Element");
            if (goods != null)
            {
                foreach (var v in goods)
                {
                    m_elements.Add(v.ToString());
                }
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 场景切换检查
 /// </summary>
 /// <param name="player"></param>
 /// <param name="inScene"></param>
 /// <param name="transmitType">0:道具/超时回城, 1:死亡回城 , 2:转送阵, 3: NPC</param>
 /// <returns></returns>
 public override bool TransferCheck(PlayerBusiness player, SceneBusiness inScene, TransmitType transmitType)
 {
     //检查必杀的怪是否完成..
     if (transmitType == TransmitType.Pin)
     {
         IList killed = player.Ectype.Value.GetValue<IList>("Killed");
         string needKill = NpcManager.Instance.MustKill(this.ID, killed);
         if (needKill != null)
         {
             string msg = string.Format(TipManager.GetMessage(ClientReturn.SceneEctype4), needKill);
             player.Call(ClientCommand.IntoSceneR, false, null, msg);
             return false;
         }
     }
     return base.TransferCheck(player, inScene, transmitType);
 }
Exemplo n.º 3
0
 /// <summary>
 /// 获取指定ID的SceneBusiness
 /// </summary>
 /// <param name="sceneID"></param>
 /// <param name="scene"></param>
 /// <returns></returns>
 public static bool TryGetScene(string sceneID, out SceneBusiness scene, int line = 0)
 {
     SceneBusiness obj;
     if (m_scenes.TryGetValue(sceneID, out obj))
     {
         scene = obj;
         return true;
     }
     scene = null;
     return false;
 }
Exemplo n.º 4
0
 /// <summary>
 /// 切换场景
 /// </summary>
 /// <param name="inScene">要进入的新场景</param>
 /// <param name="point">位置</param>
 /// <param name="exit">是否退出副本</param>
 void TransScene(SceneBusiness inScene, object[] point, bool exit)
 {
     lock (m_members)
     {
         for (int i = 0; i < m_members.Length; i++)
         {
             PlayerBusiness member = m_members[i];
             if (member != null)
             {
                 if (m_currentScene.ExitScene(member) || exit)
                 {
                     UserNote note = new UserNote(member, ClientCommand.IntoSceneSuccess, point);
                     inScene.Execute(note);
                     point[0] = member.X;
                     point[1] = member.Y;
                     if (exit)
                     {
                         member.TeamInstance = null;
                     }
                 }
             }
         }
     }
     if (exit)
     {
         m_members = Empty;
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// 初始化战斗怪
 /// </summary>
 /// <param name="inScene"></param>
 /// <param name="drame"></param>
 private void InitDrame(SceneBusiness inScene, IList drame)
 {
     int total = 0;
     foreach (object item in drame)
     {
         Variant config = item as Variant;
         if (config != null)
         {
             Variant apcs = config.GetVariantOrDefault("VisibleAPC");
             if (apcs != null)
             {
                 int count = config.GetIntOrDefault("Count", 1);
                 string apcid = apcs.GetStringOrDefault(Difficulty);
                 if (!string.IsNullOrEmpty(apcid))
                 {
                     Rectangle range = RangeHelper.NewRectangle(config.GetVariantOrDefault("Range"), true);
                     for (int i = 0; i < count; i++)
                     {
                         EctypeApc ecApc = new EctypeApc(apcid);
                         if (ecApc.Apc != null)
                         {
                             ecApc.ID = (total++);
                             ecApc.Say = config.GetIntOrDefault("Say");
                             ecApc.Batch = config.GetIntOrDefault("Batch");
                             Point point = inScene.RandomBronPoint(range);
                             if (point.X == 0)
                             {
                                 Console.WriteLine("");
                             }
                             ecApc.X = point.X;
                             ecApc.Y = point.Y;
                             m_currentApcs.Add(ecApc);
                         }
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 6
0
        public bool TryInto(PlayerBusiness player)
        {
            PlayerTeam team = player.Team;
            //设置玩家列表.
            string msg;
            if (!FillPlayers(team, player, out msg))
            {
                player.Call(InstanceCommand.NewInstanceR, new object[] { false, msg, string.Empty });
                return false;
            }

            player.TeamInstance = this;
            // 检查副本进入限制
            if (m_intoLimit != null)
            {
                PlayerBusiness member;
                if ((!m_intoLimit.IntoCheck(m_members, out msg, out member))
                    || (!m_intoLimit.IntoDeduct(m_members, out msg, out member)))
                {
                    player.TeamInstance = null;
                    this.CallAll(InstanceCommand.NewInstanceR, new object[] { false, msg, member == null ? string.Empty : member.Name });
                    m_members = Empty;
                    return false;
                }
            }
            m_team = team;
            TeamInstanceProxy.TryAddInstance(this);

            //设置进入次数
            for (int i = 0; i < m_members.Length; i++)
            {
                PlayerBusiness member = m_members[i];
                if (member == null) continue;
                member.TeamInstance = this;
                member.WriteDaily(PlayerBusiness.DailyMap, m_gc.ID);

                //进入秘境通知..
                member.AddAcivity(ActivityType.FuBenCount, 1);

                // 记录副本进入日志
                PlayerLog log = new PlayerLog(ServerLogger.zoneid, Actiontype.EctypeIn);
                log.itemtype = m_difficulty;
                log.itemid = m_gc.ID;
                log.remark = m_gc.Name;
                member.WriteLog(log);
            }

            oldx = player.X;
            oldy = player.Y;
            m_oldScene = player.Scene;
            m_currentScene = m_oldScene;
            Astate = ActionState.Standing;
            return true;
        }
Exemplo n.º 7
0
        /// <summary>
        /// 进入下一场景
        /// </summary>
        /// <param name="player"></param>
        /// <returns></returns>
        public bool NextDrame()
        {
            if (level >= m_movie.Count)
            {
                return false;
            }
            m_currentApcs.Clear();

            Variant movieItem = m_movie[level++];
            string sceneID = movieItem.GetStringOrDefault("SceneID");
            SceneBusiness inScene;
            if (!ScenesProxy.TryGetScene(sceneID, out inScene) || inScene.SceneType != SceneType.Instance)
            {
                return NextDrame();
            }

            InitDrame(inScene, movieItem.GetValueOrDefault<IList>("Drame"));
            int x = movieItem.GetIntOrDefault("X");
            int y = movieItem.GetIntOrDefault("Y");

            //切换场景
            TransScene(inScene, new object[] { x, y }, false);
            m_currentScene = inScene;

            //发送怪物信息
            var apcs = m_currentApcs.FindAll(k => k.State == 0);
            CallAll(InstanceCommand.NewInstanceR, new object[] { true, apcs, m_currentScene.ID });
            return true;
        }
Exemplo n.º 8
0
 /// <summary>
 /// 加载活动怪
 /// </summary>
 /// <param name="scene"></param>
 public static void LoadPartApcs(SceneBusiness scene, string partID)
 {
     foreach (SceneApc bb in m_sceneApcs.Values)
     {
         if (bb.SceneID == scene.ID && bb.SubType == partID)
         {
             bb.ResetApc();
             m_activeApcs[bb.ID] = bb;
             scene.HaveApc = true;
         }
     }
     IList apcs = GetSceneApc(scene.ID);
     scene.CallAll(0, ClientCommand.RefreshApcR, new object[] { scene.ID, apcs });
 }
Exemplo n.º 9
0
 /// <summary>
 /// 移除活动怪
 /// </summary>
 /// <param name="scene"></param>
 public static void UnloadPartApcs(SceneBusiness scene, string partID)
 {
     bool haveAPc = false;
     foreach (SceneApc sb in m_activeApcs.Values)
     {
         if (sb.SceneID == scene.ID)
         {
             if (sb.SubType == partID)
             {
                 SceneApc t;
                 m_activeApcs.TryRemove(sb.ID, out t);
             }
             else
             {
                 haveAPc = true;
             }
         }
     }
     scene.HaveApc = haveAPc;
     IList apcs = GetSceneApc(scene.ID);
     scene.CallAll(0, ClientCommand.RefreshApcR, new object[] {scene.ID, apcs });
 }
Exemplo n.º 10
0
 /// <summary>
 /// 切换场景
 /// </summary>
 /// <param name="player"></param>
 /// <param name="inScene"></param>
 /// <param name="transmitType"></param>
 /// <returns></returns>
 public virtual bool TransferCheck(PlayerBusiness player, SceneBusiness inScene, TransmitType transmitType)
 {
     if (inScene == null) return false;
     return inScene.IntoCheck(player);
 }
Exemplo n.º 11
0
        protected SceneBusiness(SceneBusiness scene)
        {
            m_players = new ConcurrentDictionary<string, PlayerBusiness>();
            m_walk = scene.m_walk;
            m_map = scene.m_map;
            m_id = scene.m_id;
            m_name = scene.m_name;
            m_skin = scene.m_skin;
            m_fightInterval = scene.m_fightInterval;
            m_fightType = scene.m_fightType;
            m_intoLimit = scene.m_intoLimit;
            m_bornX = scene.m_bornX;
            m_bornY = scene.m_bornY;
            m_propDest = scene.m_propDest;
            m_deadDest = scene.m_deadDest;

            m_showAll = scene.m_showAll;
            m_fightType = scene.m_fightType;
        }
Exemplo n.º 12
0
        public FightBase(FightObject[] teamA, FightObject[] teamB, List<PlayerBusiness> players)
        {
            m_id = ObjectId.GenerateNewId().ToString();//Guid.NewGuid().ToString("N");
            m_players = players.ToArray();
            m_teamA = teamA;
            m_teamB = teamB;
            m_scene = players[0].Scene;
            foreach (var v in m_teamA)
            {
                v.Team = m_teamA;
            }
            foreach (var v in m_teamB)
            {
                v.Team = m_teamB;
            }
            m_protecter = new List<FightObject>();
            m_totalFighter = m_teamA.Length + m_teamB.Length;

            m_fighter = new List<FightObject>(m_totalFighter);
            m_actions = new List<FightAction>(m_totalFighter);
        }