Exemplo n.º 1
0
        /// <summary>
        /// Payments the API finish.
        /// </summary>
        public void PaymentApiFinish()
        {
            if (GetUserApi._httpCatchData.result.is_auto_renewable == "true")
            {
                CommonConstants.IS_PREMIUM = true;
                //とりあえず、アイモバイルの広告全ストップ。
                IMobileSdkAdsUnityPlugin.stop();
                string spotId = "";
                if (CommonConstants.IS_AD_TEST == true)
                {
                    spotId = CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID;
                    //インタースティシャル広告
                    IMobileSdkAdsUnityPlugin.stop(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);
                }
                else
                {
                    spotId = CommonConstants.IMOBILE_BANNER_SPOT_ID;
                    //インタースティシャル広告
                    IMobileSdkAdsUnityPlugin.stop(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);
                }

                _nendAdBanner.Pause();
                _nendAdBanner.Hide();

                IMobileSdkAdsUnityPlugin.stop(spotId);
                SceneHandleManager.NextSceneRedirect(CommonConstants.MYPAGE_SCENE);
            }
        }
Exemplo n.º 2
0
    void Start()
    {
        adInfo = manager.SPAds.Find(ad => ad.SceneName == "IconScene");

        // 初回のみResister(),Start(),Show()を呼び、
        // 2度目以降は、SetVisibility()を使用してください
        if (adInfo.AdViewId == null)
        {
            IMobileSdkAdsUnityPlugin.registerInline(adInfo.TestPID, adInfo.TestMID, adInfo.TestSID);
            IMobileSdkAdsUnityPlugin.start(adInfo.TestSID);
            var iconParam = new IMobileIconParams();
            iconParam.iconNumber      = 5;
            iconParam.iconSize        = 52;
            iconParam.iconTitleEnable = false;
            adInfo.AdViewId           = IMobileSdkAdsUnityPlugin.show(adInfo.TestSID,
                                                                      IMobileSdkAdsUnityPlugin.AdType.ICON,
                                                                      IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                                      IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE,
                                                                      iconParam);
        }
        else
        {
            IMobileSdkAdsUnityPlugin.setVisibility(adInfo.AdViewId.Value, true);
        }
    }
        /// <summary>
        /// Chats the back button.
        /// Event設定用。
        /// </summary>
        public void ChatBackButton()
        {
            if (PanelFooterButtonManager.Instance != null)
            {
                PanelFooterButtonManager.Instance.gameObject.SetActive(true);
            }

            BackButton(_panelChat.gameObject);
            _panelChat.GetComponent <BoxCollider2D> ().enabled = true;

            _panelChat.GetComponent <PanelChat> ()._listUpdateDisable = true;


            if (_panelProfile.localScale.x != 0)
            {
                PanelPopupCloseAnimate(_panelProfile.gameObject);
                _panelProfile.GetComponent <BoxCollider2D> ().enabled = true;
            }

            //_panelEazyNotifyInfiniteScroll.Init ("");
            NativeReadCheck();
            HeaderTab1();
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
            if (GetUserApi._httpCatchData.result.review == "false" && CommonConstants.IS_PREMIUM == false)
            {
                IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_FULL_SPOT_ID);
            }
#endif
        }
	/// <summary>
	/// 広告の表示領域を返します
	/// </summary>
	/// <returns>広告の表示領域</returns>
	/// <param name="left">Left</param>
	/// <param name="top">Top</param>
	/// <param name="adType">AdType</param>
	/// <param name="iconParams">IMobileIconParams</param>
	internal static Rect getAdRect(int left, int top, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
		iconParams = iconParams ?? new IMobileIconParams ();
		Rect adRect = new Rect ();
		adRect.width = getWidth (adType, iconParams);
		adRect.height = getHeight (adType, iconParams);
		adRect.x = left;
		adRect.y = top;
		return adRect;
	}
Exemplo n.º 5
0
    // Use this for initialization
    void Awake()
    {
#if UNITY_IPHONE || UNITY_ANDROID
        IMobileSdkAdsUnityPlugin.registerFullScreen(partnerID, mediaID, spotID);
        IMobileSdkAdsUnityPlugin.start(spotID);
        IMobileSdkAdsUnityPlugin.addObserver(gameObject.name);
        adViewId = IMobileSdkAdsUnityPlugin.show(spotID, IMobileSdkAdsUnityPlugin.AdType.BANNER, IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER, IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM);
#endif
    }
Exemplo n.º 6
0
 void OnGUI()
 {
     // TopSceneに戻る前に、SetVisibility()を使用して広告を非表示にします
     if (manager.AddBackButton())
     {
         IMobileSdkAdsUnityPlugin.setVisibility(adInfo.AdViewId.Value, false);
         Application.LoadLevel(manager.HomeSceneName);
     }
 }
        /// <summary>
        /// Histories the list close event.
        /// イベント設定用に
        /// </summary>
        /// <returns>The list close event.</returns>
        void HistoryListCloseEvent()
        {
            HistoryListClose(_paneHistory);
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
            if (GetUserApi._httpCatchData.result.review == "false" && CommonConstants.IS_PREMIUM == false)
            {
                IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_FULL_SPOT_ID);
            }
#endif
        }
    // Use this for initialization
    void Start()
    {
        // SetScreenOrientation
        Screen.autorotateToPortrait           = true;
        Screen.autorotateToLandscapeLeft      = false;
        Screen.autorotateToLandscapeRight     = false;
        Screen.autorotateToPortraitUpsideDown = false;

        IMobileSdkAdsUnityPlugin.setTestMode(true);
    }
Exemplo n.º 9
0
        /// <summary>
        /// Profiles the back button.
        /// Eventセット用
        /// </summary>
        public void ProfileBackButton()
        {
            HeaderPanel.Instance.BackButtonSwitch(false, null, LocalMsgConst.TITLE_SEARCH);

            ProfileClose(_panelProfile.gameObject);
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
            if (GetUserApi._httpCatchData.result.review == "false" && CommonConstants.IS_PREMIUM == false)
            {
                IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_FULL_SPOT_ID);
            }
#endif
        }
Exemplo n.º 10
0
    void Start()
    {
        adInfo = manager.SPAds.Find(ad => ad.SceneName == "TextPopupScene");

        // 初回のみResister(),Start()を呼びます。
        // 2度目以降と区別するため、AdViewIdに0を設定します
        if (adInfo.AdViewId == null)
        {
            IMobileSdkAdsUnityPlugin.registerFullScreen(adInfo.TestPID, adInfo.TestMID, adInfo.TestSID);
            IMobileSdkAdsUnityPlugin.start(adInfo.TestSID);
            adInfo.AdViewId = 0;
        }
    }
    public static void sendClick(string recieverGameObjectName, int adViewId, int nativeAdObjectIndex)
    {
#if UNITY_IPHONE && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            IMobileSdkAdsUnityPlugin.sendClick(adViewId, nativeAdObjectIndex);
        }
#elif UNITY_ANDROID && !UNITY_EDITOR
        if (Application.platform == RuntimePlatform.Android)
        {
            IMobileSdkAdsUnityPlugin.getAndroidClass().CallStatic("onClickNativeAd", recieverGameObjectName, nativeAdObjectIndex);
        }
#endif
    }
Exemplo n.º 12
0
    void OnGUI()
    {
        if (manager.AdAdShowButton(adInfo.DisplayName + "広告を表示します"))
        {
            // Show()を呼び、広告を表示します
            IMobileSdkAdsUnityPlugin.show(adInfo.TestSID);
        }

        if (manager.AddBackButton())
        {
            // TopSceneに戻ります
            Application.LoadLevel(manager.HomeSceneName);
        }
    }
		/// <summary>
		/// 広告の表示領域を返します
		/// </summary>
		/// <returns>広告の表示領域</returns>
		/// <param name="alignPosition">AdAlignPosition</param>
		/// <param name="valignPosition">AdValignPosition</param>
		/// <param name="adType">AdType</param>
		/// <param name="iconParams">IMobileIconParams</param>
		/// <param name="sizeAdjust">sizeAdjust</param>
		internal static Rect getAdRect(IMobileSdkAdsUnityPlugin.AdAlignPosition alignPosition, IMobileSdkAdsUnityPlugin.AdValignPosition valignPosition, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams, bool sizeAdjust)
		{
			// スクリーンの論理サイズを取得
			int screenWidth = 0;
			int screenHeight = 0;

			#if UNITY_IPHONE && !UNITY_EDITOR
			screenWidth = getScreenWidth_(isScreenPortrait());
			screenHeight = getScreenHeight_(isScreenPortrait());
			#elif UNITY_ANDROID && !UNITY_EDITOR
			screenWidth = getDensitySize (Screen.width);
			screenHeight = getDensitySize (Screen.height);
			#endif

			// 広告の表示位置を計算
			int left = 0;
			int top = 0;

			// 広告サイズを取得
			iconParams = iconParams ?? new IMobileIconParams ();
			CGSize adSize = getAdSize (adType, iconParams, sizeAdjust);

			// x座標の取得
			switch (alignPosition) {
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.LEFT:
					left = 0;
					break;
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER:
					left = (screenWidth - adSize.width) / 2;
					break;
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.RIGHT:
					left = screenWidth - adSize.width;
					break;
			}

			// y座標の取得
			switch (valignPosition) {
				case IMobileSdkAdsUnityPlugin.AdValignPosition.TOP:
					top = 0;
					break;
				case IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE:
					top = (screenHeight / 2) - (adSize.height / 2);
					break;
				case IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM:
					top = screenHeight - adSize.height;
					break;
			}

			return new Rect (left, top, adSize.width, adSize.height);
		}
Exemplo n.º 14
0
    public void ShowRectangle(DataManager.AD_TYPE _eAdType, bool _bDisp)
    {
        if (m_bAdDispRectangle == _bDisp)
        {
            return;
        }
        switch (_eAdType)
        {
        case DataManagerBase <DataManager> .AD_TYPE.NEND:
            if (_bDisp)
            {
                m_nendRectangle.Show();
            }
            else
            {
                m_nendRectangle.Hide();
            }
            break;

        case DataManagerBase <DataManager> .AD_TYPE.IMOBILE:
                        #if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                #if USE_IMOBILE
            if (_bDisp && m_iIMobileRectangle == 0)
            {
                // スポット情報を設定します
                IMobileSdkAdsUnityPlugin.registerInline(IMOBILE_BANNER_PID, IMOBILE_BANNER_MID, IMOBILE_BANNER_SID);
                // 広告の取得を開始します
                IMobileSdkAdsUnityPlugin.start(IMOBILE_BANNER_SID);
                // 広告の表示位置を指定して表示します(画面中央)
                m_iIMobileRectangle = IMobileSdkAdsUnityPlugin.show(IMOBILE_BANNER_SID,
                                                                    IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE,
                                                                    IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                                    IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE);
            }
            else
            {
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileRectangle, _bDisp);
            }
                #endif
                        #endif
            break;

        case DataManagerBase <DataManager> .AD_TYPE.MAX:
        default:
            break;
        }
        m_bAdDispRectangle = _bDisp;
        return;
    }
		/// <summary>
		/// 広告の表示領域を返します
		/// </summary>
		/// <returns>広告の表示領域</returns>
		/// <param name="alignPosition">AdAlignPosition</param>
		/// <param name="valignPosition">AdValignPosition</param>
		/// <param name="adType">AdType</param>
		/// <param name="iconParams">IMobileIconParams</param>
		internal static Rect getAdRect(IMobileSdkAdsUnityPlugin.AdAlignPosition alignPosition, IMobileSdkAdsUnityPlugin.AdValignPosition valignPosition, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){

			// スクリーンの論理サイズを取得
			int screenWidth = 0;
			int screenHeight = 0;

			#if UNITY_IPHONE
			screenWidth = getScreenWidth_();
			screenHeight = getScreenHeight_();
			#elif UNITY_ANDROID
			screenWidth = getDensitySize (Screen.width);
			screenHeight = getDensitySize (Screen.height);
			#endif

			// 広告の表示位置を計算
			int x = 0;
			int y = 0;

			// 広告サイズを取得
			CGSize adSize = getAdSize (adType, iconParams);

			// x座標の取得
			switch (alignPosition) {
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.LEFT:
					x = 0;
					break;
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER:
					x = (screenWidth - adSize.width) / 2;
					break;
				case IMobileSdkAdsUnityPlugin.AdAlignPosition.RIGHT:
					x = screenWidth - adSize.width;
					break;
			}

			// y座標の取得
			switch (valignPosition) {
				case IMobileSdkAdsUnityPlugin.AdValignPosition.TOP:
					y = 0;
					break;
				case IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE:
					y = (screenHeight / 2) - (adSize.height / 2);
					break;
				case IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM:
					y = screenHeight - adSize.height;
					break;
			}

			return getAdRect (x, y, adType, iconParams);
		}
Exemplo n.º 16
0
        /// <summary>
        /// Profiles to chat close event.
        /// Mypage専用イベント
        /// </summary>
        /// <returns>The to chat close event.</returns>
        public void ProfileToChatCloseEvent()
        {
            if (PanelFooterButtonManager.Instance != null)
            {
                PanelFooterButtonManager.Instance.gameObject.SetActive(true);
            }
            ProfileToChatClose(_panelChat);

#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
            if (GetUserApi._httpCatchData.result.review == "false" && CommonConstants.IS_PREMIUM == false)
            {
                IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_FULL_SPOT_ID);
            }
#endif
        }
 private static int getTop(IMobileSdkAdsUnityPlugin.AdValignPosition valignPosition, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
     int screenHeight = getDensitySize (Screen.height);
     int topPosition = 0;
     switch (valignPosition) {
     case IMobileSdkAdsUnityPlugin.AdValignPosition.TOP:
         topPosition = 0;
         break;
     case IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE:
         topPosition = (screenHeight / 2) - (getHeight(adType, iconParams) / 2);
         break;
     case IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM:
         topPosition = screenHeight - getHeight(adType, iconParams);
         break;
     }
     return topPosition;
 }
Exemplo n.º 18
0
    public void ShowIcon(DataManager.AD_TYPE _eAdType, bool _bDisp)
    {
        if (m_bAdDispIcon == _bDisp)
        {
            return;
        }

        switch (_eAdType)
        {
        case DataManagerBase <DataManager> .AD_TYPE.NEND:
                #if UNITY_ANDROID
            m_goNendNativePanel.SetActive(_bDisp);
                #elif UNITY_IPHONE
            m_goNendNativePanel.SetActive(_bDisp);
                #endif
            break;

        case DataManagerBase <DataManager> .AD_TYPE.IMOBILE:
                        #if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                        #if USE_IMOBILE
            if (m_iIMobileIcon == 0 && _bDisp)
            {
                // スポット情報を設定します
                IMobileSdkAdsUnityPlugin.registerInline(IMOBILE_ICON_PID, IMOBILE_ICON_MID, IMOBILE_ICON_SID);
                // 広告の取得を開始します
                IMobileSdkAdsUnityPlugin.start(IMOBILE_ICON_SID);
                // アイコン表示パラメータを作成します
                var iconParams = new IMobileIconParams();
                iconParams.iconNumber = 2;
                // 広告の表示位置を指定して表示します
                m_iIMobileIcon = IMobileSdkAdsUnityPlugin.show(IMOBILE_ICON_SID,
                                                               IMobileSdkAdsUnityPlugin.AdType.ICON,
                                                               IMobileSdkAdsUnityPlugin.AdAlignPosition.RIGHT,
                                                               IMobileSdkAdsUnityPlugin.AdValignPosition.TOP,
                                                               iconParams);
            }
            else
            {
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileIcon, _bDisp);
            }
                        #endif
                        #endif
            break;
        }
        m_bAdDispIcon = _bDisp;
    }
