Example #1
0
        public static bool EnterSceneCopyScene(GameClient client, out int nSeqID, int mapCode)
        {
            nSeqID = -1;
            ZhuanShengMapInfo mapInfo;

            lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
            {
                if (!ZhuanShengShiLian.ZhuanShengRunTimeData.ZhuanShengMapDict.TryGetValue(mapCode, out mapInfo))
                {
                    return(false);
                }
            }
            bool result;

            if (!ZhuanShengShiLian.JudgeCanEnterOnTime(mapInfo))
            {
                result = false;
            }
            else
            {
                int calEnterMapCode = ZhuanShengShiLian.GetZhuanShengShiLianMapCodeIDForRole(client);
                if (calEnterMapCode <= 0 || mapCode != calEnterMapCode)
                {
                    result = false;
                }
                else
                {
                    ZSSLScene sceneInfo = null;
                    lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                    {
                        foreach (KeyValuePair <int, ZSSLScene> kvp in ZhuanShengShiLian.SceneDict)
                        {
                            if (kvp.Value.SceneInfo.MapCode == mapCode)
                            {
                                sceneInfo = kvp.Value;
                                nSeqID    = kvp.Key;
                                break;
                            }
                        }
                        if (null == sceneInfo)
                        {
                            nSeqID    = GameCoreInterface.getinstance().GetNewFuBenSeqId();
                            sceneInfo = new ZSSLScene();
                            sceneInfo.CleanAllInfo();
                            sceneInfo.SceneInfo = mapInfo;
                            ZhuanShengShiLian.SceneDict[nSeqID] = sceneInfo;
                        }
                    }
                    if (null != sceneInfo.m_CopyMap)
                    {
                        if (sceneInfo.m_CopyMap.GetGameClientCount() >= mapInfo.MaxEnterNum)
                        {
                            return(false);
                        }
                    }
                    result = true;
                }
            }
            return(result);
        }
Example #2
0
 public static void BroadBossLife(ZSSLScene mapInfo, GameClient client, bool Top5Chg)
 {
     if (null != mapInfo.AttackLog)
     {
         BossLifeLog bossLifeLog = new BossLifeLog();
         bossLifeLog.InjureSum = mapInfo.AttackLog.InjureSum;
         if (null != mapInfo.AttackLog.BHAttackRank)
         {
             int countLimit = Global.GMin(mapInfo.AttackLog.BHAttackRank.Count, 5);
             bossLifeLog.BHAttackRank = mapInfo.AttackLog.BHAttackRank.GetRange(0, countLimit);
         }
         List <GameClient> objsList = mapInfo.m_CopyMap.GetClientsList();
         if (objsList != null && objsList.Count > 0)
         {
             for (int i = 0; i < objsList.Count; i++)
             {
                 GameClient c = objsList[i];
                 if (c != null)
                 {
                     if (!Top5Chg && null != client)
                     {
                         if (client.ClientData.TeamID > 0 && client.ClientData.TeamID != c.ClientData.TeamID)
                         {
                             goto IL_189;
                         }
                         if (c.ClientData.RoleID != client.ClientData.RoleID)
                         {
                             goto IL_189;
                         }
                     }
                     if (null != mapInfo.AttackLog.BHInjure)
                     {
                         long tID = ZhuanShengShiLian.GetGUID(c.ClientData.TeamID, c.ClientData.RoleID);
                         mapInfo.AttackLog.BHInjure.TryGetValue(tID, out bossLifeLog.SelfBHAttack);
                     }
                     c.sendCmd <BossLifeLog>(1906, bossLifeLog, false);
                 }
                 IL_189 :;
             }
         }
     }
 }
Example #3
0
        public static void SendTimeInfoToAll(ZSSLScene scene, long ticks)
        {
            List <GameClient> objsList = scene.m_CopyMap.GetClientsList();

            if (objsList != null && objsList.Count > 0)
            {
                for (int i = 0; i < objsList.Count; i++)
                {
                    GameClient client = objsList[i];
                    if (client != null)
                    {
                        int nRemainSecs;
                        int nStatus;
                        lock (ZhuanShengShiLian.ZhuanShengRunTimeData.Mutex)
                        {
                            nRemainSecs = (int)((scene.StatusEndTime - ticks) / 1000L);
                            nStatus     = (int)scene.State;
                        }
                        string strcmd = string.Format("{0}:{1}", nStatus, nRemainSecs);
                        client.sendCmd(1909, strcmd, false);
                    }
                }
            }
        }