Example #1
0
 // 发起解散投票
 public void StartHandsUp(int yon)
 {
     if (!App.GetGameManager <Mahjong2DGameManager>().IsGameing&& Data.IsFirstTime)
     {
         //局外只有房主才能解散,其他玩家只能退出
         if (App.GetGameManager <Mahjong2DGameManager>().SelfPlayer.UserInfo.id == App.GetGameData <Mahjong2DGameData>().OwnerId)
         {
             YxDebug.Log("局外房主申请");
             SendFrameRequest("dissolve", new SFSObject());
         }
         else
         {
             YxMessageBox.Show("非房主不能发起解散!", null, null, true);
         }
     }
     else
     {
         //局内任何玩家都可以发起投票
         ISFSObject iobj = new SFSObject();
         iobj.PutUtfString(RequestKey.Cmd, "dismiss");
         iobj.PutInt(RequestKey.KeyType, yon);
         iobj.PutInt(RequestKey.KeyId, App.GetGameManager <Mahjong2DGameManager>().SelfPlayer.UserInfo.id);
         SendFrameRequest(RequestCmd.HandsUp, iobj);
     }
 }
Example #2
0
        /// <summary>
        /// 显示玩家之间距离信息和地址信息
        /// </summary>
        public void ShowDistince(GpsUser[] users)
        {
            YxDebug.Log("GSP User 数量是:" + users.Length);
            if (users.Length == 1)
            {
                return;
            }
            for (int i = 0; i < users.Length; i++)
            {
                int nextSeat = (i + 1) % users.Length;

                if (users[i].NextSeat.Equals(users[nextSeat].LocalSeat))
                {
                    string des = string.Empty;
                    if (users[i].IsGpsInfo && users[nextSeat].IsGpsInfo)
                    {
                        int distance = (int)GetDistince(users[i].GpsX, users[i].GpsY, users[nextSeat].GpsX, users[nextSeat].GpsY);
                        if (distance < 1000)
                        {
                            des = distance < 100 ? "<=100m" : string.Format("距离:{0}M", distance);
                        }
                        else
                        {
                            des = string.Format("距离:{0} KM", distance / 1000f);
                        }
                        users[i].Line.SetActive(true);
                    }
                    users[i].DistanceLabel.text = des;
                }
                else
                {
                    users[i].Line.SetActive(false);
                }
            }
        }
Example #3
0
        /// <summary>
        /// 发送准备信息
        /// </summary>
        public void ReadyGame()
        {
            YxDebug.Log("发送准备!!");
            var key = GameKey + RequestCmd.Ready;

            SendFrameRequest(key, SFSObject.NewInstance());
        }
Example #4
0
        /// <summary>
        /// 初始化玩家的手牌信息
        /// </summary>
        /// <param name="info"></param>
        /// <returns></returns>
        UserMatchInfo GetMatchInfo(ISFSObject info)
        {
            UserMatchInfo userMatchInfo = ParseMatchInfo(info);

            ISFSArray cardInfos = info.GetSFSArray("duninfo") ?? info.GetSFSObject("duns").GetSFSArray("duninfo");

            AddDunInfo(ref userMatchInfo, cardInfos);

            //检测
            YxDebug.LogArray(userMatchInfo.Cards);
            if (userMatchInfo.Cards.Count != 13)
            {
                Debug.LogError("手牌不是十三张!!");
                string errorMsg = string.Empty;
                foreach (var card in userMatchInfo.Cards)
                {
                    errorMsg += card + " , ";
                }
                Debug.LogError(errorMsg);
            }

            ISFSObject userScore = info.GetSFSObject("userscore");

            AddScoreInfo(ref userMatchInfo, userScore);

            if (info.ContainsKey("daqiang"))
            {
                userMatchInfo.Shoot = GetShootInfo(info);
            }

            return(userMatchInfo);
        }
