Beispiel #1
0
        // Called by the C++ code when a message has been received or a status has changed.
        public void OnMessageReceived(Dota_ChatMessage data)
        {
            switch (data.Type)
            {
            // Hide status has been changed, report to DLL.
            case -2:
            case -1:
                InjectionHelper.SendHideShowMessage(data.Type == -1);

                break;

            // A message has been received, display in main window and send to DLL.
            case 0:
            case 1:
            case 2:
                // Scope is determined by the type value: 0 = All, 1 = Team.
                String scope = (data.Type == 0) ? "ALL" : ((data.Type == 1) ? "TEAM" : "TV");

                // Make sure the data is read as UTF8.
                String sender  = ToUTF(data.Sender);
                String message = ToUTF(data.Message);

                // Translate the message and add it.
                new Thread(new ParameterizedThreadStart(TranslateMessageAndAdd)).Start(new object[] { scope, sender, message });

                break;
            }
        }
Beispiel #2
0
 // Sends the relevant settings to the overlay.
 public void SendChangesToOverlay()
 {
     InjectionHelper.SendSetting("FontName", this.FontName);
     InjectionHelper.SendSetting("MessagesShown", this.MessagesShown);
     InjectionHelper.SendSetting("AutoHide", this.AutoHide);
     InjectionHelper.SendSetting("FadeMessages", this.FadeMessages);
     InjectionHelper.SendSetting("FadeWait", this.FadeWait);
     InjectionHelper.SendSetting("FadeDuration", this.FadeDuration);
     InjectionHelper.SendSetting("AutoMessageHeight", this.AutoMessageHeight);
     InjectionHelper.SendSetting("MessageHeight", this.MessageHeight);
 }
Beispiel #3
0
        // Injects the overlay.
        public void StartOverlay()
        {
            // Register debug message handler.
            DotaDXInject.MessageManager.OnDebugMessage += OnDebugMessage;

            // Setup the helper.
            InjectionHelper.Setup();

            // Attach the overlay to the dota process.
            Boolean success = InjectionHelper.AttachToProcess(hWnd);

            // Set the state of the inject button to disabled if the injection succeeded.
            SetInjectOverlayButtonState_Invoke(!success);
        }
Beispiel #4
0
        // Translates the message and (optionally) appends it to the overlay.
        private void TranslateMessageAndAdd(object arg)
        {
            // Read the arguments.
            object[] args    = (object[])arg;
            String   scope   = (String)args[0];
            String   sender  = (String)args[1];
            String   message = (String)args[2];

            // Translate the message.
            String translatedMessage = Translate.TranslateString(message);

            // Don't output the message if we don't want to.
            if (!Settings.OutputAll && translatedMessage.Equals(message))
            {
                return;
            }

            // Add the message to the window.
            AddChatItem_Invoke(scope, sender, translatedMessage);

            // Add the message to the overlay.
            InjectionHelper.SendMessage(sender, translatedMessage);
        }