Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Oct 21 21:01

    tiagoschenkel on @robotlegsjs

    (compare)

  • Oct 21 21:00

    tiagoschenkel on core-1.0.3

    (compare)

  • Oct 21 21:00

    tiagoschenkel on core-1.0.3

    (compare)

  • Oct 21 21:00

    tiagoschenkel on core-1.0.3

    (compare)

  • Oct 21 21:00

    tiagoschenkel on master

    chore(package): update @robotle… update changelog Merge pull request #105 from Ro… (compare)

  • Oct 21 21:00
    tiagoschenkel closed #105
  • Oct 21 20:55
    tiagoschenkel synchronize #105
  • Oct 21 20:55

    tiagoschenkel on core-1.0.3

    update changelog (compare)

  • Oct 21 20:50
    tiagoschenkel assigned #105
  • Oct 21 20:50
    tiagoschenkel labeled #105
  • Oct 21 20:50
    tiagoschenkel opened #105
  • Oct 21 20:49

    tiagoschenkel on core-1.0.3

    chore(package): update @robotle… (compare)

  • Oct 20 21:55

    greenkeeper[bot] on @robotlegsjs

    (compare)

  • Oct 20 21:55

    tiagoschenkel on core-1.0.3

    (compare)

  • Oct 20 21:55

    tiagoschenkel on master

    chore(package): update @robotle… update changelog Merge pull request #52 from Rob… (compare)

  • Oct 20 21:55
    tiagoschenkel closed #52
  • Oct 20 21:48
    tiagoschenkel synchronize #52
  • Oct 20 21:48

    tiagoschenkel on core-1.0.3

    update changelog (compare)

  • Oct 20 21:47
    tiagoschenkel labeled #52
  • Oct 20 21:47
    tiagoschenkel assigned #52
Jeff Onsea
@jeffonsea
ok i'll take a look. Thanks
Jeff Onsea
@jeffonsea
noted :)
Tiago Schenkel
@tiagoschenkel

check the IInjector interface, is in fact exposing the Container API from inversify:
https://github.com/RobotlegsJS/RobotlegsJS/blob/master/src/robotlegs/bender/framework/api/IInjector.ts

also, each robotlegs application will have a Context, that is creating the Injector and mapping it:
https://github.com/RobotlegsJS/RobotlegsJS/blob/master/src/robotlegs/bender/framework/impl/Context.ts#L396

Jeff Onsea
@jeffonsea
Ok ill save those links, what i'm looking at now is events and how to pass arguments with the event to the commands, i guess its using this ?
this.commandMap.map(GameEvent.CARD_SELECTED).toCommand(SelectCardCommand).withPayloadInjection(true);
Tiago Schenkel
@tiagoschenkel
Jeff Onsea
@jeffonsea
Hi guys i'm getting the following error when dispatching an event
Uncaught Error: No matching bindings found for serviceIdentifier: DemoMediator
    at _validateActiveBindingCount (planner.js:62)
    at _getActiveBindings (planner.js:48)
    at _createSubRequests (planner.js:91)
    at planner.js:115
    at Array.forEach (<anonymous>)
    at planner.js:114
    at Array.forEach (<anonymous>)
    at _createSubRequests (planner.js:94)
    at Object.plan (planner.js:136)
    at container.js:318
is it possible this is happening because of a circular dependency ?
The DemoMediator is mapped by the way
private mapStateMediators(): void {
    this.sceneMediatorMap.map(Boot).toMediator(BootMediator);
    this.sceneMediatorMap.map(Preload).toMediator(PreloadMediator);
    this.sceneMediatorMap.map(Main).toMediator(MainMediator);
    this.sceneMediatorMap.map(Demo).toMediator(DemoMediator);
    // this.sceneMediatorMap.map(GameTitle).toMediator(GameTitleMediator);
    // this.sceneMediatorMap.map(Main).toMediator(MainMediator);
    // this.sceneMediatorMap.map(GameOver).toMediator(GameOverMediator);
  }
Jeff Onsea
@jeffonsea
OK, if i remove @inject(DemoMediator) from the command im using the error disapears, but isnt the mediator + commands suposed to be the Controller in this MVC+S ?
Tiago Schenkel
@tiagoschenkel
@jeffonsea, the mediators are not injected into the context, they are created as soon as the view appears on the stage and they are removed as soon as the view is removed from stage. You use the mediator to make the link between the view and the rest of the MVC model, acting as a bridge, but you never inject the mediator somewhere else
Tiago Schenkel
@tiagoschenkel

