public void Init() { if (BuildConfig.HIDE_ADS || this.adsDisabled) { return; } this.GetServerConfig(); this.ads = this.CreateAdsNetwork(); this.bannerDisabled = !this.config.BannerIsOn(); this.fsDisabled = !this.config.FsIsOn(); string b = this.bannerDisabled ? null : this.config.bannerAdUnit; string fs = this.fsDisabled ? null : this.config.fsAdUnit; string rewardAdUnit = this.config.rewardAdUnit; FMLogger.vAds(string.Concat(new object[] { "init. b: ", !this.bannerDisabled, " fs: ", !this.fsDisabled })); this.ads.Configure(this.config.adsTest, this.config.bannerShowTime, this.config.bannerLoadDelay, this.config.fsInternalOnReward); this.ads.Initialize(b, this.config.bannerPos, fs, rewardAdUnit); this.ads.RewardedComplete += delegate(object sender, EventArgs e) { if (this.RewardedVideoComplete != null) { this.RewardedVideoComplete(); } }; }
private IEnumerator LazyInit() { yield return(0); yield return(0); yield return(0); this.LoadResources(this.picItem.PictureData); this.lineImg.texture = this.line; this.colors = new List <Color>(); for (int i = 0; i < this.palleteData.entities.Length; i++) { this.palleteData.entities[i].color.a = byte.MaxValue; this.colors.Add(this.palleteData.entities[i].color); } yield return(0); this.chopFill = new ChopFill(); this.chopFill.Create(this.line, this.palleteData, true); this.drawImg.texture = this.chopFill.DrawTex; yield return(this.CrossFade(0.7f)); this.coloringAnimation.InitAsPreview(this.chopFill.DrawTex, this.chopFill.Pixels, this.picItem.SaveData.steps, this.chopFill, new Func <int, Color>(this.IdToColor)); this.coloringAnimation.StartAnimation(0.5f, 0f); this.animInit = null; this.Inited = true; FMLogger.vCore("preview inited"); yield break; }
private AdConfig LoadDefaultConfig() { AdConfig adConfig = null; string @string = PlayerPrefs.GetString("adsconfig", string.Empty); if (!string.IsNullOrEmpty(@string)) { adConfig = JsonUtility.FromJson <AdConfig>(@string); } FMLogger.vCore("cfg str: " + @string); if (adConfig == null) { adConfig = ((!this.isTablet) ? AdConfig.DefaultPhone() : AdConfig.DefaultTablet()); } if (string.IsNullOrEmpty(adConfig.bannerAdUnit)) { adConfig.bannerAdUnit = ((!this.isTablet) ? "f22e60410d82403aa5e0fb791ef9c153" : "1253b5589a4d45869288611de14229d6"); FMLogger.vAds("cfg fix banner unit"); } if (string.IsNullOrEmpty(adConfig.fsAdUnit)) { adConfig.fsAdUnit = ((!this.isTablet) ? "72bb0678c400487b8d1a941944fa6888" : "8cae328870984a9987623f9c6e52b25d"); FMLogger.vAds("cfg fix fs unit"); } if (string.IsNullOrEmpty(adConfig.rewardAdUnit)) { adConfig.rewardAdUnit = ((!this.isTablet) ? "6bc3898062484e71a114d0ab59cb1c78" : "0543e571406140dd96252ac1351b99f5"); FMLogger.vAds("cfg fix reward unit"); } this.SaveConfig(adConfig); FMLogger.vAds("loaded saved cfg: " + adConfig); return(adConfig); }
public static bool IsServerContentExpired() { double totalMinutes = (DateTime.Now - AppState.ContentReqTime).TotalMinutes; FMLogger.Log("check exp time. t:" + totalMinutes); return(totalMinutes > 240.0); }
private void CheckPrecacheResources() { PictureData pictureData = this.task.PictureData; if (FileHelper.FileExist(this.directory, this.iconPath)) { this.iconState = PictureDataDownloader.DownloadState.Cached; FMLogger.Log("skip dl icon, already stored"); } if (FileHelper.FileExist(this.directory, this.linePath)) { this.lineState = PictureDataDownloader.DownloadState.Cached; FMLogger.Log("skip dl line, already stored"); } if (pictureData.FillType == FillAlgorithm.Flood) { if (FileHelper.FileExist(this.directory, this.coloredPath)) { this.colorState = PictureDataDownloader.DownloadState.Cached; FMLogger.Log("skip dl colormap, already stored"); } } else { this.colorState = PictureDataDownloader.DownloadState.Cached; FMLogger.Log("skip dl colormap, not needed anymore"); } if (FileHelper.FileExist(this.directory, this.jsonPath)) { this.jsonState = PictureDataDownloader.DownloadState.Cached; FMLogger.Log("skip dl json, already stored"); } }
private IEnumerator Checker() { FMLogger.vAds("hint btn start checker. rs:" + this.hasRewarded); while (this.shouldCheckRewarded) { while (!this.hasRewarded) { this.hasRewarded = AdsManager.Instance.HasRewardedVideo(); if (this.hasRewarded) { this.label.text = this.AD_STR; FMLogger.vAds("hint checker upd. AD"); } yield return(new WaitForSeconds(1f)); } while (this.hasRewarded) { this.hasRewarded = AdsManager.Instance.HasRewardedVideo(); if (!this.hasRewarded) { this.label.text = GeneralSettings.HintsCount.ToString(); FMLogger.vAds("hint checker upd. Rewarded GONE"); } yield return(new WaitForSeconds(3f)); } yield return(0); } yield break; }
public void GetDailyPage(Action <DailyPageResponse> callback) { if (this.dailyPageTask != null && this.dailyPageTask.Completed && this.dailyPageTask.Success && this.dailyResponce != null) { callback(this.dailyResponce); } else if (this.dailyPageTask != null && this.dailyPageTask.IsRunning) { this.dailyPageCallback = callback; } else { if (this.dailyPageTask != null) { this.dailyPageTask.Cancel(); } string text = (!BuildConfig.TGF_DEBUG_URL) ? "https://coloring-gp.x-flow.app/api/v_2/content_daily.php" : "https://coloring-gp-dev.x-flow.app/content_daily.php"; WWWForm wwwform = this.ContentRequestData(); wwwform.AddField("page", 1); this.dailyPageCallback = callback; this.dailyPageTask = new WebPostTask(new string[] { text, text }, wwwform, new Action <bool, string>(this.OnDailyPageLoaded)); FMLogger.vCore("daily page req: "); WebLoader.Instance.LoadText(this.dailyPageTask); } }
private void OnDailyPageLoaded(bool success, string text) { DailyPageResponse dailyPageResponse = null; if (success && !string.IsNullOrEmpty(text)) { try { dailyPageResponse = JsonUtility.FromJson <DailyPageResponse>(text); FMLogger.vCore("daily resp: " + text); } catch (Exception ex) { UnityEngine.Debug.LogError("daily ex: " + ex.Message); UnityEngine.Debug.LogError("daily failed to parse page responce"); UnityEngine.Debug.LogError(text); dailyPageResponse = null; } if (dailyPageResponse == null || !dailyPageResponse.IsValid()) { UnityEngine.Debug.LogError("daily resp not valid: " + text); dailyPageResponse = null; } } else { FMLogger.vCore("daily req fail. 404 or resp empty"); } this.dailyResponce = dailyPageResponse; if (this.dailyPageCallback != null) { this.dailyPageCallback(this.dailyResponce); } this.dailyPageCallback = null; }
private void OnMainPageLoaded(bool success, string text) { LibraryPageResponce libraryPageResponce = null; if (success && !string.IsNullOrEmpty(text)) { try { libraryPageResponce = JsonUtility.FromJson <LibraryPageResponce>(text); FMLogger.vCore("resp: " + text); } catch (Exception ex) { UnityEngine.Debug.LogError("ex: " + ex.Message); UnityEngine.Debug.LogError("failed to parse page responce"); UnityEngine.Debug.LogError(text); libraryPageResponce = null; } if (libraryPageResponce == null || !libraryPageResponce.IsValid()) { libraryPageResponce = null; FMLogger.vCore("resp not valid: " + text); } } else { FMLogger.vCore("lib req fail. 404 or resp empty"); } this.libResponce = libraryPageResponce; if (this.mainPageCallback != null) { this.mainPageCallback(this.libResponce); } this.mainPageCallback = null; }
public void OnFeaturedItemClick(FeaturedItem featuredItem) { FeaturedItem.ItemType type = featuredItem.Type; if (type != FeaturedItem.ItemType.Daily) { if (type != FeaturedItem.ItemType.PromoPic) { if (type == FeaturedItem.ItemType.ExternalLink) { ExternalLinkItem externalLinkItem = (ExternalLinkItem)featuredItem; AnalyticsManager.FeaturedExternalLink(externalLinkItem.Id); SystemUtils.OpenUrl(externalLinkItem.TargetScheme, externalLinkItem.TargetUrl); FMLogger.vCore("External link click. " + externalLinkItem.TargetScheme + " url:" + externalLinkItem.TargetUrl); } } else { MenuScreen.PaintStartSource = PaintStartSource.LibFeaturedPromoPic; PromoPicItem promoPicItem = (PromoPicItem)featuredItem; PicItem picItem = promoPicItem.PicItem; AnalyticsManager.FeaturePromoPicClick(picItem.Id, promoPicItem.Order); this.ProcessPicItem(picItem); } } else { MenuScreen.PaintStartSource = PaintStartSource.LibFeaturedDailyPic; DailyPicItem dailyPicItem = (DailyPicItem)featuredItem; PicItem picItem = dailyPicItem.PicItem; AnalyticsManager.FeaturedDailyClick(picItem.Id, dailyPicItem.Order); this.ProcessPicItem(picItem); } }
private IEnumerator POSTInstall(string host, WWWForm data) { UnityWebRequest www = UnityWebRequest.Post(host, data); yield return(www.Send()); if (!www.isNetworkError && www.responseCode == 200L) { string text = www.downloadHandler.text; AppInstallReportService.InstallRespone installRespone = JsonUtility.FromJson <AppInstallReportService.InstallRespone>(text); if (installRespone != null && installRespone.success == 1) { AppInstallReportService.InstallGUIDSent = true; if (AppInstallReportService.GDPRStatusReceived != null) { AppInstallReportService.GDPRStatusReceived(installRespone.gdpr == 1); } FMLogger.vCore("app install sent. status: " + (installRespone.gdpr == 1)); } } if (!AppInstallReportService.InstallGUIDSent) { this.RescheduleInstallReport(); } yield break; }
private void Update() { if (!this.consentHandled && this.mopubResultReceived && this.tgfResultReceived) { this.consentHandled = true; int num = (int)(DateTime.UtcNow - this.initTime).TotalMilliseconds; AppInstallReportService.Time = num; FMLogger.vCore(string.Concat(new object[] { "consent handle t: ", num, " s:", this.tgfRequireConsent, " m:", this.mopubRequireConsent })); this.HandleConsent(); } if (!this.isLongLoad) { this.loadTime += Time.deltaTime; if (this.loadTime > 20f) { this.isLongLoad = true; if (!this.mopubResultReceived || !this.tgfResultReceived) { SplashCanvas.Instance.ShowError(); } } } }
public void OnFill(int row, OrderedItemInfo itemInfo, bool lazyLoad) { base.Row = row; if (itemInfo == null) { this.Clean(); return; } OrderedItemType itemType = itemInfo.itemType; if (itemType != OrderedItemType.PromoPic) { if (itemType != OrderedItemType.ExternalLink) { FMLogger.vCore("news item " + row + " is empty"); } else { ExternalLinkInfo externalLinkInfo = (ExternalLinkInfo)itemInfo; this.AddExternalLinkItem(externalLinkInfo, lazyLoad); } } else { PromoPicInfo promoPicInfo = (PromoPicInfo)itemInfo; this.AddEditorItem(promoPicInfo, lazyLoad); } }
public void InitializeBanner(string bAdUnit, BannerPosition bannerPos) { if (this.bannerEnabled) { return; } if (!string.IsNullOrEmpty(bAdUnit)) { try { this.bannerAdUnit = bAdUnit; this.bannerEnabled = true; this.bannerPosition = ((bannerPos != BannerPosition.Bottom) ? MoPubBase.AdPosition.TopCenter : MoPubBase.AdPosition.BottomCenter); this.InternalInit(this.bannerAdUnit); MoPubAndroid.LoadBannerPluginsForAdUnits(new string[] { this.bannerAdUnit }); } catch (Exception ex) { this.bannerEnabled = false; FMLogger.vAds("failed to init mopab banner. error: " + ex.Message); } this.RequestBanner(); } }
public override IEnumerator Run() { Texture2D tex = null; try { tex = FileHelper.LoadTextureFromFile(this.path); tex.wrapMode = TextureWrapMode.Clamp; } catch (Exception) { FMLogger.LogError("tex not found: " + this.path); } try { if (this.callback != null) { this.callback(tex); } } catch (Exception) { FMLogger.LogError("never should happen"); } yield return(0); yield break; }
public static void v(string msg, int layer = 0) { if (FMLogger.disabled) { return; } if (layer == 0) { FMLogger.DeubLog(msg); } else { if ((layer & FMLogger.showLayer) == FMLogger.gbLayer) { FMLogger.DeubLog(msg); } if ((layer & FMLogger.showLayer) == FMLogger.analiticsLayer) { FMLogger.DeubLog(msg); } if ((layer & FMLogger.showLayer) == FMLogger.adsLayer) { FMLogger.DeubLog(msg); } if ((layer & FMLogger.showLayer) == FMLogger.coreLayer) { FMLogger.DeubLog(msg); } } }
private void OnGDPRStatusReceived(bool gdprApplied) { int num = (int)(DateTime.UtcNow - this.time).TotalMilliseconds; FMLogger.vCore(string.Concat(new object[] { "OnGDPRStatusReceived callback: ga", gdprApplied, " t:", num })); bool obj = false; if (AppInstallReportService.TGFR_GDPRStatus == GDPRStatus.Unknown) { AppInstallReportService.TGFR_GDPRStatus = ((!gdprApplied) ? GDPRStatus.NotApplied : GDPRStatus.Applied); obj = gdprApplied; FMLogger.vCore("changing server consent from unknown to " + ((!gdprApplied) ? "not applied" : "applied ")); } else if (AppInstallReportService.TGFR_GDPRStatus == GDPRStatus.NotApplied && gdprApplied) { FMLogger.vCore("changing server consent from not applied to applied"); AppInstallReportService.TGFR_GDPRStatus = GDPRStatus.Applied; obj = true; } if (this.OnResult != null) { this.OnResult(obj); } }
private IEnumerator LoadIconAsync(IconDownloadTask task, bool queued = true) { for (int i = 0; i < task.BaseUrls.Length; i++) { using (UnityWebRequest www = UnityWebRequestTexture.GetTexture(task.BaseUrls[i] + task.RelativeUrl)) { //www.timeout = 13; yield return(www.Send()); if (!www.isNetworkError && www.responseCode == 200L) { if (task.IsCanceled) { Texture2D content = DownloadHandlerTexture.GetContent(www); if (content != null && content.width > 10 && content.height > 10) { task.FallbackCancelation(content); } } else { Texture2D content2 = DownloadHandlerTexture.GetContent(www); if (content2 != null && content2.width > 10 && content2.height > 10) { content2.wrapMode = TextureWrapMode.Clamp; task.Result(true, content2); } else { task.Result(false, null); } this.SendConnectionResume(); } yield return(0); this.currentIconConnections--; yield break; } FMLogger.Log(string.Concat(new object[] { "icon dl error.", i, ". ", task.BaseUrls[i], string.Empty, task.RelativeUrl, " msg:", www.error })); } } this.currentIconConnections--; this.StepFailedPicture(); if (!task.IsCanceled) { FMLogger.Log("*************error task:" + task.RelativeUrl); task.Result(false, null); } yield break; }
public override IEnumerator Run() { string path = Application.temporaryCachePath + "/" + this.cacheKey; Texture2D tex = null; if (File.Exists(path)) { tex = FileHelper.LoadCacheTextureFromFile(path); tex.wrapMode = TextureWrapMode.Clamp; } try { if (this.callback != null) { this.callback(tex); } } catch (Exception) { FMLogger.LogError("never should happen"); } yield return(0); yield break; }
public ImageCacher(ILocalImageCache localRunner) { this.localRunner = localRunner; LocalStorageRunner.QueueSpeed queueSpeed = this.GetQueueSpeed(); this.localRunner.Init(queueSpeed); ImageCacher.UnloaderType unloaderType = this.GetUnloaderType(); FMLogger.vCore(string.Concat(new object[] { "buffer type: ", unloaderType, " queue speed: ", queueSpeed })); switch (unloaderType) { case ImageCacher.UnloaderType.LowEnd: this.unloader = new LowEndUnloadBehaviour(this.cached, localRunner); break; case ImageCacher.UnloaderType.MidEnd: this.unloader = new MidEndUnloadBehaviour(this.cached, localRunner); break; case ImageCacher.UnloaderType.HighEnd: this.unloader = new HighEndUnloadBehaviour(this.cached, localRunner); break; default: this.unloader = new LowEndUnloadBehaviour(this.cached, localRunner); break; } }
private void InitRewarded() { if (BuildConfig.HIDE_ADS || this.ads != null) { return; } if (this.ads == null) { this.ads = this.CreateAdsNetwork(); } if (!this.configRequested) { this.GetServerConfig(); } string rewardAdUnit = this.config.rewardAdUnit; if (string.IsNullOrEmpty(rewardAdUnit)) { FMLogger.vAds("Init rewarded fail. Empty ad unit"); return; } this.ads.InitializeRewarded(rewardAdUnit); this.ads.RewardedComplete += delegate(object sender, EventArgs e) { if (this.RewardedVideoComplete != null) { this.RewardedVideoComplete(); } }; FMLogger.vAds("Init rewarded only"); }
private void OnPicDeleted(PictureData delPicData, PictureData replacePicData) { if (replacePicData == null) { return; } for (int i = 0; i < this.items.Count; i++) { PicItem picItem = null; FeaturedItem.ItemType type = this.items[i].Type; if (type != FeaturedItem.ItemType.Daily) { if (type == FeaturedItem.ItemType.PromoPic) { picItem = ((PromoPicItem)this.items[i]).PicItem; } } else { picItem = ((DailyPicItem)this.items[i]).PicItem; } if (picItem != null && picItem.PictureData.Id == replacePicData.Id) { FMLogger.Log("found and replaced in featured section " + replacePicData.Id); picItem.Reset(); picItem.Init(replacePicData, false, false, false); } } }
private void onRewardedVideoLoadedEvent(string adUnitId) { FMLogger.vAds("onRewardedVideoLoadedEvent: " + adUnitId); AdsManager.Instance.rewardInfo.IterateLoaded(); AdsManager.Instance.rewardInfo.LoadTime = (int)(DateTime.Now - this.rewardLoadReqTime).TotalSeconds; AnalyticsManager.RewardLoaded(AdsManager.Instance.rewardInfo); }
private void LoadIcon() { if (this.useIndicator) { this.loadIcon.SetActive(true); } FMLogger.Log("load web " + this.pd.Id); this.iconDownloadTask = new IconDownloadTask(this.pd.WebPath.baseUrls, this.pd.WebPath.icon, this.pd.WebPath.CacheKey, delegate(bool success, Texture2D tex) { if (success && tex != null) { if (this.useIndicator) { this.loadIcon.SetActive(false); } this.img.texture = tex; } else { FMLogger.Log("Error loading bonus pic: " + this.pd.Id); } this.iconDownloadTask = null; }); ImageManager.Instance.DownloadIcon(this.iconDownloadTask); }
private void Start() { this.AdjustInit(); this.FirebaseInit(); this.CheckDailyBonus(); try { PlayTimeEventTracker.AppResume(); } catch (Exception ex) { UnityEngine.Debug.Log("PlayTimeEventTracker ex. " + ex.Message); } this.deepLinker = new DeeplinkController(base.GetComponent <FMDeepLink>()); this.deepLinker.BonusCodeReceived += this.OnFBDeeplinkOpened; AppState.ContentReqTime = DateTime.Now; base.StartCoroutine(this.LoadSysParameters(delegate { AdsManager.Instance.SetParams(this.adsId, this.adsLimitied); if (GeneralSettings.AdsDisabled) { FMLogger.vAds("casual disable ads on startup"); AdsManager.Instance.DisableAds(); } else { FMLogger.vAds("ads init"); AdsManager.Instance.Init(); AdsManager.Instance.StartFsInterval(); } TGFModule.Instance.Init(this.adsId, this.adsLimitied, this.countryCode, this.langCode); ImageManager.Instance.Init(); SharedData.Instance.Init(); //FB.Init(null, null, null); AppState.LaunchTime = DateTime.Now; this.fairyController.StartTimer(); this.deepLinker.Check(); TGFModule.Instance.PrecachePages(); try { AnalyticsManager.SetUserDeviceTypeProperty(SafeLayout.IsTablet); } catch (Exception ex2) { FMLogger.vCore("SetUserDeviceTypeProperty crash. " + ex2.Message); } float delay = 0.5f; if (AppManager.__f__mg_cache0 == null) { AppManager.__f__mg_cache0 = new Action(UserLifecycle.AppLaunch); } base.StartCoroutine(this.DelayAction(delay, AppManager.__f__mg_cache0)); AppManager.inited = true; if (this.Loaded != null) { this.Loaded(); } })); }
public bool FindEmptyZone() { if (this.palette.CurrentId == -1) { this.toastManager.ShowHintPickColor(); return(false); } bool flag = this.validator.IsFilled(this.palette.CurrentId); if (flag) { FMLogger.Log("used fully. " + this.palette.CurrentId); this.toastManager.ShowHintAlreadyPainted(); return(false); } int currentId = this.palette.CurrentId; int[] indexes = this.paletteData.entities[currentId].indexes; int num = -1; for (int i = 0; i < indexes.Length; i++) { Point p = default(Point); p.i = Mathf.FloorToInt((float)indexes[i] / (float)this.paintFill.TexWidth); p.j = indexes[i] - p.i * this.paintFill.TexWidth; Color32 a = this.paintFill.CurrentColorInPixel(p); Color32 c = this.paintFill.ExpectedColorInPixel(p); if (!ColorUtils.IsSameColors(a, c)) { num = i; break; } } if (num == -1) { FMLogger.Log("element not found. never should happen"); return(false); } int num2 = this.paletteData.entities[currentId].indexes[num]; Point p2 = default(Point); p2.i = Mathf.FloorToInt((float)num2 / (float)this.paintFill.TexWidth); p2.j = num2 - p2.i * this.paintFill.TexWidth; Vector2 b = this.TextureToCanvas(p2); this.boardController.ZoomToPosition(new Vector2(this.imageRect.width / 2f, this.imageRect.height / 2f) - b); if (this.hintRevealedIndexes.Contains(num2)) { FMLogger.Log("already hint revealed"); return(false); } this.hintRevealedIndexes.Add(num2); if (this.pictureSaveData != null) { this.pictureSaveData.hintsUsed++; FMLogger.Log("hints used " + this.pictureSaveData.hintsUsed); } return(true); }
private IEnumerator BannerHideWorkaround() { yield return(0); FMLogger.vAds("hide banner after req on next frame. workaround"); MoPubAndroid.ShowBanner(this.bannerAdUnit, false); yield break; }
public void Check() { string anyAdUnitId = (!SafeLayout.IsTablet) ? "6bc3898062484e71a114d0ab59cb1c78" : "0543e571406140dd96252ac1351b99f5"; this.time = DateTime.UtcNow; MoPubAndroid.InitializeSdk(anyAdUnitId); FMLogger.vCore("mopub pre int consent status " + MoPubAndroid.CurrentConsentStatus); }
public void ShouldReward(string dummy) { FMLogger.vAds("FAdsManager ShouldReward received"); if (FAdsManager.RewardedCompleted != null) { FAdsManager.RewardedCompleted(); } }
public void Check() { string adUnit = (!SafeLayout.IsTablet) ? "6bc3898062484e71a114d0ab59cb1c78" : "0543e571406140dd96252ac1351b99f5"; this.time = DateTime.UtcNow; this.consentProvider.InitForConsent(adUnit); FMLogger.vCore("fads pre int consent status " + this.consentProvider.CurrentConsentStatus); }