Example #5
0
        IEnumerator CardValueForStart()
        {
            if (MyCardsValueList.Count != CardItemList.Count)
            {
                YxDebug.LogError("手牌与手牌值长度不相等,手牌数为:" + CardItemList.Count + ",值的数量为:" + MyCardsValueList.Count + "手牌值为:");
            }
            for (int i = 0; i < MyCardsValueList.Count; i++)
            {
                CardItemList[i].Value = MyCardsValueList[i];
                CardItemList[i].SetCardDepth(i);
                yield return(new WaitForSeconds(0.005f));
            }

            FreshHandCard(null);
            CardsArea.GetComponent <UIGrid>().Reposition();
            if (GetInfo <JlGameUserInfo>().ActiveCards != null)
            {
                FreshHandCard(GetInfo <JlGameUserInfo>().ActiveCards);

                GetInfo <JlGameUserInfo>().ActiveCards = null;
                if (!GetInfo <JlGameUserInfo>().IsCurSpeaker)
                {
                    NoCanClickCard();
                }
            }
            if (GetInfo <JlGameUserInfo>().IsTrusteeship)
            {
                ShowTrusteeshipObj(true);
            }

            if (TrusteeshipObj.GetComponent <UIButton>().onClick.Count == 0)
            {
                TrusteeshipObj.GetComponent <UIButton>().onClick.Add(RejoinFresh);
            }
        }
Example #6
0
        IEnumerator ShowPlaneFit(float waitTime, PludoPlane fitPlane, AsyncCallback call = null)
        {
            yield return(new WaitForSeconds(waitTime));

            var planeList = fitPlane.PlaneList.ToList();
            var count     = planeList.Count;

            YxDebug.LogError(string.Format("移动飞机的子飞机有{0}个", count));
            for (int i = 0; i < count; i++)
            {
                var plane = planeList[i];
                plane.PlaneListReset();
                plane.PlaneData.PlaneStateChange((int)EnumPlaneStatus.Fit);
                plane.Hide();
                _planeList.Add(plane);
            }
            if (gameObject.activeInHierarchy)
            {
                StartCoroutine(OnShowFitAction.WaitExcuteCalls());
            }
            FreshPlaneNum();
            yield return(new WaitForSeconds(FitAniTime));

            if (call != null)
            {
                call(null);
            }
        }
Example #7
0
        public override void GameResponseStatus(int type, ISFSObject response)
        {
            YxDebug.Log("------> RemoteServer: OnServerResponse() CMDID = rqst and type = " + type + "" + "! \n");
            var eventCenter = Facade.EventCenter;

            switch ((Mx97RequestCmd)type)
            {
            case Mx97RequestCmd.CmdIdStartGame:
            {
                App.GetGameData <Mx97GlobalData>().SetStartData(response);

                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.SwitchBtnWhenStart);
                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.StartScrollAni);
            }
            break;

            case Mx97RequestCmd.CmdIdJackpotChange:
            {
                // 更新奖池
                App.GetGameData <Mx97GlobalData>().Caichi = response.GetLong("caichi");
                eventCenter.DispatchEvent <Mx97EventType, object>(Mx97EventType.RefreshJackpot);
            }
            break;

                /*   //目前不需要Notice
                 * case Mx97RequestCmd.CmdIdGetMessage:
                 * {
                 * Facade.Instance<MusicManager>().Play("Winning");
                 * var data = response.GetUtfString("data");
                 * StartCoroutine(ShowNotice(data));
                 * }
                 * break;
                 */
            }
        }
Example #8
0
 /// <summary>
 /// 加入比赛
 /// </summary>
 public void JoinMatch()
 {
     if (_curData != null)
     {
         var gameKey  = _curData.GameKey;
         var gameType = _curData.GameType;
         YxDebug.LogError("加入比赛");
         YxDebug.LogError(string.Format("当前比赛的游戏是:{0}房间类型是:{1}", gameKey, gameType));
         var dic = GameListModel.Instance.GameUnitModels;
         if (dic.ContainsKey(gameKey))
         {
             if (_curData.IsQucikGame)
             {
                 OnOpenQuickGame();
             }
             else
             {
                 OnOpenCreateWindow();
             }
         }
         else
         {
             YxMessageBox.Show("咋整地,没配置游戏就想比赛啊!");
         }
     }
 }
