public void sureRoomNumber() { if (inputChars.Count != 6) { MyDebug.Log("请先完整输入房间号码!"); TipsManagerScript.getInstance().setTips("请先完整输入房间号码!"); return; } if (watingPanel != null) { watingPanel.gameObject.SetActive(true); } String roomNumber = inputChars[0] + inputChars[1] + inputChars[2] + inputChars[3] + inputChars[4] + inputChars[5]; MyDebug.Log(roomNumber + "此处加入房间输入房间号,并发送到服务器判断是否有此房间存在"); RoomJoinVo roomJoinVo = new RoomJoinVo(); roomJoinVo.roomId = int.Parse(roomNumber); string sendMsg = JsonMapper.ToJson(roomJoinVo); StartCoroutine(ConnectTime(4f, 1)); CustomSocket sok = CustomSocket.getInstance(); sok.sendMsg(new JoinRoomRequest(sendMsg)); if (SocketEventHandle.getInstance().serviceErrorNotice != null) { SocketEventHandle.getInstance().serviceErrorNotice = null; } SocketEventHandle.getInstance().serviceErrorNotice += serviceErrorNotice; }
public void openGamePlay() { string id = mZhanjiDataItemVo.id + ""; CustomSocket.getInstance().sendMsg(new GameBackPlayRequest(id)); PrefabManage.loadPerfab("Prefab/Panel_GamePlayBack"); }
public void youkeLogin() { watingPanel.GetComponentInChildren <Text> ().text = "进入游戏中"; watingPanel.SetActive(true); CustomSocket.getInstance().sendMsg(new LoginRequest(null)); }
private void clickNumber(string number) { MyDebug.Log(number.ToString()); if (inputChars.Count >= 6) { return; } inputChars.Add(number); int index = inputChars.Count; inputsWithText [index - 1].text = number.ToString(); //inputTexts[index - 1].enabled = true; //inputTexts[index - 1].sprite = numberList[int.Parse(number)]; //inputTexts[index - 1].SetNativeSize(); if (inputChars.Count == 6) { String roomNumber = inputChars[0] + inputChars[1] + inputChars[2] + inputChars[3] + inputChars[4] + inputChars[5]; MyDebug.Log(roomNumber); RoomJoinVo roomJoinVo = new RoomJoinVo(); roomJoinVo.roomId = int.Parse(roomNumber); string sendMsg = JsonMapper.ToJson(roomJoinVo); CustomSocket.getInstance().sendMsg(new JoinRoomRequest(sendMsg)); } }
IEnumerator ConnectTime1(float time, byte type) { connectRetruen = false; if (watingPanel != null) { watingPanel.SetActive(true); watingPanel.GetComponentInChildren <Text> ().text = "正在连接服务器..."; } CustomSocket.hasStartTimer = false; CustomSocket.getInstance().Connect(); ChatSocket.getInstance().Connect(); GlobalDataScript.isonLoginPage = true; yield return(new WaitForSeconds(time)); if (!connectRetruen) //超过5秒还没连接成功显示失败 { if (type == 1) { watingPanel.SetActive(false); } else if (type == 2) { } } }
/** * 创建划水麻将房间 */ public void createHuashuiRoom() { int roundNumber = 4; //房卡数量 bool isZimo = false; //自摸 bool isFengpai = false; //七小对 int maCount = 0; for (int i = 0; i < huashuiRoomCards.Count; i++) { Toggle item = huashuiRoomCards [i]; if (item.isOn) { if (i == 0) { roundNumber = 8; } else if (i == 1) { roundNumber = 16; } break; } } if (huashuiGameRule [0].isOn) { isFengpai = true; } if (huashuiGameRule [1].isOn) { isZimo = true; } for (int i = 0; i < huashuixiayu.Count; i++) { if (huashuixiayu [i].isOn) { maCount = 2 * (i + 1); break; } } sendVo = new RoomCreateVo(); sendVo.xiaYu = maCount; sendVo.roundNumber = roundNumber; sendVo.ziMo = isZimo?1:0; sendVo.roomType = GameConfig.GAME_TYPE_HUASHUI; sendVo.addWordCard = isFengpai; sendVo.sevenDouble = true; string sendmsgstr = JsonMapper.ToJson(sendVo); if (GlobalDataScript.loginResponseData.account.roomcard > 0) { CustomSocket.getInstance().sendMsg(new CreateRoomRequest(sendmsgstr)); } else { TipsManagerScript.getInstance().setTips("你的房卡数量不足,不能创建房间"); } }
public void login() { if (!CustomSocket.getInstance().isConnected) { CustomSocket.getInstance().Connect(); ChatSocket.getInstance().Connect(); tapCount = 0; return; } GlobalDataScript.reinitData(); //初始化界面数据 if (agreeProtocol.isOn) { doLogin(); watingPanel.SetActive(true); } else { MyDebug.Log("请先同意用户使用协议"); TipsManagerScript.getInstance().setTips("请先同意用户使用协议"); } tapCount += 1; Invoke("resetClickNum", 10f); }
void FixedUpdate() { while (callBackResponseList.Count > 0) { ClientResponse response = callBackResponseList [0]; callBackResponseList.RemoveAt(0); dispatchHandle(response); } //每隔一秒检测是否掉线 timeAll += Time.deltaTime; if (timeAll > 1) { timeAll = 0; CustomSocket.getInstance().sendHeadData02(); } if (isDisconnet) { isDisconnet = false; if (disConnetNotice != null) { disConnetNotice(); } } }
private void ReqForCreateRoom(string msg) { int gold = 10; if (GlobalDataScript.userGameType == GameType.GameType_PK_DN) { gold = 5; } if (GlobalDataScript.goldType) { if (GlobalDataScript.loginResponseData.account.gold >= gold) { watingPanel.gameObject.SetActive(true); CustomSocket.getInstance().sendMsg(new CreateRoomRequest(msg)); userDefaultSet = msg; } else { TipsManagerScript.getInstance().setTips("你的金币不足,不能匹配到训练场"); } } else { if (GlobalDataScript.loginResponseData.account.roomcard > 0) { watingPanel.gameObject.SetActive(true); CustomSocket.getInstance().sendMsg(new CreateRoomRequest(msg)); userDefaultSet = msg; } else { TipsManagerScript.getInstance().setTips("你的房卡数量不足,不能创建房间"); } } }
void Start() { SocketEventHandle.getInstance().giftResponse += giftResponse; CommonEvent.getInstance().prizeCountChange += prizeCountChange; CustomSocket.getInstance().sendMsg(new GetGiftRequest("0")); choujiangNum.text = GlobalDataScript.loginResponseData.account.prizecount + ""; }
/// <summary> /// 登录 /// </summary> public void Login() { CustomSocket.getInstance().sendMsg(new LoginRequest(null)); //if(username=="123"&&password=="123"){ // //执行登录操作 // Debug.Log("登录中..............."); // CustomSocket.getInstance().sendMsg(new LoginRequest(null)); //} //else if(username=="1234"&&password=="1234"){ // Debug.Log("2........登录中..............."); // CustomSocket.getInstance().sendMsg(new LoginRequest(null)); //} //else if (username == "12345" && password == "12345") //{ // Debug.Log("2........登录中..............."); // CustomSocket.getInstance().sendMsg(new LoginRequest(username)); //} //else if (username == "123456" && password == "123456") //{ // Debug.Log("2........登录中..............."); // CustomSocket.getInstance().sendMsg(new LoginRequest(username)); //} //else if (username == "1234567" && password == "1234567") //{ // Debug.Log("2........登录中..............."); // CustomSocket.getInstance().sendMsg(new LoginRequest(username)); //} }
public void exit() { CustomSocket.getInstance().sendMsg(new LoginRequest()); Application.Quit(); //多态 调用退出登录接口 }
IEnumerator retry() { yield return(new WaitForSeconds(10.0f)); CustomSocket.getInstance().sendMsg(new PaySuccessRequest(checkingOrder)); retryTimes++; }
public void reStratGame() { if (GlobalDataScript.isOverByPlayer) { //TipsManagerScript.getInstance ().setTips ("房间已解散,不能重新开始游戏"); closeDialog(); return; } if (GlobalDataScript.surplusTimes > 0) { if (GlobalDataScript.roomVo.gameType == 0) { CustomSocket.getInstance().sendMsg(new GameReadyRequest()); CommonEvent.getInstance().readyGame(); } closeDialog(); } else { //TipsManagerScript.getInstance ().setTips ("游戏局数已经用完,无法重新开始游戏"); closeDialog(); } SoundCtrl.getInstance().playSoundByActionButton(1); }
public void login() { MyDebug.Log("----------------1-------------------"); if (!CustomSocket.getInstance().isConnected) { StartCoroutine(ConnectTime1(3f, 1)); InvokeRepeating("isConnected", 0.1f, 0.1f); tapCount = 0; MyDebug.Log("----------------2------------------"); return; } GlobalDataScript.reinitData(); //初始化界面数据 if (agreeProtocol.isOn) { MyDebug.Log("----------------3------------------"); doLogin(); watingPanel.GetComponentInChildren <Text> ().text = "进入游戏中"; watingPanel.SetActive(true); StartCoroutine(ConnectTime(5f, 1)); } else { MyDebug.Log("请先同意用户使用协议"); TipsManagerScript.getInstance().setTips("请先同意用户使用协议"); } tapCount += 1; Invoke("resetClickNum", 10f); }
public void OnGetApplyClubCallBack(ClientResponse response) { ClubAccountVO vo = JsonMapper.ToObject <ClubAccountVO>(response.message); if (vo.msgcode != 0) { TipsManagerScript.getInstance().setTips(vo.msgstring); } else { isagreePanelShow = true; agreeListPanel.SetActive(true); PrefabUtils.ClearChild(agreeListGrid); foreach (ClubAccount ac in vo.listaccount) { GameObject child = PrefabUtils.AddChild(agreeListGrid, agreesub); agreeSubScript cs = child.GetComponent <agreeSubScript>(); cs.setValue(ac); cs.agreebtn.onClick.AddListener(() => { ClientRequest cr = new ClientRequest(); cr.headCode = APIS.AGREE_CLUB_REQUEST; cr.messageContent = "{'agree':1,'uuid':" + ac.uuid + "}"; CustomSocket.getInstance().sendMsg(cr); }); cs.nobtn.onClick.AddListener(() => { ClientRequest cr = new ClientRequest(); cr.headCode = APIS.AGREE_CLUB_REQUEST; cr.messageContent = "{'agree':0,'uuid':" + ac.uuid + "}"; CustomSocket.getInstance().sendMsg(cr); }); } } }
public List <Toggle> beishu; // 1. 5倍 2. 10倍 3. 20倍 public void createXiazui() { gameObject.SetActive(false); int XZList = 0; // 下嘴的组合 147 258 369 int XZbeishu = 0; // 下嘴的倍数 5 10 20 for (int i = 0; i < xiazuiList.Count; i++) { Toggle item = xiazuiList[i]; if (item.isOn) { if (i == 0) { XZList = 1; // 表示 147 组合 } if (i == 1) { XZList = 2; // 表示 258 组合 } if (i == 2) { XZList = 3; // 表示 369组合 } break; } } for (int i = 0; i < beishu.Count; i++) { Toggle bs = beishu[i]; if (bs.isOn) { if (i == 0) { XZbeishu = 5; // 5倍 } if (i == 1) { XZbeishu = 10; // 10倍 } if (i == 2) { XZbeishu = 20; // 20倍 } } } ReadyVO readyVO = new ReadyVO(); readyVO.phase = 1; XiazuiVO xiazuiVO = new XiazuiVO(); xiazuiVO.xiazuiList = XZList; xiazuiVO.xiazuiMultiple = XZbeishu; string sendmsg = JsonMapper.ToJson(xiazuiVO); CustomSocket.getInstance().sendMsg(new GameReadyRequest(readyVO)); CustomSocket.getInstance().sendMsg(new XiazuiRequest(xiazuiVO)); }
/** * public void closeUserInfoPanel (){ * userInfoPanel.SetActive (false); * } */ public void showRoomCardPanel() { SoundCtrl.getInstance().playSoundByActionButton(1); CustomSocket.getInstance().sendMsg(new GetContactInfoRequest()); }
public void exit() { SoundCtrl.getInstance().playSoundUI(); CustomSocket.getInstance().sendMsg(new LoginRequest()); Application.Quit(); //多态 调用退出登录接口 }
//微信支付回调 public void onWillPay(string str) { string[] sArray = str.Split(','); string order = sArray [0]; string ticketId = sArray [1]; CustomSocket.getInstance().sendMsg(new SaveTicketRequest(order, ticketId)); }
public void reshOnClick() { ClientRequest cr = new ClientRequest(); cr.headCode = APIS.CLUBSTATE_REQUEST; cr.messageContent = ""; CustomSocket.getInstance().sendMsg(cr); }
private void quitClub() { ClientRequest cr = new ClientRequest(); cr.headCode = APIS.QUIT_CLUB_REQUEST; cr.messageContent = ""; CustomSocket.getInstance().sendMsg(cr); }
public void sendMsg() { if (msg.text.Length == 0) { return; } SoundCtrl.getInstance().playSoundByActionButton(1); CustomSocket.getInstance().sendMsg(new MessageBoxRequest(2, msg.text, GlobalDataScript.loginResponseData.account.uuid)); if (GlobalDataScript.roomVo.gameType == 0) { if (myMaj == null) { myMaj = GameObject.Find("Panel_GamePlay(Clone)").GetComponent <MyMahjongScript> (); } if (myMaj != null) { myMaj.playerItems [0].showChatMessage(msg.text); } } else if (GlobalDataScript.roomVo.gameType == 1) { if (myPdk == null) { myPdk = GameObject.Find("Panel_GamePDK(Clone)").GetComponent <MyPDKScript> (); } if (myPdk != null) { myPdk.playerItems [0].showChatMessage(msg.text); } } else if (GlobalDataScript.roomVo.gameType == 3) { if (myDN == null && GlobalDataScript.roomVo.playerAmounts == 10) { myDN = GameObject.Find("Panel_GameDN(Clone)").GetComponent <MyDNScript> (); } if (myDN == null && GlobalDataScript.roomVo.playerAmounts == 6) { myDN = GameObject.Find("Panel_GameDN_6(Clone)").GetComponent <MyDNScript>(); } if (myDN != null) { myDN.playerItems [0].showChatMessage(msg.text); } } else if (GlobalDataScript.roomVo.gameType == 4) { if (myDzpk == null) { myDzpk = GameObject.Find("Panel_GameDZPK(Clone)").GetComponent <MyDZPKScript> (); } if (myDzpk != null) { myDzpk.playerItems [0].showChatMessage(msg.text); } } hidePanel(); }
public void tuichu() { OutRoomRequestVo vo = new OutRoomRequestVo(); vo.roomId = GlobalDataScript.roomVo.roomId; string sendMsg = JsonMapper.ToJson(vo); CustomSocket.getInstance().sendMsg(new OutRoomRequest(sendMsg)); }
public void RequestPrepareGame() { RoomJoinVo roomJoinVo = new RoomJoinVo(); roomJoinVo.roomId = GlobalDataScript.loginResponseData.roomId; string sendMsg = JsonMapper.ToJson(roomJoinVo); CustomSocket.getInstance().sendMsg(new StartPrepareGameRequest(sendMsg)); }
public void sendBiaoqing(string code) { SoundCtrl.getInstance().playSoundUI(); if (myMaj != null) { CustomSocket.getInstance().sendMsg(new MessageBoxRequest(2, GlobalDataScript.loginResponseData.account.uuid, code)); hidePanel(); } }
// Use this for initialization void Start() { CustomSocket.hasStartTimer = false; // 开始连接服务端 CustomSocket.getInstance().Connect(); versionText.text = "版本号:" + Application.version; GlobalDataScript.isonLoginPage = true; SocketEventHandle.getInstance().LoginCallBack += LoginCallBack; }
/** * 创建长沙麻将房间 */ public void createChangshaRoom() { int roundNumber = 4; //房卡数量 bool isZimo = false; //自摸 int maCount = 0; for (int i = 0; i < changshaRoomCards.Count; i++) { Toggle item = changshaRoomCards[i]; if (item.isOn) { if (i == 0) { roundNumber = 8; } else if (i == 1) { roundNumber = 16; } break; } } if (changshaGameRule [0].isOn) { isZimo = true; } for (int i = 0; i < changshaZhuama.Count; i++) { if (changshaZhuama[i].isOn) { // pow(x,y) 返回值 x 的 y 次幂。 maCount = (int)Math.Pow(2, i); break; } } sendVo = new RoomCreateVo(); // 游戏倍数 sendVo.magnification = maCount; // 游戏局数 sendVo.roundNumber = roundNumber; // 设置游戏类型 sendVo.roomType = GameConfig.GAME_TYPE_CHANGSHA; // 设置是否只允许自摸才能胡牌 sendVo.ziMo = isZimo?1:0; string sendMessage = JsonMapper.ToJson(sendVo); Debug.Log(sendMessage); if (GlobalDataScript.loginResponseData.account.roomCard > 0) { CustomSocket.getInstance().sendMsg(new CreateRoomRequest(sendMessage)); } else { TipsManagerScript.getInstance().setTips("你的房卡数量不足,不能创建房间"); } }
private static void sendHeartbeat() { if (CustomSocket.getInstance().isConnected) { CustomSocket.getInstance().sendHeadData(); ChatSocket.getInstance().sendHeadData(); } Thread.Sleep(20000); sendHeartbeat(); }
private void doDissoliveRoomRequest() { DissoliveRoomRequestVo dissoliveRoomRequestVo = new DissoliveRoomRequestVo(); dissoliveRoomRequestVo.roomId = GlobalDataScript.loginResponseData.roomId; dissoliveRoomRequestVo.type = dissolveType; string sendMsg = JsonMapper.ToJson(dissoliveRoomRequestVo); CustomSocket.getInstance().sendMsg(new DissoliveRoomRequest(sendMsg)); }