Esempio n. 1
0
 /// <summary>
 /// 打枪
 /// </summary>
 /// <param name="someone">打枪的目标人物</param>
 /// <param name="index">打枪的枪号索引</param>
 public void ShootSomeone(SssPlayer someone, int index)
 {
     YxDebug.Log(" ==== 射击的是" + index + "号枪 === ");
     ShootAnim.transform.localEulerAngles = _gunEulers[index];
     ShootAnim.transform.localPosition    = _gunPositions[index];
     ShootAnim.DoShoot(someone);
 }
Esempio n. 2
0
        public List <CpgSaveData> Read(int chair)
        {
            if (_saveList[chair].Count != 0)
            {
                return(_saveList[chair]);
            }

            string key       = SaveDataKey + chair;
            string valueJson = PlayerPrefs.GetString(key, "");

            if (valueJson == "")
            {
                YxDebug.Log("当前本地 无吃碰杠保存数据");
                return(null);
            }

            ISFSArray array = SFSArray.NewFromJsonData(valueJson);

            for (int i = 0; i < array.Size(); i++)
            {
                ISFSObject  arrayObj = array.GetSFSObject(i);
                CpgSaveData data     = new CpgSaveData();
                data.type  = (EnGroupType)arrayObj.GetInt(CpgType);
                data.value = arrayObj.GetIntArray(CpgValue);
                data.index = arrayObj.GetInt(CpgIndex);


                _saveList[chair].Add(data);
            }

            return(_saveList[chair]);
        }
Esempio n. 3
0
        /// <summary>
        ///     刷新手牌
        /// </summary>
        /// <param name="values"></param>
        public virtual void RefreshHandList(List <int> values)
        {
            var items = _handPile.Layout.GetChildList();

            if (items.Count != values.Count)
            {
                YxDebug.LogError("UI数量与数据数量数量不一致,去看看");
                YxDebug.LogError(string.Format("玩家实际手牌数量(数据){0},目前UI数量{1}", values.Count, items.Count));
                YxDebug.Log("-----------------------------------值----------------------------");
                foreach (var item in values)
                {
                    YxDebug.Log((EnumMahjongValue)item);
                }
                YxDebug.Log("-----------------------------------UI----------------------------");
                foreach (var item in items)
                {
                    YxDebug.Log((EnumMahjongValue)item.GetComponent <MahjongItem>().Value);
                }
            }
            for (int i = 0, lenth = items.Count; i < lenth; i++)
            {
                var item = items[i].GetComponent <MahjongItem>();
                item.Value = values[i];
                item.JudgeHunTag(App.GetGameManager <Lyzz2DGameManager>().LaiZiNum);
            }
            _handPile.Layout.ResetPositionNow = true;
        }
Esempio n. 4
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();
                    }
                }
            });
        }
Esempio n. 5
0
        /// <summary>
        /// 退出房间
        /// </summary>
        private void QuitRoom()
        {
            var gdata = App.GetGameData <DuifenGlobalData>();

            if (gdata.IsGameing && gdata.GetPlayer <DuifenPlayerPanel>().ReadyState)
            {
                YxDebug.Log(" === 正在游戏中,结束后再退出!!! === ");
                YxMessageBox.Show(new YxMessageBoxData()
                {
                    Msg       = "正在游戏中,结束后再退出!!!",
                    IsTopShow = true,
                    Delayed   = 5,
                });
            }
            else
            {
                YxDebug.Log(" === 允许退出游戏!!! === ");
                YxMessageBox.Show(new YxMessageBoxData()
                {
                    Msg       = "确定要退出游戏吗?",
                    IsTopShow = true,
                    Delayed   = 5,
                    BtnStyle  = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
                    Listener  = (box, btnName) =>
                    {
                        if (btnName == YxMessageBox.BtnLeft)
                        {
                            App.QuitGame();
                        }
                    },
                });
            }
        }
Esempio n. 6
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;
                 */
            }
        }
Esempio n. 7
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();
             }
         }
     }
 }
Esempio n. 8
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);
        }
Esempio n. 9
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);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 更换房间
        /// </summary>
        private void ChangeRoom()
        {
            var gdata = App.GetGameData <PaiJiuGameData>();

            if (gdata.IsGameing && gdata.GetPlayer <PaiJiuPlayer>().IsReady)
            {
                YxDebug.Log("正在游戏中,无法更换房间!!");
                YxMessageBox.Show(new YxMessageBoxData()
                {
                    Msg       = "正在游戏中,不能换房间!!!",
                    IsTopShow = true,
                    Delayed   = 5,
                });
            }
            else
            {
                YxDebug.Log("允许更换房间!!");


                foreach (var player in gdata.PlayerList)
                {
                    var user = (PaiJiuPlayer)player;
                    user.Info = null;
                    user.RefreshPanel();
                    user.gameObject.SetActive(false);
                }
                App.GetRServer <PaiJiuGameServer>().OnAllowEnter();
                YxWindowManager.ShowWaitFor();
            }
        }
