1. //
  2. // GuomobWallView.h
  3. // GuoMobWallSample
  4. //
  5. // Created by keyrun on 14-1-21.
  6. // Copyright (c) 2014年 AK. All rights reserved.
  7. //
  8.  
  9. #import <Foundation/Foundation.h>
  10. #import "GuoMobWallViewController.h"
  11.  
  12. @interface GuomobWallView : NSObject
  13.  
  14. @end
  1. //
  2. // GuomobWallView.m
  3. // GuoMobWallSample
  4. //
  5. // Created by keyrun on 14-1-21.
  6. // Copyright (c) 2014年 AK. All rights reserved.
  7. //
  8.  
  9. #import "GuomobWallView.h"
  10. #import "GuoMobWallViewController.h"
  11. static GuoMobWallViewController * guomobwall=nil;
  12. @implementation GuomobWallView
  13.  
  14. +(void)InitGuoMobWall:(NSString *)appkey updatetime:(int)updatetime modelname:(NSString *)name{
  15. if (!guomobwall) {
  16. guomobwall=[[GuoMobWallViewController alloc]initWithId:appkey Model:name];
  17. guomobwall.updatetime=updatetime;
  18. }
  19. }
  20. extern "C" void InitGuoMobWall(const char * appkey,int time,const char * ModelName)
  21. {
  22. [GuomobWallView InitGuoMobWall:[NSString stringWithUTF8String:appkey] updatetime:time modelname:[NSString stringWithUTF8String:ModelName]];
  23. }
  24. extern "C" void LoadGuoMobWall(int rotation,int screen)
  25. {
  26. if (guomobwall) {
  27. [guomobwall pushGuoMobWall:rotation Hscreen:screen];
  28. }
  29. }
  30. extern "C" void GuoMobWallSetOtherID(const char * OtherID)
  31. {
  32. if (guomobwall) {
  33. guomobwall.OtherID=[NSString stringWithUTF8String:OtherID];
  34. }
  35. }
  36. extern "C" void GuoMobWallSetStatusBar(int isStatusBarHidden)
  37. {
  38. if (guomobwall) {
  39. guomobwall.isStatusBarHidden=isStatusBarHidden;
  40. }
  41. }
  42. extern "C" int GuoMobWallreadpoint()
  43. {
  44. if (guomobwall) {
  45. int point=[guomobwall readPoint];
  46. return point;
  47. }
  48. return nil;
  49. }
  50. extern "C" void GuoMobWallwritepoint(int point)
  51. {
  52. if (guomobwall) {
  53. [guomobwall writePoint:point];
  54. }
  55. }
  56. extern "C" int GuoMobWallcheckpoint()
  57. {
  58. if (guomobwall) {
  59. int point=[guomobwall checkPoint];
  60. return point;
  61. }
  62. return nil;
  63. }
  64. extern "C" void GuoMobWallupdatepoint()
  65. {
  66. if (guomobwall) {
  67. [guomobwall updatePoint];//更新积分
  68. }
  69. }
  70. extern "C" void ReleaseGuoMobWall()
  71. {
  72. if(guomobwall!=nil)
  73. {
  74. [guomobwall release];
  75. guomobwall=nil;
  76. }
  77. }
  78. - (void)dealloc
  79. {
  80. if(guomobwall!=nil)
  81. {
  82. [guomobwall release];
  83. guomobwall=nil;
  84. }
  85. [super dealloc];
  86. }
  87. @end
  1. //
  2. // GuoMobWall.h
  3. // GuoMobWall
  4. //
  5. // Created by qq on 12-11-21.
  6. // Copyright (c) 2012年 AK. All rights reserved.
  7. //
  8. #import <UIKit/UIKit.h>
  9. #import <Foundation/Foundation.h>
  10.  
  11. @interface GuoMobWallViewController : UIViewController
  12.  
  13. - (id)initWithId:(NSString *)appKey Model:(NSString*)name;
  14. -(void)pushGuoMobWall:(BOOL)allow Hscreen:(BOOL)isHscreen;
  15. //查询积分
  16. - (int)checkPoint;
  17. //读取所有积分并清空
  18. - (int)readPoint;
  19. //追加积分
  20. - (void)writePoint:(int)writepoint;
  21. //刷新积分
  22. -(void)updatePoint;
  23.  
  24. @property(nonatomic)NSTimeInterval updatetime;//自动刷新积分的时间间隔
  25. @property(nonatomic)BOOL isStatusBarHidden;//积分墙是否显示状态栏
  26. @property(nonatomic,copy) NSString * OtherID;//使用积分服务器回调时候的可选参数
  27. @end

