Exemple #1
0
 // Use this for initialization
 void Start()
 {
     videopanel   = GameObject.Find("Canvas/PanelVideo");
     videoManager = videopanel.GetComponent <VideoPanelManager3>();
     mycamera     = GameObject.Find("HoloLensCamera");
     text         = GameObject.Find("CameraInfo/rotation/rotationtext").gameObject.GetComponent <Text>();
     socket       = GameObject.Find("Directional light").GetComponent <DemoSocket>();
 }
    async void Start()
    {
        gps = GameObject.Find("Canvas/PanelMap/PositionText").GetComponent <Text>();
        Debug.Log("Local Ip At Start " + local);
        local = externalIP;

        controllerInput = new ControllerInput(0, 0.19f);

        Debug.Log("Waiting for a connection...");

        infos = GameObject.FindGameObjectsWithTag("label");

        parents         = GameObject.FindGameObjectsWithTag("parent");
        map             = MapController.GetMapController();
        videoManager    = GameObject.Find("Canvas/PanelVideo").GetComponent <VideoPanelManager3>();
        texts           = new Text[infos.Length];
        originalTexts   = new string[infos.Length];
        anchor          = GameObject.Find("Canvas/PanelVideo/anchor");
        anchorTransform = anchor.transform;
        for (int i = 0; infos != null && i < infos.Length; i++)
        {
            texts[i] = infos[i].GetComponent <Text>();
            if (texts[i] != null)
            {
                originalTexts[i] = texts[i].text;
            }
        }
        //Modify 4/13/2017
        socket = new DatagramSocket();
        socket.MessageReceived += Socket_MessageReceived;

        HostName IP = null;

        try
        {
            var icp = NetworkInformation.GetInternetConnectionProfile();
            IP = Windows.Networking.Connectivity.NetworkInformation.GetHostNames()
                 .SingleOrDefault(
                hn =>
                hn.IPInformation?.NetworkAdapter != null && hn.IPInformation.NetworkAdapter.NetworkAdapterId
                == icp.NetworkAdapter.NetworkAdapterId);

            await socket.BindEndpointAsync(IP, port);
        }
        catch (Exception e)
        {
            Debug.Log(e.ToString());
            Debug.Log(SocketError.GetStatus(e.HResult).ToString());
            return;
        }

        var message = "hello from " + IP;

        await SendMessage(message);
        await SendMessage("hello");

        Debug.Log("exit start");
    }
 // Use this for initialization
 void Start()
 {
     manager = GameObject.Find("Canvas/PanelVideo").GetComponent <VideoPanelManager3>();
 }