Ejemplo n.º 1
0
    private float motorAngleFactor = 0.025f; // 90 degree angle rotates plexi by 15 degree.

    private void Awake()
    {
        xMaxValue = 320f;
        xMinValue = 0f;

        yMaxValue = 240f;
        yMinValue = 0f;

        distanceMaxValue = 100f;
        distanceMinValue = 0f;

        originXValue = (xMaxValue - xMinValue) / 2f;
        originYValue = (yMaxValue - yMinValue) / 2f;

        distanceFactor = 6f / distanceMaxValue;
        xFactor        = 8f / xMaxValue;
        yFactor        = 6f / yMaxValue;

        drawGraph     = GraphObject.GetComponent <Hard_DrawGraph>();
        ballTransform = ballObject.GetComponent <Transform>();

        uiHandler = UIObject.GetComponent <Hard_UIHandler>();
        blHandler = BallLocationHandlerObject.GetComponent <Hard_BallLocationHandler>();
        bhHandler = BallHeightObject.GetComponent <Hard_BallHeightHandler>();
        cMovement = ComponentMovementObject.GetComponent <ComponentMovement>();

        clientSide = ClientSideObject.GetComponent <ClientSide>();
    }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the OnClicked event of the Refresh control. Refreshes the current settings from the server.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        /// <version author="Andre Cachopas" date="13/05/2018" version="1.0" machine="KLAP"></version>
        /// <exception cref="NotImplementedException"></exception>
        private async void Refresh_OnClicked(object sender, EventArgs e)
        {
            ClientSide client = ClientSide.Instance;
            await client.RequestAlarm();

            await client.RequestLight();
        }
Ejemplo n.º 3
0
 void Awake()
 {
     if (null == instance)
     {
         instance = this;
     }
 }
Ejemplo n.º 4
0
 static void ipcon_OnConnectionChange(ClientSide.ConnectionState state)
 {
     Console.WriteLine("New Client state: " + state);
     if (state == ClientSide.ConnectionState.open)
     {
         ipcon.registerPacket(ClientOpCode.Core_send_version, ClientReceivedVersion, true);
     }
 }
Ejemplo n.º 5
0
        public AlarmPage()
        {
            Initialize(Content);
            InitializeComponent();

            _alarmServer = ClientSide.Instance;
            PopulateList();
        }
Ejemplo n.º 6
0
 public TreeViewSettings()
 {
     Header         = new Header();
     ClientHandlers = new ClientSide();
     Height         = 0;
     Width          = 0;
     DataOnClient   = false;
 }
Ejemplo n.º 7
0
        public Form_client()
        {
            InitializeComponent();

            _clientSocket          = new ClientSide();
            _clientSocket.StopWord = "bye";

            BindUItoClientSide();

            FormClosed += Form_client_FormClosed;

            _bot = new Bot(_clientSocket.Send);
        }
Ejemplo n.º 8
0
        int id;                    // This is the ID that is unique for this process instance

        public MainForm()
        {
            InitializeComponent();

            // Get the context for the user interface.
            ctx        = SynchronizationContext.Current;
            client     = new ClientSide(5000);
            bStayAlive = true;
            mreDead    = new ManualResetEvent(false);
            areNewData = new AutoResetEvent(false);
            // Get a unique ID for this client.
            id = System.Diagnostics.Process.GetCurrentProcess().Handle.ToInt32();
            // Start the worker thread.
            ThreadPool.QueueUserWorkItem(new WaitCallback(ListeningThread), null);
        }
Ejemplo n.º 9
0
        private string ToXml(ClientSide fd)
        {
            //Initiate XML stuff
            StringBuilder     sb       = new StringBuilder();
            XmlWriterSettings settings = new XmlWriterSettings();
            XmlWriter         writer   = XmlWriter.Create(sb, settings);

            writer.WriteStartDocument();
            writer.WriteStartElement("Datas");

            fd.ToXml(writer);

            writer.WriteEndElement();
            writer.WriteEndDocument();
            writer.Flush();
            return(sb.ToString());
        }
Ejemplo n.º 10
0
    // Start is called before the first frame update
    void Start()
    {
        cloneBalanceDeactivated  = Instantiate(deactivatedObject, buttonBalanceObject.transform.position, buttonBalanceObject.transform.rotation, buttonBalanceObject.transform);
        cloneBounceDeactivated   = Instantiate(deactivatedObject, buttonBounceObject.transform.position, buttonBounceObject.transform.rotation, buttonBounceObject.transform);
        cloneSquareDeactivated   = Instantiate(squareRedObject, buttonSquareObject.transform.position, buttonSquareObject.transform.rotation, buttonSquareObject.transform);
        cloneTriangleDeactivated = Instantiate(triangleRedObject, buttonTriangleObject.transform.position, buttonTriangleObject.transform.rotation, buttonTriangleObject.transform);
        cloneCircleDeactivated   = Instantiate(circleRedObject, buttonCircleObject.transform.position, buttonCircleObject.transform.rotation, buttonCircleObject.transform);

        bounceActivated   = false;
        balanceActivated  = false;
        squareActivated   = false;
        triangleActivated = false;
        circleActivated   = false;

        simMovement = plexiObject.GetComponent <Sim_PlexiMovement>();
        clientSide  = ClientObject.GetComponent <ClientSide>();

        clientSide.SendWithParameter("Desktop Client Initialized.");
    }
Ejemplo n.º 11
0
    private void Awake()
    {
        hpMovement = plexiObject.GetComponent <Hard_PlexiMovement>();

        clientsSender        = new List <ServerClient>();
        disconnectListSender = new List <ServerClient>();

        clientsReceiver        = new List <ServerClient>();
        disconnectListReceiver = new List <ServerClient>();

        clientsMobile        = new List <ServerClient>();
        disconnectListMobile = new List <ServerClient>();

        IPAddress temp = IPAddress.Any;

        try
        {
            serverSender = new TcpListener(temp, portSender);
            serverSender.Start();

            serverReceiver = new TcpListener(temp, portReceiver);
            serverReceiver.Start();

            serverMobile = new TcpListener(temp, portMobile);
            serverMobile.Start();

            StartListening();

            serverSenderStarted   = true;
            serverReceiverStarted = true;
            serverMobileStarted   = true;

            serverStatus.text = "Ip " + temp + " Port " + portSender;
        }
        catch (Exception e)
        {
            Debug.Log("Socket Error: " + e.Message);
            serverStatus.text = "Socket Error: " + e.Message;
        }

        clientSide = ClientSideObject.GetComponent <ClientSide>();
        clientSide.SendWithParameter("Desktop Client Initialized.");
    }
Ejemplo n.º 12
0
        public static void EnsureValid <TRequest>(TRequest request, IValidator <TRequest> validator)
        {
            var validationError = ClientSide.ValidationFailure();

            if (request == null)
            {
                throw validationError;
            }

            var validationResult = validator.Validate(request);

            if (!validationResult.IsValid)
            {
                foreach (var validationFailure in validationResult.Errors)
                {
                    validationError.Infos.Add(new Info(validationFailure.ErrorCode, validationFailure.ErrorMessage));
                }
                throw validationError;
            }
        }
 public SubscriberChangedEventArgs(ClientSide.Model.Subscriber subscriber)
 {
     Subscriber = subscriber;
 }
Ejemplo n.º 14
0
 public Receiver(ClientSide client, byte[] data)
 {
     _pr     = new PacketReader(data);
     _client = client;
 }