GuoMobWall.cs

  1. using UnityEngine;
  2. using System.Collections;
  3. using System.Runtime.InteropServices;
  4. public class GuoMobWall : MonoBehaviour {
  5.  
  6. // Use this for initialization
  7. void Start () {
  8.  
  9. }
  10.  
  11. // Update is called once per frame
  12. void Update () {
  13.  
  14. }
  15.  
  16. [DllImport("__Internal")]
  17. private static extern void InitGuoMobWall(string appkey,int updatetime,string ObjectName);
  18. [DllImport("__Internal")]
  19. private static extern void LoadGuoMobWall(int rotation,int screen);
  20. [DllImport("__Internal")]
  21. private static extern void GuoMobWallSetOtherID(string OtherID);
  22. [DllImport("__Internal")]
  23. private static extern void GuoMobWallSetStatusBar(int isStatusBarHidden);
  24. [DllImport("__Internal")]
  25. private static extern int GuoMobWallreadpoint();
  26. [DllImport("__Internal")]
  27. private static extern void GuoMobWallwritepoint(int point);
  28. [DllImport("__Internal")]
  29. private static extern int GuoMobWallcheckpoint();
  30. [DllImport("__Internal")]
  31. private static extern void GuoMobWallupdatepoint();
  32. [DllImport("__Internal")]
  33. private static extern void ReleaseGuoMobWall();
  34.  
  35. //初始化积分墙 参数: appkey:果盟广告密钥
  36.  
  37. //updatetime:设置自动刷新积分的时间间隔
  38. //******注:不设置该updatetime参数的话,SDK默认为20秒,自动刷新时间最小值为15******
  39. //******设置updatetime为0为不自动刷新,开发者自己去控制刷新******
  40.  
  41. //ObjectName: GMWallDelegate.cs脚本绑定的Object名称 比如 Main Camera
  42. public static void U3DInitGuoMobWall(string appkey,int updatetime,string ObjectName)
  43. {
  44.  
  45. if(Application.platform == RuntimePlatform.IPhonePlayer)
  46. {
  47. InitGuoMobWall(appkey,updatetime,ObjectName);
  48. }
  49. }
  50.  
  51. //加载积分墙 rotation:积分墙是否自适应旋转 1---旋转, 0---不旋转
  52. // screen:积分墙初始横竖屏状态 1---横屏, 0---竖屏
  53. public static void U3DLoadGuoMobWall(int rotation,int screen)
  54. {
  55. if(Application.platform == RuntimePlatform.IPhonePlayer)
  56. {
  57. LoadGuoMobWall(rotation,screen);
  58. }
  59. }
  60. public static void U3DGuoMobWallSetOtherID(string OtherID)
  61. {
  62. if(Application.platform == RuntimePlatform.IPhonePlayer)
  63. {
  64. GuoMobWallSetOtherID(OtherID);
  65. }
  66. }
  67. public static void U3DGuoMobWallSetStatusBar(int isStatusBarHidden)
  68. {
  69. if(Application.platform == RuntimePlatform.IPhonePlayer)
  70. {
  71. GuoMobWallSetStatusBar(isStatusBarHidden);
  72. }
  73. }
  74.  
  75. //读取积分,全部读取积分并且清零,返回整形的积分
  76. public static int U3DGuoMobWallreadpoint()
  77. {
  78. if(Application.platform == RuntimePlatform.IPhonePlayer)
  79. {
  80. return GuoMobWallreadpoint();
  81. }
  82. return ;
  83. }
  84.  
  85. //添加积分,减分参数请设置为负数
  86. public static void U3DGuoMobWallwritepoint(int point)
  87. {
  88. if(Application.platform == RuntimePlatform.IPhonePlayer)
  89. {
  90. GuoMobWallwritepoint(point);
  91. }
  92. }
  93.  
  94. //查询积分,不清零,返回整形的积分
  95. public static int U3DGuoMobWallcheckpoint()
  96. {
  97. if(Application.platform == RuntimePlatform.IPhonePlayer)
  98. {
  99. return GuoMobWallcheckpoint();
  100. }
  101. return ;
  102. }
  103.  
  104. //更新服务器已经完成任务但没有取走的积分
  105. public static void U3DGuoMobWallupdatepoint()
  106. {
  107. if(Application.platform == RuntimePlatform.IPhonePlayer)
  108. {
  109. GuoMobWallupdatepoint();
  110. }
  111. }
  112.  
  113. //释放积分墙,释放后会停止自动更新积分,释放后再次加载需要重新初始化积分墙
  114. public static void U3DReleaseGuoMobWall()
  115. {
  116. if(Application.platform == RuntimePlatform.IPhonePlayer)
  117. {
  118. ReleaseGuoMobWall();
  119. }
  120. }
  121.  
  122. }