Exemplo n.º 19
0
    public void ShowBanner(DataManager.AD_TYPE _eAdType, bool _bDisp)
    {
        if (m_bAdDispBanner == _bDisp)
        {
            return;
        }
        switch (_eAdType)
        {
        case DataManagerBase <DataManager> .AD_TYPE.NEND:
            if (_bDisp)
            {
                m_nendBanner.Show();
            }
            else
            {
                m_nendBanner.Hide();
            }
            break;

        case DataManagerBase <DataManager> .AD_TYPE.IMOBILE:
                        #if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                        #if USE_IMOBILE
            if (m_iIMobileBanner == 0 && _bDisp)
            {
                // スポット情報を設定します

                IMobileSdkAdsUnityPlugin.registerInline(IMOBILE_BANNER_PID, IMOBILE_BANNER_MID, IMOBILE_BANNER_SID);
                // 広告の取得を開始します
                IMobileSdkAdsUnityPlugin.start(IMOBILE_BANNER_SID);
                // 広告の表示位置を指定して表示します(画面中央下)
                m_iIMobileBanner = IMobileSdkAdsUnityPlugin.show(IMOBILE_BANNER_SID,
                                                                 IMobileSdkAdsUnityPlugin.AdType.BANNER,
                                                                 IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                                 IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM);
            }
            else
            {
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileBanner, _bDisp);
            }
                        #endif
                        #endif
            break;
        }
        m_bAdDispBanner = _bDisp;
    }
 private static int getLeft(IMobileSdkAdsUnityPlugin.AdAlignPosition alignPosition, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
     int screenWidth = getDensitySize (Screen.width);
     int leftPosition = 0;
     switch (alignPosition) {
     case IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER:
         leftPosition = screenWidth - getWidth(adType, iconParams);
         if(leftPosition != 0) {
             leftPosition = leftPosition / 2;
         }
         break;
     case IMobileSdkAdsUnityPlugin.AdAlignPosition.LEFT:
         leftPosition = 0;
         break;
     case IMobileSdkAdsUnityPlugin.AdAlignPosition.RIGHT:
         leftPosition = screenWidth - getWidth(adType, iconParams);
         break;
     }
     return leftPosition;
 }
	private static int getWidth(IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
        int width = -1;
        switch (adType) {
        case IMobileSdkAdsUnityPlugin.AdType.BANNER:
            width = 320;
            break;
        case IMobileSdkAdsUnityPlugin.AdType.BIG_BANNER:
            width = 320;
            break;
		case IMobileSdkAdsUnityPlugin.AdType.TABLET_BANNER:
			width = 468;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.TABLET_BIG_BANNER:
			width = 728;
			break;
        case IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE:
            width = 300;
            break;
		case IMobileSdkAdsUnityPlugin.AdType.BIG_RECTANGLE:
			width = 336;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SKYSCRAPER:
			width = 120;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.WIDE_SKYSCRAPER:
			width = 160;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SQUARE:
			width = 250;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SMALL_SQUARE:
			width = 200;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.HALFPAGE:
			width = 300;
			break;
        case IMobileSdkAdsUnityPlugin.AdType.ICON:
            width = getIconAdWidth(iconParams);
            break;
        }

        return width;
    }
Exemplo n.º 22
0
    void Start()
    {
        adInfo = manager.SelectedAdInfo;

        // 初回のみResister(),Start(),Show()を呼び、
        // 2度目以降は、SetVisibility()を使用してください
        if (adInfo.AdViewId == null)
        {
            IMobileSdkAdsUnityPlugin.registerInline(adInfo.TestPID, adInfo.TestMID, adInfo.TestSID);
            IMobileSdkAdsUnityPlugin.start(adInfo.TestSID);
            adInfo.AdViewId = IMobileSdkAdsUnityPlugin.show(adInfo.TestSID,
                                                            adInfo.AdType.Value,
                                                            IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                            IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE);
        }
        else
        {
            IMobileSdkAdsUnityPlugin.setVisibility(adInfo.AdViewId.Value, true);
        }
    }
Exemplo n.º 23
0
    void Start()
    {
        adInfo = manager.SPAds.Find(ad => ad.SceneName == "BannerScene");

        // 初回のみResister(),Start(),Show()を呼び、
        // 2度目以降は、SetVisibility()を使用してください
        if (adInfo.AdViewId == null)
        {
            IMobileSdkAdsUnityPlugin.registerInline(adInfo.TestPID, adInfo.TestMID, adInfo.TestSID);
            IMobileSdkAdsUnityPlugin.start(adInfo.TestSID);
            adInfo.AdViewId = IMobileSdkAdsUnityPlugin.show(adInfo.TestSID,
                                                            IMobileSdkAdsUnityPlugin.AdType.BANNER,
                                                            IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                            IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE, true);
        }
        else
        {
            IMobileSdkAdsUnityPlugin.setVisibility(adInfo.AdViewId.Value, true);
        }
    }
Exemplo n.º 24
0
 void OnDisable()
 {
     if (!isDontDestroy)
     {
         IMobileNativeAdRecieverManager.RemoveRecieverFromDictionary(adViewId);
     }
     if (hasReceivedNativeAd)
     {
                     #if UNITY_IPHONE && !UNITY_EDITOR
         if (Application.platform == RuntimePlatform.IPhonePlayer)
         {
             IMobileSdkAdsUnityPlugin.destroyNativeAd(adViewId);
         }
                     #elif UNITY_ANDROID && !UNITY_EDITOR
         if (Application.platform == RuntimePlatform.Android)
         {
             IMobileSdkAdsUnityPlugin.getAndroidClass().CallStatic("destroyNativeAd", this.gameObject.name);
         }
                     #endif
     }
 }
