Beispiel #1
0
 public void ChangeTable(PokerBattle battle)
 {
     if (battle.Msg == "-1")
     {
         App.Instance.HintBox.Show("本次押注结算后才可离开");
     }
     else
     {
         if (battle.Msg == GlobalVariable.LoginUser.ID.ToString())
         {
             App.Instance.DetailPageBox.Hide();
             if (Page_Poker != null)
             {
                 App.Instance.PageGroup.ShowPage("Page_Poker", true, Page_Poker.MatchType, battle.ID);
             }
         }
         else
         {
             PokerSide side = battle.Sides.FirstOrDefault(c => c.AccountID == battle.Msg);
             if (side != null)
             {
                 battle.Sides.Remove(side);
             }
         }
     }
     SynchronousData(battle);
     Sender.SetCommandLazyTime(0);
 }
Beispiel #2
0
    public void Show(PokerBattle battle)
    {
        DataBattle = battle;
        this.gameObject.SetActive(true);
        Content.GetComponent <RectTransform>().DOLocalMoveX(140, 0.3f);
        for (int i = 0; i < List.transform.childCount; i++)
        {
            List.transform.GetChild(i).gameObject.SetActive(false);
        }

        List <PokerPlayerUICtr> playerList = GameObject.FindObjectOfType <Page_Poker>().PlayerUIList.Where(c => c.gameObject.activeInHierarchy).ToList();

        for (int i = 0; i < playerList.Count; i++)
        {
            if (playerList[i].UID == Session.UserID)
            {
                continue;
            }
            PokerSide side = battle.Sides.FirstOrDefault(c => c.AccountID == playerList[i].UID.ToString());
            if (side == null || side.IsDisCard)
            {
                continue;
            }
            GameObject item = List.transform.GetChild(i).gameObject;
            item.name = "Player_" + playerList[i].UID;
            item.SetActive(true);
            item.transform.Find("Name").GetComponent <Text>().text = playerList[i].Name.text;
            item.transform.Find("FriendIcon").GetComponent <RawImage>().texture = playerList[i].Face.texture;
            item.transform.Find("Gold").GetComponent <Text>().text = playerList[i].Num.text;
            EventListener.Get(item).onClick = OnPlayerItemClicked;
        }
    }
Beispiel #3
0
    public void Show(string name, string face, int gold, int vip, int uid, PokerSide side, bool isSessionPlayer, bool isCurrentPlayer)
    {
        if (side.IsDisCard)
        {
            QiPai.gameObject.SetActive(true);
        }
        else
        {
            QiPai.gameObject.SetActive(false);
        }
        if (side.BatGold == 0)
        {
            XiaZhu.gameObject.SetActive(false);
        }
        ShowCard(side, isSessionPlayer);
        LookSelfCard(side, isSessionPlayer);

        Name.text       = name;
        NameBorder.text = name;
        UID             = uid;
        Num.text        = gold.ToString();
        this.gameObject.SetActive(true);
        TextMsg.gameObject.SetActive(false);
        if (isCurrentPlayer)
        {
            ActivedSignal.gameObject.SetActive(true);
        }
        else
        {
            ActivedSignal.gameObject.SetActive(false);
        }

        if (IsShow)
        {
            return;
        }
        IsShow = true;
        App.Instance.ShowImage(Face, face);
        if (vip == 0)
        {
            VipBorder.texture = App.Instance.ImageManger.Get("VIP0").texture;
            Name.color        = new Color(178 / 255f, 134 / 255f, 86 / 255f, 1);
        }
        else if (vip == 1)
        {
            VipBorder.texture = App.Instance.ImageManger.Get("VIP1").texture;
            Name.color        = new Color(178 / 255f, 134 / 255f, 86 / 255f, 1);
        }
        else if (vip == 2)
        {
            VipBorder.texture = App.Instance.ImageManger.Get("VIP2").texture;
            Name.color        = new Color(251 / 255f, 236 / 255f, 108 / 255f, 1);
        }
        else if (vip == 3)
        {
            VipBorder.texture = App.Instance.ImageManger.Get("VIP3").texture;
            Name.color        = new Color(183 / 255f, 55 / 255f, 219 / 255f, 1);
        }
    }
