Пример #1
0
 private void DownObbUpdate()
 {
     HonorSDKImpl.GetInstance().DownObbUpdate(delegate(ResultObbDownload result)
     {
         Debug.Log("HonorSDK:DownObbUpdate.stateChanged = " + result.stateChanged);
         if (result.stateChanged)
         {
             Debug.Log("HonorSDK:DownObbUpdate.state = " + result.state);
             if (ResultObbDownload.STATE_COMPLETED.Equals(result.state))
             {
                 HonorSDKImpl.GetInstance().ReloadObb();
             }
             else
             {
                 HonorSDKImpl.GetInstance().ContinueUpdateObb();
             }
         }
         else
         {
             Debug.Log("HonorSDK:DownObbUpdate.currentSize = " + result.currentSize
                       + ",totalSize =" + result.totalSize
                       );
         }
     });
 }
Пример #2
0
    private void Pay()
    {
        OrderInfo orderInfo = new OrderInfo();

        orderInfo.count     = 1;
        orderInfo.extra     = CurrentTimeMillis().ToString();
        orderInfo.serverId  = Scene2.currentServerId;
        orderInfo.roleName  = "UnityDemoAndorid";
        orderInfo.roleLevel = 1;
        orderInfo.roleId    = "1";
        orderInfo.goodsId   = currentGoodsId;
        HonorSDKImpl.GetInstance().Pay(orderInfo, delegate(ResultPay result)
        {
            Debug.Log("HonorSDK:Pay.success = " + result.success);

            if (result.success)
            {
                Debug.Log("HonorSDK:Pay.orderId = " + result.orderId);
            }
            else
            {
                Debug.Log("HonorSDK:Pay.message = " + result.message);
            }
        });
    }
Пример #3
0
    public void Login()
    {
        int identify = -1;

        HonorSDKImpl.GetInstance().RegisterIdentifyListener(delegate(IdentifyInfo identifyInfo) {
            identify = identifyInfo.identify;
        });
        HonorSDKImpl.GetInstance().Login(delegate(UserInfo userInfo)
        {
            Debug.Log("HonorSDK:Login.success = " + userInfo.success);
            if (userInfo.success)
            {
                string playTime = userInfo.getExtra(UserInfo.EXTRA_PLAY_TIME);

                string authInfo = HonorSDKImpl.GetInstance().GetAuthInfo();
                authInfo       += "&playtime=" + authInfo;
                authInfo       += "&identify=" + identify;



                Debug.Log("HonorSDK:Login.accessToken = " + userInfo.accessToken
                          + ",nickName =" + userInfo.nickName
                          + ",uid =" + userInfo.uid
                          );
                //SceneManager.LoadScene("scene2");

                //SceneManager.LoadScene("Scene2");
                LoadTest.Instance.ChangeScene(2);
            }
            else
            {
                Debug.Log("HonorSDK:Login.message = " + userInfo.message);
            }
        });
    }
Пример #4
0
 private void getGoodsList()
 {
     HonorSDKImpl.GetInstance().GetGoodsList(delegate(GoodsList result)
     {
         Debug.Log("HonorSDK:GetGoodsList.success = " + result.success);
         if (result.success)
         {
             GetGoodsListSuccess(result);
             List <GoodsInfo> goodsList = result.goods;
             foreach (GoodsInfo goodsInfo in goodsList)
             {
                 Debug.Log("HonorSDK:GetNoticeList.goods.item.category =" + goodsInfo.category
                           + ",count =" + goodsInfo.count
                           + ",currency =" + goodsInfo.currency
                           + ",description =" + goodsInfo.description
                           + ",endTime =" + goodsInfo.endTime
                           + ",gift =" + goodsInfo.gift
                           + ",goodsId =" + goodsInfo.goodsId
                           + ",goodsName =" + goodsInfo.goodsName
                           + ",limitByDay =" + goodsInfo.limitByDay
                           + ",price =" + goodsInfo.price
                           + ",priceDisplay =" + goodsInfo.priceDisplay
                           + ",ratio =" + goodsInfo.ratio
                           + ",startTime =" + goodsInfo.startTime
                           + ",ratio =" + goodsInfo.tag
                           + ",url =" + goodsInfo.url
                           );
             }
         }
         else
         {
             Debug.Log("HonorSDK:GetGoodsList.message = " + result.message);
         }
     }, Scene2.currentServerId, "", "");
 }
