Inheritance: MonoBehaviour
        protected override void OnStart()
        {
            if (!_IOController.TryLoad(this))
            {
                _IOController.Save(this);
            }
#if HAS_SQLITE3
            sqlite = _bootstrap.GetService(ServicesTypes.SQLite3) as SQLite3Service;
#endif

            groupsInfo    = _bootstrap.GetModel(ModelTypes.Group) as GroupsInfo;
            questionsData = _bootstrap.GetModel(ModelTypes.Questions) as QuestionsData;

            quizTurning = _bootstrap.GetController(ControllerTypes.Quiz) as QuizTurningController;
            quizTurning.ClodeTurning += SaveAll;

            TurningGroupResponse = new List <TurningGroupResponse>();
            TurningPadResponse   = new List <TurningPadResponse>();
            LoadAll();
            LoadGroup();

            if (!GetFromUdp)
            {
                return;
            }

            receiver = _bootstrap.GetService(ServicesTypes.UDPRead) as UDPReceive;
            sender   = _bootstrap.GetService(ServicesTypes.UDPSend) as UDPSender;
            receiver.OnPacketReceive += UpdateFromUdp;
        }
Example #2
0
 private void Awake()
 {
     UDPScript     = network.GetComponent <UDPEditMode>();
     udpSend       = network.GetComponent <UDPSend>();
     udpReceive    = network.GetComponent <UDPReceive>();
     baxterCmdList = new List <BaxterCommands>();
 }
Example #3
0
        public static void Start(int maxPlayers)
        {
            MaxPlayers = maxPlayers;

            Console.WriteLine("Starting server...");

            ReceiveManager = new ServerReceiveManager();
            Send           = new ServerSend();

            tcpListener = new TcpListener(IPAddress.Any, Constants.PortTCP);
            tcpListener.Start();
            tcpListener.BeginAcceptTcpClient(TCPConnectCallback, null);
            Console.WriteLine($"TCP Listener has Started (Port: {Constants.PortTCP})");

            Action <Packet> serverUSPReceiveAction = (packet) => { ForwardUDPReceiveToClient(packet); };

            udpReceiver = new UDPReceive(serverUSPReceiveAction);
            udpReceiver.StartListening(Constants.ServerPortUDP);

            Thread mainThread = new Thread(new ThreadStart(MainThread));

            isRunning = true;
            mainThread.Start();
            Console.WriteLine($"Server has started.");
        }
 public Connection(string _remoteIP)
 {
     this.remoteIP    = _remoteIP;
     this.status      = false;
     this.udpSender   = new UDPSend(_remoteIP);
     this.udpReceiver = new UDPReceive();
     this.tcpSender   = new TCPSend(_remoteIP);
 }
Example #5
0
    void Start()
    {
        GameObject contoller = GameObject.FindGameObjectWithTag("GameController");
            faceAPI = contoller.GetComponentInChildren<UDPReceive>();

            Luna = GameObject.Find("Luna");
            cameraPosition = transform.position;
    }
	void Start(){

		DontDestroyOnLoad(this.gameObject);

		connectedPlayers = new List<string>();
		Application.runInBackground = true;
		udpReceive = GetComponent<UDPReceive>();
		udpSend = GetComponent<UDPSend>();
	}
Example #7
0
 public void Init()
 {
     controller        = Controller.Instance;
     penrose           = controller.penrose;
     tiles             = penrose.Tiles;
     setting           = new Settings();
     listenerOpenPixel = new UDPReceive(8500, handleOpenPixel);
     hits = new float[5];
 }
	// Use this for initialization
	void Start () {
		receive = GameObject.Find("Smart Floor").GetComponent<UDPReceive>();
		settings = GameObject.Find("Smart Floor").GetComponent<Settings>();
		playerNumber = playerNumber -1;
		float tempUnit = settings.Units / 3;
		
		if(tempUnit != 0)
			unitInUnity = unitInUnity * tempUnit; //depending on how many panels it will be calculated here
	}
Example #9
0
 public void Awake()
 {
     instance = this;
     DontDestroyOnLoad(gameObject);
     client        = new UdpClient(port);
     receiveThread = new Thread(new ThreadStart(ReceiveData));
     receiveThread.IsBackground = true;
     receiveThread.Start();
 }
    private void Awake()
    {
        instance = this;

        string host = System.Net.Dns.GetHostName();

        IP = System.Net.Dns.GetHostEntry(host).AddressList[0].ToString();
        IP = LocalIPAddress();
        Debug.Log("Super Brand new IP: " + IP);
    }
