本文整理汇总了C#中IObject类的典型用法代码示例。如果您正苦于以下问题:C# IObject类的具体用法?C# IObject怎么用?C# IObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IObject类属于命名空间,在下文中一共展示了IObject类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsProperty
public bool IsProperty(IObject element)
{
var attributeXmi = "{" + Namespaces.Xmi + "}type";
return element.isSet(attributeXmi) &&
element.get(attributeXmi).ToString() == "uml:Property";
}
示例2: WalkClass
protected override void WalkClass(IObject classInstance, CallStack stack)
{
var name = GetNameOfElement(classInstance);
Result.AppendLine($"{stack.Indentation}if(name == \"{name}\") // Looking for class");
Result.AppendLine($"{stack.Indentation}{{");
string fullName;
if (stack.Level == 1)
{
// Removes the name of the package of the first hierarchy level
// since it is already included into the class name
fullName = $".__{name}";
}
else
{
fullName = $"{stack.Fullname}.__{name}";
}
var ifStack = stack.NextWithoutLevelIncrease;
var ifForeachStack = ifStack.NextWithoutLevelIncrease;
Result.AppendLine($"{ifStack.Indentation}tree{fullName} = value;");
Result.AppendLine($"{ifStack.Indentation}isSet = value.isSet(\"ownedAttribute\");");
Result.AppendLine(
$"{ifStack.Indentation}collection = isSet ? (value.get(\"ownedAttribute\") as IEnumerable<object>) : EmptyList;");
Result.AppendLine($"{ifStack.Indentation}foreach (var item{ifStack.Level} in collection)");
Result.AppendLine($"{ifStack.Indentation}{{");
Result.AppendLine($"{ifForeachStack.Indentation}value = item{ifStack.Level} as IElement;");
Result.AppendLine($"{ifForeachStack.Indentation}name = GetNameOfElement(value);");
base.WalkClass(classInstance, ifStack);
Result.AppendLine($"{ifStack.Indentation}}}");
Result.AppendLine($"{stack.Indentation}}}");
}
示例3: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
///cast to out world instance
PhysxPhysicWorld PhysxPhysicWorld = World.PhysicWorld as PhysxPhysicWorld;
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
///Physic Triangle mesh (same as bepu)
PhysxTriangleMesh tmesh = new PhysxTriangleMesh(PhysxPhysicWorld,simpleModel,
Matrix.Identity, Vector3.One);
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
///Ball Throw !!!
BallThrowPhysx28 BallThrowBullet = new BallThrowPhysx28(this.World, GraphicFactory);
this.AttachCleanUpAble(BallThrowBullet);
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo));
}
示例4: onSaveGameLoaded
private void onSaveGameLoaded()
{
_panel = _game.Find<IPanel>(_panel.ID);
_inventoryItemIcon = _game.Find<IObject>(_inventoryItemIcon.ID);
_player = _game.State.Player;
_lastInventoryItem = null;
}
示例5: LoadContent
/// <summary>
/// Load content for the screen.
/// </summary>
/// <param name="GraphicInfo"></param>
/// <param name="factory"></param>
/// <param name="contentManager"></param>
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory, IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
for (int i = 0; i < 10; i++)
{
for (int j = 0; j < 10; j++)
{
float x, y;
x = -i * 100;
y = -j * 100;
TreeModel tm = new TreeModel(factory, "Trees\\Pine", null, null);
ForwardTreeShader ts = new ForwardTreeShader();
TreeMaterial tmat = new TreeMaterial(ts, new WindStrengthSin());
GhostObject go = new GhostObject(new Vector3(x, 0, y), Matrix.Identity, new Vector3(0.05f));
IObject ox = new IObject(tmat, tm, go);
this.World.AddObject(ox);
}
}
}
///add a camera
this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo.Viewport));
}
示例6: IsSuperClass
/// <summary>
/// Tests if an object is a plugin with the supplied SuperClass.
/// </summary>
public static bool IsSuperClass(IObject objectRef, SClass_ID scid)
{
if (objectRef == null)
return false;
return objectRef.SuperClassID == scid;
}
示例7: LoadContent
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager)
{
base.LoadContent(GraphicInfo, factory, contentManager);
{
SimpleModel simpleModel = new SimpleModel(factory, "Model//cenario");
TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial());
ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default());
ForwardMaterial fmaterial = new ForwardMaterial(shader);
IObject obj = new IObject(fmaterial, simpleModel, tmesh);
this.World.AddObject(obj);
}
var newCameraFirstPerson = new CameraStatic(new Vector3(100,100,100), - new Vector3(100,100,100) );
this.World.CameraManager.AddCamera(newCameraFirstPerson);
SimpleConcreteGestureInputPlayable SimpleConcreteGestureInputPlayable = new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.DoubleTap, (sample) => doubleTapCount++);
this.BindInput(SimpleConcreteGestureInputPlayable);
this.BindInput(new SimpleConcreteGestureInputPlayable(Microsoft.Xna.Framework.Input.Touch.GestureType.Hold,
(sample) =>
{
this.RemoveInputBinding(SimpleConcreteGestureInputPlayable);
doubleTapDisabled = true;
}
));
}
示例8: Billboard3D
public Billboard3D(Texture2D tex,IObject obj, Vector3 displacement, Vector2 scale)
{
this.Texture = tex;
this.Position = displacement;
this.obj = obj;
this.Scale = scale;
}
示例9: AssociationEquals
internal AssociationEquals(ExtentFiltered extent, IAssociationType association, IObject allorsObject)
{
extent.CheckAssociation(association);
PredicateAssertions.AssertAssociationEquals(association, allorsObject);
this.association = association;
this.allorsObject = allorsObject;
}
示例10: SpawnPrimitive
/// <summary>
/// Create a simple Sphere object
/// </summary>
/// <param name="pos"></param>
/// <param name="ori"></param>
/// <returns></returns>
private IObject SpawnPrimitive(Vector3 pos, Matrix ori)
{
///Load a Model with a custom texture
sm2 = new SimpleModel(factory,"Model\\ball");
sm2.SetTexture(factory.CreateTexture2DColor(1,1,Color.White,false), TextureType.DIFFUSE);
IMaterial m;
if (forward)
{
ForwardXNABasicShader nd = new ForwardXNABasicShader();
m = new ForwardMaterial(nd);
}
else
{
DeferredNormalShader nd = new DeferredNormalShader();
m = new DeferredMaterial(nd);
}
PhysxPhysicWorld PhysxPhysicWorld = _mundo.PhysicWorld as PhysxPhysicWorld;
SphereShapeDescription SphereGeometry = new SphereShapeDescription(5f);
PhysxPhysicObject PhysxPhysicObject = new PhysxPhysicObject(SphereGeometry,
0.5f, Matrix.CreateTranslation(pos), Vector3.One * 5f);
IObject o = new IObject(m, sm2, PhysxPhysicObject);
return o;
}
示例11: RoleContains
internal RoleContains(ExtentFiltered extent, IRoleType role, IObject allorsObject)
{
extent.CheckRole(role);
PredicateAssertions.ValidateRoleContains(role, allorsObject);
this.role = role;
this.allorsObject = allorsObject;
}
示例12: GetName
public string GetName(IObject element)
{
// Returns the name by the uml logic.
var dataLayer = _dataLayerLogic?.GetDataLayerOfObject(element);
var metaLayer = _dataLayerLogic?.GetMetaLayerFor(dataLayer);
var uml = _dataLayerLogic?.Get<_UML>(metaLayer);
if (uml != null && element.isSet(_UML._CommonStructure._NamedElement.name))
{
var result = element.get(_UML._CommonStructure._NamedElement.name);
if (result != null)
{
return result.ToString();
}
}
// If the element is not uml induced or the property is empty, check by
// the default "name" property
if (element.isSet("name"))
{
return element.get("name").ToString();
}
// Ok, finally, we don't know what to do, so request retrieve the name just via ToString
return element.ToString();
}
示例13: MakeActive
public void MakeActive(IObject Object)
{
activeObject = Object;
if(! (activeObject is ControlPoint)) {
if(activeObject != null)
application.EditProperties(activeObject, activeObject.GetType().Name);
controlPoints.Clear();
}
if(activeObject != null && activeObject.Resizable) {
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.TOP | ControlPoint.AttachPoint.LEFT));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.TOP));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.TOP | ControlPoint.AttachPoint.RIGHT));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.LEFT));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.RIGHT));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.BOTTOM | ControlPoint.AttachPoint.LEFT));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.BOTTOM));
controlPoints.Add(new ControlPoint(activeObject,
ControlPoint.AttachPoint.BOTTOM | ControlPoint.AttachPoint.RIGHT));
}
application.PrintStatus( "ObjectsEditor:MakeActive(" + activeObject + ")" );
}
示例14: AGSInteractions
public AGSInteractions (IInteractions defaultInteractions, IObject obj, IGameState state)
{
_events = new ConcurrentDictionary<string, IEvent<ObjectEventArgs>>();
_inventoryEvents = new ConcurrentDictionary<string, IEvent<InventoryInteractEventArgs>>();
var defaultInteractionEvent = new AGSInteractionEvent<ObjectEventArgs>(
new List<IEvent<ObjectEventArgs>>(), DEFAULT, obj, state);
var defaultInventoryEvent = new AGSInteractionEvent<InventoryInteractEventArgs>(
new List<IEvent<InventoryInteractEventArgs>>(), DEFAULT, obj, state);
_events.TryAdd(DEFAULT, defaultInteractionEvent);
_inventoryEvents.TryAdd(DEFAULT, defaultInventoryEvent);
_factory = verb =>
{
List<IEvent<ObjectEventArgs>> interactions = new List<IEvent<ObjectEventArgs>> { defaultInteractionEvent };
if (defaultInteractions != null)
{
interactions.Add(defaultInteractions.OnInteract(verb));
if (verb != DEFAULT) interactions.Add(defaultInteractions.OnInteract(DEFAULT));
}
return new AGSInteractionEvent<ObjectEventArgs>(interactions, verb, obj, state);
};
_inventoryFactory = verb =>
{
List<IEvent<InventoryInteractEventArgs>> interactions = new List<IEvent<InventoryInteractEventArgs>> { defaultInventoryEvent };
if (defaultInteractions != null)
{
interactions.Add(defaultInteractions.OnInventoryInteract(verb));
if (verb != DEFAULT) interactions.Add(defaultInteractions.OnInventoryInteract(DEFAULT));
}
return new AGSInteractionEvent<InventoryInteractEventArgs>(interactions, verb, obj, state);
};
}
示例15: Draw
protected override void Draw(GameTime gt, IObject obj, RenderHelper render, ICamera cam, IList<ILight> lights)
{
Vector3 dir = cam.Target - cam.Position;
dir.Normalize();
_shader.Parameters["forward"].SetValue(dir);
_shader.Parameters["camUp"].SetValue(cam.Up);
_shader.Parameters["scaleX"].SetValue(scale.X);
_shader.Parameters["scaleY"].SetValue(scale.Y);
_shader.Parameters["xWorld"].SetValue(obj.PhysicObject.WorldMatrix);
_shader.Parameters["xView"].SetValue(cam.View);
_shader.Parameters["xProjection"].SetValue(cam.Projection);
//_shader.Parameters["xBillboardTexture"].SetValue(obj.Modelo.getTexture(TextureType.DIFFUSE,0,0));
render.Textures[0] = obj.Modelo.getTexture(TextureType.DIFFUSE, 0, 0);
_shader.Parameters["atenuation"].SetValue(atenuation);
render.PushRasterizerState(RasterizerState.CullNone);
BatchInformation batchInfo = obj.Modelo.GetBatchInformation(0)[0];
{
_shader.Parameters["alphaTest"].SetValue(alphaTestLimit);
render.RenderBatch(batchInfo, _shader);
}
render.PopRasterizerState();
}