playMaker

Author Topic: Using Playmaker's GUI system.  (Read 5267 times)

Red

  • Hero Member
  • *****
  • Posts: 563
Using Playmaker's GUI system.
« on: June 20, 2012, 02:18:57 PM »
So, i'm still learning this bit and i think i've managed to cobble together something use-able... but i was wondering... when you're using script to control the GUI it seems able to tell it to align to the top, left, right, bottom, etc... but i can't seem to find any way to control that using PM's native action set.

is there something i'm overlooking?

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Using Playmaker's GUI system.
« Reply #1 on: June 21, 2012, 06:56:15 PM »
You'd have to share a bit more specific info I think.  Are you just using GUI text/textures?  You creating windows?  Using GUI Layout?

Red

  • Hero Member
  • *****
  • Posts: 563
Re: Using Playmaker's GUI system.
« Reply #2 on: June 21, 2012, 11:36:21 PM »
well, the two main things i'm hoping to achieve would be menus aligned to the left and right side of the screen, the main UI at the bottom and possibly a floating GUI element that would surround a target on the screen.

think a bit like how Diablo/Torchlight does it for the GUI.

so, skill tree on the right, character sheet on the left, health/mana and spell/weapon indicator at the bottom. and the floating GUI thing for say you've got a particular monster/enemy targeted, i want to make the health bar that it has aligned to it. i've thought of using something like a separate object or plane that's always aligned to the screen, but that seems a bit trickier to set up and control than having a floating GUI/reticle thing.

but mainly it's the allignment that i'm most interested in.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Using Playmaker's GUI system.
« Reply #3 on: June 22, 2012, 04:22:25 AM »
hi,

 The trick for you will be the following:

 playmaker actions for defining areas and layout can accept normalized rect, which means 1 is equal to the screen.width for example.

 so a rect of [0.5,0.5,1,1] will be the bottom right corner of the screen starting from the center of the screen to the bottom right.

 then, with this you can achieve what you want.

then you can also use the flexibleSpace gui element, that will help you push things apart of in one end of a particular layout.


To target on screen, you have a an action for this: BeginAreaFollowObject that will just do that.


 Experiment with these, if you need some help on using them, let me know. Hopefully this is what you are after.


Bye,

 Jean

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Using Playmaker's GUI system.
« Reply #4 on: July 25, 2012, 08:52:50 PM »
This cleared a lot of things up for me.

But I still don't see how to align things to the right or any other edge of the screen, all of the locational fields start from the top left. How do I align a static sized image to the normalized top right?
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D

artician

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 318
Re: Using Playmaker's GUI system.
« Reply #5 on: July 25, 2012, 09:02:37 PM »
I'd love it if someone told me a better way to do it, but I handle that situation by estimating the percentage of the screen that my image is for the upper-right corner, and when I create the GUILayout space for it I enter that into the 0-1 field for normalized size. 

Using rounded numbers for simplicities sake, say your screen is 1000 pixels wide, and you want to clamp a 200 pixel-wide texture to the right side.  When I create a GUILayout for that texture I tell it's normalized screen coordinates to be 0.8-1.0.  If you look at it as a percentage rather than a coordinate system or pixel measurement, it's basically 1/5th the screen, or .2%.

If I wanted to clamp it to the left, well that's easier, but to use it in this context you would just set the normalized layout coords to be 0.0-0.2.

That said, I'm pretty well situation with NGUI now, so I don't have these issues anymore. 


Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2511
  • Mender of the past
    • Cleverous
Re: Using Playmaker's GUI system.
« Reply #6 on: July 25, 2012, 09:26:41 PM »
Well the problem for me is I'm using images and i don't see any way to normalize them. If I choose not to normalize the gui then if the player changes the resolution the GUI will be in all the wrong places and in either case the GUI and Images are scaling sort of unpredictably.

I want to stick strictly with Unity and PlayMaker here because I intend to publish this as a community package that shows how you can do everything that gameplay basically requires and not require users to own any other asset packages or tools.
Products by Cleverous
|| Vault Core : Database
|| Vault Inventory : Multiplayer Inventory
|| Vault Attributes : Character Stats
|| That Hurt! : Dmg Floaties
|| Quinn : 3D