Пример #1
0
        /// <summary>
        // 刷怪接口
        /// </summary>
        public static void CreateMonsterForGoldCopyScene(GameClient client, GoldCopyScene goldcopyscene, int nWave)
        {
            GoldCopySceneMonster tmpInfo = Data.Goldcopyscenedata.GoldCopySceneMonsterData[nWave];
            long ticks = TimeUtil.NOW();

            // 随机刷怪
            int nRom = Global.GetRandomNumber(0, 10);

            // 在起点刷怪
            int[] pos   = Data.Goldcopyscenedata.m_MonsterPatorlPathList[0];
            Point toPos = new Point(pos[0], pos[1]);

            GameManager.MonsterZoneMgr.AddDynamicMonsters(goldcopyscene.m_MapCodeID, tmpInfo.m_MonsterID[nRom], goldcopyscene.m_CopyMapID, 1, (int)toPos.X, (int)toPos.Y, 1);

            goldcopyscene.m_CreateMonsterCount += 1;

            // 第N大波刷完了
            if (goldcopyscene.m_CreateMonsterCount == tmpInfo.m_Num)
            {
                goldcopyscene.m_CreateMonsterTick2      = ticks; // 设定大波刷完时间
                goldcopyscene.m_CreateMonsterWave       = nWave + 1;
                goldcopyscene.m_CreateMonsterCount      = 0;
                goldcopyscene.m_CreateMonsterWaveNotify = 0;

                //SendMsgToClientForGlodCopySceneMonsterWave(client, nWave);

                if (goldcopyscene.m_CreateMonsterWave > Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count() && client != null)
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client,
                                                             StringUtil.substitute(Global.GetLang("金币副本 挂怪结束了")), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, (int)HintErrCodeTypes.None);
                }
            }
        }
Пример #2
0
        public static void CreateMonsterForGoldCopyScene(GameClient client, GoldCopyScene goldcopyscene, int nWave)
        {
            GoldCopySceneMonster tmpInfo = Data.Goldcopyscenedata.GoldCopySceneMonsterData[nWave];
            long ticks = TimeUtil.NOW();
            int  nRom  = Global.GetRandomNumber(0, 10);

            int[] pos   = Data.Goldcopyscenedata.m_MonsterPatorlPathList[0];
            Point toPos = new Point((double)pos[0], (double)pos[1]);

            GameManager.MonsterZoneMgr.AddDynamicMonsters(goldcopyscene.m_MapCodeID, tmpInfo.m_MonsterID[nRom], goldcopyscene.m_CopyMapID, 1, (int)toPos.X, (int)toPos.Y, 1, 0, SceneUIClasses.Normal, null, null);
            goldcopyscene.m_CreateMonsterCount++;
            if (goldcopyscene.m_CreateMonsterCount == tmpInfo.m_Num)
            {
                goldcopyscene.m_CreateMonsterTick2      = ticks;
                goldcopyscene.m_CreateMonsterWave       = nWave + 1;
                goldcopyscene.m_CreateMonsterCount      = 0;
                goldcopyscene.m_CreateMonsterWaveNotify = 0;
                if (goldcopyscene.m_CreateMonsterWave > Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count <KeyValuePair <int, GoldCopySceneMonster> >() && client != null)
                {
                    GameManager.ClientMgr.NotifyImportantMsg(Global._TCPManager.MySocketListener, Global._TCPManager.TcpOutPacketPool, client, StringUtil.substitute(GLang.GetLang(376, new object[0]), new object[0]), GameInfoTypeIndexes.Error, ShowGameInfoTypes.ErrAndBox, 0);
                }
            }
        }