Example #9
0
 /// <summary>
 /// 默认返回bets下标0
 /// </summary>
 /// <param name="index">Bets下标</param>
 /// <param name="gold">通过钱获取</param>
 /// <returns></returns>
 public GameObject GetBet(int index = -1, int gold = -1)
 {
     if (index > 0)
     {
         if (index < Bets.Length)
         {
             return(Bets[index]);
         }
         YxDebug.Log("index > Bets的长度!");
         return(Bets[0]);
     }
     if (gold > 0)
     {
         var betValues = App.GetGameData <CschGameData>().AnteRate;
         var len       = betValues.Count;
         for (var i = len - 1; i > 0; i--)
         {
             var bet = betValues[i];
             if (gold >= bet)
             {
                 return(Bets[i]);
             }
         }
         YxDebug.Log("Gold不在BetsValue中!!");
         return(Bets[0]);
     }
     return(Bets[0]);
 }
Example #10
0
        public void Show()
        {
            YxDebug.LogError(" ----- --------------- Show");

            bg.SetActive(true);
            _isShow = true;
        }
Example #11
0
        /// <summary>
        /// 取钱
        /// </summary>
        public void OnGetMoneyClick()
        {
            var count = DrawMoneyLabel.value;
            var pwd   = PassWordLabel.value;

            if (string.IsNullOrEmpty(count))
            {
                YxWindowManager.ShowMessageWindow("请输入正确金额!!!");
                return;
            }
            if (string.IsNullOrEmpty(pwd))
            {
                YxWindowManager.ShowMessageWindow("密码不能为空!!!");
                return;
            }
            var realValue = YxUtiles.RecoverShowNumber(double.Parse(count));

            if (realValue < 1)
            {
                YxWindowManager.ShowMessageWindow("输入金额不在有效范围内,请重新输入!!!");
                return;
            }
            YxDebug.Log("Real value is:" + realValue);
            UserController.Instance.SaveCoin("2", realValue.ToString(), pwd);
            DrawMoneyLabel.value = "";
            if (NeelClearPwd)
            {
                PassWordLabel.value = "";
            }
        }
Example #12
0
        /// <summary>
        /// 设置庄家信息
        /// </summary>
        public void SetBankerInfo(ISFSObject data)
        {
            YxBaseGameUserInfo bankerInfo = null;

            if (data == null)
            {
                bankerInfo = new YxBaseGameUserInfo
                {
                    NickM        = "系统",
                    CoinA        = 1147483647,
                    Seat         = -1,
                    TotalCount   = 0,
                    WinTotalCoin = 0
                };
                Banker.SetMaxCoin(1147483646);
                Banker.Info = bankerInfo;
            }
            else
            {
                var newBanker = new YxBaseGameUserInfo();
                newBanker.Parse(data);
                newBanker.NickM = data.GetUtfString("username");
                var oldBnaker = Banker.Info;
                if (oldBnaker == null || oldBnaker.NickM != newBanker.NickM)
                {
                    YxDebug.Log("重置庄家信息!!");
                    newBanker.NickM        = data.GetUtfString("username");
                    newBanker.CoinA        = data.GetLong("ttgold");
                    newBanker.TotalCount   = 0;
                    newBanker.WinTotalCoin = 0;
                    bankerInfo             = newBanker;
                    Banker.Info            = bankerInfo;
                }
            }
        }
Example #13
0
        public float JudgeY = 0f;                       // 判定点 由于向上移动 故坐标点大于该值时重置为起始位置


        // Use this for initialization
        protected void Start()
        {
            if (JudgeY.Equals(0f))
            {
                YxDebug.LogError("------> StartVec and CenterY and JudgeLen couldn't be null in AniMoveFruit!\n");
            }
        }
Example #14
0
        /// <summary>
        /// 退出游戏
        /// </summary>
        public void QuitGame()
        {
            CloseListView();
            var gdata = App.GetGameData <SssGameData>();

            if (gdata.IsPlaying)
            {
                YxDebug.Log("正在游戏中,无法退出游戏!");
                YxMessageBox.Show(new YxMessageBoxData
                {
                    Msg     = "正在游戏中,无法退出游戏!",
                    Delayed = 5,
                });
            }
            else
            {
                YxDebug.Log("正在退出游戏...");
                bool daikai = gdata.DaiKai;
                bool isMine = App.GetGameManager <SssGameManager>().IsRoomOwner;

                if (!daikai && isMine)
                {
                    DissolveRoomWithMessageBox();
                }
                else
                {
                    QuitWithMessageBox();
                }
            }
        }