Beispiel #4
0
    public void ShowCardType(PokerSide side)
    {
        CardType.gameObject.SetActive(true);
        List <PokerCard> cardList = new List <PokerCard>(side.Cards);
        PokerCardType    cardType = PokerHelper.GetCardsType(ref cardList);

        CardType.sprite = Resources.Load <Sprite>("cardtype/" + cardType);
    }
Beispiel #5
0
 private void LicensingToOneSide(PokerSide oneSide, int num)
 {
     for (int i = 0; i < num; i++)
     {
         PokerCard card = CardLibrary.FirstOrDefault();
         oneSide.Cards.Add(card);
         CardLibrary.Remove(card);
     }
 }
Beispiel #6
0
    IEnumerator Start()
    {
        btnSit.SetActive(false);

        while (PokerObserver.Game.gameDetails == null)
        {
            yield return(new WaitForEndOfFrame());
        }

        bool active = false;

        if (PokerObserver.Game.MAX_PLAYER_IN_GAME == 5)
        {
            if (CurrentSide == PokerSide.Slot_1)
            {
                active = true;
            }
            else if (CurrentSide == PokerSide.Slot_3)
            {
                CurrentSide = PokerSide.Slot_2;
                active      = true;
            }
            else if (CurrentSide == PokerSide.Slot_5)
            {
                CurrentSide = PokerSide.Slot_3;
                active      = true;
            }
            else if (CurrentSide == PokerSide.Slot_6)
            {
                CurrentSide = PokerSide.Slot_4;
                active      = true;
            }
            else if (CurrentSide == PokerSide.Slot_8)
            {
                CurrentSide = PokerSide.Slot_5;
                active      = true;
            }
            else if (CurrentSide == PokerSide.Slot_2)
            {
                CurrentSide = PokerSide.Slot_6;
            }
            else if (CurrentSide == PokerSide.Slot_4)
            {
                CurrentSide = PokerSide.Slot_7;
            }
            else if (CurrentSide == PokerSide.Slot_7)
            {
                CurrentSide = PokerSide.Slot_8;
            }
        }
        else
        {
            active = true;
        }

        SetActiveButton(active);
    }
Beispiel #7
0
 void ExcuteTimeOut()
 {
     LogHelper.Log("Poker ExcuteTimeOut:" + CurrentCommand);
     if (CurrentCommand == PokerCommand.Operation)//播色子动画超时
     {
         PokerSide currentSide = Battleground.Battle.Sides.FirstOrDefault(c => c.Order == Battleground.Battle.CurrentSideOrder);
         Battleground.OperationBack(currentSide.AccountID, PokerOperationType.Discard, false, "");
     }
 }
Beispiel #8
0
        public void Settlement()
        {
            LogHelper.DebugLog("Settlement begin1...");
            //自动结算,如果当前只有一个玩家,这个玩家赢得所有,如果不只一个就开始比牌
            List <PokerSide> winSides = new List <PokerSide>();

            foreach (var s in Battle.Sides)
            {
                if (s.IsFlipCard)
                {
                    continue;
                }
                if (winSides.Count == 0)
                {
                    winSides.Add(s);
                }
                else
                {
                    PokerSide        oneSide           = winSides.FirstOrDefault();
                    List <PokerCard> currentSiderCards = new List <PokerCard>(oneSide.Cards);
                    List <PokerCard> targetSiderCards  = new List <PokerCard>(s.Cards);
                    int compareResult = PokerHelper.CardGroupCompare(ref currentSiderCards, ref targetSiderCards);
                    if (compareResult == 0)
                    {
                        winSides.Add(s);
                    }
                    else if (compareResult < 0)
                    {
                        winSides.Clear();
                        winSides.Add(s);
                    }
                }
            }
            //开始结算金币
            LogHelper.DebugLog("Settlement begin2...");
            if (winSides.Count > 0)
            {
                int winGold = Battle.BetGoldNum / winSides.Count;
                foreach (var s in winSides)
                {
                    s.WinGold = winGold;
                    s.Gold   += winGold;
                    try
                    {
                        new AccountService().WinGold(int.Parse(s.AccountID), winGold);
                    }
                    catch (Exception ex)
                    {
                        LogHelper.LogError(ex.StackTrace);
                    }
                }
            }
            LogHelper.DebugLog("Settlement begin3...");
            ToPokerCleintCommand.SendToClient(PokerCommand.Settlement, Battle);
            CleanUpAndRestart();
        }
