Unity IOS常用代码控制源码 带测试场景
using UnityEngine;using System.Collections.Generic;
public class MobclixGUIManager : MonoBehaviour
{
void OnStart()
{
Screen.orientation = ScreenOrientation.LandscapeLeft;
}
void OnGUI()
{
float yPos = 5.0f;
float xPos = 20.0f;
float width = 210.0f;
float height = 40.0f;
float heightPlus = 45.0f;
if( GUI.Button( new Rect( xPos, yPos, width, height ), "Initialize Mobclix" ) )
{
MobclixBinding.start();
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Show Banner" ) )
{
MobclixBinding.showBanner();
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Hide Banner" ) )
{
MobclixBinding.hideBanner( true );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Request Full Screen Ad" ) )
{
MobclixBinding.requestFullScreenAd();
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Is Full Screen Ad Loaded?" ) )
{
Debug.Log( "is full screen ad ready? " + MobclixBinding.isFullScreenAdReady() );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Display Full Screen Ad" ) )
{
MobclixBinding.displayFullScreenAd();
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Request and Display Full Screen" ) )
{
MobclixBinding.requestAndDisplayFullScreenAd();
}
xPos = Screen.width - width - 20.0f;
yPos = 5.0f;
if( iPhoneSettings.generation != iPhoneGeneration.iPad1Gen )
{
if( GUI.Button( new Rect( xPos, yPos, width, height ), "320x50 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPhone_320x50, ( Screen.width - 320 ) / 2, 0 );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "320x250 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPhone_300x250, ( Screen.width - 300 ) / 2, 0 );
}
}
else
{
if( GUI.Button( new Rect( xPos, yPos, width, height ), "120x600 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPad_120x600, ( Screen.width - 120 ) / 2, 0 );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "468x60 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPad_468x60, 0, 0 );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "728x90 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPad_728x90, ( Screen.width - 728 ) / 2, 0 );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "300x250 Banner" ) )
{
MobclixBinding.createBanner( MobclixBannerType.iPad_300x250, ( Screen.width - 300 ) / 2, 0 );
}
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force Portrait Banner" ) )
{
MobclixBinding.rotateToOrientation( DeviceOrientation.Portrait );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force LandcapeLeft Banner" ) )
{
MobclixBinding.rotateToOrientation( DeviceOrientation.LandscapeLeft );
}
if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force LandcapeRight Banner" ) )
{
MobclixBinding.rotateToOrientation( DeviceOrientation.LandscapeRight );
}
}
}
{:5_424:}{:5_424:}{:5_424:}
膜拜中。。。。{:soso__7524161091986203637_5:}
也不能一竿子打死呀!{:soso__11174995096617402082_3:}
膜拜中。。。。{:soso__7524161091986203637_5:}
不错 不错 不错{:soso__3922851084632044791_6:}
也不能一竿子打死呀!{:soso__11174995096617402082_3:}
感谢楼主的无私分享!{:soso__11402694654016840197_7:} 学习了,谢谢分享 看看怎么实现的