Exemplo n.º 25
0
    public void ShowAdBanner(bool _bFlag)
    {
        if (_bFlag)
        {
            if (m_iIMobileBannerId == 0)
            {
                                #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
                IMobileSdkAdsUnityPlugin.registerInline(IMOBILE_PID, IMOBILE_MID, IMOBILE_SID_BANNER);

                // 広告の取得を開始します
                IMobileSdkAdsUnityPlugin.start(IMOBILE_SID_BANNER);
                // 広告の表示位置を指定して表示します(画面左下)
                m_iIMobileBannerId = (int)IMobileSdkAdsUnityPlugin.show(IMOBILE_SID_BANNER,
                                                                        IMobileSdkAdsUnityPlugin.AdType.BANNER,
                                                                        IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                                                                        IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM);
                                #else
                                #endif
            }
            else
            {
                                #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileBannerId, true);
                                #else
                                #endif
            }
        }
        else
        {
            if (m_iIMobileBannerId != 0)
            {
                                #if (UNITY_IPHONE || UNITY_ANDROID) && !UNITY_EDITOR
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileBannerId, false);
                                #else
                                #endif
            }
        }
    }
        /// <summary>
        /// Taps the this message.
        /// 自分と相手とのメッセージのやり取り.
        /// </summary>
        /// <param name="obj">Object.</param>
        public void TapThisMessage(GameObject obj)
        {
            if (_panelEazyNotifyInfiniteScroll.GetDisplayType() == "2")
            {
                HeaderPanel.Instance.BackButtonSwitch(false);
                HeaderPanel.Instance.BackButtonSwitch(true, InformationBackButton);
                _backSwipe.EventMessageTarget = _informationPanel.gameObject;

                if (obj != null)
                {
                    string id = obj.name;
                }

                if (_informationPanel != null)
                {
                    if (_informationPanel.GetComponent <uTweenPosition> ().from.x == 0)
                    {
                        _informationPanel.GetComponent <uTweenPosition> ().from = _informationPanel.GetComponent <uTweenPosition> ().to;
                    }

                    _informationPanel.GetComponent <uTweenPosition> ().to = Vector3.zero;
                    _informationPanel.GetComponent <uTweenPosition> ().ResetToBeginning();
                    _informationPanel.GetComponent <uTweenPosition> ().enabled = true;

                    // 初期化処理
                    _informationPanelScroll.GetComponent <PanelInformationInfiniteScroll> ().Init(obj.name);
                }
            }
            else
            {
                _userId = obj.name;

#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                if (GetUserApi._httpCatchData.result.review == "false")
                {
                    if (CommonConstants.IS_PREMIUM == false)
                    {
                        //動画広告が何もない場合はアイモバイル、インターステシャルを表示。
                        if (Maio.CanShow(CommonConstants.MAIO_ZONE_ID_1) == false)
                        {
                            if (AppStartLoadBalanceManager.m_NendAdFullBoard != null)
                            {
                                AppStartLoadBalanceManager.m_NendAdFullBoard.Load();
                                AppStartLoadBalanceManager.m_NendAdFullBoard.Show();
                            }
                        }
                        else
                        {
                            //サーバーにイベント通知用Api(インストール時に一回のみ) ----------------------
                            string commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME;

                            LocalFileHandler.Init(commonFileName);
                            string isMovieFlag = LocalFileHandler.GetString(LocalFileConstants.MOVIE_POPUP_SHOW);

                            if (string.IsNullOrEmpty(isMovieFlag) == true)
                            {
                                PanelPopupAnimate(_popupMovie);
                                return;
                            }
                            else
                            {
                                //問答無用で動画広告を表示
                                AppStartLoadBalanceManager._whereFromAds = MaioMovieSdkEvent.WhereFromAds.MessageList;
                                Maio.Show(CommonConstants.MAIO_ZONE_ID_1);
                                return;
                            }
                        }
                    }
                    else
                    {
                        //
                        IMobileSdkAdsUnityPlugin.stop();
                    }
                }
#endif
                //審査中のときは、広告を一切挟まないので下記、処理。
                HeaderPanel.Instance.BackButtonSwitch(false);
                HeaderPanel.Instance.BackButtonSwitch(true, ChatBackButton);
                _backSwipe.EventMessageTarget = _panelChat.gameObject;

                if (obj != null)
                {
                    string id = obj.name;
                }

                if (_panelChat != null)
                {
                    if (_panelChat.GetComponent <uTweenPosition> ().from.x == 0)
                    {
                        _panelChat.GetComponent <uTweenPosition> ().from = _panelChat.GetComponent <uTweenPosition> ().to;
                    }

                    _panelChat.GetComponent <uTweenPosition> ().to = Vector3.zero;
                    _panelChat.GetComponent <uTweenPosition> ().ResetToBeginning();
                    _panelChat.GetComponent <uTweenPosition> ().enabled = true;

                    // 初期化処理
                    _panelChat.GetComponent <PanelChat> ()._maxAfterID        = "";
                    _panelChat.GetComponent <PanelChat> ()._maxBeforeID       = "";
                    _panelChat.GetComponent <PanelChat> ()._maxAfterIDBackup  = "";
                    _panelChat.GetComponent <PanelChat> ()._maxBeforeIDBackup = "";
                    _panelChat.GetComponent <PanelChat> ()._listUpdateDisable = false;
                    _panelChat.GetComponent <PanelChat> ().Init(obj.name);
                }
            }
        }
Exemplo n.º 27
0
    public void ShowIcon(GameObject _goIcon, bool _bFlag)
    {
        string strSid = IMOBILE_SID_ICON;

        if (_bFlag)
        {
            if (m_iIMobileIconId == 0)
            {
                                #if UNITY_ANDROID  // && !UNITY_EDITOR
                IMobileSdkAdsUnityPlugin.registerInline(IMOBILE_PID, IMOBILE_MID, strSid);
                var iconParams = new IMobileIconParams();
                iconParams.iconNumber            = 2;         // アイコンの数を6個に
                iconParams.iconTitleFontColor    = "#000000"; // タイトルの色を黒に
                iconParams.iconTitleShadowEnable = false;     // タイトルの影を非表示に
                iconParams.iconTitleEnable       = false;

                // 広告の取得を開始します
                IMobileSdkAdsUnityPlugin.start(strSid);
                // 広告の表示位置を指定して表示します(画面左下)
                m_iIMobileIconId = (int)IMobileSdkAdsUnityPlugin.show(strSid,
                                                                      IMobileSdkAdsUnityPlugin.AdType.ICON,
                                                                      0, 90, iconParams);

                /*
                 * IMobileSdkAdsUnityPlugin.AdAlignPosition.LEFT,
                 * IMobileSdkAdsUnityPlugin.AdValignPosition.MIDDLE);
                 */
                                #else
                                #endif
            }
            else
            {
                                #if UNITY_ANDROID //&& !UNITY_EDITOR
                IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileIconId, true);
                                #else
                                #endif
            }
        }
        else
        {
                        #if UNITY_ANDROID //&& !UNITY_EDITOR
            IMobileSdkAdsUnityPlugin.setVisibility(m_iIMobileIconId, false);
                        #else
                        #endif
        }

        /*
         #if UNITY_ANDROID
         * NendAdIcon script = _goIcon.GetComponent<NendAdIcon> ();
         * if (script == null) {
         *      Debug.Log ("ShowIcon script=null! ");
         *
         * } else if (_bFlag) {
         *      Debug.Log ("Show Icon! ");
         *      script.Show ();
         *      script.Resume ();
         * } else {
         *      Debug.Log ("Hide Icon! ");
         *      script.Hide();
         *      script.Pause();
         * }
         #endif
         */
        return;
    }
Exemplo n.º 28
0
 public void ShowAd()
 {
     IMobileSdkAdsUnityPlugin.setVisibility(adViewId, true);
 }
Exemplo n.º 29
0
 public void HideAd()
 {
     IMobileSdkAdsUnityPlugin.setVisibility(adViewId, false);
 }
		private static CGSize getAdjustedAdSize(CGSize originalSize, bool sizeAdjust, IMobileSdkAdsUnityPlugin.AdType adType)
		{
			if (!sizeAdjust) {
				return originalSize;
			}

			int screenWidth = 0;
			int screenHeight = 0;
			
			#if UNITY_IPHONE && !UNITY_EDITOR
			screenWidth = getScreenWidth_(isScreenPortrait());
			screenHeight = getScreenHeight_(isScreenPortrait());
			#elif UNITY_ANDROID && !UNITY_EDITOR
			screenWidth = getDensitySize (Screen.width);
			screenHeight = getDensitySize (Screen.height);
			#endif

			screenWidth = Math.Min (screenWidth, screenHeight);
			int adjustedWidth = (adType == IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE) ? screenWidth - 20 : screenWidth; 
			int adjustedHeight = (int)Math.Round(originalSize.height * (double)adjustedWidth / (double)originalSize.width);

			return new CGSize (adjustedWidth, adjustedHeight);
		}
    /// <summary>
    /// Start this instance.
    /// </summary>
    IEnumerator Start()
    {
#if UNITY_IPHONE && !UNITY_EDITOR
        NotificationServices.RegisterForNotifications(
            NotificationType.Alert |
            NotificationType.Badge |
            NotificationType.Sound);

        // notification clear
        NativeRecieveManager.RemotePushClear();
#endif


        //ローディングアニメーション取得。
        _loadAnimation.SetActive(true);
        //アプリ全体で使用する変数をリセット。
        ResetStaticVariable();

        //仮登録API ----------------------
        new PreRegistUser();
        while (PreRegistUser._success == false)
        {
            yield return(PreRegistUser._success == true);
        }

        _userKey = PreRegistUser._httpCatchData.result.user.user_key;
        _gender  = PreRegistUser._httpCatchData.result.user.sex_cd;

        new GetUserApi();
        while (GetUserApi._success == false)
        {
            yield return(GetUserApi._success == true);
        }

        //-------------------------------- 広告用設定 初期化処理 ここから --------------------------------
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
        if (GetUserApi._httpCatchData.result.review == "false")
        {
            string nendNativeAdApiKey_IOS = "";
            string nendNativeAdSpotId_IOS = "";

            string nendNativeAdApiKey_Android = "";
            string nendNativeAdSpotId_Android = "";

            if (CommonConstants.IS_AD_TEST == true)
            {
                //Imobile Test mode
                IMobileSdkAdsUnityPlugin.setTestMode(true);

                //Maio test mode
                Maio.SetAdTestMode(true);

                //バナー広告用 テスト
                IMobileSdkAdsUnityPlugin.registerInline(
                    CommonConstants.IMOBILE_PARTNER_TEST_ID,
                    CommonConstants.IMOBILE_MDDIA_TEST_ID,
                    CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID
                    );

                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_TEST_ID,
                    CommonConstants.IMOBILE_MDDIA_TEST_ID,
                    CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID
                    );

                //スポット情報の取得処理
                //バナー広告用テスト
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID);

                //インタースティシャル広告テスト
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);

                //NEND IOS用 テスト
                nendNativeAdApiKey_IOS = CommonConstants.NEND_NATIVEAD_API_TEST_ID;
                nendNativeAdSpotId_IOS = CommonConstants.NEND_NATIVEAD_SPOT_TEST_ID;

                //NEND Android用 テスト
                nendNativeAdApiKey_Android = CommonConstants.NEND_NATIVEAD_API_TEST_ID;
                nendNativeAdSpotId_Android = CommonConstants.NEND_NATIVEAD_SPOT_TEST_ID;
            }
            else
            {
                // //バナー広告用
                IMobileSdkAdsUnityPlugin.registerInline(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_BANNER_SPOT_ID
                    );

                //インタースティシャル用
                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID
                    );

                //フル広告用
                IMobileSdkAdsUnityPlugin.registerFullScreen(
                    CommonConstants.IMOBILE_PARTNER_ID,
                    CommonConstants.IMOBILE_MDDIA_ID,
                    CommonConstants.IMOBILE_FULL_SPOT_ID
                    );

                //スポット情報の取得処理
                //インタースティシャル
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);

                //バナー
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_BANNER_SPOT_ID);

                //アイモバイル・フル広告用
                IMobileSdkAdsUnityPlugin.start(CommonConstants.IMOBILE_FULL_SPOT_ID);

                //NEND Native AD IOS
                nendNativeAdApiKey_IOS = CommonConstants.NEND_NATIVEAD_API_IOS_ID;
                nendNativeAdSpotId_IOS = CommonConstants.NEND_NATIVEAD_SPOT_IOS_ID;

                //NEND Native AD ANDROID
                nendNativeAdApiKey_Android = CommonConstants.NEND_NATIVEAD_API_ANDROID_ID;
                nendNativeAdSpotId_Android = CommonConstants.NEND_NATIVEAD_SPOT_ANDROID_ID;
            }



            //Nend Native Ad セットアップ処理。
                        #if UNITY_EDITOR
            // UnityEditorの場合は、広告枠のタイプを指定しテスト用の広告を使って表示の確認が行えます。
            m_NendAdClient    = NativeAdClientFactory.NewClient(NativeAdClientFactory.NativeAdType.SmallSquare);
            m_NendAdFullBoard = NendAdFullBoard.NewFullBoardAd(CommonConstants.NEND_NATIVEFULL_SPOT_IOS_ID, CommonConstants.NEND_NATIVEFULL_API_IOS_ID);
                        #elif UNITY_IPHONE
            m_NendAdClient    = NativeAdClientFactory.NewClient(nendNativeAdSpotId_IOS, nendNativeAdApiKey_IOS);
            m_NendAdFullBoard = NendAdFullBoard.NewFullBoardAd(CommonConstants.NEND_NATIVEFULL_SPOT_IOS_ID, CommonConstants.NEND_NATIVEFULL_API_IOS_ID);
                        #elif UNITY_ANDROID
            m_NendAdClient = NativeAdClientFactory.NewClient(nendNativeAdSpotId_Android, nendNativeAdApiKey_Android);
//m_NendAdFullBoard  = NativeAdClientFactory.NewClient (nendNativeAdSpotId_Android, nendNativeAdApiKey_Android);
                        #endif

            //バナー広告用。
            IMobileSdkAdsUnityPlugin.inlinieAdOrientation = IMobileSdkAdsUnityPlugin.ImobileSdkAdsInlineAdOrientation.PORTRAIT;


            //maio動画広告のクローズボタンが押された時のイベント処理。
            Maio.OnClosedAd += MaioMovieSdkEvent.OnClosed;

            //動画 広告用。
            Maio.Start(CommonConstants.MAIO_MEDIA_ID);

            NendAdBannerOrigenalManager.Instance.Init();
        }
#endif
//-------------------------------- 広告用設定 初期化処理 ここまで--------------------------------

        //メンテナンスの場合、処理を止める。
        if (AppliEventController.Instance.MaintenanceCheck() == true)
        {
            _loadAnimation.SetActive(false);
            yield break;
        }

        //ユーザーのステータスをチェックする処理。
        AppliEventController.Instance.UserStatusProblem();

        //強制アップデートの場合、処理を止める。
        if (AppliEventController.Instance.ForceUpdateCheck() == true)
        {
            _loadAnimation.SetActive(false);
            yield break;
        }

        //GPSを取得する処理。
        yield return(StartCoroutine(GpsSet()));

#if UNITY_IPHONE && !UNITY_EDITOR
        NativeRecieveManager.GetPushMessageIos();
#endif
        _tokenSent         = false;
        _toPushCatchUserId = "";

#if UNITY_ANDROID
        //ステータスバーを表示 //Android用
        ApplicationChrome.statusBarState = ApplicationChrome.States.VisibleOverContent;
#endif


        //基本プロフィールを作成しているかどうかの判定。
        if (string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.name) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.pref) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.city_id) == false &&
            string.IsNullOrEmpty(PreRegistUser._httpCatchData.result.user.birth_date) == false)
        {
            //基本プロフィールを作成している。
            _isBaseProfile = true;
        }
        else
        {
            //まだ、基本プロフィールを作成していない。
            _isBaseProfile = false;
        }

        //サーバーにイベント通知用Api(インストール時に一回のみ) ----------------------
        _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME;

        LocalFileHandler.Init(_commonFileName);

        //ファイルが作成されるまでポーリングして処理待ち
        while (System.IO.File.Exists(_commonFileName) == false)
        {
            yield return(System.IO.File.Exists(_commonFileName) == true);
        }

        //ここでユーザーキーを保存
        LocalFileHandler.SetString(LocalFileConstants.USER_KEY, _userKey);
        LocalFileHandler.Flush();

        //レビュー時、すれ違い機能は表示しないようにしておく。リスクヘッジ。


#if UNITY_ANDROID && !UNITY_EDITOR
        _deviceToken = GCMService.GetRegistrationId();

        //デバイストークンの登録API----------------------
        if (string.IsNullOrEmpty(_deviceToken) == false)
        {
            new SetDeviceToken(_userKey, _deviceToken);
            while (SetDeviceToken._success == false)
            {
                yield return(SetDeviceToken._success == true);
            }
        }
        else
        {
            GCMService.Registration();
        }