GMWallDelegate.cs

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class GMWallDelegate : MonoBehaviour {
  5.  
  6. // Use this for initialization
  7. void Start () {
  8.  
  9. }
  10.  
  11. // Update is called once per frame
  12. void Update () {
  13.  
  14. }
  15.  
  16. //加载回调 表示加载成功
  17. void loadWallAdSuccess()
  18. {
  19. print("loadWallAdSuccess");
  20. }
  21.  
  22. //加载积分墙出错时候的回调 返回错误信息
  23. void GMWallDidFailWithError(string error){
  24. print(error);
  25. }
  26.  
  27. //更新积分出错时候的回调 返回错误信息
  28. void GMUpdatePointError(string error){
  29. print(error);
  30. }
  31.  
  32. //点击下载按钮
  33. void onClickDownLoad(){
  34. print("onClickDownLoad");
  35. }
  36.  
  37. //点击返回按钮
  38. void onClickBack(){
  39. print("onClickBack");
  40. }
  41.  
  42. //
  43. //可以只在积分point不为0的情况下提示, 回调格式为:
  44. // 名字,积分 如: 新三国,200 表示用户通过下载新三国得到了200积分
  45. void GMWallGetPoint(string NameAndPoint){
  46. print(NameAndPoint);
  47. }
  48. }

