Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Somewhere in your setup, do this:
- JSObject jsHud = awesomium.WebView.CreateGlobalJavascriptObject("hud");
- jsHud.Bind("OnMouseUp", false, OnMouseUp);
- jsHud.Bind("OnMouseDown", false, OnMouseDown);
- // and use the following JS: http://pastebin.com/sCRk259m
- // Then make some functions:
- protected void OnMouseDown(object sender, JavascriptMethodEventArgs e)
- {
- bool mouseUpOverHUD = e.Arguments[0];
- MouseButton mouseButton = (MouseButton)(int)e.Arguments[1];
- }
- /// <summary>
- /// Handle mouse up everywhere except the controls
- /// </summary>
- protected void OnMouseUp(object sender, JavascriptMethodEventArgs e)
- {
- bool mouseUpOverHUD = e.Arguments[0];
- MouseButton mouseButton = (MouseButton)(int)e.Arguments[1];
- bool clickHandled = mouseUpOverHUD;
- if (mouseButton == MouseButton.LEFT)
- {
- if (!clickHandled && creatingEntityID != null)
- {
- // Have we just tried to build this guy?
- if (/*mouse.LeftButton == EnhancedButtonState.JUST_RELEASED &&*/ IsValidToBuildHere())
- {
- // Yes, build this now!
- BuildStructure();
- clickHandled = true;
- }
- }
- }
- else if (mouseButton == MouseButton.RIGHT && creatingEntityID != null)
- {
- OnCancelCreation();
- }
- if(!clickHandled)
- {
- selectionSystem.OnMouseUp(sender, mouseButton, theMouse);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment