private void listViewHomePage_SelectedIndexChanged(object sender, EventArgs e) { // string id = null; if (listViewHomePage.SelectedItems.Count > 0) { id = listViewHomePage.SelectedItems[0].SubItems[0].Text; } else { return; } AdHandler handler = new AdHandler(); Product product = handler.getSelectedAd(id); if (Arxikh.user != null && (product.Owner.Id == Arxikh.user.Id)) { editAd.Visible = true; selectedId = id; } else { editAd.Visible = false; } }
private void updateButton_Click(object sender, EventArgs e) { string title = titleTB.Text; string description = descriptionTB.Text; string price = priceTB.Text; string type = (comboBox1.SelectedItem as string); int categoryId = catId; User owner = Arxikh.user; Product product = new Product { Title = title, Desc = description, Price = price, Type = type, CategoryId = categoryId, Date = System.DateTime.Today.ToString("dd/MM/yy"), Owner = owner }; AdHandler handler = new AdHandler(product); if (handler.createAd()) { Database.updateAd(product, productId); MessageBox.Show("Your ad was updated!"); this.Close(); } else { MessageBox.Show("Fill all the fields."); } }
public void watchVideo() { Debug.Log("watchvideoad"); SoundManager.Instance.PlayClickSound(); GameAnalytics.NewDesignEvent("VideoClicked"); AdHandler.GetInstance().showVideoAd(); }
public void onMarketPurchase(PurchasableVirtualItem pvi, string payload, Dictionary <string, string> extra) { Debug.Log("Arslan::InApp::onMarketPurchase pvi id = " + pvi.ID); if (pvi.ID.Equals("stars100")) { GameManager.Instance.addStars(100); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 100, "IAP", "Stars100"); } else if (pvi.ID.Equals("stars500")) { GameManager.Instance.addStars(500); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 500, "IAP", "Stars500"); } else if (pvi.ID.Equals("stars1000")) { GameManager.Instance.addStars(1000); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "Stars", 1000, "IAP", "Stars1000"); } else if (pvi.ID.Equals("removead")) { AdHandler.GetInstance().hideAdmobBanner(); ZPlayerPrefs.SetInt("ads", 0); GameAnalytics.NewResourceEvent(GAResourceFlowType.Source, "RemoveAd", 100, "IAP", "RemoveAd"); } }
IEnumerator showAd() { yield return(new WaitForSeconds(0.7f)); Debug.Log("Arslan::gameoverAnimCompleteCB"); AdHandler.GetInstance().showInterstatial(); }
public void LoseGame() { appOverlay.LoseTextHandler(); Time.timeScale = 1; GameTimer.ContinueStop(); pauseButton.SetActive(false); GameTimer.Stop(); GameTimer.Reset(); if (MusicScript.SoundEffToggle) { loseSound.GetComponent <AudioSource>().Play(); } hatDanceLoop.GetComponent <AudioSource>().Stop(); PlayerInfluence.lostGame = !PlayerInfluence.lostGame; appOverlay.LostGameScreen(); lifePoints = 3; firstlose = false; AdHandler.GamesPlayed++; if (FBScript.user != null) { if (appOverlay.GetScore() > bestScore) { writeNewUser(FBScript.auth.CurrentUser.UserId, FBScript.user.DisplayName, appOverlay.GetScore()); } } AdHandler.ShowAd(); }
private void showAdButton_Click(object sender, EventArgs e) { showAdPanel.Visible = true; string id; if (listViewHomePage.SelectedItems.Count > 0) { id = listViewHomePage.SelectedItems[0].SubItems[0].Text; } else { MessageBox.Show("Choose an ad."); return; } showAdPanel.Visible = true; AdHandler handler = new AdHandler(); Product product = handler.getSelectedAd(id); titleTextBox.Text = product.Title; descriptionTextBox.Text = product.Desc; priceTextBox.Text = product.Price; typeTextBox.Text = product.Type; categoryTextBox.Text = Database.getCategoryNameById(Convert.ToInt32(product.CategoryId)); dateTextBox.Text = product.Date; ownerTextBox.Text = product.Owner.Username; phoneTextBox.Text = product.Owner.Phone.ToString(); emailTextBox.Text = product.Owner.Email; if (Arxikh.user != null) { handler.addToViewHistoryIfDoesntExist(product); } }
void initInfiniteGamePlay() { scorePanel.SetActive(true); levelStarsPanel.SetActive(false); for (int i = 0; i < 4; i++) { groundBox.localPosition = new Vector3(0, -3 * (i + 1), 0); Transform box = BoxPattern.getInstance().getRandomBoxPattern(); Transform boxObj = Instantiate(box, new Vector3(0, -3 * i, 0), Quaternion.identity) as Transform; boxObj.parent = transform; boxObj.localPosition = new Vector3(0, -3 * i, 0); lastBoxPosition = boxObj.localPosition; } addStarGameObject(10); updateScores(0, null); if (numOfStars >= 30) { popButtonGameObject.GetComponent <Image>().sprite = Resources.Load("PopStar", typeof(Sprite)) as Sprite; popButtonGameObject.SetActive(true); } else if (AdHandler.GetInstance().IsVideoAdAvailable()) { popButtonGameObject.GetComponent <Image>().sprite = Resources.Load("PopVideo", typeof(Sprite)) as Sprite; popButtonGameObject.SetActive(true); } else { popButtonGameObject.SetActive(false); } }
void Awake() { adHandler = this; #if UNITY_ANDROID Advertisement.Initialize(androidId_UnityAds); #elif UNITY_IPHONE Advertisement.Initialize(iosId_UnityAds); #endif }
void ActivateVideoAdBtn() { if (!AdHandler.GetInstance().IsVideoAdAvailable()) { VidAdBtn.SetActive(false); } else { VidAdBtn.SetActive(true); } }
public void popButtonClicked() { if (numOfStars < 30) { AdHandler.GetInstance().showVideoAd(videoActionComplete); } else { numOfStars -= 30; popButtonGameObject.SetActive(false); StartCoroutine("popBlocks1"); } }
void Awake() { //Check if instance already exists if (instance == null) { //if not, set instance to this instance = this; //Sets this to not be destroyed when reloading scene DontDestroyOnLoad(gameObject); } //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); } }
public void shareButtonClick() { GameAnalytics.NewDesignEvent("shareButtonClick"); Debug.Log("share"); SoundManager.Instance.PlayClickSound(); homeBtn.SetActive(false); shareBtn.SetActive(false); AdHandler.GetInstance().hideAdmobBanner(); #if UNITY_IPHONE // GameObject.Find("SharePanel").GetComponent<GeneralSharing>().OnShareTextWithImage(); StartCoroutine(ShareManager.Share(homeBtn, shareBtn)); #endif #if UNITY_ANDROID StartCoroutine(ShareManager.Share(homeBtn, shareBtn)); #endif }
public ActionResult postAd() { User currentUser = (User)Session[Webutil.CurrentUser]; if (currentUser == null) { return(RedirectToAction("UserLogin", "Login", new { returnUrl = "Advertisement/postAd" })); } ViewBag.CountryList = new LocationHandler().GetCountries().ToselectList(); ViewBag.Categories = new CategoryHandler().Getcategory().ToselectList(); var temp = new AdHandler().Gettypes().ToselectList(); temp.First().Selected = true; ViewBag.Adtypes = temp; return(View()); }
private void button1_Click(object sender, EventArgs e) { string id = null; if (listViewHistoryPage.SelectedItems.Count > 0) { id = listViewHistoryPage.SelectedItems[0].SubItems[0].Text; } else { MessageBox.Show("Choose an ad."); return; } AdHandler handler = new AdHandler(); Product product = handler.getSelectedAd(id); Database.removeEntryFromViewHistroy(product); refreshViewHistory(); }
private void createAdButton_Click(object sender, EventArgs e) { string title = titleTextBox.Text; string description = descriptionTextBox.Text; string price = priceTextBox.Text; string type = (typeComboBox.SelectedItem as string); string category = (categoryComboBox.SelectedItem as string); int categoryId = Database.getCategoryIdByName(category); User owner = Arxikh.user; Product product = new Product { Title = title, Desc = description, Price = price, Type = type, CategoryId = categoryId, Date = System.DateTime.Today.ToString("dd/MM/yy"), Owner = owner }; AdHandler handler = new AdHandler(product); if (handler.createAd()) { Database.insertAd(product); MessageBox.Show("Your ad was created!"); clearAllFields(); this.mainForm.refreshAllAds(); this.mainForm.getHomePage.BringToFront(); } else { MessageBox.Show("Fill all the fields."); } }
public void onVideoAd() { SoundManager.Instance.PlayClickSound(); GameAnalytics.NewDesignEvent("VideoClicked"); AdHandler.GetInstance().showVideoAd(); }
public static IEnumerator Share(GameObject homeBtn, GameObject shareBtn) { string dateAndTime = System.DateTime.Now.ToString(); dateAndTime = dateAndTime.Replace("/", "-"); string screenshotName = "ScreenShot" + "_" + dateAndTime + ".png"; string screenshotPath = Path.Combine(Application.persistentDataPath, screenshotName); Debug.Log("Arslan:: imagePath = " + screenshotPath); // string filename = "ScreenN123.png"; Application.CaptureScreenshot(screenshotName); while (!System.IO.File.Exists(screenshotPath)) { Debug.Log("Arslan:: waiting "); yield return(null); } homeBtn.SetActive(true); shareBtn.SetActive(true); AdHandler.GetInstance().showAdmobBanner(); #if UNITY_ANDROID //instantiate the class Intent AndroidJavaClass intentClass = new AndroidJavaClass("android.content.Intent"); //instantiate the object Intent AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent"); //call setAction setting ACTION_SEND as parameter intentObject.Call <AndroidJavaObject>("setAction", intentClass.GetStatic <string>("ACTION_SEND")); //instantiate the class Uri AndroidJavaClass uriClass = new AndroidJavaClass("android.net.Uri"); //instantiate the object Uri with the parse of the url's file AndroidJavaObject uriObject = uriClass.CallStatic <AndroidJavaObject>("parse", "file://" + screenshotPath); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_STREAM"), uriObject); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_SUBJECT"), GameConstants.SHARE_SUBJECT); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TITLE"), GameConstants.SHARE_TITLE); //call putExtra with the uri object of the file intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TEXT"), GameConstants.SHARE_TEXT); //set the type of file intentObject.Call <AndroidJavaObject>("setType", "image/jpeg"); //instantiate the class UnityPlayer AndroidJavaClass unity = new AndroidJavaClass("com.unity3d.player.UnityPlayer"); //instantiate the object currentActivity AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject>("currentActivity"); // option one WITHOUT chooser: //currentActivity.Call("startActivity", intentObject); // option two WITH chooser: AndroidJavaObject jChooser = intentClass.CallStatic <AndroidJavaObject>("createChooser", intentObject, GameConstants.SHARE_SUBJECT); currentActivity.Call("startActivity", jChooser); #endif #if UNITY_IOS GeneralSharingiOSBridge.ShareTextWithImage(screenshotPath, GameConstants.SHARE_TEXT_IOS); #endif }
IEnumerator showGameOver() { yield return(new WaitForSeconds(3.0f)); int gameOverCount = ZPlayerPrefs.GetInt(GameConstants.GAMEOVER_COUNT_STRING, 0); ZPlayerPrefs.SetInt(GameConstants.GAMEOVER_COUNT_STRING, gameOverCount + 1); GameAnalytics.NewDesignEvent("GameOver", (float)gameOverCount); GameAnalytics.NewDesignEvent("GameOverNew"); ZPlayerPrefs.SetInt(GameConstants.CURRENTSCORE_STRING, currentScore); ZPlayerPrefs.SetInt(GameConstants.BESTSCORE_STRING, bestScore); ZPlayerPrefs.SetInt(GameConstants.GLOBALSTARS_STRING, numOfStars); int socialCount = PlayerPrefs.GetInt(GameConstants.SOCIAL_COUNT_STRING, 0); PlayerPrefs.SetInt(GameConstants.SOCIAL_COUNT_STRING, socialCount + 1); if (gameOverCount % 3 == 0 && GameConstants.LEVEL_TO_LOAD == 0) { // AdHandler.GetInstance().showInterstatial(); StartCoroutine("showAd"); } else if (gameOverCount % 3 == 0 && GameConstants.LEVEL_TO_LOAD != 0) { AdHandler.GetInstance().showInterstatial(); } if (GameConstants.LEVEL_TO_LOAD == 0) { isPauseMenu = true; gameoverPanel.SetActive(true); gameoverScoreText.text = "" + currentScore; iTween.ScaleTo(gameoverBG.gameObject, iTween.Hash( "scale", Vector3.one, "easeType", iTween.EaseType.easeInOutBack, "loopType", iTween.LoopType.none, "time", 0.75f, "oncomplete", "gameoverAnimCompleteCB", "oncompletetarget", gameObject)); if (Social.localUser.authenticated) { SendScore(); } else { Debug.Log("User not logged in. Score not sent to leaderboard"); } } else { if (starCount == 3) { PlayerPrefs.SetInt(GameConstants.LEVEL_STRING + (levelData.levelNumber + 1), 1); if (levelData.levelNumber + 1 >= 99) { GameAnalytics.NewDesignEvent("EndLevel99"); } } SceneManager.LoadScene("LevelScene"); } }
void StartBanner() { AdHandler.GetInstance().showAdmobBanner(); }