Exemple #1
0
    private IEnumerator InitializeEvent()
    {
        yield return(new WaitUntil(() => _locationStatus.GetLocationLat() != "0" && _locationStatus.GetLocationLon() != "0"));

        GameNetworkEvent _event = new GameNetworkEvent(_localUser.userID, _locationStatus.GetLocationLat(), _locationStatus.GetLocationLon());

        StartCoroutine(_gameNetwork.GetEvent("https://harryspotter.eu.ngrok.io/getEvents", _event.Serialize().ToString(), GetEventResults));
        _originalEventSpawnPoseLat = _locationStatus.GetLocationLat();
        _originalEventSpawnPoseLon = _locationStatus.GetLocationLon();
    }
Exemple #2
0
    private void TakePicture(int maxSize)
    {
        NativeCamera.Permission permission = NativeCamera.TakePicture((path) =>
        {
            Debug.Log("Image path: " + path);
            if (path != null)
            {
                texture = NativeCamera.LoadImageAtPath(path, maxSize);
                if (texture == null)
                {
                    Debug.Log("Couldn't load texture from " + path);
                    return;
                }

                if (_PcdebugMode == false)
                {
                    photoTaken.gameObject.SetActive(true);
                    photoTaken.texture = texture;
                    //Sending the image which user has taken in 64bit format to the backend
                    byte[] currenBytes = DeCompress(texture).EncodeToJPG();
                    //bytes = _testTexture.EncodeToPNG();
                    string currentImage64     = "data:image/jpeg;base64," + Convert.ToBase64String(currenBytes);
                    GameNetworkImage captured = new GameNetworkImage(_localUser.userID, currentImage64, _locationStatus.GetLocationLat(), _locationStatus.GetLocationLon());
                    StartCoroutine(_gameNetwork.PostAddObject("https://harryspotter.eu.ngrok.io/addObject", captured.Serialize().ToString(), GetObjectIds));
                }

                /*
                 *              // Assign texture to a temporary quad and destroy it after 5 seconds
                 *              GameObject quad = GameObject.CreatePrimitive(PrimitiveType.Quad);
                 *              quad.transform.position = Camera.main.transform.position + Camera.main.transform.forward * 2.5f;
                 *              quad.transform.forward = Camera.main.transform.forward;
                 *              quad.transform.localScale = new Vector3(1f, texture.height / (float)texture.width, 1f);
                 *
                 *              Material material = quad.GetComponent<Renderer>().material;
                 *              if (!material.shader.isSupported) // happens when Standard shader is not included in the build
                 *                      material.shader = Shader.Find("Legacy Shaders/Diffuse");
                 *
                 *              material.mainTexture = texture;
                 *
                 *              Destroy(quad, 5f);
                 *
                 *              // If a procedural texture is not destroyed manually,
                 *              // it will only be freed after a scene change
                 *              Destroy(texture, 5f);
                 */
            }
            else
            {
                _uIManagerMap.DisplayMapPanel();
            }
        }, maxSize);
        Debug.Log("Permission result: " + permission);
    }