I'm having the feeling that you are still learning the Robotlegs concepts, it's fine. But then would be great if you can take a look at this book:
http://shop.oreilly.com/product/0636920021216.do

You can read parts of the book for free at Amazon:
https://www.amazon.com/ActionScript-Developers-Guide-Robotlegs-Applications/dp/1449308902

The book will help you to understand the concepts behind the framework and how to use it properly. Unfortunately the robotlegs.org domain was removed from the internet, they had a forum and so on, but appears that their hosting provider went offline recently. But you still can check their github repo for documentation and references.

BTW, since the RobotlegsJS is a port to TypeScript of the original AS3 version, there are still a lot of things to do. Would be good to also migrate their official documentation and adapt the code examples to our case, but this will take some time and help will be needed, :)

If you would like to contribute, feel free to take a look here:
https://github.com/RobotlegsJS/RobotlegsJS/blob/master/CHANGELOG.md#v100---planned-stable-version

We already added the documentation but had no time yet to update it:
https://github.com/RobotlegsJS/RobotlegsJS/tree/master/docs/robotlegs

Jeff Onsea
@jeffonsea
Thanks @tiagoschenkel , yes i'm learning the robotlegs framework and still dont get some of the components right, i've read through the AS3 examples and docs to try and understand as much as possible. Porting the docs to this port would be great and help others like me to learn it faster. If i generate any worth docs i will let you guys know, maybe it could be of use.
Tiago Schenkel
@tiagoschenkel

this article have the classic robotlegs diagram, it will help you to understand the general idea behind the framework:
https://bharatria.wordpress.com/2012/04/19/introduction-to-robotlegs-architecture/

if you would like to contribute with the migration of documentation, I can create a branch and add you as a contributor

we also have an domain for the RobotlegsJS framework:
http://robotlegsjs.io/

the content is being generated from this repo:
https://github.com/RobotlegsJS/robotlegsjs.github.io

it's also possible to create a kind of a blog and add posts or tutorials in the near future

Jeff Onsea
@jeffonsea
I will try and learn it first and if i get confortable enough i will be interested in helping with that :)
Tiago Schenkel
@tiagoschenkel
sure
BTW, the plugin for Phaser v3 is already released, you can start using it:
https://github.com/RobotlegsJS/RobotlegsJS-Phaser
Jeff Onsea
@jeffonsea
Great! I'll take a look.
Gnun Ulikhanyan
@gnunua
Hey there. I have opened a pull request in RobotlegsJS-Phaser to support mediators for the container Game Object.
RobotlegsJS/RobotlegsJS-Phaser#55
@tiagoschenkel please review.
Thanks.
Tiago Schenkel
@tiagoschenkel

Hi @gnunua, I already checked your issues and pull request and I'm planning to validate the merge request this weekend.

Can I have write access to your repo?
https://github.com/gnunua/RobotlegsJS-Phaser

I will probably do some small changes before accepting the merge request, will be quicker to work directly in your repo, :)

Gnun Ulikhanyan
@gnunua
Hey @tiagoschenkel. Thanks for your message. The write access response is waiting for you :)
Tiago Schenkel
@tiagoschenkel
@gnunua, I sent you PM, pls check when you will have some time, ;)
Gnun Ulikhanyan
@gnunua
Hey there. Is there any way to pass data with the event to macroCommand. With regular Command, you can receive the event as an argument of the execute method or also it is possible to inject it in command. The same process seems to problematic with the macrocommands ( macrobot package)
Tiago Schenkel
@tiagoschenkel

one way to pass data to the SubCommands is defining a payload:
https://github.com/RobotlegsJS/RobotlegsJS-Macrobot#using-payloads

there is one open issue that could be related, since is mentioned that the event is not mapped into the context so is not possible to use the event (or some data from the event) as a payload:
RobotlegsJS/RobotlegsJS-Macrobot#49

I don't have a solution yet for this problem, I asked for more details about the issue but have no answer so far

personally I prefer to use Signals mapped to MacroCommands instead of events, you can also take a look at this extension:
https://github.com/RobotlegsJS/RobotlegsJS-SignalCommandMap

