// Mostra o banner
    public static bool showBanner()
    {
        if (!bannerEnabled)
        {
            //Debug.Log("show return 1");
            return(false);
        }
        if (totalBanners > 0)
        {
            //Debug.Log("show return 2");
            return(true);
        }
        if (Info.IsEditor())
        {
            //Debug.Log("show return 3");
            return(false);           //AdvertisementEditorBanner.Show();
        }
        if (!AdvertisementManager.isEnabled() || isTryingBanner)
        {
            //Debug.Log("show return 4");
            return(false);
        }

        AdvertisementManager.manager.StartCoroutine(AdvertisementManager.manager.showBannerCoroutine());

        return(false);
    }
Beispiel #2
0
        public static void Main(string[] args)
        {
            bool_0 = true;
            DateTime now = DateTime.Now;

            Output.InitializeStream(true, OutputLevel.DebugInformation);
            Output.WriteLine("Initializing BoomBang game environment...");
            ConfigManager.Initialize(Constants.DataFileDirectory + @"\server-main.cfg");
            Output.SetVerbosityLevel((OutputLevel)ConfigManager.GetValue("output.verbositylevel"));
            foreach (string str in args)
            {
                Output.WriteLine("Command line argument: " + str);
                Input.ProcessInput(str.Split(new char[] { ' ' }));
            }
            try
            {
                Output.WriteLine("Initializing MySQL manager...");
                SqlDatabaseManager.Initialize();
                Output.WriteLine("Setting up server listener on port " + ((int)ConfigManager.GetValue("net.bind.port")) + "...");
                boomBangTcpListener_0 = new BoomBangTcpListener(new IPEndPoint(IPAddress.Any, (int)ConfigManager.GetValue("net.bind.port")), (int)ConfigManager.GetValue("net.backlog"), new OnNewConnectionCallback(SessionManager.HandleIncomingConnection));
                using (SqlDatabaseClient client = SqlDatabaseManager.GetClient())
                {
                    Output.WriteLine("Resetting database counters and statistics...");
                    smethod_0(client);
                    Output.WriteLine("Initializing game components and workers...");
                    DataRouter.Initialize();
                    GlobalHandler.Initialize();
                    SessionManager.Initialize();
                    CharacterInfoLoader.Initialize();
                    UserCredentialsAuthenticator.Initialize();
                    RegisterManager.Initialize();
                    Class1.smethod_0();
                    LaptopHandler.Initialize();
                    CatalogManager.Initialize(client);
                    FlowerPowerManager.Initialize();
                    NewsCacheManager.Initialize(client);
                    Navigator.Initialize(client);
                    SpaceManager.Initialize(client);
                    SpaceInfoLoader.Initialize();
                    SpaceHandler.Initialize();
                    GameHandler.Initialize();
                    CrossdomainPolicy.Initialize(@"Data\crossdomain.xml");
                    WordFilterManager.Initialize(client);
                    AdvertisementManager.Initialize();
                    ContestHandler.Initialize();
                    SilverCoinsWorker.Initialize();
                    ModerationBanManager.Initialize(client);
                }
            }
            catch (Exception exception)
            {
                HandleFatalError("Could not initialize BoomBang game environment: " + exception.Message + "\nStack trace: " + exception.StackTrace);
                return;
            }
            TimeSpan span = (TimeSpan)(DateTime.Now - now);

            Output.WriteLine("The server has initialized successfully (" + Math.Round(span.TotalSeconds, 2) + " seconds). Ready for connections.", OutputLevel.Notification);
            Output.WriteLine("Pulsa ENTER e introduce un comando. Ten una guía de comandos escribiendo HELP", OutputLevel.Notification);
            Console.Beep();
        }
    public void Start()
    {
        instance = this;
        if (initialized)
        {
            if (!PlayerBoxController.currentPlayer.noAdvertisements)
            {
                advertBanner.LoadAd(GetNextRequest());
            }
            return;
        }
        initialized = true;
#if UNITY_ANDROID
        string appId = androidAppID;
#elif UNITY_IPHONE
        string appId = appleAppID;
#else
        string appId = "unknown-platform";
#endif
        MobileAds.Initialize(appId);
        advertBanner = GetBannerView();
        if (!PlayerBoxController.currentPlayer.noAdvertisements)
        {
            advertBanner.LoadAd(GetNextRequest());
        }
        advertInterstitial             = GetInterstitialAd();
        advertInterstitial.OnAdClosed += OnInterstitialUnload;
        OnInterstitialUnload(null, null);
        advertVideo               = GetVideoAd();
        advertVideo.OnAdClosed   += OnVideoUnload;
        advertVideo.OnAdRewarded += OnAdRewarded;
        OnVideoUnload(null, null);
    }
