void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     PutRecordButton.onClick.AddListener(() => { PutRecord(); });
     ListStreamsButton.onClick.AddListener(() => { ListStreams(); });
     DescribeStreamButton.onClick.AddListener(() => { DescribeStream(); });
 }
Пример #2
0
 public static void AsyncExecutor(Action action, AsyncOptions options)
 {
     if (options.ExecuteCallbackOnMainThread)
     {
         if (UnityInitializer.IsMainThread())
         {
             SafeExecute(action);
         }
         else
         {
             UnityRequestQueue.Instance.ExecuteOnMainThread(action);
         }
     }
     else
     {
         if (!UnityInitializer.IsMainThread())
         {
             SafeExecute(action);
         }
         else
         {
             ThreadPool.QueueUserWorkItem((state) =>
             {
                 SafeExecute(action);
             });
         }
     }
 }
Пример #3
0
 void Start()
 {
     //AlexaPlusUnity initialization
     UnityInitializer.AttachToGameObject(gameObject);
     AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
     alexaManager          = new AmazonAlexaManager(publishKey, subscribeKey, channel, tableName, identityPoolId, AWSRegion, this.gameObject, OnAlexaMessage, null, debug); //Initialize the Alexa Manager
 }
Пример #4
0
        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);

            // Open your datasets
            playerInfo = SyncManager.OpenOrCreateDataset("PlayerInfo");

            while (!string.IsNullOrEmpty(playerInfo.Get("alias" + index)))
            {
                print(playerInfo.Get("alias" + index));
                index++;
            }

            // Fetch locally stored data from a previous run
            alias      = string.IsNullOrEmpty(playerInfo.Get("alias1")) ? "Enter your alias" : playerInfo.Get("alias1");
            playerName = string.IsNullOrEmpty(playerInfo.Get("playerName")) ? "Enter your full name" : playerInfo.Get("playerName");

            // Define Synchronize callbacks
            // when ds.SynchronizeAsync() is called the localDataset is merged with the remoteDataset
            // OnDatasetDeleted, OnDatasetMerged, OnDatasetSuccess,  the corresponding callback is fired.
            // The developer has the freedom of handling these events needed for the Dataset
            playerInfo.OnSyncSuccess   += this.HandleSyncSuccess; // OnSyncSucess uses events/delegates pattern
            playerInfo.OnSyncFailure   += this.HandleSyncFailure; // OnSyncFailure uses events/delegates pattern
            playerInfo.OnSyncConflict   = this.HandleSyncConflict;
            playerInfo.OnDatasetMerged  = this.HandleDatasetMerged;
            playerInfo.OnDatasetDeleted = this.HandleDatasetDeleted;
        }
Пример #5
0
    private void Awake()
    {
        _instance = this;

        UnityInitializer.AttachToGameObject(this.gameObject);

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        //CognitoAWSCredentials credentials = new CognitoAWSCredentials(
        //                                    "ap-south-1:f1b44440-6440-4aa1-8db8-e93522a00cd2", // Identity Pool ID
        //                                    _S3Region // Region
        //                                    );

        //_s3Client = new AmazonS3Client(credentials, _S3Region);

        //S3Client.ListBucketsAsync(new ListBucketsRequest(), (responseObject) =>
        //{
        //    if (responseObject.Exception == null)
        //    {
        //        responseObject.Response.Buckets.ForEach((s3b) =>
        //        {
        //            Debug.Log("Bucket Name: " + s3b.BucketName);
        //        });
        //    }
        //    else
        //    {
        //        Debug.Log("Got AWS Exception: " + responseObject.Exception);
        //    }
        //});
    }
Пример #6
0
        public void Init()
        {
            IdentityPoolId = "us-east-1:1d281ad5-139a-45ae-915d-bcd555a2e228";

            UnityInitializer.AttachToGameObject(gameObject);
            AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
        }
