/// </inheritdoc>
        public void StartSession(object context, object arScene)
        {
            this.context    = context as Context;
            this.arFragment = arScene as ArFragment;

            if (this.spatialAnchorsSession == null)
            {
                CloudServices.Initialize(this.context);
            }

            this.spatialAnchorsSession = new CloudSpatialAnchorSession();
            this.spatialAnchorsSession.Configuration.AccountKey = Constants.SpatialAnchorsAccountKey;
            this.spatialAnchorsSession.Configuration.AccountId  = Constants.SpatialAnchorsAccountId;
            this.spatialAnchorsSession.Session                 = this.arFragment.ArSceneView.Session;
            this.spatialAnchorsSession.AnchorLocated          += this.OnAnchorLocated;
            this.spatialAnchorsSession.LocateAnchorsCompleted += this.OnLocateAnchorsCompleted;
            this.spatialAnchorsSession.SessionUpdated         += this.SessionUpdated;
            this.spatialAnchorsSession.TokenRequired          += SpatialAnchorsSession_TokenRequired;
            this.spatialAnchorsSession.Error += (sender, e) =>
            {
                SessionErrorEvent eventArgs = e?.Args;
                if (eventArgs == null)
                {
                    return;
                }
                var message = $"{eventArgs.ErrorCode}: {eventArgs.ErrorMessage}";
                ShowMessage(this, message);
            };


            this.spatialAnchorsSession.Start();
            this.Status = SpatialAnchorStatus.Iddle;
            this.arFragment.TapArPlane += OnTapArPlane;
        }
Beispiel #2
0
    public void ConsumableItemUsed(E_ItemID id)
    {
        int index = PlayerData.InventoryList.Items.FindIndex(p => p.ID == id);

        if (index < 0)
        {
            return;
        }

        PPIItemData itemData = PlayerData.InventoryList.Items[index];

        MFDebugUtils.Assert(itemData.IsValid());

        itemData.Count--;
        PlayerData.InventoryList.Items[index] = itemData;

        if (uLink.Network.isServer)
        {
            //SEND TO CLOUD !!!!
            ItemSettings settings = ItemSettingsManager.Instance.Get(id);

            CloudServices.GetInstance()
            .ModifyItem(PrimaryKey,
                        PPIManager.ProductID,
                        settings.GUID,
                        "Count",
                        itemData.Count.ToString(),
                        CloudConfiguration.DedicatedServerPasswordHash);
        }
    }
Beispiel #3
0
    void OnUserAuthenticationChanged(bool state)
    {
        if (state == true)
        {
            Settings = UserSettings.Load(CloudUser.instance.primaryKey);
            GuiOptions.Load();

            PlayerPersistantInfo ppi = PPIManager.Instance.GetLocalPPI();
            ppi.PrimaryKey     = CloudUser.instance.primaryKey;
            ppi.PrimaryKeyHash = CloudServices.CalcHash64(ppi.PrimaryKey);

            if (ppi.Experience == 0 && PlayerPrefs.HasKey("firstrun") == false)
            {
                ppi.IsFirstRun = true;
                PlayerPrefs.SetInt("firstrun", 0);
            }

            TapJoy.ConnectUser(ppi.PrimaryKey);
        }
        else
        {
            SaveSettings();
            TapJoy.DisconnectUser();
        }
    }
Beispiel #4
0
        public void Test_GetAllCloudServiceNames_Should_Return_AlistOfCloudServices()
        {
            CloudServices services = sutR.GetAllCloudServices();

            foreach (var cloudService in testData._CloudServices._CloudServices)
            {
                Should.Equals(services.Contains(cloudService.CloudServiceName), true);
            }
        }
 void Password2KeyboardClose(GUIBase_Button input, string text, bool cancelled)
 {
     if (cancelled == false)
     {
         m_Password2Hash = CloudServices.CalcPasswordHash(text);
         m_Password2Btn.SetNewText(new string('*', text.Length));
         RefreshPage();
     }
 }