Beispiel #4
0
 public void ContinueLoading()
 {
     if (this.task_0 != null)
     {
         this.task_0 = null;
     }
     using (DatabaseClient @class = GoldTree.GetDatabase().GetClient())
     {
         this.method_0(@class, 0);
     }
     if (this.GetClientManager() != null)
     {
         this.GetClientManager().method_6();
         this.GetClientManager().method_11();
     }
     if (this.GetPixelManager() != null)
     {
         this.PixelManager.KeepAlive = false;
     }
     this.ClientManager        = null;
     this.BanManager           = null;
     this.RoleManager          = null;
     this.HelpTool             = null;
     this.Catalog              = null;
     this.Navigator            = null;
     this.ItemManager          = null;
     this.RoomManager          = null;
     this.AdvertisementManager = null;
     this.PixelManager         = null;
 }
Beispiel #5
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (PiciEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = PiciEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //PiciEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;
            }
        }
Beispiel #6
0
    private static void AdvertisementFlurry(AdvertisementManager ads, string tab)
    {
        if (!SwitcherButton(ads, "Flurry"))
        {
            return;
        }

        EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);

        ads.flurry.ios = EditorGUILayout.TextField(tab + "API Key", ads.flurry.ios);

        EditorGUILayout.Space();
        EditorGUILayout.LabelField(tab + "Ad Space", EditorStyles.miniBoldLabel);

        ads.flurry_banner.ios = EditorGUILayout.TextField(tab.Multiply(2) + "Banner", ads.flurry_banner.ios);
        ads.flurry_inters.ios = EditorGUILayout.TextField(tab.Multiply(2) + "Interstitial", ads.flurry_inters.ios);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);

        ads.flurry.android = EditorGUILayout.TextField(tab + "API Key", ads.flurry.android);

        EditorGUILayout.Space();

        EditorGUILayout.LabelField(tab + "Ad Space", EditorStyles.miniBoldLabel);

        ads.flurry_banner.android = EditorGUILayout.TextField(tab.Multiply(2) + "Banner", ads.flurry_banner.android);
        ads.flurry_inters.android = EditorGUILayout.TextField(tab.Multiply(2) + "Interstitial", ads.flurry_inters.android);
    }
Beispiel #7
0
        internal Game(int conns)
        {
            ClientManager = new GameClientManager();

            //if (ButterflyEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            //{
            //    ClientManager.StartConnectionChecker();
            //}


            using (IQueryAdapter dbClient = ButterflyEnvironment.GetDatabaseManager().getQueryreactor())
            {
                //ButterflyEnvironment.GameInstance = this;
                DateTime start = DateTime.Now;

                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();

                ModerationTool = new ModerationTool();
                BotManager     = new BotManager();
                questManager   = new QuestManager();
                //soundMachineManager = new SoundMachineManager();

                TimeSpan spent = DateTime.Now - start;

                Logging.WriteLine("Class initialization -> READY! (" + spent.Seconds + " s, " + spent.Milliseconds + " ms)");
            }
        }
Beispiel #8
0
        public static void Hide()
        {
            //Debug.Log("hide 1");
#if !UNITY_WEBPLAYER
            AdvertisementManager.hideBanner();
#endif
        }
