//
        // Write a object instance to data output stream
        //
        public override void LooseMarshal(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut)
        {
            ControlCommand info = (ControlCommand)o;

            base.LooseMarshal(wireFormat, o, dataOut);
            LooseMarshalString(info.Command, dataOut);
        }
Example #2
0
        private bool ExecuteCommand(ControlCommand command)
        {
            var result = true;

            switch (command)
            {
            case ControlCommand.L:
                TurnLeft();
                break;

            case ControlCommand.R:
                TurnRight();
                break;

            case ControlCommand.M:
                result = Move();
                break;

            default:
                // TODO throw exception
                break;
            }

            return(result);
        }
Example #3
0
    public bool InputCommand(string text)
    {
        if (!UnLockFuncName.Contains(text))
        {
            return(false);
        }
        ControlCommand controlCommand = (ControlCommand)Enum.Parse(typeof(ControlCommand), text);

        if (UnLockFunc.Contains(controlCommand))
        {
            return(false);
        }
        UnLockFunc.Add(controlCommand);

        if (controlCommand == ControlCommand.love)
        {
        }
        if (controlCommand == ControlCommand.evol)
        {
        }
        if (controlCommand == ControlCommand.authorize)
        {
            buttonjumplevel.gameObject.SetActive(true);
        }
        return(true);
    }
Example #4
0
    // Update is called once per frame in Unity
    void Update()
    {
        if (!started && Input.GetButtonDown("Start"))
        {
            ConnectionStatus.text = "Connected";
            started = true;
            ros     = new ROSBridgeWebSocketConnection("ws://localhost", 8080);

            ros.AddPublisher(typeof(CommandPublisher));
            ros.AddPublisher(typeof(VelocityPublisher));

            // Fire up the subscriber(s) and publisher(s)
            ros.Connect();
        }

        ControlCommand command_msg = GetControlCommand();

        Debug.Log("Sending: " + command_msg.ToYAMLString());
        ControlVelocity velocity_msg = new ControlVelocity(GetPitch(), GetRoll(), GetThrottle(), GetYaw());

        Debug.Log("Sending: " + velocity_msg.ToYAMLString());

        // Publish it (ros is the object defined in the first class)
        ros.Publish(CommandPublisher.GetMessageTopic(), command_msg);
        ros.Publish(VelocityPublisher.GetMessageTopic(), velocity_msg);

        ros.Render();
    }
Example #5
0
        public override Packet Read(BinaryReader reader)
        {
            var controlCommand = new ControlCommand();

            var type     = reader.ReadInt32();
            var dataSize = reader.ReadInt32();

            if (!IsValidControlCommand(type))
            {
                ThrowException();
            }

            controlCommand.Level = Level.Control;
            controlCommand.ControlCommandType =
                (ControlCommandType)type;

            if (dataSize > 0)
            {
                Stream data = new MemoryStream();
                ReadData(reader, data, dataSize);
                controlCommand.Data          = data;
                controlCommand.Data.Position = 0;
            }

            Logging.SDK.LogObject(Level.Debug, "controlCommand",
                                  controlCommand);
            return(controlCommand);
        }
Example #6
0
        public RouteResponse CC(ControlCommand command)
        {
            //serialize message
            string serialized = JsonConvert.SerializeObject(command, new JsonSerializerSettings()
            {
                TypeNameHandling = TypeNameHandling.All
            });
            JObject asJO = JObject.Parse(serialized);



            //create peristed message
            BusMessage msg = new BusMessage()
            {
                PayLoad = serialized, MessageType = asJO["$type"].ToString()
            };


            RouteResponse toReturn = new RouteResponse()
            {
                Status = false
            };

            try {
                toReturn = Bus.ReceiveMessage(msg);
            } catch {
                throw;
            }

            return(toReturn);
        }
Example #7
0
        public BasicTrickAreaObservable(CommandContainer container, IEventAggregator aggregator) : base(container)
        {
            _aggregator = aggregator;
            MethodInfo method = this.GetPrivateMethod(nameof(PrivateCardClickedAsync));

            CardSingleClickCommand = new ControlCommand(this, method, container);
        }
    public override void ExecuteControlCommand(ControlCommand control)
    {
        ////Debug.Log ("Executing control command " + control.ToString ());

        Move(control.Forward, control.Turn, control.Duration, control.Jump);
        Look(control.LookHorz, control.LookVert);
    }
Example #9
0
 public void Init(ControlCommand controlCommand)
 {
     gameObject.SetActive(true);
     this.controlCommand = controlCommand;
     icon.sprite         = UIMgr.instance.GetFuncBtnSprite((int)controlCommand);
     name.text           = ControlMgr.instance.nameEnum[(int)controlCommand];
 }
	public override void ExecuteControlCommand (ControlCommand control)
	{	
		////Debug.Log ("Executing control command " + control.ToString ());
		
		Move (control.Forward, control.Turn, control.Duration, control.Jump);
		Look (control.LookHorz, control.LookVert);
	}
