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;
            }
        }
Example #2
0
        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.");
            }
        }
Example #3
0
 public void watchVideo()
 {
     Debug.Log("watchvideoad");
     SoundManager.Instance.PlayClickSound();
     GameAnalytics.NewDesignEvent("VideoClicked");
     AdHandler.GetInstance().showVideoAd();
 }
Example #4
0
    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");
        }
    }
Example #5
0
    IEnumerator showAd()
    {
        yield return(new WaitForSeconds(0.7f));

        Debug.Log("Arslan::gameoverAnimCompleteCB");
        AdHandler.GetInstance().showInterstatial();
    }
Example #6
0
 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);
            }
        }
Example #8
0
    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);
        }
    }
Example #9
0
    void Awake()
    {
        adHandler = this;

#if UNITY_ANDROID
        Advertisement.Initialize(androidId_UnityAds);
#elif UNITY_IPHONE
        Advertisement.Initialize(iosId_UnityAds);
#endif
    }
Example #10
0
 void ActivateVideoAdBtn()
 {
     if (!AdHandler.GetInstance().IsVideoAdAvailable())
     {
         VidAdBtn.SetActive(false);
     }
     else
     {
         VidAdBtn.SetActive(true);
     }
 }
Example #11
0
 public void popButtonClicked()
 {
     if (numOfStars < 30)
     {
         AdHandler.GetInstance().showVideoAd(videoActionComplete);
     }
     else
     {
         numOfStars -= 30;
         popButtonGameObject.SetActive(false);
         StartCoroutine("popBlocks1");
     }
 }
Example #12
0
 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);
     }
 }
Example #13
0
    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();
        }
Example #16
0
        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.");
            }
        }
Example #17
0
 public void onVideoAd()
 {
     SoundManager.Instance.PlayClickSound();
     GameAnalytics.NewDesignEvent("VideoClicked");
     AdHandler.GetInstance().showVideoAd();
 }
Example #18
0
    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
    }
Example #19
0
    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");
        }
    }
Example #20
0
 void StartBanner()
 {
     AdHandler.GetInstance().showAdmobBanner();
 }