Beispiel #9
0
    /// <summary>
    /// 同步数据,玩家在网络不好,或是断线重连时会直接显示当前数据
    /// </summary>
    /// <param name="battle"></param>
    public void SynchronousData(PokerBattle battle)
    {
        Sender.BattleCode = battle.ID;
        if (Page_Poker == null)
        {
            return;
        }
        if (battle.IsStarted)
        {
            Page_Poker.BattleCanOperation();
        }

        //同步玩家信息
        PokerSide mySide = battle.Sides.FirstOrDefault(c => c.AccountID == Sender.UserID);

        if (mySide == null)
        {
            return;
        }
        int orderOffset = mySide.Order - 1;

        foreach (var p in Page_Poker.PlayerUIList)
        {
            int newOrder = p.Order + orderOffset;
            if (newOrder > 5)
            {
                newOrder = newOrder % 5;
            }

            PokerSide side = battle.Sides.FirstOrDefault(c => c.Order == newOrder);
            if (side != null)
            {
                p.Show(side.NickName, side.Face, side.Gold, side.Vip, System.Convert.ToInt32(side.AccountID), side, side.AccountID == Session.UserID.ToString(), side.Order == battle.CurrentSideOrder);
            }
            else
            {
                p.gameObject.SetActive(false);
            }
        }

        Page_Poker.BattleUICtr.ChangeUI(battle.TrunNum, battle.BetGoldNum);
        if (battle.CurrentSideOrder == mySide.Order && battle.Step == PokerCommand.Operation)
        {
            Page_Poker.OperationUICtr.Show(battle, false);
            Page_Poker.BattleUICtr.DownNumCtr.Begin();
        }
        else
        {
            Page_Poker.OperationUICtr.Hide();
            Page_Poker.BattleUICtr.DownNumCtr.Hide();
        }
    }
Beispiel #10
0
 public void LookSelfCard(PokerSide side, bool isSessionPlayer)
 {
     foreach (var c in Cards)
     {
         if (isSessionPlayer && side.IsFlipCard)
         {
             c.Flip();
         }
         else
         {
             c.DeFlip();
         }
     }
 }
Beispiel #11
0
        public void Leave(string accountID)
        {
            PokerSide side = Battle.Sides.FirstOrDefault(c => c.AccountID == accountID);

            if (side.BatGold > 0)
            {
                Battle.Msg = "-1";
            }
            else
            {
                Battle.Msg = accountID;
                ToPokerCleintCommand.SendToClient(PokerCommand.Leave, Battle);
                Battle.Sides.Remove(side);
            }
        }
Beispiel #12
0
 public void ShowBetGold(PokerSide side, bool isCurrentPlayer)
 {
     if (side.BatGold == 0)
     {
         return;
     }
     XiaZhu.gameObject.SetActive(true);
     if (isCurrentPlayer)
     {
         XiaZhuNum.text = side.BatGold.ToString();
         //金币动画
         XiaZhu.transform.localScale = Vector3.zero;
         XiaZhu.transform.DOScale(0.6f, 0.16f);
         PlayGoldToMyBet(side.BatGold);
     }
 }