Example #15
0
 public void ShowPhiz(int index)
 {
     Show(true);
     if (PhizWithAni)
     {
         UIAtlas atla = AtlasManager.Instance.GetAtlaByName(string.Format(AtlasFormat, index));
         if (atla != null)
         {
             _phiz.atlas = atla;
             UISpriteAnimation ani = _phiz.gameObject.GetComponent <UISpriteAnimation>();
             ani.namePrefix = index.ToString();
             ani.Play();
             int phizWidth  = atla.spriteList[0].width;
             int phizHeight = atla.spriteList[0].height;
             _bgSprite.width  = phizWidth > _phizBgWidth ? phizWidth : _phizBgWidth;
             _bgSprite.height = phizHeight > _phizBgHeight ? phizHeight : _phizBgHeight;
             _bgSprite.gameObject.TrySetComponentValue(true);
         }
         else
         {
             YxDebug.LogError(string.Format("There is not exist such atla,name is {0}", index));
         }
     }
     else
     {
         _phiz.TrySetComponentValue(string.Format(StaticPhizFormat, index));
         _phiz.MakePixelPerfect();
     }
     _phiz.gameObject.SetActive(true);
     DoHide();
 }
Example #16
0
 void Update()
 {
     curretTimer += Time.deltaTime;
     if (curretTimer > MarqueeInterval && canMove == true)
     {
         curretImg = nImg % 24;
         if (nImg == resultNum)
         {
             YxDebug.LogError(result + "转的图片");
             Paoma(curretImg);
             nImg      = curretImg;
             resultNum = -5;
             canMove   = false;
             RefeshTexts();
             StartMali();
         }
         else if (nImg < resultNum)
         {
             Paoma(curretImg);
             nImg++;
             curretTimer = 0f;
         }
         else
         {
             nImg = curretImg;
         }
     }
 }
Example #17
0
        public override void OnGetGameInfo(ISFSObject gameInfo)
        {
            YxDebug.Log("-----------游戏开始--------------");
            var gdata = App.GetGameData <FishGameData>();

            gdata.GameState                = YxGameState.Run;
            State_                         = State.Normal;
            GameOdds.GainRatio             = GameOdds.GainRatios[(int)(BSSetting.GameDifficult_.Val)];
            GameOdds.GainRatioConditFactor = GameOdds.GainRatioConditFactors[(int)(BSSetting.ArenaType_.Val)];
            StartCoroutine(_Coro_MainProcess());
            Pool_GameObj.Init();
            var evtMainProcessStartGame = gdata.EvtMainProcessStartGame;

            if (evtMainProcessStartGame != null)
            {
                evtMainProcessStartGame();
            }
            App.GetGameData <FishGameData>().Msgrate = gameInfo.GetInt(FishRequestKey.Msgrate);
            GameSystemUI.Init(gameInfo);
            PlayersBatterys.Init(gameInfo);
            var self = PlayersBatterys.UserSelf;

            Operation.UserSelf = self;
            if (self.Idx >= PlayersBatterys.Count / 2)
            {
                RotatePond(180);
            }

            FishGenerator.Init(gameInfo);
            StartCoroutine(_Coro_DelayInitGame());
        }
Example #18
0
        /// <summary>
        /// 重连游戏
        /// </summary>
        /// <param name="args"></param>
        protected virtual void OnRejoinGame(DdzbaseEventArgs args)
        {
            var data = args.IsfObjData;

            if (!data.ContainsKey(RequestKey.KeyUser))
            {
                YxDebug.LogEvent("服务器没有发送本人信息");
                return;
            }

            var userSelf = data.GetSFSObject(RequestKey.KeyUser);

            if (!userSelf.ContainsKey(GlobalConstKey.C_Cards))
            {
                if (App.GameData.IsGameStart)
                {
                    YxDebug.LogEvent("服务器没有发送手牌信息");
                }
                return;
            }

            var cards = userSelf.GetIntArray(GlobalConstKey.C_Cards);

            if (cards == null || cards.Length < 1)
            {
                YxDebug.LogEvent("服务器发送手牌信息错误");
                return;
            }

            InitHdCdsArray(cards);
            RefreshUiInfo();
        }