Beispiel #9
0
        public static void Fetch()        //float delay = 0f)
        {
#if !UNITY_WEBPLAYER
            /*if (delay > 0f) new KTimer(delay, AdvertisementManager.fetchVideo);
             * else */AdvertisementManager.fetchVideo();
#endif
        }
Beispiel #10
0
    public static void DrawInterface(ConfigManager config)
    {
        if (!config.gameObject.GetComponent <AdvertisementManager>())
        {
            config.gameObject.AddComponent <AdvertisementManager>();
        }
        AdvertisementManager ads = config.gameObject.GetComponent <AdvertisementManager>();

        EditorGUILayout.LabelField("'".Multiply(500), EditorStyles.miniBoldLabel);

        EditorGUILayout.LabelField("Advertisement", EditorStyles.boldLabel);

        if (GUILayout.Button(config.showAds ? "Close" : "Open"))
        {
            if (ads != null)
            {
                ads.curEditorAds = "";
            }

            config.showAds = !config.showAds;
        }

        if (ads != null && config.showAds)
        {
            CheckList(ads);
        }
    }
Beispiel #11
0
 public void Destroy()
 {
     if (Task != null)
     {
         Task = null;
     }
     using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
     {
         DatabaseCleanup(adapter, 0);
     }
     if (GetClientManager() != null)
     {
         GetClientManager().Clear();
         GetClientManager().StopConnectionChecker();
     }
     if (GetPixelManager() != null)
     {
         PixelManager.KeepAlive = false;
     }
     ClientManager        = null;
     BanManager           = null;
     RoleManager          = null;
     HelpTool             = null;
     Catalog              = null;
     Navigator            = null;
     ItemManager          = null;
     RoomManager          = null;
     AdvertisementManager = null;
     PixelManager         = null;
 }
Beispiel #12
0
        public static bool Play(VideoDelegate callback)
        {
#if !UNITY_WEBPLAYER
            return(AdvertisementManager.showVideo(callback));
#else
            return(false);
#endif
        }
Beispiel #13
0
        public static bool IsDownloaded()
        {
#if !UNITY_WEBPLAYER
            return(AdvertisementManager.isVideoAvailable());
#else
            return(false);
#endif
        }
Beispiel #14
0
    // Se a API de Advertisement realmente esta sendo utilizada
    //
    // Quando o metodo retorna false:
    // - Se a Prefab "AdvertisementManager" (inserida dentro da Prefab "#Configuration#") for nula
    // - Se a bool isActive do "AdvertisementManager" estiver como false
    // - Se nenhum Advertisement conseguir ser instanciado
    //
    // Ex: if (Advertisement.IsRunning())
    //	      Debug.log("Advertisement API esta funcionando");
    public static bool IsRunning()
    {
#if !UNITY_WEBPLAYER
        return(AdvertisementManager.isEnabled());
#else
        return(false);
#endif
    }
Beispiel #15
0
        public static bool PopUp()
        {
#if !UNITY_WEBPLAYER
            return(AdvertisementManager.showPopup());
#else
            return(false);
#endif
        }