Esempio n. 11
0
        //-------------------------------------------------------------------------------------------------


        /// <summary>
        /// 发送玩家准备网络请求
        /// </summary>
        public void SendPlayerReadyServCmd()
        {
            YxDebug.Log("发送准备");
            string key = GameKey + RequestCmd.Ready;

            SendFrameRequest(key, SFSObject.NewInstance());
        }
Esempio n. 12
0
 /// <summary>
 /// 退出房间
 /// </summary>
 private void QuitRoom()
 {
     if (App.GetGameData <PaiJiuGameData>().IsGameing&& App.GetGameData <PaiJiuGameData>().GetPlayer <PaiJiuPlayer>().IsReady)
     {
         YxDebug.Log(" === 正在游戏中,结束后再退出!!! === ");
         YxMessageBox.Show(new YxMessageBoxData()
         {
             Msg       = "正在游戏中,结束后再退出!!!",
             IsTopShow = true,
             Delayed   = 5,
         });
     }
     else
     {
         YxDebug.Log(" === 允许退出游戏!!! === ");
         YxMessageBox.Show(new YxMessageBoxData()
         {
             Msg       = "确定要退出游戏吗?",
             IsTopShow = true,
             Delayed   = 5,
             BtnStyle  = YxMessageBox.LeftBtnStyle | YxMessageBox.RightBtnStyle,
             Listener  = (box, btnName) =>
             {
                 if (btnName == YxMessageBox.BtnLeft)
                 {
                     App.QuitGame();
                 }
             },
         });
     }
 }
Esempio n. 13
0
        private static int GetPerChairNormal(int curr, int totalCnt)
        {
            if (totalCnt == 2)
            {
                curr = curr == 2 ? 1 : curr;
            }
            if (totalCnt == 3)
            {
                curr = curr == 3 ? 2 : curr;
            }

            int next = (curr + totalCnt - 1) % totalCnt;

            if (totalCnt == 2)
            {
                return(next == 1 ? 2 : next);
            }
            if (totalCnt == 3)
            {
                return(next == 2 ? 3 : next);
            }
            if (totalCnt == 4)
            {
                return(next);
            }

            YxDebug.Log("查找 上个座位号 出错");
            return(-1);
        }
Esempio n. 14
0
        /// <summary>
        /// 小于0,倒水
        /// </summary>
        /// <param name="list1"></param>
        /// <param name="line1"></param>
        /// <param name="list2"></param>
        /// <param name="line2"></param>
        /// <returns></returns>
        int MatchListType(List <int> list1, int line1, List <int> list2, int line2)
        {
            if (list1 == null || list1.Count < 1 || list2 == null || list2.Count < 1)
            {
                return(0);
            }
            var      vnList1 = new VnList(list1);
            var      vnList2 = new VnList(list2);
            CardType type1   = CheckCardType(list1, line1);
            CardType type2   = CheckCardType(list2, line2);

            YxDebug.Log(string.Format(" === 第{0}行牌型为{1} , 第{2}行牌型为{3} === ", line1, type1, line2, type2));

            int result = type1 - type2;
            int dif    = line1 - line2;

            if (result == 0)
            {
                for (int i = 0; i < vnList2.Count; i++)
                {
                    if (vnList1[i].Val != vnList2[i].Val)
                    {
                        return(vnList1[i].Val.CompareTo(vnList2[i].Val) * dif);
                    }
                }
            }
            return(result * dif);
        }
Esempio n. 15
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());
        }
Esempio n. 16
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();
                }
            }
        }
Esempio n. 17
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());
        }
Esempio n. 18
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;
                }
            }
        }
Esempio n. 19
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();
 }
Esempio n. 20
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 = "";
            }
        }
Esempio n. 21
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);
                }
            }
        }
Esempio n. 22
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]);
 }
Esempio n. 23
0
        /// <summary>
        /// 房主直接解散房间
        /// </summary>
        public void DismissRoom()
        {
            YxDebug.Log("解散房间!");
            IRequest req = new ExtensionRequest("dissolve", new SFSObject());

            SendRequest(req);
        }