Example #19
0
        /// <summary>
        /// 开始下注
        /// </summary>
        /// <param name="responseData"></param>
        public void OnAnteStart(ISFSObject responseData)
        {
            var gdata = App.GetGameData <TtzGameData>();

            RobBank.RobParentCtrl();

            if (responseData.ContainsKey(InteractParameter.Bkp))
            {
                _bankSeat = responseData.GetInt(InteractParameter.Bkp);
                YxDebug.Log("庄家坐位:" + _bankSeat);
            }

            var cd = responseData.GetInt(InteractParameter.Cd);

            _cdTime = Time.time + cd;
            var antes = responseData.GetUtfString(InteractParameter.Antes);

            _bankAntes = antes.Split(',');

            foreach (var user in gdata.PlayerList)
            {
                var player = (TtzPlayer)user;
                player.SetBanker(false);
            }
            OnBeginAnte();
            StartCoroutine(responseData.ContainsKey(InteractParameter.Banks) ? ShowRandomBankAni(responseData) : BankShake());
        }
Example #20
0
        protected virtual void ToSelectTingOut()
        {
            List <int> outList   = Manager.TingOutCards;
            var        tingCount = outList.Count;

            if (tingCount == 1)
            {
                var         tingValue  = outList[0];
                MahjongItem selectItem = GetHandCard(tingValue);
                if (selectItem)
                {
                    OnMahjongClick(selectItem.transform);
                }
            }
            else
            {
                MahjongEnv.SetHandCardsInvalid();
                InteraptMenu.Instance.Revert();
                InteraptMenu.Instance.ShowTing(true);
                for (int i = 0; i < tingCount; i++)
                {
                    int         checkValue = outList[i];
                    MahjongItem selectItem = GetHandCard(checkValue);
                    if (selectItem != null)
                    {
                        selectItem.SetColor(Color.white);
                        AddUserControl(selectItem);
                    }
                    else
                    {
                        YxDebug.LogError(string.Format("TingOut牌中的牌:{0}值是:{1},不存在于实际手牌中", (EnumMahjongValue)checkValue, checkValue));
                    }
                }
            }
        }
Example #21
0
 public void ShowResultInfo(List <int> list, long betNum, long winNum, int multiple)
 {
     ResetResultPanel();
     for (int i = 0; i < list.Count; i++)
     {
         _resultsParent.GetChild(i).gameObject.SetActive(true);
         //animal
         _resultsParent.GetChild(i).GetChild(0).GetComponent <Image>().sprite =
             App.GetGameData <LswcGameData>().GetSprite(((LSAnimalSpriteType)list[i]).ToString());
         //倍率
         int peiNum = 1;
         if (multiple == 0)
         {
         }
         else
         {
             peiNum = multiple;
         }
         YxDebug.Log(list[i] + "号位的倍率是" + App.GetGameData <LswcGameData>().PeiLvs[list[i]] + ",当前的倍数是:" + peiNum);
         peiNum = App.GetGameData <LswcGameData>().PeiLvs[list[i]] * peiNum;
         _resultsParent.GetChild(i).GetChild(1).GetChild(0).GetComponent <Text>().text = "X" + peiNum.ToString();
     }
     _betNum.text = YxUtiles.GetShowNumberToString(betNum);
     _winNum.text = YxUtiles.GetShowNumberToString(winNum);
     PlayAnimation();
 }