Пример #7
0
    void Start()
    {
        // Hacky, but we need to see if this was created ONCE
        if (current_id == null)
        {
            DontDestroyOnLoad(gameObject);

            UnityInitializer.AttachToGameObject(this.gameObject);
            Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;

            string id_path = "./.IcarusCache/id.blob";
            if (!Directory.Exists(".IcarusCache"))
            {
                Directory.CreateDirectory(".IcarusCache");
                StreamWriter  cache = new StreamWriter(id_path);
                System.Random rand  = new System.Random();
                cache.Write(Encrypt.EncryptString(rand.Next(1000000000).ToString("D10"), "LazyUnlock1"));

                cache.Close();
            }
            StreamReader reader = new StreamReader(id_path);
            current_id = Encrypt.DecryptString(reader.ReadToEnd(), "LazyUnlock1");

            string name_path = "./.IcarusCache/name.blob";
            if (File.Exists(name_path))
            {
                reader       = new StreamReader(name_path);
                current_name = reader.ReadToEnd();
            }

            _client = Client;
        }
    }
Пример #8
0
        /*
         * Initialization.
         */

        public static void Initialize(string poolId)
        {
            if (Initializing)
            {
                _log.Error("Already initializing");
                return;
            }

            if (Initialized)
            {
                _log.Error("Already initialized");
                return;
            }

            _log.Debug("Initializing");

            Initializing = true;

            _poolId   = poolId;
            _instance = new GameObject("BitszerAuctionHouse").AddComponent <AuctionHouse>();

            UnityInitializer.AttachToGameObject(_instance.gameObject);

            AWSConfigs.HttpClient          = AWSConfigs.HttpClientOption.UnityWebRequest;
            AWSConfigs.LoggingConfig.LogTo = LoggingOptions.None;

            _credentials = new CognitoAWSCredentials(_poolId, RegionEndpoint);
            _credentials.GetIdentityIdAsync(OnIdentityReceived);

            _syncManager = new CognitoSyncManager(_credentials, RegionEndpoint);
        }
Пример #9
0
    void OnEnable()
    {
        //attach amazon details
        UnityInitializer.AttachToGameObject(this.gameObject);

        ConfigureScanner();
    }
Пример #10
0
        public void Awake()
        {
            //Check if instance already exists
            if (instance == null)
            {
                //if not, set instance to this
                instance = this;
            }

            //If instance already exists and it's not this:
            else if (instance != this)
            {
                //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
                Destroy(gameObject);
            }

            //Sets this to not be destroyed when reloading scene
            DontDestroyOnLoad(gameObject);

            UnityInitializer.AttachToGameObject(this.gameObject);

            AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

            CreateContext();
        }
Пример #11
0
        void Start()
        {
            UnityInitializer.AttachToGameObject(transform.root.gameObject);
            AWSConfigsS3.UseSignatureVersion4 = true;
            AWSConfigs.HttpClient             = AWSConfigs.HttpClientOption.UnityWebRequest;
            if (logLevel >= LogLevel.Debugging)
            {
                AWSConfigs.LoggingConfig.LogTo        = LoggingOptions.UnityLogger;
                AWSConfigs.LoggingConfig.LogResponses = ResponseLoggingOption.OnError;
                AWSConfigs.LoggingConfig.LogMetrics   = true;
            }
            AWSConfigs.CorrectForClockSkew = true;

            awsCredentials = new CognitoAWSCredentials(
                s3Credentials.identityPoolID,
                RegionEndpoint.GetBySystemName(s3Credentials.cognitoIdentityRegion)
                );

            s3Client = new AmazonS3Client(
                awsCredentials,
                RegionEndpoint.GetBySystemName(s3Credentials.s3Region)
                );

            isReady = true;

            s3Client.ExceptionEvent += HandleException;
        }