Beispiel #13
0
    IEnumerator Start()
    {
        btnSit.SetActive(false);

        while (PokerObserver.Game.gameDetails == null)
            yield return new WaitForEndOfFrame();

        bool active = false;
        if(PokerObserver.Game.MAX_PLAYER_IN_GAME == 5)
        {
            if (CurrentSide == PokerSide.Slot_1)
                active = true;
            else if (CurrentSide == PokerSide.Slot_3)
            {
                CurrentSide = PokerSide.Slot_2;
                active = true;
            }
            else if (CurrentSide == PokerSide.Slot_5)
            {
                CurrentSide = PokerSide.Slot_3;
                active = true;
            }
            else if (CurrentSide == PokerSide.Slot_6)
            {
                CurrentSide = PokerSide.Slot_4;
                active = true;
            }
            else if (CurrentSide == PokerSide.Slot_8)
            {
                CurrentSide = PokerSide.Slot_5;
                active = true;
            }
            else if (CurrentSide == PokerSide.Slot_2)
                CurrentSide = PokerSide.Slot_6;
            else if (CurrentSide == PokerSide.Slot_4)
                CurrentSide = PokerSide.Slot_7;
            else if (CurrentSide == PokerSide.Slot_7)
                CurrentSide = PokerSide.Slot_8;
        }
        else
        {
            active = true;
        }

        SetActiveButton(active);
    }
Beispiel #14
0
    public void Settlement(PokerBattle battle)
    {
        TheBattle = battle;
        //播放玩家获得金币动画
        PokerSide mySide = battle.Sides.FirstOrDefault(c => c.AccountID == Sender.UserID);

        if (mySide == null)
        {
            return;
        }
        int   orderOffset = mySide.Order - 1;
        float maxTime     = 0;

        foreach (var p in Page_Poker.PlayerUIList)
        {
            int newOrder = p.Order + orderOffset;
            if (newOrder > 5)
            {
                newOrder = newOrder % 5;
            }
            PokerSide side = battle.Sides.FirstOrDefault(c => c.Order == newOrder);
            if (side != null && side.WinGold > 0)
            {
                float needTime = p.PlayGoldAllBetToMySelf(side.WinGold);
                if (needTime > maxTime)
                {
                    maxTime = needTime;
                }
            }
            //所有玩家翻牌
            if (side != null && !side.IsDisCard)
            {
                foreach (var card in p.Cards)
                {
                    card.Flip();
                }
                p.ShowCardType(side);
            }
        }
        this.Invoke("OnSettlementComplatedSynchronousData", maxTime);
        Sender.SetCommandLazyTime(maxTime + 2f);
    }
Beispiel #15
0
        public void SendTextMsg(string battleID, string accountID, string textData)
        {
            LogHelper.DebugLog("Poker收到:" + accountID + "  发来的SendTextMsg");
            PokerBattleground bg           = PokerBattlegroundManager.Instance.Find(battleID);
            SocketServer      socketServer = PokerServer.Instance.GetServer();

            PokerBattle soundBattle = new PokerBattle();
            PokerSide   currentSide = bg.Battle.Sides.FirstOrDefault(c => c.AccountID == accountID);

            soundBattle.CurrentSideOrder = currentSide.Order;
            soundBattle.Sides            = bg.Battle.Sides;
            soundBattle.Step             = PokerCommand.SendTextMsg;
            soundBattle.Msg = textData;

            LemonMessage msg = new LemonMessage();

            msg.Body = new JsonSerialize().SerializeToString(soundBattle);

            ToPokerCleintCommand.SendMsgToAllClient(PokerCommand.SendTextMsg, soundBattle, msg);
        }
Beispiel #16
0
    void OnPlayerItemClicked(GameObject sender)
    {
        Hide();
        string    id         = sender.name.Split('_')[1];
        PokerSide mySide     = DataBattle.Sides.FirstOrDefault(c => c.AccountID == Session.UserID.ToString());
        PokerSide targetSide = DataBattle.Sides.FirstOrDefault(c => c.AccountID == id);
        int       goldnum    = DataBattle.CurrentNoteNum * 2;

        if (mySide.IsFlipCard && targetSide.IsFlipCard)
        {
            goldnum = DataBattle.CurrentNoteNum;
        }
        if (mySide.Gold < goldnum)
        {
            App.Instance.HintBox.Show("金币不足");
            return;
        }
        bool islook = GameObject.FindObjectOfType <PokerOperationUICtr>().BtnLook.isOn;

        GameObject.FindObjectOfType <Page_Poker>().SendCommand.SendOperationBack(PokerOperationType.CompareCard, islook, id);
    }
