コード例 #1
0
    // Use this for initialization
    void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);

        //AWS Mobile Analytics init
        analyticsManager = MobileAnalyticsManager.GetOrCreateInstance(mobileAppId, new CognitoAWSCredentials(mobileIdentityPoolId, _Region), AnalyticsRegion);

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        // Open your datasets
        userInfo = SyncManager.OpenOrCreateDataset("UserInfo");

        userInfo.OnSyncSuccess += SyncSuccessCallback;
        userInfo.OnSyncFailure += SynFailure;

        // init user Info
        loginTime = DateTime.Now.ToString();
        float randomNum = UnityEngine.Random.Range(0f, 10.0f);

        userId = getLoginId((int)randomNum);

        userInfo.Put("userId", userId);
        userInfo.Put("loginTime", loginTime);

        Debug.Log("userId::::" + userId);
        Debug.Log("loginTime::::" + loginTime);

        userInfo.SynchronizeAsync();

        CustomEvent customEvent = new CustomEvent("SceneLoading");

        // Add attributes
        customEvent.AddAttribute("SceneName", "scene3");
        customEvent.AddAttribute("UserId", "user0000");
        customEvent.AddAttribute("Successful", "True");

        // Add metrics
        customEvent.AddMetric("Score", (int)UnityEngine.Random.Range(0f, 10000.0f));
        customEvent.AddMetric("TimeInLevel", (int)UnityEngine.Random.Range(0f, 500.0f));

        // Record the event
        analyticsManager.RecordEvent(customEvent);

        Debug.Log("SynchronizeAsync Called::::");

        Button btn = btnGoToScene4.GetComponent <Button>();

        btn.onClick.AddListener(TaskOnClick);
    }
コード例 #2
0
    void Awake()
    {
        _instance = this;

        UnityInitializer.AttachToGameObject(this.gameObject);

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        var request = new ListObjectsRequest()
        {
            BucketName = "jwassetbundles"
        };

        GetObjects();
    }
コード例 #3
0
    private void initAWS()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        var credentials = new CognitoAWSCredentials(IDENTITY_POOL_ID, RegionEndpoint.EUCentral1);
        // Initialize the Amazon Cognito credentials provider


        AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials, RegionEndpoint.EUCentral1);

        Context = new DynamoDBContext(client);

        // GetTableDetails(client);
    }
コード例 #4
0
        private string assetBundleDir; // GG added


        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);

            GetBucketListButton.onClick.AddListener(() => { GetBucketList(); });
            PostBucketButton.onClick.AddListener(() => { PostObject(); });
            GetObjectsListButton.onClick.AddListener(() => { GetObjects(); });
            DeleteObjectButton.onClick.AddListener(() => { DeleteObject(); });
            GetObjectButton.onClick.AddListener(() => { GetObject(); });

            // Fixes: "InvalidOperationException: Cannot override system-specified headers"
            AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

            assetBundleDir = Path.Combine(Application.persistentDataPath, assetBundleFolder); // GG added
        }
コード例 #5
0
ファイル: AWSManager.cs プロジェクト: Valensta/otherside
    void Awake()
    {
        //  Instance = this;
#if UNITY_EDITOR
        ENABLED = false;
#else
        ENABLED = true;
#endif

        if (!ENABLED)
        {
            return;
        }
        UnityInitializer.AttachToGameObject(this.gameObject);
    }
コード例 #6
0
    private void Start()
    {
        UnityInitializer.AttachToGameObject(gameObject);
        //Initializing Singleton from script.
        Instance = this;

        var childCount = transform.childCount;

        for (var childIndex = 0; childIndex < childCount; childIndex++)
        {
            transform.GetChild(childIndex).gameObject.SetActive(false);
        }

        LoadMenu(startingMenu);
    }
コード例 #7
0
ファイル: Login.cs プロジェクト: delustra/Instagramm-rpg
 public void LoginButton()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
     if (email.GetComponent <InputField>().text != "" &&
         password.GetComponent <InputField>().text != "")
     {
         var user = new User
         {
             Username = email.GetComponent <InputField>().text,
             Password = password.GetComponent <InputField>().text,
         };
         SentToLambda(user);
     }
 }
コード例 #8
0
    // Use this for initialization

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

        XmlDocument doc       = new XmlDocument();
        TextAsset   textAsset = (TextAsset)Resources.Load("AWS", typeof(TextAsset));

        doc.LoadXml(textAsset.text);
        XmlNode access_key = doc.GetElementsByTagName("access_key") [0];
        XmlNode secret_key = doc.GetElementsByTagName("secret_key") [0];

        SqsClient = new AmazonSQSClient(access_key.InnerText, secret_key.InnerText, RegionEndpoint.USEast1);

        StartCoroutine(listenForMessages(.1f));
    }