Beispiel #6
0
    public void LeaderboardsUpdateScore()
    {
        List <CloudServices.S_LeaderBoardScoreInfo> scores = new List <CloudServices.S_LeaderBoardScoreInfo>();
        List <CloudServices.S_LeaderBoardScoreInfo> daily  = new List <CloudServices.S_LeaderBoardScoreInfo>();

        foreach (PlayerPersistantInfo ppi in PPIs)
        {
            if (ppi.IsValid)
            {
                scores.Add(new CloudServices.S_LeaderBoardScoreInfo(ppi.Experience, ppi.PrimaryKey));
                daily.Add(new CloudServices.S_LeaderBoardScoreInfo(ppi.Score.Score, ppi.PrimaryKey));
            }
        }

        CloudServices.GetInstance()
        .LeaderboardSetScores(PPIManager.ProductID, "Default", CloudConfiguration.DedicatedServerPasswordHash, scores.ToArray());
    }
Beispiel #7
0
    void Update()
    {
        switch (m_State)
        {
        case E_State.E_STATE_INIT:
        {
            m_LoadShopItemsAsyncOp = CloudServices.GetInstance().ProductGetParam(PPIManager.ProductID, CloudServices.PROP_ID_SHOP_ITEMS, "");

            m_State = E_State.E_STATE_LOADING_SHOP_ITEMS;
        }
        break;

        case E_State.E_STATE_LOADING_SHOP_ITEMS:
        {
            if (m_LoadShopItemsAsyncOp != null)
            {
                if (m_LoadShopItemsAsyncOp.m_Finished)
                {
                    if (m_LoadShopItemsAsyncOp.m_Res)
                    {
                        m_ShopItemsJSON = m_LoadShopItemsAsyncOp.m_ResultDesc;

                        UpdateSettingsManagers();
                        //Debug.Log("Loaded shop settings from cloud");

                        m_State = E_State.E_STATE_OK;
                    }
                    else
                    {
                        Debug.LogError("Unable to load shop settings from cloud");

                        m_State = E_State.E_STATE_FAILED;
                    }
                }
            }
            else
            {
                Debug.LogError("Unable to load shop settings from cloud");

                m_State = E_State.E_STATE_FAILED;
            }
        }
        break;
        }
    }
    IEnumerator CheckUserPasswordAndConfirm()
    {
        bool paswordsMatch = false;
        bool popupCanceled = true;

        ForgotPasswordDialog popup = (ForgotPasswordDialog)Owner.ShowPopup("ForgotPassword", null, null, null);

        popup.IsForPassword = true;
        popup.SetHandler((inPopup, inResult) =>
        {
            if (inResult == E_PopupResultCode.Ok)
            {
                popupCanceled = false;
                if (CloudServices.CalcPasswordHash(popup.TextFieldData) == CloudUser.instance.passwordHash)
                {
                    paswordsMatch = true;
                }
            }
            Owner.Back();
        });

        while (popup.IsVisible == true)
        {
            yield return(new WaitForEndOfFrame());
        }

        popup.IsForPassword = false;

        popup.ForceClose();

        if (popupCanceled)
        {
            yield break;
        }

        if (paswordsMatch)
        {
            StartCoroutine(UpdateProfile_Coroutine());
        }
        else
        {
            Owner.ShowPopup("MessageBox", TextDatabase.instance[0107000], TextDatabase.instance[0107023]);
        }
    }
        public ServicesModel QueryServices()
        {
            var serviceManager = new CloudServices(_storage.BlobStorage);
            var services       = serviceManager.GetServices();

            var inspector             = new CloudApplicationInspector(_storage.BlobStorage);
            var applicationDefinition = inspector.Inspect();

            if (!applicationDefinition.HasValue)
            {
                return(new ServicesModel
                {
                    QueueServices = new QueueServiceModel[0],
                    ScheduledServices = new CloudServiceInfo[0],
                    CloudServices = new CloudServiceInfo[0],
                    UnavailableServices = new CloudServiceInfo[0]
                });
            }

            var appDefinition = applicationDefinition.Value;

            var queueServices = services.Join(
                appDefinition.QueueServices,
                s => s.ServiceName,
                d => d.TypeName,
                (s, d) => new QueueServiceModel {
                ServiceName = s.ServiceName, IsStarted = s.IsStarted, Definition = d
            }).ToArray();

            var scheduledServices   = services.Where(s => appDefinition.ScheduledServices.Any(ads => ads.TypeName.StartsWith(s.ServiceName))).ToArray();
            var otherServices       = services.Where(s => appDefinition.CloudServices.Any(ads => ads.TypeName.StartsWith(s.ServiceName))).ToArray();
            var unavailableServices = services
                                      .Where(s => !queueServices.Any(d => d.ServiceName == s.ServiceName))
                                      .Except(scheduledServices).Except(otherServices).ToArray();

            return(new ServicesModel
            {
                QueueServices = queueServices,
                ScheduledServices = scheduledServices,
                CloudServices = otherServices,
                UnavailableServices = unavailableServices
            });
        }
        public ActionResult Status(string hostedServiceName, string id, bool isStarted)
        {
            InitializeDeploymentTenant(hostedServiceName);
            var cloudServices = new CloudServices(Storage.BlobStorage);

            if (isStarted)
            {
                cloudServices.EnableService(id);
            }
            else
            {
                cloudServices.DisableService(id);
            }

            return(Json(new
            {
                serviceName = id,
                isStarted,
            }));
        }