果盟广告SDK的更多相关文章

  1. cocos2dx-3.1 接入多盟广告sdk+Android (2)

    上篇,把基本工作做完了,接下来,在C++下加入代码. 1.打开win32下的project,加入一个类.DomobAd.代码例如以下, <pre name="code" cl ...

  2. unity, 集成iOS广告sdk注意事项

    ----更新:2015-10-22 今天在unity里集成讯飞语音听写的iOS sdk,结果发现前面集成domob广告的方法搞复杂了. 其实,直接把UnityViewControllerBase当做s ...

  3. iOS开发——iOS10升级极光推送SDK、友盟分享SDK

    前不久升级了Xcode8 ,同时iOS10系统也推送久. 由于公司需要适配iOS 10系统,同时第三方sdk建议升级. 包含替换升级新的SDK和相应的代码修改. 主要分享如何升级极光推送SDK,友盟分 ...

  4. UmengAppDemo【友盟统计SDK集成以及多渠道打包配置,基于V7.5.3版本】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 这里只是记录下集成友盟统计SDK以及简单配置多渠道打包的步骤.所以1.该Demo不能运行:2.配置多渠道打包只是一种简单的写法,具体 ...

  5. UmengShareDemo【友盟分享SDK集成,基于V6.9.3版本】

    版权声明:本文为HaiyuKing原创文章,转载请注明出处! 前言 这里简单记录下友盟分享SDK集成的步骤. 如果想要使用自定义分享对话框实现,请参考<ShareDialogDemo[分享对话框 ...

  6. 【Android】接入有米广告SDK

    测试:接入有米广告SDK(测试广告). 步骤: 1.注册并登录有米广告. 2.下载相应的SDK,这里我选了第一个[Android广告SDK ],如下图: 3.下好后,根据doc文档步骤进行操作,包括: ...

  7. 配置友盟最新SDK遇到的问题

    编译报错  Undefined symbols for architecture i386:原因:i386是代表模拟器,显示i386错误说明静态库不支持模拟器,只支持真机.友盟最新SDK可能不支持模拟 ...

  8. WP8 中使用HTML Agility Pack与友盟分享SDK遇到的 System.Xml.XPath加载问题

    今晚在尝试使用友盟最新的社交分享SDK时,按照官方Demo,并未做多少多少改动,就是去除了对微信.脸书和推特的分享.然后运行之后就一直报错 : {System.IO.FileLoadException ...

  9. 适用于 Flutter 的 Google 移动广告 SDK 正式版现已发布

    作者 / Zoey Fan,Flutter 产品经理 应用变现有多种方法: 通过实体企业的店面接受付款.提供订阅或应用内购买,或者直接在应用中投放广告.经过六个月的 beta 测试期,我们很高兴能够推 ...

随机推荐

  1. (转)MongoDB分片实战 集群搭建

    环境准备 Linux环境 主机 OS 备注 192.168.32.13 CentOS6.3 64位 普通PC 192.168.71.43 CentOS6.2 64位 服务器,NUMA CPU架构 Mo ...

  2. 【leetcode】367. Valid Perfect Square

    题目描述: Given a positive integer num, write a function which returns True if num is a perfect square e ...

  3. OSX 上初步尝试 asp.net 5

    去年微软最令开源狗界振奋的消息就是 ASP.NET 的开放与开源这一消息了. 根据微软的介绍,与我之前的一些总结,可以看到 ASP.NET 以及 .NET 平台会有下面几个变化: 代码使用 Apach ...

  4. 给view 添加事件

    //绑定图片点击事件 UITapGestureRecognizer *g=[[UITapGestureRecognizeralloc]initWithTarget:selfaction:@select ...

  5. 使用GDataXML解析XML文档

    转载自:http://blog.csdn.net/tangren03/article/details/7868246 在IOS平台上进行XML文档的解析有很多种方法,在SDK里面有自带的解析方法,但是 ...

  6. Mysql备份--mysqldump&outfile

    1.备份工具mysqldump 客户端和服务器端都能用select outfile 只能写到服务器端 2.按表单位备份 a.单个表备份 mysqldump -uusername -p database ...

  7. opencv初体验

    http://guoming.me/opencv-config  这篇文章有讲解opencv的安装与配置 一些常用库 opencv_core249d.lib opencv_imgproc249d.li ...

  8. mindmanager 快捷键

    insert or CTRL + Enter: 添加副主题 Enter: 添加同级主题(向下) Shift + Enter: 添加同级主题(向上) CTRL + Shift + Insert: 添加上 ...

  9. JAVA读取TXT文本中的数据

    现在在Demo.txt中存在数据: ABC 需要将ABC从文本文件中读取出来 代码片: import java.io.*; class FileReaderDemo { public static v ...

  10. myeclipse配置下tomcat debug启动很无比慢

    myeclipse配置下tomcat debug启动很无比慢,而run启动很快今天照常使用MyEclipse 6.5 Blue Edition进行开发,但是却遇到一个怪问题.在MyEclipse环境下 ...