void Start()
	{
		// find the server so that we can interact with it
		_server = Utility.FindComponent<Server>(Server.NAME);
		_server.ConnectionLostEvent += OnConnectionLost;
		_server.ExtensionEvent += OnResponse;

		_chat = Utility.FindComponent<ChatController>(ChatController.NAME);
	
		_cam = Camera.main.GetComponent<CamFollow>();

		LoadMap();

		// pull player image from prefs and randomly place them on the top of the map
		int type = PlayerPrefs.GetInt(Constants.PLAYER_TYPE, 0);;
		int x = Random.Range(5, 20);
		int y = Random.Range(0, -10);

		_player = CreateCharacter(type, new Vector2(x, y));

		_cam.Target = _player.gameObject;

		_otherPlayers = new Dictionary<string, Player>();

		// let the server (and other players) this player has just joined the game
		PsObject psobj = new PsObject();
		psobj.SetInt(ServerConstants.PLAYER_TYPE, type);
		psobj.SetIntArray(ServerConstants.PLAYER_POSITION, new List<int>() { x, y });

		_server.SendRequest(new ExtensionRequest(PlayerCommand.GetCommand(PlayerCommand.PlayerEnum.Start), psobj));

		_running = true;
	}
Example #2
0
        public void GetById()
        {
            // Arrange
            ChatController controller = new ChatController();

            // Act
            // string result = controller.Get(5);

            // Assert
            //   Assert.AreEqual("value", result);
        }
Example #3
0
        private async void UpdatePosts(DateTime time)
        {
            this.lastUpdatDateTime = time.AddMinutes(-30);
            var getPostsSince = await ChatController.GetPostsSince(this.lastUpdatDateTime);

            foreach (var post in getPostsSince.Where(post => !this.posts.Contains(post)))
            {
                this.posts.Add(post);
            }

            this.ScrollListViewToBottom();
        }
Example #4
0
 private void ChatNotFound(string message)
 {
     LoggingService.GetInstance().LogNote("Chat Not Found!!!");
     if (ChatController.EnableKeepOpenOnDisconnectAndStartNew())
     {
         Clients.Caller.restartChat(message);
     }
     else
     {
         Clients.Caller.addNewSystemMessageToPage(ChatController.GetConnectionLostText());
     }
 }
Example #5
0
    /*private int LineEnd;
     * private List <string> optionsList = new List<string>();
     * private List <string[]> optionsAnswers = new List<string[]>();
     */

    // Use this for initialization
    void Start()
    {
        chatt = FindObjectOfType <ChatController>();

        DataPool.initpool();

        datas = DataPool.m_sheet.dataArray;

        //LineStr = 0;

        //ChamaCoisa(Line);
    }
Example #6
0
        public static bool Prefix(ChatController __instance)
        {
            if (!__instance.TextArea.text.StartsWith("/"))
            {
                return(true);
            }

            CommandsController.Run(new ChatCallback(__instance),
                                   __instance.TextArea.text);
            __instance.TextArea.Clear();
            return(false);
        }
 void Start()
 {
     lm        = LiteralManager.getInstance();
     onTrigger = false;
     active    = false;
     foreach (Activable act in acts)
     {
         act.deactivate();
     }
     puc = GameObject.FindObjectOfType <PopUpController> ();
     cc  = GameObject.FindObjectOfType <ChatController> ();
 }