#endif

        //初期マスターデータの取得
        //ファイルネーム比較してマスター更新分があったら再度Api飛ばしてローカルデータを更新する
        new InitDataApi();
        while (InitDataApi._success == false)
        {
            yield return(InitDataApi._success == true);
        }

        //新着メッセージ未既読のAPI取得する
        new GetUnreadMessageCountApi();
        while (GetUnreadMessageCountApi._success == false)
        {
            yield return(GetUnreadMessageCountApi._success == true);
        }
        _msgBadge = GetUnreadMessageCountApi._httpCatchData.result.count;

        var user = PreRegistUser._httpCatchData.result.user;

        if (string.IsNullOrEmpty(user.pref) == false && string.IsNullOrEmpty(user.city_id) == false &&
            user.pref != "0" && user.city_id != "0")
        {
            if (PreRegistUser._httpCatchData.result.complete.Count > 0)
            {
                //Mypageシーンに遷移 - 遷移する前にログインボーナス表示
                string loginComplete = PreRegistUser._httpCatchData.result.complete [0];
                if (string.IsNullOrEmpty(loginComplete) == false)
                {
                    StartEventManager.Instance.PanelPopupAnimate(_loginBonus);
                    _loginBonus.transform.GetChild(0).localScale = new Vector3(1, 1, 1);
                    _loadAnimation.SetActive(false);
                    yield break;
                }
                else
                {
                    _loadAnimation.SetActive(false);
                    NextSceneProccess();
                    yield break;
                }
            }
            else
            {
                _loadAnimation.SetActive(false);
                NextSceneProccess();
                yield break;
            }
        }
        else
        {
            if (_gender != "0")
            {
                NextSceneProccess();
                yield break;
            }

#if !UNITY_EDITOR && UNITY_IPHONE
            //初回時に通る処理。 => ポップアップ
            //説明用ポップアップ。
            PopupSecondSelectPanel.Instance.PopMessageInsert(
                LocalMsgConst.SELF_SHARE_INFO_CONFIRM,
                LocalMsgConst.APPROVAL,
                LocalMsgConst.DENIAL,
                PublicUserInfoAllow,
                PublicUserInfoDeny
                );
            GameObject obj = GameObject.FindGameObjectWithTag(CommonConstants.POPUP_SECOND_SELECT_TAG);
            StartEventManager.Instance.PanelPopupAnimate(obj);
#endif

            if (string.IsNullOrEmpty(LocalFileHandler.GetString(LocalFileConstants.VALID_URL_KEY)) == true)
            {
                if (GetUserApi._httpCatchData.result.review == "false")
                {
                    new Valid(_userKey);
                    while (Valid._success == false)
                    {
                        yield return(Valid._success == true);
                    }

                    //start app installed. defaul browser open
                    if (string.IsNullOrEmpty(Valid._httpCatchData.result.url) == false)
                    {
                        //ローカルファイルにvalid_urlで保存 初回インストール時のみ通知するURLとする
                        LocalFileHandler.SetString(LocalFileConstants.VALID_URL_KEY, Valid._httpCatchData.result.url);
                        LocalFileHandler.Flush();
                        var uri = new System.Uri(Valid._httpCatchData.result.url);
                        Application.OpenURL(uri.AbsoluteUri);
                    }
                }
            }
            LocalFileHandler.HashAllClear();


            _startAnimation.GetComponent <uTweenPosition> ().enabled = true;
            _loadAnimation.SetActive(false);
        }
    }
		private static CGSize getAdSize(IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams, bool sizeAdjust)
		{
			CGSize adSize = new CGSize();

			switch (adType) {
			case IMobileSdkAdsUnityPlugin.AdType.BANNER:
				adSize = getAdjustedAdSize(new CGSize(320, 50), sizeAdjust, IMobileSdkAdsUnityPlugin.AdType.BANNER);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.BIG_BANNER:
				adSize = getAdjustedAdSize(new CGSize(320, 100), sizeAdjust, IMobileSdkAdsUnityPlugin.AdType.BIG_BANNER);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.TABLET_BANNER:
				adSize = new CGSize(468, 60);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.TABLET_BIG_BANNER:
				adSize = new CGSize(728, 90);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE:
				adSize = getAdjustedAdSize(new CGSize(300, 250), sizeAdjust, IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.BIG_RECTANGLE:
				adSize = new CGSize(336, 280);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.SKYSCRAPER:
				adSize = new CGSize(120, 600);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.WIDE_SKYSCRAPER:
				adSize = new CGSize(160, 600);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.SQUARE:
				adSize = new CGSize(250, 250);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.SMALL_SQUARE:
				adSize = new CGSize(200, 200);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.HALFPAGE:
				adSize = new CGSize(300, 600);
				break;
			case IMobileSdkAdsUnityPlugin.AdType.ICON:

				#if !UNITY_EDITOR
				int iconDefaultWidth = 57;			// アイコン1つあたりのデフォルトサイズ
				int iconMinimumWidth = 47;			// アイコン1つあたりの最小サイズ
				int iconDefaultMargin = 18;			// デフォルトアイコン間隔
				int iconMinimumMargin = 4;			// 最小アイコン間隔
				int iconAdTitleReserveSpace = 3;    // タイトル表示エリアの予備マージン

				// アイコン広告の表示サイズをアイコンパラメータから計算して求める
				int iconAdWidth = 0;
				int iconAdHeight = 0;

				// スクリーンの論理サイズを取得
				int screenWidth = 0;
				int screenHeight = 0;
				#endif

				#if UNITY_IPHONE && !UNITY_EDITOR
				screenWidth = getScreenWidth_(isScreenPortrait());
				screenHeight = getScreenHeight_(isScreenPortrait());

				// 幅を計算する
				if (iconParams.iconViewLayoutWidth > 0) {
					iconAdWidth = iconParams.iconViewLayoutWidth;
				} else {
					int iconWidth = (iconParams.iconSize > 0) ? Math.Max(iconParams.iconSize, iconMinimumWidth) : iconDefaultWidth;
					iconAdWidth =  (iconWidth + iconDefaultMargin) * 1;
				}
				
				// 高さを計算する
				// アイコン一つあたりの幅を計算
				int iconImageWidth = 0;
				if (iconParams.iconSize > 0) {
					iconImageWidth  = Math.Max(iconParams.iconSize, iconMinimumWidth);
				} else {
					if (iconAdWidth >= (iconDefaultWidth + iconDefaultMargin) * 1) {
						iconImageWidth = iconDefaultWidth;
					} else {
						iconImageWidth = iconMinimumWidth;
					}
				}
				
				// アイコンの表示間隔を取得(アイコン広告の表示サイス - アイコン一つあたりの幅 * アイコンの数) / アイコンの数 の結果と最低マージンとの比較で大きい方をマージンとして設定
				int iconImageMargin = Math.Max((int)Math.Ceiling((double)(iconAdWidth - iconImageWidth * 1) / 1) , iconMinimumMargin);

				#elif UNITY_ANDROID && !UNITY_EDITOR
				screenWidth = getDensitySize (Screen.width);
				screenHeight = getDensitySize (Screen.height);

				// 幅を計算する
				if (iconParams.iconViewLayoutWidth > 0) {
					iconAdWidth = iconParams.iconViewLayoutWidth;
				} else {
					if (iconParams.iconNumber < 4) {
						int iconWidth = (iconParams.iconSize > 0) ? Math.Max(iconParams.iconSize, iconMinimumWidth) : iconDefaultWidth;
						iconAdWidth =  (iconWidth + iconDefaultMargin) * iconParams.iconNumber;
					} else {
						iconAdWidth =  Math.Min(screenWidth, screenHeight);
					}
				}
				
				// 高さを計算する
				// アイコン一つあたりの幅を計算
				int iconImageWidth = 0;
				if (iconParams.iconSize > 0) {
					iconImageWidth  = Math.Max(iconParams.iconSize, iconMinimumWidth);
				} else {
					if (iconAdWidth >= (iconDefaultWidth + iconDefaultMargin) * iconParams.iconNumber) {
						iconImageWidth = iconDefaultWidth;
					} else {
						iconImageWidth = iconMinimumWidth;
					}
				}
				
				// アイコンの表示間隔を取得(アイコン広告の表示サイス - アイコン一つあたりの幅 * アイコンの数) / アイコンの数 の結果と最低マージンとの比較で大きい方をマージンとして設定
				int iconImageMargin = Math.Max((int)Math.Ceiling((double)(iconAdWidth - iconImageWidth * iconParams.iconNumber) / iconParams.iconNumber) , iconMinimumMargin);
				#endif


				#if !UNITY_EDITOR
				// 高さの取得
				if (!iconParams.iconTitleEnable) {
					iconAdHeight = iconImageWidth;
				} else {
					int iconTitleOffset = (iconParams.iconTitleOffset > 0) ? iconParams.iconTitleOffset : 4;
					int iconTitleFontSize = (iconParams.iconTitleFontSize > 0) ? Math.Max(iconParams.iconTitleFontSize, 8) : 10;
					int iconTitleShadowDy = (iconParams.iconTitleShadowEnable) ? iconParams.iconTitleShadowDy : 0;
					
					// タイトルが一行に収まるか計算
					if ((iconImageWidth + iconImageMargin) >= (iconDefaultWidth + iconDefaultMargin / 2)) {
						iconAdHeight = iconImageWidth + iconTitleOffset + iconTitleFontSize + iconTitleShadowDy + iconAdTitleReserveSpace;
					} else {
						iconAdHeight = iconImageWidth + iconTitleOffset + iconTitleFontSize * 2 + iconTitleShadowDy + iconAdTitleReserveSpace;
					}
				}
				adSize = new CGSize(iconAdWidth, iconAdHeight);
				#endif
				break;
			}
			return adSize;
		}
	/// <summary>
	/// 広告の表示領域を返します
	/// </summary>
	/// <returns>広告の表示領域</returns>
	/// <param name="alignPosition">AdAlignPosition</param>
	/// <param name="valignPosition">AdValignPosition</param>
	/// <param name="adType">AdType</param>
	/// <param name="iconParams">IMobileIconParams</param>
	internal static Rect getAdRect(IMobileSdkAdsUnityPlugin.AdAlignPosition alignPosition, IMobileSdkAdsUnityPlugin.AdValignPosition valignPosition, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
		int left = getLeft (alignPosition, adType, iconParams);
		int top = getTop (valignPosition, adType, iconParams);
		return getAdRect (left, top, adType, iconParams);
	}
	private static int getHeight(IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams){
		int height = -1;
		switch (adType) {
		case IMobileSdkAdsUnityPlugin.AdType.BANNER:
			height = 50;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.BIG_BANNER:
			height = 100;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.TABLET_BANNER:
			height = 60;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.TABLET_BIG_BANNER:
			height = 90;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.MEDIUM_RECTANGLE:
			height = 250;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.BIG_RECTANGLE:
			height = 280;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SKYSCRAPER:
			height = 600;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.WIDE_SKYSCRAPER:
			height = 600;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SQUARE:
			height = 250;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.SMALL_SQUARE:
			height = 200;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.HALFPAGE:
			height = 600;
			break;
		case IMobileSdkAdsUnityPlugin.AdType.ICON:
			height = getIconAdHeight(iconParams);
			break;
		}
		
		return height;
	}
Exemplo n.º 35
0
        /// <summary>
        /// Start this instance.
        /// </summary>
        IEnumerator Start()
        {
            _loadingOverlay.SetActive(true);
            // アンドロイドでバックグラウンドプッシュ?スプラッシュから?何かのタイミングで
            //static変数のデータが消え去ってしまうみたいなのでリカバー
            if (string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == true)
            {
                //サーバーにイベント通知用Api(インストール時に一回のみ) ----------------------
                string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME;

                LocalFileHandler.Init(_commonFileName);

                //ファイルが作成されるまでポーリングして処理待ち
                while (System.IO.File.Exists(_commonFileName) == false)
                {
                    yield return(System.IO.File.Exists(_commonFileName) == true);
                }

                //ここでユーザーキーを取得。
                AppStartLoadBalanceManager._userKey = LocalFileHandler.GetString(LocalFileConstants.USER_KEY);

#if UNITY_ANDROID
                //ステータスバーを表示 //Android用
                ApplicationChrome.statusBarState = ApplicationChrome.States.VisibleOverContent;
#endif
            }

            //ユーザーデータの取得。
            new GetUserApi();
            while (GetUserApi._success == false)
            {
                yield return(GetUserApi._success == true);
            }


            if (GetUserApi._httpCatchData.result.review == "false")
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
//有料会員か?
                if (CommonConstants.IS_PREMIUM == false)
                {
                    //_nendAdBanner.Show ();
                }
                else
                {
                    _nendAdBanner.Pause();
                    _nendAdBanner.Hide();
                    Destroy(_nendAdBanner.gameObject);
                }
#endif
            }

            //審査レビューじゃない場合のみ広告表示。
            if (GetUserApi._httpCatchData.result.review == "false")
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
                if (CommonConstants.IS_PREMIUM == false)
                {
                    // 広告の取得、表示処理
                    if (CommonConstants.IS_AD_TEST == true)
                    {
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);
                    }
                    else
                    {
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);
                    }
                }
                else
                {
                    IMobileSdkAdsUnityPlugin.stop();
                }
