예제 #1
0
    public void CheckClickOutOfAnyCard()
    {
        if (!this.MouseOnDialog)
        {
            // Хоть убей я не придумал как сделать по другому.
            if (!this.skipedFirstCheckClickOutOfAnyCard)
            {
                this.skipedFirstCheckClickOutOfAnyCard = true;
            }
            else
            {
                var leftMouseClicked = Input.GetButtonDown("Fire1");
                if (leftMouseClicked && MouseOnTile == false)
                {
                    Unibus.Dispatch <string>(ClickOutOfBoardEmmiter.CLICK_OUT_OF_BOARD, "");
                }

                var rightMouseClicked = Input.GetButtonDown("Fire2");
                if (rightMouseClicked)
                {
                    Unibus.Dispatch <string>(ClickOutOfBoardEmmiter.RIGHT_CLICK, "");
                }
            }
        }
    }
예제 #2
0
 private void BeHit(float damage)
 {
     PlayHurt();
     Knockback();
     BeHitSlowDown();
     Unibus.Dispatch(EventVirus.Get(EventVirus.Action.BE_HIT, this, damage));
 }
예제 #3
0
 public void EmmitCardToAimAction(UnitDisplay unit)
 {
     Unibus.Dispatch <SimpleAbilityCardAction>(ActionEmmiter.CARD_TO_AIM, new SimpleAbilityCardAction
     {
         cardId = unit.CardData.id
     });
 }
예제 #4
0
 public void EmmitCardUseManaAbilityAction(UnitDisplay unit)
 {
     Unibus.Dispatch <SimpleAbilityCardAction>(ActionEmmiter.CARD_USE_MANA_ABILITY, new SimpleAbilityCardAction
     {
         cardId = unit.CardData.id
     });
 }
예제 #5
0
        private void OnEventVirus(EventVirus evt)
        {
            if (evt.action == EventVirus.Action.DEAD)
            {
                // add coin
                getCoin       += FormulaUtil.CoinConvert(evt.virus.size, mTableGameLevel.coinValueFactor * D.I.vipCoinValueMul, D.I.coinValue);
                mAddCoinCount += evt.virus.size * 0.1f;
                if (Random.value > CT.table.coinAddProb[evt.virus.size - 1])
                {
                    var pos       = UIUtil.GetUIPos(evt.virus.rectTransform);
                    int coinCount = Mathf.Clamp(Mathf.CeilToInt(mAddCoinCount), 1, 15);
                    Unibus.Dispatch(EventBattle.Get(EventBattle.Action.GET_COIN, coinCount, pos));
                    mAddCoinCount = 0;
                }

                // virus kills 4 buff
                D.I.kills4Buff += 1;

                // book
                D.I.BookAddCollectCount(evt.virus.id);
            }
            else if (evt.action == EventVirus.Action.BE_HIT)
            {
                if (BuffProxy.Ins.Has_Effect_Coin)
                {
                    var buff = BuffProxy.Ins.GetBuff("coin");
                    if (buff != null && Random.value <= buff.param2)
                    {
                        getCoin += FormulaUtil.CoinConvert(evt.virus.size, mTableGameLevel.coinValueFactor * buff.param1 * D.I.vipCoinValueMul, D.I.coinValue);
                        var pos = UIUtil.GetUIPos(evt.virus.rectTransform);
                        Unibus.Dispatch(EventBattle.Get(EventBattle.Action.GET_COIN, 1, pos));
                    }
                }
            }
        }
예제 #6
0
 private void OnCardSelectedToPlayHandler(CardDisplay card)
 {
     if (card.Placeholder.IsChildOf(this.transform))
     {
         Unibus.Dispatch(PlayerHandDisplay.CARD_SELECTED_TO_PLAY, card);
     }
 }
예제 #7
0
 private void OnCardClicked(CardDisplay card)
 {
     if (card.Placeholder.IsChildOf(this.transform))
     {
         Unibus.Dispatch(PlayerTableDisplay.CARD_SELECTED_ON_TABLE, card);
     }
 }
