public void OnNPLevelSliderChanged(GameOptionSlider option) { if (option.slider != UISlider.current) { return; } float value = option.slider.value; bool flag = option.value != value; option.value = value; /* */ int num = Mathf.CeilToInt(option.slider.value * (option.slider.numberOfSteps - 1)); string s; switch (num) { case 1: s = "Lv1"; break; case 2: s = "Lv2"; break; case 3: s = "Lv3"; break; default: s = "默认"; break; } option.ValueTxtLabel.text = s; }
private void addSlider(string key, float defaultValue, string name, int numberOfSteps, string actionName) { EventDelegate onChangeEvent = new EventDelegate(this, actionName); GameOptionSlider opSlider = new GameOptionSlider(gameObject, key, defaultValue, onChangeEvent); opSlider.SetLocalPosition(0f, GetYAfterIncrement(opSlider), 0f); opSlider.slider.numberOfSteps = numberOfSteps; opSlider.NameTxtLabel.text = name; }
public void OnAtkSliderChanged(GameOptionSlider option) { if (option.slider != UISlider.current) { return; } float value = option.slider.value; bool flag = option.value != value; option.value = value; int num = Mathf.CeilToInt(value * (option.slider.numberOfSteps - 1)) + 1; option.ValueTxtLabel.text = "x" + num; }