Beispiel #17
0
    void OnBtnLookClicked(GameObject sender)
    {
        PokerSide mySide = showBattle.Sides.FirstOrDefault(c => c.AccountID == Session.UserID.ToString());

        SoundManager.Instance.PlaySound("音效/按钮");
        BtnLook.isOn = true;
        if (mySide.IsFlipCard)
        {
            return;
        }
        List <PokerPlayerUICtr> plist    = GameObject.FindObjectOfType <Page_Poker>().PlayerUIList;
        PokerPlayerUICtr        myPlayer = plist.FirstOrDefault(c => c.UID == Session.UserID);

        if (myPlayer != null)
        {
            foreach (var card in myPlayer.Cards)
            {
                card.Flip();
            }
        }
        Show(showBattle, BtnLook.isOn);
    }
Beispiel #18
0
    public void OneTrunComplated(PokerBattle battle)
    {
        Page_Poker.BattleUICtr.ReStartTip.gameObject.SetActive(false);
        TheBattle = battle;
        if (battle.IsStarted)
        {
            Page_Poker.BattleCanOperation();
        }
        //播放玩家下注的金币动画
        PokerSide mySide = battle.Sides.FirstOrDefault(c => c.AccountID == Sender.UserID);

        if (mySide == null)
        {
            return;
        }
        int   orderOffset = mySide.Order - 1;
        float maxTime     = 0;

        foreach (var p in Page_Poker.PlayerUIList)
        {
            int newOrder = p.Order + orderOffset;
            if (newOrder > 5)
            {
                newOrder = newOrder % 5;
            }
            PokerSide side = battle.Sides.FirstOrDefault(c => c.Order == newOrder);
            if (side != null)
            {
                float needTime = p.PlayGoldToAllBet(battle.CurrentNoteNum);
                if (needTime > maxTime)
                {
                    maxTime = needTime;
                }
            }
        }
        this.Invoke("OnComplatedSynchronousData", maxTime);
        Sender.SetCommandLazyTime(maxTime + 0.1f);
    }
Beispiel #19
0
 public void Operation()
 {
     if (Battle.TrunNum >= 10 || Battle.Sides.Count(c => !c.IsDisCard) <= 1)
     {
         Settlement();
         return;
     }
     if (Battle.CurrentSideOrder == 0)
     {
         int randomIndex = random.Next(0, Battle.Sides.Count);
         Battle.CurrentSideOrder = Battle.Sides[randomIndex].Order;
     }
     else
     {
         PokerSide side = Battle.Sides.FirstOrDefault(c => c.Order == (Battle.CurrentSideOrder + 1));
         if (side == null)
         {
             side = Battle.Sides.OrderBy(c => c.Order).FirstOrDefault();
         }
         Battle.CurrentSideOrder = side.Order;
     }
     Countdown.SetCommand(PokerCommand.Operation);
     ToPokerCleintCommand.SendToClient(PokerCommand.Operation, Battle);
 }