예제 #8
0
    private void KillUnit(CardDisplay cardDisplay)
    {
        cardDisplay.Kill();
        this.playerStacks[cardDisplay.cardData.ownerId].graveyard.GetComponent <StackDisplay>().AddCard(cardDisplay);
        boardCreator.KillUnit(cardDisplay);

        Unibus.Dispatch(CardManager.CARD_DIED, cardDisplay);
    }
예제 #9
0
 public void EmmitCardHealingAction(UnitDisplay healerUnit, UnitDisplay healedUnit)
 {
     Unibus.Dispatch <HealCardAction>(ActionEmmiter.CARD_HEAL, new HealCardAction
     {
         healerCardId = healerUnit.CardData.id,
         healedCardId = healedUnit.CardData.id
     });
 }
예제 #10
0
 public void Kill()
 {
     this.cardData.alive = false;
     Unibus.Dispatch(CARD_DIED, this);
     this.ZoomOut();
     this.Unselect();
     this.OverHighlightOff();
 }
예제 #11
0
    public void HideDialog()
    {
        this.gameObject.SetActive(false);

        this.button1.GetComponent <Button>().onClick.RemoveListener(OnButton1ClickHandler);
        this.button2.GetComponent <Button>().onClick.RemoveListener(OnButton2ClickHandler);
        Unibus.Dispatch(DIALOG_MOUSE_EXIT, "");
    }
예제 #12
0
 public ClickOutOfBoardEmmiter()
 {
     Unibus.Subscribe <Point>(TileDisplay.TILE_MOUSE_ENTER, OnTileMouseEnter);
     Unibus.Subscribe <Point>(TileDisplay.TILE_MOUSE_EXIT, OnTileMouseExit);
     Unibus.Subscribe <AbilityDisplay>(AbilityDisplay.ABILITY_MOUSE_ENTER, OnTileMouseEnter);
     Unibus.Subscribe <AbilityDisplay>(AbilityDisplay.ABILITY_MOUSE_EXIT, OnTileMouseExit);
     Unibus.Subscribe <string>(Dialog.DIALOG_MOUSE_ENTER, OnDialogMouseEnter);
     Unibus.Subscribe <string>(Dialog.DIALOG_MOUSE_EXIT, OnDialogMouseExit);
 }
    // Start is called before the first frame update
    void Start()
    {
        Unibus.Subscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_ENTER_ON_BOARD, OnUnitBoardMouseEnter);
        Unibus.Subscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_EXIT_ON_BOARD, OnUnitBoardMouseExit);
        Unibus.Subscribe <CardDisplay>(CardDisplay.CARD_MOUSE_ENTER, OnCardMouseEnter);
        Unibus.Subscribe <CardDisplay>(CardDisplay.CARD_MOUSE_EXIT, OnCardMouseExit);

        boardCreator = this.transform.Find("Board").GetComponent <BoardCreator>();
    }
    protected override void Disable()
    {
        base.Disable();
        Dialog.instance.HideDialog();

        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_CLICKED_ON_BOARD, OnUnitSelectedOnBoard);
        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_ENTER_ON_BOARD, OnUnitMouseEnterOnBoard);
        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_EXIT_ON_BOARD, OnUnitMouseExitOnBoard);
    }
예제 #15
0
 public void EmmitCardPlayAction(CardDisplay card, Point point)
 {
     Unibus.Dispatch <PlayCardAction>(ActionEmmiter.CARD_PLAY, new PlayCardAction
     {
         cardId = card.cardData.id,
         x      = point.x.ToString(),
         y      = point.y.ToString()
     });
 }
예제 #16
0
 public void EmmitCardMoveAction(UnitDisplay movingUnit, Point point)
 {
     Unibus.Dispatch <MoveCardAction>(ActionEmmiter.CARD_MOVE, new MoveCardAction
     {
         cardId = movingUnit.CardData.id,
         x      = point.x.ToString(),
         y      = point.y.ToString()
     });
 }
예제 #17
0
 private void BeDead()
 {
     isAlive = false;
     Unibus.Dispatch(EventVirus.Get(EventVirus.Action.DEAD, this, hpTotal));
     Recycle();
     PlayDead();
     Divide();
     GenBuff();
 }
