public IPopupHandle Get(ApplicationLocation location) { var popupHandle = injector.binder.GetInstance <IPopupHandle> (); popupHandle.Location = location; return(popupHandle); }
private void OnShowFail(IPromise <LocationResult> promise, ApplicationLocation location, string failMessage) { var result = new LocationResult { location = location, success = false, message = failMessage, }; promise.Dispatch(result); }
static string GetConfigFilePath(string configfile) { string file = Path.Combine(ApplicationLocation.GetAppPath(), configfile); if (File.Exists(file)) { return(file); } return(UserConfigFolder.GetConfigFile(configfile)); }
public IEnumerator showInterstitial(ApplicationLocation location, Action <bool, bool> onfinished = null) { var isShown = false; var isDone = false; Action onShown = () => isShown = true; Action onDone = () => isDone = true; yield return(ShowInterstitial(location, onShown, onDone)); if (onfinished != null) { onfinished(isDone, isShown); } }
/// <summary> /// Promise to show the specified location if available immediately, otherwise reports failure /// </summary> /// <param name="location">Location.</param> public IPromise <LocationResult> Show(ApplicationLocation location) { Debug.Log("PsdkLocationManagerProvider.Show for location " + location); var locationShownPromise = new Promise <LocationResult> (); // there is exists location, terminate both of them if (locationResultPromises.ContainsKey(location)) { // terminate last var message = string.Format("PSdkLocationManagerProvider.Show : Terminate last location [{0}] that was already requested without result", location); var lastPromise = locationResultPromises [location]; locationResultPromises.Remove(location); OnShowFail(lastPromise, location, message); // also terminate this message = string.Format("PSdkLocationManagerProvider.Show : Terminate location [{0}] because last one was already requested without result", location); OnShowFail(locationShownPromise, location, message); return(locationShownPromise); } // not ready if (!IsReady(location)) { var message = string.Format("PSdkLocationManagerProvider.Show : location [{0}] not ready", location); OnShowFail(locationShownPromise, location, message); return(locationShownPromise); } // show Debug.Log("PsdkLocationManagerProvider : attempting to show " + location); psdkMgr.GetLocationManagerService().ReportLocation(location.Name); crashTools.AddBreadCrumb("PSDK.LocationManager.ShowLocation: " + location); locationResultPromises.Add(location, locationShownPromise); var showAttributes = psdkMgr.GetLocationManagerService().Show(location.Name); // PSDK will not dispatch shown failed event in case there is no source // This should be fixed in a future psdk version and then this code can be removed: if (showAttributes == LocationMgrAttributes.LOCATION_MGR_ATTR_NO_SOURCE) { Debug.Log("PsdkLocationManagerProvider - no source for location:" + location); OnShown(location.Name, false, showAttributes); } return(locationShownPromise); }
static void SetupTokenFiles( bool isCloudPlasticInstall, bool isDvcsPlasticInstall) { string unityCloudEditionTokenFile = Path.Combine( ApplicationLocation.GetAppPath(), EditionToken.CLOUD_EDITION_FILE_NAME); string unityDvcsEditionTokenFile = Path.Combine( ApplicationLocation.GetAppPath(), EditionToken.DVCS_EDITION_FILE_NAME); CreateOrDeleteTokenFile(isCloudPlasticInstall, unityCloudEditionTokenFile); CreateOrDeleteTokenFile(isDvcsPlasticInstall, unityDvcsEditionTokenFile); }
static void SetupEditionFile(string plasticInstallDir) { bool isCloudPlasticInstall = EditionToken.IsCloudEditionForPath(plasticInstallDir); bool isDvcsPlasticInstall = EditionToken.IsDvcsEditionForPath(plasticInstallDir); string unityCloudEditionTokenFile = Path.Combine( ApplicationLocation.GetAppPath(), EditionToken.CLOUD_EDITION_FILE_NAME); string unityDvcsEditionTokenFile = Path.Combine( ApplicationLocation.GetAppPath(), EditionToken.DVCS_EDITION_FILE_NAME); SetupTokenFile(isCloudPlasticInstall, unityCloudEditionTokenFile); SetupTokenFile(isDvcsPlasticInstall, unityDvcsEditionTokenFile); }
public LocationResult ParsePsdkAttributes(string location, bool success, long attributes) { var result = new LocationResult { location = ApplicationLocation.NameToEvent(location), success = success }; if ((attributes & LocationMgrAttributes.LOCATION_MGR_ATTR_NO_SOURCE) == 0) { result.sourceAssigned = false; } if ((attributes & LocationMgrAttributes.LOCATION_MGR_ATTR_SOURCE_EXIST) > 0) { result.sourceAssigned = true; } if ((attributes & LocationMgrAttributes.LOCATION_MGR_ATTR_PLAYING_MUSIC) > 0) { result.playsMusic = true; } return(result); }
public bool CanShowInterstitial(ApplicationLocation location) { // check debug settings if (CocoDebugSettingsData.Instance.IsSkipInterstitialEnabled) { return(false); } #if !InsterstitialNotNeedCheckGameDuration // check ftue and game duration if (!CocoRoot.GetInstance <CocoGlobalRecordModel> ().FirstTimeFlowOver&& CocoRoot.GetInstance <CocoGlobalRecordModel> ().GameDuration < 3) { return(false); } #endif // check no ads and location ready // if (CocoStoreControl.Instance.IsNoAds || !m_locationManager.IsReady (location)) { // return false; // } return(true); }
private void cboApplicationLocation_SelectedIndexChanged(object sender, EventArgs e) { _ApplicationLocation = (ApplicationLocation)cboApplicationLocation.SelectedItem; }
public bool IsReady(ApplicationLocation location) { // psdkMgr.GetLocationManagerService().ReportLocation(location.ToString()); return(psdkMgr.GetLocationManagerService().IsLocationReady(location.Name)); }
public bool GetInsterstitialEnable(ApplicationLocation location) { return(CanShowInterstitial(location)); }
public IEnumerator ShowInterstitial(ApplicationLocation location, Action onShown = null, Action onDone = null) { // check if can show if (!CanShowInterstitial(location)) { if (onDone != null) { onDone(); } yield break; } // use default location if null if (location == null) { location = ApplicationLocation.SceneTransitions; } // result status var isShown = false; var isDone = false; Action <LocationResult> shownAction = result => { if (result.location != location) { return; } isShown = result.success; }; Action <LocationResult> doneAction = result => { if (result.location != location) { return; } isDone = true; }; // request show InterstitialDoneSignal.AddOnce(doneAction); InterstitialShownSignal.AddOnce(shownAction); Debug.LogWarning("Test : Interstitial Start !!!"); RequestInterstitialSignal.Dispatch(location); // wait for done var wait = new WaitForEndOfFrame(); while (!isDone) { yield return(wait); if (!isShown) { continue; } if (onShown != null) { onShown(); } isShown = false; } // end done yield return(wait); if (onDone != null) { onDone(); } }