Пример #12
0
    private void Awake()
    {
        _instance = this;
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
        // For obtain credentials
        // https://docs.aws.amazon.com/mobile/sdkforunity/developerguide/setup-unity.html
        // To obtain my identify Pool ID
        // https://us-east-2.console.aws.amazon.com/cognito/pool/edit/?region=us-east-2&id=us-east-2:d2f8c75d-d231-496d-a4ec-1a50920351fd

        //CognitoAWSCredentials credentials =


        // AmazonS3Client S3Client = new AmazonS3Client(credentials, _S3Region);

        // ResultText is a label used for displaying status information

        /*
         * S3Client.ListBucketsAsync(new ListBucketsRequest(), (responseObject) =>
         * {
         *
         *  if (responseObject.Exception == null)
         *  {
         *      responseObject.Response.Buckets.ForEach((s3b) =>
         *      {
         *          Debug.Log("Bucket Name : " + s3b.BucketName);
         *      });
         *  }
         *  else
         *  {
         *      Debug.Log("AWS ERROR : " + responseObject.Exception);
         *  }
         * });
         */
    }
 private void Awake()
 {
     UnityInitializer.AttachToGameObject(gameObject);
     credentials = new CognitoAWSCredentials("ap-northeast-2:48d7b34a-8723-41ff-a872-da35c8eaa049", RegionEndpoint.APNortheast2);
     DBClient    = new AmazonDynamoDBClient(credentials, RegionEndpoint.APNortheast2);
     context     = new DynamoDBContext(DBClient);
 }
Пример #14
0
    void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);

        // create an Identify object and Start Syncronizing Databases
        Identity.StartSync();
    }
Пример #15
0
    private void Awake()
    {
        _instance = this;

        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        // CognitoAWSCredentials credentials = new CognitoAWSCredentials(
        //"eu-central-1:41fdc6a2-cac8-4e0f-8ff1-3d745a81ccf5", // Identity Pool ID
        //        RegionEndpoint.EUCentral1// Region
        //        );
        //AmazonS3Client S3Client = new AmazonS3Client(credentials, _S3Region);

        /*S3Client.ListBucketsAsync(new ListBucketsRequest(), (responseObject) =>
         * {
         *  if (responseObject.Exception == null)
         *  {
         *
         *      responseObject.Response.Buckets.ForEach((s3b) =>
         *      {
         *          Debug.Log("Bucket name:" + s3b.BucketName);
         *      });
         *  }
         *  else
         *  {
         *      Debug.Log("AWS ERROR :" + responseObject.Exception);
         *  }
         * });*/
    }
Пример #16
0
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
     //CreateGameSession();
     //FindGameSession();
 }
    private void SetupAWS()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        gameObject.AddComponent <AWSPlayerClient>();
    }
Пример #18
0
    // Called by Unity when the Gameobject is created
    void Start()
    {
        FindObjectOfType <UIManager>().SetTextBox("Setting up Client..");

        // Set up Mobile SDK
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.AWSRegion  = MatchmakingClient.regionString;
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        // Get Cognito Identity and start Connecting to server once we have the identity
        CognitoAWSCredentials credentials = new CognitoAWSCredentials(
            MatchmakingClient.identityPoolID,
            MatchmakingClient.region
            );

        credentials.GetCredentialsAsync(
            (response) => {
            Debug.Log("Received CognitoCredentials: " + response.Response);
            cognitoCredentials = response.Response;

            // Start a coroutine for the connection process to keep UI updated while it's happening
            StartCoroutine(ConnectToServer());
        }
            );
    }
Пример #19
0
        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);
            Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;
            InvokeButton.onClick.AddListener(() => { Invoke(); });
//          ListFunctionsButton.onClick.AddListener(() => { ListFunctions(); });
        }
Пример #20
0
    void Awake()
    {
        loading          = true;
        sync             = false;
        loginPage        = true;
        fbandcsInitiated = 0;
        UnityInitializer.AttachToGameObject(this.gameObject);
        DontDestroyOnLoad(this.gameObject);

        if (loginClientInstance == null)
        {
            loginClientInstance = this;
        }
        else
        {
            Destroy(gameObject);
        }

        if (!FB.IsInitialized)
        {
            FB.Init(FbInitCallBack);
        }
        else
        {
            fbandcsInitiated = fbandcsInitiated + 1;
        }
    }
