Example #1
0
        static void Main(string[] args)
        {
            Console.Title = "YGCore LoginServer";
            Console.WriteLine("Authors: Jenose\n"
                              + "Authorized representative: netgame.in.th\n\n"
                              + "-------------------------------------------\n");

            Stopwatch sw = Stopwatch.StartNew();

            Configuration.GetInstance();

            ClientManager.GetInstance();
            GameServerManager.GetInstance();
            GSNetworkFactory.GetInstance();
            NetworkFactory.GetInstance();

            sw.Stop();

            Thread.Sleep(100);
            Console.WriteLine("-------------------------------------------");
            Console.WriteLine("           Server start in {0}", (sw.ElapsedMilliseconds / 1000.0).ToString("0.00s"));
            Console.WriteLine("-------------------------------------------");

            Process.GetCurrentProcess().WaitForExit();
        }
    // Set up the Game Server Manager script
    // The setting up of the script is such because of authority issue. P2 (Client) could not issue command for server's
    // GameServerManager because of . That is why they must inherit the controller's script.
    void SettingUpGameServerManager()
    {
        // Local Players will set their GameServerManager as their script
        if (isLocalPlayer)
        {
            mainGameServerManager = GetComponent <GameServerManager>();
        }
        else
        {
            // Other non-local player will set the local player's script as their gameServerManagerScript
            var gameServerManagerScript = FindObjectsOfType <GameServerManager>();
            foreach (GameServerManager script in gameServerManagerScript)
            {
                if (script.gameObject != this.gameObject)
                {
                    mainGameServerManager = script;

                    if (mainGameServerManager == null)
                    {
                        StartCoroutine(SearchForGameServerManagerAgain());
                    }
                }
            }
        }
    }
Example #3
0
        protected internal override void Run()
        {
            var resp = AuthService.GetInstance().AuthAccount(Login, MD5Pass, ref _Client._Account);

            foreach (GSClient client in GameServerManager.GetInstance().GetAllGSClient())
            {
                client.SendPacket(new LSReqUserOnlineCount());
            }

            _Client.SendPacket(new ResponseLogin(resp));
        }
Example #4
0
 public void SetConfig(Properties config)
 {
     DbManager           = AccountManager.Instance;
     matchQueue          = PlayerQueueManager.Instance;
     queueManager        = GameServerManager.Instance;
     this.config         = config;
     JHSDebug.LogReciver = new JHSLoggingOverite();
     NetConfig.logFilter = (JHSLogFilter)Settings.DEBUG_MODE;
     NetConfig.IP        = this.config.get("HOST_IP");
     NetConfig.Port      = int.Parse(this.config.get("TCP_port"));
 }
Example #5
0
 private AdminServer()
 {
     _disposed             = false;
     _isRunning            = false;
     _securityManager      = new SecurityManager();
     _gameServerManager    = new GameServerManager();
     _connectionManager    = new ConnectionManager();
     _messageEngine        = new MessageEngine();
     _gameServerMonitor    = new GameServerMonitor();
     _automationManager    = new AutomationManager();
     _strategyManager      = new StrategyManager();
     _scheduledTaskManager = new ScheduledTaskManager();
     _FTPClient            = new FTPClient();
     _batchTaskManager     = new BatchTaskManager();
     _paysysManager        = new PaysysManager();
     _ibShopManager        = new IBShopManager();
 }
Example #6
0
        public bool Execute(JHSNetworkMessage netMsg)
        {
            if (queueManager == null)
            {
                queueManager = GameServerManager.Instance;
            }

            GameServerLogin packet = netMsg.ReadMessage <GameServerLogin>();

            if (packet != null)
            {
                uint connectionId = netMsg.conn.connectionId;
                var  server       = queueManager.GetServerByConnectionId(connectionId);
                if (server == null)
                {
                    if (Settings.BINDPASSWORD == packet.PassWord)
                    {
                        if (queueManager.AddServer(connectionId, packet))
                        {
                            netMsg.conn.Send(GameServerOP.UPDATE_STATE, packet);
                        }
                    }
                }
                else
                {
                    if (server != null)
                    {
                        lock (server)
                        {
                            server.status = packet.gameMatchState;
                            LOG.Info("OnChangeSession ServerId[" + connectionId + "] Status[" + packet.gameMatchState.ToString() + "]");
                        }
                    }
                }
            }
            return(true);
        }
