/// <summary> /// Update a player row from player source. /// </summary> /// <param name="player"></param> /// <param name="rank"></param> /// <param name="status"></param> /// <param name="crewTag"></param> /// <param name="icon"></param> /// <param name="rowColor"></param> /// <param name="statusColor"></param> public async void UpdatePlayer(Player player, int rank, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor) { PlayerRow p = playerRows.Find(pr => { return(pr.Player.ServerId == player.ServerId); }); p.Status = status; p.PlayerRank = rank; p.CrewTag = crewTag; p.Icon = icon; p.RowColor = rowColor; p.StatusColor = statusColor; await UpdateList(); }
/// <summary> /// Update a player row by index. /// </summary> /// <param name="index"></param> /// <param name="rank"></param> /// <param name="status"></param> /// <param name="crewTag"></param> /// <param name="icon"></param> /// <param name="rowColor"></param> /// <param name="statusColor"></param> public async void UpdatePlayer(int index, int rank, string status, string crewTag, PlayerIcon icon, HudColor rowColor, HudColor statusColor) { PlayerRow p = playerRows[index]; p.Status = status; p.PlayerRank = rank; p.CrewTag = crewTag; p.Icon = icon; p.RowColor = rowColor; p.StatusColor = statusColor; await UpdateList(); }
/// <summary> /// Updates the playerlist. /// </summary> /// <returns></returns> private async Task UpdateList() { //for (var i = 0; i < 32; i++) //{ // PushScaleformMovieFunctionN("SET_DATA_SLOT_EMPTY"); // PushScaleformMovieFunctionParameterInt(3); // PushScaleformMovieFunctionParameterInt(i); // PopScaleformMovieFunctionVoid(); //} //await BaseScript.Delay(0); if (playerRows.Count > 0) { for (var i = 0; i < playerRows.Count; i++) { PlayerRow pr = playerRows[i]; if (pr.RowIndex != i) { pr.RowIndex = i; playerRows[i] = pr; } PushScaleformMovieFunctionN("SET_DATA_SLOT"); // call scaleform function PushScaleformMovieFunctionParameterInt(3); // frontend menu column PushScaleformMovieFunctionParameterInt(i); // row index PushScaleformMovieFunctionParameterInt(0); // menu ID PushScaleformMovieFunctionParameterInt(0); // unique ID PushScaleformMovieFunctionParameterInt(2); // type (2 = AS_ONLINE_IN_SESSION) PushScaleformMovieFunctionParameterInt(pr.PlayerRank); // rank value / (initialIndex 1337) PushScaleformMovieFunctionParameterBool(false); // isSelectable PushScaleformMovieFunctionParameterString(pr.Player.Name); // playerName PushScaleformMovieFunctionParameterInt((int)pr.RowColor); // rowColor PushScaleformMovieFunctionParameterBool(false); // reduceColors (if true: removes color from left bar & reduces color opacity on row itself.) PushScaleformMovieFunctionParameterInt(0); // unused PushScaleformMovieFunctionParameterInt((int)pr.Icon); // right player icon. PushScaleformMovieFunctionParameterInt(0); // unused PushScaleformMovieFunctionParameterString($"..+{pr.CrewTag}"); // crew label text. PushScaleformMovieFunctionParameterBool(false); // should be a thing to toggle blinking of (kick) icon, but doesn't seem to work. PushScaleformMovieFunctionParameterString(pr.Status); // badge/status tag text PushScaleformMovieFunctionParameterInt((int)pr.StatusColor); // badge/status tag background color PopScaleformMovieFunctionVoid(); // done } } else { await BaseScript.Delay(0); } //await BaseScript.Delay(500); //UpdateDetails(); //PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT"); //PushScaleformMovieFunctionParameterInt(0); //PopScaleformMovieFunctionVoid(); //UpdateSettings(); //PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT"); //PushScaleformMovieFunctionParameterInt(1); //PopScaleformMovieFunctionVoid(); //await UpdateList(); PushScaleformMovieFunctionN("DISPLAY_DATA_SLOT"); PushScaleformMovieFunctionParameterInt(3); PopScaleformMovieFunctionVoid(); /// ACTIVATE THE FIRST COLUMN (FOCUS). PushScaleformMovieFunctionN("SET_COLUMN_FOCUS"); PushScaleformMovieFunctionParameterInt(0); // column index // _loc7_ PushScaleformMovieFunctionParameterBool(true); // highlightIndex // _loc6_ PushScaleformMovieFunctionParameterBool(false); // scriptSetUniqID // _loc4_ PushScaleformMovieFunctionParameterBool(false); // scriptSetMenuState // _loc5_ PopScaleformMovieFunctionVoid(); }