Exemplo n.º 1
0
    void OnBtnClicked(GameObject sender)
    {
        if (!sender.GetComponent <Button>().interactable)
        {
            return;
        }
        SoundManager.Instance.PlaySound("音效/按钮");
        PokerOperationType pokerOperationType = PokerOperationType.Discard;
        string             par = "";

        if (sender.name == "Button1")
        {
            pokerOperationType = PokerOperationType.Follow;
        }
        else if (sender.name == "Button2")
        {
            pokerOperationType = PokerOperationType.Discard;
        }
        else if (sender.name == "Button3")
        {
            ChosieBox.Show(showBattle);
            return;
        }
        else if (sender.name == "Button4")
        {
            pokerOperationType = PokerOperationType.Bet;
            par = sender.GetComponentInChildren <Text>().text;
        }
        else if (sender.name == "Button5")
        {
            pokerOperationType = PokerOperationType.Bet;
            par = sender.GetComponentInChildren <Text>().text;
        }
        else if (sender.name == "Button6")
        {
            pokerOperationType = PokerOperationType.Bet;
            par = sender.GetComponentInChildren <Text>().text;
        }
        Hide();
        GameObject.FindObjectOfType <Page_Poker>().SendCommand.SendOperationBack(pokerOperationType, BtnLook.isOn, par);
    }
Exemplo n.º 2
0
        public void OperationBack(string accountID, PokerOperationType operationType, bool look, string par1)
        {
            Countdown.ClearCommand();
            PokerSide currentSider = Battle.Sides.FirstOrDefault(c => c.AccountID == accountID);
            int       uid          = Convert.ToInt32(accountID);

            if (operationType == PokerOperationType.Bet)
            {
                int goldnum = Convert.ToInt32(par1);
                if (look && !currentSider.IsFlipCard)
                {
                    goldnum = goldnum + this.Battle.CurrentNoteNum;
                    currentSider.IsFlipCard = true;
                }
                currentSider.BatGold       = goldnum;
                currentSider.Gold         -= goldnum;
                this.Battle.CurrentNoteNum = goldnum;
            }
            else if (operationType == PokerOperationType.CompareCard)
            {
                string    targetAccountID = par1;
                PokerSide targetSider     = Battle.Sides.FirstOrDefault(c => c.AccountID == targetAccountID);

                int goldnum = this.Battle.CurrentNoteNum * 2;
                if (currentSider.IsFlipCard && targetSider.IsFlipCard)
                {
                    goldnum = this.Battle.CurrentNoteNum;
                }
                if (look)
                {
                    currentSider.IsFlipCard = true;
                }
                List <PokerCard> currentSiderCards = new List <PokerCard>(currentSider.Cards);
                List <PokerCard> targetSiderCards  = new List <PokerCard>(targetSider.Cards);
                int compareResult = PokerHelper.CardGroupCompare(ref currentSiderCards, ref targetSiderCards);
                if (compareResult <= 0)
                {
                    currentSider.IsDisCard = true;
                }
                else
                {
                    targetSider.IsDisCard = true;
                }
                currentSider.BatGold = goldnum;
                currentSider.Gold   -= goldnum;
            }
            else if (operationType == PokerOperationType.Discard)
            {
                currentSider.IsDisCard = true;
            }
            else if (operationType == PokerOperationType.Follow)
            {
                int goldnum = this.Battle.CurrentNoteNum;
                if (look && !currentSider.IsFlipCard)
                {
                    goldnum = goldnum + this.Battle.CurrentNoteNum;
                    currentSider.IsFlipCard = true;
                }
                currentSider.BatGold       = goldnum;
                currentSider.Gold         -= goldnum;
                this.Battle.CurrentNoteNum = goldnum;
            }
            Battle.OperationType = operationType;
            Battle.OperationLook = look;
            Battle.OperationPar1 = par1;
            ToPokerCleintCommand.SendToClient(PokerCommand.OperationBack, Battle);

            //每回合扣玩家金币,把金币放到战斗托管中心
            ThisTrunOperationNum++;
            if (ThisTrunOperationNum >= Battle.Sides.Count)
            {
                Battle.TrunNum++;
                ThisTrunOperationNum = 0;
                foreach (var s in Battle.Sides)
                {
                    if (s.BatGold > 0)
                    {
                        this.Battle.BetGoldNum += s.BatGold;
                        new AccountService().DeductedGold(int.Parse(s.AccountID), s.BatGold);
                    }
                    s.BatGold = 0;
                }
                ToPokerCleintCommand.SendToClient(PokerCommand.OneTrunComplated, Battle);
            }
            Operation();
        }
Exemplo n.º 3
0
        public void OperationBack(string battleID, string accountID, PokerOperationType operationType, bool look, string par1)
        {
            PokerBattleground bg = PokerBattlegroundManager.Instance.Find(battleID);

            bg.OperationBack(accountID, operationType, look, par1);
        }
Exemplo n.º 4
0
 public void SendOperationBack(PokerOperationType operationType, bool look, string par1)
 {
     Send("ToPokerServerCommand/OperationBack", BattleCode, UserID, operationType, look, par1);
 }