Example #8
0
        static void Main(string[] args)
        {
            ChatController ch = new ChatController(new SocketHandler());

            string type          = "xml";
            string messageToSend = "Hehu";
            string sender        = "172.16.2.51";
            string senderNick    = "Lingon";
            string receiver      = "172.16.2.51";
            string receiverNick  = "Lingon2";
            string serverIp      = "172.16.2.30";
            int    port          = 0;

            Console.WriteLine("Connecting to server...");

            switch (type)
            {
            case "plain":
            {
                port = 50001;
                break;
            }

            case "xml":
            {
                port = 50002;
                break;
            }

            case "symmetry":
            {
                port = 50003;
                break;
            }
            }
            ch.Connect(serverIp, port);

            Console.WriteLine("Connected!");

            while (messageToSend != "exit")
            {
                Console.WriteLine(ch.Update(type));
                Console.Write("\n\nWrite your message: ");
                messageToSend = Console.ReadLine();
                if (messageToSend != "")
                {
                    ch.PrepareToSend(messageToSend, sender, senderNick, receiver, receiverNick, type);
                }
            }

            Console.ReadKey();
        }
        public async Task PublishingMessageCompleted()
        {
            _mockNatIntegration.Setup(x => x.PublishMessage(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            var inMemoryStorage = new InMemoryStorage();
            var controller      = new ChatController(inMemoryStorage, _mockNatIntegration.Object);
            var chatMessage     = new ChatMessage {
                From = "User1", Message = "hihihi", To = "User1"
            };
            var sut = await controller.SendMessageToUser(chatMessage);

            Assert.IsType <Microsoft.AspNetCore.Mvc.OkResult>(sut);
        }
        public async Task ChatMessageObjectInIncorrect()
        {
            _mockNatIntegration.Setup(x => x.PublishMessage(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>())).Returns(true);

            var inMemoryStorage = new InMemoryStorage();
            var controller      = new ChatController(inMemoryStorage, _mockNatIntegration.Object);
            var chatMessage     = new ChatMessage {
                From = "User1", Message = "hihihi"
            };
            var sut = await controller.SendMessageToUser(chatMessage);

            Assert.IsType <BadRequestObjectResult>(sut);
        }
Example #11
0
 private void Btn_Supprimer(object sender, RoutedEventArgs e)
 {
     if (Lv_chat.SelectedItem != null)
     {
         ChatController a = new ChatController();
         a.SupprChat(Lv_chat.SelectedItem as ChatRoom);
     }
     else
     {
         Erreur er = new Erreur("Veuillez selectionner une ChatRoom pour pouvoir le supprimer");
         er.Show();
     }
 }
Example #12
0
        static void Main(string[] args)
        {
            var proxy           = new DuplexServiceProxy <ICommunicationService, ICommunicationServiceCallback>(new CommunicationServiceCallback(), "netTcpBinding_ICommunicationService");
            var loginController = new LoginController(proxy);
            var chatController  = new ChatController(proxy);

            loginController.Register();

            chatController.StartChat();
            chatController.OpenChatWindow();

            Console.ReadKey();
        }
Example #13
0
            public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] PlayerControl sourcePlayer)
            {
                if (__instance != DestroyableSingleton <HudManager> .Instance.Chat)
                {
                    return(true);
                }
                PlayerControl localPlayer = PlayerControl.LocalPlayer;

                return(localPlayer == null ||
                       (MeetingHud.Instance != null || LobbyBehaviour.Instance != null ||
                        localPlayer.isDead() || localPlayer.PlayerId == sourcePlayer.PlayerId ||
                        (Lovers.enableChat && localPlayer.getPartner() == sourcePlayer)));
            }
Example #14
0
        public void LoginCharacter(AccountController accountController)
        {
            AccountController = accountController;
            accountController.CharacterController = this;

            ChatController.LoginMessages(this);
            SpawnManager.SpawnCharacter(this);

            API.shared.triggerClientEvent(accountController.Client, "stopAudio");
            accountController.Client.freeze(false);
            accountController.Client.transparency = 255;
            accountController.Client.nametag      = FormatName + " (" + accountController.PlayerId + ")";
            API.shared.triggerClientEvent(accountController.Client, "update_money_display", Character.Cash);
        }
Example #15
0
    private void Start()
    {
        if (GetComponent <NetworkIdentity>().isLocalPlayer)
        {
            Debug.Log("Player score Start");
            myChat = GameObject.FindGameObjectWithTag("ChatController").GetComponent <ChatController>();
            CmdSetPlayerName(myChat.localPlayerName);
        }

        gameController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameController>();

        scoreBoard = GameObject.FindGameObjectWithTag("ScoreBoard").GetComponent <ScoreBoardController>();
        scoreBoard.AddNewPlayer(this);
    }
Example #16
0
        private void Btn_ajouter_Click(object sender, RoutedEventArgs e)
        {
            ChatController a = new ChatController();

            if (Action == "add")
            {
                a.InsertChat(txt_Nom.Text);
            }
            else
            {
                a.ModifyChat(Id, txt_Nom.Text);
            }
            Close();
        }
