コード例 #1
0
 public void RemoveBattleSceneBuffForRole(KarenBattleScene scene, GameClient client)
 {
     lock (this.RuntimeData.Mutex)
     {
         if (scene.SceneBuffDict.Count != 0)
         {
             List <KarenBattleSceneBuff> sceneBuffDeleteList = new List <KarenBattleSceneBuff>();
             foreach (KarenBattleSceneBuff contextData in scene.SceneBuffDict.Values)
             {
                 if (contextData.RoleID == client.ClientData.RoleID)
                 {
                     sceneBuffDeleteList.Add(contextData);
                 }
             }
             if (sceneBuffDeleteList.Count != 0)
             {
                 foreach (KarenBattleSceneBuff contextData in sceneBuffDeleteList)
                 {
                     if (contextData.RoleID != 0)
                     {
                         this.UpdateBuff4GameClient(client, contextData.BuffID, contextData.tagInfo, false);
                     }
                     KarenBattleQiZhiConfig_East CrystalItem = contextData.tagInfo as KarenBattleQiZhiConfig_East;
                     if (null != CrystalItem)
                     {
                         this.AddDelayCreateMonster(scene, TimeUtil.NOW() + (long)(CrystalItem.RefreshCD * 1000), contextData.tagInfo);
                     }
                 }
             }
         }
     }
 }
