示例#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 WorldChatWindowHUDController();
        chatController = new ChatController_Mock();
        mouseCatcher   = new MouseCatcher_Mock();

        controller.Initialize(chatController, mouseCatcher);
        this.view = controller.view;

        Assert.IsTrue(view != null, "World chat hud view is null?");
        Assert.IsTrue(controller != null, "World chat hud controller is null?");
    }
示例#2
0
    public void Initialize(IChatController chatController, IMouseCatcher mouseCatcher)
    {
        view            = WorldChatWindowHUDView.Create();
        view.controller = this;

        chatHudController = new ChatHUDController();
        chatHudController.Initialize(view.chatHudView);
        chatHudController.OnPressPrivateMessage -= ChatHUDController_OnPressPrivateMessage;
        chatHudController.OnPressPrivateMessage += ChatHUDController_OnPressPrivateMessage;
        LoadLatestReadWorldChatMessagesStatus();

        view.OnSendMessage += SendChatMessage;

        this.chatController = chatController;
        this.mouseCatcher   = mouseCatcher;

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

        if (mouseCatcher != null)
        {
            mouseCatcher.OnMouseLock += view.ActivatePreview;
        }
    }