Read my official documentation and download the source at http://docs2x.smartfoxserver.com/ExamplesUnity/buddy-messenger
Dear Reader
Thank you for following my blog. This might be my last entry until I begin a new project. I have been working on the contents of this for a while. Previously, the only example that Unity had for Buddy Messenger used Flash. I've coordinated with Smart Fox to make one for Unity, and they have added it to their Unity examples. Although, it's been a lot of work, and I've been really busy lately. I made notes here as I worked on the example, so if you want to know how or why I made certain decisions, you can peruse this listing and the links below.
Stream of consciousness notes:
I've been working to make my layout match that of the flash example. There are quite a few things to worry about with the buddy list. One thing I didn't realize is that anytime you change a buddy variable, you have to send the request to smart fox. Another thing is that you don't change the variable in the buddy manager, you are only supposed to access that variable. The online state as a buddy is different from your online state as a user. There is a list of reserved variables that you can use to edit state, nickname, and online status. It's quite a unique set up that they have in Smart Fox Server's buddy list. I got pretty annoyed with it, but I think that in the long run this is the most efficient way to maintain the buddy lists of all the users in your zone. I'm assuming that these buddy variables persist throughout each room in the zone, but they don't leave the zone. So, you'll want to have all the rooms that these people will want their same buddy lists to be in the same zone. If you have a bunch of online card games, then you'll want each of these to be in the same zone, that way users can invite their friends to all of the games.
My combo box is pretty unique. I know that with a more elaborate GUI system you could probably avoid the complex way that I'm using to draw it in the correct location, but I wanted to stick with the original Unity GUI so as to not have to distribute a custom GUI when I try to submit this to Smart Fox as a Unity example. For the add, remove, and block buttons, I will make it so they work only when the user in that text field is a user in smart fox's user list. Otherwise, it would generate an error.
I've split the code into three different functions which are called from OnGUI. I'd say that the majority of my time with this project was actually making the GUI look good. The actual use of Smart Fox was mainly a hindrance in desiging the project because I wasn't absolutely sure what kind of things were necessary for the application to work. I'd suggest logging in as two different user names and adding the other user to your buddy list. That is what enabled me to test the functionality that I'd created. You can create your own personal variables for buddies, so that makes it a pretty unique system. The example on sfs is to see what song your friend is listening to. You can also set your mood. I've done quite a bit of refactoring, and I have more to do tomorrow before I consider the project good enough.
I'll do a combo box for the user list and disable the switch between users and buddies. That way the project will more closely resemble the outline that I'm working from.
You can check it out at Smart Fox Server soon because they will be using my project as an official Untiy example.
//Invitation
http://docs2x.smartfoxserver.com/AdvancedTopics/game-api#invApi
//Make sure you've read the official sfs documenation
http://docs2x.smartfoxserver.com/AdvancedTopics/buddy-list-api
//They have a buddy list example in the old documentation
http://smartfoxserver.com/docs/1x/index.htm?http://smartfoxserver.com/docs/1x/docPages/sfsPro/buddyList2.htm
//I want to talk about error messages
http://docs2x.smartfoxserver.com/AdvancedTopics/client-error-messages
//This dude helped
http://smartfoxserver.com/forums/viewtopic.php?f=20&t=11962&p=49005&hilit=buddy+list#p49005
//Flash tutorials for buddy manager
http://www.actionscripterrors.com/?p=1454
http://www.adobe.com/devnet/flex/articles/fcf_mxml_actionscript.html
//Budy List Events
http://docs2x.smartfoxserver.com/api-docs/javadoc/server/
http://docs2x.smartfoxserver.com/api-docs/asdoc/com/smartfoxserver/v2/core/SFSBuddyEvent.html
//Nice dropdown menu script wiki
http://www.unifycommunity.com/wiki/index.php?title=PopupList
//GUI Selection Grid
http://forum.unity3d.com/threads/117150-Gui-Selection-Grid
//Reposition the box
http://answers.unity3d.com/questions/127219/know-guilayout-current-screen-position.html
Dear Reader
Thank you for following my blog. This might be my last entry until I begin a new project. I have been working on the contents of this for a while. Previously, the only example that Unity had for Buddy Messenger used Flash. I've coordinated with Smart Fox to make one for Unity, and they have added it to their Unity examples. Although, it's been a lot of work, and I've been really busy lately. I made notes here as I worked on the example, so if you want to know how or why I made certain decisions, you can peruse this listing and the links below.
Stream of consciousness notes:
I've been working to make my layout match that of the flash example. There are quite a few things to worry about with the buddy list. One thing I didn't realize is that anytime you change a buddy variable, you have to send the request to smart fox. Another thing is that you don't change the variable in the buddy manager, you are only supposed to access that variable. The online state as a buddy is different from your online state as a user. There is a list of reserved variables that you can use to edit state, nickname, and online status. It's quite a unique set up that they have in Smart Fox Server's buddy list. I got pretty annoyed with it, but I think that in the long run this is the most efficient way to maintain the buddy lists of all the users in your zone. I'm assuming that these buddy variables persist throughout each room in the zone, but they don't leave the zone. So, you'll want to have all the rooms that these people will want their same buddy lists to be in the same zone. If you have a bunch of online card games, then you'll want each of these to be in the same zone, that way users can invite their friends to all of the games.
My combo box is pretty unique. I know that with a more elaborate GUI system you could probably avoid the complex way that I'm using to draw it in the correct location, but I wanted to stick with the original Unity GUI so as to not have to distribute a custom GUI when I try to submit this to Smart Fox as a Unity example. For the add, remove, and block buttons, I will make it so they work only when the user in that text field is a user in smart fox's user list. Otherwise, it would generate an error.
I've split the code into three different functions which are called from OnGUI. I'd say that the majority of my time with this project was actually making the GUI look good. The actual use of Smart Fox was mainly a hindrance in desiging the project because I wasn't absolutely sure what kind of things were necessary for the application to work. I'd suggest logging in as two different user names and adding the other user to your buddy list. That is what enabled me to test the functionality that I'd created. You can create your own personal variables for buddies, so that makes it a pretty unique system. The example on sfs is to see what song your friend is listening to. You can also set your mood. I've done quite a bit of refactoring, and I have more to do tomorrow before I consider the project good enough.
I'll do a combo box for the user list and disable the switch between users and buddies. That way the project will more closely resemble the outline that I'm working from.
You can check it out at Smart Fox Server soon because they will be using my project as an official Untiy example.
//Invitation
http://docs2x.smartfoxserver.com/AdvancedTopics/game-api#invApi
//Make sure you've read the official sfs documenation
http://docs2x.smartfoxserver.com/AdvancedTopics/buddy-list-api
//They have a buddy list example in the old documentation
http://smartfoxserver.com/docs/1x/index.htm?http://smartfoxserver.com/docs/1x/docPages/sfsPro/buddyList2.htm
//I want to talk about error messages
http://docs2x.smartfoxserver.com/AdvancedTopics/client-error-messages
//This dude helped
http://smartfoxserver.com/forums/viewtopic.php?f=20&t=11962&p=49005&hilit=buddy+list#p49005
//Flash tutorials for buddy manager
http://www.actionscripterrors.com/?p=1454
http://www.adobe.com/devnet/flex/articles/fcf_mxml_actionscript.html
//Budy List Events
http://docs2x.smartfoxserver.com/api-docs/javadoc/server/
http://docs2x.smartfoxserver.com/api-docs/asdoc/com/smartfoxserver/v2/core/SFSBuddyEvent.html
//Nice dropdown menu script wiki
http://www.unifycommunity.com/wiki/index.php?title=PopupList
//GUI Selection Grid
http://forum.unity3d.com/threads/117150-Gui-Selection-Grid
//Reposition the box
http://answers.unity3d.com/questions/127219/know-guilayout-current-screen-position.html
No comments:
Post a Comment