void onValueChange(ValueFloat v1, float v2) { if (_onValueChange != null) { _onValueChange(v1, v2); } }
public void AddValueChange(string key, VoidDelegateValueFloatFloat _cb) { if (!valuefloat.ContainsKey(key)) { var vi = new ValueFloat(); valuefloat.Add(key, vi); } valuefloat [key].AddValueChangeCB(_cb); }
public void SetMinValue(string key, float value) { if (!valuefloat.ContainsKey(key)) { var vi = new ValueFloat(); valuefloat.Add(key, vi); } valuefloat [key].SetMinValue(value); }
public float GetFloatQ(string key) { if (!valuefloat.ContainsKey(key)) { var vi = new ValueFloat(); valuefloat.Add(key, vi); } return(valuefloat [key].GetValue() / 1000); }
private void readValueArray(BinaryReader br) { if (ValueLength == 0) { return; } Value[] Values = new Value[ArrayCount]; for (int i = 0; i < ArrayCount; i++) { switch (Type) { case ShaderParameterType.@int: Values[i] = new ValueInt(br); break; case ShaderParameterType.@float: Values[i] = new ValueFloat(br); break; case ShaderParameterType.float2: Values[i] = new ValueFloat2(br); break; case ShaderParameterType.float3: Values[i] = new ValueFloat3(br); break; case ShaderParameterType.float4: Values[i] = new ValueFloat4(br); break; case ShaderParameterType.@bool: Values[i] = new ValueBool(br); break; case ShaderParameterType.float4x3: Values[i] = new ValueFloat4x3(br); break; case ShaderParameterType.float4x4: Values[i] = new ValueFloat4x4(br); break; case ShaderParameterType.sampler: int len = ValueLength / ArrayCount; Values[i] = new ValueSamplerState(br, len); break; } } Value = new ValueList(Values); }
private void readValue(BinaryReader br) { if (ValueLength == 0) { return; } switch (Type) { case ShaderParameterType.@int: Value = new ValueInt(br); break; case ShaderParameterType.@float: Value = new ValueFloat(br); break; case ShaderParameterType.float2: Value = new ValueFloat2(br); break; case ShaderParameterType.float3: Value = new ValueFloat3(br); break; case ShaderParameterType.float4: Value = new ValueFloat4(br); break; case ShaderParameterType.@bool: Value = new ValueBool(br); break; case ShaderParameterType.float4x3: Value = new ValueFloat4x3(br); break; case ShaderParameterType.float4x4: Value = new ValueFloat4x4(br); break; case ShaderParameterType.sampler: Value = new ValueSamplerState(br, ValueLength); break; } }
public void AddValue(string key, float value, string type) { if (!valuefloat.ContainsKey(key)) { var vi = new ValueFloat(); valuefloat.Add(key, vi); } if (type == "Base") { valuefloat [key].AddBaseValue(value); } else if (type == "Buff") { valuefloat [key].AddBuffValue(value); } }
public bool IsValueDefault() { if (ValueInt != null) { return(ValueInt.Equals(ValueIntDefault)); } if (ValueFloat != null) { return(ValueFloat.Equals(ValueFloatDefault)); } if (ValueCol != null) { return(ValueCol.Equals(ValueColDefault)); } return(false); }
public string GetDisplayableValue() { if (ValueInt != null) { return(ValueInt.ToString()); } if (ValueFloat != null) { return(ValueFloat.ToString()); } if (ValueCol != null) { return(ValueCol.ToString()); } return("#unimplemented value"); }
public float GetFloat() { ValueFloat v = PropValue as ValueFloat; return(v != null ? v.Float : 0.0f); }
public void TestNumber() { Value pattern = PatternData.Single("a", ValueType.Number); Value match = null, leftover = null; { // single int type - match Value input = new ValueInt(42); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(42, match.AsInt); Assert.AreEqual(null, leftover); } { // single float type - match Value input = new ValueFloat(3.5); Assert.IsTrue(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); Assert.AreEqual(3.5, match.AsFloat); Assert.AreEqual(null, leftover); } { // single string type - not a match Value input = new ValueString("hello"); Assert.IsFalse(PatternChecker.Do(input, pattern, false/*bShortPat*/, out match, out leftover)); } }
void onMoveSpeedChange(ValueFloat v1, float v2) { cachedMoveSpeed = v1.GetValue(); }
void onHPChange(ValueFloat vi, float v1) { Debug.Log("血量发生改变 value :[" + v1 + "]"); MessageProvider.Instance.Execute(enBattleUIAction.enUpdateHP, hppos, vi.GetProportion()); }
/// <summary> /// Make a parameter that's an array of two values, /// each of which could be an int or float /// </summary> private DelimiterNode MakePair(double a, double b, bool bInt1, bool bInt2) { List<Value> list = new List<Value>(); Value value1, value2; if (bInt1) value1 = new ValueInt((int)a); else value1 = new ValueFloat(a); list.Add(value1); if (bInt2) value2 = new ValueInt((int)b); else value2 = new ValueFloat(b); list.Add(value2); return new DelimiterNodeValue(new ValueArray(list)); }