コード例 #9
0
        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);
            GetBucketListButton.onClick.AddListener(() => { GetBucketList(); });
            PostBucketButton.onClick.AddListener(() => { PostObject(); });
            GetObjectsListButton.onClick.AddListener(() => { GetObjects(); });
            DeleteObjectButton.onClick.AddListener(() => { DeleteObject(); });
            GetObjectButton.onClick.AddListener(() => { GetObject(); });

            AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

            AWSConfigs.LoggingConfig.LogTo        = LoggingOptions.UnityLogger;
            AWSConfigs.LoggingConfig.LogResponses = ResponseLoggingOption.Always;
            AWSConfigs.LoggingConfig.LogMetrics   = true;
            AWSConfigs.CorrectForClockSkew        = true;
        }
コード例 #10
0
    //public Text ResultText = null;

    void Start()
    {
        //scoreObject = GameObject.Find("ScoreObject").GetComponent<ScoreObject>();
        scoreText.text = ScoreManager.instance.score.ToString();

        //continuesound = GetComponent<AudioSource>();

        UnityInitializer.AttachToGameObject(this.gameObject);
        //InvokeButton.onClick.AddListener(() => { Invoke(); });

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        PopulateHighscores();
        SoundManager.instance.PlayCelebrate();
        Cursor.visible = true;
    }
コード例 #11
0
    void Start()
    {
#if !UNITY_WEBGL
        //Amazon stuff
        UnityInitializer.AttachToGameObject(this.gameObject);
        Amazon.AWSConfigs.HttpClient = Amazon.AWSConfigs.HttpClientOption.UnityWebRequest;
#endif
        if (GetBucketListButton != null)
        {
            GetBucketListButton.onClick.AddListener(() => { GetBucketList(); });
            // PostBucketButton.onClick.AddListener(() => { PostObject_Test(); });
            GetObjectsListButton.onClick.AddListener(() => { GetObjects(); });
            DeleteObjectButton.onClick.AddListener(() => { DeleteObject(); });
            //GetObjectButton.onClick.AddListener(() => { GetObject(); });
        }
    }
コード例 #12
0
ファイル: CognitoLogin.cs プロジェクト: ceseas/DBTest
    void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        _playerInfo = SyncManager.OpenOrCreateDataset("Player1");

        _playerInfo.OnSyncSuccess += OnSyncSuccess;
        _playerInfo.OnSyncFailure += OnSyncFailed;

        PlayGamesClientConfiguration config = new PlayGamesClientConfiguration();

        if (!FB.IsInitialized)
        {
            FB.Init(() => { Debug.Log("Facebook Init successfully"); });
        }
    }
コード例 #13
0
ファイル: CanvasControl.cs プロジェクト: biz2013/Learnagotchi
    // Use this for initialization
    void Start () {
        myCanvas = this.GetComponent<Canvas>();
        Transform transformObj = this.imageTopLeft.transform;
        if (null == transformObj)
        {
            Debug.Log("the imagetopleft has no transform");
        }

        this.imageBottomLeft.transform.Translate(new Vector3(-500, -250, 0));
        this.imageBottomRight.transform.Translate(new Vector3(500, -250, 0));
        this.imageTopLeft.transform.Translate(new Vector3(-500, 250, 0));
        this.imageTopRight.transform.Translate(new Vector3(500, 250, 0));

        this.msgListener = new SQSMessageListener(IdentityPoolId, QueueName, queueUrl, this);
        UnityInitializer.AttachToGameObject(this.gameObject);

        Debug.Log("The transformation is there");
    }
    void Start()
    {
        // required to initialize the AWS Mobile SDK
        UnityInitializer.AttachToGameObject(this.gameObject);

        // tells UNET we want more than the default 8 players
        maxConnections = MAX_PLAYERS;

        // detect headless server mode
        if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Null)
        {
            isHeadlessServer = true;
            SetupServerAndGamelift();
        }
        else
        {
            SetupClient();
        }
    }
コード例 #15
0
 // Start is called before the first frame update
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     // detect headless server mode
     if (SystemInfo.graphicsDeviceType == UnityEngine.Rendering.GraphicsDeviceType.Null)
     {
         Debug.Log("** SERVER MODE **");
         isHeadlessServer = true;
         SetupServerAndGamelift();
     }
     else if (PlayerPrefs.GetInt("MainClient") == 1)
     {
         mainClient = true;
         SetupMainClient();
     }
     else
     {
         SetupController();
     }
 }
