コード例 #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
ファイル: CardManager.cs プロジェクト: gamesFTW/card-game
    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
ファイル: CardDisplay.cs プロジェクト: gamesFTW/card-game
 public void Kill()
 {
     this.cardData.alive = false;
     Unibus.Dispatch(CARD_DIED, this);
     this.ZoomOut();
     this.Unselect();
     this.OverHighlightOff();
 }
コード例 #11
0
ファイル: Dialog.cs プロジェクト: gamesFTW/card-game
    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);
 }
コード例 #13
0
    // 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>();
    }
コード例 #14
0
    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
ファイル: Tutorial.cs プロジェクト: gamesFTW/card-game
    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
ファイル: BoardActivities.cs プロジェクト: gamesFTW/card-game
    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
ファイル: UnitDisplay.cs プロジェクト: gamesFTW/card-game
    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
ファイル: CardDisplay.cs プロジェクト: gamesFTW/card-game
    public void Untap()
    {
        cardData.tapped = false;

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

        this.cardBaseBlack.SetActive(false);
        Unibus.Dispatch(CARD_UNTAPPED, this);
    }
コード例 #27
0
ファイル: CardManager.cs プロジェクト: gamesFTW/card-game
    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
ファイル: BoardActivities.cs プロジェクト: gamesFTW/card-game
    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
ファイル: CardManager.cs プロジェクト: gamesFTW/card-game
    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);
    }