Пример #3
0
        public static void HeartBeatGlodCopyScene()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks - GlodCopySceneManager.LastHeartBeatTicks >= 1000L)
            {
                GlodCopySceneManager.LastHeartBeatTicks = ((GlodCopySceneManager.LastHeartBeatTicks < 86400000L) ? nowTicks : (GlodCopySceneManager.LastHeartBeatTicks + 1000L));
                lock (GlodCopySceneManager.m_GlodCopySceneLists)
                {
                    foreach (CopyMap item in GlodCopySceneManager.m_GlodCopySceneLists.Values)
                    {
                        List <GameClient> clientsList          = item.GetClientsList();
                        GoldCopyScene     tmpGoldCopySceneData = null;
                        lock (GlodCopySceneManager.m_GlodCopySceneInfo)
                        {
                            if (!GlodCopySceneManager.m_GlodCopySceneInfo.TryGetValue(item.FuBenSeqID, out tmpGoldCopySceneData))
                            {
                                continue;
                            }
                        }
                        if (tmpGoldCopySceneData != null)
                        {
                            lock (tmpGoldCopySceneData)
                            {
                                if (tmpGoldCopySceneData.m_TimeNotifyFlag == 0)
                                {
                                    tmpGoldCopySceneData.m_TimeNotifyFlag = 1;
                                    if (clientsList.Count <GameClient>() != 0 && clientsList[0] != null)
                                    {
                                        GlodCopySceneManager.SendMsgToClientForGlodCopyScenePrepare(clientsList[0], tmpGoldCopySceneData);
                                    }
                                }
                                if (nowTicks >= tmpGoldCopySceneData.m_StartTimer + (long)GlodCopySceneManager.m_PrepareTime)
                                {
                                    int nWave  = tmpGoldCopySceneData.m_CreateMonsterWave;
                                    int nCount = Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count <KeyValuePair <int, GoldCopySceneMonster> >();
                                    if (nWave <= nCount)
                                    {
                                        if (nWave == 0 && tmpGoldCopySceneData.m_CreateMonsterFirstWaveFlag == 0)
                                        {
                                            tmpGoldCopySceneData.m_CreateMonsterFirstWaveFlag = 1;
                                            tmpGoldCopySceneData.m_CreateMonsterWave          = 1;
                                        }
                                        GoldCopySceneMonster tmpMonsterInfo = null;
                                        if (Data.Goldcopyscenedata.GoldCopySceneMonsterData.TryGetValue(nWave, out tmpMonsterInfo))
                                        {
                                            if (tmpMonsterInfo != null)
                                            {
                                                if (nowTicks - tmpGoldCopySceneData.m_CreateMonsterTick2 > (long)(tmpMonsterInfo.m_Delay2 * 1000))
                                                {
                                                    if (tmpGoldCopySceneData.m_CreateMonsterWaveNotify == 0)
                                                    {
                                                        tmpGoldCopySceneData.m_CreateMonsterWaveNotify = 1;
                                                        if (clientsList.Count <GameClient>() != 0 && clientsList[0] != null)
                                                        {
                                                            GlodCopySceneManager.SendMsgToClientForGlodCopySceneMonsterWave(clientsList[0], tmpGoldCopySceneData.m_CreateMonsterWave);
                                                        }
                                                    }
                                                    if (nowTicks - tmpGoldCopySceneData.m_CreateMonsterTick1 > (long)(tmpMonsterInfo.m_Delay1 * 1000))
                                                    {
                                                        if (tmpGoldCopySceneData.m_LoginEnterFlag == 1)
                                                        {
                                                            if (clientsList.Count <GameClient>() != 0 && clientsList[0] != null && nowTicks - tmpGoldCopySceneData.m_LoginEnterTimer > (long)GlodCopySceneManager.m_DelayTime)
                                                            {
                                                                tmpGoldCopySceneData.m_LoginEnterFlag = 0;
                                                                GlodCopySceneManager.SendMsgToClientForGlodCopySceneMonsterWave(clientsList[0], tmpGoldCopySceneData.m_CreateMonsterWave);
                                                            }
                                                        }
                                                        tmpGoldCopySceneData.m_CreateMonsterTick1 = ((tmpGoldCopySceneData.m_CreateMonsterTick1 < 86400000L) ? nowTicks : (tmpGoldCopySceneData.m_CreateMonsterTick1 + (long)(tmpMonsterInfo.m_Delay1 * 1000)));
                                                        if (clientsList.Count <GameClient>() != 0 && clientsList[0] != null)
                                                        {
                                                            GlodCopySceneManager.CreateMonsterForGoldCopyScene(clientsList[0], tmpGoldCopySceneData, tmpGoldCopySceneData.m_CreateMonsterWave);
                                                        }
                                                        else
                                                        {
                                                            GlodCopySceneManager.CreateMonsterForGoldCopyScene(null, tmpGoldCopySceneData, tmpGoldCopySceneData.m_CreateMonsterWave);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #4
0
        /// <summary>
        // 心跳处理
        /// </summary>
        public static void HeartBeatGlodCopyScene()
        {
            long nowTicks = TimeUtil.NOW();

            if (nowTicks - LastHeartBeatTicks < (1000))
            {
                return;
            }

            LastHeartBeatTicks = LastHeartBeatTicks < TimeUtil.DAY ? nowTicks : LastHeartBeatTicks + 1000;

            // lock住!!!
            lock (m_GlodCopySceneLists)
            {
                foreach (var item in m_GlodCopySceneLists.Values)
                {
                    List <GameClient> clientsList = item.GetClientsList();

                    GoldCopyScene tmpGoldCopySceneData = null;

                    lock (m_GlodCopySceneInfo)
                    {
                        if (!m_GlodCopySceneInfo.TryGetValue(item.FuBenSeqID, out tmpGoldCopySceneData))
                        {
                            continue;
                        }

                        //tmpGoldCopySceneData = m_GlodCopySceneInfo[item.FuBenSeqID];
                    }

                    if (tmpGoldCopySceneData == null)
                    {
                        continue;
                    }

                    lock (tmpGoldCopySceneData)
                    {
                        if (tmpGoldCopySceneData.m_TimeNotifyFlag == 0)
                        {
                            tmpGoldCopySceneData.m_TimeNotifyFlag = 1;

                            if (clientsList.Count() != 0 && clientsList[0] != null)
                            {
                                SendMsgToClientForGlodCopyScenePrepare(clientsList[0], tmpGoldCopySceneData);
                            }
                        }

                        // 准备时间
                        if (nowTicks >= (tmpGoldCopySceneData.m_StartTimer + m_PrepareTime))
                        {
                            int nWave  = tmpGoldCopySceneData.m_CreateMonsterWave;
                            int nCount = Data.Goldcopyscenedata.GoldCopySceneMonsterData.Count();

                            if (nWave > nCount)
                            {
                                continue;
                            }

                            if (nWave == 0 && tmpGoldCopySceneData.m_CreateMonsterFirstWaveFlag == 0)
                            {
                                tmpGoldCopySceneData.m_CreateMonsterFirstWaveFlag = 1;
                                tmpGoldCopySceneData.m_CreateMonsterWave          = 1;

                                //SendMsgToClientForGlodCopySceneMonsterWave(clientsList[0], 0);
                            }

                            GoldCopySceneMonster tmpMonsterInfo = null;

                            if (!Data.Goldcopyscenedata.GoldCopySceneMonsterData.TryGetValue(nWave, out tmpMonsterInfo))
                            {
                                continue;
                            }

                            if (tmpMonsterInfo != null)
                            {
                                // 延迟间隔判断
                                if (nowTicks - tmpGoldCopySceneData.m_CreateMonsterTick2 > tmpMonsterInfo.m_Delay2 * 1000)       // 大波间隔时间判断
                                {
                                    if (tmpGoldCopySceneData.m_CreateMonsterWaveNotify == 0)
                                    {
                                        tmpGoldCopySceneData.m_CreateMonsterWaveNotify = 1;
                                        if (clientsList.Count() != 0 && clientsList[0] != null)
                                        {
                                            SendMsgToClientForGlodCopySceneMonsterWave(clientsList[0], tmpGoldCopySceneData.m_CreateMonsterWave);
                                        }
                                    }

                                    if (nowTicks - tmpGoldCopySceneData.m_CreateMonsterTick1 > tmpMonsterInfo.m_Delay1 * 1000)   // 小波间隔时间判断
                                    {
                                        if (tmpGoldCopySceneData.m_LoginEnterFlag == 1)
                                        {
                                            if (clientsList.Count() != 0 && clientsList[0] != null && nowTicks - tmpGoldCopySceneData.m_LoginEnterTimer > m_DelayTime)
                                            {
                                                tmpGoldCopySceneData.m_LoginEnterFlag = 0;
                                                SendMsgToClientForGlodCopySceneMonsterWave(clientsList[0], tmpGoldCopySceneData.m_CreateMonsterWave);
                                            }
                                        }

                                        tmpGoldCopySceneData.m_CreateMonsterTick1 = tmpGoldCopySceneData.m_CreateMonsterTick1 < TimeUtil.DAY ? nowTicks : tmpGoldCopySceneData.m_CreateMonsterTick1 + tmpMonsterInfo.m_Delay1 * 1000;

                                        if (clientsList.Count() != 0 && clientsList[0] != null)
                                        {
                                            CreateMonsterForGoldCopyScene(clientsList[0], tmpGoldCopySceneData, tmpGoldCopySceneData.m_CreateMonsterWave);
                                        }
                                        else
                                        {
                                            CreateMonsterForGoldCopyScene(null, tmpGoldCopySceneData, tmpGoldCopySceneData.m_CreateMonsterWave);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }