public bool HasObject(IObject value) { lock (_cachedObjects) { return _cachedObjects.Contains(value); } }
/// <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); ///Uncoment to add your model SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario"); ///Physic info (position, rotation and scale are set here) TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Deferred material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself IObject obj = new IObject(fmaterial, simpleModel, tmesh); ///Add to the world this.World.AddObject(obj); ///add a camera this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); ///task sample taskSample taskSample = new taskSample(); ///when ended, call this (syncronous -- specified in the itask implementation) function taskSample.Ended += new Action<ITask, IAsyncResult>(taskSample_Ended); ///create and send the task to the processor TaskCommand TaskCommand = new TaskCommand(taskSample); CommandProcessor.getCommandProcessor().SendCommandAssyncronous(TaskCommand); }
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); } { SimpleModel simpleModel = new SimpleModel(factory, "Model//uzi"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(100,10,10), Matrix.Identity, Vector3.One * 10, MaterialDescription.DefaultBepuMaterial()); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); this.World.AddObject(obj); } this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); this.RenderTechnic.AddPostEffect(new BlackWhitePostEffect()); }
public bool IsProperty(IObject element) { var attributeXmi = "{" + Namespaces.Xmi + "}type"; return element.isSet(attributeXmi) && element.get(attributeXmi).ToString() == "uml:Property"; }
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)); }
public void Setup() { this.machine = new Machine(); this.manager = new TransactionManager(this.machine); this.obj = new BaseObject(null, new object[] { 1, 2, 3 }); this.trobj = new TransactionalObject(this.obj, new TransactionManager(this.machine)); }
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}}}"); }
public Player(IScreen screen, Vector3 position, Matrix rotation, SimpleModel model, float width, float height, Boolean useThirdPerson = false) : base(screen, position, rotation, width, height, new Vector3(1F)) { this.height = height * scale.Y; charecter.CharacterController.HorizontalMotionConstraint.Speed = 50; charecter.CharacterController.HorizontalMotionConstraint.MaximumForce = 10000; charecter.CharacterController.JumpSpeed = 35; mod = model; obj = new IObject(Materials.dMaterial, mod, charecter); Mouse.SetPosition(EngineSettings.graphicInfo.BackBufferWidth / 2, EngineSettings.graphicInfo.BackBufferHeight / 2); bstate = Mouse.GetState(); rotSpeed = 0.05F; zoomDistance = 50; camera = new PlayerCamera(obj, (height / 2)); camera.HorizontalOffset = -camera.HorizontalOffset; UpdateCamera(); firstPerson = !useThirdPerson; this.Start(); }
/// <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)); }
public override bool ValidateWorkingBase(IObject workingBase, DBTypeManager typeManager) { if (workingBase is DBTypeAttribute) { var workingTypeAttribute = (workingBase as DBTypeAttribute).GetValue(); if (workingTypeAttribute.TypeCharacteristics.IsBackwardEdge) { return true; } else if (workingTypeAttribute.GetDBType(typeManager).IsUserDefined) { return true; } else { return false; } } else { return false; } }
private void onSaveGameLoaded() { _panel = _game.Find<IPanel>(_panel.ID); _inventoryItemIcon = _game.Find<IObject>(_inventoryItemIcon.ID); _player = _game.State.Player; _lastInventoryItem = null; }
protected override void LoadContent(GraphicInfo GraphicInfo, GraphicFactory factory ,IContentManager contentManager) { base.LoadContent(GraphicInfo, factory, contentManager); { ///Uncoment to add your model SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario"); ///Physic info (position, rotation and scale are set here) TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Deferred material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself IObject obj = new IObject(fmaterial, simpleModel, tmesh); ///Add to the world this.World.AddObject(obj); } { SnowParticleSystem snow = new SnowParticleSystem(); DPFSParticleSystem ps = new DPFSParticleSystem("snow", snow); this.World.ParticleManager.AddAndInitializeParticleSystem(ps); ///cant set emiter position before adding the particle ///IF YOU DO SO, IT WILL NOT WORK snow.Emitter.PositionData.Position = new Vector3(500, 0, 0); } CameraFirstPerson cam = new CameraFirstPerson(MathHelper.ToRadians(-50), MathHelper.ToRadians(-10), new Vector3(-150, 150, 150), GraphicInfo); this.World.CameraManager.AddCamera(cam); }
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; } )); }
/// <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); ///Uncoment to add your model SimpleModel simpleModel = new SimpleModel(factory, "Model/cenario"); ///Physic info (position, rotation and scale are set here) TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, Vector3.Zero, Matrix.Identity, Vector3.One, MaterialDescription.DefaultBepuMaterial()); ///Forward Shader (look at this shader construction for more info) ForwardXNABasicShader shader = new ForwardXNABasicShader(); ///Forward material ForwardMaterial fmaterial = new ForwardMaterial(shader); ///The object itself IObject obj = new IObject(fmaterial, simpleModel, tmesh); ///Add to the world this.World.AddObject(obj); this.RenderTechnic.AddPostEffect(MotionBlurPostEffect); this.RenderTechnic.AddPostEffect(BloomPostEffect); BloomPostEffect.Enabled = false; MotionBlurPostEffect.Enabled = false; blurdefault = MotionBlurPostEffect.Amount; RotatingCamera cam = new RotatingCamera(this, new Vector3(0,-100,-400)); this.World.CameraManager.AddCamera(cam); RasterizerState = new RasterizerState(); RasterizerState.CullMode = CullMode.None; }
/// <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; }
public ExecutionContext(Machine machine, IObject self, Block block, object[] arguments) : this(block, arguments) { // this.self = receiver; // TODO review this.machine = machine; this.self = self; }
private ExecutionContext(Block block, object[] arguments) { this.block = block; this.Stack = new ArrayList(5); this.arguments = arguments; if (this.block.NoLocals > 0) this.locals = new object[this.block.NoLocals]; else this.locals = null; // TODO refactor to no copy of arguments and locals this.arguments = arguments; if (block.Closure != null) { this.self = block.Closure.Self; this.nativeSelf = block.Closure.NativeSelf; int nlocs = block.NoLocals - block.Closure.NoLocals; if (nlocs > 0) this.locals = new object[nlocs]; else this.locals = null; } else { if (this.block.NoLocals > 0) this.locals = new object[this.block.NoLocals]; else this.locals = null; } }
public void FireAll() { var items = new IObject[] { new ShipInfo { Code = ItemCode.LightFrigate }, new WeaponInfo { Code = ItemCode.MissileLauncher, MinimumDamage = 100, MaximumDamage = 100 }, }; var ship = new ShipState(ItemCode.LightFrigate) { LocalCoordinates = Vector.Parse("0,-1"), Heading = Vector.Parse("0,-1"), HardPoints = new[] { new HardPointState { Weapon = new WeaponState {Code = ItemCode.MissileLauncher}, Position = HardPointPosition.Front }, new HardPointState { Weapon = new WeaponState {Code = ItemCode.MissileLauncher}, Position = HardPointPosition.Rear }, new HardPointState { Weapon = new WeaponState {Code = ItemCode.MissileLauncher}, Position = HardPointPosition.Top }, } }; _combat = _combatFactory(ship, new IdResolutionContext(items)); Assert.That(_combat.Ship.HardPoints, Is.Not.Empty); _random.Setup(x => x.GetNext()).Returns(0); var result = _combat.Ship.HardPoints .Where(hp => hp.Weapon != null) .Where(hp => hp.InRange(_combat.Target)) .Select(x => _combat.Fire(x.Weapon)) .ToArray(); Assert.That(result, Is.Not.Empty); var dmg = result.Aggregate((Damage )null, (current, value) => current + value.TotalDamage); Assert.That(dmg.Value, Is.Not.EqualTo(0d)); }
public override void Initialize(GraphicInfo ginfo, GraphicFactory factory, IObject obj) { effect = factory.GetBasicEffect(); base.Initialize(ginfo,factory,obj); effect.PreferPerPixelLighting = true; SetDescription(desc); }
/// <summary> /// Constructs a death record around an existing object, /// adding death record properties (with default values) as necessary. /// </summary> /// <param name="target">the object containing / to contain the death record information</param> protected DeathRecord(IObject target) : base(target) { if (!PropertyExists(PropertyTags.City)) AddProperty(PropertyTags.City, "Unspecified"); if (!PropertyExists(PropertyTags.AgeInYears)) AddProperty(PropertyTags.AgeInYears, "-1"); if (!PropertyExists(PropertyTags.Gender)) AddProperty(PropertyTags.Gender, "U"); if (!PropertyExists(PropertyTags.Race)) AddProperty(PropertyTags.Race, "U"); if (!PropertyExists(PropertyTags.Volume)) AddProperty(PropertyTags.Volume, "-1"); if (!PropertyExists(PropertyTags.Page)) AddProperty(PropertyTags.Page, "-1"); if (!PropertyExists(PropertyTags.CertificateNumber)) AddProperty(PropertyTags.CertificateNumber, "-1"); if (!PropertyExists(PropertyTags.County)) AddProperty(PropertyTags.County, "Unspecified"); if (!PropertyExists(PropertyTags.LastName)) AddProperty(PropertyTags.LastName, "Unknown"); if (!PropertyExists(PropertyTags.FirstName)) AddProperty(PropertyTags.FirstName, "Unknown"); if (!PropertyExists(PropertyTags.MiddleName)) AddProperty(PropertyTags.MiddleName, string.Empty); }
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); } for (int i = 0; i < 10; i++) { for (int j = 0; j < 10; j++) { SimpleModel simpleModel = new SimpleModel(factory, "Model//uzi"); TriangleMeshObject tmesh = new TriangleMeshObject(simpleModel, new Vector3(18 * j, 10, 8 * i), Matrix.Identity, Vector3.One * 10, MaterialDescription.DefaultBepuMaterial()); ForwardXNABasicShader shader = new ForwardXNABasicShader(ForwardXNABasicShaderDescription.Default()); ForwardMaterial fmaterial = new ForwardMaterial(shader); IObject obj = new IObject(fmaterial, simpleModel, tmesh); obj.OnUpdate += new OnUpdate(obj_OnUpdate); this.World.AddObject(obj); } } this.World.CameraManager.AddCamera(new CameraFirstPerson(GraphicInfo)); }
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(); }
public Billboard3D(Texture2D tex,IObject obj, Vector3 displacement, Vector2 scale) { this.Texture = tex; this.Position = displacement; this.obj = obj; this.Scale = scale; }
/// <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; }
internal RoleContains(ExtentFiltered extent, IRoleType role, IObject allorsObject) { extent.CheckRole(role); PredicateAssertions.ValidateRoleContains(role, allorsObject); this.role = role; this.allorsObject = allorsObject; }
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 + ")" ); }
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(); }
internal AssociationEquals(ExtentFiltered extent, IAssociationType association, IObject allorsObject) { extent.CheckAssociation(association); PredicateAssertions.AssertAssociationEquals(association, allorsObject); this.association = association; this.allorsObject = allorsObject; }
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); }; }
public MRMPrim(IObject obj, MRMPrimFactory factory) { _factory = factory; _id = obj.GlobalID; _factory.RegisterPrim(this); SetUpExistingObj(obj, factory); }
IObject getValue(IObject obj) => ((Lazy)obj).Value;
internal bool ExtentRolesContains(IRoleType roleType, IObject value) => this.Roles.ExtentContains(roleType, value.Id);
public async Task <string> Run() { IGameFactory factory = _game.Factory; float panelWidth = _game.Settings.VirtualResolution.Width * 3 / 4f; float panelHeight = _game.Settings.VirtualResolution.Height * 3 / 4f; const float labelHeight = 20f; const float textBoxHeight = 20f; const float buttonHeight = 20f; float itemHeight = panelHeight / 8f; ITEM_WIDTH = panelWidth / 10f; float itemPaddingX = panelWidth / 10f; float itemPaddingY = panelHeight / 12f; const float scrollButtonWidth = 20f; const float scrollButtonHeight = 20f; const float scrollButtonOffsetX = 5f; const float scrollButtonOffsetY = 5f; const float okButtonWidth = 50f; const float okButtonHeight = 20f; const float okButtonPaddingX = 20f; const float okButtonPaddingY = 20f; float okCancelWidth = okButtonWidth * 2 + okButtonPaddingX; float okButtonX = panelWidth / 2f - okCancelWidth / 2f; float cancelButtonX = okButtonX + okButtonWidth + okButtonPaddingX; float panelX = _game.Settings.VirtualResolution.Width / 2f - panelWidth / 2f; float panelY = _game.Settings.VirtualResolution.Height / 2f - panelHeight / 2f; ITextConfig textBoxConfig = new AGSTextConfig(alignment: Alignment.BottomLeft, autoFit: AutoFit.TextShouldCrop, font: _game.Factory.Fonts.LoadFont(null, 10f)); IPanel panel = factory.UI.GetPanel("SelectFilePanel", panelWidth, panelHeight, panelX, panelY); panel.RenderLayer = new AGSRenderLayer(AGSLayers.UI.Z - 1); panel.SkinTags.Add(AGSSkin.DialogBoxTag); panel.Skin?.Apply(panel); panel.AddComponent <IModalWindowComponent>().GrabFocus(); ILabel titleLabel = factory.UI.GetLabel("SelectFileTitle", _title, panelWidth, labelHeight, 0f, panelHeight - labelHeight, panel, _buttonsTextConfig); _fileTextBox = factory.UI.GetTextBox("SelectFileTextBox", 0f, panelHeight - labelHeight - textBoxHeight, panel, _startPath, textBoxConfig, width: panelWidth, height: textBoxHeight); _inventory = new AGSInventory(); IInventoryWindow invWindow = factory.Inventory.GetInventoryWindow("SelectFileInventory", panelWidth - scrollButtonWidth - scrollButtonOffsetX * 2, panelHeight - labelHeight - buttonHeight - textBoxHeight - okButtonPaddingY, ITEM_WIDTH + itemPaddingX, itemHeight + itemPaddingY, 0f, okButtonPaddingY + okButtonHeight, _inventory); invWindow.Z = 1; IButton okButton = factory.UI.GetButton("SelectFileOkButton", (string)null, null, null, okButtonX, okButtonPaddingY, panel, "OK", _buttonsTextConfig, width: okButtonWidth, height: okButtonHeight); IButton cancelButton = factory.UI.GetButton("SelectFileCancelButton", (string)null, null, null, cancelButtonX, okButtonPaddingY, panel, "Cancel", _buttonsTextConfig, width: okButtonWidth, height: okButtonHeight); IButton scrollDownButton = factory.UI.GetButton("SelectFileScrollDown", (string)null, null, null, panelWidth - scrollButtonWidth - scrollButtonOffsetX, okButton.Y + okButtonHeight + scrollButtonOffsetY, panel, "", _buttonsTextConfig, width: scrollButtonWidth, height: scrollButtonHeight); IButton scrollUpButton = factory.UI.GetButton("SelectFileScrollUp", (string)null, null, null, panelWidth - scrollButtonWidth - scrollButtonOffsetX, panelHeight - labelHeight - textBoxHeight - scrollButtonHeight - scrollButtonOffsetY, panel, "", _buttonsTextConfig, width: scrollButtonWidth, height: scrollButtonHeight); invWindow.TreeNode.SetParent(panel.TreeNode); cancelButton.MouseClicked.Subscribe(onCancelClicked); okButton.MouseClicked.SubscribeToAsync(onOkClicked); scrollDownButton.MouseClicked.Subscribe(_ => invWindow.ScrollDown()); scrollUpButton.MouseClicked.Subscribe(_ => invWindow.ScrollUp()); var iconFactory = factory.Graphics.Icons; _fileIcon = iconFactory.GetFileIcon(); _fileIconSelected = iconFactory.GetFileIcon(true); _folderIcon = iconFactory.GetFolderIcon(); _folderIconSelected = iconFactory.GetFolderIcon(true); var arrowDownIcon = getIcon("ArrowDown", factory, scrollButtonWidth, scrollButtonHeight, iconFactory.GetArrowIcon(ArrowDirection.Down), scrollDownButton.RenderLayer); arrowDownIcon.Pivot = new PointF(); arrowDownIcon.Enabled = false; arrowDownIcon.TreeNode.SetParent(scrollDownButton.TreeNode); _game.State.UI.Add(arrowDownIcon); var arrowUpIcon = getIcon("ArrowUp", factory, scrollButtonWidth, scrollButtonHeight, iconFactory.GetArrowIcon(ArrowDirection.Up), scrollUpButton.RenderLayer); arrowUpIcon.Pivot = new PointF(); arrowUpIcon.Enabled = false; arrowUpIcon.TreeNode.SetParent(scrollUpButton.TreeNode); _game.State.UI.Add(arrowUpIcon); _fileGraphics = getIcon("FileGraphics", factory, ITEM_WIDTH, itemHeight, _fileIcon, scrollUpButton.RenderLayer); _folderGraphics = getIcon("FolderGraphics", factory, ITEM_WIDTH, itemHeight, _folderIcon, scrollUpButton.RenderLayer); fillAllFiles(_startPath); _fileTextBox.OnPressingKey.Subscribe(onTextBoxKeyPressed); bool okGiven = await _tcs.Task; _inventory.Items.Clear(); removeAllUI(panel); panel.GetComponent <IModalWindowComponent>().LoseFocus(); if (!okGiven) { return(null); } return(_fileTextBox.Text); }
void m_editEvents_OnCreateFeature(IObject obj) { // check if feature contains more than 2000 nodes/vertices // applies to lines and polygons // notify the user and offer a split // check if feature geometry is multi-part // applies to lines and polygons // notify the user and offer a conversion to relation IFeatureClass currentObjectFeatureClass = obj.Class as IFeatureClass; if ((currentObjectFeatureClass == null) || (currentObjectFeatureClass.EXTCLSID == null)) { return; } // check if the current feature class being edited is acutally an OpenStreetMap feature class // all other feature class should not be touched by this extension UID osmEditorExtensionCLSID = currentObjectFeatureClass.EXTCLSID; if (osmEditorExtensionCLSID.Value.ToString().Equals("{65CA4847-8661-45eb-8E1E-B2985CA17C78}", StringComparison.InvariantCultureIgnoreCase) == false) { return; } IFeature currentFeature = obj as IFeature; if (currentFeature == null) { return; } ISegmentCollection segmentCollection = currentFeature.Shape as ISegmentCollection; bool densifyRequired = false; if (segmentCollection != null) { for (int segmentIndex = 0; segmentIndex < segmentCollection.SegmentCount; segmentIndex++) { ISegment segment = segmentCollection.get_Segment(segmentIndex); if (!(segment is Line)) { densifyRequired = true; break; } } } if (densifyRequired) { IGeometryEnvironment4 geometryEnvironment = new GeometryEnvironmentClass() as IGeometryEnvironment4; double densifyTolerance = geometryEnvironment.AutoDensifyTolerance; double deviationTolerance = geometryEnvironment.DeviationAutoDensifyTolerance; IPolycurve polycurve = currentFeature.Shape as IPolycurve; polycurve.Densify(densifyTolerance, deviationTolerance); currentFeature.Shape = polycurve; obj.Store(); } }
void m_editEvents_OnChangeFeature(IObject obj) { // check if feature contains more than 2000 nodes/vertices // applies to lines and polygons // notify the user and offer a split // check if feature geometry is multi-part // applies to lines and polygons // notify the user and offer a conversion to relation IFeatureClass currentObjectFeatureClass = obj.Class as IFeatureClass; if ((currentObjectFeatureClass == null) || (currentObjectFeatureClass.EXTCLSID == null)) { return; } // check if the current feature class being edited is acutally an OpenStreetMap feature class // all other feature class should not be touched by this extension UID osmEditorExtensionCLSID = currentObjectFeatureClass.EXTCLSID; if (osmEditorExtensionCLSID.Value.ToString().Equals("{65CA4847-8661-45eb-8E1E-B2985CA17C78}", StringComparison.InvariantCultureIgnoreCase) == false) { return; } IFeature currentFeature = obj as IFeature; if (currentFeature == null) { return; } IPointCollection pointCollection = currentFeature.Shape as IPointCollection; if (pointCollection == null) { return; } // block changing features that are supporting features for multi-part geometries (relations) if (currentFeature.Shape is IPolygon || currentFeature.Shape is IPolyline) { if (((IFeatureChanges)currentFeature).ShapeChanged == true) { int memberOFFieldIndex = currentFeature.Fields.FindField("osmMemberOf"); int membersFieldIndex = currentFeature.Fields.FindField("osmMembers"); int osmIDFieldIndex = currentFeature.Fields.FindField("OSMID"); long osmID = 0; if (osmIDFieldIndex > -1) { object osmIDValue = currentFeature.get_Value(osmIDFieldIndex); if (osmIDValue != DBNull.Value) { osmID = Convert.ToInt64(osmIDValue); } } if (membersFieldIndex > -1) { ESRI.ArcGIS.OSM.OSMClassExtension.member[] relationMembers = _osmUtility.retrieveMembers(currentFeature, membersFieldIndex); if (relationMembers != null) { if (relationMembers.Length > 0) { string abortMessage = String.Format(resourceManager.GetString("OSMEditor_FeatureInspector_multipartchangeparentconflictmessage"), osmID); MessageBox.Show(abortMessage, resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictcaption"), MessageBoxButtons.OK, MessageBoxIcon.Stop); m_editor3.AbortOperation(); } } } if (memberOFFieldIndex > -1) { List <string> isMemberOfList = _osmUtility.retrieveIsMemberOf(currentFeature, memberOFFieldIndex); Dictionary <string, string> dictofParentsAndTypes = _osmUtility.parseIsMemberOfList(isMemberOfList); StringBuilder typeAndIDString = new StringBuilder(); foreach (var item in dictofParentsAndTypes) { switch (item.Value) { case "rel": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_relationidtext") + item.Key + ","); break; case "ply": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_polygonidtext") + item.Key + ","); break; case "ln": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_polylineidtext") + item.Key + ","); break; case "pt": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_pointidtext") + item.Key + ","); break; default: break; } } if (typeAndIDString.Length > 0) { string parentsString = typeAndIDString.ToString(0, typeAndIDString.Length - 1); string abortMessage = String.Format(resourceManager.GetString("OSMEditor_FeatureInspector_multipartchangeconflictmessage"), osmID, parentsString); MessageBox.Show(abortMessage, resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictcaption"), MessageBoxButtons.OK, MessageBoxIcon.Stop); m_editor3.AbortOperation(); } } } } ISegmentCollection segmentCollection = currentFeature.Shape as ISegmentCollection; bool densifyRequired = false; for (int segmentIndex = 0; segmentIndex < segmentCollection.SegmentCount; segmentIndex++) { ISegment segment = segmentCollection.get_Segment(segmentIndex); if (!(segment is Line)) { densifyRequired = true; break; } } if (densifyRequired) { IGeometryEnvironment4 geometryEnvironment = new GeometryEnvironmentClass() as IGeometryEnvironment4; double densifyTolerance = geometryEnvironment.AutoDensifyTolerance; double deviationTolerance = geometryEnvironment.DeviationAutoDensifyTolerance; IPolycurve polycurve = currentFeature.Shape as IPolycurve; polycurve.Densify(densifyTolerance, deviationTolerance); currentFeature.Shape = polycurve; obj.Store(); } }
void m_editEvents_OnDeleteFeature(IObject obj) { // check if the deleted feature participates in a relation // applies to point, lines, and polygons // if it does participate in a relation ask the user if it is ok to delete IFeatureClass currentObjectFeatureClass = obj.Class as IFeatureClass; if ((currentObjectFeatureClass == null) || (currentObjectFeatureClass.EXTCLSID == null)) { return; } // check if the current feature class being edited is acutally an OpenStreetMap feature class // all other feature class should not be touched by this extension UID osmEditorExtensionCLSID = currentObjectFeatureClass.EXTCLSID; if (osmEditorExtensionCLSID.Value.ToString().Equals("{65CA4847-8661-45eb-8E1E-B2985CA17C78}", StringComparison.InvariantCultureIgnoreCase) == false) { return; } // at this point we are only handling geometry types // relation types are using a separate UI IFeature deletedFeature = obj as IFeature; if (deletedFeature == null) { return; } // block changing features that are supporting features for multi-part geometries (relations) if (deletedFeature.Shape is IPolygon || deletedFeature.Shape is IPolyline) { int memberOFFieldIndex = deletedFeature.Fields.FindField("osmMemberOf"); int membersFieldIndex = deletedFeature.Fields.FindField("osmMembers"); int osmIDFieldIndex = deletedFeature.Fields.FindField("OSMID"); int osmID = 0; if (osmIDFieldIndex > -1) { object osmIDValue = deletedFeature.get_Value(osmIDFieldIndex); if (osmIDValue != DBNull.Value) { osmID = Convert.ToInt32(osmIDValue); } } if (membersFieldIndex > -1) { ESRI.ArcGIS.OSM.OSMClassExtension.member[] relationMembers = _osmUtility.retrieveMembers(deletedFeature, membersFieldIndex); if (relationMembers != null) { if (relationMembers.Length > 0) { string abortMessage = String.Format(resourceManager.GetString("OSMEditor_FeatureInspector_multipartdeleteparentconflictmessage"), osmID); MessageBox.Show(abortMessage, resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictcaption"), MessageBoxButtons.OK, MessageBoxIcon.Stop); m_editor3.AbortOperation(); } } } if (memberOFFieldIndex > -1) { List <string> isMemberOfList = _osmUtility.retrieveIsMemberOf(deletedFeature, memberOFFieldIndex); Dictionary <string, string> dictofParentsAndTypes = _osmUtility.parseIsMemberOfList(isMemberOfList); StringBuilder typeAndIDString = new StringBuilder(); foreach (var item in dictofParentsAndTypes) { switch (item.Value) { case "rel": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_relationidtext") + item.Key + ","); break; case "ply": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_polygonidtext") + item.Key + ","); break; case "ln": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_polylineidtext") + item.Key + ","); break; case "pt": typeAndIDString.Append(resourceManager.GetString("OSMEditor_FeatureInspector_pointidtext") + item.Key + ","); break; default: break; } } if (typeAndIDString.Length > 0) { string parentsString = typeAndIDString.ToString(0, typeAndIDString.Length - 1); string abortMessage = String.Format(resourceManager.GetString("OSMEditor_FeatureInspector_relationsconflictmessage"), osmID, parentsString); MessageBox.Show(abortMessage, resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictcaption"), MessageBoxButtons.OK, MessageBoxIcon.Stop); m_editor3.AbortOperation(); return; } } } else if (deletedFeature.Shape is IPoint) { // if we are dealing with points to be deleted then we'll determine the connectedness via a spatial query and then the attributes indicating that // the higher order feature is part of a relation IFeatureClass lineFeatureClass = ESRI.ArcGIS.OSM.OSMClassExtension.OpenStreetMapClassExtension.findMatchingFeatureClass(deletedFeature, esriGeometryType.esriGeometryPolyline); ISpatialFilter searchPointFilter = new SpatialFilterClass(); searchPointFilter.Geometry = deletedFeature.Shape; searchPointFilter.SpatialRel = esriSpatialRelEnum.esriSpatialRelTouches; TestRelationMembership(deletedFeature, lineFeatureClass, searchPointFilter); IFeatureClass polygonFeatureClass = ESRI.ArcGIS.OSM.OSMClassExtension.OpenStreetMapClassExtension.findMatchingFeatureClass(deletedFeature, esriGeometryType.esriGeometryPolygon); TestRelationMembership(deletedFeature, polygonFeatureClass, searchPointFilter); } string featureClassName = ((IDataset)obj.Class).Name; // find the correspoding relation table int baseIndex = featureClassName.IndexOf("_osm_"); int deleteOSMIDFieldIndex = obj.Fields.FindField("OSMID"); int deleteIsMemberOfFieldIndex = obj.Fields.FindField("osmMemberOf"); if (baseIndex > -1) { string relationTableName = featureClassName.Substring(0, baseIndex) + "_osm_relation"; IFeatureWorkspace featureWorkspace = m_editor3.EditWorkspace as IFeatureWorkspace; ITable relationTable = featureWorkspace.OpenTable(relationTableName); int relationOSMIDFieldIndex = relationTable.Fields.FindField("OSMID"); List <string> memberOfList = _osmUtility.retrieveIsMemberOf(deletedFeature, deleteIsMemberOfFieldIndex); Dictionary <string, string> isMemberOfIdsAndTypes = _osmUtility.parseIsMemberOfList(memberOfList); if (memberOfList.Count > 0) { // the deleted feature is referenced by a relation // check with the user if it is ok to delete // if OK then we are dealing with the delete upon stop editing, if cancel undo the delete string relationsString = String.Empty; int relationCount = 0; foreach (var memberOfItem in isMemberOfIdsAndTypes) { if (memberOfItem.Value == "rel") { relationCount = relationCount + 1; relationsString = relationsString + memberOfItem.Key + ","; } } string errorMessage = String.Empty; if (relationCount > 1) { errorMessage = string.Format(resourceManager.GetString("OSMEditor_FeatureInspector_relationsconflictmessage"), deletedFeature.get_Value(deleteOSMIDFieldIndex), relationsString.Substring(0, relationsString.Length - 1)); } else { errorMessage = string.Format(resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictmessage"), deletedFeature.get_Value(deleteOSMIDFieldIndex), relationsString.Substring(0, relationsString.Length - 1)); } if (MessageBox.Show(errorMessage, resourceManager.GetString("OSMEditor_FeatureInspector_relationconflictcaption"), MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { m_editor3.AbortOperation(); } } } }
public ResponseStringParamTag(IObject <ObjectData> frontendObject) : base(frontendObject) { }
public AddObjectOperation(IObject obj, IExecutionContext context) : base(context) { Object = obj; }
public bool Post(DbManagerProxy manager, IObject obj, bool bChildObject = false) { throw new NotImplementedException(); }
public override IObject DynamicInvoke(IObject obj, Message message) => SendMessage(getValue(obj), message);
public Lookup2ParamTable CreateWithParamsT(DbManagerProxy manager, IObject Parent, List <object> pars) { return(_CreateNew(manager, Parent, null, null, null)); }
public override void SendConfig(IObject obj) { obj.SetAngleBinding(BindingPoint, BoneMarker, Angle, Range); }
public Lookup2ParamTable CreateFakeT(DbManagerProxy manager, IObject Parent, int?HACode = null) { return(_CreateNew(manager, Parent, HACode, null, null, true)); }
public IObject CreateWithParams(DbManagerProxy manager, IObject Parent, List <object> pars) { return(_CreateNew(manager, Parent, null, null, null)); }
public bool RequiredByProperty(string name, IObject obj) { return(Meta.RequiredByProperty.ContainsKey(name) ? Meta.RequiredByProperty[name](obj as Lookup2ParamTable) : false); }
public IObject CreateFake(DbManagerProxy manager, IObject Parent, int?HACode = null) { return(_CreateNew(manager, Parent, HACode, null, null, true)); }
public override IMatched <IObject> Execute(Machine machine, IObject value) => Objects.Some.Object(value).Matched();
public CompareModel Compare(IObject o) { return(_compare(o, null)); }
public NegativeAbility(IStat MainStat, IObject TempStat) : base(MainStat, TempStat) { }
public bool Validate(DbManagerProxy manager, IObject obj, bool bPostValidation, bool bChangeValidation, bool bDeepValidation, bool bRethrowException = false) { return(Validate(manager, obj as Lookup2ParamTable, bPostValidation, bChangeValidation, bDeepValidation, bRethrowException)); }
public Ability(IStat MainStat) { this.MainStat = MainStat; TempStat = null; }
/// <summary> /// Removes a tag from the target to mark that it's no longer being followed by the follower /// </summary> /// <param name="target">Target.</param> /// <param name="follower">Follower.</param> public static void RemoveTag(IObject target, IEntity follower) { target.Properties.Entities.SetValue($"{FOLLOWER_PREFIX}{follower.ID}", null); }
public CheckAbility(IStat MainStat, IObject TempStat) : base(MainStat, TempStat) { }
public Ability(IStat MainStat, IObject TempStat) { this.MainStat = MainStat; this.TempStat = TempStat; }
public DeathSentence(IObject obj, float lifetime) { this.obj = obj; this.lifetime = Game.TotalElapsedGameTime + lifetime; this.controlTime = lifetime; }
public Ability() { TempStat = MainStat = null; }
internal Equals(IObject equals) { PredicateAssertions.ValidateEquals(equals); this.equals = equals; }
public static bool IsObjectBlackListed(IObject obj) { if (IGNORE_BLACKLIST) { return(false); } if (!(obj.Sizeable == SizeableType.None) || obj.IsBurning || obj.DestructionInitiated) { return(true); } controlStringArray = obj.Name.Split('0'); switch (controlStringArray[0]) { case "BambooStick": return(true); case "Plank": return(true); case "TruckWheel": return(true); case "WpnGrenadesThrown": return(true); case "WpnMineThrown": return(true); case "HangingLamp": return(true); case "Chandelier": return(true); case "WoodDebris": return(true); case "GlassShard": return(true); case "Hook": return(true); case "Elevator": return(true); case "MetalDebris": return(true); case "Pulley": return(true); case "FerrisWheelCart": return(true); case "CarnivalCart": return(true); case "HangingCrate": return(true); case "Giblet": return(true); case "ConcretePipe": return(true); case "Lift": return(true); case "TinRoof": return(true); case "Piano": return(true); case "WindMillSail": return(true); case "CarWheel": return(true); case "Car": return(true); case "Duct": return(true); case "Truck": return(true); case "SteamshipWheel": return(true); case "Lifeboat": return(true); case "SubwayTrain": return(true); case "CargoContainer": return(true); case "TrainCarLocomotive": return(true); case "HangingCrateHolder": return(true); case "Pallet": return(true); case "Balloon": return(true); case "MetalDesk": return(true); } return(false); }
public bool IsEqualTo(IObject obj) => obj is YieldingInvokable yfi && selector.IsEqualTo(yfi.selector);
public Point Point(IObject x, IObject y) => new(x, y);