Can some body find me a way how can i pass argument while making scheduler call in cocos2d or cocos2dx? I'm using this scheduler call and passing it parameter by a class variable. I want to send parameter through this call. Thanks!
scheduler->scheduleSelector(schedule_selector(CFacebookManager::sendRequestAllUpdateUI), CFacebookManager::instance(), 1, false, 1, 1.0f);
If you are using cocos2dx with c++11, I had to make an action that takes a lambda of code and schedules it. Lamdas can capture any number of variables, plus the action takes userData as a template, and passes it to the lambda as a pointer, so you can modify it and expect percistency across updates without declaring extra instance variables in your class.
Please, check it out.
https://github.com/radif/MCBCallLambda
What you want to do isn't possible in cocos2d. You can't pass parameter's through a schedule update method.
LearnCocos2d gave a good answers to almost the same question here schedule event with multiple arguments in cocos2D
Related
I'm trying to build a process like this:
In state1, it will trigger 10 lambdas, and only when ALL those 10 lambda respond/ or call callback with taskToken, it will then proceed to next state2.
How to design this process?
This is a perfect scenario for the Map state. You can pass in an array of lambda function names, then add a Lambda task and use the Parameters block to set the function dynamically. And if you want them to run one at a time instead of in parallel, you can set MaxConcurrency.
I would like to run one lambda function, that would return a list of parameters. Based on the number of parameters I would like to trigger another lambda functions to finish the process individually (e.g. 100 independent sub-lambda function).
Would like to know how this be done? It would be great if there are some github settings? Thanks a lot.
There are three options: first, call Invoke using the AWS SDK for your language.
Second, use Step Functions.
Third, write each parameter onto an SQS queue, and configure the second Lambda to be triggered by that queue. This is the approach that I'd use.
Im running a workflow using a step function (with SAM), when I needed to send information between lambdas I've used events and everything was perfect! But now, I need that almost every lambda in my workflow have access to a constant received in the invocation input of the step function (it changes on every execution) like a global variable.
I know that I can solve it by returning it in every lambda output but I think that it is a very ugly solution :(
Is there any way to access the context of the execution and add data to it from a lambda in the step function ? Any other solution would be cool too.
Yes, see https://docs.aws.amazon.com/step-functions/latest/dg/input-output-resultpath.html#input-output-resultpath-append
You can keep the input of the state machine execution and combine it with the result of the state.
Going through the docs, I see that you can access the context object from each state in the state machine.
You can pass the information that you need to be global as the input to your state machine and then, access the state machine input from the context object.
You can refer the linked doc to see how to access the context object.
For a cleaner code style, I just want to know is there a way to set HttpMetric time attribute directly not using start() or stop().
Because I can get the time directly, and don't want to add any start/stop listener for it.
I've found HttpMetric has a putAttribute method, so I guess it is possible to set the time directly.
According to the documentation https://firebase.google.com/docs/perf-mon/get-started-android#manual-network, this is not possible. Using start() and stop() is the recommended way of using HTTPMetric.
I am working on a image slider and using transitions in it. So, when I hit "next button" to get the next image in the middle of transition, the function gets called for next image, though the last transition affect hasn't done yet.
How should I stop the function to be called until the last transition completes? Please help! Thank You.
When I was working without transitions, it was working great but that wasn't smooth in mozilla, so I came up with transitions to make it! Now it is better than before but creating problems as transitions will take time to execute, and if in that time duration, I hit for next image, it calls the function for next transition effects.
What you are looking for is called 'debouncing'. If you can use an external library, I would recommend to use enter link description here. Underscore provides a similar function. This function ensures your function is not called twice and even can set a delay between two invocations.
If you can't then, you can google for a sample implementation like this one (I didn't test this one as I usually uses lodash's).
Hope this helps.