HelpCommand() public méthode

public HelpCommand ( CasualCommon pos ) : string
pos CasualCommon
Résultat string
Exemple #1
0
        static void Main(string[] args)
        {
            CClient Client = new CClient();

            Client.m_Core.Connect(CasualCommon.Join.ipaddr, CasualCommon.Join.portnum, CasualCommon.Join.protocol_ver);
            Console.WriteLine("Connect to server ({0}:{1}) ...", CasualCommon.Join.ipaddr, CasualCommon.Join.portnum);


            // 최초 서버 접속과 입장완료까지 확인하고 넘어가는 부분
            bool connect_fail = false;

            Client.m_Core.server_connect_result_handler = (bool isConnectSuccess) =>
            {
                if (isConnectSuccess == false)
                {
                    connect_fail = true;
                }
            };
            while (true)
            {
                Client.m_Core.NetLoop();
                System.Threading.Thread.Sleep(10);

                if (Client.m_Core.IsJoined())
                {
                    break;
                }
                if (connect_fail)
                {
                    Console.WriteLine("Connect FAIL");
                    System.Threading.Thread.Sleep(3000);
                    return;
                }
            }


            CasualCommon.Common.DisplayHelpCommand();
            Console.WriteLine("current({0})", Client.server_now);

            var  ret         = CasualCommon.Common.ReadLineAsync();
            bool run_program = true;

            while (run_program)
            {
                if (ret.IsCompleted)
                {
                    switch (ret.Result)
                    {
                    case "/q":
                        Client.m_Core.Leave();
                        break;

                    case "/exit":
                        run_program = false;
                        break;

                    case "/h":
                        CasualCommon.Common.DisplayHelpCommand();
                        break;

                    case "/refresh":
                        if (Client.server_now == CasualCommon.Server.Login)
                        {
                            Client.proxy.request_lobby_list(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic);
                        }
                        break;

                    case "/lobby":
                        if (Client.server_now == CasualCommon.Server.Login)
                        {
                            // 일단 간단한 처리를 위해 첫번째 로비서버를 골라서 들어가도록 처리
                            Client.server_tag = CasualCommon.Server.Lobby;
                            foreach (KeyValuePair <ZNet.RemoteID, ZNet.MasterInfo> obj in Client.lobbys)
                            {
                                Client.proxy.request_go_lobby(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, obj.Value.m_Description);
                                break;
                            }
                        }
                        else if (Client.server_now == CasualCommon.Server.Room)
                        {
                            // 현재 룸서버인경우 원래의 로비로 나가기만 가능
                            Client.server_tag = CasualCommon.Server.Lobby;
                            Client.m_Core.MoveToServer((int)Client.server_tag);     // 일단 아무 로비로든 그냥 보내버린다
                        }
                        break;

                    case "/login":
                        if (Client.server_now == CasualCommon.Server.Lobby)
                        {
                            // 현재 로비서버인 경우 로그인서버로 이동 요청
                            Client.server_tag = CasualCommon.Server.Login;
                            Client.m_Core.MoveToServer((int)Client.server_tag);
                        }
                        break;

                    case "/join":
                        if (Client.server_now == CasualCommon.Server.Lobby)
                        {
                            Client.server_tag = CasualCommon.Server.Room;
                            Client.proxy.request_join_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, new Guid());
                        }
                        break;

                    case "/make":
                        if (Client.server_now == CasualCommon.Server.Lobby)
                        {
                            Client.server_tag = CasualCommon.Server.Room;
                            Client.proxy.request_make_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, "방이름AZ");
                        }
                        break;

                    case "/out":
                        if (Client.server_now == CasualCommon.Server.Room)
                        {
                            Client.server_tag = CasualCommon.Server.Lobby;
                            Client.proxy.request_out_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic);
                        }
                        break;

                    default:
                        Client.proxy.Chat(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, ret.Result);
                        Console.WriteLine("({0}) {1}", Client.server_now, Client.HelpCommand(Client.server_now));
                        break;
                    }

                    if (run_program)
                    {
                        ret = CasualCommon.Common.ReadLineAsync();
                    }
                }

                Client.m_Core.NetLoop();
                System.Threading.Thread.Sleep(1);
            }

            Client.m_Core.Destroy();
            System.Threading.Thread.Sleep(1000 * 2);
        }
