public void undo() { if (previewAction.delete) { GameObject go = CreateBlock(); blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z] = new Block { Blocktransform = go.transform, color = selectedColor }; PositionBlock(go.transform, previewAction.index); previewAction = new BlockAction() { delete = false, index = previewAction.index, color = previewAction.color }; } else { //index -= hit.normal * blockSize; Destroy(blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z].Blocktransform.gameObject); blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z] = null; previewAction = new BlockAction() { delete = true, index = previewAction.index, color = previewAction.color }; } }
void Update() { // Only perform move/delete block with left mouse click bool isLeftClicked = Input.GetMouseButtonDown(0); BlockAction mode = ModeManager.Instance.currentMode; if (isLeftClicked) { // Check if the mouse was clicked over a UI element. If true, skip raycast if (EventSystem.current.IsPointerOverGameObject()) { return; } Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); bool isHit = Physics.Raycast(ray, out RaycastHit hitInfo); if (isHit && mode == BlockAction.Add && currentBlock != null) { PlaceBlockNear(hitInfo.point); } else if (isHit && mode == BlockAction.Delete) { RemoveBlock(hitInfo); } } }
public override void HandleEvent(Block block) { if (block.HitPoints <= HitPoints) { BlockAction.DoAction(block); } }
internal static string ToSerializedValue(this BlockAction value) { switch (value) { case BlockAction.Delete: return("Delete"); case BlockAction.Confirm: return("Confirm"); case BlockAction.Release: return("Release"); case BlockAction.Cancel: return("Cancel"); case BlockAction.Pickup: return("Pickup"); case BlockAction.Modify: return("Modify"); case BlockAction.Wash: return("Wash"); } return(null); }
public void Undo() { if (previewAction.delete) { //Spawn back GameObject go = CreateBlock(); blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z] = new Block { blockTransform = go.transform, color = selectedColor }; PositionBlock(go.transform, previewAction.index); previewAction = new BlockAction() { delete = false, index = previewAction.index, color = previewAction.color }; } else { Destroy(blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z].blockTransform.gameObject); blocks[(int)previewAction.index.x, (int)previewAction.index.y, (int)previewAction.index.z] = null; previewAction = new BlockAction() { delete = true, index = previewAction.index, color = previewAction.color }; } }
/// <summary> /// Retrieves a set of custom block actions. /// </summary> private List <IScrollableAction> GetScrollableActions() { List <IScrollableAction> actions = new List <IScrollableAction>(); if (TBlock is IMyMechanicalConnectionBlock) { BlockAction.GetMechActions(TBlock, actions); IsMechConnection = true; } else if (TBlock is IMyDoor) { BlockAction.GetDoorActions(TBlock, actions); } else if (TBlock is IMyWarhead) { BlockAction.GetWarheadActions(TBlock, actions); } else if (TBlock is IMyLandingGear) { BlockAction.GetGearActions(TBlock, actions); } else if (TBlock is IMyShipConnector) { BlockAction.GetConnectorActions(TBlock, actions); } else if (TBlock is IMyParachute) { BlockAction.GetChuteActions(TBlock, actions); } return(actions); }
/// <summary> /// Initializes a new instance of the /// ActionModelBlockActionNotAllowedBlockActionReason class. /// </summary> /// <param name="action">Possible values include: 'Delete', 'Confirm', /// 'Release', 'Cancel', 'Pickup', 'Modify', 'Wash'</param> public ActionModelBlockActionNotAllowedBlockActionReason(BlockAction action, bool isAllowed, IList <ActionReasonModelNotAllowedBlockActionReason> reasons = default(IList <ActionReasonModelNotAllowedBlockActionReason>)) { Action = action; IsAllowed = isAllowed; Reasons = reasons; CustomInit(); }
public ScriptBlock GetBlockScript(string key, GameBlock block, BlockAction action) { ValidateScriptType(key, "ScriptBlock"); ScriptBlock script = (ScriptBlock)GetScript(key); script.Prepare(block, action); return script; }
public void ShouldReturnAdminBlock() { var blockAction = new BlockAction(); Assert.Equal(AnalyzeResult.AdminBlock, blockAction.Audit(null, new Configuration.Action { })); }
public void Test_SetStatusCode() { int statusCode = (new Random((int)DateTime.Now.Ticks)).Next(); BlockAction action = new BlockAction(); Assert.AreNotEqual(action.StatusCode, statusCode); action.StatusCode = statusCode; Assert.AreEqual(action.StatusCode, statusCode); }
/// <summary> /// 区块排它锁 /// </summary> /// <param name="action">进入锁之后的回调。</param> /// <param name="arg">参数。</param> public void Block <T>(BlockAction <T> action, T arg) { Symbol.CommonException.CheckArgumentNull(action, "action"); Begin(); try { ThreadHelper.Block <T>(_sync, action, arg); } finally { End(); } }
public LambdaAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.LambdaContext context) { Scope lambdaScope = scope.Child(); RecursiveCallHandler = new LambdaRecursionHandler(this); CallInfo = new CallInfo(RecursiveCallHandler, parseInfo.Script); // Get the lambda parameters. Parameters = new Var[context.define().Length]; InvokedState = new SubLambdaInvoke[Parameters.Length]; for (int i = 0; i < Parameters.Length; i++) { InvokedState[i] = new SubLambdaInvoke(); // TODO: Make custom builder. Parameters[i] = new ParameterVariable(lambdaScope, new DefineContextHandler(parseInfo, context.define(i)), InvokedState[i]); } CodeType[] argumentTypes = Parameters.Select(arg => arg.CodeType).ToArray(); // context.block() will not be null if the lambda is a block. // () => {} if (context.block() != null) { // Parse the block. Block = new BlockAction(parseInfo.SetCallInfo(CallInfo), lambdaScope, context.block()); // Validate the block. BlockTreeScan validation = new BlockTreeScan(parseInfo, Block, "lambda", DocRange.GetRange(context.INS())); validation.ValidateReturns(); if (validation.ReturnsValue) { LambdaType = new ValueBlockLambda(validation.ReturnType, argumentTypes); MultiplePaths = validation.MultiplePaths; } else { LambdaType = new BlockLambda(argumentTypes); } } // context.expr() will not be null if the lambda is an expression. // () => 2 * x else if (context.expr() != null) { // Get the lambda expression. Expression = parseInfo.SetCallInfo(CallInfo).GetExpression(lambdaScope, context.expr()); LambdaType = new MacroLambda(Expression.Type(), argumentTypes); } // Add so the lambda can be recursive-checked. parseInfo.TranslateInfo.RecursionCheck(CallInfo); // Add hover info parseInfo.Script.AddHover(DocRange.GetRange(context.INS()), new MarkupBuilder().StartCodeLine().Add(LambdaType.GetName()).EndCodeLine().ToString()); }
private void grdDataView_CustomDrawCell(object sender, DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventArgs e) { if (e.Column == grdDataView.Columns[1]) { DataRowView drv = grdDataView.GetRow(e.RowHandle) as DataRowView; if (drv != null) { BlockAction action = BlockAction.CreateActionInstance(drv[4].ToString()); StudioContext.UI.DrawRowIcon(action.Icon, e); } } }
private void _getLambdaStatement(PortableLambdaType expectingType) { ParseInfo parser = _parseInfo.SetCallInfo(CallInfo).AddVariableTracker(this).SetExpectingLambda(expectingType?.ReturnType); CodeType returnType = null; bool returnsValue = false; // Get the statements. if (_context.Statement is Block block) { // Parse the block. Statement = new BlockAction(parser, _lambdaScope, block); // Validate the block. BlockTreeScan validation = new BlockTreeScan(_parseInfo, (BlockAction)Statement, "lambda", _context.Arrow.Range); validation.ValidateReturns(); if (validation.ReturnsValue) { returnType = validation.ReturnType; MultiplePaths = validation.MultiplePaths; returnsValue = true; } } else if (_context.Statement is ExpressionStatement exprStatement) { // Get the lambda expression. Expression = parser.GetExpression(_lambdaScope, exprStatement.Expression); returnType = Expression.Type(); returnsValue = true; } else { // Statement Statement = parser.GetStatement(_lambdaScope, _context.Statement); if (Statement is IExpression expr) { Expression = expr; returnType = expr.Type(); returnsValue = true; } } LambdaType = new PortableLambdaType(expectingType?.LambdaKind ?? LambdaKind.Anonymous, _argumentTypes, returnsValue, returnType, _isExplicit); // Add so the lambda can be recursive-checked. _parseInfo.TranslateInfo.RecursionCheck(CallInfo); if (!LambdaType.IsConstant()) { Identifier = _parseInfo.TranslateInfo.GetComponent <LambdaGroup>().Add(new LambdaHandler(this)); } }
/// <summary> /// ExecuteAction method executes the user action (flag|open) on a particular block of the board. /// </summary> /// <param name="point">Position of the block.</param> /// <param name="blockAction">Action of the user on the block.</param> /// <returns>Block result describes whether the action is resulted in a success or error result.</returns> public BlockResult ExecuteAction(Point point, BlockAction blockAction) { if (!_validator.ValidateAction(_board, point, blockAction)) { return(BlockResult.Error); } var handler = _blockActionHandlers.Handlers.First(p => p.Key == blockAction).Value; handler.Process(CurrentBoard, point); return(BlockResult.Success); }
public static BlockAction GetBlockAction(string value, Action <StringBuilder> GetPostfixFunc, Action Action, PropertyBlock block) { BlockAction blockAction = block.blockActionPool.Get(); blockAction._propName = value; blockAction.SetAction(x => { if (x.Length == 0) { x.Append(value); } }, GetPostfixFunc, Action, block); return(blockAction); }
public static void queueAction(BlockAction action) { //Debug.Log("Queued " + action); lock (actionSet) { if (actionSet.Contains(action)) { return; } actions.Enqueue(action); actionSet.Add(action); //Debug.LogWarning("Added " + action + " target is now " + action.target.getPosition().getBlock()); } }
public void Serialize(System.Xml.XmlWriter xmlWriter, object o) { BlockAction ba = (BlockAction)o; foreach (var action in ba.ActionList) { ISerializer actionSerializer = SerializerProvider.GetSerializer(action.GetType()); xmlWriter.WriteStartElement("Action"); //xmlWriter.WriteAttributeString("AssemblyQualifiedName", action.GetType().AssemblyQualifiedName); xmlWriter.WriteAttributeString("Type", SerializerHelper.GetActionName(action.GetType())); actionSerializer.Serialize(xmlWriter, action); xmlWriter.WriteEndElement(); } }
/// <summary> /// ValidateAction method will validate the user action on a block. /// </summary> /// <param name="board">Board object which holds all the blocks.</param> /// <param name="position">Position of the block on which user performs an action.</param> /// <param name="action">Type of the action which user intends to perform on a block.</param> /// <returns></returns> public bool ValidateAction(Board board, Point position, BlockAction action) { var block = IsValidIndex(board, position); if (block == null) { return(false); } if (block.BlockState == BlockState.Opened) { return(false); } return(true); }
public object Deserialize(System.Xml.XmlReader xmlReader) { BlockAction blockAction = new BlockAction(); blockAction.ActionList = new List <IAction>(); xmlReader.ReadStartElement(); SerializerHelper.ReadWhiteSpace(xmlReader); while (xmlReader.IsStartElement("Action")) { IAction action = SerializerHelper.DeserializeAction(xmlReader); blockAction.ActionList.Add(action); } xmlReader.ReadEndElement(); SerializerHelper.ReadWhiteSpace(xmlReader); return(blockAction); }
public void TestMethod1() { ExpressionParser Parser = ExpressionParser.CreateParser(); BlockAction action = new BlockAction { Parser = Parser, ActionList = new List <IAction> { new DummyAction(), new DummyAction() } }; action.ExecuteAction(); Assert.AreEqual(1, (action.ActionList[0] as DummyAction).Count); Assert.AreEqual(1, (action.ActionList[1] as DummyAction).Count); }
// Use this for initialization void Start() { base.Initialize(); // Load Action Func으로 뺴세요 if (MoveAction == null) { MoveAction = GetComponent <MoveAction>(); } if (IdleAction == null) { IdleAction = GetComponent <IdleAction>(); } if (RollAction == null) { RollAction = GetComponent <RollAction>(); } if (AttackAction == null) { AttackAction = GetComponent <AttackAction>(); } if (KnockBackAction == null) { KnockBackAction = GetComponent <KnockBackAction>(); } if (BackStepAction == null) { BackStepAction = GetComponent <BackStepAction>(); } if (BlockAction == null) { BlockAction = GetComponent <BlockAction>(); } var mainCamera = Camera.main.GetComponent <TargetCamera>(); MoveAction.OnMoveEndCallBack += mainCamera.OnUpdateCamera; RollAction.OnMoveEndCallBack += mainCamera.OnUpdateCamera; mainCamera.SetTarget(this); }
private void SendToServer(IMyEntity entityblock, long playerID, BlockAction action, TurretSetting settings = null) { try { if (playerID == 0) { return; } NetworkMessage msg = new NetworkMessage(); msg.BlockEntityId = entityblock.EntityId; msg.PlayerId = playerID; msg.SteamId = MyAPIGateway.Multiplayer.MyId; msg.Action = (ushort)action; // compile block data if (settings != null) { // send passed values msg.ColorR = settings.LightColor.R; msg.ColorG = settings.LightColor.G; msg.ColorB = settings.LightColor.B; msg.ColorA = settings.LightColor.A; msg.LightIntensity = settings.LightIntensity; msg.LightOffset = settings.LightOffset; msg.LightRadius = settings.LightRadius; msg.LightBlinkInterval = settings.LightBlinkInterval; msg.LightBlinkLength = settings.LightBlinkLength; msg.LightBlinkOffset = settings.LightBlinkOffset; msg.TurretAzimuth = settings.TurretAzimuth; msg.TurretElevation = settings.TurretElevation; msg.Enabled = settings.Enabled; } Logger.Instance.LogMessage("Send message to server: " + msg.SteamId + " for block: " + msg.BlockEntityId + " Action: " + msg.Action); var msgBytes = MyAPIGateway.Utilities.SerializeToBinary(msg); MyAPIGateway.Multiplayer.SendMessageToServer(_RCV_FROMCLIENT, msgBytes, true); } catch (Exception ex) { Logger.Instance.LogMessage(ex.Message); Logger.Instance.LogMessage(ex.StackTrace); } }
public LambdaAction(ParseInfo parseInfo, Scope scope, DeltinScriptParser.LambdaContext context) { Scope lambdaScope = scope.Child(); // Get the lambda parameters. Parameters = new Var[context.define().Length]; for (int i = 0; i < Parameters.Length; i++) { // TODO: Make custom builder. Parameters[i] = new ParameterVariable(lambdaScope, new DefineContextHandler(parseInfo, context.define(i))); } CodeType[] argumentTypes = Parameters.Select(arg => arg.CodeType).ToArray(); // context.block() will not be null if the lambda is a block. // () => {} if (context.block() != null) { // Parse the block. Block = new BlockAction(parseInfo, lambdaScope, context.block()); // Validate the block. BlockTreeScan validation = new BlockTreeScan(parseInfo, Block, "lambda", DocRange.GetRange(context.INS())); validation.ValidateReturns(); if (validation.ReturnsValue) { LambdaType = new ValueBlockLambda(validation.ReturnType, argumentTypes); MultiplePaths = validation.MultiplePaths; } else { LambdaType = new BlockLambda(argumentTypes); } } // context.expr() will not be null if the lambda is an expression. // () => 2 * x else if (context.expr() != null) { // Get the lambda expression. Expression = parseInfo.GetExpression(lambdaScope, context.expr()); LambdaType = new MacroLambda(Expression.Type(), argumentTypes); } }
public void Test_Execute() { IntrusionDetector detector = Esapi.IntrusionDetector as IntrusionDetector; Assert.IsNotNull(detector); // Should be loaded by default BlockAction action = new BlockAction(); // Set context MockHttpContext.InitializeCurrentContext(); SurrogateWebPage page = new SurrogateWebPage(); HttpContext.Current.Handler = page; // Block Assert.AreNotEqual(HttpContext.Current.Response.StatusCode, action.StatusCode); action.Execute(ActionArgs.Empty); Assert.AreEqual(HttpContext.Current.Response.StatusCode, action.StatusCode); }
public override void applyAction(BlockAction action) { UpdatePressure pu = action as UpdatePressure; if (pu != null) { Liquid liq = pu.changed as Liquid; if (liq != null) { float otherPressure = liq.getPressure(); if (liq.getCoordinates().y > coords.y) { otherPressure += liq.density; } } } else { Debug.LogError("Unknown action: " + action); } }
/// <summary> /// 区块排它锁 /// </summary> /// <param name="state">用于排它锁的对象,不能是结构类型和string。</param> /// <param name="action">进入锁之后的回调。</param> /// <param name="arg">参数。</param> public static void Block <T>(object state, BlockAction <T> action, T arg) { Symbol.CommonException.CheckArgumentNull(state, "state"); Symbol.CommonException.CheckArgumentNull(action, "action"); bool lockToken = false; #if net20 || net35 System.Threading.Monitor.Enter(state); lockToken = true; #else System.Threading.Monitor.Enter(state, ref lockToken); #endif try { action(arg); } finally { if (lockToken) { System.Threading.Monitor.Exit(state); } } }
public BlockResponse GetBlockState(int blockId) { // Compose Action object BlockAction action = new BlockAction(blockId); // Get RequestQueue, and push data into queue IRequestQueue queue = QueueCollection.Current.Item(blockId); if (queue == null) { throw new InvalidOperationException($"Could not find queue with BlockID {blockId}"); } // Send request for block state queue.Push(action); // Wait a bit for the the response to appear BlockResponse result = (BlockResponse)queue.GetResponse(action.MessageID); return(result); }
/// <summary> /// Retrieves a set of custom block actions. /// </summary> private void GetScrollableActions() { if (SubtypeId.UsesSubtype(TBlockSubtypes.MechanicalConnection)) { BlockAction.GetMechActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.Door)) { BlockAction.GetDoorActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.Warhead)) { BlockAction.GetWarheadActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.LandingGear)) { BlockAction.GetGearActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.Connector)) { BlockAction.GetConnectorActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.Programmable)) { BlockAction.GetProgrammableBlockActions(this, blockMembers); } if (SubtypeId.UsesSubtype(TBlockSubtypes.Timer)) { BlockAction.GetTimerActions(this, blockMembers); } }
private static void Run() { while (running) { BlockAction action = null; lock (actionSet) { if (actions.TryDequeue(out action)) { actionSet.Remove(action); } } if (action != null) { if (action.getAge() < MIN_AGE) { Thread.Sleep(Math.Max(1, (int)(1000 * (MIN_AGE - action.getAge())))); } if (!action.target.getPosition().getBlock().Equals(action.target)) { //Debug.LogWarning("Scrapped " + action + " target is now " + action.target.getPosition().getBlock()); } else { lock (actionLock) { action.target.applyAction(action); } } } else { Thread.Sleep(100); } //Thread.Sleep(2000); } }
public void Prepare(GameBlock block, BlockAction action) { this.block = block; this.action = action; }
public void NetThread() { SessionIDRequest sessionID = new SessionIDRequest(Storage.Network.UserName, Storage.Network.Password); sessionID.SendRequest(); SharedSecretGenerator sharedSecret = new SharedSecretGenerator(); //random byte[16] gen Timer positionUpdater = new Timer(PositionSender, null, Timeout.Infinite, 50); //create position updater Socket networkSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); networkSocket.Connect(Storage.Network.Server, Storage.Network.Port); _stream = new EnhancedStream(networkSocket); Handshake handshake = new Handshake(_stream); handshake.Send(Storage.Network.UserName, Storage.Network.Server, Storage.Network.Port); // connect Storage.Network.IsConnected = true; while (Storage.Network.IsConnected) { switch (_packetIDbuffer = (byte)_stream.ReadByte()) { case 0x00: KeepAlive keepAlive = new KeepAlive(_stream); break; case 0x01: LoginRequest loginRequest = new LoginRequest(_stream); //positionUpdater.Change(0, 50); ClientSettings clientSettings = new ClientSettings(_stream); clientSettings.Send(); break; case 0x03: ChatMessage chatMessage = new ChatMessage(_stream); break; case 0x04: TimeUpdate timeUpdate = new TimeUpdate(_stream); break; case 0x05: EntityEquipment entityEquipment = new EntityEquipment(_stream); break; case 0x06: SpawnPosition spawnPosition = new SpawnPosition(_stream); break; case 0x08: UpdateHealth updateHealth = new UpdateHealth(_stream); break; case 0x09: RespawnPacket respawnPacket = new RespawnPacket(_stream); break; case 0x0D: _playerPositionLook = new PlayerPositionLook(_stream); break; case 0x10: HeldItemChange heldItemChange = new HeldItemChange(_stream); break; case 0x11: UseBed useBed = new UseBed(_stream); break; case 0x12: Animation animation = new Animation(_stream); break; case 0x14: SpawnNamedEntity spawnNamedEntity = new SpawnNamedEntity(_stream); break; case 0x16: CollectItem collectItem = new CollectItem(_stream); break; case 0x17: SpawnObjectVehicle spawnObjectVehicle = new SpawnObjectVehicle(_stream); break; case 0x18: SpawnMob spawnMob = new SpawnMob(_stream); break; case 0x19: SpawnPainting spawnPainting = new SpawnPainting(_stream); break; case 0x1A: SpawnExperienceOrb spawnExperienceOrb = new SpawnExperienceOrb(_stream); break; case 0x1C: EntityVelocity entityVelocity = new EntityVelocity(_stream); break; case 0x1D: DestroyEntity destroyEntity = new DestroyEntity(_stream); break; case 0x1E: Entity entity = new Entity(_stream); break; case 0x1F: EntityRelativeMove entityRelativeMove = new EntityRelativeMove(_stream); break; case 0x20: EntityLook entityLook = new EntityLook(_stream); break; case 0x21: EntityLookRelativeMove entityLookRelativeMove = new EntityLookRelativeMove(_stream); break; case 0x22: EntityTeleport entityTeleport = new EntityTeleport(_stream); break; case 0x23: EntityHeadLook entityHeadLook = new EntityHeadLook(_stream); break; case 0x26: EntityStatus entityStatus = new EntityStatus(_stream); break; case 0x27: AttachEntity attachEntity = new AttachEntity(_stream); break; case 0x28: EntityMetadata entityMetadata = new EntityMetadata(_stream); break; case 0x29: EntityEffect entityEffect = new EntityEffect(_stream); break; case 0x2A: RemoveEntityEffect removeEntityEffect = new RemoveEntityEffect(_stream); break; case 0x2B: SetExperience setExperience = new SetExperience(_stream); break; case 0x33: ChunkData mapChunk = new ChunkData(_stream); break; case 0x34: MultiBlockChange multiBlockChange = new MultiBlockChange(_stream); break; case 0x35: BlockChange blockChange = new BlockChange(_stream); break; case 0x36: BlockAction blockAction = new BlockAction(_stream); break; case 0x37: BlockBreakAnimation blockBreakAnimation = new BlockBreakAnimation(_stream); break; case 0x38: MapChunkBulk mapChunkBulk = new MapChunkBulk(_stream); break; case 0x3C: Explosion explosion = new Explosion(_stream); break; case 0x3D: SoundParticleEffect soundParticleEffect = new SoundParticleEffect(_stream); break; case 0x3E: NamedSoundEffect namedSoundEffect = new NamedSoundEffect(_stream); break; case 0x46: ChangeGameState changeGameState = new ChangeGameState(_stream); break; case 0x47: Thunderbolt thunderbolt = new Thunderbolt(_stream); break; case 0x64: OpenWindow openWindow = new OpenWindow(_stream); break; case 0x65: CloseWindow closeWindow = new CloseWindow(_stream); break; case 0x67: SetSlot setSlot = new SetSlot(_stream); break; case 0x68: SetWindowItems setWindowItems = new SetWindowItems(_stream); break; case 0x69: UpdateWindowProperty updateWindowProperty = new UpdateWindowProperty(_stream); break; case 0x6A: ConfirmTransaction confirmTransaction = new ConfirmTransaction(_stream); break; case 0x6B: CreativeInventoryAction creativeInventoryAction = new CreativeInventoryAction(_stream); break; case 0x6C: EnchantItem enchantItem = new EnchantItem(_stream); break; case 0x82: UpdateSign updateSign = new UpdateSign(_stream); break; case 0x83: ItemData itemData = new ItemData(_stream); break; case 0x84: UpdateTileEntity updateTileEntity = new UpdateTileEntity(_stream); break; case 0xC8: IncrementStatistic incrementStatistic = new IncrementStatistic(_stream); break; case 0xC9: PlayerListItem playerListItem = new PlayerListItem(_stream); break; case 0xCA: PlayerAbilities playerAbilities = new PlayerAbilities(_stream); break; case 0xCB: TabComplete tabcomplete = new TabComplete(_stream); break; case 0xFA: PluginMessage pluginMessage = new PluginMessage(_stream); break; case 0xFC: EncryptionKeyResponse encryptionKeyResponse = new EncryptionKeyResponse(_stream); encryptionKeyResponse.Get(); _stream = new AesStream(networkSocket, _stream, sharedSecret.Get); ClientStatuses clientStatuses = new ClientStatuses(_stream); clientStatuses.Send(0); break; case 0xFD: EncryptionKeyRequest encryptionKeyRequest = new EncryptionKeyRequest(_stream, sharedSecret.Get, sessionID.GetID(), Storage.Network.UserName); // encryptionKeyResponse = new EncryptionKeyResponse(_stream); encryptionKeyResponse.Send(encryptionKeyRequest.GetEncSharedSecret(), encryptionKeyRequest.GetEncToken()); break; case 0xFF: positionUpdater = null; DisconnectKick disconnectKick = new DisconnectKick(_stream); networkSocket.Disconnect(false); break; default: throw new Exception("We got a Unknown Packet (" + _packetIDbuffer + ")from the Server. This should not happen: Error in Packet parser"); } } }
public ActionBlockItem(BlockAction action) { Action = action; }
public NetworkMode ReadPacket(MinecraftStream stream, NetworkMode mode, PacketDirection direction) { Action = (BlockAction)stream.ReadInt8(); X = stream.ReadInt32(); Y = stream.ReadUInt8(); Z = stream.ReadInt32(); Face = (BlockFace)stream.ReadInt8(); return mode; }
public PlayerBlockActionPacket(BlockAction action, int x, byte y, int z, BlockFace face) { Action = action; X = x; Y = y; Z = z; Face = face; }
public void ToggleAction() { Action = Action == BlockAction.Show ? BlockAction.Hide : BlockAction.Show; }
public abstract void applyAction(BlockAction action);
public void Interact(BlockAction action) { if (scriptName != null) { ScriptBlock script = Engine.Script.Library.GetBlockScript(scriptName, this, action); Engine.Script.AddScript(script); } }