Пример #5
0
 private void GetNoticeList()
 {
     HonorSDKImpl.GetInstance().GetNoticeList(delegate(NoticeList result)
     {
         Debug.Log("HonorSDK:GetNoticeList.success = " + result.success);
         if (result.success)
         {
             List <NoticeInfo> notices = result.notices;
             foreach (NoticeInfo notice in notices)
             {
                 Debug.Log("HonorSDK:GetNoticeList.notices.item.content =" + notice.content
                           + ",endTime =" + notice.endTime
                           + ",image =" + notice.image
                           + ",important =" + notice.important
                           + ",link =" + notice.link
                           + ",mode =" + notice.mode
                           + ",sort =" + notice.sort
                           + ",startTime =" + notice.startTime
                           + ",status =" + notice.status
                           + ",title =" + notice.title
                           + ",type =" + notice.type
                           );
             }
         }
         else
         {
             Debug.Log("HonorSDK:GetNoticeList.message = " + result.message);
         }
     }, "", "", "", "");
 }
Пример #6
0
 private void GetCountryCode()
 {
     HonorSDKImpl.GetInstance().GetCountryAndLanguage(delegate(Locale countryCode)
     {
         Debug.Log("HonorSDK:GetCountryCode.countryCode = " + countryCode
                   );
     });
 }
Пример #7
0
 private void GetMemory()
 {
     HonorSDKImpl.GetInstance().GetMemory(delegate(MemoryInfo memoryInfo)
     {
         Debug.Log("HonorSDK:GetMemory.availMem = " + memoryInfo.availMem
                   + ",totalMem =" + memoryInfo.totalMem
                   );
     });
 }
Пример #8
0
 private void GetBattery()
 {
     HonorSDKImpl.GetInstance().GetBattery(delegate(BatteryInfo batteryInfo)
     {
         Debug.Log("HonorSDK:GetBattery.scale = " + batteryInfo.scale
                   + ",level =" + batteryInfo.level
                   );
     });
 }
Пример #9
0
 public static void Exit()
 {
     HonorSDKImpl.GetInstance().Exit(delegate(Result result)
     {
         Debug.Log("HonorSDK:Exit.success = " + result.success);
         if (!result.success)
         {
             Debug.Log("HonorSDK:Exit.message = " + result.message);
         }
     });
 }
Пример #10
0
    void OnEnable()
    {
        HonorSDKImpl.GetInstance().GetServerList(delegate(ServerList list)
        {
        });

        Button switchAccountView = GameObject.Find("SwitchButton").GetComponent <Button>();
        Button bindView          = GameObject.Find("BindButton").GetComponent <Button>();
        Button logoutView        = GameObject.Find("LogoutButton").GetComponent <Button>();

        payView = GameObject.Find("PaytButton").GetComponent <Button>();
        Button exitView = GameObject.Find("ExitButton").GetComponent <Button>();

        goodsOptionView = GameObject.Find("GoodsOption").GetComponent <Dropdown>();

        exitView.onClick.AddListener(delegate()
        {
            if (HonorSDKImpl.GetInstance().HasExitDialog())
            {
                Exit();
            }
            else
            {
                //创建游戏退出框
                ExitDialog.Inst.show(delegate()
                {
                    Exit();
                });
            }
        });
        bindView.onClick.AddListener(delegate()
        {
            Bind();
        });

        switchAccountView.onClick.AddListener(delegate()
        {
            SwitchAccount();
        });

        logoutView.onClick.AddListener(delegate()
        {
            Logout();
        });
        payView.enabled         = false;
        goodsOptionView.enabled = false;
        getGoodsList();
        payView.onClick.AddListener(delegate()
        {
            Pay();
        });
        UploadGameRoleInfo();
    }
Пример #11
0
 private void GetAppInfo()
 {
     HonorSDKImpl.GetInstance().GetAppInfo(delegate(AppInfo appInfo)
     {
         Debug.Log("HonorSDK:GetAppInfo.deviceId = " + appInfo.deviceId
                   + ",appName =" + appInfo.appName
                   + ",version =" + appInfo.version
                   + ",platform =" + appInfo.platform
                   + ",appId =" + appInfo.appId
                   );
     });
 }
Пример #12
0
    private void SwitchAccount()
    {
        bool isSupportApi = HonorSDKImpl.GetInstance().IsSupportApi(Api.SWITCH_ACCOUNT);

        if (!isSupportApi)
        {
            Debug.Log("HonorSDK:SwitchAccount.IsSupportApi = " + isSupportApi);
            return;
        }
        //判断是否支持切换账号

        HonorSDKImpl.GetInstance().SwitchAccount();
    }
Пример #13
0
    private void GetObbUpdate()
    {
        bool hasObbUpdtae = HonorSDKImpl.GetInstance().HasObbUpdate();

        Debug.Log("HonorSDK:HasObbUpdate.hasObbUpdtae = " + hasObbUpdtae);
        if (hasObbUpdtae)
        {
            DownObbUpdate();
        }
        else
        {
            GetDynamicUpdate();
        }
    }
