private void StartMatch() { Debug.Log("开始匹配"); //发送匹配请求 //smg.Change(OpCode.MATCH, MatchCode.MATCH_ENTER_CREQ, null); //发起进入游戏请求看是否有空余游戏房间,没有就发起匹配请求 smg.Change(OpCode.GAME, GameCode.GAME_ENTER_CERQ, null); Dispatch(AreaCode.NET, 0, smg); }
private void onClick() { if (isConnected) { string acc = PlayerPrefs.GetString("ID", "0"); socketMessage.Change(OpCode.ACCOUNT, AccCode.ACC_LOGIN_CREQ, acc); Dispatch(AreaCode.NET, 0, socketMessage); } else { ShowToast.MakeToast("无法接到服务器"); } }
IEnumerator Attack() { SocketMessage socketMessage = new SocketMessage(); shootDto.Change(account); while (true) { yield return(new WaitForSeconds(fireInterval)); socketMessage.Change(OpCode.GAME, GameCode.GAME_DO_ATTACK_CERQ, shootDto); Dispatch(AreaCode.NET, 0, socketMessage); curArms.Fire(); } }
private void Enter(GameRoomDto dto) { if (dto == null) { smg.Change(OpCode.MATCH, MatchCode.MATCH_ENTER_CREQ, null); Dispatch(AreaCode.NET, 0, smg); return; } SceneMesg sm = new SceneMesg(2, () => { foreach (var item in dto.UserAccDtoDict.Keys) { Dispatch(AreaCode.GAME, GameEvent.GAME_PLAYER_ADD, dto.UserAccDtoDict[item]); Dispatch(AreaCode.GAME, GameEvent.GAME_PLAYER_SPAWN, dto.UserTransDto[item]); Dispatch(AreaCode.GAME, GameEvent.GAME_SYNC_HP, dto.UserHpDict[item]); Dispatch(AreaCode.GAME, GameEvent.GAME_SYNC_HG, dto.UserHgDict[item]); Dispatch(AreaCode.GAME, GameEvent.GAME_SYNC_KILL, dto.UserKillDict[item]); //ArmsDto armsDto = new ArmsDto(item, dto.UserArmsDict[item]); //Dispatch(AreaCode.FIGHT, FightEvent.FIGHT_SYNC_ARMSTYPS, armsDto); } }); Dispatch(AreaCode.SCENE, SceneEvent.SCENE_LOAD, sm); }
/// <summary> /// 向服务器发送方位信息 /// </summary> private void SendTrans(TransformDto dto) { dto.Account = localAcc; smg.Change(OpCode.GAME, GameCode.GAME_SYNC_TRASNFORM_CERQ, dto); Dispatch(AreaCode.NET, 0, smg); }