예제 #18
0
    private void ShowDialog(Step step)
    {
        if (step.image == null)
        {
            this.dialog = this.transform.Find("Dialog").gameObject;
        }
        else
        {
            this.dialog = this.transform.Find("DialogBig").gameObject;
            var spriteRenderer = this.transform.Find("DialogBig/Image").GetComponent <SpriteRenderer>();
            spriteRenderer.sprite = Resources.Load <Sprite>($"{step.image}");
        }
        this.dialog.SetActive(true);
        this.dialog.transform.Find("Text").GetComponent <TextMeshProUGUI>().text = step.text;
        this.dialog.transform.Find("StepCounter").GetComponent <TextMeshProUGUI>().text
            = $"{this.currentStepIndex + 1} / {this.tutorialSteps.Length}";

        if (step.stepEvent != null)
        {
            Unibus.Subscribe <CardDisplay>(step.stepEvent, this.OnEventHandled);
        }

        if (step.dialogPosition != null)
        {
            this.dialog.transform.localPosition = new Vector3(step.dialogPosition[0], step.dialogPosition[1], 0);
        }
        else
        {
            this.dialog.transform.localPosition = new Vector3(0, 70, 0);
        }

        this.arrowLeft.SetActive(false);
        this.arrowBottom.SetActive(false);
        this.arrowRight.SetActive(false);
        this.arrowBottomLeft.SetActive(false);

        if (step.arrow != null)
        {
            if (step.arrow == Step.Arrow.left)
            {
                this.arrowLeft.SetActive(true);
            }
            if (step.arrow == Step.Arrow.bottom)
            {
                this.arrowBottom.SetActive(true);
            }
            if (step.arrow == Step.Arrow.right)
            {
                this.arrowRight.SetActive(true);
            }
            if (step.arrow == Step.Arrow.bottomLeft)
            {
                this.arrowBottomLeft.SetActive(true);
            }
        }
    }
예제 #19
0
        void Start()
        {
            var count  = 0;
            var button = this.GetComponent <Button>();

            button.onClick.AddListener(() => Unibus.Dispatch(Tag, ++count));

            // Initial rendering
            Unibus.Dispatch(Tag, count);
        }
예제 #20
0
    public void Disable()
    {
        CursorController.SetDefault();

        this.boardCreator.RemoveAllBlinks();
        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_CLICKED_ON_BOARD, OnUnitSelectedOnBoard);
        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_ENTER_ON_BOARD, OnUnitMouseEnterOnBoard);
        Unibus.Unsubscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_EXIT_ON_BOARD, OnUnitMouseExitOnBoard);
        Unibus.Unsubscribe <CardDisplay>(PlayerTableDisplay.CARD_SELECTED_ON_TABLE, OnCardClicked);
    }
예제 #21
0
    // Start is called before the first frame update
    void Start()
    {
        Unibus.Subscribe <CardDisplay>(CardManager.CARD_ATTACKED, OnCardAttacked);
        Unibus.Subscribe <CardDisplay>(CardManager.CARD_PLAYED, OnCardPlayed);
        Unibus.Subscribe <CardDisplay>(CardManager.CARD_DIED, OnCardDied);
        Unibus.Subscribe <CardDisplay>(CardManager.CARD_MOVED, OnCardMoved);
        Unibus.Subscribe <CardDisplay>(CardManager.CARD_SELECTED, OnCardSelected);

        this.AudioSource = this.GetComponent <AudioSource>();
    }
예제 #22
0
    private void OnActivateAbility(Ability ability)
    {
        var abilityActivated = new AbilityActivated()
        {
            cardDisplay = this.CardDisplay,
            ability     = ability
        };

        Unibus.Dispatch(ABILITY_ACTIVATED, abilityActivated);
    }
예제 #23
0
        private void OnItemCollider(int index, VirusBase virus)
        {
            base.OnUnitFire(index);
            units[index].SetReady(false);
            Vector2 cDir = virus.position - units[index].position;
            Vector2 dir  = (cDir + virus.direction).normalized;

            virus.SetDirection(dir);
            Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, virus, damage));
            ExplosionWeaponCoverItem.Create().Reset(units[index].position, table.explosionSound);
        }
