public void PostGameActionReport(GameActionReport report)
 {
     if (report != null)
     {
         ActionsReports.Add(report);
         GotNewActionReportEvent?.Invoke(report);
     }
 }
        public GameAction(Action <T, Action> action, T parameter, GameActionReport report)
        {
            _timerManager = GameClient.Get <ITimerManager>();

            Action    = action;
            Parameter = parameter;
            Report    = report;
        }
        /// <summary>
        ///     AddNewActionInToQueue
        /// </summary>
        /// <param name="actionToDo">action to do, parameter + callback action</param>
        /// <param name="parameter">parameters for action if ot needs</param>
        /// <param name="report">report that will be added into reports list</param>
        public void AddNewActionInToQueue(
            Action <object, Action> actionToDo, object parameter = null, GameActionReport report = null)
        {
            GameAction <object> gameAction = new GameAction <object>(actionToDo, parameter, report);

            gameAction.OnActionDoneEvent += OnActionDoneEvent;
            _actionsToDo.Enqueue(gameAction);

            if (_actionInProgress == null && _actionsToDo.Count < 2)
            {
                TryCallNewActionFromQueue();
            }
        }
Ejemplo n.º 4
0
        public ReportViewBase(GameObject prefab, Transform parent, GameActionReport gameAction)
        {
            LoadObjectsManager     = GameClient.Get <ILoadObjectsManager>();
            GameplayManager        = GameClient.Get <IGameplayManager>();
            ActionsQueueController = GameplayManager.GetController <ActionsQueueController>();
            CardsController        = GameplayManager.GetController <CardsController>();

            GameAction = gameAction;
            SelfObject = Object.Instantiate(prefab, parent, false);
            SelfObject.transform.SetSiblingIndex(0);
            PreviewImage = SelfObject.transform.Find("Image").GetComponent <Image>();

            OnBehaviourHandler behaviour = SelfObject.GetComponent <OnBehaviourHandler>();

            behaviour.PointerEntered += PointerEnteredHandler;
            behaviour.PointerExited  += PointerExitedHandler;

            PlayerAvatarPreviewPrefab =
                LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/PlayerAvatarPreview");
            AttackingHealthPrefab = LoadObjectsManager.GetObjectByPath <GameObject>("Prefabs/Gameplay/AttackingHealth");

            CreatePreviewPanel();
        }
Ejemplo n.º 5
0
        private void GotNewActionReportEventHandler(GameActionReport report)
        {
            ReportViewBase reportView = null;

            switch (report.ActionType)
            {
            case Enumerators.ActionType.ATTACK_PLAYER_BY_CREATURE:
                reportView =
                    new ReportViewBaseAttackPlayerByCreature(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.ATTACK_CREATURE_BY_CREATURE:
                reportView =
                    new ReportViewBaseAttackCreatureByCreature(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.ATTACK_CREATURE_BY_SKILL:
                reportView =
                    new GameplayActionReportAttackCreatureBySkill(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.ATTACK_PLAYER_BY_SKILL:
                reportView =
                    new GameplayActionReportAttackPlayerBySkill(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.HEAL_PLAYER_BY_SKILL:
                reportView =
                    new GameplayActionReportHealPlayerBySkill(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.HEAL_CREATURE_BY_SKILL:
                reportView =
                    new GameplayActionReportHealCreatureBySkill(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.ATTACK_CREATURE_BY_ABILITY:
                reportView =
                    new GameplayActionReportAttackCreatureByAbility(_playedCardPrefab, _selfPanel.transform,
                                                                    report);
                break;

            case Enumerators.ActionType.ATTACK_PLAYER_BY_ABILITY:
                reportView =
                    new GameplayActionReportAttackPlayerByAbility(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.HEAL_PLAYER_BY_ABILITY:
                reportView =
                    new GameplayActionReportHealPlayerByAbility(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.HEAL_CREATURE_BY_ABILITY:
                reportView =
                    new GameplayActionReportHealCreatureByAbility(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.PLAY_UNIT_CARD:
                reportView = new GameplayActionReportPlayUnitCard(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.PLAY_SPELL_CARD:
                reportView = new GameplayActionReportPlaySpellCard(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.STUN_CREATURE_BY_ABILITY:
                reportView =
                    new GameplayActionReportStunCreatureByAbility(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.STUN_UNIT_BY_SKILL:
                reportView =
                    new GameplayActionReportStunCreatureBySkill(_playedCardPrefab, _selfPanel.transform, report);
                break;

            case Enumerators.ActionType.SUMMON_UNIT_CARD:
                reportView = new GameplayActionReportPlayUnitCard(_playedCardPrefab, _selfPanel.transform, report);
                break;
            }

            if (reportView != null)
            {
                _allReports.Add(reportView);
            }
        }
 public GameplayActionReportPlayUnitCard(GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
 public GameplayActionReportHealPlayerBySkill(GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
Ejemplo n.º 8
0
 public GameplayActionReportHealCreatureByAbility(
     GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
 public GameplayActionReportStunCreatureBySkill(GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
 public GameplayActionReportAttackPlayerByAbility(
     GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
Ejemplo n.º 11
0
 public ReportViewBaseAttackPlayerByCreature(GameObject prefab, Transform parent, GameActionReport gameAction)
     : base(prefab, parent, gameAction)
 {
 }
        // todo improve I guess
        public GameActionReport FormatGameActionReport(Enumerators.ActionType actionType, object[] parameters)
        {
            GameActionReport actionReport = new GameActionReport(actionType, parameters);

            return(actionReport);
        }