Beispiel #20
0
    public void OperationBack(PokerBattle battle)
    {
        SynchronousData(battle);
        //播放玩家下注的金币动画
        PokerSide mySide = battle.Sides.FirstOrDefault(c => c.AccountID == Sender.UserID);

        if (mySide == null)
        {
            return;
        }
        int orderOffset = mySide.Order - 1;

        foreach (var p in Page_Poker.PlayerUIList)
        {
            int newOrder = p.Order + orderOffset;
            if (newOrder > 5)
            {
                newOrder = newOrder % 5;
            }
            PokerSide side = battle.Sides.FirstOrDefault(c => c.Order == newOrder);
            if (side != null)
            {
                p.ShowBetGold(side, battle.CurrentSideOrder == side.Order);
            }
        }
        string soundSex = PlayerPrefs.GetString("SoundSex");

        if (battle.OperationType == PokerOperationType.Bet)
        {
            if (soundSex == "Man")
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_RAISE_MALE_SOUND");
            }
            else
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_RAISE_FEMALE_SOUND");
            }
            Sender.SetCommandLazyTime(2.3f);
        }
        else if (battle.OperationType == PokerOperationType.Follow)
        {
            if (soundSex == "Man")
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_CALL_MALE_SOUND");
            }
            else
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_CALL_FEMALE_SOUND");
            }
            Sender.SetCommandLazyTime(2.3f);
        }
        else if (battle.OperationType == PokerOperationType.Discard)
        {
            if (soundSex == "Man")
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_FOLD_MALE_SOUND");
            }
            else
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_FOLD_FEMALE_SOUND");
            }
            Sender.SetCommandLazyTime(0.1f);
        }
        else if (battle.OperationType == PokerOperationType.CompareCard)
        {
            if (soundSex == "Man")
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_BP_MALE_SOUND");
            }
            else
            {
                SoundManager.Instance.PlaySound("PokerSound/OX_BP_FEMALE_SOUND");
            }
            PokerSide currentSide = battle.Sides.FirstOrDefault(c => c.Order == battle.CurrentSideOrder);
            if (currentSide != null)
            {
                PokerPlayerUICtr currentPlayer = Page_Poker.PlayerUIList.FirstOrDefault(c => c.UID == int.Parse(currentSide.AccountID));
                PokerPlayerUICtr targetPlayer  = Page_Poker.PlayerUIList.FirstOrDefault(c => c.UID == int.Parse(battle.OperationPar1));
                if (currentPlayer != null &&
                    targetPlayer != null &&
                    (mySide.AccountID == currentPlayer.UID.ToString() || mySide.AccountID == targetPlayer.UID.ToString()))
                {
                    //播放3秒,3秒后再处理新命令
                    Page_Poker.SendCommand.SetCommandLazyTime(3);

                    foreach (var card in currentPlayer.Cards)
                    {
                        card.Flip();
                    }

                    foreach (var card in targetPlayer.Cards)
                    {
                        card.Flip();
                    }
                }
            }

            Sender.SetCommandLazyTime(5f);
        }
    }
Beispiel #21
0
    public void Show(PokerBattle battle, bool look)
    {
        showBattle = battle;
        this.gameObject.SetActive(true);
        PokerSide mySide = battle.Sides.FirstOrDefault(c => c.AccountID == Session.UserID.ToString());

        if (battle.TrunNum > 1)
        {
            BtnLook.gameObject.SetActive(true);
        }
        else
        {
            BtnLook.gameObject.SetActive(false);
        }
        int noteNum = battle.CurrentNoteNum;

        if (look)
        {
            noteNum = noteNum * 2;
        }
        if (mySide.Gold < noteNum)
        {
            BtnList[0].interactable = false;
            BtnList[2].interactable = false;
        }
        else
        {
            BtnList[0].interactable = true;
            BtnList[2].interactable = true;
        }

        BtnList[3].GetComponentInChildren <Text>().text = (noteNum * 2).ToString();
        if (mySide.Gold < noteNum * 2)
        {
            BtnList[3].interactable = false;
        }
        else
        {
            BtnList[3].interactable = true;
        }
        BtnList[4].GetComponentInChildren <Text>().text = (noteNum * 4).ToString();
        if (mySide.Gold < noteNum * 4)
        {
            BtnList[4].interactable = false;
        }
        else
        {
            BtnList[4].interactable = true;
        }
        BtnList[5].GetComponentInChildren <Text>().text = (noteNum * 6).ToString();
        if (mySide.Gold < noteNum * 6)
        {
            BtnList[5].interactable = false;
        }
        else
        {
            BtnList[5].interactable = true;
        }
        if (!look)
        {
            if (mySide.IsFlipCard)
            {
                BtnLook.isOn = true;
            }
            else
            {
                BtnLook.isOn = false;
            }
        }
    }
Beispiel #22
0
 public PokerGPSide GetPokerSide(PokerSide side)
 {
     return(Array.Find <PokerGPSide>(arrayPokerSide, s => s.CurrentSide == side));
 }