#endif
            }

            //性別が取得出来ていない場合の処理。
            if (GetUserApi._httpCatchData.result.user.sex_cd == "0")
            {
                PanelGenderSelectCommon.Instance.Init();  //性別選択のUIを表示。
                _loadingOverlay.SetActive(false);
                yield break;
            }

            AppStartLoadBalanceManager._gender = GetUserApi._httpCatchData.result.user.sex_cd;

            ///メンテナンスの場合、処理を止める。
            if (AppliEventController.Instance.MaintenanceCheck() == true)
            {
                _loadingOverlay.SetActive(false);
                yield break;
            }

            ///ユーザーのステータスをチェックする処理。
            AppliEventController.Instance.UserStatusProblem();

            ///強制アップデートの場合、処理を止める。
            if (AppliEventController.Instance.ForceUpdateCheck() == true)
            {
                _loadingOverlay.SetActive(false);
                yield break;
            }

            ///アプリポップアップレビューの立ち上げ処理。
            AppliEventController.Instance.AppliReview();


            //マスターデータの取得
            if (InitDataApi._httpCatchData == null)
            {
                new InitDataApi();
                while (InitDataApi._success == false)
                {
                    yield return(InitDataApi._success == true);
                }
            }

            //基本プロフィールを作成しているかどうかの判定。念の為、もう一回判定。
            if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.name) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.pref) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.city_id) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.birth_date) == false)
            {
                //基本プロフィールを作成している。
                AppStartLoadBalanceManager._isBaseProfile = true;
            }
            else
            {
                //まだ、基本プロフィールを作成していない。
                AppStartLoadBalanceManager._isBaseProfile = false;
            }

            LocalFileHandler.Init(LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME);
            if (LocalFileHandler.GetBool(LocalFileConstants.TUTORIAL_MATCHING_KEY) == false)
            {
                _tutorial.SetActive(true);
            }
            else
            {
                _tutorial.SetActive(false);
            }

            _isStart = true;
            _loadingOverlay.SetActive(false);
            yield break;
        }
        /// <summary>
        /// Start this instance.
        /// </summary>
        IEnumerator Start()
        {
            _coverOrProf  = CoverOrProfType.None;
            _time         = 0;
            _tmpText.text = LocalMsgConst.TITLE_MYPAGE;
            _loadingOverlay.SetActive(true);
            //アンドロイドでバックグラウンドプッシュ?スプラッシュから?何かのタイミングで
            //static変数のデータが消え去ってしまうみたいなのでリカバー
            if (string.IsNullOrEmpty(AppStartLoadBalanceManager._userKey) == true)
            {
                //サーバーにイベント通知用Api(インストール時に一回のみ) ----------------------
                string _commonFileName = LocalFileConstants.GetLocalFileDir() + LocalFileConstants.COMMON_LOCAL_FILE_NAME;

                LocalFileHandler.Init(_commonFileName);

                //ファイルが作成されるまでポーリングして処理待ち
                while (System.IO.File.Exists(_commonFileName) == false)
                {
                    yield return(System.IO.File.Exists(_commonFileName) == true);
                }

                //ここでユーザーキーを取得。
                AppStartLoadBalanceManager._userKey = LocalFileHandler.GetString(LocalFileConstants.USER_KEY);

#if UNITY_ANDROID
                //ステータスバーを表示 //Android用
                ApplicationChrome.statusBarState = ApplicationChrome.States.VisibleOverContent;
#endif
            }

            //ユーザーの取得。
            new GetUserApi();
            while (GetUserApi._success == false)
            {
                yield return(GetUserApi._success == true);
            }

            if (GetUserApi._httpCatchData.result.is_auto_renewable == "true")
            {
                CommonConstants.IS_PREMIUM = true;
            }
            else
            {
                CommonConstants.IS_PREMIUM = false;
            }
            PremiumPushPanel.Instance.Init();

            //性別が取得出来ていない場合の処理。
            if (GetUserApi._httpCatchData.result.user.sex_cd == "0")
            {
                PanelGenderSelectCommon.Instance.Init();  //性別選択のUIを表示。
                _loadingOverlay.SetActive(false);
                yield break;
            }

            AppStartLoadBalanceManager._gender = GetUserApi._httpCatchData.result.user.sex_cd;

            ///メンテナンスの場合、処理を止める。
            if (AppliEventController.Instance.MaintenanceCheck() == true)
            {
                _loadingOverlay.SetActive(false);
                yield break;
            }

            ///ユーザーのステータスをチェックする処理。
            AppliEventController.Instance.UserStatusProblem();

            ///強制アップデートの場合、処理を止める。
            if (AppliEventController.Instance.ForceUpdateCheck() == true)
            {
                _loadingOverlay.SetActive(false);
                yield break;
            }

            ///アプリポップアップレビューの立ち上げ処理。
            AppliEventController.Instance.AppliReview();

            //マスターデータの取得。
            if (InitDataApi._httpCatchData == null)
            {
                new InitDataApi();
                while (InitDataApi._success == false)
                {
                    yield return(InitDataApi._success == true);
                }
            }

            //基本プロフィールを作成しているかどうかの判定。念の為、もう一回判定。
            if (string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.name) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.pref) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.city_id) == false &&
                string.IsNullOrEmpty(GetUserApi._httpCatchData.result.user.birth_date) == false)
            {
                //基本プロフィールを作成している。
                AppStartLoadBalanceManager._isBaseProfile = true;
            }
            else
            {
                //まだ、基本プロフィールを作成していない。
                AppStartLoadBalanceManager._isBaseProfile = false;
            }

            //こっからプッシュ飛んできた時の処理。
            if (NotificationRecieveManager._isCatch == true)
            {
                switch (AppStartLoadBalanceManager._toScenePanel)
                {
                case CommonConstants.VIEW_HISTORY:
                    HeaderPanel.Instance.BackButtonSwitch(false);
                    HeaderPanel.Instance.BackButtonSwitch(true, HistoryListCloseEvent);
                    _tmpText.text = LocalMsgConst.TITLE_HISTORY;
                    PaneHistory.Instance.Init();
                    PanelAnimate(_paneHistory);
                    _paneHistory.GetComponent <BoxCollider2D> ().enabled = false;
                    break;
                }
                NotificationRecieveManager._isCatch = false;
                yield break;
            }

            //ヘッダーパネル初期化
            PanelStateManager.InitPanelSet();

            //データの初期化等
            DataInit();

            //シーンの最初に表示する箇所、初期化。
            PanelMypageMain.Instance.Init();


