本文整理汇总了C#中ObjectState类的典型用法代码示例。如果您正苦于以下问题:C# ObjectState类的具体用法?C# ObjectState怎么用?C# ObjectState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectState类属于命名空间,在下文中一共展示了ObjectState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Draw
public void Draw(SpriteBatch spriteBatch, Vector2 location, ObjectState state)
{
this.SpriteWidth = this.Texture.Width / this.Columns;
this.SpriteHeight = this.Texture.Height / this.Rows;
if (state == ObjectState.Moving)
{
int row = (int)((float)this.currentFrame / this.Columns);
int column = this.currentFrame % this.Columns;
var sourceRectangle = new Rectangle(this.SpriteWidth * column, this.SpriteHeight * row, this.SpriteWidth, this.SpriteHeight);
var destinationRectangle = new Rectangle((int)location.X, (int)location.Y, this.SpriteWidth, this.SpriteHeight);
spriteBatch.Begin();
spriteBatch.Draw(this.Texture, destinationRectangle, sourceRectangle, Color.White, this.Rotation, new Vector2(0, 0), this.Effects, 0f);
spriteBatch.End();
}
else
{
var sourceRectangle = new Rectangle(0, 0, this.SpriteWidth, this.SpriteHeight);
var destinationRectangle = new Rectangle((int)location.X, (int)location.Y, this.SpriteWidth, this.SpriteHeight);
spriteBatch.Begin();
spriteBatch.Draw(this.Texture, destinationRectangle, sourceRectangle, Color.White, this.Rotation, new Vector2(0, 0), this.Effects, 0f);
spriteBatch.End();
}
}
示例2: getMessageToClient
public static string getMessageToClient(ObjectState _objectState, string _customerName)
{
string messageToClient = string.Empty;
switch (_objectState)
{
case ObjectState.Added:
{
messageToClient = string.Format("A sales order for {0} has been added to the database.", _customerName);
}
break;
case ObjectState.Modified:
{
messageToClient = string.Format("The customer name for the sales order has been updated to {0} in the database", _customerName);
}
break;
case ObjectState.Deleted:
{
messageToClient = "You are about to permanently deleting this sales order";
}
break;
default:
messageToClient = string.Format("The orignal value of Customer Name is {0}", _customerName);
break;
}
return messageToClient;
}
示例3: SetState
public void SetState(ObjectState State)
{
state = State;
//_interactable = State != ObjectState.Done;
graphic_dirty.SetActive(State == ObjectState.Dirty);
graphic_done.SetActive(triggerEvent._triggered);
}
示例4: Awake
private void Awake()
{
m_collider2D = GetComponent<Collider2D>();
// E-man - Begin
motherShipExplosion = GameObject.Find("MotherShipExplosion");
if (motherShipExplosion)
{
motherShipExplosion.SetActive(false);
}
else
{
Debug.Log("DopHatch::Awake(), Hey buddy! Can't find your explosion guy!");
}
// E-man - End
m_objectState = GetComponent<ObjectState>();
Handler = GameObject.Find("Input Handler");
Ihandler = Handler.GetComponent<InputHandler>();
GameObject go = GameObject.Find("Pod");
m_podRigidbody = go.GetComponent<Rigidbody2D>();
// E-man
as_explosion = GetComponent<AudioSource>();
if(!fire)
{
Debug.Log("DopHatch::Awake(), Hey buddy! Can't seem to find your fire fwiend!");
}
}
示例5: RowChangedEventArgs
public bool saved; //RowChanged fired twice during Adding a record;
#endregion Fields
#region Constructors
//true: after record saved
//false: before record saving, give a chance to deny saving
public RowChangedEventArgs(RowAdapter adapter, ObjectState state, bool saved)
{
this.adapter = adapter;
this.state = state;
this.confirmed = true;
this.saved = saved;
}
示例6: ItemInfo
public ItemInfo(int tex)
: base(null)
{
ID_ = idCounter++;
tex_ = tex;
structureID_ = -1;
state_ = ObjectState.OK;
}
示例7: AssignOid
public void AssignOid(IDatabase db, int oid, bool raw)
{
this.oid = oid;
this.db = db;
if (raw)
state |= ObjectState.RAW;
else
state &= ~ObjectState.RAW;
}
示例8: Apply
public void Apply(ObjectState v)
{
State t = v as State;
X = t.x;
Y = t.y;
show_members = t.b1;
show_full_qual = t.b2;
RefreshContent();
SetHidden( t.hidden );
}
示例9: It_maps_attributes_without_values_to_default_values_for_their_typs
public void It_maps_attributes_without_values_to_default_values_for_their_typs()
{
var objectState = new ObjectState(objectId, objectTypeId);
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var o = snapshot.GetById<TestingObject>(objectId);
Assert.IsNull(o.TextValue);
Assert.AreEqual(0, o.IntValue);
}
示例10: It_does_not_map_attributes_that_are_not_listed_in_object_type_descriptor
public void It_does_not_map_attributes_that_are_not_listed_in_object_type_descriptor()
{
var objectState = new ObjectState(objectId, objectTypeId);
objectState.ModifyAttribute("NotMappedProperty", 10.5m);
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var o = snapshot.GetById<TestingObject>(objectId);
Assert.AreEqual(0m, o.NotMappedProperty);
}
示例11: It_maps_attribute_values_to_properties
public void It_maps_attribute_values_to_properties()
{
var objectState = new ObjectState(objectId, objectTypeId);
objectState.ModifyAttribute("TextValue", "SomeValue");
objectState.ModifyAttribute("IntValue", 42);
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(objectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var o = snapshot.GetById<TestingObject>(objectId);
Assert.AreEqual("SomeValue", o.TextValue);
Assert.AreEqual(42, o.IntValue);
}
示例12: ConvertState
private static System.Data.Entity.EntityState ConvertState(ObjectState state)
{
switch (state)
{
case ObjectState.Added:
return System.Data.Entity.EntityState.Added;
case ObjectState.Modified:
return System.Data.Entity.EntityState.Modified;
case ObjectState.Deleted:
return System.Data.Entity.EntityState.Deleted;
default:
return System.Data.Entity.EntityState.Unchanged;
}
}
示例13: GetMessageToClient
public static string GetMessageToClient(ObjectState objectState, string customerName)
{
string meeesageToClient = string.Empty;
switch (objectState)
{
case ObjectState.Added:
meeesageToClient = string.Format("A's sales order for{0} has been added to the database", customerName);
break;
case ObjectState.Modified:
meeesageToClient = string.Format("The Custoemr name for this sales order has been updated to {0}", customerName);
break;
}
return meeesageToClient;
}
示例14: ConvertState
public static EntityState ConvertState(ObjectState state)
{
switch (state)
{
case ObjectState.Added:
return EntityState.Added;
case ObjectState.Modified:
return EntityState.Modified;
case ObjectState.Deleted:
return EntityState.Deleted;
default:
return EntityState.Unchanged;
}
}
示例15: GetDisplayString
public static string GetDisplayString(ObjectState state)
{
Type type = typeof(ObjectState);
FieldInfo fieldInfo = type.GetField(state.ToString());
Attribute attr = fieldInfo.GetCustomAttribute(typeof(EnumDisplayStringAttribute));
var dispAttr = (EnumDisplayStringAttribute)attr;
if (dispAttr == null)
{
return state.ToString();
}
return dispAttr.DisplayString;
}