Example #22
0
        public void SendRequest(RequestType rt, IDictionary data)
        {
            if (!HasGetGameInfo)
            {
                return;
            }

            YxDebug.Log("SendRequest == " + rt.ToString());

            var sfsObject = new SFSObject();

            switch (rt)
            {
            case RequestType.Bet:
                if (data.Contains("golds"))
                {
                    sfsObject.PutIntArray("golds", (int[])data["golds"]);
                    sfsObject.PutInt("type", (int)RequestType.Bet);
                    YxDebug.Log("发送重复上轮");
                }
                else
                {
                    sfsObject.PutInt("p", (int)data["p"]);
                    sfsObject.PutInt("gold", (int)data["gold"]);
                    sfsObject.PutInt("type", (int)RequestType.Bet);
                }
                break;

            case RequestType.Reward:
                break;

            case RequestType.ApplyBanker:
                sfsObject.PutInt("type", (int)RequestType.ApplyBanker);
                break;

            case RequestType.ApplyQuit:
                sfsObject.PutInt("type", (int)RequestType.ApplyQuit);
                break;

            case RequestType.BeginBet:
                break;

            case RequestType.EndBet:
                break;

            case RequestType.GiveCards:
                break;

            case RequestType.Result:
                break;

            case RequestType.BankerList:
                break;

            default:
                YxDebug.Log("不存在的服务器交互!");
                return;
            }
            SendFrameRequest(GameKey + RequestCmd.Request, sfsObject);
        }
Example #23
0
 protected override void ActionCallBack()
 {
     if (Data.Equals(_cacheData))
     {
         return;
     }
     _cacheData = Data;
     if (Data is Dictionary <string, object> )
     {
         YxDebug.Log("ActionCallBack is dic");
         WebData        webData = new WebData(Data);
         List <TabData> datas   = webData.Datas;
         FullScreen      = webData.FullScreen;
         _needCleanCache = webData.CleanCache;
         TabDatas        = new TabData[datas.Count];
         datas.CopyTo(TabDatas);
         TabDatas[0].StarttingState = true;
         TabSatate = -1;
         UpdateTabs(TabDatas);
     }
     else
     {
         if (Data is string)
         {
             if (!string.IsNullOrEmpty(Data.ToString()))
             {
                 FullScreen = true;
                 YxDebug.Log("ActionCallBack is string,value is:" + Data.ToString());
                 _url = Data.ToString();
                 InitWebview();
                 ShowView();
             }
         }
     }
 }
Example #24
0
        public void PostGameData(int totalbullet, int bullet, int odds, int coin)
        {
            const int keyLen = 7;
            var       x      = bullet + "," + odds + "," + coin + "," + totalbullet;

            YxDebug.Log(x);
            var cs = new char[keyLen + x.Length];

            int[] encs =
            {
                64,   65,  84,  85,  86,  88,  89,  90,  91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104,
                105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122
            };
            for (var i = 0; i < keyLen; i++)
            {
                cs[i] = (char)encs[Random.Range(0, encs.Length)];
            }
            for (var i = keyLen; i < cs.Length; i++)
            {
                cs[i] = (char)(cs[i % keyLen] ^ x[i - keyLen]);
            }

            var data = SFSObject.NewInstance();

            data.PutInt(RequestKey.KeyType, 0);
            x = new string(cs);
            data.PutUtfString("x", x);
            PostData(data, coin);
        }
Example #25
0
        /// <summary>
        /// 某个玩家打出一张牌,这个打出是到达打出位置
        /// </summary>
        /// <param name="item"></param>
        /// <param name="direct"></param>
        /// <param name="isAuto"></param>
        /// <param name="moveTime"></param>
        public virtual void ThrowOutCard(MahjongItem item, bool direct = false, bool isAuto = false, float moveTime = 0, AsyncCallback finishCall = null)
        {
            MahjongItem newGetItem = _handPile.NewCard.GetIn;//打牌的玩家一定新抓了一张牌,放到手牌中

            if (newGetItem != null)
            {
                if (item.Value != newGetItem.Value)
                {
                    _handPile.AddItem(newGetItem.transform);
                }
            }
            else
            {
                YxDebug.LogError("获得的最后一张牌是空的,应该是谁吃碰杠");
            }
            _handPile.NewCard.GetIn = null;
            if (item != null)
            {
                if (direct)
                {
                    _outPile.ThrowOutCard(item, moveTime, finishCall);
                }
                else
                {
                    _outPile.ThrowOutCard(item, isAuto?ThrowCardTime * AutoTimeRate:ThrowCardTime, finishCall);//找一张牌打出去
                }
            }
            else
            {
                YxDebug.LogError("要打的牌是空的,什么情况?");
            }
        }