Beispiel #16
0
        public Game(int conns)
        {
            ClientManager = new GameClientManager(conns);
            if (PhoenixEnvironment.GetConfig().data["client.ping.enabled"] == "1")
            {
                ClientManager.StartConnectionChecker();
            }
            DateTime Now = DateTime.Now;

            Logging.Write("Connecting to database...");
            using (DatabaseClient adapter = PhoenixEnvironment.GetDatabase().GetClient())
            {
                Logging.WriteLine("completed!");
                PhoenixEnvironment.GameInstance = this;
                LoadSettings(adapter);
                BanManager           = new ModerationBanManager();
                RoleManager          = new RoleManager();
                HelpTool             = new HelpTool();
                Catalog              = new Catalog();
                Navigator            = new Navigator();
                ItemManager          = new ItemManager();
                RoomManager          = new RoomManager();
                AdvertisementManager = new AdvertisementManager();
                PixelManager         = new PixelManager();
                AchievementManager   = new AchievementManager();
                ModerationTool       = new ModerationTool();
                BotManager           = new BotManager();
                Marketplace          = new Marketplace();
                QuestManager         = new QuestManager();
                TextManage           = new TextManager();
                Guilds = new GroupManager();
                TextManager.LoadTexts(adapter);
                BanManager.LoadBans(adapter);
                RoleManager.LoadRoles(adapter);
                HelpTool.LoadCategories(adapter);
                HelpTool.LoadTopics(adapter);
                ModerationTool.LoadMessagePresets(adapter);
                ModerationTool.LoadPendingTickets(adapter);
                ItemManager.LoadItems(adapter);
                Catalog.Initialize(adapter);
                Catalog.InitCache();
                Navigator.Initialize(adapter);
                RoomManager.LoadModels(adapter);
                RoomManager.LoadCache();
                NavigatorCache = new NavigatorCache();
                AdvertisementManager.LoadRoomAdvertisements(adapter);
                BotManager.LoadBots(adapter);
                AchievementManager.LoadAchievements(adapter);
                PixelManager.Start();
                ChatCommandHandler.InitFilter(adapter);
                QuestManager.InitQuests();
                GroupManager.LoadGroups(adapter);
                DatabaseCleanup(adapter, 1);
            }
            Task = new Task(new Action(LowPriorityWorker.Process));
            Task.Start();
        }
	private static void CheckList(AdvertisementManager ads)
	{
		string space = " ".Multiply(5);
	
		EditorGUILayout.Space();
		ads.isActive = EditorGUILayout.Toggle("Enabled", ads.isActive);
		EditorGUILayout.Space();
	
		DrawList(ads, space);
	}
Beispiel #18
0
    private static void CheckList(AdvertisementManager ads)
    {
        string space = " ".Multiply(5);

        EditorGUILayout.Space();
        ads.isActive = EditorGUILayout.Toggle("Enabled", ads.isActive);
        EditorGUILayout.Space();

        DrawList(ads, space);
    }
Beispiel #19
0
        public static void Fetch(Advertisement.Position pos = Advertisement.Position.Top)
        {
#if !UNITY_WEBPLAYER
            if (!canShowAds)
            {
                return;
            }

            AdvertisementManager.fetchBanner(pos == Advertisement.Position.Top? AdvertisementManager.Positions.TOP : AdvertisementManager.Positions.BOTTOM);
#endif
        }
Beispiel #20
0
 void AwakeSingleton()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this.gameObject);
     }
 }
Beispiel #21
0
        public void Delete(string advertisementName, int publishmentSystemId)
        {
            var parms = new IDataParameter[]
            {
                GetParameter(ParmAdName, EDataType.VarChar, 50, advertisementName),
                GetParameter(ParmPublishmentsystemid, EDataType.Integer, publishmentSystemId)
            };

            ExecuteNonQuery(SqlDeleteAd, parms);
            AdvertisementManager.RemoveCache(publishmentSystemId);
        }
	private static void DrawList(AdvertisementManager ads, string space)
	{
		EditorGUILayout.LabelField("Advertisement -> Configuration", EditorStyles.boldLabel);
		AdvertisementAdColony(ads, space);
		AdvertisementAdMob(ads, space);
		AdvertisementFlurry(ads, space);
		AdvertisementRevMob(ads, space);
		//AdvertisementTapGage(ads, space);
		AdvertisementPlayHaven(ads, space);
		AdvertisementVungle(ads, space);
		AdvertisementDefaults(ads, space);
	}