コード例 #2
0
        private void CheckSceneGameClients(KarenBattleScene karenBattleScene, long nowTicks)
        {
            List <GameClient> objsList = karenBattleScene.CopyMap.GetClientsList();

            if (objsList != null && objsList.Count != 0)
            {
                GameMap gameMap = null;
                if (GameManager.MapMgr.DictMaps.TryGetValue(karenBattleScene.m_nMapCode, out gameMap))
                {
                    for (int i = 0; i < objsList.Count; i++)
                    {
                        GameClient c = objsList[i];
                        if (c != null)
                        {
                            if (gameMap.InSafeRegionList(c.CurrentGrid))
                            {
                                if (c.SceneContextData != null)
                                {
                                    this.RemoveBattleSceneBuffForRole(karenBattleScene, c);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #3
0
 private void CheckSceneScoreTime(KarenBattleScene karenBattleScene, long nowTicks)
 {
     lock (this.RuntimeData.Mutex)
     {
         bool NotifyScoreData = false;
         foreach (KeyValuePair <int, KarenCenterConfig> item in karenBattleScene.KarenCenterConfigDict)
         {
             KarenCenterConfig center = item.Value;
             NotifyScoreData |= this.CheckSceneCenterState(karenBattleScene, center, nowTicks);
             if (center.BattleWhichSide != 0)
             {
                 center.OwnTicksDelta += nowTicks - center.OwnTicks;
                 center.OwnTicks       = nowTicks;
                 if (center.OwnTicksDelta >= (long)(center.ProduceTime * 1000) && center.ProduceTime > 0)
                 {
                     int calRate = (int)(center.OwnTicksDelta / (long)(center.ProduceTime * 1000));
                     center.OwnTicksDelta -= (long)(calRate * center.ProduceTime * 1000);
                     karenBattleScene.ScoreData[center.BattleWhichSide - 1].Score += calRate * center.ProduceNum;
                     karenBattleScene.ScoreData[center.BattleWhichSide - 1].ticks  = nowTicks;
                     NotifyScoreData = true;
                 }
             }
         }
         if (NotifyScoreData)
         {
             this.BroadcastSceneScoreInfo(karenBattleScene);
         }
     }
 }
コード例 #4
0
        private bool CheckSceneCenterState(KarenBattleScene karenBattleScene, KarenCenterConfig center, long nowTicks)
        {
            List <object> enemiesObjList = new List <object>();

            GameManager.ClientMgr.LookupEnemiesInCircle(karenBattleScene.m_nMapCode, karenBattleScene.CopyMapId, center.PosX, center.PosY, center.Radius, enemiesObjList);
            Dictionary <int, GameClient> OwnerSideDict = new Dictionary <int, GameClient>();
            int newBattleSide = 0;

            foreach (object item in enemiesObjList)
            {
                GameClient client = item as GameClient;
                if (client.ClientData.CurrentLifeV > 0)
                {
                    OwnerSideDict[client.ClientData.BattleWhichSide] = client;
                }
            }
            if (OwnerSideDict.Count == 1)
            {
                newBattleSide = OwnerSideDict.Keys.FirstOrDefault <int>();
            }
            bool result;

            if (newBattleSide == 0 || newBattleSide == center.BattleWhichSide)
            {
                center.OwnCalculateSide  = 0L;
                center.OwnCalculateTicks = 0L;
                result = false;
            }
            else if (center.OwnCalculateSide != (long)newBattleSide)
            {
                center.OwnCalculateSide  = (long)newBattleSide;
                center.OwnCalculateTicks = nowTicks;
                result = false;
            }
            else if (nowTicks - center.OwnCalculateTicks >= (long)(center.OccupyTime * 1000))
            {
                if (center.BattleWhichSide != 0)
                {
                    karenBattleScene.ScoreData[center.BattleWhichSide - 1].ResourceList.Remove(center.ID);
                }
                center.OwnTicksDelta   = 0L;
                center.OwnTicks        = nowTicks;
                center.BattleWhichSide = newBattleSide;
                karenBattleScene.ScoreData[center.BattleWhichSide - 1].ResourceList.Add(center.ID);
                GameClient    client    = OwnerSideDict.Values.FirstOrDefault <GameClient>();
                SystemXmlItem systemNPC = null;
                if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(center.NPCID, out systemNPC))
                {
                    string param  = systemNPC.GetStringValue("SName");
                    string param2 = client.ClientData.JunTuanName;
                    KarenBattleManager.getInstance().NtfKarenNotifyMsg(karenBattleScene, KarenNotifyMsgType.Own, client.ClientData.JunTuanId, param, param2);
                }
                result = true;
            }
            else
            {
                result = false;
            }
            return(result);
        }
コード例 #5
0
 public void CheckCreateDynamicMonster(KarenBattleScene scene, long nowMs)
 {
     lock (this.RuntimeData.Mutex)
     {
         while (scene.CreateMonsterQueue.Count > 0)
         {
             KeyValuePair <long, List <object> > pair = scene.CreateMonsterQueue.First <KeyValuePair <long, List <object> > >();
             if (nowMs < pair.Key)
             {
                 break;
             }
             try
             {
                 foreach (object obj in pair.Value)
                 {
                     if (obj is KarenBattleQiZhiConfig_East)
                     {
                         KarenBattleQiZhiConfig_East item = obj as KarenBattleQiZhiConfig_East;
                         GameManager.MonsterZoneMgr.AddDynamicMonsters(scene.m_nMapCode, item.MonsterID, scene.CopyMapId, 1, item.PosX / scene.MapGridWidth, item.PosY / scene.MapGridHeight, 0, 0, SceneUIClasses.KarenEast, item, null);
                     }
                 }
             }
             finally
             {
                 scene.CreateMonsterQueue.RemoveAt(0);
             }
         }
     }
 }
コード例 #6
0
 public void GiveAwards(KarenBattleScene scene)
 {
     try
     {
         foreach (KarenBattleClientContextData contextData in scene.ClientContextDataDict.Values)
         {
             int success;
             if (contextData.BattleWhichSide == scene.SuccessSide)
             {
                 success = 1;
             }
             else
             {
                 success = 0;
             }
             GameClient client     = GameManager.ClientMgr.FindClient(contextData.RoleId);
             string     awardsInfo = string.Format("{0},{1}", scene.SceneInfo.Id, success);
             if (client != null && client.ClientData.MapCode == scene.m_nMapCode)
             {
                 this.NtfCanGetAward(client, success, scene.SceneInfo);
                 this.GiveRoleAwards(client, success, scene.SceneInfo);
             }
         }
         this.PushGameResultData(scene);
     }
     catch (Exception ex)
     {
         DataHelper.WriteExceptionLogEx(ex, "阿卡伦系统清场调度异常");
     }
 }
コード例 #7
0
 private void UpdateKuaFuMapClientCount(KarenBattleScene scene)
 {
     if (null != scene)
     {
         CopyMap copyMap = scene.CopyMap;
         if (null != copyMap)
         {
             KarenBattleSceneInfo sceneItem          = this.SceneDataDict.Values.FirstOrDefault <KarenBattleSceneInfo>();
             List <int>           mapClientCountList = new List <int>(new int[sceneItem.MaxLegions]);
             List <GameClient>    objsList           = copyMap.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient c = objsList[i];
                     if (c != null)
                     {
                         int side = c.ClientData.BattleWhichSide;
                         if (side > 0 && side < mapClientCountList.Count)
                         {
                             List <int> list;
                             int        index;
                             (list = mapClientCountList)[index = side - 1] = list[index] + 1;
                         }
                     }
                 }
             }
             JunTuanClient.getInstance().UpdateKuaFuMapClientCount(scene.GameId, mapClientCountList);
         }
     }
 }
コード例 #8
0
 private void InitCreateDynamicMonster(KarenBattleScene scene)
 {
     foreach (KarenBattleQiZhiConfig_East junqi in this.RuntimeData.NPCID2QiZhiConfigDict.Values)
     {
         this.AddDelayCreateMonster(scene, scene.m_lPrepareTime + (long)(junqi.BeginTime * 1000), junqi);
     }
 }
コード例 #9
0
        public void NtfKarenNotifyMsg(KarenBattleScene scene, KarenNotifyMsgType index, int LegionID, string param1, string param2)
        {
            KarenNotifyMsg msg = new KarenNotifyMsg();

            msg.index    = (int)index;
            msg.LegionID = LegionID;
            msg.param1   = param1;
            msg.param2   = param2;
            GameManager.ClientMgr.BroadSpecialCopyMapMessage <KarenNotifyMsg>(1214, msg, scene.CopyMap);
        }
コード例 #10
0
 private void ProcessEnd(KarenBattleScene scene, int successSide, long nowTicks)
 {
     this.CompleteScene(scene, successSide);
     scene.m_eStatus              = GameSceneStatuses.STATUS_END;
     scene.m_lLeaveTime           = nowTicks + (long)(scene.SceneInfo.ClearRolesSecs * 1000);
     scene.StateTimeData.GameType = 19;
     scene.StateTimeData.State    = 5;
     scene.StateTimeData.EndTicks = scene.m_lLeaveTime;
     GameManager.ClientMgr.BroadSpecialCopyMapMessage <GameSceneStateTimeData>(827, scene.StateTimeData, scene.CopyMap);
 }
コード例 #11
0
 private void LeaveFuBen(GameClient client)
 {
     lock (this.RuntimeData.Mutex)
     {
         KarenBattleScene scene = null;
         if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
         {
             scene.m_nPlarerCount--;
         }
         JunTuanClient.getInstance().GameFuBenRoleChangeState(client.ServerId, client.ClientData.RoleID, scene.GameId, client.ClientData.BattleWhichSide, 7);
     }
 }
コード例 #12
0
 public void AddDelayCreateMonster(KarenBattleScene scene, long ticks, object monster)
 {
     lock (this.RuntimeData.Mutex)
     {
         List <object> list = null;
         if (!scene.CreateMonsterQueue.TryGetValue(ticks, out list))
         {
             list = new List <object>();
             scene.CreateMonsterQueue.Add(ticks, list);
         }
         list.Add(monster);
     }
 }
コード例 #13
0
        public int GetBirthPoint(GameClient client, out int posX, out int posY, bool isLogin = false)
        {
            posX = 0;
            posY = 0;
            double distance = 0.0;
            int    side     = client.ClientData.BattleWhichSide;

            lock (this.RuntimeData.Mutex)
            {
                KarenBattleBirthPoint birthPoint = null;
                if (!this.RuntimeData.MapBirthPointDict.TryGetValue(side, out birthPoint))
                {
                    return(-1);
                }
                posX     = birthPoint.PosX;
                posY     = birthPoint.PosY;
                distance = Global.GetTwoPointDistance(new Point((double)posX, (double)posY), new Point((double)client.ClientData.PosX, (double)client.ClientData.PosY));
            }
            int result;

            if (isLogin)
            {
                result = side;
            }
            else
            {
                KarenBattleScene scene = null;
                if (this.SceneDict.TryGetValue(client.ClientData.FuBenSeqID, out scene))
                {
                    foreach (KeyValuePair <int, KarenBattleQiZhiConfig_West> item in scene.NPCID2QiZhiConfigDict)
                    {
                        if (item.Value.BattleWhichSide == side)
                        {
                            double tempdis = Global.GetTwoPointDistance(new Point((double)item.Value.BirthX, (double)item.Value.BirthY), new Point((double)client.ClientData.PosX, (double)client.ClientData.PosY));
                            if (tempdis < distance)
                            {
                                distance = tempdis;
                                Point BirthPoint = Global.GetMapPointByGridXY(ObjectTypes.OT_CLIENT, client.ClientData.MapCode, item.Value.BirthX / scene.MapGridWidth, item.Value.BirthY / scene.MapGridHeight, item.Value.BirthRadius / scene.MapGridWidth, 0, false);
                                posX = (int)BirthPoint.X;
                                posY = (int)BirthPoint.Y;
                            }
                        }
                    }
                }
                result = side;
            }
            return(result);
        }
コード例 #14
0
        public void BroadcastSceneScoreInfo(KarenBattleScene scene)
        {
            List <GameClient> objsList = scene.CopyMap.GetClientsList();

            if (objsList != null && objsList.Count > 0)
            {
                for (int i = 0; i < objsList.Count; i++)
                {
                    GameClient c = objsList[i];
                    if (c != null && c.ClientData.CopyMapID == scene.CopyMap.CopyMapID)
                    {
                        this.NotifyTimeStateInfoAndScoreInfo(c, false, true);
                    }
                }
            }
        }
コード例 #15
0
        public bool OnSpriteClickOnNpc(GameClient client, int npcID, int npcExtentionID)
        {
            KarenBattleQiZhiConfig_West item = null;
            bool             isQiZuo         = false;
            bool             installJunQi    = false;
            KarenBattleScene scene           = client.SceneObject as KarenBattleScene;
            bool             result;

            if (null == scene)
            {
                result = isQiZuo;
            }
            else
            {
                lock (this.RuntimeData.Mutex)
                {
                    if (scene.NPCID2QiZhiConfigDict.TryGetValue(npcExtentionID, out item))
                    {
                        isQiZuo = true;
                        if (item.Alive)
                        {
                            return(isQiZuo);
                        }
                        if (client.ClientData.BattleWhichSide == item.BattleWhichSide || Math.Abs(TimeUtil.NOW() - item.DeadTicks) >= 5000L)
                        {
                            if (scene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                            {
                                if (Math.Abs(client.ClientData.PosX - item.PosX) <= 1000 && Math.Abs(client.ClientData.PosY - item.PosY) <= 1000)
                                {
                                    installJunQi = true;
                                }
                            }
                        }
                    }
                    if (installJunQi)
                    {
                        this.InstallJunQi(scene, client, item);
                    }
                }
                result = isQiZuo;
            }
            return(result);
        }
コード例 #16
0
 private void InitScene(KarenBattleScene scene, GameClient client)
 {
     foreach (KarenBattleQiZhiConfig_West item in this.RuntimeData.NPCID2QiZhiConfigDict.Values)
     {
         scene.NPCID2QiZhiConfigDict.Add(item.QiZuoID, item.Clone() as KarenBattleQiZhiConfig_West);
     }
     scene.ScoreData.Clear();
     for (int sideloop = 1; sideloop <= scene.SceneInfo.MaxLegions; sideloop++)
     {
         JunTuanRankData      RankData  = KarenBattleManager.getInstance().GetJunTuanRankDataBySide(sideloop);
         KarenBattleScoreData scoreData = new KarenBattleScoreData();
         if (null != RankData)
         {
             scoreData.LegionID = RankData.JunTuanId;
             scoreData.Name     = RankData.JunTuanName;
         }
         scene.ScoreData.Add(scoreData);
     }
 }
コード例 #17
0
 public void OnProcessMonsterDead(GameClient client, Monster monster)
 {
     if (client != null && this.IsQiZhiExtensionID(monster.MonsterInfo.ExtensionID))
     {
         KarenBattleScene            scene       = client.SceneObject as KarenBattleScene;
         KarenBattleQiZhiConfig_West qizhiConfig = monster.Tag as KarenBattleQiZhiConfig_West;
         if (scene != null && null != qizhiConfig)
         {
             lock (this.RuntimeData.Mutex)
             {
                 scene.ScoreData[qizhiConfig.BattleWhichSide - 1].ResourceList.Remove(qizhiConfig.ID);
                 qizhiConfig.DeadTicks       = TimeUtil.NOW();
                 qizhiConfig.Alive           = false;
                 qizhiConfig.BattleWhichSide = client.ClientData.BattleWhichSide;
                 qizhiConfig.OwnTicks        = 0L;
                 qizhiConfig.OwnTicksDelta   = 0L;
                 this.BroadcastSceneScoreInfo(scene);
             }
         }
     }
 }
コード例 #18
0
        private void CheckSceneBufferTime(KarenBattleScene karenBattleScene, long nowTicks)
        {
            List <KarenBattleSceneBuff> sceneBuffDeleteList = new List <KarenBattleSceneBuff>();

            lock (this.RuntimeData.Mutex)
            {
                if (karenBattleScene.m_eStatus == GameSceneStatuses.STATUS_BEGIN)
                {
                    if (karenBattleScene.SceneBuffDict.Count != 0)
                    {
                        foreach (KarenBattleSceneBuff contextData in karenBattleScene.SceneBuffDict.Values)
                        {
                            if (contextData.EndTicks < nowTicks)
                            {
                                sceneBuffDeleteList.Add(contextData);
                            }
                        }
                        if (sceneBuffDeleteList.Count != 0)
                        {
                            foreach (KarenBattleSceneBuff contextData in sceneBuffDeleteList)
                            {
                                if (contextData.RoleID != 0)
                                {
                                    GameClient client = GameManager.ClientMgr.FindClient(contextData.RoleID);
                                    if (null != client)
                                    {
                                        this.UpdateBuff4GameClient(client, contextData.BuffID, contextData.tagInfo, false);
                                    }
                                }
                                KarenBattleQiZhiConfig_East CrystalItem = contextData.tagInfo as KarenBattleQiZhiConfig_East;
                                if (null != CrystalItem)
                                {
                                    this.AddDelayCreateMonster(karenBattleScene, TimeUtil.NOW() + (long)(CrystalItem.RefreshCD * 1000), contextData.tagInfo);
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #19
0
        public void InstallJunQi(KarenBattleScene scene, GameClient client, KarenBattleQiZhiConfig_West item)
        {
            CopyMap copyMap = scene.CopyMap;
            GameMap gameMap = GameManager.MapMgr.GetGameMap(scene.m_nMapCode);

            if (copyMap != null && null != gameMap)
            {
                item.Alive           = true;
                item.BattleWhichSide = client.ClientData.BattleWhichSide;
                item.OwnTicks        = TimeUtil.NOW();
                scene.ScoreData[item.BattleWhichSide - 1].ResourceList.Add(item.ID);
                GameManager.MonsterZoneMgr.AddDynamicMonsters(copyMap.MapCode, item.QiZhiID, copyMap.CopyMapID, 1, item.PosX / gameMap.MapGridWidth, item.PosY / gameMap.MapGridHeight, 0, 0, SceneUIClasses.KarenWest, item, null);
                SystemXmlItem systemNPC = null;
                if (GameManager.SystemNPCsMgr.SystemXmlItemDict.TryGetValue(item.QiZuoID, out systemNPC))
                {
                    string param  = systemNPC.GetStringValue("SName");
                    string param2 = client.ClientData.JunTuanName;
                    KarenBattleManager.getInstance().NtfKarenNotifyMsg(scene, KarenNotifyMsgType.Own, client.ClientData.JunTuanId, param, param2);
                }
                this.BroadcastSceneScoreInfo(scene);
            }
        }
コード例 #20
0
 private void CheckSceneScoreTime(KarenBattleScene karenBattleScene, long nowTicks)
 {
     lock (this.RuntimeData.Mutex)
     {
         bool NotifyScoreData = false;
         foreach (KeyValuePair <int, KarenBattleQiZhiConfig_West> item in karenBattleScene.NPCID2QiZhiConfigDict)
         {
             KarenBattleQiZhiConfig_West qizhi = item.Value;
             if (qizhi.BattleWhichSide != 0 && qizhi.Alive)
             {
                 qizhi.OwnTicksDelta += nowTicks - qizhi.OwnTicks;
                 qizhi.OwnTicks       = nowTicks;
                 if (qizhi.OwnTicksDelta >= (long)(qizhi.ProduceTime * 1000) && qizhi.ProduceTime > 0)
                 {
                     int calRate = (int)(qizhi.OwnTicksDelta / (long)(qizhi.ProduceTime * 1000));
                     qizhi.OwnTicksDelta -= (long)(calRate * qizhi.ProduceTime * 1000);
                     karenBattleScene.ScoreData[qizhi.BattleWhichSide - 1].Score += calRate * qizhi.ProduceNum;
                     karenBattleScene.ScoreData[qizhi.BattleWhichSide - 1].ticks  = nowTicks;
                     NotifyScoreData = true;
                 }
             }
         }
         if (NotifyScoreData)
         {
             List <GameClient> objsList = karenBattleScene.CopyMap.GetClientsList();
             if (objsList != null && objsList.Count > 0)
             {
                 for (int i = 0; i < objsList.Count; i++)
                 {
                     GameClient c = objsList[i];
                     if (c != null && c.ClientData.CopyMapID == karenBattleScene.CopyMap.CopyMapID)
                     {
                         this.NotifyTimeStateInfoAndScoreInfo(c, false, true);
                     }
                 }
             }
         }
     }
 }
コード例 #21
0
 public void CompleteScene(KarenBattleScene scene, int successSide)
 {
     scene.SuccessSide = successSide;
 }
コード例 #22
0
        public bool AddCopyScenes(GameClient client, CopyMap copyMap, SceneUIClasses sceneType)
        {
            bool result;

            if (sceneType == SceneUIClasses.KarenWest)
            {
                GameMap gameMap = null;
                if (!GameManager.MapMgr.DictMaps.TryGetValue(client.ClientData.MapCode, out gameMap))
                {
                    result = false;
                }
                else
                {
                    int      fuBenSeqId = copyMap.FuBenSeqID;
                    int      mapCode    = copyMap.MapCode;
                    int      roleId     = client.ClientData.RoleID;
                    int      gameId     = (int)Global.GetClientKuaFuServerLoginData(client).GameId;
                    DateTime now        = TimeUtil.NowDateTime();
                    lock (this.RuntimeData.Mutex)
                    {
                        KarenBattleScene scene = null;
                        if (!this.SceneDict.TryGetValue(fuBenSeqId, out scene))
                        {
                            KarenFuBenData fuBenData;
                            if (!this.RuntimeData.FuBenItemData.TryGetValue(gameId, out fuBenData))
                            {
                                LogManager.WriteLog(LogTypes.Error, "阿卡伦战场没有为副本找到对应的跨服副本数据,GameID:" + gameId, null, true);
                            }
                            KarenBattleSceneInfo sceneInfo;
                            if (null == (sceneInfo = KarenBattleManager.getInstance().TryGetKarenBattleSceneInfo(mapCode)))
                            {
                                LogManager.WriteLog(LogTypes.Error, "阿卡伦战场没有为副本找到对应的档位数据,ID:" + mapCode, null, true);
                            }
                            scene         = new KarenBattleScene();
                            scene.CopyMap = copyMap;
                            scene.CleanAllInfo();
                            scene.GameId         = gameId;
                            scene.m_nMapCode     = mapCode;
                            scene.CopyMapId      = copyMap.CopyMapID;
                            scene.FuBenSeqId     = fuBenSeqId;
                            scene.m_nPlarerCount = 1;
                            scene.SceneInfo      = sceneInfo;
                            scene.MapGridWidth   = gameMap.MapGridWidth;
                            scene.MapGridHeight  = gameMap.MapGridHeight;
                            DateTime startTime = now.Date.Add(KarenBattleManager.getInstance().GetStartTime(sceneInfo.MapCode));
                            scene.StartTimeTicks = startTime.Ticks / 10000L;
                            this.InitScene(scene, client);
                            this.SceneDict[fuBenSeqId] = scene;
                        }
                        else
                        {
                            scene.m_nPlarerCount++;
                        }
                        KarenBattleClientContextData clientContextData;
                        if (!scene.ClientContextDataDict.TryGetValue(roleId, out clientContextData))
                        {
                            clientContextData = new KarenBattleClientContextData
                            {
                                RoleId          = roleId,
                                ServerId        = client.ServerId,
                                BattleWhichSide = client.ClientData.BattleWhichSide
                            };
                            scene.ClientContextDataDict[roleId] = clientContextData;
                        }
                        client.SceneObject       = scene;
                        client.SceneGameId       = (long)scene.GameId;
                        client.SceneContextData2 = clientContextData;
                        copyMap.IsKuaFuCopy      = true;
                        copyMap.SetRemoveTicks(TimeUtil.NOW() + (long)(scene.SceneInfo.TotalSecs * 1000));
                    }
                    JunTuanClient.getInstance().GameFuBenRoleChangeState(client.ServerId, roleId, gameId, client.ClientData.BattleWhichSide, 5);
                    result = true;
                }
            }
            else
            {
                result = false;
            }
            return(result);
        }
コード例 #23
0
        public void PushGameResultData(KarenBattleScene scene)
        {
            JunTuanRankData rankData = this.GetJunTuanRankDataBySide(scene.SuccessSide);

            if (null != rankData)
            {
                JunTuanBaseData baseData = JunTuanManager.getInstance().GetJunTuanBaseDataByJunTuanID(rankData.JunTuanId);
                if (null == baseData)
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("无法获取军团基本信息 JunTuanId={0}", rankData.JunTuanId), null, true);
                }
                else if (baseData.BhList == null || baseData.BhList.Count == 0)
                {
                    LogManager.WriteLog(LogTypes.Fatal, string.Format("军团基本信息BhList为空 JunTuanId={0}", rankData.JunTuanId), null, true);
                }
                else
                {
                    int               leaderBangHui  = baseData.BhList[0];
                    int               leaderServerID = 0;
                    SceneUIClasses    mapType        = Global.GetMapSceneType(scene.m_nMapCode);
                    int               lingDiType     = this.ConvertMapSceneTypeToCaiJiLingDiType(mapType);
                    LingDiData        oldLingDiData  = null;
                    List <LingDiData> LingDiList     = JunTuanClient.getInstance().GetLingDiData();
                    if (null != LingDiList)
                    {
                        oldLingDiData = LingDiList.Find((LingDiData x) => x.LingDiType == lingDiType);
                    }
                    RoleData4Selector oldLeader = (oldLingDiData != null && oldLingDiData.RoleData != null) ? DataHelper.BytesToObject <RoleData4Selector>(oldLingDiData.RoleData, 0, oldLingDiData.RoleData.Length) : null;
                    lock (this.Mutex)
                    {
                        if (!this.FactionIDVsServerIDDict.TryGetValue(leaderBangHui, out leaderServerID))
                        {
                            JunTuanData data = JunTuanClient.getInstance().GetJunTuanData(leaderBangHui, rankData.JunTuanId, true);
                            if (null == data)
                            {
                                LogManager.WriteLog(LogTypes.Fatal, string.Format("无法获取JunTuanData BangHuiID={0} JunTuanId={1}", leaderBangHui, rankData.JunTuanId), null, true);
                                return;
                            }
                            LingDiCaiJiManager.getInstance().SetLingZhu(lingDiType, data.LeaderRoleId, rankData.JunTuanId, rankData.JunTuanName, null);
                            EventLogManager.AddKarenBattleEvent(lingDiType, oldLeader, data.LeaderZoneId, rankData.JunTuanId, data.LeaderRoleId);
                            return;
                        }
                    }
                    BangHuiDetailData bhData = Global.GetBangHuiDetailData(-1, leaderBangHui, leaderServerID);
                    if (null == bhData)
                    {
                        LogManager.WriteLog(LogTypes.Fatal, string.Format("无法获取帮会详细信息 BangHuiID={0} ServerID={1}", leaderBangHui, leaderServerID), null, true);
                    }
                    else
                    {
                        RoleDataEx dbRd = Global.sendToDB <RoleDataEx, string>(275, string.Format("{0}:{1}", -1, bhData.BZRoleID), leaderServerID);
                        if (dbRd == null || dbRd.RoleID <= 0)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("无法获取帮主详细信息 BangHuiID={0} BZRoleID={1} ServerID={2}", leaderBangHui, bhData.BZRoleID, leaderServerID), null, true);
                        }
                        else
                        {
                            JunTuanManager.getInstance().OnInitGame(dbRd);
                            RoleData4Selector leaderShowInfo = Global.RoleDataEx2RoleData4Selector(dbRd);
                            LingDiCaiJiManager.getInstance().SetLingZhu(lingDiType, dbRd.RoleID, rankData.JunTuanId, rankData.JunTuanName, leaderShowInfo);
                            EventLogManager.AddKarenBattleEvent(lingDiType, oldLeader, dbRd.ZoneID, rankData.JunTuanId, dbRd.RoleID);
                        }
                    }
                }
            }
        }