public CandidatePanel(Candidate candidate, Func <Candidate, TabPage, bool> _handleDelete) { InitializeComponent(); Candidate = candidate; OnCreate(); handleDelete = new HandleDelete(_handleDelete); }
bool DeleteBlock(byte old, ushort x, ushort y, ushort z, byte block, byte extBlock) { if (deleteMode) { return(ChangeBlock(x, y, z, Block.air, 0)); } bool changed = true; HandleDelete handler = BlockBehaviour.deleteHandlers[old]; if (handler != null) { if (handler(this, old, x, y, z)) { return(false); } } else { changed = ChangeBlock(x, y, z, Block.air, 0); } bool autoDelete = level.GrassGrow && (level.physics == 0 || level.physics == 5); if (autoDelete && level.GetTile(x, (ushort)(y - 1), z) == Block.dirt) { ChangeBlock(x, (ushort)(y - 1), z, Block.grass, 0); } return(changed); }
public override void Use(Player p, string message) { if (Player.IsSuper(p)) { MessageInGameOnly(p); return; } if (message.CaselessEq("all")) { if (!p.HasBlockchange) { Player.Message(p, "Cannot mark, no selection or cuboid in progress."); return; } Level lvl = p.level; PlaceMark(p, 0, 0, 0); PlaceMark(p, lvl.Width - 1, lvl.Height - 1, lvl.Length - 1); return; } // convert player pos to block coords Vec3U16 P = Vec3U16.ClampPos(p.pos[0], (ushort)(p.pos[1] - 32), p.pos[2], p.level); P.X /= 32; P.Y /= 32; P.Z /= 32; if (message != "" && !ParseCoords(message, p, ref P)) { return; } P = Vec3U16.Clamp(P.X, P.Y, P.Z, p.level); if (p.HasBlockchange) { PlaceMark(p, P.X, P.Y, P.Z); } else { // We only want to activate blocks in the world byte old = p.level.GetTile(P.X, P.Y, P.Z); if (!p.CheckManualChange(old, Block.air, false)) { return; } HandleDelete handler = BlockBehaviour.deleteHandlers[old]; if (handler != null) { handler(p, old, P.X, P.Y, P.Z); } else { Player.Message(p, "Cannot mark, no selection or cuboid in progress, " + "nor could the existing block at the coordinates be activated."); return; } } }
public static void show() { CleanConsole.clean(); Console.WriteLine("_____________________________"); Console.WriteLine(" USER DELETE "); Console.WriteLine("_____________________________"); Console.WriteLine("Enter User id: "); string uuid = Console.ReadLine(); HandleDelete <User> .action(listContainer.userList, uuid); }
public override void Use(Player p, string message, CommandData data) { if (message.CaselessEq("all")) { if (!DoMark(p, 0, 0, 0)) { p.Message("Cannot mark, no selection in progress."); } else { Level lvl = p.level; DoMark(p, lvl.Width - 1, lvl.Height - 1, lvl.Length - 1); } return; } Vec3S32 P = p.Pos.BlockCoords; P.Y = (p.Pos.Y - 32) / 32; if (message.Length > 0 && !ParseCoords(message, p, ref P)) { return; } P.X = Clamp(P.X, p.level.Width); P.Y = Clamp(P.Y, p.level.Height); P.Z = Clamp(P.Z, p.level.Length); if (DoMark(p, P.X, P.Y, P.Z)) { return; } Vec3U16 mark = (Vec3U16)P; // We only want to activate blocks in the world BlockID old = p.level.GetBlock(mark.X, mark.Y, mark.Z); if (!p.CheckManualChange(old, Block.Air, true)) { return; } HandleDelete handler = p.level.deleteHandlers[old]; if (handler != null) { handler(p, old, mark.X, mark.Y, mark.Z); } else { p.Message("Cannot mark, no selection in progress, " + "nor could the existing block at the coordinates be activated."); return; } }
void DeleteBlock(BlockID old, ushort x, ushort y, ushort z, BlockID block) { if (deleteMode) { ChangeBlock(x, y, z, Block.Air); return; } HandleDelete handler = level.deleteHandlers[old]; if (handler != null) { handler(this, old, x, y, z); return; } ChangeBlock(x, y, z, Block.Air); }
ChangeResult DeleteBlock(BlockID old, ushort x, ushort y, ushort z) { if (deleteMode) { return(ChangeBlock(x, y, z, Block.Air)); } HandleDelete handler = level.DeleteHandlers[old]; if (handler != null) { return(handler(this, old, x, y, z)); } return(ChangeBlock(x, y, z, Block.Air)); }
bool DeleteBlock(ExtBlock old, ushort x, ushort y, ushort z, ExtBlock block) { if (deleteMode) { return(ChangeBlock(x, y, z, ExtBlock.Air) == 2); } HandleDelete handler = level.deleteHandlers[old.Index]; if (handler != null) { handler(this, old, x, y, z); return(true); } return(ChangeBlock(x, y, z, ExtBlock.Air) == 2); }
protected virtual void OnDelete(PPError result) => HandleDelete?.Invoke(this, result);