// Ball private void SetupBallSelector() { SelectorData selectorData = new SelectorData(); List <int> ballKeys = tnGameData.GetBallsKeysMain(); if (ballKeys != null) { for (int index = 0; index < ballKeys.Count; ++index) { int key = ballKeys[index]; if (Hash.IsNullOrEmpty(key)) { continue; } tnBallData ballData = tnGameData.GetBallDataMain(key); if (ballData == null) { continue; } SelectorItem selectorItem = new SelectorItem(key, ballData.name, "", ballData.icon); selectorData.AddItem(selectorItem); } } if (viewInstance != null) { viewInstance.SetBallSelectorData(selectorData); } }
// Referee private void SetupRefereeSelector() { SelectorData selectorData = new SelectorData(); List <int> refereeOptionKeys = tnGameData.GetRefereeOptionKeysMain(); if (refereeOptionKeys != null) { for (int index = 0; index < refereeOptionKeys.Count; ++index) { int key = refereeOptionKeys[index]; string value; if (tnGameData.TryGetRefereeValueMain(key, out value)) { SelectorItem selectorItem = new SelectorItem(key, value, "", null); selectorData.AddItem(selectorItem); } } } if (viewInstance != null) { viewInstance.SetRefereeSelectorData(selectorData); } }
// Max players private void SetupMaxPlayerSelector(int i_StadiumId) { SelectorData selectorData = new SelectorData(); tnStadiumData stadiumData = tnGameData.GetStadiumDataMain(i_StadiumId); if (stadiumData != null) { int minPlayers = 2 * stadiumData.onlineTeamSize.min; int maxPlayers = 2 * stadiumData.onlineTeamSize.max; int localPartySize; PhotonUtils.TryGetPlayerCustomProperty <int>(PhotonNetwork.player, PhotonPropertyKey.s_PlayerCustomPropertyKey_LocalPartySize, out localPartySize); for (int numPlayers = minPlayers; numPlayers <= maxPlayers; numPlayers += 2) { if (numPlayers <= localPartySize) { continue; } SelectorItem selectorItem = new SelectorItem(numPlayers, numPlayers.ToString(), "", null); selectorData.AddItem(selectorItem); } } if (viewInstance != null) { viewInstance.SetMaxPlayersSelectorData(selectorData); } RefreshMaxPlayers(); }
// Duration private void SetupMatchDurationSelector() { SelectorData selectorData = new SelectorData(); List <int> matchDurationKeys = tnGameData.GetMatchDurationOptionKeysMain(); if (matchDurationKeys != null) { for (int index = 0; index < matchDurationKeys.Count; ++index) { int key = matchDurationKeys[index]; float value; if (tnGameData.TryGetMatchDurationValueMain(key, out value)) { string time = TimeUtils.TimeToString(value, true, true); SelectorItem selectorItem = new SelectorItem(key, time, "", null); selectorData.AddItem(selectorItem); } } } if (viewInstance != null) { viewInstance.SetMatchDurationSelectorData(selectorData); } }
private void InitMatchDurationSelector() { if (m_MatchDurationSelector == null) { return; } SelectorData selectorData = new SelectorData(); List <int> matchDurationKeys = tnGameData.GetMatchDurationOptionKeysMain(); if (matchDurationKeys != null) { foreach (int key in matchDurationKeys) { float value; if (tnGameData.TryGetMatchDurationValueMain(key, out value)) { string time = TimeUtils.TimeToString(value, true, true); SelectorItem selectorItem = new SelectorItem(key, time, "", null); selectorData.AddItem(selectorItem); } } } m_MatchDurationSelector.SetData(selectorData); }
protected IEnumerator Selector (params IEnumerator[] children) { SelectorData selector = new SelectorData (); return Control ( selector, () => { if (selector.Index >= children.Length) { return Success; } IEnumerator child = children[selector.Index]; // Move to next on break or explicit failure if (!child.MoveNext () || Failure.Equals (child.Current)) { selector.Index = selector.Index + 1; } // Success on success if (Success.Equals (child.Current)) { return Success; } return Running; }, children ); }
private void SetupGameModeSelector() { if (m_GameModeSelector == null) { return; } tnTeamsModule teamsModule = GameModulesManager.GetModuleMain <tnTeamsModule>(); if (teamsModule == null) { return; } int maxTeamSize = 0; for (int teamIndex = 0; teamIndex < teamsModule.teamsCount; ++teamIndex) { tnTeamDescription teamDescription = teamsModule.GetTeamDescription(teamIndex); if (teamDescription != null) { maxTeamSize = Mathf.Max(teamDescription.charactersCount, maxTeamSize); } } SelectorData selectorData = new SelectorData(); List <int> gameModesKeys = tnGameData.GetGameModesKeysMain(); if (gameModesKeys != null) { for (int gameModeIndex = 0; gameModeIndex < gameModesKeys.Count; ++gameModeIndex) { int gameModeId = gameModesKeys[gameModeIndex]; tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(gameModeId); if (gameModeData == null) { continue; } if (!gameModeData.hidden) { IntRange teamsRange = gameModeData.teamsRange; IntRange teamSizeRange = gameModeData.playersPerTeamRange; if (teamsRange.IsValueValid(teamsModule.teamsCount)) { if (teamSizeRange.IsValueValid(maxTeamSize)) { SelectorItem selectorItem = new SelectorItem(gameModeId, gameModeData.name, "", null); selectorData.AddItem(selectorItem); } } } } } m_GameModeSelector.SetData(selectorData); }
private void InitGoldenGoalSelector() { if (m_GoldenGoalSelector == null) { return; } SelectorData selectorData = new SelectorData(); List <int> goldenGoalOptionKeys = tnGameData.GetGoldenGoalOptionKeysMain(); if (goldenGoalOptionKeys != null) { for (int goldenGoalOptionIndex = 0; goldenGoalOptionIndex < goldenGoalOptionKeys.Count; ++goldenGoalOptionIndex) { int goldenGoalOptionId = goldenGoalOptionKeys[goldenGoalOptionIndex]; string goldenGoalOption; if (tnGameData.TryGetGoldenGoalValueMain(goldenGoalOptionId, out goldenGoalOption)) { SelectorItem selectorItem = new SelectorItem(goldenGoalOptionId, goldenGoalOption, "", null); selectorData.AddItem(selectorItem); } } } m_GoldenGoalSelector.SetData(selectorData); }
// Game Mode public void SetGameModeSelectorData(SelectorData i_SelectorData) { if (m_GameModeSelector != null) { m_GameModeSelector.SetData(i_SelectorData); } }
// Max players public void SetMaxPlayersSelectorData(SelectorData i_SelectorData) { if (m_MaxPlayersSelector != null) { m_MaxPlayersSelector.SetData(i_SelectorData); } }
private void InitRefereeSelector() { if (m_RefereeSelector == null) { return; } SelectorData selectorData = new SelectorData(); List <int> refereeOptionKeys = tnGameData.GetRefereeOptionKeysMain(); if (refereeOptionKeys != null) { for (int refereeOptionIndex = 0; refereeOptionIndex < refereeOptionKeys.Count; ++refereeOptionIndex) { int refereeOptionId = refereeOptionKeys[refereeOptionIndex]; string refereeOption; if (tnGameData.TryGetRefereeValueMain(refereeOptionId, out refereeOption)) { SelectorItem selectorItem = new SelectorItem(refereeOptionId, refereeOption, "", null); selectorData.AddItem(selectorItem); } } } m_RefereeSelector.SetData(selectorData); }
// Ball public void SetBallSelectorData(SelectorData i_SelectorData) { if (m_BallSelector != null) { m_BallSelector.SetData(i_SelectorData); } }
// Stadium public void SetStadiumSelectorData(SelectorData i_SelectorData) { if (m_StadiumSelector != null) { m_StadiumSelector.SetData(i_SelectorData); } }
// Referee public void SetRefereeSelectorData(SelectorData i_SelectorData) { if (m_RefereeSelector != null) { m_RefereeSelector.SetData(i_SelectorData); } }
// Golden goal public void SetGoldenGoalSelectorData(SelectorData i_SelectorData) { if (m_GoldenGoalSelector != null) { m_GoldenGoalSelector.SetData(i_SelectorData); } }
// Duration public void SetMatchDurationSelectorData(SelectorData i_SelectorData) { if (m_MatchDurationSelector != null) { m_MatchDurationSelector.SetData(i_SelectorData); } }
private void InitBallSelector() { if (m_BallSelector == null) { return; } SelectorData selectorData = new SelectorData(); List <int> ballKeys = tnGameData.GetBallsKeysMain(); if (ballKeys != null) { for (int ballIndex = 0; ballIndex < ballKeys.Count; ++ballIndex) { int ballId = ballKeys[ballIndex]; tnBallData ballData = tnGameData.GetBallDataMain(ballId); SelectorItem selectorItem = new SelectorItem(ballId, ballData.name, "", ballData.icon); selectorData.AddItem(selectorItem); } } m_BallSelector.SetData(selectorData); }
private void Internal_SetResolutionSelectorData(SelectorData i_SelectorData) { if (m_ResolutionSelector == null) { return; } m_ResolutionSelector.SetData(i_SelectorData); }
public void SetData(SelectorData i_Data) { m_Data = i_Data; if (!IndexValid(m_CurrentIndex)) { SelectItemByIndex(0); // Reset selection. } else { SelectItemByIndex(m_CurrentIndex); // Refresh view. } }
// Game mode private void SetupGameModeSelector() { SelectorData selectorData = new SelectorData(); List <int> gameModesKeys = tnGameData.GetGameModesKeysMain(); if (gameModesKeys != null) { for (int gameModeIndex = 0; gameModeIndex < gameModesKeys.Count; ++gameModeIndex) { int gameModeId = gameModesKeys[gameModeIndex]; if (Hash.IsNullOrEmpty(gameModeId)) { continue; } tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(gameModeId); if (gameModeData == null) { continue; } if (!gameModeData.hidden) { IntRange teamSizeRange = gameModeData.onlinePlayersPerTeamRange; int localPartySize; PhotonUtils.TryGetPlayerCustomProperty <int>(PhotonPropertyKey.s_PlayerCustomPropertyKey_LocalPartySize, out localPartySize); bool teamSizeInvalid = (localPartySize >= teamSizeRange.max * 2); if (!teamSizeInvalid) { SelectorItem selectorItem = new SelectorItem(gameModeId, gameModeData.name, "", null); selectorData.AddItem(selectorItem); } } } } if (viewInstance != null) { viewInstance.SetGameModeSelectorData(selectorData); } }
private void InitResolutionSelector() { if (m_ResolutionSelector == null) { return; } SelectorData selectorData = new SelectorData(); for (int resolutionIndex = 0; resolutionIndex < Screen.resolutions.Length; ++resolutionIndex) { Resolution resolution = Screen.resolutions[resolutionIndex]; string label = resolution.ToString(); SelectorItem selectorItem = new SelectorItem(resolutionIndex, label, "", null); selectorData.AddItem(selectorItem); } m_ResolutionSelector.SetData(selectorData); }
public void SetData(SelectorData data) { mData = data; int count = data.Count; //if(count < ShowNum) //{ // setShowNum(count); //} calculateItemOffset(); recoverAll(); //if (null == mItemPos || mItemPos.Length != count) calulateItemPos(count); checkNeedUpdate(true); if (null != Toggles) { Toggles.SetTotalNum(data.Count); } SetCurIndex(0); updateDrag(new Vector2(5, 0)); }
private void InitResolutionSelector() { SelectorData selectorData = new SelectorData(); Resolution[] resolutions = Screen.resolutions; if (resolutions != null) { for (int resolutionIndex = 0; resolutionIndex < resolutions.Length; ++resolutionIndex) { Resolution resolution = resolutions[resolutionIndex]; string label = resolution.ToString(); SelectorItem selectorItem = new SelectorItem(resolutionIndex, label, "", null); selectorData.AddItem(selectorItem); } } if (viewInstance != null) { viewInstance.SetResolutionSelectorData(selectorData); } }
public SelectorOptions(ushort p_options, SelectionClass p_class) { source_data = Globals.selector_data; value = p_options; selection_class = p_class; switch (p_class) { case SelectionClass.Reference: options_possible = source_data.reference_options; icons_possible = source_data.reference_icons; flags_possible = source_data.reference_flags; functions_possible = source_data.reference_function_pointers; break; case SelectionClass.Target: options_possible = source_data.target_options; icons_possible = source_data.target_icons; flags_possible = source_data.target_flags; functions_possible = source_data.target_function_pointers; break; case SelectionClass.Info: options_possible = source_data.info_options; icons_possible = source_data.info_icons; flags_possible = source_data.info_flags; functions_possible = source_data.info_function_pointers; break; default: case SelectionClass.Command: options_possible = source_data.command_options; icons_possible = source_data.command_icons; flags_possible = source_data.command_flags; functions_possible = source_data.command_function_pointers; break; } }
private void SetupAILevelSelector() { if (m_AILevelSelector == null) { return; } SelectorData selectorData = new SelectorData(); for (int aiLevelIndex = 0; aiLevelIndex < tnGameData.aiLevelCountMain; ++aiLevelIndex) { tnAILevel aiLevel = tnGameData.GetAILevelMain(aiLevelIndex); if (aiLevel == null) { continue; } SelectorItem selectorItem = new SelectorItem(aiLevelIndex, aiLevel.label, "", null); selectorData.AddItem(selectorItem); } m_AILevelSelector.SetData(selectorData); }
public void SetDataAndIndex(SelectorData data, int index) { SetData(data); SetCurIndex(index); }
/// <nodoc /> public static Selector FromGrpc(this SelectorData request) { return(new Selector(request.ContentHash.FromGrpc(), request.Output.ToByteArray())); }
private void SetupStadiumSelector(int i_GameModeId) { if (m_StadiumSelector == null) { return; } tnTeamsModule teamModule = GameModulesManager.GetModuleMain <tnTeamsModule>(); if (teamModule == null) { return; } int maxTeamSize = 0; for (int teamIndex = 0; teamIndex < teamModule.teamsCount; ++teamIndex) { tnTeamDescription teamDescription = teamModule.GetTeamDescription(teamIndex); if (teamDescription != null) { maxTeamSize = Mathf.Max(teamDescription.charactersCount, maxTeamSize); } } SelectorData selectorData = new SelectorData(); List <int> stadiumKeys = tnGameData.GetStadiumsKeysMain(); if (stadiumKeys != null) { tnGameModeData gameModeData = tnGameData.GetGameModeDataMain(i_GameModeId); for (int stadiumIndex = 0; stadiumIndex < stadiumKeys.Count; ++stadiumIndex) { int stadiumId = stadiumKeys[stadiumIndex]; tnStadiumData stadiumData = tnGameData.GetStadiumDataMain(stadiumId); if (stadiumData == null) { continue; } bool excludedByTag = false; if (gameModeData != null) { for (int excluderTagIndex = 0; excluderTagIndex < gameModeData.fieldsExcludersTagsCount; ++excluderTagIndex) { int excluderTag = gameModeData.GetFieldExcluderTag(excluderTagIndex); if (excluderTag != Hash.s_EMPTY && excluderTag != Hash.s_NULL) { if (stadiumData.HasTag(excluderTag)) { excludedByTag = true; } } } } IntRange teamSizeRange = stadiumData.teamSize; bool locked = excludedByTag || !(teamSizeRange.IsValueValid(maxTeamSize)); string lockedString = ""; if (locked) { if (excludedByTag) { lockedString = "Not available in this game mode."; } else { lockedString = "From " + teamSizeRange.min + " to " + teamSizeRange.max + " players"; } } SelectorItem selectorItem = new SelectorItem(stadiumId, stadiumData.name, stadiumData.description, stadiumData.icon, locked, lockedString); selectorData.AddItem(selectorItem); } } m_StadiumSelector.SetData(selectorData); }
public void SetResolutionSelectorData(SelectorData i_SelectorData) { Internal_SetResolutionSelectorData(i_SelectorData); }
public void Clear() { m_Data = null; SelectItemByIndex(-1); }