Beispiel #23
0
 private static void DrawList(AdvertisementManager ads, string space)
 {
     EditorGUILayout.LabelField("Advertisement -> Configuration", EditorStyles.boldLabel);
     AdvertisementAdColony(ads, space);
     AdvertisementAdMob(ads, space);
     AdvertisementFlurry(ads, space);
     AdvertisementRevMob(ads, space);
     //AdvertisementTapGage(ads, space);
     AdvertisementPlayHaven(ads, space);
     AdvertisementVungle(ads, space);
     AdvertisementDefaults(ads, space);
 }
        /// <summary>
        /// This can be called to show a video, for instance after calling "SendrequestRewardVideoEvent()"
        /// and receiving an "AdAvailable" event the developer could call this method from the event handler.
        /// When calling this method "SendrequestRewardVideoEvent()" must first have been called to request and cache a video.
        /// If no video is available then nothing will happen.
        /// </summary>
        public override void PlayVideo(string location = null, string rewardType = null)
        {
            int priv = Spil.Instance.GetPrivValue();

            if (priv < 2 && priv > -1 && Spil.UseUnityPrefab)
            {
                ShowAdsScreen();
                return;
            }

            AdvertisementManager.PlayVideo();
        }
Beispiel #25
0
        public static void Show()        //float delay = 0f)
        {
#if !UNITY_WEBPLAYER
            if (!canShowAds)
            {
                return;
            }

            /*if (delay > 0f)
             *      new KTimer(delay, AdvertisementManager.showInterstitial);
             * else */AdvertisementManager.showInterstitial();
#endif
        }
Beispiel #26
0
    void Awake()
    {
        if (instance == null)
        {
            instance = this;

            DontDestroyOnLoad(this);
        }
        else
        {
            Destroy(gameObject);
        }
    }
Beispiel #27
0
        public static void Widget(System.Action <bool> callback)       //float delay = 0f)
        {
#if !UNITY_WEBPLAYER
            if (!canShowAds)
            {
                return;
            }

            /*if (delay > 0f)
             *      new KTimer(delay, AdvertisementManager.showWidget);
             * else */AdvertisementManager.showWidget(callback);
#endif
        }
Beispiel #28
0
        public static bool Show()
        {
#if !UNITY_WEBPLAYER
            //Debug.Log("show 1");
            if (!canShowAds)
            {
                return(false);
            }
            return(AdvertisementManager.showBanner());
#else
            return(false);
#endif
        }
	private static bool SwitcherButton(AdvertisementManager ads, string ad)
	{
		if (GUILayout.Button(ad))
		{
			ads.curEditorAds = ad;
			ads.curListAds = "";
			ads.curPreferenceAds = "";
		}

		if (ads.curEditorAds != ad)
			return false;
		
		return true;
	}
Beispiel #30
0
 public void Awake()
 {
     _gameManager          = GetComponent <GameManager>();
     _uiManager            = GetComponent <UIManager>();
     _audioManager         = GetComponent <AudioManager>();
     _scoreManager         = GetComponent <ScoreManager> ();
     _inputManager         = GetComponent <PlayerInputManager> ();
     _advertisementManager = GetComponent <AdvertisementManager> ();
     _analyticManager      = GetComponent <AnalyticsManager> ();
     _cameraManager        = GetComponent <CameraManager> ();
     _gridManager          = GetComponent <GridManager> ();
     _spawnManager         = GetComponent <SpawnManager> ();
     _colorManager         = GetComponent <ColorManager> ();
 }
Beispiel #31
0
    private static void AdvertisementDefaults(AdvertisementManager ads, string tab)
    {
        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Advertisement -> Preferences", EditorStyles.boldLabel);

        string[] adsList = new string[]
        {
            "Banner",
            "Interstitial",
            "PopUp",
            "Video",
            "Widget"
        };

        foreach (string adList in adsList)
        {
            if (GUILayout.Button(adList))
            {
                ads.curListAds       = adList;
                ads.curPreferenceAds = "";
                ads.curEditorAds     = "";
            }

            if (ads.curListAds == adList)
            {
                if (adList == "Banner")
                {
                    AdvertisementPreferencesBanner(ads);
                }
                else if (adList == "Interstitial")
                {
                    AdvertisementPreferencesInterstitial(ads);
                }
                else if (adList == "PopUp")
                {
                    AdvertisementPreferencesPopUp(ads);
                }
                else if (adList == "Video")
                {
                    AdvertisementPreferencesVideo(ads);
                }
                else if (adList == "Widget")
                {
                    AdvertisementPreferencesWidget(ads);
                }
            }
        }
    }
