コード例 #1
0
        public void OnLeaveScene(GameClient client, SceneUIClasses sceneType, bool logout = false)
        {
            if (client.ClientSocket.IsKuaFuLogin)
            {
                switch (sceneType)
                {
                case SceneUIClasses.HuanYingSiYuan:
                    HuanYingSiYuanManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.TianTi:
                    TianTiManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.YongZheZhanChang:
                    YongZheZhanChangManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.KingOfBattle:
                    KingOfBattleManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.MoRiJudge:
                    MoRiJudgeManager.Instance().OnLogOut(client);
                    break;

                case SceneUIClasses.ElementWar:
                    ElementWarManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.LangHunLingYu:
                    LangHunLingYuManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.CopyWolf:
                    CopyWolfManager.getInstance().OnLogout(client);
                    break;

                case SceneUIClasses.KFZhengBa:
                    ZhengBaManager.Instance().OnLogout(client);
                    break;

                case SceneUIClasses.CoupleArena:
                    CoupleArenaManager.Instance().OnLeaveFuBen(client);
                    break;
                }

                if (!logout)
                {
                    GotoLastMap(client);
                }
            }
        }
コード例 #2
0
        public bool OnInitGame(GameClient client)
        {
            int gameType = Global.GetClientKuaFuServerLoginData(client).GameType;

            switch (gameType)
            {
            case (int)GameTypes.HuanYingSiYuan:
                return(HuanYingSiYuanManager.getInstance().OnInitGame(client));

            case (int)GameTypes.TianTi:
                return(TianTiManager.getInstance().OnInitGame(client));

            case (int)GameTypes.YongZheZhanChang:
                return(YongZheZhanChangManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KingOfBattle:
                return(KingOfBattleManager.getInstance().OnInitGame(client));

            case (int)GameTypes.MoRiJudge:
                return(MoRiJudgeManager.Instance().OnInitGame(client));

            case (int)GameTypes.ElementWar:
                return(ElementWarManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuBoss:
                return(KuaFuBossManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuMap:
                return(KuaFuMapManager.getInstance().OnInitGame(client));

            case (int)GameTypes.KuaFuCopy:
                return(CopyTeamManager.Instance().HandleKuaFuInitGame(client));

            case (int)GameTypes.LangHunLingYu:
                return(LangHunLingYuManager.getInstance().OnInitGameKuaFu(client));

            case (int)GameTypes.ZhengBa:
                return(ZhengBaManager.Instance().KuaFuInitGame(client));

            case (int)GameTypes.CoupleArena:
                return(CoupleArenaManager.Instance().KuaFuInitGame(client));
            }

            return(false);
        }
コード例 #3
0
        //刷新当前的功能开启状态,处理有关逻辑
        public static void RefreshGongNeng(GameClient client)
        {
            CaiJiLogic.InitRoleDailyCaiJiData(client, false, false);
            HuanYingSiYuanManager.getInstance().InitRoleDailyHYSYData(client);
            Global.InitRoleDailyTaskData(client, false);
            // 检测触发开启守护之灵
            GuardStatueManager.Instance().OnTaskComplete(client);

            // 检测开启梅林魔法书 [XSea 2015/6/23]
            GameManager.MerlinMagicBookMgr.InitMerlinMagicBook(client);

            // 魂石系统
            SoulStoneManager.Instance().CheckOpen(client);

            ZhengBaManager.Instance().CheckGongNengCanOpen(client);

            FundManager.initFundData(client);

            CoupleArenaManager.Instance().CheckGongNengOpen(client);
        }
コード例 #4
0
        public static void initialize()
        {
#if BetaConfig
            int round = 9;
            Console.WriteLine("连接调试器或按任意键继续");
            do
            {
                Console.Write("\b\b" + round);
                if (Console.KeyAvailable)
                {
                    break;
                }
                Thread.Sleep(1000);
            } while (--round > 0);
            Console.Write("\b\b");
#endif
            //战盟事件管理器
            ZhanMengShiJianManager.getInstance().initialize();

            //竞技场管理器
            JingJiChangManager.getInstance().initialize();

            //离线摆摊
            LiXianBaiTanManager.getInstance().initialize();

            //离线挂机
            LiXianGuaJiManager.getInstance().initialize();

            //副本活动组队管理器
            CopyTeamManager.Instance().initialize();

            //指令注册管理器
            CmdRegisterTriggerManager.getInstance().initialize();

            //发送指令管理
            SendCmdManager.getInstance().initialize();

            //Boss AI管理器
            BossAIManager.getInstance().initialize();

            //洗炼管理器
            WashPropsManager.initialize();

            //MU交易所
            SaleManager.getInstance().initialize();

            //炼制系统
            LianZhiManager.GetInstance().initialize();

            // 成就升级
            ChengJiuManager.GetInstance().initialize();

            //声望勋章
            PrestigeMedalManager.getInstance().initialize();

            UnionPalaceManager.getInstance().initialize();
            UserActivateManager.getInstance().initialize();

            PetSkillManager.getInstance().initialize();

            //玩家召回
            UserReturnManager.getInstance().initialize();

            //天赋
            TalentManager.getInstance().initialize();

            //每日专享
            TodayManager.getInstance().initialize();

            FundManager.getInstance().initialize();

            //警告
            WarnManager.getInstance().initialize();

            //恶魔来袭
            EMoLaiXiCopySceneManager.LoadEMoLaiXiCopySceneInfo();

            //罗兰法阵副本
            LuoLanFaZhenCopySceneManager.initialize();

            //情侣副本管理器
            MarryFuBenMgr.getInstance().initialize();
            MarryLogic.LoadMarryBaseConfig();
            MarryPartyLogic.getInstance().LoadMarryPartyConfig();

            //领地
            BuildingManager.getInstance().initialize();

            // 藏宝秘境
            OnePieceManager.getInstance().initialize();

            //初始化跨服相关管理器
            RegisterManager4Scene((int)SceneUIClasses.Normal, KuaFuManager.getInstance());
            // RegisterManager4Scene((int)SceneUIClasses.LangHunLingYu, LangHunLingYuManager.getInstance());

            //注册罗兰城战管理器
            RegisterManager4Scene((int)SceneUIClasses.LuoLanChengZhan, LuoLanChengZhanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Normal, FashionManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.HuanYingSiYuan, HuanYingSiYuanManager.getInstance());
            RegisterManager4Scene((int)ManagerTypes.ClientGoodsList, JingLingQiYuanManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.TianTi, TianTiManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.YongZheZhanChang, YongZheZhanChangManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KingOfBattle, KingOfBattleManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.MoRiJudge, MoRiJudgeManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.ElementWar, ElementWarManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CopyWolf, CopyWolfManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuBoss, KuaFuBossManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KuaFuMap, KuaFuMapManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.Spread, SpreadManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.KFZhengBa, ZhengBaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleArena, CoupleArenaManager.Instance());
            RegisterManager4Scene((int)SceneUIClasses.Ally, AllyManager.getInstance());
            RegisterManager4Scene((int)SceneUIClasses.CoupleWish, CoupleWishManager.Instance());

            // 读取外挂列表和相关配置
            RobotTaskValidator.getInstance().Initialize(false, 0, 0, "");

            //初始化圣物系统相关配置
            HolyItemManager.getInstance().Initialize();

            //初始化塔罗牌相关配置
            TarotManager.getInstance().Initialize();

            // 七日活动
            SevenDayActivityMgr.Instance().initialize();

            // 魂石
            SoulStoneManager.Instance().initialize();

            TradeBlackManager.Instance().LoadConfig();
            //调用所有注册的管理模块的初始化函数
            lock (Scene2ManagerDict)
            {
                foreach (var list in Scene2ManagerDict.Values)
                {
                    foreach (var m in list)
                    {
                        bool      success = m.initialize();
                        IManager2 m2      = m as IManager2;
                        if (null != m2)
                        {
                            success = success && m2.initialize(GameCoreInterface.getinstance());
                        }

                        if (GameManager.ServerStarting && !success)
                        {
                            LogManager.WriteLog(LogTypes.Fatal, string.Format("执行{0}.initialize()失败,按任意键继续启动!", m.GetType()));
                            //Console.ReadKey(); HX_SERVER close the copy scenes;
                        }
                    }
                }
            }

            //应用宝
            TenManager.getInstance().initialize();
            TenRetutnManager.getInstance().initialize();

            //礼包码
            GiftCodeNewManager.getInstance().initialize();
        }
コード例 #5
0
        public bool OnUserLogin(TMSKSocket socket, int verSign, string userID, string userName, string lastTime, string userToken, string isadult, string signCode, int serverId, string ip, int port, int roleId, int gameType, long gameId)
        {
            KuaFuServerLoginData kuaFuServerLoginData = socket.ClientKuaFuServerLoginData;

            kuaFuServerLoginData.ServerId   = serverId;
            kuaFuServerLoginData.ServerIp   = ip;
            kuaFuServerLoginData.ServerPort = port;
            kuaFuServerLoginData.RoleId     = roleId;
            kuaFuServerLoginData.GameType   = gameType;
            kuaFuServerLoginData.GameId     = gameId;

            if (kuaFuServerLoginData.WebLoginToken == null)
            {
                kuaFuServerLoginData.WebLoginToken = new WebLoginToken()
                {
                    VerSign  = verSign,
                    UserID   = userID,
                    UserName = userName,
                    LastTime = lastTime,
                    Isadult  = isadult,
                    SignCode = signCode,
                };
            }

            if (roleId > 0)
            {
                // 跨服服务器的两个ID相等,如果不想等,则配置错误;
                // 如果想要去掉这个限制,允许区游戏服务器兼作跨服活动服务器(混合使用),必须先修改GameManager.ServerLineID相关的逻辑,使其可以兼容
                // 完成修改前,这个限制不可取消.
                if (GameManager.ServerLineID != GameManager.ServerId)
                {
                    LogManager.WriteLog(LogTypes.Error, "GameManager.ServerLineID未配置,禁止跨服登录");
                    return(false);
                }

                //跨服登录,限制rid
                if (!string.IsNullOrEmpty(ip) && port > 0 && gameType > 0 && gameId > 0 /* && HuanYingSiYuanClient.getInstance().CanKuaFuLogin()*/)
                {
                    string dbIp      = "";
                    int    dbPort    = 0;
                    string logDbIp   = "";
                    int    logDbPort = 0;
                    socket.ServerId = serverId;
                    switch (gameType)
                    {
                    case (int)GameTypes.HuanYingSiYuan:
                    {
                        if (!HuanYingSiYuanClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = HuanYingSiYuanClient.getInstance().KuaFuLogin(kuaFuServerLoginData);
                        if (!HuanYingSiYuanClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.TianTi:
                    {
                        if (!TianTiClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = TianTiClient.getInstance().KuaFuLogin(kuaFuServerLoginData);
                        if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.KingOfBattle:
                    case (int)GameTypes.YongZheZhanChang:
                    case (int)GameTypes.KuaFuBoss:
                    {
                        if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = YongZheZhanChangClient.getInstance().KuaFuLogin(kuaFuServerLoginData);
                        if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.KuaFuMap:
                    {
                        if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = YongZheZhanChangClient.getInstance().CanEnterKuaFuMap(kuaFuServerLoginData);
                        if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.LangHunLingYu:
                    {
                        if (!YongZheZhanChangClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = LangHunLingYuManager.getInstance().CanEnterKuaFuMap(kuaFuServerLoginData);
                        if (!YongZheZhanChangClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.KuaFuCopy:
                    {
                        if (!KFCopyRpcClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = CopyTeamManager.Instance().HandleKuaFuLogin(kuaFuServerLoginData);
                        if (!KFCopyRpcClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.ZhengBa:
                    {
                        if (!TianTiClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = ZhengBaManager.Instance().CanKuaFuLogin(kuaFuServerLoginData);
                        if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;

                    case (int)GameTypes.CoupleArena:
                    {
                        if (!TianTiClient.getInstance().CanKuaFuLogin())
                        {
                            return(false);
                        }

                        socket.IsKuaFuLogin = CoupleArenaManager.Instance().CanKuaFuLogin(kuaFuServerLoginData);
                        if (!TianTiClient.getInstance().GetKuaFuDbServerInfo(serverId, out dbIp, out dbPort, out logDbIp, out logDbPort))
                        {
                            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的原服务器的服务器IP和端口", kuaFuServerLoginData.RoleId));
                            return(false);
                        }
                    }
                    break;
                    }

                    if (socket.IsKuaFuLogin && serverId != 0)
                    {
                        if (serverId != 0)
                        {
                            if (!InitGameDbConnection(serverId, dbIp, dbPort, logDbIp, logDbPort))
                            {
                                LogManager.WriteLog(LogTypes.Error, string.Format("连接角色{0}的原服务器的GameDBServer和LogDBServer失败", kuaFuServerLoginData.RoleId));
                                return(false);
                            }
                        }

                        return(socket.IsKuaFuLogin);
                    }
                }
                else
                {
                    LogManager.WriteLog(LogTypes.Error, string.Format("角色{0}未能在服务器列表中找本服务器,作为跨服服务器", kuaFuServerLoginData.RoleId));
                    return(false);
                }
            }
            else
            {
                //非跨服登录
                if (HuanYingSiYuanClient.getInstance().LocalLogin(userID))
                {
                    kuaFuServerLoginData.RoleId   = 0;
                    kuaFuServerLoginData.GameId   = 0;
                    kuaFuServerLoginData.GameType = 0;
                    kuaFuServerLoginData.ServerId = 0;
                    socket.ServerId     = 0;
                    socket.IsKuaFuLogin = false;
                    return(true);
                }
            }

            LogManager.WriteLog(LogTypes.Error, string.Format("未能找到角色{0}的跨服活动或副本信息", kuaFuServerLoginData.RoleId));
            return(false);
        }