Beispiel #11
0
    public void SynchronizePendingPPIChanges()
    {
        MFDebugUtils.Assert(IsValid);

        if (PlayerDataChanged)
        {
            string PPIAsJSON = GetPlayerDataAsJsonStr();

            /*CloudServices.AsyncOpResult	res;
             *
             * res =*/
            CloudServices.GetInstance()
            .UserSetPerProductData(PrimaryKey,
                                   PPIManager.ProductID,
                                   CloudServices.PROP_ID_PLAYER_DATA,
                                   PPIAsJSON,
                                   CloudConfiguration.DedicatedServerPasswordHash,
                                   PPISyncToCloudFinished);

            PlayerDataChanged = false;
        }
    }
 void OnConfirmPressed(GUIBase_Widget widget)
 {
     if (CloudUser.instance.userAccountKind == E_UserAcctKind.Normal)
     {
         if (IsKeyboardControlEnabled)
         {
             StartCoroutine(CheckUserPasswordAndConfirm());
         }
         else
         {
             ShowKeyboard(widget.GetComponent <GUIBase_Button>(),
                          GuiScreen.E_KeyBoardMode.Password,
                          (input, text, cancelled) =>
             {
                 if (cancelled == false)
                 {
                     if (CloudServices.CalcPasswordHash(text) == CloudUser.instance.passwordHash)
                     {
                         // we can update profile now
                         StartCoroutine(UpdateProfile_Coroutine());
                     }
                     else
                     {
                         // inform user that he enters invalid password
                         Owner.ShowPopup("MessageBox", TextDatabase.instance[0107000], TextDatabase.instance[0107023]);
                     }
                 }
             },
                          string.Empty,
                          TextDatabase.instance[0107016]);
         }
     }
     else
     {
         // we don't ask for password if guest or facebook user logged-in
         StartCoroutine(UpdateProfile_Coroutine());
     }
 }
