本文整理汇总了C#中ObjectState类的典型用法代码示例。如果您正苦于以下问题:C# ObjectState类的具体用法?C# ObjectState怎么用?C# ObjectState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectState类属于命名空间,在下文中一共展示了ObjectState类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
}
开发者ID:TeamCherryBomb,项目名称:CherryQuest,代码行数:27,代码来源:DrawableGameObject.cs
示例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;
}
开发者ID:ahmedsaud,项目名称:MVC5Lessons,代码行数:28,代码来源:Helpers.cs
示例3: SetState
public void SetState(ObjectState State)
{
state = State;
//_interactable = State != ObjectState.Done;
graphic_dirty.SetActive(State == ObjectState.Dirty);
graphic_done.SetActive(triggerEvent._triggered);
}
开发者ID:compositeredfox,项目名称:arnosim,代码行数:7,代码来源:InteractiveObject.cs
示例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!");
}
}
开发者ID:Clink92,项目名称:PushTheButtonX,代码行数:33,代码来源:DropHatch.cs
示例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;
}
开发者ID:fjiang2,项目名称:sqlcon,代码行数:15,代码来源:RowChangedEventArgs.cs
示例6: ItemInfo
public ItemInfo(int tex)
: base(null)
{
ID_ = idCounter++;
tex_ = tex;
structureID_ = -1;
state_ = ObjectState.OK;
}
开发者ID:BigDub,项目名称:HomePrototype,代码行数:8,代码来源:ItemInfo.cs
示例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;
}
开发者ID:kjk,项目名称:volante,代码行数:9,代码来源:MarshalByRefPersistent.cs
示例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 );
}
开发者ID:inspirer,项目名称:uml-designer,代码行数:10,代码来源:GuiEnum.cs
示例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);
}
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:11,代码来源:ObjectFacadeTests.cs
示例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);
}
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:11,代码来源:ObjectFacadeTests.cs
示例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);
}
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:13,代码来源:ObjectFacadeTests.cs
示例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;
}
}
开发者ID:Mousum,项目名称:erp_asp,代码行数:14,代码来源:DbContextExtension.cs
示例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;
}
开发者ID:shivathebravo,项目名称:MVC-EF-Knockout-Parent-Child-Data,代码行数:14,代码来源:ViewModelHelpers.cs
示例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;
}
}
开发者ID:WorldWayno,项目名称:AngularBootstrap,代码行数:14,代码来源:StateHelper.cs
示例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;
}
开发者ID:Whylex,项目名称:ikit-mita-materials,代码行数:14,代码来源:Program.cs
示例16: setState
public void setState(ObjectState state)
{
switch (state)
{
case ObjectState.OK:
color_ = Color.White;
break;
case ObjectState.DISABLED:
color_ = Color.Yellow;
break;
case ObjectState.DAMAGED:
color_ = Color.Red;
break;
}
}
开发者ID:BigDub,项目名称:HomePrototype,代码行数:15,代码来源:RenderComponent.cs
示例17: GetMessageToClient
public static string GetMessageToClient(ObjectState objectState, string customerName)
{
string messageToClient = string.Empty;
switch (objectState)
{
case ObjectState.Added:
messageToClient = string.Format("Saving new entry for {0}", customerName);
break;
case ObjectState.Modified:
messageToClient = string.Format("Saving changes to {0}", customerName);
break;
}
return messageToClient;
}
开发者ID:cmchase,项目名称:ps-pc,代码行数:16,代码来源:Helpers.cs
示例18: Getting_object_reference_by_traversing_a_relation_preserves_identity_property
public void Getting_object_reference_by_traversing_a_relation_preserves_identity_property()
{
var parentObjectId = ObjectId.NewUniqueId();
var thisObjectState = new ObjectState(objectId, objectTypeId);
thisObjectState.Attach(parentObjectId, "Parent");
var parentObjectState = new ObjectState(parentObjectId, objectTypeId);
parentObjectState.Attach(objectId, "Children");
dataFacadeMock.Setup(x => x.GetById(objectId, changeSetId)).Returns(thisObjectState);
dataFacadeMock.Setup(x => x.GetById(parentObjectId, changeSetId)).Returns(parentObjectState);
var snapshot = objectFacade.GetSnapshot(changeSetId);
var objectDirectly = snapshot.GetById<TestingObject>(objectId);
var chidViaParentViaChild = objectDirectly.Parent.Children.First();
Assert.AreSame(chidViaParentViaChild, objectDirectly);
}
开发者ID:SzymonPobiega,项目名称:ReferenceDataManager,代码行数:17,代码来源:ObjectFacadeTests.cs
示例19: GetMessageToClient
public static string GetMessageToClient(ObjectState objectState, string employeeName)
{
string messageToClient = string.Empty;
switch (objectState)
{
case ObjectState.Added:
messageToClient = string.Format("A timesheet for {0} has been added to the database.", employeeName);
break;
case ObjectState.Modified:
messageToClient = string.Format("The employee for this timesheet has been updated to {0} in the database.", employeeName);
break;
}
return messageToClient;
}
开发者ID:kev1awlor,项目名称:Timetracker,代码行数:17,代码来源:Helpers.cs
示例20: UpdateObjectHit
public void UpdateObjectHit(EventTrigger objectHit)
{
// current object is changed only if the state is hovering
// Previous object is no longer hit
if (currentObject != null &&
objectHit != currentObject &&
currentObjectState == ObjectState.Hovering) {
currentObject.OnHoverOut();
}
if (objectHit != null &&
objectHit != currentObject &&
currentObjectState == ObjectState.Hovering) {
currentObjectState = ObjectState.Hovering;
objectHit.OnHoverIn();
}
if (currentObjectState == ObjectState.Hovering) {
currentObject = objectHit;
}
if (currentObject == null) {
return;
}
// We are calling the press only if the current object is being hovered
if (Input.GetMouseButtonDown(0) &&
currentObjectState == ObjectState.Hovering) {
currentObjectState = ObjectState.Pressing;
currentObject.OnPress();
}
// Only if we are currently pressing
if (Input.GetMouseButtonUp(0) &&
currentObjectState == ObjectState.Pressing) {
currentObject.OnRelease();
currentObjectState = ObjectState.Hovering;
// Only if we are currently pressing and the object hit is the same we call the on click
if (objectHit == currentObject) {
currentObject.OnClick();
}
}
}
开发者ID:tiberiu,项目名称:zombieage,代码行数:44,代码来源:InputManager.cs
注:本文中的ObjectState类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论