Example #11
0
    // Use this for initialization
    void Start()
    {
        GameObject contoller = GameObject.FindGameObjectWithTag("GameController");
        faceAPI = contoller.GetComponentInChildren<UDPReceive>();

        Luna = GameObject.Find ("Luna");

        //		 LunaBody = GameObject.Find ("LunaBody");
        //		headposition = this.transform.position - LunaBody.transform.position;
    }
Example #12
0
        protected override void OnStart()
        {
            base.OnStart();

            receiver = _bootstrap.GetService(ServicesTypes.UDPRead) as UDPReceive;
            receiver.OnPacketReceive += PrintDebug;

            sender = _bootstrap.GetService(ServicesTypes.UDPSend) as UDPSender;
            sender.SendPacket("Hello World");
        }
Example #13
0
    void Start()
    {
        myReceiver = GameObject.FindObjectOfType <UDPReceive>();

        if (myReceiver.markerUsable)
        {
            initalARRotation = headPose.rotation * Quaternion.Inverse(markerPose.rotation);
        }
        OriginalPosition = transform.position;
    }
	void Start(){
		System.Random random = new System.Random();
		id = random.Next(1000000).ToString();
		Application.runInBackground = true;
		udpReceive = GetComponent<UDPReceive>();
		udpSend = GetComponent<UDPSend>();
		
		sendLimit = 0.5f;
		sendCounter = 0;

	}
	public string allReceivedUDPPackets=""; // clean up this from time to time!


	// start from shell
	private static void Main() {
		UDPReceive receiveObj=new UDPReceive();
		receiveObj.init();

		string text="";
		do
		{
			text = Console.ReadLine();
		}
		while(!text.Equals("exit"));
	}
Example #16
0
    void Update()
    {
        if (thisInputField != null && thisInputField.placeholder.GetComponent <Text>().text.Equals("local ip"))
        {
            thisInputField.placeholder.GetComponent <Text>().text = UDPReceive.LocalIPAddress();
        }

        if (thisInputField != null && thisInputField.placeholder.GetComponent <Text>().text.Equals("local port"))
        {
            thisInputField.placeholder.GetComponent <Text>().text = UDPReceive.portField;
        }
    }
Example #17
0
    // start from shell
    private static void Main()
    {
        UDPReceive receiveObj = new UDPReceive();

        receiveObj.init();
        string text = "";

        do
        {
            text = Console.ReadLine();
        }while (!text.Equals("exit"));
    }
Example #18
0
 // cancels out MOOG rotations from the camera
 private void correctOrientation()
 {
     byte[] packet = UDPReceive.getMOOGData();
     if (packet != null)
     {
         float   time        = BitConverter.ToSingle(packet, 0);
         Vector3 orientation = new Vector3(
             BitConverter.ToSingle(packet, 4),
             BitConverter.ToSingle(packet, 8),
             BitConverter.ToSingle(packet, 12));
         transform.Rotate(-orientation);
     }
 }
        protected override void OnStart()
        {
            base.OnStart();

            sqlite = _bootstrap.GetService(ServicesTypes.SQLite3) as SQLite3Service;

            //sqlite.CreateDB("DebugDB");
            sqlite.CreateTurningTable();
            sqlite.CreateSunVoteTable();

            receiver = _bootstrap.GetService(ServicesTypes.UDPRead) as UDPReceive;
            receiver.OnPacketReceive += PrintDebug;
        }
    // start from shell
    // USEFULL ?
    private static void Main()
    {
        Debug.Log("Is that usefull ?");
        UDPReceive receiveObj = new UDPReceive();

        receiveObj.init();

        string text = "";

        do
        {
            text = Console.ReadLine();
        }while (!text.Equals("exit"));
    }
	// Use this for initialization
	void Start () {
		//check for jump maybe not cause of 2 people
		//if(player.JumpDetect() == "Landed")
		recieve = GameObject.Find("Smart Floor").GetComponent<UDPReceive>();
		settings = GameObject.Find("Smart Floor").GetComponent<Settings>();
		
		if(Screen.fullScreen)	
		{
			fullAddX = 100;
			fullAddY = 70;
		}
		
		AutoConnect();
		StartCoroutine(WaitCountdown(8.5f));
	}