//審査レビューじゃない場合のみ広告表示。
            if (GetUserApi._httpCatchData.result.review == "false")
            {
#if UNITY_IPHONE || UNITY_ANDROID && !UNITY_EDITOR
//有料会員か?
                if (CommonConstants.IS_PREMIUM == false)
                {
// 広告の取得、表示処理

                    string spotId = "";
                    if (CommonConstants.IS_AD_TEST == true)
                    {
                        spotId = CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID;
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);
                    }
                    else
                    {
                        spotId = CommonConstants.IMOBILE_BANNER_SPOT_ID;
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.show(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);
                    }

                    if (AppStartLoadBalanceManager.m_NendAdFullBoard != null)
                    {
                        AppStartLoadBalanceManager.m_NendAdFullBoard.Load();
                        AppStartLoadBalanceManager.m_NendAdFullBoard.Show();
                    }
                    if (_isUnserBanner == false)
                    {
                        _imobileBannerViewId = IMobileSdkAdsUnityPlugin.show(
                            spotId,
                            IMobileSdkAdsUnityPlugin.AdType.BANNER,
                            IMobileSdkAdsUnityPlugin.AdAlignPosition.CENTER,
                            IMobileSdkAdsUnityPlugin.AdValignPosition.BOTTOM,
                            true
                            );
                        _isUnserBanner = true;
                    }

                    //_nendAdBanner.Show ();
                }
                else
                {
                    Debug.Log(" i-mobile LOG: => Start This is Premium");

                    string spotId = "";
                    if (CommonConstants.IS_AD_TEST == true)
                    {
                        spotId = CommonConstants.IMOBILE_BANNER_SPOT_TEST_ID;
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.stop(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_TEST_ID);
                    }
                    else
                    {
                        spotId = CommonConstants.IMOBILE_BANNER_SPOT_ID;
                        //インタースティシャル広告
                        IMobileSdkAdsUnityPlugin.stop(CommonConstants.IMOBILE_INTERSTATIAL_SPOT_ID);
                    }

                    //バナー広告隠す処理。
                    IMobileSdkAdsUnityPlugin.setVisibility(_imobileBannerViewId, false);

                    //有料会員のため、広告ストップ
                    IMobileSdkAdsUnityPlugin.stop(spotId);

                    _nendAdBanner.Pause();
                    _nendAdBanner.Hide();
                    Destroy(_nendAdBanner.gameObject);
                }
#endif
            }

            _loadingOverlay.SetActive(false);

            yield break;
        }
		/// <summary>
		/// 広告の表示領域を返します
		/// </summary>
		/// <returns>広告の表示領域</returns>
		/// <param name="left">Left</param>
		/// <param name="top">Top</param>
		/// <param name="adType">AdType</param>
		/// <param name="iconParams">IMobileIconParams</param>
		/// <param name="sizeAdjust">sizeAdjust</param>
		internal static Rect getAdRect(int left, int top, IMobileSdkAdsUnityPlugin.AdType adType, IMobileIconParams iconParams, bool sizeAdjust)
		{
			iconParams = iconParams ?? new IMobileIconParams ();
			CGSize adSize = getAdSize (adType, iconParams, sizeAdjust);
			return new Rect (left, top, adSize.width, adSize.height);
		}