Ejemplo n.º 1
0
        private static void Main(string[] args)
        {
            var            encryptString = "_encrypted_";
            string         datePatern    = "dd_MM_H_mm_ss";
            Client         c;
            TextTestClient client = new TextTestClient();

            _displayResults = new DisplayResults();
            var logFilePath = "TestRun_NoSessions" + encryptString + DateTime.Now.ToString(datePatern) + ".txt";

            //Globals_Game.pcMasterList.Add("rory", new PlayerCharacter());
            using (Globals_Server.LogFile = new System.IO.StreamWriter(logFilePath))
            {
                _wordRecogniser = new WordRecogniser();
                _testClient     = new TextTestClient();
                Console.Clear();
                LogInPrompt();
                while (_testClient.IsConnectedAndLoggedIn() == false)
                {
                    Thread.Sleep(0);
                }
                var command = TokenizeConsoleEntry();
                ProcessCommand(_wordRecogniser.CheckWord(command[0]), command);
                ProcessCommand(WordRecogniser.Tasks.Check, command);
                while (_wordRecogniser.CheckWord(command[0]) != WordRecogniser.Tasks.Exit)
                {
                    command = TokenizeConsoleEntry();
                    ProcessCommand(_wordRecogniser.CheckWord(command[0]), command);
                    Globals_Server.LogFile.WriteLine(command[0]); // to log all the tasks attempted by the user before exit or server/client crash
                }
                Shutdown();
            }
        }
Ejemplo n.º 2
0
    protected void LoginButton()
    {
        m_MyText.text += "1";
        string username = inputUsername.text;
        string password = inputPassword.text;

        tclient.LogInAndConnect("helen", "potato", "localhost");

        while (!tclient.IsConnectedAndLoggedIn())
        {
            Thread.Sleep(0);
        }

        buttonText.text = "loading";
        if (tclient.IsConnectedAndLoggedIn())
        {
            mf = FiefDetails(tclient);

            SceneManager.LoadScene(1);
            // FiefControl f = new FiefControl(tclient);
        }
    }
Ejemplo n.º 3
0
    public static void LoggedIn(string Username, string Password, object obj, EventArgs args)
    {
        client = new TextTestClient();
        client.LogInAndConnect(Username, Password);
        while (client.IsConnectedAndLoggedIn() == false)
        {
            Thread.Sleep(0);
        }
        playerOps = new PlayerOperations();
        myWin     = new Window("HistMMorpg Client");
        //Create a label and put some text in it.
        tableLayout = new Table(5, 5, false);
        northEast   = new Button("North East");
        northWest   = new Button("North West");
        east        = new Button("East");
        west        = new Button("West");
        southEast   = new Button("South East");
        southWest   = new Button("South West");
        siege       = new Button("Siege");
        hire        = new Button("Hire");
        SetUpDirectionalButtonClicks();
        SetUpOperationButtonClicks();
        //Add the label to the form
        tableLayout.Attach(northEast, 0, 1, 0, 1);
        tableLayout.Attach(northWest, 1, 2, 0, 1);
        tableLayout.Attach(east, 0, 1, 1, 2);
        tableLayout.Attach(west, 1, 2, 1, 2);
        tableLayout.Attach(siege, 2, 3, 1, 2);
        tableLayout.Attach(southEast, 0, 1, 2, 3);
        tableLayout.Attach(southWest, 1, 2, 2, 3);
        tableLayout.Attach(hire, 2, 3, 0, 1);
        myWin.Add(tableLayout);

        /*ProtoPlayerCharacter player = playerOps.Profile (client);
         * profileTable = new ProfileTable (player.playerID, player.firstName + " " + player.familyName, player.ownedFiefs, player.location, player.armyID, Convert.ToString( player.purse));
         * tableLayout.Attach (profileTable.getProfileLayout (), 3, 4, 1, 2);
         * ProtoFief fiefData = playerOps.FiefDetails (client);
         * fiefTable = new FiefTable (fiefData.fiefID, fiefData.owner, Convert.ToString (fiefData.industry),
         *      fiefData.charactersInFief, fiefData.armies);
         * tableLayout.Attach (fiefTable.getProfileTable (), 3, 4, 2, 3);*/
        //ProfileClickEvent (null, null);
        //FiefClickEvent (null, null);
        //Show Everything
        FiefClickEvent(obj, args);
        ProfileClickEvent(obj, args);
        myWin.ShowAll();
    }
Ejemplo n.º 4
0
    public static bool Login(string username, string password, out string reason)
    {
        reason = null;
        //tclient.LogInAndConnect(username, password, "localhost");
        tclient.LogInAndConnect(username, password, "92.239.228.86");

        //bool loggedIn = false;
        //while(!loggedIn){
        //    ProtoMessage reply = GetActionReply(Actions.LogIn, tclient);
        //    if(reply.ResponseType == DisplayMessages.LogInFail) {
        //        return false;
        //    }
        //    else if(reply.ResponseType == DisplayMessages.None){

        //    }
        //    else if(reply.ResponseType == DisplayMessages.LogInSuccess) {
        //        loggedIn = true;
        //    }
        //}

        Debug.Log("made it out of LogInAndConnect");

        int          i     = 1;
        ProtoMessage reply = null;

        while (!tclient.IsConnectedAndLoggedIn())
        {
            reply = GetActionReply(Actions.LogIn, tclient);
            if (reply == null)
            {
                reason = "Log in request timed out.";
                return(false);
            }
            if (reply.ResponseType == DisplayMessages.LogInFail)
            {
                reason = "Wrong username or password.";
                return(false);
            }
            if (reply.ResponseType == DisplayMessages.LogInSuccess)
            {
                break;
            }

            Debug.Log("I'm still waiting: " + i.ToString());
            i++;
        }

        protoClient = (ProtoClient)reply;
        return(true);


        //while (!tclient.IsConnectedAndLoggedIn())
        //{
        //    Thread.Sleep(0);
        //}

        //if (tclient.IsConnectedAndLoggedIn())
        //{
        //   // mf = GetFiefDetails(tclient);

        //    GoToScene("MainMenu");

        //    //SceneManager.LoadScene("MainMenu");
        //    // FiefControl f = new FiefControl(tclient);
        //}
    }