Example #17
0
        public void IndexActionOfChatControllerHasNoModel()
        {
            // Arrange
            var dbContext   = host.Services.GetService <AppDbContext>();
            var userManager = host.Services.GetService <UserManager <AppUser> >();
            var roleManager = host.Services.GetService <RoleManager <IdentityRole> >();
            var controller  = new ChatController(dbContext, userManager, roleManager);

            // Act
            var isNull = (controller.Index() as ViewResult).ViewData?.Model ?? null;

            // Assert
            Assert.Null(isNull);
        }
Example #18
0
        public void Get()
        {
            // Arrange
            ChatController controller = new ChatController();

            // Act
            IEnumerable <string> result = controller.Get();

            // Assert
            Assert.IsNotNull(result);
            Assert.AreEqual(2, result.Count());
            Assert.AreEqual("value1", result.ElementAt(0));
            Assert.AreEqual("value2", result.ElementAt(1));
        }
Example #19
0
        public ChatHandler(Game.Server.ControllerManager controllerManager)
        {
            mainLog = NLog.LogManager.GetCurrentClassLogger();

            try
            {
                mainLog.Info("IRSE: Loading ChatManager...");
                m_chatController = controllerManager.Chat;
            }
            catch (Exception ex)
            {
                mainLog.Error(ex.ToString());
            }
        }
Example #20
0
    public void Init(Game game)
    {
        Game = game;

        CanvasController = transform.GetChild(0).GetComponent <CanvasController>();
        CanvasController.Init(this);

        PhpController = GetComponent <PhpController>();
        PhpController.Init(GameSparksController.Instance().PhpOffline);

        LoginController = GetComponent <LoginController>();

        ChatController = GetComponent <ChatController>();
    }
Example #21
0
        public async Task DeleteShouldReturnProperRedirect()
        {
            // Arrange
            var mockMessagesService = new Mock <IMessagesService>();
            var controller          = new ChatController(mockMessagesService.Object);

            // Act
            var result = await controller.Delete(0);

            // Assert
            var redirectToActionResult = Assert.IsType <RedirectToActionResult>(result);

            Assert.Equal("Index", redirectToActionResult.ActionName);
        }
        public async Task ListContainsTwoMessages()
        {
            var inMemorStorage = new InMemoryStorage();

            inMemorStorage.AddMessage("foo", "hihihiha");
            inMemorStorage.AddMessage("foo", "hahahaha");
            var controller = new ChatController(inMemorStorage, _mockNatIntegration.Object);

            var sut = await controller.GetReceivedMessagesForUser("foo") as OkObjectResult;

            var a = sut.Value as List <string>;

            Assert.Equal(2, a.Count);
        }
Example #23
0
            public static bool Prefix(ChatController __instance, [HarmonyArgument(0)] PlayerControl sourcePlayer)
            {
                if (__instance != HudManager.Instance.Chat)
                {
                    return(true);
                }
                var localPlayer = PlayerControl.LocalPlayer;

                if (localPlayer == null)
                {
                    return(true);
                }
                return(MeetingHud.Instance != null || LobbyBehaviour.Instance != null || localPlayer.Data.IsDead ||
                       localPlayer.isLover() || sourcePlayer.PlayerId == PlayerControl.LocalPlayer.PlayerId);
            }
Example #24
0
        public static bool Prefix(ChatController __instance)
        {
            if (ShipStatus.Instance == null)
            {
                return(true);
            }
            if (!__instance.TextArea.text.Equals("-help"))
            {
                return(true);
            }

            __instance.AddChat(LocalPlayer, LocalRole.Description);
            __instance.TextArea.Clear();
            return(false);
        }
Example #25
0
        private ChatController GetController(IEnumerable <ChatMessages> data)
        {
            var mockContext = new Mock <FriendyContext>();
            var mockSet     = Helpers.GetMockDbSet(data.ToList());

            mockContext.Setup(c => c.Set <ChatMessages>()).Returns(mockSet.Object);
            var mockWrapper = new Mock <RepositoryWrapper>(mockContext.Object);
            var rep         = new ChatMessagesRepository(mockContext.Object);

            mockWrapper.Setup(c => c.ChatMessages).Returns(rep);
            var service    = new ChatService(mockWrapper.Object, _imageSaver);
            var controller = new ChatController(_dialogNotifier, service);

            return(controller);
        }
Example #26
0
 public void Speak()
 {
     if (SpeakWith != null)
     {
         ChatController ChatCon = SpeakWith.GetComponent <ChatController>();
         PauseAction = true;
         SpeakButton.SetActive(false);
         TextBox.SetActive(true);
         ChatMessageIndex = 0;
         // Set name.
         TextBox.transform.FindChild("NamePanel/Name").GetComponent <Text>().text = ChatCon.Messages[ChatCon.Message][0];
         // Show the first message.
         ChatNext();
     }
 }