Beispiel #13
0
    void Delegate_OnKeyboardClose(GUIBase_Button inInput, string inKeyboardText, bool inInputCanceled)
    {
        if (inInput == m_UserNameButton)
        {
            if (m_UserName != inKeyboardText)
            {
                string tmpName = "";                 //m_LoadedUserName;
                if (string.IsNullOrEmpty(inKeyboardText) == false)
                {
                    tmpName = inKeyboardText.ToLower();
                }

                m_UserName = tmpName;
                m_UserNameButton.SetNewText(m_UserName.MFNormalize());
                UpdateLoginButton();
            }
        }
        else if (inInput == m_PasswordButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_PasswordHash   = m_LoadedPassword;
                m_PasswordLength = 0;                 //m_LoadedPasswordLength;
            }
            else
            {
                m_PasswordHash   = CloudServices.CalcPasswordHash(inKeyboardText);
                m_PasswordLength = inKeyboardText.Length;
            }

            m_PasswordButton.SetNewText(new string('*', m_PasswordLength));
            UpdateLoginButton();
        }
        else
        {
            Debug.LogError("Unknown input widget !!!");
        }
    }
        /// <summary>
        ///  Returns a list of Cloud Cervice objects for a given subscription. Each cloud service contains some metadata of the actual cloud service
        /// </summary>
        /// <returns>A list of Cloud Serviec objects</returns>
        public CloudServices GetAllCloudServices()
        {
            var subscriptionId             = Configuration.SubscriptionId();
            var certificate                = Configuration.Base64EncodedManagementCertificate();
            ComputeManagementClient client = new ComputeManagementClient(getCredentials(subscriptionId, certificate));

            try
            {
                var           cloudServiceList = client.HostedServices.List();
                CloudServices services         = new CloudServices(new List <CloudService>());
                CloudService  service          = null;
                foreach (var cloudService in cloudServiceList)
                {
                    service = new CloudService(cloudService.ServiceName, cloudService.Uri.ToString());
                    services.Add(service);
                }
                return(services);
            }
            catch (CloudException ce)
            {
                Logger.Warn(ce, String.Format("Exception during retrieval of Cloud Services Exception: {0}", ce));
            }
            return(null);
        }
Beispiel #15
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            // Add framework services.
            services.AddMvc().AddJsonOptions(options =>
                                             options.SerializerSettings.ReferenceLoopHandling =
                                                 Newtonsoft.Json.ReferenceLoopHandling.Ignore
                                             );

            services.AddCors(options => {
                options.AddPolicy("CorsPolicy",
                                  builder => builder.AllowAnyOrigin()
                                  .AllowAnyMethod()
                                  .AllowAnyHeader()
                                  .AllowCredentials());
            });

            CloudServices.Register(services, Configuration);

            SqlServerDb.Register(services, Configuration);
            MongoDb.Register(services, Configuration);

            MongoDbSets.Register(services);
            ModelRepositories.Register(services);
        }
 static AzureSpatialAnchorsManager()
 {
     CloudServices.Initialize(Android.App.Application.Context);
 }
Beispiel #17
0
 public Services()
 {
     cloudServices = new CloudServices();
 }