Пример #14
0
    private void UploadGameRoleInfo()
    {
        GameRoleInfo gameRoleInfo = new GameRoleInfo();

        gameRoleInfo.roleId     = "1";
        gameRoleInfo.roleLevel  = 2;
        gameRoleInfo.roleName   = "UnityDemoAndorid";
        gameRoleInfo.roleVip    = "1";
        gameRoleInfo.serverId   = Scene2.currentServerId;
        gameRoleInfo.type       = GameRoleInfo.TYPE_ENTER_GAME;
        gameRoleInfo.extra      = "";
        gameRoleInfo.lastUpdate = (int)CurrentTimeMillis();
        HonorSDKImpl.GetInstance().UploadGameRoleInfo(gameRoleInfo);
    }
Пример #15
0
    public void GetServerList()
    {
        HonorSDKImpl.GetInstance().GetServerList(delegate(ServerList result)
        {
            Debug.Log("HonorSDK:GetServerList.success = " + result.success);
            if (result.success)
            {
                GetServerListSuccess(result);
                Debug.Log("HonorSDK:GetServerList.tester = " + result.tester
                          + ",time =" + result.time
                          + ",servers = [...]"
                          );

                List <ServerInfo> servers = result.servers;

                foreach (ServerInfo server in servers)
                {
                    Debug.Log("HonorSDK:GetServerList.servers.item.address =" + server.address
                              + ",closeTime =" + server.closeTime
                              + ",label =" + server.label
                              + ",openTime =" + server.openTime
                              + ",serverId =" + server.serverId
                              + ",serverName =" + server.serverName
                              + ",status =" + server.status
                              + ",tag =" + server.tag
                              + ",roles = [...]"
                              );

                    List <GameRoleInfo> roles = server.roles;

                    foreach (GameRoleInfo role in roles)
                    {
                        Debug.Log("HonorSDK:GetServerList.servers.item.roles.item.lastUpdate =" + role.lastUpdate
                                  + ",extra =" + role.extra
                                  + ",roleId =" + role.roleId
                                  + ",roleLevel =" + role.roleLevel
                                  + ",roleName =" + role.roleName
                                  + ",roleVip =" + role.roleVip
                                  + ",serverId =" + role.serverId
                                  + ",roles ={...}"
                                  );
                    }
                }
            }
            else
            {
                Debug.Log("HonorSDK:GetServerList.message = " + result.message);
            }
        });
    }
Пример #16
0
 private void DownDynamicUpdate()
 {
     HonorSDKImpl.GetInstance().DownDynamicUpdate(delegate(ResultDownload result)
     {
         Debug.Log("HonorSDK:DownDynamicUpdate.success = " + result.success);
         if (result.success)
         {
             Debug.Log("HonorSDK:DownDynamicUpdate.currentSize = " + result.currentSize
                       + ",totalSize=" + result.totalSize
                       );
         }
         else
         {
             Debug.Log("HonorSDK:DownDynamicUpdate.message = " + result.message);
         }
     });
 }
Пример #17
0
 void Update()
 {
     if (Input.GetKeyDown(KeyCode.Escape))
     {
         Debug.Log("HonorSDK:BaseScene.Update GetKeyDown=KeyCode.Escape");
         if (HonorSDKImpl.GetInstance().HasExitDialog())
         {
             Scene3.Exit();
         }
         else
         {
             //创建游戏退出框
             ExitDialog.Inst.show(delegate()
             {
                 Scene3.Exit();
             });
         }
     }
 }
Пример #18
0
 private void GetForceUpdate()
 {
     HonorSDKImpl.GetInstance().GetForceUpdate(delegate(ResultGetForce result)
     {
         Debug.Log("HonorSDK:GetForceUpdate.success = " + result.success);
         if (result.success)
         {
             Debug.Log("HonorSDK:GetForceUpdate.totalSize = " + result.totalSize);
             if (result.totalSize > 0)
             {
                 DownForceUpdate();
             }
             else
             {
                 GetObbUpdate();
             }
         }
         else
         {
             Debug.Log("HonorSDK:GetForceUpdate.message = " + result.message);
         }
     });
 }
Пример #19
0
    private void Bind()
    {
        bool isSupportApi = HonorSDKImpl.GetInstance().IsSupportApi(Api.BIND);

        if (!isSupportApi)
        {
            Debug.Log("HonorSDK:StartBind.IsSupportApi = " + isSupportApi);
            return;
        }

        HonorSDKImpl.GetInstance().StartBind(delegate(ResultBind result)
        {
            Debug.Log("HonorSDK:StartBind.success = " + result.success);
            if (result.success)
            {
                Debug.Log("HonorSDK:StartBind.nickName = " + result.nickName);
            }
            else
            {
                Debug.Log("HonorSDK:StartBind.message = " + result.message);
            }
        });
    }
