private Hero PlaceHeroAt(PlayerMatchInfo info) { var uinfo = NetInfo.GetPlayerInfo(info.seatid); var player = Instantiate(characters[uinfo.usex]); player.name = uinfo.unick; var center = info.side == -1 ? playerEntry // 蓝色方 : enemyEntry; // 红色方 var degree = 180.0f / (LogicConfig.PlayerCount + 1); var index = info.seatid / 2; var temp = Vector2.right; temp = temp.RotateAngle((index + 1) * degree); player.transform.position = center.position + spreadRadis * temp.x * center.right + spreadRadis * temp.y * center.forward; var hero = player.AddComponent <Hero>(); hero.isGhost = NetInfo.seatid != info.seatid; hero.side = (SideType)info.side; hero.seatid = info.seatid; //逻辑初始化 hero.LogicInit(player.transform.position); return(hero); }
void addPlayerField(PlayerData player) { PackedScene scene = (PackedScene)ResourceLoader.Load("res://Scenes/AdvancedComponents/PlayerMatchInfo.tscn"); PlayerMatchInfo info = (PlayerMatchInfo)scene.Instance(); info.Initialize(player); playersList.AddChild(info); }
public PlayerMatchInfo[] PassRanking() { PlayerMatchInfo[] ranking = new PlayerMatchInfo[players.Count]; foreach (PlayerController player in players) { ranking[matchInfo.matchInfo[player].rank - 1] = matchInfo.matchInfo[player]; } return(ranking); }
public void SetPlayer(PlayerController player) { PlayerMatchInfo newPlayerInfo = new PlayerMatchInfo(); newPlayerInfo.kills = 0; newPlayerInfo.deaths = 0; newPlayerInfo.suicides = 0; newPlayerInfo.skin = player.playerSkin; matchInfo.Add(player, newPlayerInfo); }
public void SetValues(PlayerMatchInfo player) { rank.text = "Rank: " + player.rank; kills.text = "Kills: " + player.kills; deaths.text = "Deaths: " + player.deaths; suicides.text = "Suicides: " + player.suicides; //rank.color = player.skin.mainColor; //kills.color = player.skin.mainColor; //deaths.color = player.skin.mainColor; //suicides.color = player.skin.mainColor; border.color = player.skin.mainColor; background.color = player.skin.mainColor - new Color(0, 0, 0, 0.5f); }
private hero place_hero_at(PlayerMatchInfo match_info, int index) { int side = match_info.side; user_info uinfo = ugame.Instance.get_user_info(match_info.seatid); GameObject h_object = GameObject.Instantiate(this.hero_characters[uinfo.usex]); h_object.name = uinfo.unick; h_object.transform.SetParent(this.transform, false); Vector3 center_pos; if (side == 0) { center_pos = this.map_entry_A.transform.position; } else { center_pos = this.map_entry_B.transform.position; } if (index == 0) { center_pos.z -= 3.0f; } else { center_pos.z += 3.0f; } h_object.transform.position = center_pos; hero ctrl = h_object.AddComponent <hero>(); ctrl.is_ghost = (match_info.seatid != ugame.Instance.self_seatid); ctrl.logic_init(h_object.transform.position); ctrl.seatid = match_info.seatid; ctrl.side = side; //创建要给ui血条 UI_show_blood ui_blood = this.ui_blood_mgr.place_ui_blood_on_hero(side); ctrl.ui_blood = ui_blood; //end return(ctrl); }
private Hero PlaceHeroAt(PlayerMatchInfo matchInfo, int index) { int side = matchInfo.side; UserInfo uinfo = UGame.Instance.getUserInfo(matchInfo.seatid); GameObject heroObject = Instantiate(this.heroCharacters[uinfo .usex]); heroObject.name = uinfo.unick; heroObject.transform.SetParent(this.transform, false); Vector3 centerPos; if (side == 0) { centerPos = this.entryA.transform.position; } else { centerPos = this.entryB.transform.position; } if (index == 0) { centerPos.z -= 3.0f; } else { centerPos.z += 3.0f; } heroObject.transform.position = centerPos; Hero ctrl = heroObject.AddComponent <Hero>(); ctrl.isGhost = (matchInfo.seatid == UGame.Instance.selfSeatid) ? false : true; ctrl.LoginInit(heroObject.transform.position);//逻辑数据初始化 ctrl.seatid = matchInfo.seatid; ctrl.side = side; //创建一个UI血条 UIShowBlood uiBlood = this.UiBloodManager.PlaceUIBloodOnHero(side); ctrl.uiBlood = uiBlood; return(ctrl); }
protected IEnumerable <BestPlayersItem> SendBestPlayerReportTestData() { var bigKdaPlayer = new PlayerMatchInfo { Deaths = 1, Frags = 1000, Kills = 1000, Name = "KDA1000" }; var noDeathsPlayer = new PlayerMatchInfo { Deaths = 0, Frags = 200, Kills = 200, Name = "no deaths 200" }; var otherPlayers = new List <PlayerMatchInfo>(); for (var i = 0; i < 55; ++i) { otherPlayers.Add(new PlayerMatchInfo { Deaths = 2, Frags = i * 10, Kills = i * 10, Name = $"just{i}" }); } SendAdvertise(Endpoints[0], Advertises[0]); var date = new DateTime(); //this players have only 5 matches: they won't in report for (var i = 0; i < 5; ++i) { var match = new MatchInfo { Map = "kek", GameMode = "DM", FragLimit = 20, TimeLimit = 20, TimeElapsed = 12.345678, Scoreboard = otherPlayers.Take(5).Concat(new List <PlayerMatchInfo> { bigKdaPlayer, noDeathsPlayer }).ToList() }; SendMatchInfo(Endpoints[0], date.ToString("yyyy-MM-ddTHH:mm:ssZ"), match); date = date.AddDays(1); } //all except noDeathsPlayer will be in report for (var i = 0; i < 50; ++i) { var match = new MatchInfo { Map = "kek", GameMode = "DM", FragLimit = 20, TimeLimit = 20, TimeElapsed = 12.345678, Scoreboard = otherPlayers.Skip(5).Concat(new List <PlayerMatchInfo> { noDeathsPlayer }).ToList() }; SendMatchInfo(Endpoints[0], date.ToString("yyyy-MM-ddTHH:mm:ssZ"), match); date = date.AddDays(1); } return(otherPlayers .Select(p => new BestPlayersItem { Name = p.Name, KillToDeathRatio = (double)p.Kills.Value / p.Deaths.Value }) .Reverse() .ToList()); }