找回密码
 立即注册
查看: 6336|回复: 95

[源码] Unity IOS常用代码控制源码 带测试场景

[复制链接]
发表于 2012-12-6 13:27 | 显示全部楼层 |阅读模式
资源信息 Asset Information
资源名称: Unity IOS常用代码控制源码 带测试场景 (发帖教程)
版本: (版本)
资源等级: 1
资源格式: .unitypackage (链接失效请点击帖子右下方举报通知管理员)
资源大小: 8MB (默认:MB)
下载地址: 链接:http://pan.baidu.com/s/1qXAxuFy 密码:lwcl (购买积分)
点击查看原图
美丽分割线
  1. using UnityEngine;
  2. using System.Collections.Generic;


  3. public class MobclixGUIManager : MonoBehaviour
  4. {
  5.     void OnStart()
  6.     {
  7.         Screen.orientation = ScreenOrientation.LandscapeLeft;
  8.     }
  9.    
  10.    
  11.     void OnGUI()
  12.     {
  13.         float yPos = 5.0f;
  14.         float xPos = 20.0f;
  15.         float width = 210.0f;
  16.         float height = 40.0f;
  17.         float heightPlus = 45.0f;
  18.         
  19.         
  20.         if( GUI.Button( new Rect( xPos, yPos, width, height ), "Initialize Mobclix" ) )
  21.         {
  22.             MobclixBinding.start();
  23.         }
  24.         
  25.         
  26.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Show Banner" ) )
  27.         {
  28.             MobclixBinding.showBanner();
  29.         }
  30.         
  31.         
  32.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Hide Banner" ) )
  33.         {
  34.             MobclixBinding.hideBanner( true );
  35.         }
  36.         
  37.         
  38.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Request Full Screen Ad" ) )
  39.         {
  40.             MobclixBinding.requestFullScreenAd();
  41.         }
  42.         
  43.         
  44.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Is Full Screen Ad Loaded?" ) )
  45.         {
  46.             Debug.Log( "is full screen ad ready? " + MobclixBinding.isFullScreenAdReady() );
  47.         }
  48.         
  49.         
  50.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Display Full Screen Ad" ) )
  51.         {
  52.             MobclixBinding.displayFullScreenAd();
  53.         }


  54.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Request and Display Full Screen" ) )
  55.         {
  56.             MobclixBinding.requestAndDisplayFullScreenAd();
  57.         }
  58.         
  59.         
  60.         xPos = Screen.width - width - 20.0f;
  61.         yPos = 5.0f;
  62.         
  63.         if( iPhoneSettings.generation != iPhoneGeneration.iPad1Gen )
  64.         {
  65.             if( GUI.Button( new Rect( xPos, yPos, width, height ), "320x50 Banner" ) )
  66.             {
  67.                 MobclixBinding.createBanner( MobclixBannerType.iPhone_320x50, ( Screen.width - 320 ) / 2, 0 );
  68.             }
  69.         
  70.             if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "320x250 Banner" ) )
  71.             {
  72.                 MobclixBinding.createBanner( MobclixBannerType.iPhone_300x250, ( Screen.width - 300 ) / 2, 0 );
  73.             }
  74.         }
  75.         else
  76.         {
  77.             if( GUI.Button( new Rect( xPos, yPos, width, height ), "120x600 Banner" ) )
  78.             {
  79.                 MobclixBinding.createBanner( MobclixBannerType.iPad_120x600, ( Screen.width - 120 ) / 2, 0 );
  80.             }
  81.             
  82.             
  83.             if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "468x60 Banner" ) )
  84.             {
  85.                 MobclixBinding.createBanner( MobclixBannerType.iPad_468x60, 0, 0 );
  86.             }
  87.             
  88.             
  89.             if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "728x90 Banner" ) )
  90.             {
  91.                 MobclixBinding.createBanner( MobclixBannerType.iPad_728x90, ( Screen.width - 728 ) / 2, 0 );
  92.             }
  93.             
  94.             
  95.             if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "300x250 Banner" ) )
  96.             {
  97.                 MobclixBinding.createBanner( MobclixBannerType.iPad_300x250, ( Screen.width - 300 ) / 2, 0 );
  98.             }
  99.         }
  100.         
  101.         
  102.         
  103.         
  104.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force Portrait Banner" ) )
  105.         {
  106.             MobclixBinding.rotateToOrientation( DeviceOrientation.Portrait );
  107.         }
  108.         
  109.         
  110.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force LandcapeLeft Banner" ) )
  111.         {
  112.             MobclixBinding.rotateToOrientation( DeviceOrientation.LandscapeLeft );
  113.         }
  114.         
  115.         
  116.         if( GUI.Button( new Rect( xPos, yPos += heightPlus, width, height ), "Force LandcapeRight Banner" ) )
  117.         {
  118.             MobclixBinding.rotateToOrientation( DeviceOrientation.LandscapeRight );
  119.         }
  120.     }


  121. }

复制代码

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

×

评分

参与人数 1鲜花 +1 收起 理由
ΦωΦ + 1 赞一个!

查看全部评分

发表于 2013-3-5 12:54 | 显示全部楼层
{:5_424:}{:5_424:}{:5_424:}
发表于 2013-3-20 12:13 | 显示全部楼层

膜拜中。。。。{:soso__7524161091986203637_5:}
发表于 2013-3-20 12:13 | 显示全部楼层

也不能一竿子打死呀!{:soso__11174995096617402082_3:}
发表于 2013-3-20 12:14 | 显示全部楼层

膜拜中。。。。{:soso__7524161091986203637_5:}
发表于 2013-3-20 12:15 | 显示全部楼层

不错 不错 不错{:soso__3922851084632044791_6:}
发表于 2013-3-20 19:24 | 显示全部楼层

也不能一竿子打死呀!{:soso__11174995096617402082_3:}
发表于 2013-4-4 23:50 | 显示全部楼层

感谢楼主的无私分享!{:soso__11402694654016840197_7:}
发表于 2013-5-10 16:29 | 显示全部楼层
学习了,谢谢分享
发表于 2013-6-5 13:44 | 显示全部楼层
看看怎么实现的
懒得打字嘛,点击右侧快捷回复 【右侧内容,后台自定义】
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Unity开发者联盟 ( 粤ICP备20003399号 )

GMT+8, 2024-4-30 19:11 , Processed in 0.136700 second(s), 36 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表