Beispiel #32
0
    void Start()
    {
        instances++;

        if (instances > 1)
        {
            Debug.LogWarning("There are more than one AdvertisementManager");
        }
        else
        {
            _instance = this;
        }

        // StartAds();
    }
Beispiel #33
0
    void Awake()
    {
        _gameManager          = GetComponent <GameManager>();
        _uiManager            = GetComponent <UIManager>();
        _audioManager         = GetComponent <AudioManager>();
        _scoreManager         = GetComponent <ScoreManager> ();
        _inputManager         = GetComponent <PlayerInputManager> ();
        _advertisementManager = GetComponent <AdvertisementManager> ();
        _analyticManager      = GetComponent <AnalyticsManager> ();
        _cameraManager        = GetComponent <CameraManager> ();
        _spawnManager         = GetComponent <SpawnManager> ();
        _difficultyManager    = GetComponent <DifficultyManager>();

        DontDestroyOnLoad(gameObject);
    }
	private static void AdvertisementAdColony(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "AdColony"))
			return;
		
		EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);
		
		ads.adcolony.ios = EditorGUILayout.TextField(tab + "App ID", ads.adcolony.ios);
		ads.adcolony_zoneid.ios = EditorGUILayout.TextField(tab + "Secret", ads.adcolony_zoneid.ios);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.adcolony.android = EditorGUILayout.TextField(tab + "App ID", ads.adcolony.android);
		ads.adcolony_zoneid.android = EditorGUILayout.TextField(tab + "Secret", ads.adcolony_zoneid.android);
	}
	public override void fetchBanner(AdvertisementManager.Positions pos)
	{
		try
		{
			base.fetchBanner(pos);
			
			if (Info.IsEditor() || !Info.IsPlatform(Info.Platform.iPhone) || (firstTime && !Setup()))
				return;
			
			#if UNITY_IPHONE
				on_bottom = pos == AdvertisementManager.Positions.BOTTOM;
			#endif
		}
		catch
		{
			Error(API, ERROR_LOADING_BANNER);
		}
	}
	/*private static void AdvertisementTapGage(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "TapGage"))
			return;
		
		ads.tapgage = EditorGUILayout.TextField("Key", ads.tapgage);
	}*/
	
	private static void AdvertisementPlayHaven(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "PlayHaven"))
			return;
		
		EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);
		
		ads.playhaven_inters.ios = EditorGUILayout.TextField(tab + "Placement Tag", ads.playhaven_inters.ios);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.playhaven_inters.android = EditorGUILayout.TextField(tab + "Placement Tag", ads.playhaven_inters.android);
	}
	// Obtem o banner
	public static void fetchBanner(AdvertisementManager.Positions pos)
	{
		if (!AdvertisementManager.isEnabled())
			return;
		
		if (Info.IsEditor() || AdvertisementManager.manager.banner == null)
		{
			if (Info.IsEditor()) return;	
		}
		
		foreach (AdvertisementBase ad in AdvertisementManager.manager.banner)
			ad.fetchBanner(pos);
	}
	protected void loadDefault(List<AdvertisementBase> list, AdvertisementManager.Apps ad)
	{
		if (list != null)
			return;
		
		list = new List<AdvertisementBase>(1);
		AdvertisementBase adsb = fromString(ad.value, ADS_TYPE_NONE);
		
		if (adsb != null)
			list.Add(adsb);
	}
	private static void AdvertisementPreferencesWidget(AdvertisementManager ads)
	{
		EditorGUILayout.LabelField("Enabled", EditorStyles.miniBoldLabel);
		for (int i = 0; i < ads.default_on_widgets.Length; i++)
		{
			if (GUILayout.Button(ads.default_on_widgets[i], EditorStyles.miniButton))
				ads.curPreferenceAds = ads.default_on_widgets[i];
		}
		
		EditorGUILayout.LabelField("Disabled", EditorStyles.miniBoldLabel);
		for (int i = 0; i < ads.default_off_widgets.Length; i++)
		{
			if (GUILayout.Button(ads.default_off_widgets[i], EditorStyles.miniButton))
				ads.curPreferenceAds = ads.default_off_widgets[i];
		}
		
		EditorGUILayout.Space();
		EditorGUILayout.Space();
		
		if (ads.default_on_widgets.Length + ads.default_off_widgets.Length != 3)
		{
			ads.default_off_widgets =
				new string[]
				{
					"RevMob",
					//"TapGage",
					"PlayHaven"
				};
			ads.default_on_widgets =
				new string[] {};
		}
		
		EditorGUILayout.LabelField("Selected", EditorStyles.miniBoldLabel);
		EditorGUILayout.LabelField(ads.curPreferenceAds.IsEmpty() ? "None" : ads.curPreferenceAds, EditorStyles.toolbarButton);
		EditorGUILayout.LabelField("Manage", EditorStyles.miniBoldLabel);
		if (GUILayout.Button("Move Up", EditorStyles.miniButton))
		{
			List<string> tmp = ads.default_on_widgets.ToList();
			int index = tmp.IndexOf(ads.curPreferenceAds);
			if (index >= 0)
			{
				if (index > 0 && index < tmp.Count)
				{
					tmp.ChangeIndex(ads.curPreferenceAds, index - 1);
					ads.default_on_widgets = tmp.ToArray();
				}
			}
			else
			{
				tmp = ads.default_off_widgets.ToList();
				tmp.Remove(ads.curPreferenceAds);
				ads.default_off_widgets = tmp.ToArray();
				
				tmp = ads.default_on_widgets.ToList();
				tmp.Add(ads.curPreferenceAds);
				ads.default_on_widgets = tmp.ToArray();
			}
			
		}
		
		if (GUILayout.Button("Move Down", EditorStyles.miniButton))
		{
			List<string> tmp = ads.default_on_widgets.ToList();
			int index = tmp.IndexOf(ads.curPreferenceAds);
		
			if (index >= 0 && index < tmp.Count)
			{
				if (index + 1 >= tmp.Count)
				{
					tmp.Remove(ads.curPreferenceAds);
					ads.default_on_widgets = tmp.ToArray();
					tmp = ads.default_off_widgets.ToList();
					tmp.Add(ads.curPreferenceAds);
					ads.default_off_widgets = tmp.ToArray();
				}
				else
				{
					tmp.ChangeIndex(ads.curPreferenceAds, index + 1);
					ads.default_on_widgets = tmp.ToArray();
				}
			}
		}
		
		EditorGUILayout.Space();
	}
	public override void fetchBanner(AdvertisementManager.Positions pos)
	{
		try
		{
			base.fetchBanner(pos);
			
			if (Info.IsEditor() || (firstTime && !Setup()))
				return;
			
			#if UNITY_ANDROID
				placement = (pos == AdvertisementManager.Positions.BOTTOM)
					? AdMobAdPlacement.BottomCenter
					: AdMobAdPlacement.TopCenter;
			#endif
		}
		catch
		{
			Error(API, ERROR_LOADING_BANNER);
		}
	}
	// Obtem o banner
	public virtual void fetchBanner(AdvertisementManager.Positions pos)
	{
	}
	private static void AdvertisementAdMob(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "AdMob"))
			return;
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.admob = EditorGUILayout.TextField(tab + "Publisher ID", ads.admob);
		
		EditorGUILayout.Space();
		EditorGUILayout.LabelField(tab + "Mediation", EditorStyles.miniBoldLabel);
		
		ads.adbmob_inters = EditorGUILayout.TextField(tab.Multiply(2) + "Interstitial", ads.adbmob_inters);
	}
	private static void AdvertisementFlurry(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "Flurry"))
			return;
		
		EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);
		
		ads.flurry.ios = EditorGUILayout.TextField(tab + "API Key", ads.flurry.ios);
		
		EditorGUILayout.Space();
		EditorGUILayout.LabelField(tab + "Ad Space", EditorStyles.miniBoldLabel);
		
		ads.flurry_banner.ios = EditorGUILayout.TextField(tab.Multiply(2) + "Banner", ads.flurry_banner.ios);
		ads.flurry_inters.ios = EditorGUILayout.TextField(tab.Multiply(2) + "Interstitial", ads.flurry_inters.ios);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.flurry.android = EditorGUILayout.TextField(tab + "API Key", ads.flurry.android);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField(tab + "Ad Space", EditorStyles.miniBoldLabel);
		
		ads.flurry_banner.android = EditorGUILayout.TextField(tab.Multiply(2) + "Banner", ads.flurry_banner.android);
		ads.flurry_inters.android = EditorGUILayout.TextField(tab.Multiply(2) + "Interstitial", ads.flurry_inters.android);
	}
	private static void AdvertisementDefaults(AdvertisementManager ads, string tab)
	{
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Advertisement -> Preferences", EditorStyles.boldLabel);
		
		string[] adsList = new string[]
		{
			"Banner",
			"Interstitial",
			"PopUp",
			"Video",
			"Widget"
		};
		
		foreach(string adList in adsList)
		{
			if (GUILayout.Button(adList))
			{
				ads.curListAds = adList;
				ads.curPreferenceAds = "";
				ads.curEditorAds = "";
			}
			
			if (ads.curListAds == adList)
			{
				if (adList == "Banner")
					AdvertisementPreferencesBanner(ads);
				else if (adList == "Interstitial")
					AdvertisementPreferencesInterstitial(ads);
				else if (adList == "PopUp")
					AdvertisementPreferencesPopUp(ads);
				else if (adList == "Video")
					AdvertisementPreferencesVideo(ads);
				else if (adList == "Widget")
					AdvertisementPreferencesWidget(ads);
			}
		}
	}
	public override void fetchBanner(AdvertisementManager.Positions pos)
	{
		try
		{
			base.fetchBanner(pos);
			
			if (Info.IsEditor() || (firstTime && !Setup()))
				return;
			
			#if UNITY_IPHONE
				ScreenOrientation or;
				
				if (pos == AdvertisementManager.Positions.BOTTOM) or = Screen.orientation;
				else
				{
					switch (Screen.orientation)
					{
						case ScreenOrientation.Portrait: or = ScreenOrientation.PortraitUpsideDown; break;
						case ScreenOrientation.PortraitUpsideDown: or = ScreenOrientation.Portrait; break;
						case ScreenOrientation.LandscapeLeft: or = ScreenOrientation.LandscapeRight; break;
						case ScreenOrientation.LandscapeRight: or = ScreenOrientation.LandscapeLeft; break;
						default: or = ScreenOrientation.PortraitUpsideDown; break;
					}
				}
				
				ScreenOrientation[] ors = new ScreenOrientation[1] {or};
				
				banner = instance.CreateBanner(null, ors);
			#endif
		}
		catch
		{
			Error(API, ERROR_LOADING_BANNER);
		}
	}
	private static void AdvertisementRevMob(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "RevMob"))
			return;
		
		EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);
		
		ads.revmob.ios = EditorGUILayout.TextField(tab + "App ID", ads.revmob.ios);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.revmob.android = EditorGUILayout.TextField(tab + "App ID", ads.revmob.android);
	}
	private static void AdvertisementVungle(AdvertisementManager ads, string tab)
	{
		if (!SwitcherButton(ads, "Vungle"))
			return;
		
		EditorGUILayout.LabelField("Apple", EditorStyles.miniBoldLabel);
		
		ads.vungle.ios = EditorGUILayout.TextField(tab + "App ID", ads.vungle.ios);
		
		EditorGUILayout.Space();
		
		EditorGUILayout.LabelField("Android", EditorStyles.miniBoldLabel);
		
		ads.vungle.android = EditorGUILayout.TextField(tab + "App ID", ads.vungle.android);
		
		if (GUILayout.Button(""))
			ads.curEditorAds = "";
	}