Playmaker Forum
PlayMaker Feedback => Action Requests => Topic started by: jeanfabre on August 23, 2011, 04:03:32 AM
-
hi,
Following the request from http://hutonggames.com/playmakerforum/index.php?topic=545.0 (http://hutonggames.com/playmakerforum/index.php?topic=545.0)
Here is a simple action that can store isApplicationGenuineAvailable and isApplicationGenuine in bools as well as dispatching events.
Could someone check it work for android. I have a hard time figuring out why there is no specific android utils, I currently use iPhoneUtils. Maybe I miss the obvious, else...
The code can be found below and also attached to this post. Any mistake, please comment :)
// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.
//
// Author: Jean fabre
// http://www.fabrejean.net
//
using UnityEngine;
namespace HutongGames.PlayMaker.Actions
{
[ActionCategory("mobile")]
[Tooltip("Check if application is genuine and dispatch events. Can also store flags in variables")]
public class IsApplicationGenuine : FsmStateAction
{
[UIHint(UIHint.Variable)]
public FsmBool isApplicationGenuineAvailable;
[UIHint(UIHint.Variable)]
public FsmBool isApplicationGenuine;
public FsmEvent isGenuine;
public FsmEvent isNotGenuine;
public FsmEvent notVerified;
public override void Reset()
{
isApplicationGenuineAvailable = null;
isApplicationGenuine = null;
isGenuine = null;
isNotGenuine = null;
notVerified = null;
}
public override void OnEnter()
{
DoIsApplicationGenuineTest();
}
void DoIsApplicationGenuineTest()
{
isApplicationGenuineAvailable.Value = iPhoneUtils.isApplicationGenuineAvailable;
isApplicationGenuine.Value = iPhoneUtils.isApplicationGenuine;
if (iPhoneUtils.isApplicationGenuineAvailable ){
if (iPhoneUtils.isApplicationGenuine){
Fsm.Event(isGenuine);
}else{
Fsm.Event(isNotGenuine);
}
}else{
Fsm.Event(notVerified);
}
}
}
}
Bye,
Jean
-
Well most support for the android is for IOS.
So they still use iphone syntax.
But almost everything for IOS do work on android.
Its just bad that they still use iphone syntax instead of a mobile syntax.
About this.
Im not sure you understand it..
This syntax should be checked first isApplicationGenuineAvailable.
If that is true then it should check isApplicationGenuine.
If you only check isApplicationGenuine then you can get an error if its not used.So i think you should split this up to 2 actions.
So if you check isApplicationGenuineAvailable first and its true you can use the second action to check that to.
If isApplicationGenuineAvailable is not true then it should not do anything.
So isApplicationGenuineAvailable = true then send it to an event.
If isApplicationGenuine true then continue with the game, if not then send it to an new event.
In that new event you can show the user a new screen or send the user to the market and close the program.
-
Hi,
Isn't it what it's doing? or do you mean that I should not store into bool first thing?
This syntax should be checked first isApplicationGenuineAvailable.
If that is true then it should check isApplicationGenuine.
It's doing this. the first if statement check for isApplicationGenuineAvailable, if true procesed with isApplicationGenuine
Or I am still missing the point ???
If you only check isApplicationGenuine then you can get an error if its not used.
Is it a bug? cause the documentation seems to say that isApplicationGenuine simply returns false wether it's actually available or not.
I have put the sample from the custom action where I do the check bellow:
if (iPhoneUtils.isApplicationGenuineAvailable ){
if (iPhoneUtils.isApplicationGenuine){
Fsm.Event(isGenuine);
}else{
Fsm.Event(isNotGenuine);
}
}else{
Fsm.Event(notVerified);
}
so first, I check if genuine test is available and then I perform the test.
I don't think you do need two actions for this since with this custom action, you can route all possible way out of it I think.
Also, How do you actually manage to verify this action actually? Do you have some steps to be able to touch the code so that it triggers false for isApplicationGenuineAvailable and isApplicationGenuine?
Bye,
Jean
-
Hi,
Isn't it what it's doing? or do you mean that I should not store into bool first thing?
This syntax should be checked first isApplicationGenuineAvailable.
If that is true then it should check isApplicationGenuine.
It's doing this. the first if statement check for isApplicationGenuineAvailable, if true procesed with isApplicationGenuine
Or I am still missing the point ???
If you only check isApplicationGenuine then you can get an error if its not used.
Is it a bug? cause the documentation seems to say that isApplicationGenuine simply returns false wether it's actually available or not.
I have put the sample from the custom action where I do the check bellow:
if (iPhoneUtils.isApplicationGenuineAvailable ){
if (iPhoneUtils.isApplicationGenuine){
Fsm.Event(isGenuine);
}else{
Fsm.Event(isNotGenuine);
}
}else{
Fsm.Event(notVerified);
}
so first, I check if genuine test is available and then I perform the test.
I don't think you do need two actions for this since with this custom action, you can route all possible way out of it I think.
Also, How do you actually manage to verify this action actually? Do you have some steps to be able to touch the code so that it triggers false for isApplicationGenuineAvailable and isApplicationGenuine?
Bye,
Jean
Maybe i did not read it to good, but there was not much info in the playmaker either.
if it first check isApplicationGenuineAvailable is true then check isApplicationGenuine if that true or false before it do any event then it work with one action.
isApplicationGenuine do return false if its not genuine, but also if isApplicationGenuineAvailable is false.
Thats why you need to check isApplicationGenuineAvailable first and if that false you dont need to check isApplicationGenuine for you know that will always be false.
So if isApplicationGenuineAvailable is fase the only even it shuld do is that is not validated.
Maybe you did that already. but it was not so clear when i was in playmaker and i needed to be sure it works like it should.
So
isApplicationGenuineAvailable = true
then
if isApplicationGenuine = true
then event(run your game)
Else event( run a info page)
end
else
event(not validated)
end
But it might like you do that already. I just need to be sure.. :-)
-
Hi,
Yes, it is like that ;)
Bye,
Jean
-
Anyone get this working with Android LVL ?
-
Anyone want to add this action to ecosystem?
Cheers
Seb