Example #22
0
        public Client()
        {
            ClientReceiveManager = new ClientReceiveManager();
            Send = new ClientSend();

            Action <Packet> receivePacketAction = (packet) =>
            {
                ClientReceiveManager.ExecuteOnMainThread(() =>
                {
                    ClientReceiveManager.ProcessPacket(packet.PacketTypeId, this, packet);
                });
            };

            tcp        = new TCP(this, receivePacketAction);
            udpSend    = new UDPSend(this, receivePacketAction);
            udpReceive = new UDPReceive(receivePacketAction);
        }
	// Use this for initialization
	void Start () {
		int noOfPlayers = GetComponent<Settings>().noOfPlayers;
		receive = GameObject.Find("SmartFloor Prefab").GetComponent<UDPReceive>();
		
		//the following need to be arrays due to multiple players
		lastForce = new float[noOfPlayers];
		lastXcord  = new float[noOfPlayers];
		lastYcord  = new float[noOfPlayers];
		strHorMovement = new string[noOfPlayers];
		strVerMovement = new string[noOfPlayers];
		strCurrentForce = new string[noOfPlayers];
		countFrames = new int[noOfPlayers];
		countOccurrences = new int[noOfPlayers];
		bCrouch = new bool[noOfPlayers];
		bCheckJump = new bool[noOfPlayers];
		bLanding = new bool[noOfPlayers];
	}