Example #27
0
        public void Disconnect()
        {
            // Arrange
            ChatController      chatController = new ChatController();
            WebSocketCollection chatUser       = new WebSocketCollection();
            ChatService         chatHandler    = new ChatService("amay");

            chatUser.Add(chatHandler);

            // Action
            chatHandler.OnClose();

            // Result
            Assert.True(chatHandler.GetDisconnectStatus());
        }
Example #28
0
        public void Setup()
        {
            var connStr        = @"Data Source=webchatserver.database.windows.net;Initial Catalog=WebChatDB;User ID=shianyasnuy;Password=18Q02q2001;Connect Timeout=30;Encrypt=True;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False";
            var optionsBuilder = new DbContextOptionsBuilder <MessengerContext>();

            optionsBuilder.UseSqlServer(connStr);
            chatController = new ChatController(new MessengerContext(optionsBuilder.Options));

            SessionInfo.CurrUser = new User
            {
                Id       = 1,
                NickName = "Shian",
                Password = "******"
            };
        }
Example #29
0
        public void IndexReturnsAViewResultWithAListOfUsers()
        {
            var mock = new Mock <IRepository>();

            mock.Setup(repo => repo.GetAllMessages()).Returns(GetTestMessages());
            var controller = new ChatController(mock.Object);

            var result = controller.Index();

            var viewResult = Assert.IsType <ViewResult>(result);
            var model      = Assert.IsAssignableFrom <IEnumerable <Message> >(viewResult.Model);

            Assert.Equal(GetTestMessages().Count, model.Count());
            Assert.IsType <List <Message> >(viewResult.Model);
        }
Example #30
0
        private int Setup()
        {
            // Arrange
            ChatController controller = new ChatController();

            controller.Request       = new HttpRequestMessage();
            controller.Configuration = new HttpConfiguration();

            var     response   = controller.AddChat("tester", "This is an unit test", 2000);
            var     jsonString = response.Content.ReadAsStringAsync();
            JObject json       = JObject.Parse(jsonString.Result);

            response.Dispose();
            return((int)json["id"]);
        }
Example #31
0
        public void Send(string name, string message, int userID)
        {
            ChatController chatty = new ChatController();

            // Call the addNewMessageToPage method to update clients.
            if (ChatController.userrole == -1)
            {
                Clients.All.addNewMessageToPage("SYSTEM", "There is currently no CSR on duty. Please try again later.");
            }
            else
            {
                chatty.SyncToDatabase(message);
                Clients.All.addNewMessageToPage(name, message);
            }
        }
 private void StartServer()
 {
     _controller = ServiceLocator.Retrieve<ChatController>();
     _controller.Start();
 }
	void Update() {
		if (infoTextFader == null) {
			infoTextFader = GameObject.FindWithTag ("GUIBigLabel").GetComponent<GUIBigLabelFader>();
		}

		if (chat == null) {
			GameObject chatObject = GameObject.FindWithTag("Chat");
			if(chatObject != null) {
				chat = chatObject.GetComponent<ChatController>();
			}
		}

		if (!connected && connectionMaintainer.connected) {
			AudioSource.PlayClipAtPoint(connectionEstabilishedSound, Camera.main.transform.position);
			infoTextFader.Show("Connected");
			if(chat != null) chat.AddMessage("Connected to alternativ-mud on "+hostname+":"+port);

			if(!authDataCorrect) {
				guiLoginPanelScript.enabled = true;
			}
		}
		if (!connectionFailed && connectionMaintainer.connectionFailed) {
			AudioSource.PlayClipAtPoint(connectionFailedSound, Camera.main.transform.position);
			infoTextFader.Show("Connection failed");
			if(chat != null) chat.AddMessage("Connection to alternativ-mud failed on "+hostname+":"+port);
		}
		connected = connectionMaintainer.connected;
		connectionFailed = connectionMaintainer.connectionFailed;
	}
Example #34
0
 void Start()
 {
     if (chat == null) {
         GameObject chatObject = GameObject.FindWithTag("Chat");
         if(chatObject != null) {
             chat = chatObject.GetComponent<ChatController>();
         }
     }
 }