/// <summary> /// 更新可选择的英雄列表 /// </summary> /// <param name="selectDTO"></param> private void UpdateHeroCouldSelect(SelectDTO selectDTO) { SelectDTO[] team = GetTeam(this.teamId); for (int i = 0; i < team.Length; i++) { if (team[i].userId == selectDTO.userId) { team[i] = selectDTO; } } heroCouldSelected.Clear(); for (int i = 0; i < heroList.Length; i++) { heroCouldSelected.Add(heroList[i]); } foreach (SelectDTO item in team) { if (heroCouldSelected.Contains(item.heroId)) { heroCouldSelected.Remove(item.heroId); } } heroSelectGridBox.UpdateSelectHeroGrids(heroCouldSelected); }
/// <summary> /// 获取下拉选项值 /// </summary> /// <param name="dataSource">数据来源 0 自定议,1 数据库</param> /// <param name="dropDownValue">下拉选项值</param> /// <returns></returns> private object GetComboList(int dataSource, string dropDownValue, string userId) { var returnList = new List <SelectDTO>(); if (dataSource == 0) { string[] rowValueList = dropDownValue.Split(new char[] { '\r', '\n' }); foreach (string rowValue in rowValueList) { var selDto = new SelectDTO() { Id = rowValue.Split('|')[0], Name = rowValue.Split('|')[1] }; if (rowValue.Split('|').Length > 2) { selDto.RelationId_1 = rowValue.Split('|')[2]; } if (rowValue.Split('|').Length > 3) { selDto.RelationId_2 = rowValue.Split('|')[3]; } returnList.Add(selDto); } } else { dropDownValue = dropDownValue.Replace("@UserId", "'" + userId + "'"); returnList = this.moduleQueryRepository.ExecuteQuerySql <SelectDTO>(dropDownValue, new string[] { }, new object[] { }).ToList(); } return(returnList); }
/// <summary> /// 根据一组玩家信息,初始化一组玩家信息格列表 /// </summary> /// <param name="selectDTOs"></param> /// <param name="heroHeads"></param> /// <returns></returns> public Dictionary <int, SelectPlayerInfoGrid> InitialPlayerInfo(SelectDTO[] selectDTOs, Sprite[] heroHeads) { Dictionary <int, SelectPlayerInfoGrid> infoGridMap = new Dictionary <int, SelectPlayerInfoGrid>(); for (int i = 0; i < selectDTOs.Length; i++) { Transform grid = transform.GetChild(i); SelectDTO select = selectDTOs[i]; if (grid != null) { SelectPlayerInfoGrid selectPlayerInfoGrid = grid.GetComponent <SelectPlayerInfoGrid>(); if (selectPlayerInfoGrid == null) { selectPlayerInfoGrid = grid.gameObject.AddComponent <SelectPlayerInfoGrid>(); } selectPlayerInfoGrid.Init(select.name, select.heroId, select.isEnter, select.isReady, heroHeads); if (!infoGridMap.ContainsKey(select.userId)) { infoGridMap.Add(select.userId, selectPlayerInfoGrid); } } } return(infoGridMap); }
private void AddUserToTeam(List <int> userIds, ref ConcurrentDictionary <int, SelectDTO> team) { foreach (int i in userIds) { SelectDTO select = new SelectDTO(); select.userId = i; select.name = GetUser(i).name; select.heroId = -1; select.isEnter = false; select.isReady = false; select.heroList = GetUser(i).heroList; team.TryAdd(i, select); } }
/// <summary> /// 创建英雄 /// </summary> /// <param name="model"></param> /// <param name="team"></param> private void CreateHero(SelectDTO model, int team) { HeroModel heroModel = HeroData.HeroModels[model.heroId]; HeroInstance heroInstance = new HeroInstance(); heroInstance.instanceId = model.userId; heroInstance.name = model.name; heroInstance.heroModel = HeroData.HeroModels[model.heroId]; heroInstance.fightModel = HeroData.HeroModels[model.heroId]; heroInstance.teamId = (byte)team; heroInstance.atk = heroModel.atk; heroInstance.def = heroModel.def; heroInstance.hp = heroModel.maxHp; heroInstance.mp = heroModel.mp; heroInstance.atkRange = heroModel.atkRange; heroInstance.speed = heroModel.speed; heroInstance.atkSpeed = heroModel.atkSpeed; heroInstance.eyeRange = heroModel.eyeRange; heroInstance.atkArr = heroModel.atkArr; heroInstance.defArr = heroModel.atkArr; heroInstance.hpArr = heroModel.hpArr; heroInstance.mpArr = heroModel.mpArr; int skillCount = heroModel.skillCodes.Length; FightSkill[] fightSkills = new FightSkill[skillCount]; for (int i = 0; i < skillCount; i++) { fightSkills[i] = SkillData.SkillModels[heroModel.skillCodes[i]].GetSkillLevelOne(); } heroInstance.skills = fightSkills; if (team == 1) { heroInstance.posX = MapData.heroBornPointTeamOne.x; heroInstance.posY = MapData.heroBornPointTeamOne.y; heroInstance.posZ = MapData.heroBornPointTeamOne.z; } else { heroInstance.posX = MapData.heroBornPointTeamTwo.x; heroInstance.posY = MapData.heroBornPointTeamTwo.y; heroInstance.posZ = MapData.heroBornPointTeamTwo.z; } fightRoomDTO.heroEntities.Add(heroInstance); instances.Add(heroInstance.instanceId, heroInstance); }
private bool playerHasEnter = false;//玩家是否已经进入选择 /// <summary> /// 选择网络消息处理 /// </summary> /// <param name="sm"></param> public override void OnMessageReceived(SocketModel sm) { switch (sm.command) { case SelectProtocol.ENTER_SRES: SelectRoomDTO selectRoom = sm.GetMessage <SelectRoomDTO>(); playerHasEnter = true; MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectRoom((ushort)NetEventSelect.EnterSres, selectRoom)); break; case SelectProtocol.ENTER_EXBRO: if (playerHasEnter) { int enterUserId = sm.GetMessage <int>(); MgrCenter.Instance.SendMsg(Msgs.GetMsgInt((ushort)NetEventSelect.SomeOneEntered, enterUserId)); } break; case SelectProtocol.SELECT_BRO: if (playerHasEnter) { SelectDTO selectDTO = sm.GetMessage <SelectDTO>(); MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectDTO((ushort)NetEventSelect.SomeOneSelected, selectDTO)); } break; case SelectProtocol.SELECT_SRES: break; case SelectProtocol.READY_BRO: if (playerHasEnter) { SelectDTO select = sm.GetMessage <SelectDTO>(); MgrCenter.Instance.SendMsg(Msgs.GetMsgSelectDTO((ushort)NetEventSelect.SomeOneReady, select)); } break; case SelectProtocol.FIGHT_BRO: if (playerHasEnter) { MgrCenter.Instance.SendMsg(Msgs.GetMsgString((ushort)SceneLoadEvent.LoadScene, "Fight")); } break; } }
private void Select(UserToken token, int v) { if (!IsEntered(token)) { return; } USER user = GetUser(token); //判断玩家是否拥有此英雄 if (!user.heroList.Contains(v)) { Send(token, SelectProtocol.SELECT_SRES, null); return; } SelectDTO select = null; if (teamOne.ContainsKey(user.id)) { foreach (SelectDTO item in teamOne.Values) { if (item.heroId == v) { return; } } select = teamOne[user.id]; } else { foreach (SelectDTO item in teamTwo.Values) { if (item.heroId == v) { return; } } select = teamTwo[user.id]; } select.heroId = v; //广播更新的玩家选人数据 brocast(SelectProtocol.SELECT_BRO, select); }
/// <summary> /// 获取所有公司部门 /// </summary> /// <returns></returns> public IList <SelectDTO> FindAllDeptList() { var returnList = new List <SelectDTO>(); var list = this.corpDepartPositionRepository.GetAllList <CorpDeptPositionDTO>(); var deptList = list.GroupBy(m => new { m.CorpId, m.DepartId, m.DepartName }) .Select(m => new { CorpId = m.Key.CorpId, DepartId = m.Key.DepartId, DepartName = m.Key.DepartName }); foreach (var deptModel in deptList) { var dto = new SelectDTO() { Id = deptModel.DepartId, Name = deptModel.DepartName, RelationId_1 = deptModel.CorpId }; returnList.Add(dto); } return(returnList); }
private void Ready(UserToken token) { if (!IsEntered(token)) { return; } int userId = GetUserId(token); if (readyList.Contains(userId)) { return; } SelectDTO sm = null; if (teamOne.ContainsKey(userId)) { sm = teamOne[userId]; } else { sm = teamTwo[userId]; } if (sm.heroId == -1) { return; } sm.isReady = true; brocast(SelectProtocol.READY_BRO, sm); readyList.Add(userId); if (readyList.Count >= teamOne.Count + teamTwo.Count) { StartFight(); } }
/// <summary> /// This call searches in user with search and select DTO system. This call could not be compatible with some programming language, in this case use the call api/UserSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Task of Object</returns> public async System.Threading.Tasks.Task <Object> UserSearchV3PostSearchAsync(UserSearchDTO searchDto, SelectDTO selectDto) { ApiResponse <Object> localVarResponse = await UserSearchV3PostSearchAsyncWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
private int selectedHeroId = -1;//已选择的英雄Id /// <summary> /// 处理消息 /// </summary> /// <param name="msg"></param> public override void ProcessEvent(MsgBase msg) { switch (msg.MsgId) { case (ushort)NetEventSelect.EnterSres: //服务器允许进入选择 MsgSelectRoom msgSelectRoom = msg as MsgSelectRoom; Debug.LogWarning("enter sres"); if (msgSelectRoom.selectRoom != null) { this.selectRoom = msgSelectRoom.selectRoom; SetPlayers(this.selectRoom); } InitialSelectHeroGrids(); break; case (ushort)AssetLoadEvent.AssetLoaded: //图片加载完成 MsgAssetLoaded msgAssetLoaded = msg as MsgAssetLoaded; string assetIndex = msgAssetLoaded.assetName.Split('_')[0]; int index = int.Parse(assetIndex); Texture2D texture = msgAssetLoaded.asset as Texture2D; Sprite sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0.5f, 0.5f)); OnSpriteLoaded(index, sprite); break; case (ushort)NetEventSelect.SomeOneEntered: //有玩家进入了 MsgInt msgInt = msg as MsgInt; UpdatePlayerInfoOnEnter(msgInt.Int, true); break; case (ushort)SelectUIEvent.HeroPressed: //按下了某个英雄 MsgInt msgIndex = msg as MsgInt; selectedHeroId = msgIndex.Int; heroSelectGridBox.UIOnSomeHeroSelected(msgIndex.Int); break; case (ushort)NetEventSelect.SomeOneSelected: //某人选择了英雄 MsgSelectDTO msgSelectDTO = msg as MsgSelectDTO; SelectDTO selectDTO = msgSelectDTO.SelectData; if (selectDTO != null) { UpdatePlayerHero(selectDTO.userId, selectDTO.heroId); } if (TeamId(selectDTO.userId) == this.teamId) { UpdateHeroCouldSelect(selectDTO); } break; case (ushort)NetEventSelect.SomeOneReady: //有人准备了 MsgSelectDTO msgSelect = msg as MsgSelectDTO; SelectDTO select = msgSelect.SelectData; UpdatePlayerReady(select.userId, select.isReady); break; } }
/// <summary> /// This call searches in address book with search and select DTO system This method is deprecated. Use api/v2/AddressBookSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>List<RowSearchResult></returns> public List <RowSearchResult> AddressBookSearchPostSearch(AddressBookSearchConcreteDTO searchDto, SelectDTO selectDto) { ApiResponse <List <RowSearchResult> > localVarResponse = AddressBookSearchPostSearchWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call returns all documents contained in a specific binder This method is deprecated. Use api/v2/BinderSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="binderids"></param> /// <param name="selectDto"></param> /// <returns>List<RowSearchResult></returns> public List <RowSearchResult> BinderSearchGetProfilesByPratica(List <int?> binderids, SelectDTO selectDto) { ApiResponse <List <RowSearchResult> > localVarResponse = BinderSearchGetProfilesByPraticaWithHttpInfo(binderids, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call returns all documents contained in a specific binder This method is deprecated. Use api/v2/BinderSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="binderids"></param> /// <param name="selectDto"></param> /// <returns>Task of List<RowSearchResult></returns> public async System.Threading.Tasks.Task <List <RowSearchResult> > BinderSearchGetProfilesByPraticaAsync(List <int?> binderids, SelectDTO selectDto) { ApiResponse <List <RowSearchResult> > localVarResponse = await BinderSearchGetProfilesByPraticaAsyncWithHttpInfo(binderids, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call searches in address book with search and select DTO system. This call could not be compatible with some programming language, in this case use the call api/AddressBookSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Task of Object</returns> public async System.Threading.Tasks.Task <Object> AddressBookSearchV3PostSearchAsync(AddressBookSearchConcreteDTO searchDto, SelectDTO selectDto) { ApiResponse <Object> localVarResponse = await AddressBookSearchV3PostSearchAsyncWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
public void SetMsgSelectDTO(ushort msgId, SelectDTO selectDTO) { this.msgId = msgId; this.selectDTO = selectDTO; }
/// <summary> /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Task of ApiResponse (List<RowSearchResult>)</returns> public async System.Threading.Tasks.Task <ApiResponse <List <RowSearchResult> > > UserSearchPostSearchAsyncWithHttpInfo(UserSearchDTO searchDto, SelectDTO selectDto) { // verify the required parameter 'searchDto' is set if (searchDto == null) { throw new ApiException(400, "Missing required parameter 'searchDto' when calling UserSearchApi->UserSearchPostSearch"); } // verify the required parameter 'selectDto' is set if (selectDto == null) { throw new ApiException(400, "Missing required parameter 'selectDto' when calling UserSearchApi->UserSearchPostSearch"); } var localVarPath = "/api/UserSearches"; var localVarPathParams = new Dictionary <String, String>(); var localVarQueryParams = new List <KeyValuePair <String, String> >(); var localVarHeaderParams = new Dictionary <String, String>(this.Configuration.DefaultHeader); var localVarFormParams = new Dictionary <String, String>(); var localVarFileParams = new Dictionary <String, FileParameter>(); Object localVarPostBody = null; // to determine the Content-Type header String[] localVarHttpContentTypes = new String[] { "application/json", "text/json", "application/xml", "text/xml", "application/x-www-form-urlencoded" }; String localVarHttpContentType = this.Configuration.ApiClient.SelectHeaderContentType(localVarHttpContentTypes); // to determine the Accept header String[] localVarHttpHeaderAccepts = new String[] { "application/json", "text/json", "application/xml", "text/xml" }; String localVarHttpHeaderAccept = this.Configuration.ApiClient.SelectHeaderAccept(localVarHttpHeaderAccepts); if (localVarHttpHeaderAccept != null) { localVarHeaderParams.Add("Accept", localVarHttpHeaderAccept); } if (searchDto != null) { localVarFormParams.Add("searchDto", this.Configuration.ApiClient.ParameterToString(searchDto)); // form parameter } if (selectDto != null) { localVarFormParams.Add("selectDto", this.Configuration.ApiClient.ParameterToString(selectDto)); // form parameter } // authentication (Authorization) required if (!String.IsNullOrEmpty(this.Configuration.GetApiKeyWithPrefix("Authorization"))) { localVarHeaderParams["Authorization"] = this.Configuration.GetApiKeyWithPrefix("Authorization"); } // make the HTTP request IRestResponse localVarResponse = (IRestResponse)await this.Configuration.ApiClient.CallApiAsync(localVarPath, Method.POST, localVarQueryParams, localVarPostBody, localVarHeaderParams, localVarFormParams, localVarFileParams, localVarPathParams, localVarHttpContentType); int localVarStatusCode = (int)localVarResponse.StatusCode; if (ExceptionFactory != null) { Exception exception = ExceptionFactory("UserSearchPostSearch", localVarResponse); if (exception != null) { throw exception; } } return(new ApiResponse <List <RowSearchResult> >(localVarStatusCode, localVarResponse.Headers.ToDictionary(x => x.Name, x => string.Join(",", x.Value)), (List <RowSearchResult>) this.Configuration.ApiClient.Deserialize(localVarResponse, typeof(List <RowSearchResult>)))); }
/// <summary> /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>List<RowSearchResult></returns> public List <RowSearchResult> UserSearchPostSearch(UserSearchDTO searchDto, SelectDTO selectDto) { ApiResponse <List <RowSearchResult> > localVarResponse = UserSearchPostSearchWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call searches in user with search and select DTO system. This call could not be compatible with some programming language, in this case use the call api/UserSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Object</returns> public Object UserSearchV3PostSearch(UserSearchDTO searchDto, SelectDTO selectDto) { ApiResponse <Object> localVarResponse = UserSearchV3PostSearchWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call searches in user with search and select DTO system. This method is deprecated. Use api/v3/UserSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Task of List<RowSearchResult></returns> public async System.Threading.Tasks.Task <List <RowSearchResult> > UserSearchPostSearchAsync(UserSearchDTO searchDto, SelectDTO selectDto) { ApiResponse <List <RowSearchResult> > localVarResponse = await UserSearchPostSearchAsyncWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call returns all documents contained in a specific binder This call could not be compatible with some programming language, in this case use the call \"api/BinderSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="binderids"></param> /// <param name="selectDto"></param> /// <returns>Object</returns> public Object BinderSearchV3GetProfilesByPratica(List <int?> binderids, SelectDTO selectDto) { ApiResponse <Object> localVarResponse = BinderSearchV3GetProfilesByPraticaWithHttpInfo(binderids, selectDto); return(localVarResponse.Data); }
/// <summary> /// This call searches in address book with search and select DTO system. This call could not be compatible with some programming language, in this case use the call api/AddressBookSearches /// </summary> /// <exception cref="ACUtils.AXRepository.ArxivarNext.Client.ApiException">Thrown when fails to make API call</exception> /// <param name="searchDto"></param> /// <param name="selectDto"></param> /// <returns>Object</returns> public Object AddressBookSearchV3PostSearch(AddressBookSearchConcreteDTO searchDto, SelectDTO selectDto) { ApiResponse <Object> localVarResponse = AddressBookSearchV3PostSearchWithHttpInfo(searchDto, selectDto); return(localVarResponse.Data); }
public static MsgSelectDTO GetMsgSelectDTO(ushort msgId, SelectDTO selectDTO) { msgSelectDTO.SetMsgSelectDTO(msgId, selectDTO); return(msgSelectDTO); }