Пример #20
0
 private void Init()
 {
     HonorSDKImpl.GetInstance().RegisterSwitchAccountListener(delegate(UserInfo userInfo)
     {
         Debug.Log("HonorSDK:SwitchAccount.success = " + userInfo.success);
         if (userInfo.success)
         {
             Debug.Log("HonorSDK:SwitchAccount.accessToken = " + userInfo.accessToken
                       + ",nickName =" + userInfo.nickName
                       + ",uid =" + userInfo.uid
                       );
             //退出到选服界面
             LoadTest.Instance.ChangeScene(2);
         }
         else
         {
             //切换失败继续游戏
             Debug.Log("HonorSDK:SwitchAccount.message = " + userInfo.message);
         }
     });
     Debug.Log("unity.Init");
     HonorSDKImpl.CreateInstance(HonorSDKImpl.ePlat.Android);
     HonorSDKImpl.GetInstance().Init(LoadTest.Instance.sdkObj, delegate(ResultInit initResult)
     {
         string url        = initResult.getCustomParameter("mobileAdapterKey");
         string privacyUrl = initResult.getCustomParameter("privacy");
         string termsUrl   = initResult.getCustomParameter("terms");
         Debug.Log("HonorSDK:Init.success = " + initResult.success
                   + ",message =" + initResult.message
                   );
         if (initResult.success)
         {
             loginButton.enabled = true;
         }
         InitFinish();
     }, "1");
 }
Пример #21
0
    private void Logout()
    {
        bool isSupportApi = HonorSDKImpl.GetInstance().IsSupportApi(Api.LOGOUT);

        if (!isSupportApi)
        {
            Debug.Log("HonorSDK:Logout.IsSupportApi = " + isSupportApi);
            return;
        }
        HonorSDKImpl.GetInstance().Logout(delegate(Result result)
        {
            Debug.Log("HonorSDK:Logout.success = " + result.success);
            if (result.success)
            {
                //注销成功,退出到登陆界面
                LoadTest.Instance.ChangeScene(1);
            }
            else
            {
                //注销失败继续玩游戏
                Debug.Log("HonorSDK:Logout.message = " + result.message);
            }
        });
    }
Пример #22
0
    private void InitFinish()
    {
        //  HonorSDKImpl.GetInstance().RequestDownload(new int[] { 1,2},new string[] { "1","2"},new int[] { 1, 2 }, new int[] { 1, 2 }, new long[] { 1, 2 }, new int[] { 1, 2 });

        string OPEN_GOOGLE_PLAY_COMMENTS = "open_google_play_comments";

        HonorSDKImpl.GetInstance().ExpandFunction(OPEN_GOOGLE_PLAY_COMMENTS);


        HonorSDKImpl.GetInstance().RegisterIdentifyListener(delegate(IdentifyInfo info) {
            identify = info.identify;
        });

        GetAppInfo();
        GetBattery();
        GameStepInfo();
        GetCountryCode();
        GetCpuAndGpu();
        GetMemory();
        ReportError();
        PushNotification();
        GetDynamicUpdate();
        GetNoticeList();
    }
Пример #23
0
 private void GetDynamicUpdate()
 {
     HonorSDKImpl.GetInstance().GetDynamicUpdate("GameRes", delegate(ResultGetDynamic result)
     {
         Debug.Log("HonorSDK:GetDynamicUpdate.success = " + result.success);
         if (result.success)
         {
             Debug.Log("HonorSDK:GetDynamicUpdate.totalSize = " + result.totalSize
                       + ",dynamicResPath =" + result.dynamicResPath
                       );
             if (result.totalSize > 0)
             {
                 DownDynamicUpdate();
             }
             {
                 Debug.LogError("22222222222");
             }
         }
         else
         {
             Debug.Log("HonorSDK:GetDynamicUpdate.message = " + result.message);
         }
     });
 }
Пример #24
0
 private void ReportError()
 {
     HonorSDKImpl.GetInstance().ReportError("HonorSDK:Test ReportError");
 }
Пример #25
0
 private void GetABTest()
 {
     HonorSDKImpl.GetInstance().GetABTestVer(delegate(ResultGetABTestVer result) {
     });
 }
Пример #26
0
 public HonorMessageHandler(HonorSDKImpl manager) : base(manager)
 {
     this.manager = manager;
 }
Пример #27
0
 private void GameStepInfo()
 {
     HonorSDKImpl.GetInstance().GameStepInfo("-10086", "");
 }
Пример #28
0
 private void PushNotification()
 {
     HonorSDKImpl.GetInstance().PushNotification("HonorSDK:Test PushNotification", 10, 10086);
 }