Jump to content

Help with adding toolbar to protractor


Recommended Posts

I hope that I can find help here, I don't know much about programming though I am trying to learn and I figured I would try to put the Toolbar functionality into the Protractor module. and I am positive I have borked things pretty bad. When I run debug it pops one error message about


class ProtractorButtton : MonoBehavior

regaurding the MonoBehavior...

I created a fork at https://github.com/mrwizerd/protractor

My first goal was to get toolbar in and working, then figure out how to remove the old toolbutton. Any help would be appreciated.

I am not sure if it will find other problems, but if I can figure out how to get it in then how to get the rest out... I am a total noob though so I don't know if I will be successful.

I hope this is not the wrong place, as I already have posted elsewhere and was redirected here. Thanks in advance for all the help!

Link to comment
Share on other sites

It is actualy easier than you think.

You need to reference the toolbar.dll to the project.

You can replace your button by

private IButton _Buttontoolbar;

And set it like that.

_Buttontoolbar = ToolbarManager.Instance.add("pluginname", "buttonname");
_Buttontoolbar.TexturePath = "image/url/from/gamedata";
_Buttontoolbar.ToolTip = "tooltip to display";
_Buttontoolbar.OnClick += (e) => actiontodo(_Buttontoolbar);

The github of toolbar have a few easy example.

From my browsing on the forum it seems that some people does not like being force to have the toolbar, so since you already have a standalone version working, I would keep it and have the toolbar as an option for user to choose.

Link to comment
Share on other sites

Ah, well I didn't know that was a possibility. I had hoped I could get the actual author of the mod to put it in, but he has not responded so, trying to take it on my self. I fear at this point I have more than completely borked the code... I think I may just have to spend a couple of weeks actually learning how to code in c# all together... I understand some of it, I have a descent background in basic, and html, and I have been able to do small things in php, mostly just edits, and I have SOME c+ experience but not much and ALL of it is years old, so I am basically getting on a whole separate animal and trying to reteach this old dog new tricks.

Link to comment
Share on other sites

From my browsing on the forum it seems that some people does not like being force to have the toolbar

And this is why you do not add a hard reference to toolbar.dll, but instead copy this file into your project. Everything else stays pretty much the same, but you also wrap it in an

if(ToolbarManager.ToolbarAvailable){ ... }

Link to comment
Share on other sites

And this is why you do not add a hard reference to toolbar.dll, but instead copy this file into your project. Everything else stays pretty much the same, but you also wrap it in an
if(ToolbarManager.ToolbarAvailable){ ... }

I'll keep that too :) good to know, thanks Faark!

Link to comment
Share on other sites

Shouldn't this be "MonoBehaviour?" (note the U)

Dear lord, I was so focused on the code, I didn't think to look for a missing keystroke, Thanks blizzy78 that fixed that issue... I will get this eventually. :)

Link to comment
Share on other sites

Ok, So I am starting over and attempting to set it up with the wrapper. I have downloaded and placed the wrapper, and renamed the namespace. Do I still need to get the other files, (i.e. toobarmanager, itoolbarmanager, ibutton, ivisibility, gamescenesvisibility) or are they all included in the wrap? Also, I assume that I just need to add the button code after the if statement? sorry... I am just trying to fully wrap my head around the inclusion of the wrapper. thanks again for the help

Link to comment
Share on other sites

You don't need the other source files; you aren't compiling toolbar itself into your code. You just need the toolbar dll and the wrapper. Then you check to see if the toolbar dll is present through the wrapper. If it is, proceed with building your button. If it isn't, then build the old style button instead.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...