コード例 #16
0
ファイル: S3Test.cs プロジェクト: exii-uw/unity-s3-upload
    void InitS3()
    {
        // Amazon examples don't include this line. Without it, this throws
        // "Exception: Main thread has not been set, is the AWSPrefab on the scene?".
        // According to the issue tracker, AWSPrefab is deprecated, and this is the recommended alternative.
        UnityInitializer.AttachToGameObject(gameObject);

        // Amazon examples don't include this line. Without it, this throws
        // "InvalidOperationException: Cannot override system-specified headers".
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        filePath = Path.GetFullPath(fileName);

        // Initialize the Amazon Cognito credentials provider
        credentials = new CognitoAWSCredentials(identityPoolID, RegionEndpoint.USEast2);

        // Amazon examples don't include second parameter. Without it, this throws
        // "AmazonClientException: No RegionEndpoint or ServiceURL configured".
        s3Client = new AmazonS3Client(credentials, region);
    }
コード例 #17
0
        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);

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

            // Fetch locally stored data from a previous run
            alias      = string.IsNullOrEmpty(playerInfo.Get("alias")) ? "Enter your alias" : playerInfo.Get("alias");
            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;
        }
コード例 #18
0
    // Use this for initialization
    void Start()
    {
        m_TableLength = 0;
        UnityInitializer.AttachToGameObject(this.gameObject);

        var credentials             = new CognitoAWSCredentials("us-east-1:4a6bd71a-2349-4b3f-9f10-e2865187b87a", RegionEndpoint.USEast1);
        AmazonDynamoDBClient client = new AmazonDynamoDBClient(credentials, RegionEndpoint.USEast1);

        Context = new DynamoDBContext(client);

        var request = new DescribeTableRequest
        {
            TableName = @"AppathonTable"
        };

        client.DescribeTableAsync(request, (result) =>
        {
            if (result.Exception != null)
            {
                Debug.Log(result.Exception);
                return;
            }
            var response = result.Response;
            TableDescription description = response.Table;
            Debug.Log("# of items: " + response.Table.ItemCount + "\n");
            m_TableLength = (int)response.Table.ItemCount;
            Debug.Log("Provision Throughput (reads/sec): " +
                      description.ProvisionedThroughput.ReadCapacityUnits + "\n");
            //StartCoroutine(CheckTableLength(Context));
        }, null);

        GetTableLength(Context); // first gets table length then calls the Acquring function, this should only need to happen once
        //StartCoroutine(CheckTableLength(Context));
        //SimpleAddObjectToDB(Context);
        //SimpleRetrieveObject(Context);
        //DeleteObjectFromDB(Context);
        StartCoroutine(GetLocationWait());
        //AddObjectToDB(Context);
    }
コード例 #19
0
        // Use this for initialization
        void Start()
        {
            UnityInitializer.AttachToGameObject(this.gameObject);

            AWSConfigs.HttpClient     = AWSConfigs.HttpClientOption.UnityWebRequest;
            AWSConfigs.RegionEndpoint = RegionEndpoint.APNortheast1;
            //AWSConfigs.HttpClient.

            _credentials = new CognitoAWSCredentials("ap-northeast-1:9ef21a6c-f1dd-4458-b771-7228a364e7ab", RegionEndpoint.APNortheast1);

            analyticsManager = MobileAnalyticsManager.GetOrCreateInstance("d1c5b82b0d93431289415c98693ab617", _credentials,
                                                                          RegionEndpoint.USEast1);

            CustomEvent customEvent = new CustomEvent("level_complete");

            customEvent.AddAttribute("LevelName", "Level1");
            customEvent.AddAttribute("CharacterClass", "Warrior");
            customEvent.AddAttribute("Successful", "True");
            customEvent.AddMetric("Score", 12345);
            customEvent.AddMetric("TimeInLevel", 64);

            analyticsManager.RecordEvent(customEvent);
        }
コード例 #20
0
    private void Awake()
    {
        _instance = this;

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

        /*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);
         * }
         * });*/
    }
コード例 #21
0
    private void Awake()
    {
        _instance = this;

        UnityInitializer.AttachToGameObject(this.gameObject);

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        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);
            }
        });
    }
コード例 #22
0
    public void RegisterButton()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
        if (password.GetComponent <InputField>().text != "" && email.GetComponent <InputField>().text != "" &&
            username.GetComponent <InputField>().text != "" && confPassword.GetComponent <InputField>().text != "")
        {
            if (password.GetComponent <InputField>().text != confPassword.GetComponent <InputField>().text)
            {
                Debug.Log("Pass not matched");
                return;
            }

            var user = new User
            {
                Username = username.GetComponent <InputField>().text,
                Email    = email.GetComponent <InputField>().text,
                Password = password.GetComponent <InputField>().text,
                NickName = username.GetComponent <InputField>().text
            };
            SentToLambda(user);
        }
    }
