public IEnumerator CRDraftChr(int iPlayer, CharType.CHARTYPE chrDrafted) { //Ensure the character actually exists Debug.Assert(chrDrafted < CharType.CHARTYPE.LENGTH); //Ensure this character hasn't already been drafted/banned Debug.Assert(arbChrsAvailableToDraft[(int)chrDrafted] == true); Debug.Log("Drafting " + chrDrafted + " for " + iPlayer); //Ensure the draft selection has been registered in the roomoptions (maybe someone else beat us to it, but that's fine) NetworkMatchSetup.SetCharacterSelection(iPlayer, arNumChrsDrafted[iPlayer], chrDrafted); //Then ensure that everything locally is tracked and displayed properly arDraftedChrs[iPlayer][arNumChrsDrafted[iPlayer]] = chrDrafted; arNumChrsDrafted[iPlayer]++; arbChrsAvailableToDraft[(int)chrDrafted] = false; draftcollection.SetChrAsDrafted((int)chrDrafted); arDraftedChrDisplay[iPlayer].UpdateDraftedChrDisplays(arDraftedChrs[iPlayer]); yield return(new WaitForSeconds(1.0f)); Debug.Log("Finished 'waiting' for the draft to finish"); }
public void OnChrSelectChange() { Debug.Assert(0 <= idChr && idChr < 3); NetworkMatchSetup.SetCharacterSelection(plyrselectorParent.idPlayer, idChr, (CharType.CHARTYPE)dropdown.value); //Now that our character has been reselected, we need to load in a starting loadout for that character NetworkMatchSetup.SetLoadout(plyrselectorParent.idPlayer, idChr, LoadoutManager.LoadSavedLoadoutForChr(NetworkMatchSetup.GetCharacterSelection(plyrselectorParent.idPlayer, idChr), 0)); Debug.LogFormat("Changed chr to {0} with a starting loadout of {1}", NetworkMatchSetup.GetCharacterSelection(plyrselectorParent.idPlayer, idChr), NetworkMatchSetup.GetLoadout(plyrselectorParent.idPlayer, idChr)); }
public void Start() { lstLoadoutSelected = new List <LoadoutManager.Loadout>(); //Initially save the selected loadouts as just being the default loadout for the default character in that position for (int i = 0; i < arDropdownCharSelect.Length; i++) { //Initially set the selected char to the default for that player+slot combo NetworkMatchSetup.SetCharacterSelection(idPlayer, i, CHRSELECTIONSDEFAULT[idPlayer, i]); //Set the loadout to be the default loadout for the selected player NetworkMatchSetup.SetLoadout(idPlayer, i, LoadoutManager.LoadSavedLoadoutForChr(CHRSELECTIONSDEFAULT[idPlayer, i], 0)); //Set the default position of that character NetworkMatchSetup.SetPositionCoords(idPlayer, i, POSITIONSDEFAULT[idPlayer, i]); //Ensure our character selection dropdown is initialized arDropdownCharSelect[i].UpdateDropdownOptions(); } }
public void LoadLoggedCharacterSelections(string[] arsSplitLogs) { Debug.Assert(arsSplitLogs[0] == "cs"); int iPlayer, iChr, nchrSelection; if (int.TryParse(arsSplitLogs[1], out iPlayer) == false || iPlayer < 0 || iPlayer >= Player.MAXPLAYERS) { Debug.LogErrorFormat("Error! {0} was not a valid player id to be loaded", arsSplitLogs[1]); return; } if (int.TryParse(arsSplitLogs[2], out iChr) == false || iChr < 0 || iChr >= Player.MAXCHRS) { Debug.LogErrorFormat("Error! {0} was not a valid chr id to be loaded", arsSplitLogs[2]); return; } if (int.TryParse(arsSplitLogs[3], out nchrSelection) == false) { Debug.LogErrorFormat("Error! {0} was not a valid serialized character selections to be loaded", arsSplitLogs[3]); return; } NetworkMatchSetup.SetCharacterSelection(iPlayer, iChr, (CharType.CHARTYPE)nchrSelection); }