Example #11
0
        public ChooseShapeObservable(XactikaGameContainer gameContainer) : base(gameContainer.Command)
        {
            MethodInfo method = this.GetPrivateMethod(nameof(ProcessPieceSelected));

            ShapeSelectedCommand = new ControlCommand(this, method, gameContainer.Command);
            _gameContainer       = gameContainer;
        }
Example #12
0
    public void CaseCommand(string cc)
    {
        switch (cc)
        {
        case "Rotate":
            CaseControlCommand = ControlCommand.Rotate;
            break;

        case "Zoom":
            CaseControlCommand = ControlCommand.Zoom;
            break;

        case "Move":
            CaseControlCommand = ControlCommand.Move;
            break;

        case "Delete":
            CaseControlCommand = ControlCommand.Delete;
            Destroy(this.gameObject);
            break;

        case "Info":
            CaseControlCommand = ControlCommand.information;
            break;

        case "Duplicate":
            CaseControlCommand = ControlCommand.Duplicate;
            break;

        default:
            CaseControlCommand = ControlCommand.None;
            break;
        }
    }
Example #13
0
        public NumberPicker(CommandContainer command, IGamePackageResolver resolver) : base(command)
        {
            _privateChoose           = new ItemChooserClass <NumberPieceCP>(resolver);
            _privateChoose.ValueList = NumberList;
            MethodInfo method = this.GetPrivateMethod(nameof(ChooseNumberAsync));

            NumberPickedCommand = new ControlCommand(this, method, command);
        }
Example #14
0
        public ListViewPicker(CommandContainer container, IGamePackageResolver resolver) : base(container)
        {
            _privateChoose           = new ItemChooserClass <ListViewPieceCP>(resolver);
            _privateChoose.ValueList = TextList;
            MethodInfo method = this.GetPrivateMethod(nameof(ProcessClickAsync));

            ItemSelectedCommand = new ControlCommand(this, method, container);
        }
Example #15
0
        public SimpleEnumPickerVM(CommandContainer container, IEnumListClass <E> thisChoice) : base(container)
        {
            _thisChoice = thisChoice;
            LoadEntireList();
            MethodInfo method = this.GetPrivateMethod(nameof(ProcessClickAsync));

            EnumChosenCommand = new ControlCommand(this, method, container);
        }
        public PublicPilesVM(CommandContainer command) : base(command)
        {
            MethodInfo method = this.GetPrivateMethod(nameof(PrivateNewAsync));

            NewCommand  = new ControlCommand(this, method, command);
            method      = this.GetPrivateMethod(nameof(PrivateClickAsync));
            PileCommand = new ControlCommand(this, method, command);
        }
Example #17
0
        //public ControlCommand<BasicPileInfo<FlinchCardInformation>> PileCommand { get; set; }
        //public Command PileCommand { get; set; }

        public PublicPilesViewModel(CommandContainer command) : base(command)
        {
            MethodInfo method = this.GetPrivateMethod(nameof(PrivatePileAsync));

            PileCommand = new ControlCommand(this, method, command);

            //Visible = true;
        }
 public void SendCommand(ControlCommand command)
 {
     if (command == ControlCommand.Catch)
     {
         _machineStatus.GameOver();
     }
     Send(ParseCommand(command));
 }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void LooseUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn)
        {
            base.LooseUnmarshal(wireFormat, o, dataIn);

            ControlCommand info = (ControlCommand)o;

            info.Command = LooseUnmarshalString(dataIn);
        }
Example #20
0
 public void UpdateLastCommand(ControlCommand command)
 {
     _lastSendControlCommand = command;
     if (command == ControlCommand.Stop)
     {
         IsStopWait = false;
     }
 }
        //
        // Write a object instance to data output stream
        //
        public override void TightMarshal2(OpenWireFormat wireFormat, Object o, BinaryWriter dataOut, BooleanStream bs)
        {
            base.TightMarshal2(wireFormat, o, dataOut, bs);

            ControlCommand info = (ControlCommand)o;

            TightMarshalString2(info.Command, dataOut, bs);
        }
        //
        // Un-marshal an object instance from the data input stream
        //
        public override void TightUnmarshal(OpenWireFormat wireFormat, Object o, BinaryReader dataIn, BooleanStream bs)
        {
            base.TightUnmarshal(wireFormat, o, dataIn, bs);

            ControlCommand info = (ControlCommand)o;

            info.Command = TightUnmarshalString(dataIn, bs);
        }
Example #23
0
        /// <summary>
        /// telloの操作のためのjsonに変換を行うクラス。
        /// </summary>
        /// <param name="commandName">up, downなどのワード</param>
        /// <param name="value">操作するための値を設定</param>
        /// <returns></returns>
        string EncodeToJson(string commandName, int value)
        {
            var command = new ControlCommand {
                commandName = commandName, value = value
            };
            var json = JsonUtility.ToJson(command);

            return(json);
        }