コード例 #23
0
    // Start is called before the first frame update
    void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);

        IsConnectedToServer = false;
        _localSimulation    = StateManager.isServerSimulated;
        if (_localSimulation)
        {
            _hopTime            = _localSimHopTime;
            IsConnectedToServer = true;
        }
        else
        {
            if (StateManager.startMode == StateManager.StartMode.LocalServer)
            {
                ConnectToLocalServer();
            }
            else
            {
                ConnectToGameLiftServer();
            }
        }
    }
コード例 #24
0
    void Awake()
    {
        if (instance == null)
        {
            Debug.Log("Single instance is null");
            instance = this;
        }
        else if (instance != this)
        {
            Debug.Log("Single instance is not Single.. Destroy gameobject!");
            Destroy(gameObject);
        }
        DontDestroyOnLoad(gameObject);                                       //Dont destroy this singleton gameobject :(

        UnityInitializer.AttachToGameObject(this.gameObject);                // Amazon Initialize
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest; //Bug fix code

        Credentials.GetIdentityIdAsync(delegate(AmazonCognitoIdentityResult <string> result) {
            if (result.Exception != null)
            {
                Debug.Log(result.Exception);//Exception!!
            }


            else
            {
                Debug.Log("GetIdentityID" + result.Response);
            }
        });

        dbClient  = new AmazonDynamoDBClient(Credentials, RegionEndpoint.APNortheast2);
        dbContext = new DynamoDBContext(dbClient);


        //credentials.ClearIdentityCache();
        //credentials.ClearCredentials();
    }
コード例 #25
0
    void Awake()
    {
        string guid = PlayerPrefs.GetString("guid");

        if (guid.Length == 0)
        {
            PlayerPrefs.SetString("guid", System.Guid.NewGuid().ToString());
            PlayerPrefs.Save();
            guid = PlayerPrefs.GetString("guid");
        }

        string IdentityPoolId = "us-east-1:4a8a0436-6cdc-4aeb-9647-5b09d557400f";

        UnityInitializer.AttachToGameObject(this.gameObject);
        try {
            CognitoAWSCredentials credentials = new CognitoAWSCredentials(IdentityPoolId, RegionEndpoint.USEast1);
            s3Client = new AmazonS3Client(credentials, RegionEndpoint.USEast1);
        } catch (Exception ex) {
            Debug.Log("Amazon died trying to connect client: " + ex.Message);
        }

        NotificationCenter.DefaultCenter().AddObserver(this, "OnSaveDialog");
//		NotificationCenter.DefaultCenter().PostNotification(this, "OnTriggerNewExperience", dialog);
    }
コード例 #26
0
    public void DoInitClient()
    {
        if (clientInit == true)
        {
            LogToMyConsoleMainThread("Client Already Initialized");
            return;
        }


        clientInit = true;
        UniqueID   = System.Guid.NewGuid().ToString();

        UnityInitializer.AttachToGameObject(gameObject);

        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;

        AmazonGameLiftConfig gameLiftConfig = new AmazonGameLiftConfig();

        if (localMode == false)
        {
            gameLiftConfig.RegionEndpoint = RegionEndpoint.USWest2;
        }
        else
        {
            gameLiftConfig.ServiceURL = "http://localhost:9080";
        }



        m_Client = new AmazonGameLiftClient(
            staticData.awsAccessKeyId,
            staticData.awsSecretAccessKey,
            gameLiftConfig);

        LogToMyConsoleMainThread("Client Initialized");
    }
コード例 #27
0
    private void Start()
    {
        UnityInitializer.AttachToGameObject(this.gameObject);                //AwsPrefab~のエラー対策
        AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest; //Cannot override~のエラー対策

        // Amazon Cognito 認証情報プロバイダーを初期化、
        //Invalid identity pool~のエラー対策のため情報多め
        credentials = new CognitoAWSCredentials(
            AWS_ACCOUNT,   //追加
            IDENTITY_POOL_ID,
            UNAUTH_ARN,    //追加
            AUTH_ARN,      //追加
            COGNITO_REGION
            );

        //ダウンロードコルーチンの実行
        StartCoroutine(GetTextFromS3Coroutine("test.txt", true, (a, b) => {
            if (a)
            {
                TekisutoHonbun.GetComponent <Text>().text = b;
                Debug.Log(b);
            }
        }));
    }
コード例 #28
0
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
     AWSConfigs.HttpClient = AWSConfigs.HttpClientOption.UnityWebRequest;
 }
コード例 #29
0
 void Start()
 {
     UnityInitializer.AttachToGameObject(this.gameObject);
 }
コード例 #30
0
 private void Awake()
 {
     UnityInitializer.AttachToGameObject(base.gameObject);
     Instance = this;
 }