Пример #21
0
    void Awake()
    {
        UnityInitializer.AttachToGameObject(gameObject);

        credentials = new CognitoAWSCredentials("eu-west-2:793871cb-c8a9-45bf-b20d-97df75ddbce7", RegionEndpoint.EUWest2);
        lambda      = new AmazonLambdaClient(credentials, RegionEndpoint.EUWest2);
    }
        /// <summary>
        /// Returns the HTTP response.
        /// </summary>
        /// <returns>The HTTP response.</returns>
        public IWebResponseData GetResponse()
        {
            if (UnityInitializer.IsMainThread())
            {
                throw new Exception("Cannot execute synchronous calls on game thread");
            }

            this.IsSync     = true;
            this.WaitHandle = new ManualResetEvent(false);
            try
            {
                UnityRequestQueue.Instance.EnqueueRequest(this);
                this.WaitHandle.WaitOne();

                if (this.Exception != null)
                {
                    throw this.Exception;
                }

                //timeout scenario
                if (this.Exception == null && this.Response == null)
                {
                    throw new WebException("Request timed out", WebExceptionStatus.Timeout);
                }

                return(this.Response);
            }
            finally
            {
                this.WaitHandle.Close();
            }
        }
Пример #23
0
        public void Configuration(IAppBuilder app)
        {
            var config = new HttpConfiguration();

            //  Enable attribute based routing
            config.MapHttpAttributeRoutes();

            // Default route
            config.Routes.MapHttpRoute(
                name: "DefaultApi",
                routeTemplate: "api/v1/{controller}/{id}",
                defaults: new { id = RouteParameter.Optional }
                );

            ConfigureWebApi(config);

            // Package: Unity.Container
            // Unity DI
            UnityInitializer.Initialize(config);

            app.UseWebApi(config);

            // Create the database for test (REMOVE when publish to PROD)
            InitializeDatabaseAsync(config).GetAwaiter().GetResult();
        }
Пример #24
0
 // Use this for initialization
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     lowLevelButton.onClick.AddListener(LowLevelListener);
     midLevelScanButton.onClick.AddListener(MidLevelScanListener);
     highLevelobjectMapperButton.onClick.AddListener(HighLevelListener);
 }
Пример #25
0
        /// <summary>
        /// Returns the HTTP response.
        /// </summary>
        /// <returns>The HTTP response.</returns>
        public IWebResponseData GetResponse()
        {
            if (UnityInitializer.IsMainThread())
            {
                throw new Exception("Network on game thread");
            }

            this.IsSync     = true;
            this.WaitHandle = new ManualResetEvent(false);
            try
            {
                UnityRequestQueue.Instance.EnqueueRequest(this);
                this.WaitHandle.WaitOne();

                if (this.Exception != null)
                {
                    throw this.Exception;
                }

                return(this.Response);
            }
            finally
            {
                this.WaitHandle.Close();
            }
        }
Пример #26
0
 void Start()
 {
     cams = Camera.allCameras;
     UnityInitializer.AttachToGameObject(this.gameObject);
     Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;
     StartCoroutine(RepeatRetrieveMessage(0.1F));
     activateCam(2);         // set
 }
Пример #27
0
    void Start()
    {
        // this is an AWS thing
        UnityInitializer.AttachToGameObject(this.gameObject);

        // seems like this is necessary for Unity 2017: https://github.com/aws/aws-sdk-net/issues/643
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
    }
Пример #28
0
 private void InitializeDriver()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     failedWWWTests = new HashSet <string>();
     failedUWRTests = new HashSet <string>();
     //set sleep timeout to infinity
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
 }
Пример #29
0
 // Use this for initialization
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     CreateQueue.onClick.AddListener(CreateQueueListener);
     SendMessage.onClick.AddListener(SendMessageListener);
     RetrieveMessage.onClick.AddListener(RetrieveMessageListener);
     DeleteQueue.onClick.AddListener(DeleteQueueListener);
 }
Пример #30
0
 private void InitializeDriver()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     finalFailedWWWTests = null;
     finalFailedUWRTests = null;
     //set sleep timeout to infinity
     Screen.sleepTimeout = SleepTimeout.NeverSleep;
 }