Example #24
0
 void Start()
 {
     //LogitechGSDK.LogiSteeringInitialize(false);
     myGUID    = System.Guid.NewGuid();
     canObject = GameObject.FindObjectOfType <UDPReceive>(); // should be only one in the scene
     mainCam   = GameObject.FindObjectOfType <Camera>();
     if (doLog && type == 0)
     {
         sw = new StreamWriter(DateTime.Now.ToString().Replace('/', '_').Replace(' ', '_').Replace(':', '_') + ".csv");
         sw.WriteLine("Time,origin,valuename,value,queuedMessageCount");
         string time = (Time.time / 60) + ":" + (Time.time % 60);
         sw.WriteLine(time + "," + transform.name + ",sceneName," + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
         sw.AutoFlush = true;
         IsLogging    = true;
         StartCoroutine(writeToFile());
     }
     else if (doLog && type == 1)
     {
         IsLogging = true;
         logData(this.transform, 0f, "sceneName: " + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
         IPHostEntry host;
         host   = Dns.GetHostEntry(ipAddress);
         client = new MqttClient(host.AddressList [0], port, false, null);
         client.MqttMsgPublishReceived += client_MqttMsgPublishReceived;
         string clientId = Guid.NewGuid().ToString();
         client.Connect(clientId);
         StartCoroutine(writeToMQTT());
     }
     else if (doLog && type == 2)
     {
         Application.ExternalCall("WebSocketTest");
         IsLogging = true;
         logData(this.transform, 0f, "sceneName: " + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
         StartCoroutine(writeToWebsocket());
     }
     else if (doLog && type == 3)
     {
         IsLogging = true;
         logData(this.transform, 0f, "sceneName: " + UnityEngine.SceneManagement.SceneManager.GetActiveScene().name);
         logSender      = new UdpClient();
         remoteEndPoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);
         StartCoroutine(writeToUDP());
     }
 }
    public void ActivateContext(int id)
    {
        print("instance ID");
        print(id);

        Context ctx = new Context();

        for (int i = 0; i < this.ContextIndicators.Length; i++)
        {
            //print(this.ContextIndicators[i].GetComponent<ContextScript>().ID);
            if (this.ContextIndicators[i].GetComponent <ContextScript>().ID == id)
            {
                ContextScript ctxScript = this.ContextIndicators[i].GetComponent <ContextScript>();
                ctx.name = ctxScript.textMesh.text;
                ctx.id   = id;

                if (TangibleModeEnabled == false)
                {
                    ctxScript.isActivated = true;
                }

                ctx.active = ctxScript.isActivated;
                //print("context");
                //print(ctx.name);
                //print(ctx.id);
                //print(ctx.active);

                string contextJson = JsonUtility.ToJson(ctx);
                //print(contextJson);

                UDPReceive udp = GameObject.FindWithTag("UDPReceive").GetComponent <UDPReceive>();
                udp.writeSocket(contextJson);
            }
            else
            {
                if (TangibleModeEnabled == false)
                {
                    this.ContextIndicators[i].GetComponent <ContextScript>().isActivated = false; // remove the activation in all other context
                }
            }
        }
    }
Example #26
0
    /// <summary>
    ///  this implementation only works for flat surfaces
    ///  it fixes the cars position to that Yvalue
    ///
    /// rotationally it allows us to do alot but we stay on the x-z plae
    /// </summary>
    // Invoked when a line of data is received from the serial device.
    void Start()
    {
        isCalibrated  = false;
        myReceiver    = GameObject.FindObjectOfType <UDPReceive>();
        targetY       = transform.position.y;
        startPosition = transform.position;
        // startOrientation = myReceiver.rotation;
        originalOrientation = transform.rotation;
        if (RealCarMotion)
        {
            startOrientation = myReceiver.rotation;
        }
        else
        {
            CopyCar = GameObject.FindObjectOfType <InternalVehicleMotion>() as InternalVehicleMotion;
            //startOrientation = CopyCar.transform.rotation;
        }

        StartCoroutine(DelayedClaibration(1f));
    }
	void Start () {


		Screen.SetResolution(1600, 2400, false);

		isKeyboard = true;
		isSFloor = false;
		movementScore = 0;

		PlayerX = 0;

		Shaking = false; 

		//Link Game State script	
		gs = GameObject.Find ("GameController").GetComponent<GameState>();
		bc = GameObject.Find ("GameController").GetComponent<BuildingControl>();
		receive = GameObject.Find ("SmartFloor Prefab").GetComponent<UDPReceive>();
		settings = GameObject.Find("SmartFloor Prefab").GetComponent<Settings>();




	}
Example #28
0
    void Start()
    {
        // We initialize our variables that we receive from other gameobjects/scripts:
        udpRec = GetComponent <UDPReceive>();
        start  = GameObject.Find("Start").gameObject.GetComponent <SphereCollider>();
        end    = GameObject.Find("End").gameObject.GetComponent <SphereCollider>();
        //startLarge = GameObject.Find("StartLarge").gameObject.GetComponent<SphereCollider>();
        //endLarge = GameObject.Find("EndLarge").gameObject.GetComponent<SphereCollider>();
        follower   = GameObject.Find("followHandBike").gameObject.GetComponent <Transform>();
        pathPoints = GameObject.FindGameObjectsWithTag("Path");
        //pathPointsLarge = GameObject.FindGameObjectsWithTag("PathLarge");
        haveBeenAtPathPoint = new bool[pathPoints.Length];
        // get pathPoints GameObject.FindGameObjectsWithTag Gameobject so we can get transform.position as well
        voiceFile            = GetComponent <AudioSource>();
        detectSoundHasPlayed = false;

        // Get movie
        r     = GetComponent <Renderer>();
        movie = (MovieTexture)r.material.mainTexture;
        // Loops the movie.
        movie.loop = true;

        skipButton = GameObject.Find("Skip").gameObject.GetComponent <Button>();
    }
    public string allReceivedUDPPackets = ""; // clean up this from time to time!


    void Awake()
    {
        ins = this;
    }
 void Start()
 {
     m_udpReceiver = new UDPReceive(portToListen);
 }
Example #31
0
 void Start()
 {
     myReceiver = GameObject.FindObjectOfType <UDPReceive>();
 }
Example #32
0
	void Start () 
    {
        GameObject contoller = GameObject.FindGameObjectWithTag("GameController");
        faceAPI = contoller.GetComponentInChildren<UDPReceive>();
	}
Example #33
0
    void Start()
    {
        GameObject contoller = GameObject.FindGameObjectWithTag("GameController");

        faceAPI = contoller.GetComponentInChildren <UDPReceive>();
    }
Example #34
0
 public Vector3 offset()
 {
     return(transform.position - UDPReceive.LatLonToVec(lat, lon));
 }
Example #35
0
 // Use this for initialization
 void Start()
 {
     script = UDPRec.GetComponent <UDPReceive>();
 }
Example #36
0
 // Use this for initialization
 void Start()
 {
     udpRec2 = GetComponent <UDPReceive>();
 }
Example #37
0
 public Worker(UDPReceive _udpReceive)
 {
     thread = new Thread (DoWork);
     thread.Start ();
 }
Example #38
0
 void Start()
 {
     currentState   = sceneState.SCENESTATE_EMPTY;
     ControllerInfo = "";
     updController  = GameObject.FindObjectOfType <UDPReceive>();
 }
Example #39
0
    private string allReceivedUDPPackets = ""; // clean up this from time to time!


    // start from shell
    private static void Main()
    {
        UDPReceive receiveObj = new UDPReceive();

        receiveObj.init();
    }
Example #40
0
 private void Start()
 {
     _udpListener = GetComponent <UDPReceive>();
 }
 void Awake()
 {
     m_udpReceiver = new UDPReceive(portToListen, m_threadPriority);
 }
Example #42
0
 void Start()
 {
     rect = new Rect(5, 5, 250, 570);
     innerRect = new Rect(5, 30, 240, 535);
     udpR = Camera.main.GetComponent<UDPReceive>();
 }