예제 #24
0
 void Start()
 {
     Unibus.Subscribe <CardDisplay>(CardDisplay.CARD_PLAY_AS_MANA, OnCardPlayAsMana);
     Unibus.Subscribe <PlayCardAction> (ActionEmmiter.CARD_PLAY, OnCardPlay);
     Unibus.Subscribe <MoveCardAction> (ActionEmmiter.CARD_MOVE, OnCardMove);
     Unibus.Subscribe <AttackCardAction> (ActionEmmiter.CARD_ATTACK, OnCardAttack);
     Unibus.Subscribe <AttackCardAction> (ActionEmmiter.CARD_MOVE_AND_ATTACK, OnCardMoveAndAttack);
     Unibus.Subscribe <HealCardAction> (ActionEmmiter.CARD_HEAL, OnCardHeal);
     Unibus.Subscribe <SimpleAbilityCardAction> (ActionEmmiter.CARD_USE_MANA_ABILITY, OnUseManaAbility);
     Unibus.Subscribe <SimpleAbilityCardAction> (ActionEmmiter.CARD_TO_AIM, OnToAim);
 }
예제 #25
0
        protected override void OnHit(VirusBase virus)
        {
            base.OnHit(virus);
            var hitPos = position + direction * 50;

            AreaHit(hitPos, effects[1] * 0.5f, (_vv) =>
            {
                Unibus.Dispatch(EventBullet.Get(EventBullet.Action.HIT, _vv, damage));
            });
            ExplosionWeaponMissileBullet.Create().Reset(hitPos, effects[1], explosionSound);
            ForceRecycle();
        }
예제 #26
0
    public void Untap()
    {
        cardData.tapped = false;

        if (this.UnitDisplay)
        {
            this.UnitDisplay.Untap();
        }

        this.cardBaseBlack.SetActive(false);
        Unibus.Dispatch(CARD_UNTAPPED, this);
    }
예제 #27
0
    private void CardWasInBattle(ServerActions.CardChanges cardChanges, bool isAttacker)
    {
        var         cardTransform = cardIdToCards[cardChanges.id];
        CardDisplay cardDisplay   = cardTransform.GetComponent <CardDisplay>();

        this.ApplyChangesToCard(cardChanges);

        if (isAttacker)
        {
            Unibus.Dispatch(CardManager.CARD_ATTACKED, cardDisplay);
        }
    }
예제 #28
0
        protected override void OnInit()
        {
            base.OnInit();

            mTableGameLevel = TableGameLevel.Get(D.I.gameLevel);
            mSpawnCountFix  = FormulaUtil.Expresso(CT.table.formulaArgsVirusSpawnCount);

            mWaveModule.Init();
            mBuffGenModule.Init();
            Unibus.Subscribe <EventAircraft>(OnEventAircraft);
            Unibus.Subscribe <EventVirus>(OnEventVirus);
        }
예제 #29
0
    public void Enable()
    {
        if (this.boardCreator.hoveredUnit)
        {
            this.OnUnitMouseEnterOnBoard(this.boardCreator.hoveredUnit);
        }

        Unibus.Subscribe <UnitDisplay>(BoardCreator.UNIT_CLICKED_ON_BOARD, OnUnitSelectedOnBoard);
        Unibus.Subscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_ENTER_ON_BOARD, OnUnitMouseEnterOnBoard);
        Unibus.Subscribe <UnitDisplay>(BoardCreator.UNIT_MOUSE_EXIT_ON_BOARD, OnUnitMouseExitOnBoard);
        Unibus.Subscribe <CardDisplay>(PlayerTableDisplay.CARD_SELECTED_ON_TABLE, OnCardClicked);
    }
예제 #30
0
    public void OnMoveCard(ServerActions.MoveCardAction action)
    {
        var cardTransform = cardIdToCards[action.cardId];

        CardDisplay cardDisplay = cardTransform.GetComponent <CardDisplay>();

        cardDisplay.CurrentMovingPoints = action.currentMovingPoints;

        boardCreator.MoveUnit(cardDisplay, action.position, action.path);

        Unibus.Dispatch(CardManager.CARD_MOVED, cardDisplay);
    }