this extension is lacking proper documentation, but it has the same behaviour as the origjnal AS3 implementation.

a good guide could be this one:
http://joelhooks.com/2010/02/14/robotlegs-as3-signals-and-the-signalcommandmap-example/

It is important to note that the parameters passed via the Signals dispatch() method will be instantly mapped and unmapped when the command is executed. If you’ve previously mapped a class that is being delivered via a Signal command mapping, that mapping will be overwritten and removed. To avoid this, favor using typed value objects as Signal parameters.
when dispatching one signal you can define parameters, and these parameters will be mapped inside the context of all commands and sub-commands
Gnun Ulikhanyan
@gnunua
@tiagoschenkel Thanks for the answer. looking through the RobotlegsJS-SignalCommandMap.
Gnun Ulikhanyan
@gnunua
Hey @tiagoschenkel. I have tested RobotlegsJS-SignalCommandMap.
In the case of regular commands, everything works great. With macro commands parameters passed to signal's dispatch method is undefined when injecting in command.
Here is the example code :
  1. this.signalCommandMap.map(TestSignal).toCommand(RoundStartCommand);
 this.testSignal.dispatch(999);
@injectable()
class TestSignal extends Signal {
  constructor() {
    super(Number);
  }
}

export default TestSignal;
@injectable()
export class RoundStartCommand extends SequenceMacro {
  @inject(Number)
  private myNum: number;

  public prepare(): void {
    // here  this.myNum is undefined
    this.add(SubCommand);
  }
}
Tiago Schenkel
@tiagoschenkel

there is a specific unit test for this case:
https://github.com/RobotlegsJS/RobotlegsJS-SignalCommandMap/blob/master/test/robotlegs/bender/extensions/signalCommandMap/impl/signalCommandTrigger.test.ts#L144

you need to specify the valueObjects and valueClasses in the signal:

@injectable()
export class ParametersSignal extends Signal {
    constructor() {
        super(Boolean, Number, String, Symbol, Object, Date, Array);
    }
}
but let me check here what else is involved
Gnun Ulikhanyan
@gnunua
I have specified valueClasses and it works great with Regular commands. The problem appears on Macro Commands.
Tiago Schenkel
@tiagoschenkel
can you open an issue on the macro command repo providing an example that should work?
Gnun Ulikhanyan
@gnunua

Sure, but let to be clear I did everything right. My sub command looks like this:

@injectable()
export class SubCommand implements ICommand {
  @inject(Number)
  private myNum: number;

  // override
  public execute(): void {
    console.log(this.myNum);
  }
}

In this case I got the following error:

Uncaught Error: No matching bindings found for serviceIdentifier: Number
BTW, In macro Command injected number is undefined inside prepare
method ( it means I can not pass payload to subcommand ) but I got the expected value in execute method.
Tiago Schenkel
@tiagoschenkel
I was taking a quick look in the source code of the AbstractMacro and also noticed that the command is not passing any parameter, so this appears to be a problem on the macrobot extension. Event parameters or Signal payloads are not processed, :thought_balloon:
Tiago Schenkel
@tiagoschenkel
@gnunua, I managed to solve the issue related to the prepare method and the issue of not mapping the payloads into the context of the sub-commands :tada:
RobotlegsJS/RobotlegsJS-Macrobot#68

I added a new section to the README describing how to send parameters to the macro commands using Events or Signals:
https://github.com/RobotlegsJS/RobotlegsJS-Macrobot#macro-command-triggers

I also added some test cases to ensure that these parameters are accessible inside the context of the sub-commands:
https://github.com/RobotlegsJS/RobotlegsJS-Macrobot/blob/master/test/robotlegs/bender/utilities/macrobot/impl/signalsMappedToMacro.test.ts

Gnun Ulikhanyan
@gnunua
Nice! Thanks for your efforts.
Gnun Ulikhanyan
@gnunua
Hey @tiagoschenkel . I hope you are doing well. Would like to notify that find some issue on macrobot. I have opened an issue:
RobotlegsJS/RobotlegsJS-Macrobot#88
Tiago Schenkel
@tiagoschenkel
Hi @gnunua, can you add a comment there with the error message that you are seeing in the console?
Gnun Ulikhanyan
@gnunua
sure, will comment on github