public void StartOptions(OptionPanelSettings settings, ButtonMaster buttonMaster, System.Action endOptionsScreenNotification) { _buttonMaster = buttonMaster; EndOptionsScreenNotification = endOptionsScreenNotification; Vector3 thisPosition = new Vector3(0, 0, 0); Quaternion quaternion = new Quaternion(0, 0, 0, 0); if (settings != null) { _menus = settings.OptionMenuList.ToArray(); for (int i = 0; i < _menus.Length; i++) { //Set the position and scale of the newly spawned menu items. thisPosition.y = (-1f * i) + 0.5f; thisPosition.z = 10; GameObject menuSelectorClone = (GameObject)Instantiate( _menuSelectorPrefab, thisPosition, //transform.position, quaternion // transform.rotation ); menuSelectorClone.transform.localScale = new Vector3(0.015f, 0.015f, 1); menuSelectorClone.transform.parent = gameObject.transform; //Attach the script to the menu object so we can manipulate the object programmatically MenuSelector mss = menuSelectorClone.GetComponent <MenuSelector>(); _menus[i].Script = mss; OptionMenu om = _menus[i]; mss.SetMenuOptionText(om.Title); mss.SetValueText(om.GetSelectedValue()); mss.ShowLeftArrow(!om.IsFirstValue()); mss.ShowRightArrow(!om.IsLastValue()); mss.SetHighlight(i == 0); } _menuIndex = 0; } _panelActive = true; }
void StartOptionsScreen() { _gameState = GameState.OptionsScreen; RenderGameOptionsScreen(); OptionPanelSettings ops = GetOptionsSettings(); _optionsPanel.StartOptions(ops, _buttonMaster, EndOptionsScreen); //Assign some random values for now _bossFight = true; _buffIncreaseActiveTimePercent = UnityEngine.Random.Range(0, 5) * (0.01f * BuffCritChancePerTier); _buffIncreaseActiveTimeMultiplier = 1 + _buffIncreaseActiveTimePercent; _buffDecreaseBossHealthPercent = UnityEngine.Random.Range(0, 5) * (0.01f * BuffBossHealthDecreasePercentPerTier); _buffIncreasePlayerHealthPercent = UnityEngine.Random.Range(0, 5) * (0.01f * BuffPlayerHealthIncreasePercentPerTier); _buffParty1CritChance = UnityEngine.Random.Range(0, 5) * (0.01f * BuffCritChancePerTier); _buffParty2CritChance = UnityEngine.Random.Range(0, 5) * (0.01f * BuffCritChancePerTier); }
OptionPanelSettings GetOptionsSettings() { List <OptionMenu> bmList = new List <OptionMenu>(); /* * List<string> modeValues = new List<string>() * { * OPTION_MENU_MODE_VALUE_PVP, * OPTION_MENU_MODE_VALUE_BOSS, * }; * OptionMenu bmMode = new OptionMenu( * OPTION_MENU_MODE, * modeValues.ToArray(), * modeValues[0] * ); * * bmList.Add(bmMode); */ List <string> roundValues = new List <string>() { "1", "3", "5", "7" }; OptionMenu omRounds = new OptionMenu( OPTION_MENU_ROUNDS, roundValues.ToArray(), _roundCount.ToString() ); bmList.Add(omRounds); List <string> healthValues = new List <string>(); for (int i = 1; i <= 20; i++) { healthValues.Add( Mathf.FloorToInt(PlayerMaximumDamagePerAttack * i).ToString() ); } //Populate default from currently selected value. OptionMenu omHealth = new OptionMenu( OPTION_MENU_PLAYER_HEALTH, healthValues.ToArray(), Mathf.FloorToInt(_pvpStartHealth).ToString() ); bmList.Add(omHealth); List <string> volumeValues = new List <string>(); for (int i = 1; i <= 10; i++) { volumeValues.Add(i.ToString()); } //Populate default from currently selected value. OptionMenu omMusicVolume = new OptionMenu( OPTION_MENU_MUSIC_VOLUME, volumeValues.ToArray(), Mathf.FloorToInt(_musicVolume * 10).ToString() ); bmList.Add(omMusicVolume); /* * List<string> critValues = new List<string>() * { * "0%", * "5%", * "10%", * "15%", * "20%", * "25%" * }; * OptionMenu omCrit = new OptionMenu( * OPTION_MENU_CRIT_CHANCE, * critValues.ToArray(), * critValues[0] * ); * * bmList.Add(omCrit); */ OptionPanelSettings ops = new OptionPanelSettings(bmList); return(ops); }