Example #26
0
        /// <summary>
        /// 接到语音播放
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="args"></param>
        public void OnUserSpeak(object sender, DdzbaseEventArgs args)
        {
            if (!App.GetGameData <GlobalData>().IsPlayVoiceChat)
            {
                return;
            }

            var param = args.IsfObjData;

            string url  = param.GetUtfString("url");
            int    seat = param.ContainsKey(RequestKey.KeySeat) ? param.GetInt("seat") : 0;
            int    len  = param.ContainsKey("len") ? param.GetInt("len") : 1;

            ChatSystem.DownloadRecord(
                url,
                clip =>
            {
                var info = new VoiceInfo
                {
                    Clip   = clip,
                    Seat   = seat,
                    Length = len,
                };
                _voiceQueue.Enqueue(info);

                PlayVoice();
            },
                err => YxMessageBox.Show("下载音频失败"));

            YxDebug.Log("------> RemoteServer.OnReceiveVoiceChat url=" + url + " seat=" + seat + " len=" + len + "!");
        }
Example #27
0
        public void OnClickCancelAppBtn()
        {
            if (!CouldCancelApp())
            {
                return;
            }

            YxMessageBox.Show(new YxMessageBoxData
            {
                Msg      = "确定要退出应用吗?",
                BtnStyle = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                Listener = (box, btnName) =>
                {
                    if (btnName == YxMessageBox.BtnLeft)
                    {
                        if (!CouldCancelApp())
                        {
                            return;
                        }
                        YxDebug.Log("退出App");
                        Application.Quit();
                    }
                }
            });
        }
Example #28
0
        public override bool OneBulletKillFish(int bulletScore, FishOddsData fishFirst)
        {
            _totalBullet += bulletScore;
            //鱼死亡
            if (fishFirst.Odds <= 1)
            {
                YxDebug.LogError("第一条鱼的odd小于等于一的话就怪了,暂时不可能存在这样的鱼!!,(全屏或者类型炸弹同事出两个可能会出现这种情况)");
                return(false);
            }
            _current -= bulletScore;
            _coin    -= bulletScore;
            int win      = fishFirst.Odds * bulletScore;
            int winScore = _current + win;

            if (OutMaxScore(winScore))
            {
                return(false);
            }
            bool kill = IsKill(fishFirst.Odds);

            if (kill)
            {
                _current += win;
                _coin    += win;
            }
            return(kill);
        }
Example #29
0
        /// <summary>
        /// 解散房间
        /// </summary>
        public void DismissRoom()
        {
            YxDebug.Log("解散房间!");
            IRequest req = new ExtensionRequest("dissolve", new SFSObject());

            SendRequest(req);
        }
Example #30
0
        /// <summary>
        /// 发送交互信息
        /// </summary>
        /// <param name="rt"></param>
        /// <param name="data"></param>
        public void SendRequest(GameRequestType rt, IDictionary data)
        {
            YxDebug.Log("SendRequest == " + rt);

            if (!App.GetGameData <GangwuGameData>().IsGameInfo)
            {
                YxDebug.LogError("GameInfo还没有初始化!!");
                return;
            }
            SFSObject sfsObject = new SFSObject();

            switch (rt)
            {
            case GameRequestType.Bet:
            case GameRequestType.AdvanceBet:
                if (!data.Contains("gold"))
                {
                    UnityEngine.Debug.LogError("没有Gold");
                }
                sfsObject.PutInt("gold", (int)data["gold"]);
                sfsObject.PutInt("type", (int)rt);
                break;

            case GameRequestType.Fold:
                sfsObject.PutInt("type", (int)rt);
                break;
            }

            YxDebug.Log("发送数据:");
            YxDebug.TraceSfsObject(sfsObject);

            SendGameRequest(sfsObject);
        }