Exemple #2
0
        static void Main(string[] args)
        {
            CClient Client = new CClient();

            Client.m_Core.Connect(CasualCommon.Join.ipaddr, CasualCommon.Join.portnum, CasualCommon.Join.protocol_ver);
            Console.WriteLine("Connect to server ({0}:{1}) ...", CasualCommon.Join.ipaddr, CasualCommon.Join.portnum);


            // 최초 서버 접속과 입장완료까지 확인하고 넘어가는 부분
            bool connect_fail = false;
            Client.m_Core.server_connect_result_handler = (bool isConnectSuccess) =>
            {
                if (isConnectSuccess == false)
                    connect_fail = true;
            };
            while (true)
            {
                Client.m_Core.NetLoop();
                System.Threading.Thread.Sleep(10);

                if (Client.m_Core.IsJoined()) break;
                if (connect_fail)
                {
                    Console.WriteLine("Connect FAIL");
                    System.Threading.Thread.Sleep(3000);
                    return;
                }
            }


            CasualCommon.Common.DisplayHelpCommand();
            Console.WriteLine("current({0})", Client.server_now);

            var ret = CasualCommon.Common.ReadLineAsync();
            bool run_program = true;
            while (run_program)
            {
                if (ret.IsCompleted)
                {
                    switch (ret.Result)
                    {
                        case "/q":
                            Client.m_Core.Leave();
                            break;

                        case "/exit":
                            run_program = false;
                            break;

                        case "/h":
                            CasualCommon.Common.DisplayHelpCommand();
                            break;

                        case "/refresh":
                            if (Client.server_now == CasualCommon.Server.Login)
                            {
                                Client.proxy.request_lobby_list(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic);
                            }
                            break;

                        case "/lobby":
                            if (Client.server_now == CasualCommon.Server.Login)
                            {
                                // 일단 간단한 처리를 위해 첫번째 로비서버를 골라서 들어가도록 처리
                                Client.server_tag = CasualCommon.Server.Lobby;
                                foreach (KeyValuePair<ZNet.RemoteID, ZNet.MasterInfo> obj in Client.lobbys)
                                {
                                    Client.proxy.request_go_lobby(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, obj.Value.m_Description);
                                    break;
                                }
                            }
                            else if (Client.server_now == CasualCommon.Server.Room)
                            {
                                // 현재 룸서버인경우 원래의 로비로 나가기만 가능
                                Client.server_tag = CasualCommon.Server.Lobby;
                                Client.m_Core.MoveToServer((int)Client.server_tag); // 일단 아무 로비로든 그냥 보내버린다
                            }
                            break;

                        case "/login":
                            if (Client.server_now == CasualCommon.Server.Lobby)
                            {
                                // 현재 로비서버인 경우 로그인서버로 이동 요청
                                Client.server_tag = CasualCommon.Server.Login;
                                Client.m_Core.MoveToServer((int)Client.server_tag);
                            }
                            break;

                        case "/join":
                            if (Client.server_now == CasualCommon.Server.Lobby)
                            {
                                Client.server_tag = CasualCommon.Server.Room;
                                Client.proxy.request_join_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, new Guid());
                            }
                            break;

                        case "/make":
                            if (Client.server_now == CasualCommon.Server.Lobby)
                            {
                                Client.server_tag = CasualCommon.Server.Room;
                                Client.proxy.request_make_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, "방이름AZ");
                            }
                            break;

                        case "/out":
                            if (Client.server_now == CasualCommon.Server.Room)
                            {
                                Client.server_tag = CasualCommon.Server.Lobby;
                                Client.proxy.request_out_room(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic);
                            }
                            break;

                        default:
                            Client.proxy.Chat(ZNet.RemoteID.Remote_Server, ZNet.CPackOption.Basic, ret.Result);
                            Console.WriteLine("({0}) {1}", Client.server_now, Client.HelpCommand(Client.server_now));
                            break;
                    }

                    if (run_program)
                        ret = CasualCommon.Common.ReadLineAsync();
                }

                Client.m_Core.NetLoop();
                System.Threading.Thread.Sleep(1);
            }

            Client.m_Core.Destroy();
            System.Threading.Thread.Sleep(1000 * 2);
        }