private void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject) { if (entity.ShortPrefabName.Contains("cupboard.tool")) { BasePlayer player = BasePlayer.FindByID(entity.OwnerID); if (player == null) { return; } if (!GameStarted) { entity.KillMessage(); var itemtogive = ItemManager.CreateByItemID(-97956382, 1); if (itemtogive != null) { player.inventory.GiveItem(itemtogive); } SendChatMessage(player, CurrentStartCup); return; } if (RedTeam.Contains(player.userID) && CupBoardRed) { entity.KillMessage(); var itemtogive = ItemManager.CreateByItemID(-97956382, 1); if (itemtogive != null) { player.inventory.GiveItem(itemtogive); } SendChatMessage(player, CurrentCupLimit); return; } if (BlueTeam.Contains(player.userID) && CupBoardBlue) { entity.KillMessage(); var itemtogive = ItemManager.CreateByItemID(-97956382, 1); if (itemtogive != null) { player.inventory.GiveItem(itemtogive); } SendChatMessage(player, CurrentCupLimit); return; } if (RedTeam.Contains(player.userID)) { CupBoardRed = true; CupBoardRedString = entity.ToString(); SendChatMessage(player, CurrentCupPlaced); return; } if (BlueTeam.Contains(player.userID)) { CupBoardBlue = true; CupBoardBlueString = entity.ToString(); SendChatMessage(player, CurrentCupPlaced); return; } } }
private void GrideUC_EditerEvent(object sender, EventArgs e) { BaseEntity entity = GrideUC.Current(); string tabEditerName = "TabEditer-" + entity.Id; if (tabControl.TabPages.IndexOfKey(tabEditerName) == -1) { // Création de Tab TabPage tabEditer = new TabPage(); tabEditer.Text = entity.ToString(); tabEditer.Name = tabEditerName; tabControl.TabPages.Add(tabEditer); tabControl.SelectedTab = tabEditer; // Insertion du formulaire T form = Activator.CreateInstance <T>(); form.Name = "EntityForm"; form.Entity = entity; form.Afficher(); this.tabControl.TabPages[tabEditerName].Controls.Add(form); form.EnregistrerClick += Form_EditerClick; form.AnnulerClick += Form_AnnulerEditerClick; } }
/// <summary> /// Exécuter aprés un click sur le button editer dans DataGrid /// </summary> private void EntityDataGridControl_EditClick(object sender, EventArgs e) { BaseEntity entity = (BaseEntity)this.DataGridControl.SelectedEntity; string tabEditerName = "TabEditer-" + entity.Id; if (tabControl_MainManager.TabPages.IndexOfKey(tabEditerName) == -1) { // Création de Tab TabPage tabEditer = new TabPage(); tabEditer.Text = entity.ToString(); tabEditer.Name = tabEditerName; tabControl_MainManager.TabPages.Add(tabEditer); tabControl_MainManager.CausesValidation = false; // Insertion du formulaire de mise à jour BaseEntryForm form = Formulaire.CreateInstance(this.Service, entity, null); form.Name = "EntityForm"; form.Dock = DockStyle.Fill; this.tabControl_MainManager.TabPages[tabEditerName].Controls.Add(form); tabControl_MainManager.SelectedTab = tabEditer; form.WriteEntityToField(this.FilterControl.CritereRechercheFiltre()); form.EnregistrerClick += Form_EditerClick; form.AnnulerClick += Form_AnnulerEditerClick; } else { TabPage tabEditer = this.tabControl_MainManager.TabPages[tabEditerName]; tabControl_MainManager.SelectedTab = tabEditer; } }
/// <summary> /// Editer un objet séléctioné du DataGridView /// </summary> private void EditerObjet() { BaseEntity entity = (BaseEntity)ObjetBindingSource.Current; string tabEditerName = "TabEditer-" + entity.Id; if (tabControl.TabPages.IndexOfKey(tabEditerName) == -1) { // Création de Tab TabPage tabEditer = new TabPage(); tabEditer.Text = entity.ToString(); tabEditer.Name = tabEditerName; tabControl.TabPages.Add(tabEditer); tabControl.CausesValidation = false; // Insertion du formulaire BaseEntryForm form = Formulaire.CreateInstance(this.Service, entity, null); form.Name = "EntityForm"; form.Dock = DockStyle.Fill; this.tabControl.TabPages[tabEditerName].Controls.Add(form); tabControl.SelectedTab = tabEditer; form.WriteEntityToField(this.BaseFilterControl.CritereRechercheFiltre()); form.EnregistrerClick += Form_EditerClick; form.AnnulerClick += Form_AnnulerEditerClick; } else { TabPage tabEditer = this.tabControl.TabPages[tabEditerName]; tabControl.SelectedTab = tabEditer; } }
/// <summary> /// DataGridControl_EditClick event /// </summary> private void DataGridControl_EditClick(object sender, EventArgs e) { BaseEntity entity = (BaseEntity)this.DataGridControl_Instance.SelectedEntity; string tabEditerName = "TabEditer-" + entity.Id; if (tabControl_MainManager.TabPages.IndexOfKey(tabEditerName) == -1) { // Creation of Edit Tab page TabPage tabEditer = new TabPage(); tabEditer.Text = Glossary.Update + " : " + entity.ToString(); tabEditer.Name = tabEditerName; tabEditer.Font = this.tabControl_MainManager.TabPages["TabGrid"].Font; tabControl_MainManager.TabPages.Add(tabEditer); tabControl_MainManager.CausesValidation = false; // Creation of EntryForm BaseEntryForm form = EntryForm_Instance.CreateInstance(this.BLO_Instance, entity, null); form.Name = "EntityForm"; form.Dock = DockStyle.Fill; this.tabControl_MainManager.TabPages[tabEditerName].Controls.Add(form); tabControl_MainManager.SelectedTab = tabEditer; form.ShowEntity(this.Filter_Instance.GetFilterValues(), BaseEntryForm.EntityActions.Update); // Entry Form Events form.EnregistrerClick += Form_EditerClick; form.AnnulerClick += Form_AnnulerEditerClick; } else { TabPage tabEditer = this.tabControl_MainManager.TabPages[tabEditerName]; tabControl_MainManager.SelectedTab = tabEditer; } }
private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { BaseEntity obj = (BaseEntity)ObjetBindingSource.Current; // Supprimer if (e.ColumnIndex == dataGridView.Columns["Supprimer"].Index && e.RowIndex >= 0) { if (DialogResult.Yes == MessageBox.Show( "Voullez-vous vraimment supprimer :" + obj.ToString(), "Confirmation de supprision", MessageBoxButtons.YesNo)) { this.Service.Delete(obj); this.Actualiser(); } } // Editer if (e.ColumnIndex == dataGridView.Columns["Editer"].Index && e.RowIndex >= 0) { onEditClick(this, null); } foreach (var item in this.ListePropriete.Where(p => p.PropertyType.Name == "List`1")) { if (e.ColumnIndex == dataGridView.Columns[item.Name].Index && e.RowIndex >= 0) { this.SelectedProperty = item; onEditManyToOneCollection(this, e); } } }
static void RefreshGUI(ToolRemover toolPlayer) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "DestroyUI", "RemoveTimeleftMsg"); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "DestroyUI", "RemoveEntityMsg"); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "DestroyUI", "RemoveCostMsg"); string cost = string.Empty; string entity = string.Empty; toolPlayer.inputState = serverinput.GetValue(toolPlayer.player) as InputState; Ray ray = new Ray(toolPlayer.player.eyes.position, Quaternion.Euler(toolPlayer.inputState.current.aimAngles) * Vector3.forward); BaseEntity removeObject = FindRemoveObject(ray, toolPlayer.distance); if (removeObject != null) { entity = removeObject.ToString(); entity = entity.Substring(entity.LastIndexOf("/") + 1).Replace(".prefab", "").Replace("_deployed", "").Replace(".deployed", ""); entity = entity.Substring(0, entity.IndexOf("[")); if (usePay && toolPlayer.removeType == RemoveType.Normal) { Dictionary <string, object> costList = GetCost(removeObject); foreach (KeyValuePair <string, object> pair in costList) { cost += string.Format("{0} x{1}\n", pair.Key, pair.Value.ToString()); } } } string ejson = entityjsonmsg.Replace("{entity}", entity); string cjson = costjsonmsg.Replace("{cost}", cost); string tjson = timeleftjsonmsg.Replace("{timeleft}", toolPlayer.timeLeft.ToString()); CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "AddUI", ejson); if (usePay) { CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "AddUI", cjson); } CommunityEntity.ServerInstance.ClientRPCEx(new Network.SendInfo() { connection = toolPlayer.player.net.connection }, null, "AddUI", tjson); }
private void MMenuPrint_Click(object sender, EventArgs e) { IList <BaseEntity> etis = new List <BaseEntity>(); BaseEntity entity = (this.ActiveMdiChild as IScheduleFm).Entity; VcPrintDocument.GetInstance().DocumentName = entity.ToString(); etis.Add(entity); VcPrintDocument.GetInstance().Entitis = etis; VcPrintDocument.GetInstance().Print(); }
void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject) { try { if (entity.ToString().Contains("cupboard.tool")) { if (entity.OwnerID == null) { return; } var player = BasePlayer.FindByID(entity.OwnerID); if (player.IsSleeping() || !player.IsConnected()) { return; } var onbuildingblock = false; List <BaseEntity> nearby = new List <BaseEntity>(); Vis.Entities(entity.transform.position, 1, nearby); foreach (var ent in nearby) { if (ent.ShortPrefabName.Contains("cupboard") && nearby.Count == 1) { onbuildingblock = false; break; } if (ent.ToString().Contains("foundation")) { List <BaseEntity> nerb = new List <BaseEntity>(); Vis.Entities(new Vector3(ent.transform.position.x, ent.transform.position.y + 0.5f, ent.transform.position.z), 1, nerb); foreach (var ent2 in nerb) { if (ent2.ToString().Contains("cupboard")) { return; } } } } if (onbuildingblock == false) { SendReply(player, lang.GetMessage("MayNotPlace", this)); entity.KillMessage(); player.inventory.GiveItem(ItemManager.CreateByItemID(1257201758, 1)); return; } else { return; } } else { return; } }catch (System.Exception) { return; } }
public void AddEntityByChance(BaseEntity entity, int oneInRatio) { if (_rand.Next(0, oneInRatio) == 0) { AddEntity(entity); } else { DebugLog.Log("Drop chance not met :( for " + entity.ToString()); } }
void OnEntitySpawned(BaseEntity entity) { //PrintWarning(entity.ToString()); //PrintWarning(entity.transform.position.ToString()); if (entity is BaseHelicopter && entity.ToString().Contains("patrolhelicopter") && LogServerPatrolhelicopter()) { executeQuery("INSERT INTO server_log_patrolhelicopter (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime()); } else if (entity is CargoShip && entity.ToString().Contains("cargoship") && LogServerCargoship()) { executeQuery("INSERT INTO server_log_cargoship (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime()); } else if (entity is CH47Helicopter && entity.ToString().Contains("ch47") && LogServerch47()) { executeQuery("INSERT INTO server_log_ch47 (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime()); } else if (entity is BradleyAPC && entity.ToString().Contains("bradleyapc") && LogServerbradleyapc()) { executeQuery("INSERT INTO server_log_bradleyapc (plane, location, time) VALUES (@0, @1, @2)", entity.ToString(), entity.transform.position.ToString(), getDateTime()); } }
void OnEntitySpawned(BaseEntity entity, UnityEngine.GameObject gameObject) { try { if (entity.ToString().Contains("cupboard.tool")) { if (entity.OwnerID == null) { return; } var player = BasePlayer.FindByID(entity.OwnerID); var onground = false; var onbuildingblock = false; List <BaseEntity> nearby = new List <BaseEntity>(); Vis.Entities(entity.transform.position, 1, nearby); foreach (var ent in nearby) { if (ent.ShortPrefabName.Contains("cupboard")) { foreach (var ent1 in nearby) { if (ent1 is BuildingBlock) { break; } else { onground = true; onbuildingblock = false; } } } if (ent is BuildingBlock) { onground = false; onbuildingblock = true; } } logData.logs.Add(string.Format(lang.GetMessage("Format", this), player.displayName, entity.transform.position, DateTime.Now.ToString("h:mm tt"), onground, onbuildingblock)); WriteLogs(); } else { return; } } catch (System.Exception) { return; } }
public void PrintMatrix(PrintDocument Doc, Graphics graphics, Rectangle rect) { Rectangle titleRect = new Rectangle(rect.Left, rect.Top + 20, rect.Width, 100); graphics.DrawString(entity.ToString(), new Font("���ו", DrawComm.SuitFontSize((double)titleRect.Height * 0.5), FontStyle.Bold), new SolidBrush(Color.Black), titleRect, DrawComm.CenterStringFormat); FcMatrixPtr <PrtMatterCell> Matrix = new FcMatrixPtr <PrtMatterCell>(VC2WinFmApp.DataRule.Solution); Matrix.HeighWidthProportionLow = 30; Matrix.HeighWidthProportionHigh = 40; Matrix.Rect = new Rectangle(rect.Left, rect.Top + 130, rect.Width, rect.Height - 130); Matrix.Draw(graphics); }
public void DbEntityValidationExceptionTreatment(DbEntityValidationException ex) { foreach (DbEntityValidationResult item in ex.EntityValidationErrors) { // Get entry DbEntityEntry entry = item.Entry; BaseEntity entity = (BaseEntity)entry.Entity; string entityTypeName = entity.ToString(); // Display or log error messages foreach (DbValidationError subItem in item.ValidationErrors) { string message = string.Format("Erreur : '{0}' \n trouvé dans l'objet : {1} \n sur la propriété {2}", subItem.ErrorMessage, entityTypeName, subItem.PropertyName); MessageToUser.AddMessage(MessageToUser.Category.EntityValidation, message); } } }
private void Dump(BaseEntity col) { Debug.Log(col.GetComponent <StabilityEntity>().ToString()); Debug.Log("=================================================="); Debug.Log(col.ToString() + " " + LayerMask.LayerToName(col.gameObject.layer).ToString()); Debug.Log("========= NORMAL ==========="); foreach (UnityEngine.Component com in col.GetComponents(typeof(UnityEngine.Component))) { Debug.Log(com.GetType().ToString() + " " + com.ToString()); } Debug.Log("========= PARENT ==========="); foreach (UnityEngine.Component com in col.GetComponentsInParent(typeof(UnityEngine.Component))) { Debug.Log(com.GetType().ToString() + " " + com.ToString()); } Debug.Log("========= CHILDREN ==========="); foreach (UnityEngine.Component com in col.GetComponentsInChildren(typeof(UnityEngine.Component))) { Debug.Log(com.GetType().ToString() + " " + com.ToString()); } }
// RocketLuancher void OnRocketLaunched(BasePlayer player, BaseEntity entity) { string rocketName = "Unknown Rocket"; string prefab = entity.ToString().ToLower(); if (prefab.StartsWith("rocket_basic")) { rocketName = "Rocket"; } else if (prefab.StartsWith("rocket_fire")) { rocketName = "Incendiary Rocket"; } else if (prefab.StartsWith("rocket_hv")) { rocketName = "High Velocity Rocket"; } else if (prefab.StartsWith("rocket_smoke")) { rocketName = "Smoke Rocket WIP"; } executeQuery("INSERT INTO player_bullets_fired (player_id, bullet_name, weapon_name, date) VALUES (@0, @1, @2, @3)" + "ON DUPLICATE KEY UPDATE bullets_fired = bullets_fired + 1", player.userID, rocketName, player.GetActiveItem().info.displayName.english, getDate()); }
/// <summary> /// Clikc Events /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dataGridView_CellClick(object sender, DataGridViewCellEventArgs e) { BaseEntity obj = (BaseEntity)ObjetBindingSource.Current; // Delete Clikc if (e.ColumnIndex == dataGridView.Columns["Supprimer"].Index && e.RowIndex >= 0) { if (DialogResult.Yes == MetroMessageBox.Show(this, "Voullez-vous vraimment supprimer :" + obj.ToString(), "Confirmation de supprision", MessageBoxButtons.YesNo)) { this.EntityBLO.Delete(obj); this.RefreshEntities(); } } // Editer Clikc if (e.ColumnIndex == dataGridView.Columns["Editer"].Index && e.RowIndex >= 0) { onEditClick(this, null); } // ManytoMany_Creation Clic foreach (var item in this.ShownEntityProperties.Where(p => p.PropertyType.Name == "List`1")) { ConfigProperty attributesOfProperty = new ConfigProperty(item, this.EntityBLO.ConfigEntity); if (attributesOfProperty.Relationship?.Relation != RelationshipAttribute.Relations.ManyToMany_Creation) { continue; } if (e.ColumnIndex == dataGridView.Columns[item.Name].Index && e.RowIndex >= 0) { this.SelectedProperty = item; onEditManyToMany_Creation(this, e); } } // ActionClikc for DataGridSeletedAction if (this.EntityBLO.ConfigEntity.ListDataGridSelectedAction != null) { foreach (DataGridSelectedActionAttribute item in this.EntityBLO.ConfigEntity.ListDataGridSelectedAction) { if (e.ColumnIndex == dataGridView.Columns[item.TypeOfForm.FullName].Index && e.RowIndex >= 0) { // Create TraitementAtionForm Instance IFormSelectedEntityAction Form = Activator.CreateInstance(item.TypeOfForm) as IFormSelectedEntityAction; Form.SetEntity(obj); // Show Form In MDI Application CreateAndShowManagerFormHelper ShowManagerFormHelper = new CreateAndShowManagerFormHelper(GwinApp.Instance.TypeDBContext, GwinApp.Instance.FormApplication); ShowManagerFormHelper.ShwoForm(Form as ManagerForm); } } } }
internal void RemoveInvalidEntities() { if (this.entityContents == null) { return; } Collider component = base.GetComponent <Collider>(); if (component == null) { return; } Bounds bound = component.bounds; bound.Expand(1f); BaseEntity[] array = this.entityContents.ToArray <BaseEntity>(); for (int i = 0; i < (int)array.Length; i++) { BaseEntity baseEntity = array[i]; if (baseEntity == null) { Debug.LogWarning(string.Concat("Trigger ", this.ToString(), " contains destroyed entity.")); } else if (!bound.Contains(baseEntity.ClosestPoint(base.transform.position))) { Debug.LogWarning(string.Concat("Trigger ", this.ToString(), " contains entity that is too far away: ", baseEntity.ToString())); this.RemoveEntity(baseEntity); } } }
public static string GetContainerIconURL(BaseEntity e, int size) { // TODO add more containers var c = e.GetComponent <JDeployable.Child>(); if (c != null) { JInfoAttribute info; if (JDeployableManager.DeployableTypes.TryGetValue(c.parent.GetType(), out info)) { return(info.IconUrl); } } else if (e is BoxStorage) { string panel = e.GetComponent <StorageContainer>().panelName; if (panel == "largewoodbox") { return(GetItemIconURL("box.wooden.large", size)); } return(GetItemIconURL("box.wooden", size)); } else if (e is BaseOven) { string panel = e.GetComponent <BaseOven>().panelName; if (panel == "largefurnace") { return(GetItemIconURL("furnace.large", size)); } else if (panel == "smallrefinery") { return(GetItemIconURL("small.oil.refinery", size)); } else if (panel == "lantern") { return(GetItemIconURL("lantern", size)); } else if (panel == "bbq") { return(GetItemIconURL("bbq", size)); } else if (panel == "campfire") { return(GetItemIconURL("campfire", size)); } else { return(GetItemIconURL("furnace", size)); } } else if (e is AutoTurret) { return(GetItemIconURL("autoturret", size)); } else if (e is Recycler) { return(GetItemIconURL("recycler", size)); } else if (e is FlameTurret) { return(GetItemIconURL("flameturret", size)); } else if (e is GunTrap) { return(GetItemIconURL("guntrap", size)); } else if (e is SearchLight) { return(GetItemIconURL("searchlight", size)); } else if (e is WaterCatcher) { if (e.GetComponent <WaterCatcher>()._collider.ToString().Contains("small")) { return(GetItemIconURL("water.catcher.small", size)); } return(GetItemIconURL("water.catcher.large", size)); } else if (e is LiquidContainer) { if (e.GetComponent <LiquidContainer>()._collider.ToString().Contains("purifier")) { return(GetItemIconURL("water.purifier", size)); } return(GetItemIconURL("water.barrel", size)); } else if (e is VendingMachine) { return(GetItemIconURL("vending.machine", size)); } else if (e is DropBox) { return(GetItemIconURL("dropbox", size)); } else if (e is StashContainer) { return(GetItemIconURL("stash.small", size)); } else if (e is MiningQuarry) { if (e.ToString().Contains("pump")) { return(GetItemIconURL("mining.pumpjack", size)); } return(GetItemIconURL("mining.quarry", size)); } else if (e is BuildingPrivlidge) { return(GetItemIconURL("cupboard.tool", size)); } return("http://i.imgur.com/BwJN0rt.png"); }
private static void Command_Entity(string[] args) { if (args.Length < 2) { GameData.Console.PrintLine("Invalid arguments."); return; } if (GameData.LevelManager.CurrentLevel == null) { GameData.Console.PrintLine("No level loaded."); return; } BaseEntity entity = GetEntityFromString(args[1]); if (entity == null) { GameData.Console.PrintLine($"No such entity with ID or name {args[1]}.", IGameConsole.MessageType.Warning); return; } if (args.Length == 2) { GameData.Console.PrintLine(entity.ToString()); return; } PropertyInfo entProperty = null; foreach (var property in entity.GetType().GetProperties()) { foreach (var att in property.GetCustomAttributes(true)) { if (att is BaseEntity.ConsoleModifiableAttribute) { if (property.Name.ToLower() == args[2].ToLower()) { entProperty = property; break; } } } if (entProperty != null) { break; } } if (entProperty == null) { GameData.Console.PrintLine($"Unknown or un-modifiable property {args[2]}.", IGameConsole.MessageType.Warning); return; } if (args.Length == 3) { GameData.Console.PrintLine(entProperty.GetValue(entity)?.ToString()); return; } else if (args.Length == 4) { if (IsNumericType(entProperty.PropertyType)) { object[] parameters = new object[] { args[3], null }; if ((bool)entProperty.PropertyType.GetMethod("TryParse", new[] { typeof(string), entProperty.PropertyType.MakeByRefType() }).Invoke(null, parameters) == true) { entProperty.SetValue(entity, Convert.ChangeType(parameters[1], entProperty.PropertyType)); } else { GameData.Console.PrintLine("Invalid arguments."); } } else if (entProperty.PropertyType == typeof(Point2D)) { string[] split = args[3].Split(',', StringSplitOptions.RemoveEmptyEntries); if (split.Length != 2) { GameData.Console.PrintLine("Invalid arguments."); } else { if (double.TryParse(split[0], out double x) == false || double.TryParse(split[1], out double y) == false) { GameData.Console.PrintLine("Invalid arguments."); } else { entProperty.SetValue(entity, new Point2D(x, y)); } } } else if (entProperty.PropertyType == typeof(string)) { entProperty.SetValue(entity, args[3]); } else if (entProperty.PropertyType == typeof(BaseEntity)) { if (args[3] == "null") { entProperty.SetValue(entity, null); } else { BaseEntity other = GetEntityFromString(args[3]); if (other == null) { GameData.Console.PrintLine($"Unknown entity {args[3]}.", IGameConsole.MessageType.Warning); } else { entProperty.SetValue(entity, other); } } } } }