本文整理汇总了C#中Value类的典型用法代码示例。如果您正苦于以下问题:C# Value类的具体用法?C# Value怎么用?C# Value使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Value类属于命名空间,在下文中一共展示了Value类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Card
public Card(Suit suit, Value value)
{
this.value = value;
this.suit = suit;
this.name = GetName();
this.owner = null;
}
示例2: Apply
public override void Apply(ComputedStyle style,Value value){
// Get the border:
BorderProperty border=GetBorder(style);
if(value!=null && value.Type==ValueType.Text){
if(value.Text=="transparent"){
// Currently assume the default colour (black):
// (Use #00000000 instead)
value=null;
}
}
// Apply the base colour:
border.BaseColour=value;
// Reset the border colour:
border.ResetColour();
// Tell it a colour changed:
border.ColourChanged();
}
示例3: Apply
public override void Apply(ComputedStyle style,Value value){
// E.g. relative, fixed.
if(style.SetupTransform(value)){
if(value==null){
style.Transform.OriginPosition=PositionType.Relative;
}else{
if(value.Text=="fixed"){
style.Transform.OriginPosition=PositionType.Fixed;
}else if(value.Text=="absolute"){
style.Transform.OriginPosition=PositionType.Absolute;
}else{
style.Transform.OriginPosition=PositionType.Relative;
}
}
}
style.RequestTransform();
}
示例4: Add
public Value Add(Value val1, Value val2)
{
HeapValue heapVal1 = (HeapValue) val1;
HeapValue heapVal2 = (HeapValue) val2;
return new HeapValue(_content, heapVal1.size + heapVal2.size);
}
示例5: Load
private static bool Load(BinaryReader reader, out Value value)
{
List<KeyValuePair<Value, Value>> array;
Value arrayKey;
Value arrayValue;
int count;
ValueContent type;
type = (ValueContent)reader.ReadInt32 ();
switch (type)
{
case ValueContent.Boolean:
value = reader.ReadBoolean () ? BooleanValue.True : BooleanValue.False;
break;
case ValueContent.Map:
count = reader.ReadInt32 ();
array = new List<KeyValuePair<Value, Value>> (count);
while (count-- > 0)
{
if (!ValueAccessor.Load (reader, out arrayKey) || !ValueAccessor.Load (reader, out arrayValue))
{
value = null;
return false;
}
array.Add (new KeyValuePair<Value, Value> (arrayKey, arrayValue));
}
value = array;
break;
case ValueContent.Number:
value = reader.ReadDecimal ();
break;
case ValueContent.String:
value = reader.ReadString ();
break;
case ValueContent.Void:
value = VoidValue.Instance;
break;
default:
value = null;
return false;
}
return true;
}
示例6: MoveTouch
public void MoveTouch(int id, float x, float y)
{
moveValues[0] = new Value(id, MovieID);
moveValues[1] = new Value(x / Screen.width, MovieID);
moveValues[2] = new Value(1 - y / Screen.height, MovieID);
Invoke("root.Scaleform_moveTouch", moveValues, 3);
}
示例7: Nils
public void Nils()
{
var val = new Value();
Assert.IsTrue( val.IsNil );
Assert.IsFalse( val.ToBool() );
Assert.AreEqual( LValueType.Nil, val.ValueType );
val.Set( true );
Assert.IsFalse( val.IsNil );
val.Set( Value.Nil );
Assert.IsTrue( val.IsNil );
val = new Value();
Assert.IsTrue( val.IsNil );
val = Value.Nil;
Assert.IsTrue( val.IsNil );
val.Set( true );
Assert.IsFalse( val.IsNil );
val.SetNil();
Assert.IsTrue( val.IsNil );
}
示例8: Apply
public override void Apply(ComputedStyle style,Value value){
// The new overlay colour:
Color overlay=Color.white;
if(value!=null){
overlay=value.ToColor();
}
// Apply it:
style.ColorOverlay=overlay;
// Special case here - everything needs to be told!
if(style.BGImage!=null){
style.BGImage.SetOverlayColour(overlay);
}
if(style.BGColour!=null){
style.BGColour.SetOverlayColour(overlay);
}
if(style.Border!=null){
style.Border.SetOverlayColour(overlay);
}
if(style.Text!=null){
style.Text.SetOverlayColour(overlay);
}
}
示例9: Invoke
public Value Invoke(Value objectVar, List<Value> parameters)
{
if (parameters.Count == parameterNames.Count)
{
// create new scope for the method call
var methodScope = new Scope();
methodScope.Define("this");
methodScope.Assign("this", objectVar);
for (int i = 0; i < parameterNames.Count; i++)
{
methodScope.Define(parameterNames[i]);
methodScope.Assign(parameterNames[i], parameters[i]);
}
var nodeStream = new CommonTreeNodeStream(functionBody);
// Create a tree walker to evaluate this method's code block
var walker = new SGLTreeWalker(nodeStream, methodScope);
Value returnValue = null;
// Ok, executing the function then
returnValue = walker.main().Evaluate();
// we shouldn't check the return type
/*if (!returnValue.GetVarType().Equals(this.returnType))
{
throw new Exception("The method doesn't return the expected return type (" + returnValue.ToString() + " is not from type " + this.returnType + ")");
}*/
return returnValue;
}
throw new CompilerException(definedLine, 318, name, parameterNames.Count.ToString(), parameters.Count.ToString());
}
示例10: Apply
public override void Apply(ComputedStyle style,Value value){
// Get the border:
BorderProperty border=GetBorder(style);
if(value==null){
// No corners:
border.Corners=null;
}else{
// Apply top left:
border.SetCorner(RoundCornerPosition.TopLeft,value.GetPX(0));
// Apply top right:
border.SetCorner(RoundCornerPosition.TopRight,value.GetPX(1));
// Apply bottom right:
border.SetCorner(RoundCornerPosition.BottomLeft,value.GetPX(2));
// Apply bottom left:
border.SetCorner(RoundCornerPosition.BottomRight,value.GetPX(3));
}
// Request a layout:
border.RequestLayout();
}
示例11: AmbiguousDataContainer
public AmbiguousDataContainer(Value value, string name)
{
this.value = value;
this.entityOrComponentName = name;
value.AddHandler<ScopeChanged>(OnScopeChanged);
}
示例12: ExtractBody
/// <summary>Retrieve the body off the argument</summary>
internal static List<DelimiterList> ExtractBody(Value arg)
{
Map map = arg.AsMap;
if (map == null || !map.ContainsKey(keyBody))
return null;
return map[keyBody].AsLine;
}
示例13: Cell
/// <summary>
/// Internal constructor, must only be called by Sheet.CreateCell
/// </summary>
public Cell (Sheet sheet, int col, int row)
{
Sheet = sheet;
Col = col;
Row = row;
val = DefaultValue;
}
示例14: GeglBWProcessor
protected GeglBWProcessor(Gegl.Node _gegl)
: base()
{
gegl = _gegl;
SList children = gegl.Children;
load = mixer = contrast = tint = null;
foreach (Node c in children) {
string op = c.Operation;
if (op == "load")
load = c;
else if (op == "mono-mixer")
mixer = c;
else if (op == "contrast-curve")
contrast = c;
else if (op == "tint")
tint = c;
}
if (load == null || mixer == null || contrast == null || tint == null)
throw new ApplicationException("not all nodes found");
Value val = new Value(Gegl.Curve.GType);
contrastCurve = (GLib.Object)contrast.GetProperty("curve", ref val) as Gegl.Curve;
}
示例15: ThisDataContainer
public ThisDataContainer(Value value)
{
this.value = value;
Entity = value.Entity;
value.AddHandler<ScopeChanged>(OnScopeChanged);
}