/// <summary> /// Invites a player to the game via battletag. /// </summary> /// <param name="playerName">Battletag of the player to invite. Is case sensitive. Ex: Tracer#1818</param> /// <param name="team">Team that the invited player joins.</param> /// <returns>Returns true if <paramref name="playerName"/> is a valid battletag.</returns> /// <exception cref="ArgumentNullException">Thrown if <paramref name="playerName"/> is null.</exception> public bool InvitePlayer(string playerName, InviteTeam team = InviteTeam.Both) { if (playerName == null) { throw new ArgumentNullException("playerTeam"); } updateScreen(); // check if the add AI button is there. // because the invite button gets moved if it is/isnt there. if (DoesAddButtonExist()) { LeftClick(Points.LOBBY_INVITE_IF_ADD_BUTTON_PRESENT, 250); // click invite } else { LeftClick(Points.LOBBY_INVITE_IF_ADD_BUTTON_NOT_PRESENT, 250); // click invite } LeftClick(Points.INVITE_VIA_BATTLETAG, 100); // click via battletag TextInput(playerName); if (team != InviteTeam.Both) { LeftClick(Points.INVITE_TEAM_DROPDOWN); if (team == InviteTeam.Blue) { LeftClick(Points.INVITE_TEAM_BLUE); } else if (team == InviteTeam.Red) { LeftClick(Points.INVITE_TEAM_RED); } else if (team == InviteTeam.Spectator) { LeftClick(Points.INVITE_TEAM_SPECTATOR); } } Thread.Sleep(200); updateScreen(); if (CompareColor(Points.INVITE_INVITE, Colors.CONFIRM, Fades.CONFIRM)) { LeftClick(Points.INVITE_INVITE); // invite player ResetMouse(); return(true); } else { LeftClick(Points.INVITE_BACK); // click back ResetMouse(); return(false); } }
/// <summary> /// Invites a player to the game via battletag. /// </summary> /// <param name="playerName">Battletag of the player to invite. Is case sensitive. Ex: Tracer#1818</param> /// <param name="team">Team that the invited player joins.</param> /// <returns></returns> public bool InvitePlayer(string playerName, InviteTeam team = InviteTeam.Both) { updateScreen(); // check if the add AI button is there. // because the invite button gets moved if it is/isnt there. if (DoesAddButtonExist()) { LeftClick(778, 180, 250); // click invite } else { LeftClick(835, 180, 250); // click invite } LeftClick(572, 171, 100); // click via battletag TextInput(playerName); // type the playername if (team != InviteTeam.Both) { LeftClick(475, 398); if (team == InviteTeam.Blue) { LeftClick(475, 447); // click team1 } if (team == InviteTeam.Red) { LeftClick(475, 466); // click team2 } if (team == InviteTeam.Spectator) { LeftClick(475, 483); // click spectator } } Thread.Sleep(200); updateScreen(); if (CompareColor(460, 434, CALData.ConfirmColor, 30)) { LeftClick(460, 434); // invite player ResetMouse(); return(true); } else { LeftClick(412, 434); // click back ResetMouse(); return(false); } }
// 增加一个邀请队伍,TRUE 成功,反之失败 public bool AddInviteTeam(InviteTeam pTeam) { for (int i = 0; i < m_InviteTeams.Count; ++i) { if (m_InviteTeams[i].m_InviterGUID == pTeam.m_InviterGUID) { // 同样的申请人就不接受了 return(false); } } m_InviteTeams.Add(pTeam); if (m_InviteTeams.Count > MAX_INVITE_TEAM) { // 只有在邀请界面关闭时才做即时操作 if (m_UIFlag == UI_ON_OPEN.UI_ALL_CLOSE) { EraseInviteTeam(0); } } return(true); }