Example #24
0
        public DeckObservablePile(IEventAggregator aggregator, CommandContainer command) : base(command) //realy don't want to have to resolve with this library.
        {
            _objectList = new DeckObservableDict <D>();
            MethodInfo method = this.GetPrivateMethod(nameof(PrivateDeckClickedAsync));

            DeckObjectClickedCommand       = new ControlCommand(this, method, command);
            _objectList.CollectionChanged += ObjectList_CollectionChanged;
            _aggregator = aggregator;
        }
        public DesktopSnapshot sendControlCommand(ControlCommand ControlCommand)
        {
            WebDesktopTCPClient client = new WebDesktopTCPClient(ControlCommand.MachineName);
            string          base64     = client.SendControl(ControlCommand);
            DesktopSnapshot snapshot   = new DesktopSnapshot();

            snapshot.DesktopBase64 = base64;
            return(snapshot);
        }
Example #26
0
        public BasicMultiplePilesCP(CommandContainer command, IEventAggregator aggregator) : base(command)
        {
            MethodInfo method = this.GetPrivateMethod(nameof(PrivatePileClickedAsync));

            PileCommand = new ControlCommand(this, method, command);
            _aggregator = aggregator;
            //visible is iffy (?)
            //Visible = true; //for multiple piles, has to be visible to begin with.
        }
        //
        // Write the booleans that this object uses to a BooleanStream
        //
        public override int TightMarshal1(OpenWireFormat wireFormat, Object o, BooleanStream bs)
        {
            ControlCommand info = (ControlCommand)o;

            int rc = base.TightMarshal1(wireFormat, o, bs);

            rc += TightMarshalString1(info.Command, bs);

            return(rc + 0);
        }
        public void RepeatCommand()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("repeat");

            Assert.IsTrue(command is ControlCommand);
            ControlCommand controlCommand = (ControlCommand)command;

            Assert.AreEqual(Control.REPEAT, controlCommand.controlType);
        }
        //public ControlCommand BoardDoubleClickCommand { get; set; }
        //public ControlCommand BoardMoveCommand { get; set; }
        public HandObservable(CommandContainer command) : base(command)
        {
            MethodInfo method = this.GetPrivateMethod(nameof(ObjectClickProcessAsync));

            //method did not work still.
            ObjectSingleClickCommand = new ControlCommand(this, method, command);
            method = this.GetPrivateMethod(nameof(PrivateBoardSingleClickedAsync));
            BoardSingleClickCommand     = new ControlCommand(this, method, command);
            HandList.CollectionChanged += HandList_CollectionChanged;
        }
        public void PauseCommand()
        {
            var program = MDKFactory.CreateProgram <Program>();
            var command = program.ParseCommand("pause");

            Assert.IsTrue(command is ControlCommand);
            ControlCommand controlCommand = (ControlCommand)command;

            Assert.AreEqual(Control.PAUSE, controlCommand.controlType);
        }
Example #31
0
 public bool IsCommandCanSend(ControlCommand command)
 {
     if (_lastSendControlCommand == ControlCommand.Stop && command == ControlCommand.Stop)
     {
         IsStopWait = true;
         return(false);
     }
     _lastSendControlCommand = command;
     return(true);
 }
Example #32
0
    /// <summary>
    /// 9: Send a new control request every frame
    /// </summary>
    private void UpdateControls()
    {
        // 9A: Create a new control command to record player's keyboard/mouse input for the frame
        CurrentControlCommandId++;
        CurrentControlCommand = new ControlCommand(((Character)MyPlayer).Id, CurrentControlCommandId);

        // 9B: Set the duration of the control command to be the duration since the last frame
        CurrentControlCommand.Duration = Time.deltaTime;

        UpdateMovementControls();

        UpdateMouseLookControls();

        // 9F: Add the control command for this frame to the list of control commands
        ControlCommands.Add(CurrentControlCommandId, CurrentControlCommand);
    }
 public abstract void ExecuteControlCommand (ControlCommand control);
Example #34
0
		long Control (ControlCommand command, long arg)
		{
			switch (command) {
			case ControlCommand.Flush:
				backend.Flush ();
				return 1;

			default:
				throw new NotImplementedException ();
			}
		}
Example #35
0
		static long Control (IntPtr instance, ControlCommand command, long arg)
		{
			var c = (MonoBtlsBioMono)GCHandle.FromIntPtr (instance).Target;
			try {
				return c.Control (command, arg);
			} catch (Exception ex) {
				c.SetException (ex);
				return -1;
			}
		}
Example #36
0
 public ControlMessage(MessageType msgType, ControlCommand command)
     : base(msgType)
 {
     this.command = command;
 }
Example #37
0
 private void SendControlMessage(ControlCommand command)
 {
     _remoteEndpoint.SendControlCommand((int)command, command.ToString(), null, _remoteEndpoint);
 }
Example #38
0
 public void Write(ControlCommand cmd)
 {
     lock (myLock)
     {
         _serialPort.Write(((char)cmd).ToString());
     }
 }