Example #7
0
        public bool Execute(JHSNetworkMessage netMsg)
        {
            if (DbManager == null)
            {
                DbManager = AccountManager.Instance;
            }
            if (queueManager == null)
            {
                queueManager = GameServerManager.Instance;
            }
            if (dbService == null)
            {
                dbService = DbService.Instance;
            }
            UpdateMatchResult packet = netMsg.ReadMessage <UpdateMatchResult>();

            if (packet != null)
            {
                uint connectionId = netMsg.conn.connectionId;
                var  server       = queueManager.GetServerByConnectionId(connectionId);
                if (server != null)
                {
                    AccountOBJ user = DbManager.GetOnlineByUserId(packet.UserId);
                    if (user == null)
                    {
                        user = dbService.GetAccountFromDB(packet.UserId);
                    }
                    if (user != null)
                    {
                        lock (user)
                        {
                            foreach (DBPlayerActive active in packet.Actives)
                            {
                                ActivesOBJ obj = user.GetActive((int)active.ActiveId);
                                obj.Value = (int)active.Value;
                                DbService.UpdateEntityIntime(obj);
                            }
                            user.Data.Exp += (int)packet.EXP;

                            RankinngOBJ RankData = RankingManager.GetPlayer(user);
                            if (RankData != null)
                            {
                                RankData.GameCount += 1;
                                RankData.Kills     += (int)packet.KillCount;

                                if (!packet.HasWon)
                                {
                                    RankData.Deaths += 1;
                                }
                            }
                            user.OnGameResultRecieved();
                            DbService.UpdateEntityIntime(user);
                        }
                        LOG.Info(string.Format("SaveResult  ::  Server[{0}] userid[{1}]", connectionId, packet.UserId));
                    }
                    else
                    {
                        LOG.Info(string.Format("SaveResult Error unknown user ::  Server[{0}] userid[{1}]", connectionId, packet.UserId));
                    }
                    netMsg.conn.Send(GameServerOP.PUTROLE, new Empty());
                }
            }
            return(true);
        }
Example #8
0
 protected override void TearDown()
 {
     GameServerManager.TearDown();
 }
Example #9
0
 protected override void Setup()
 {
     SetupServerManager();
     GameServerManager.Setup();
     PeerManager peerManager = PeerManager.Instance;
 }
Example #10
0
        public bool Execute(JHSNetworkMessage netMsg)
        {
            if (DbManager == null)
            {
                DbManager = AccountManager.Instance;
            }
            if (queueManager == null)
            {
                queueManager = GameServerManager.Instance;
            }
            if (dbService == null)
            {
                dbService = DbService.Instance;
            }

            ReqeuestUser packet = netMsg.ReadMessage <ReqeuestUser>();

            if (packet != null)
            {
                uint connectionId = netMsg.conn.connectionId;
                var  server       = queueManager.GetServerByConnectionId(connectionId);
                if (server != null || Settings.DEBUG_GET_PLAYER)
                {
                    AccountOBJ user = DbManager.GetOnlineByUserId(packet.userId);
                    if (Settings.DEBUG_GET_PLAYER && user == null)
                    {
                        user = dbService.GetAccountFromDB(packet.userId);
                        user.SelectedCharacer = user.FirstRole().PlayerId;
                    }
                    if (user != null)
                    {
                        if (user.SelectedCharacer != 0)
                        {
                            DBPlayer role = user.GetRole(user.SelectedCharacer);
                            if (role != null)
                            {
                                if (packet.Type == InfoType.NONE)
                                {
                                    netMsg.conn.Send(GameServerOP.GETROLE, new LoginDataBasePlayer()
                                    {
                                        STATUS = SUCCESS,
                                        player = role,
                                        REQ    = packet.Req
                                    });
                                }
                                else
                                {
                                    netMsg.conn.Send(GameServerOP.GET_ROLE2, new UpdateRole()
                                    {
                                        STATUS = SUCCESS,
                                        player = role,
                                        TYPE   = packet.Type
                                    });
                                }
                                LOG.Info(string.Format("GETRole :: REQ[{3}] id[{0}] userid[{1}] serverid[{2}]", role.Base.PlayerId, role.Base.UserId, connectionId, packet.Req));
                                return(true);
                            }
                        }
                    }

                    netMsg.conn.Send(GameServerOP.GETROLE, new LoginDataBasePlayer()
                    {
                        STATUS = PLAYER_NOT_FOUND
                    });
                }
            }
            return(true);
        }
Example #11
0
 void Awake()
 {
     _instance = this;
     _mahjong  = new MahjongMain();
 }