Esempio n. 24
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);
        }
Esempio n. 25
0
        /// <summary>
        /// 更换房间
        /// </summary>
        private void ChangeRoom()
        {
            var gdata = App.GetGameData <DuifenGlobalData>();

            if (App.GetGameData <DuifenGlobalData>().IsGameing&& gdata.GetPlayer <DuifenPlayerPanel>().ReadyState)
            {
                YxDebug.Log("正在游戏中,无法更换房间!!");
                YxMessageBox.Show(new YxMessageBoxData()
                {
                    Msg       = "正在游戏中,不能换房间!!!",
                    IsTopShow = true,
                    Delayed   = 5,
                });
            }
            else
            {
                YxDebug.Log("允许更换房间!!");
                //if (main.IsResultDone)
                //{
                //    main.ResultDone();
                //}
                //main.Reset();
                //BetMgr.GetInstance().Reset();
                foreach (var player in gdata.PlayerList)
                {
                    var panel = (DuifenPlayerPanel)player;
                    panel.Info = null;
                    player.gameObject.SetActive(false);
                }
                App.GetGameData <DuifenGlobalData>().IsGameInfo = false;
                App.GetRServer <DuifenGameServer>().OnAllowEnter();
                YxWindowManager.ShowWaitFor();
            }
        }
Esempio n. 26
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);
        }
Esempio n. 27
0
        /// <summary>
        /// 发送准备信息
        /// </summary>
        public void ReadyGame()
        {
            YxDebug.Log("发送准备!!");
            var key = GameKey + RequestCmd.Ready;

            SendFrameRequest(key, SFSObject.NewInstance());
        }
Esempio n. 28
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 + "!");
        }
Esempio n. 29
0
        /// <summary>
        /// 数据转移到小筹码堆上
        /// </summary>
        public void MoveDataToSmall()
        {
            YxDebug.Log("MoveDataToSmall");
            var gdata      = App.GameData;
            var playerList = gdata.PlayerList;
            var len        = playerList.Length;

            foreach (var stack in SmallBetStack)
            {
                if (stack.IsAdd)
                {
                    stack.IsAdd    = BigBetStack.IsAdd;
                    stack.BetValue = BigBetStack.BetValue;
                    stack.SetBelong(BigBetStack.Belong);
                    stack.Bet.gameObject.SetActive(true);
                    stack.Bet.text = YxUtiles.ReduceNumber(stack.BetValue);//App.GetGameData<GlobalData>().GetShowGold(stack.BetValue);

                    BigBetStack.IsAdd    = true;
                    BigBetStack.BetValue = 0;
                    BigBetStack.Bet.text = YxUtiles.ReduceNumber(stack.BetValue);//App.GetGameData<GlobalData>().GetShowGold(stack.BetValue);
                    //BigBetStack.Reset(false);
                    break;
                }
            }
            for (var i = 0; i < len; i++)
            {
                PlayerPanel panel = (PlayerPanel)playerList[i];
                if (panel.BetMoney <= 0 && BigBetStack.Belong[i])
                {
                    BigBetStack.Belong[i] = panel.CurGameType != PlayerGameType.AllIn;
                }
            }
        }
Esempio n. 30
0
        /// <summary>
        /// 数据转移到小筹码堆上
        /// </summary>
        public void MoveDataToSmall()
        {
            YxDebug.Log("MoveDataToSmall");
            foreach (var stack in SmallBetStack)
            {
                if (stack.IsAdd)
                {
                    stack.IsAdd    = BigBetStack.IsAdd;
                    stack.BetValue = BigBetStack.BetValue;
                    stack.SetBelong(BigBetStack.Belong);
                    stack.Bet.gameObject.SetActive(true);
                    stack.Bet.text = YxUtiles.ReduceNumber(stack.BetValue);

                    BigBetStack.IsAdd    = true;
                    BigBetStack.BetValue = 0;
                    BigBetStack.Bet.text = YxUtiles.ReduceNumber(BigBetStack.BetValue);
                    //BigBetStack.Reset(false);
                    break;
                }
            }
            var gdata       = App.GameData;
            var playerList  = gdata.PlayerList;
            var playerCount = playerList.Length;

            for (var i = 0; i < playerCount; i++)
            {
                var player = gdata.GetPlayer <PlayerPanel>(i);
                if (player.BetMoney <= 0 && BigBetStack.Belong[i])
                {
                    BigBetStack.Belong[i] = player.CurGameType != PlayerGameType.AllIn;
                }
            }
        }