Beispiel #23
0
    public void SendTextMsg(PokerBattle battle)
    {
        string[] msgData    = battle.Msg.Split('|');
        string   msgName    = msgData[0];
        string   soundSex   = msgData[1];
        string   msgContent = msgData[2];

        PokerSide mySide      = battle.Sides.FirstOrDefault(c => c.AccountID == Sender.UserID);
        int       orderOffset = mySide.Order - 1;

        foreach (var p in Page_Poker.PlayerUIList)
        {
            int newOrder = p.Order + orderOffset;
            if (newOrder > 5)
            {
                newOrder = newOrder % 5;
            }
            if (newOrder == battle.CurrentSideOrder)
            {
                p.ShowText(msgContent);
            }
        }


        if (soundSex == "Man")
        {
            if (msgName == "ChatMoreUsed01")
            {
                SoundManager.Instance.PlaySound("语音/男1");
            }
            else if (msgName == "ChatMoreUsed03")
            {
                SoundManager.Instance.PlaySound("语音/男2");
            }
            else if (msgName == "ChatMoreUsed05")
            {
                SoundManager.Instance.PlaySound("语音/男3");
            }
            else if (msgName == "ChatMoreUsed07")
            {
                SoundManager.Instance.PlaySound("语音/男4");
            }
            else if (msgName == "ChatMoreUsed09")
            {
                SoundManager.Instance.PlaySound("语音/男5");
            }
        }
        else
        {
            if (msgName == "ChatMoreUsed01")
            {
                SoundManager.Instance.PlaySound("语音/女1");
            }
            else if (msgName == "ChatMoreUsed03")
            {
                SoundManager.Instance.PlaySound("语音/女2");
            }
            else if (msgName == "ChatMoreUsed05")
            {
                SoundManager.Instance.PlaySound("语音/女3");
            }
            else if (msgName == "ChatMoreUsed07")
            {
                SoundManager.Instance.PlaySound("语音/女4");
            }
            else if (msgName == "ChatMoreUsed09")
            {
                SoundManager.Instance.PlaySound("语音/女5");
            }
            else if (msgName == "ChatMoreUsed11")
            {
                SoundManager.Instance.PlaySound("语音/女6");
            }
        }

        Sender.SetCommandLazyTime(0);
    }
Beispiel #24
0
    private void ShowCard(PokerSide side, bool isSessionPlayer)
    {
        if (side.Cards.Count == 0)
        {
            CardParent.SetActive(false);
            Vector2 pos = Vector2.zero;
            if (side.Order == 1)
            {
                pos = new Vector2(131.5f, 71.1f);
            }
            else if (side.Order == 2)
            {
                pos = new Vector2(214.4001f, -12.5f);
            }
            else if (side.Order == 3)
            {
                pos = new Vector2(215f, -121.9f);
            }
            else if (side.Order == 4)
            {
                pos = new Vector2(-87.89999f, -121.9f);
            }
            else if (side.Order == 5)
            {
                pos = new Vector2(-88.60001f, -13.7f);
            }
            for (int i = 0; i < Cards.Count; i++)
            {
                PokerCardCtr card = Cards[i];
                card.GetComponent <RectTransform>().anchoredPosition = pos;
            }
        }
        else
        {
            CardParent.SetActive(true);

            if (IsCardShowed)
            {
                return;
            }
            IsCardShowed = true;
            float intervalTime = 0;
            for (int i = 0; i < Cards.Count; i++)
            {
                PokerCardCtr card = Cards[i];
                card.Show(side.Cards[i].Color, side.Cards[i].Num);
                Sequence sequence = DOTween.Sequence();
                sequence.AppendInterval(intervalTime);
                sequence.AppendCallback(new TweenCallback(PlayCardSound));
                if (isSessionPlayer)
                {
                    sequence.Append(card.GetComponent <RectTransform>().DOLocalMove(new Vector3(-112 + i * 54, 0, 0), 0.3f));
                }
                else
                {
                    sequence.Append(card.GetComponent <RectTransform>().DOLocalMove(new Vector3(-112 + i * 20, 0, 0), 0.3f));
                }
                intervalTime = intervalTime + 0.3f;
            }
        }
    }
 public PokerGPSide GetPokerSide(PokerSide side)
 {
     return Array.Find<PokerGPSide>(arrayPokerSide, s => s.CurrentSide == side);
 }
Beispiel #26
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();
        }