Exemplo n.º 1
0
    protected override IEnumerator SetUp()
    {
        yield return(base.SetUp());

        UserProfileController.i.ClearProfilesCatalog();

        var ownProfile = UserProfile.GetOwnUserProfile();

        ownProfileModel        = new UserProfileModel();
        ownProfileModel.userId = "my-user-id";
        ownProfileModel.name   = "NO_USER";
        ownProfile.UpdateData(ownProfileModel, false);

        testProfileModel        = new UserProfileModel();
        testProfileModel.userId = "my-user-id-2";
        testProfileModel.name   = "TEST_USER";
        UserProfileController.i.AddUserProfileToCatalog(testProfileModel);

        //NOTE(Brian): This profile is added by the LoadProfile message in the normal flow.
        //             Adding this here because its used by the chat flow in ChatMessageToChatEntry.
        UserProfileController.i.AddUserProfileToCatalog(ownProfileModel);

        controller     = new PrivateChatWindowHUDController();
        chatController = new ChatController_Mock();

        controller.Initialize(chatController);
        controller.Configure(testProfileModel.userId);
        controller.SetVisibility(true);

        this.view = controller.view;
        Assert.IsTrue(view != null, "World chat hud view is null?");
        Assert.IsTrue(controller != null, "World chat hud controller is null?");

        yield break;
    }
    public void Initialize(IChatController chatController)
    {
        view              = PrivateChatWindowHUDView.Create(this);
        view.OnPressBack -= View_OnPressBack;
        view.OnPressBack += View_OnPressBack;

        view.chatHudView.inputField.onSelect.RemoveListener(ChatHUDViewInputField_OnSelect);
        view.chatHudView.inputField.onSelect.AddListener(ChatHUDViewInputField_OnSelect);

        chatHudController = new ChatHUDController();
        chatHudController.Initialize(view.chatHudView);
        LoadLatestReadChatMessagesStatus();

        view.OnSendMessage += SendChatMessage;

        this.chatController = chatController;

        if (chatController != null)
        {
            chatController.OnAddMessage -= OnAddMessage;
            chatController.OnAddMessage += OnAddMessage;
        }

        SetVisibility(false);
    }
 private void InitializeChatWindowController(IChatController chatController)
 {
     controller = new PrivateChatWindowHUDController();
     controller.Initialize(chatController);
     controller.Configure(testProfileModel.userId);
     controller.SetVisibility(true);
     view = controller.view;
 }