Ejemplo n.º 1
0
 public BoardSpaceChooser(ChessScene scene)
 {
     actionList   = new List <int>();
     inputOffsets = new Dictionary <IntVector2, int>();
     scene.Components.GetOrRegister <Message <Board> >((int)ComponentKeys.BoardCreatedMessage, Message <Board> .Create)
     .Subscribe(new SimpleListener <Board>((b) => board = b));
     db           = scene.Game.Components.Get <GameDatabase>((int)ComponentKeys.GameDatabase);
     chooserState = scene.Components.GetOrRegister <StateMachine>((int)ComponentKeys.TurnChooserState, StateMachine.Create);
     chooserState.EnterStateMessenger.Subscribe(new SimpleListener <int>(OnEnterState));
     selEvent = scene.Components.GetOrRegister <PlayerSelectionEvent>((int)ComponentKeys.PlayerSelectionChange, PlayerSelectionEvent.Create);
     selEvent.Subscribe(new SimpleListener(OnSelectionChange));
     acceptBtn = scene.Components.GetOrRegister <SubscribableBool>((int)ComponentKeys.PlayerSelectionAcceptBtn, SubscribableBool.Create);
     acceptBtn.Subscribe(new TriggerListener(OnSelectionBtnTrigger));
     chosenAction = scene.Components.GetOrRegister <SubscribableObject <TurnAction> >
                        ((int)ComponentKeys.TurnChooserChosenAction, SubscribableObject <TurnAction> .Create);
     highlightMessage = scene.Components.GetOrRegister <Message <TurnChooserHighlight> >
                            ((int)ComponentKeys.TurnChooserHighlightChange, Message <TurnChooserHighlight> .Create);
     chosenPiece          = scene.Components.GetOrRegister <SubscribableInt>((int)ComponentKeys.TurnChooserChosenPiece, SubscribableInt.Create);
     turnOptionCalculator = scene.Components.GetOrRegister <Query <TurnOptions, TurnOptionCalculatorArgs> >
                                ((int)ComponentKeys.MoveOptionListQuery, Query <TurnOptions, TurnOptionCalculatorArgs> .Create);
     scene.Components.GetOrRegister <SubscribableBool>((int)ComponentKeys.PlayerSelectionCycleBtn, SubscribableBool.Create)
     .Subscribe(new TriggerListener(OnCycleButtonPress));
     scene.Components.GetOrRegister <SubscribableInt>((int)ComponentKeys.ScrollWheel, SubscribableInt.Create)
     .Subscribe(new SimpleListener <int>((s) => {
         if (s != 0)
         {
             OnScrollWheel(s);
         }
     }));
 }
        public MouseOverMoveOptionIndicators(AutoController scene)
        {
            scene.Components.GetOrRegister <Message <Board> >((int)ComponentKeys.BoardCreatedMessage, Message <Board> .Create)
            .Subscribe(new SimpleListener <Board>((b) => board = b));
            db = scene.Game.Components.Get <GameDatabase>((int)ComponentKeys.GameDatabase);

            displayMessage = scene.Components.GetOrRegister <Message <ActionIndicatorPattern> >
                                 ((int)ComponentKeys.MouseOverIndicatorPattern, Message <ActionIndicatorPattern> .Create);
            moveOptionCalculator = scene.Components.GetOrRegister <Query <TurnOptions, TurnOptionCalculatorArgs> >
                                       ((int)ComponentKeys.MoveOptionListQuery, Query <TurnOptions, TurnOptionCalculatorArgs> .Create);
            compiler = scene.Components.GetOrRegister <Query <ActionIndicatorPattern, ActionIndicatorPatternCompileArgs> >(
                (int)ComponentKeys.GetActionIndicatorPattern, Query <ActionIndicatorPattern, ActionIndicatorPatternCompileArgs> .Create);
            chosenPiece = scene.Components.GetOrRegister <SubscribableInt>((int)ComponentKeys.TurnChooserChosenPiece, SubscribableInt.Create);
            chosenPiece.Subscribe(new SimpleListener <int>((p) => RefreshMoveOptions()));
            selEvent = scene.Components.GetOrRegister <PlayerSelectionEvent>((int)ComponentKeys.PlayerSelectionChange, PlayerSelectionEvent.Create);
            selEvent.Subscribe(new SimpleListener(RefreshMoveOptions));
        }