Beispiel #18
0
    //------------------------------------------------------------------------------------------------------------------
    void Delegate_OnKeyboardClose(GUIBase_Button inInput, string inKeyboardText, bool inInputCanceled)
    {
        if (inInput == m_UserNameButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_NickName     = string.Empty;
                m_UserName     = string.Empty;
                m_FreeUserName = null;

                m_UserNameButton.SetNewText("");

                VerifyAccountData();
                UpdateCreateAccountButton();
            }
            else
            {
                string text = GuiBaseUtils.FixNickname(inKeyboardText, m_UserName, false);
                if (string.IsNullOrEmpty(text) == false && m_UserName != text.ToLower())
                {
                    // filter out swear words
                    m_NickName = text.FilterSwearWords(true);
                    // we allow lowercase username only
                    m_UserName = text.ToLower();
                    m_UserNameButton.SetNewText(GuiBaseUtils.FixNameForGui(m_UserName));
                    m_FreeUserName = null;

                    VerifyAccountData();
                    UpdateCreateAccountButton();
                }
            }
        }
        else if (inInput == m_PasswordButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_PasswordHash   = null;
                m_PasswordLength = 0;
            }
            else
            {
                m_PasswordHash   = CloudServices.CalcPasswordHash(inKeyboardText);
                m_PasswordLength = inKeyboardText.Length;
            }

            m_PasswordButton.SetNewText(passwordGUIText);
            VerifyAccountData();
            UpdateCreateAccountButton();
        }
        else if (inInput == m_ConfirmPasswordButton)
        {
            if (string.IsNullOrEmpty(inKeyboardText) == true)
            {
                m_ConfirmPasswordHash   = null;
                m_ConfirmPasswordLength = 0;
            }
            else
            {
                m_ConfirmPasswordHash   = CloudServices.CalcPasswordHash(inKeyboardText);
                m_ConfirmPasswordLength = inKeyboardText.Length;
            }

            m_ConfirmPasswordButton.SetNewText(confirmGUIText);
            VerifyAccountData();
            UpdateCreateAccountButton();
        }
        else
        {
            Debug.LogError("Unknown input widget !!!");
        }
    }
    IEnumerator Login_Coroutine(E_UserAcctKind kind,
                                string userid,
                                string vendorID,
                                string legacyUsername,
                                string[] usernames,
                                string nickname,
                                string password,
                                string email)
    {
        if (string.IsNullOrEmpty(userid) == true && string.IsNullOrEmpty(vendorID) == true)
        {
            ShowMessage(MESSAGE_FAILED, true);
            yield break;
        }

        string pwdhash    = CloudServices.CalcPasswordHash(password);
        string username   = null;
        string primaryKey = null;

        ShowMessage(MESSAGE_WAIT, false);
        yield return(new WaitForSeconds(0.1f));

#if UNITY_IPHONE
        // fail when there is invalid guest account based on invalid MAC address generated
        if (legacyUsername == "guest6024a02ea5577bcb6442a70d0bfa791935839db3i")
        {
            Debug.LogWarning("It's not possible to deduce valid guest account. Login failed!");
            ShowMessage(MESSAGE_FAILED, true);
            yield break;
        }
#endif

        // check if username exists
        bool legacyUsernameExists = false;
        if (string.IsNullOrEmpty(legacyUsername) == false)
        {
            // NOTE: this check is obsolete but we need to do it
            //       to support legacy accounts
            UsernameAlreadyExists usernameExists = CloudUser.instance.CheckIfUserNameExist(legacyUsername);
            while (usernameExists.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (usernameExists.isFailed == true)
            {
                ShowMessage(MESSAGE_FAILED, true);
                yield break;
            }

            legacyUsernameExists = usernameExists.userExist;
        }

        if (legacyUsernameExists == true)
        {
            username = legacyUsername;

            // obtain primaryKey using legacyUsername
            UserGetPrimaryKey action = new UserGetPrimaryKey(legacyUsername);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (action.isSucceeded == true)
            {
                primaryKey = action.primaryKey;
            }
        }
        else
        {
            // obtain primaryKey using userid
            string idType = kind == E_UserAcctKind.Guest ? CloudServices.LINK_ID_TYPE_DEVICE : CloudServices.LINK_ID_TYPE_FACEBOOK;

            GetPrimaryKeyLinkedWithID action = new GetPrimaryKeyLinkedWithID(kind, userid, idType);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            if (action.isSucceeded == true && action.isPrimaryKeyForSHDZ == true)
            {
                primaryKey = action.primaryKey;
            }
        }

#if UNITY_IPHONE || TEST_IOS_VENDOR_ID
        if (kind == E_UserAcctKind.Guest && string.IsNullOrEmpty(primaryKey) == true)
        {
            // obtain username using userid
            GetPrimaryKeyLinkedWithID action = new GetPrimaryKeyLinkedWithID(kind, vendorID, CloudServices.LINK_ID_TYPE_IOSVENDOR);
            GameCloudManager.AddAction(action);

            while (action.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            //Debug.Log(">>>> action.isSucceeded="+action.isSucceeded+", action.primaryKey="+action.primaryKey);

            if (action.isSucceeded == true && action.isPrimaryKeyForSHDZ == true)
            {
                primaryKey = action.primaryKey;
            }
        }
#endif

        // create new account if needed
        if (string.IsNullOrEmpty(primaryKey) == true)
        {
            ShowMessage(MESSAGE_NEW_ACCT, false);

            // check available names
            UsernamesAlreadyExist checkAvailableNames = new UsernamesAlreadyExist(usernames);
            GameCloudManager.AddAction(checkAvailableNames);
            while (checkAvailableNames.isDone == false)
            {
                yield return(new WaitForEndOfFrame());
            }

            List <string> availableNames = new List <string>();
            foreach (var pair in checkAvailableNames.usernames)
            {
                if (pair.Exists == false)
                {
                    availableNames.Add(pair.Username);
                }
            }

            if (availableNames.Count == 0)
            {
                ShowMessage(MESSAGE_FAILED, true);
                yield break;
            }

            username = availableNames[0];
            nickname = string.IsNullOrEmpty(nickname) == true ? username : nickname.RemoveDiacritics();

            //Debug.Log(string.Join(System.Environment.NewLine, availableNames.ToArray()));
            //Debug.Log(">>>> "+kind+" :: username="******", nickname="+nickname+", email="+email+", password="******">>>> LOGIN :: primaryKey="+primaryKey+", username="******", nickname="+nickname+", email="+email+", password="******"Authentication",
                            TextDatabase.instance[02040016],
                            "",
                            (inPopup, inResult) =>
            {
                if (inResult == E_PopupResultCode.Success)
                {
                    Owner.Exit();
                }
            });
        }
    }
 public List <FileDto> GetFileList(int userId)
 {
     return(CloudServices.GetFileList(userId));
 }
Beispiel #21
0
    protected override void Init()
    {
        base.Init();

        // Not interested in non singleton instance
        if (instance != this)
        {
            return;
        }

        // Create compoennts
#if USES_ADDRESS_BOOK
        if (addressBook == null)
        {
            addressBook = AddComponentBasedOnPlatformOnlyIfRequired <AddressBook>();
        }
#endif

#if USES_BILLING
        if (billing == null)
        {
            billing = AddComponentBasedOnPlatformOnlyIfRequired <Billing>();
        }
#endif

#if USES_CLOUD_SERVICES
        if (cloudServices == null)
        {
            cloudServices = AddComponentBasedOnPlatformOnlyIfRequired <CloudServices>();
        }
#endif

#if USES_GAME_SERVICES
        if (gameServices == null)
        {
            gameServices = AddComponentBasedOnPlatformOnlyIfRequired <GameServices>();
        }
#endif

#if USES_MEDIA_LIBRARY
        if (mediaLibrary == null)
        {
            mediaLibrary = AddComponentBasedOnPlatformOnlyIfRequired <MediaLibrary>();
        }
#endif

#if USES_NETWORK_CONNECTIVITY
        if (networkConnectivity == null)
        {
            networkConnectivity = AddComponentBasedOnPlatformOnlyIfRequired <NetworkConnectivity>();
        }
#endif

#if USES_NOTIFICATION_SERVICE
        if (notificationService == null)
        {
            notificationService = CachedGameObject.AddComponentIfNotFound <NotificationService>();
        }
#endif

#if USES_SHARING
        if (sharing == null)
        {
            sharing = AddComponentBasedOnPlatformOnlyIfRequired <Sharing>();
        }
#endif

#if USES_TWITTER
        if (twitter == null)
        {
            twitter = AddComponentBasedOnPlatformOnlyIfRequired <Twitter>();
        }
#endif

        if (userInterface == null)
        {
            userInterface = AddComponentBasedOnPlatformOnlyIfRequired <UI>();
        }

        if (utility == null)
        {
            utility = CachedGameObject.AddComponentIfNotFound <Utility>();
        }

#if USES_WEBVIEW
        if (webview == null)
        {
            webview = CachedGameObject.AddComponentIfNotFound <WebViewNative>();
        }
#endif

#if USES_SOOMLA_GROW
        if (soomlaGrowService == null)
        {
            soomlaGrowService = AddComponentBasedOnPlatformOnlyIfRequired <SoomlaGrowService>();
        }
#endif
    }
Beispiel #22
0
 protected override CloudServices.AsyncOpResult GetCloudAsyncOp()
 {
     return(CloudServices.GetInstance().LeaderboardGetRanks(userID.primaryKey, userID.productID, leaderBoardName, userID.passwordHash, users));
 }
 public String GetContainerSignedSignature(int userId)
 {
     return(CloudServices.GetContainerSignedSignature(userId));
 }
 public String GetBlobSignedSignature(int userId, String fileName)
 {
     return(CloudServices.GetBlobSignedSignature(userId, fileName));
 }
 public String GetContainerUrl(int userId)
 {
     return(CloudServices.GetContainerUrl(userId));
 }