UI events

#1
Hi, ALLAH bless you.

I don't know what i should do to add a listener...

And how can i get event parameter?

This is header file:

Code: Select all

class CUIPlayerInterfaceEventListenerA { public: virtual void OnUIEventA(IUIElement* pSender, const SUIEventDesc& event, const SUIArguments& args) { CryStringLocal eventNameA = event.sDisplayName; if (eventNameA == "getQuickSelectData") { }; }; };
This is Player.cpp:

Code: Select all

..... CUIPlayerInterfaceEventListenerA eventListenerA; void CPlayer::PostInit( IGameObject * pGameObject ) { RegisterGOEvents( *this, *GetGameObject() ); CCCPOINT(PlayerState_PostInit); CActor::PostInit(pGameObject); //--- Update animationPlayerProxies & toggle the part visibility for separate character shadow casting UpdateThirdPersonState(); ResetAnimationState(); if (gEnv->pFlashUI)//////////////////////// { IUIElement *playerInterface = gEnv->pFlashUI->GetUIElement("Player_interface"); if (playerInterface) { playerInterface->AddEventListener(&eventListenerA, "Player_interface"); }; }; ............

Re: UI events

#2
I have already replied you in a private message, but I will also post the answer here, so everyone can get use of this.
VIDEO TUTORIAL ABOUT LISTENERS :
https://www.youtube.com/watch?v=nsnQFNUxS2c
HERE VIDEO TUTORIAL ABOUT INVENTORY SYSTEM PART 12 GO TO 6:05.
https://www.youtube.com/watch?v=hIHqY85vbnk
It explains how to get the event argument.

Finally I am also going to write it here:
UIEventListener.h file:

Code: Select all

#pragma once #include "FlashUI/FlashUI.h" class CUIEventListener: public IUIElementEventListener { private: virtual void OnUIEvent(IUIElement* pSender, const SUIEventDesc& event, const SUIArguments& args) override { string eventName = event.sDisplayName; if(eventName == "YourEvent") { //for example you want to pass string argument //fscommand in flash can only handle ONE argument (and First in programming means 0) //Declare your variable string, int or whatever you want string myString; //Get argument from this function's parameter //argument has index 0, because it is first argument. First and the only one, no matter what. args.GetArg(0, myString); //Now your "myString" variable has argument value written into it. } } };
Also man, subscribe my channel, and before you create a new topic, search through my videos. There is literally ALL informations about Flash UI in Cryengine C++.
I know you have seen my channel in the past, because I have sent you links. Also my videos are posted on this forum in Community Tutorials subforum.
Search.

Also check http://thedesignguis.com/community/tutorials/ all tutorials in one place. This can't get any easier to find nowadays.
Cryengine tutorial videos on my Youtube channel! Check it out !
https://www.youtube.com/user/MusicForLifePL20

Who is online

Users browsing this forum: No registered users and 1 guest