public ShaderPropFloat(PropKey key, EditRange range, float[] sliderRange, bool[] opts, float defaultVal, params float[] presetVals) : base(key, ValType.Float) { this.range = range; this.sliderMin = sliderRange[0]; this.sliderMax = sliderRange[1]; this.opts = opts; this.presetVals = presetVals; this.defaultVal = defaultVal; }
private bool drawValueSlider(string label, ref EditColor edit, int idx, ref float sliderVal) { bool changed = false; bool fontChanged = false; GUILayout.BeginHorizontal(optItemHeight); try { drawLabel(ref label); if (!edit.isSyncs[idx]) { SetTextColor(uiParams.textStyleSC, ref txtColorRed); fontChanged = true; } EditRange range = edit.GetRange(idx); var val2 = GUILayout.TextField(edit.editVals[idx], uiParams.textStyleSC, optInputWidth); if (edit.editVals[idx] != val2) // 直接書き換えられたケース { edit.Set(idx, val2, range); } changed |= drawSlider(ref sliderVal, range.editMin, range.editMax); GUILayout.Space(buttonMargin); } catch (Exception e) { LogUtil.DebugF("{0}, idx={1}, color={2}, vals.length={3}, syncs.length={4}, e={5}", label, idx, edit.val, edit.editVals.Length, edit.isSyncs.Length, e); throw; } finally { GUILayout.EndHorizontal(); if (fontChanged) { SetTextColor(uiParams.textStyleSC, ref txtColor); } } return(changed); }
public EditValue(float val1, string format, float min, float max) { this.range = new EditRange(format, min, max); Set( val1 ); }
internal EditValue(float val1, EditRange attr) { this.range = attr; Set( val1 ); }
public EditValue(float val1, string format, float min, float max) { this.range = new EditRange(format, min, max); Set(val1); }
internal EditValue(float val1, EditRange attr) { this.range = attr; Set(val1); }
public void Set(int idx, string editVal1, EditRange er = null) { if (idx < editVals.Length) { editVals[idx] = editVal1; if (er == null) er = GetRange(idx); bool sync = false; float v; if (float.TryParse(editVal1, out v)) { if (er.editMin> v) v = er.editMin; else if (er.editMax < v) v = er.editMax; else sync = true; if (sync) { Color c = val.Value; if (type == ColorType.a) { c.a = v; } else { switch(idx) { case 0: c.r = v; break; case 1: c.g = v; break; case 2: c.b = v; break; case 3: c.a = v; break; } } val = c; } } isSyncs[idx] = sync; } }
public void Set(int idx, string editVal1, EditRange er = null) { if (idx < editVals.Length) { editVals[idx] = editVal1; if (er == null) { er = GetRange(idx); } bool sync = false; float v; if (float.TryParse(editVal1, out v)) { if (er.editMin > v) { v = er.editMin; } else if (er.editMax < v) { v = er.editMax; } else { sync = true; } if (sync) { Color c = val.Value; if (type == ColorType.a) { c.a = v; } else { switch (idx) { case 0: c.r = v; break; case 1: c.g = v; break; case 2: c.b = v; break; case 3: c.a = v; break; } } val = c; } } isSyncs[idx] = sync; } }