public static byte[] GetAndroidSignatures()
 {
     byte[] result = null;
     try
     {
         AndroidJavaClass androidJavaClass = new AndroidJavaClass("android.content.pm.PackageManager");
         int @static = androidJavaClass.GetStatic <int>("GET_SIGNATURES");
         AndroidJavaObject androidJavaObject = NativeCallTools.PackageManager.Call <AndroidJavaObject>("getPackageInfo", new object[]
         {
             NativeCallManager.GetAndroidPackageName(),
             @static
         });
         AndroidJavaObject[] array = androidJavaObject.Get <AndroidJavaObject[]>("signatures");
         if (array != null && array.Length > 0)
         {
             result = array[0].Call <byte[]>("toByteArray", new object[0]);
         }
     }
     catch (Exception ex)
     {
         Debug.LogException(ex);
         return(null);
     }
     return(result);
 }
Example #2
0
    private void NotificationGUI()
    {
        int num = 29;

        num++;
        num++;
        if (GUI.Button(this.GetRect(num), "一次推送"))
        {
            for (int i = 1; i < 100; i++)
            {
                NativeCallManager.NotificationMessage(i, "一次推送" + i, DateTime.get_Now().AddSeconds((double)(i * 60)), NotificationRepeatInterval.None);
            }
        }
        num++;
        if (GUI.Button(this.GetRect(num), "循环推送1"))
        {
            NativeCallManager.NotificationMessage(1000, "循环推送1", DateTime.get_Now().AddSeconds(5.0), NotificationRepeatInterval.ForTest);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "循环推送2"))
        {
            NativeCallManager.NotificationMessage(1000, "循环推送2", DateTime.get_Now().AddSeconds(5.0), NotificationRepeatInterval.ForTest2);
        }
        num++;
        if (GUI.Button(this.GetRect(num), "清空"))
        {
            Debug.LogError("[推送]清理");
            LocalForAndroidManager.CancelNotification(1);
            LocalForAndroidManager.CancelNotification(2);
            LocalForAndroidManager.CancelNotification(3);
        }
    }
Example #3
0
 public void SpeechRecordStop(Action recordFinished = null)
 {
     this.mIsWaittingOfRecordFinished = true;
     this.mRecordFinished             = recordFinished;
     NativeCallManager.Native_StopRecording();
     SoundManager.Instance.TurnOnOff2VoiceTalk(true);
 }
Example #4
0
    public void NotificationOfflineCall()
    {
        int num = 8;

        if (!this.IsLocalPushOn(num))
        {
            return;
        }
        if (this.IsSystemOn(num))
        {
            return;
        }
        SystemOpen systemOpen = DataReader <SystemOpen> .Get(64);

        if (systemOpen == null)
        {
            return;
        }
        TuiSongTongZhi tuiSongTongZhi = DataReader <TuiSongTongZhi> .Get(num);

        if (tuiSongTongZhi != null)
        {
            Debug.Log("[离线召回] time = " + tuiSongTongZhi.early);
            NativeCallManager.NotificationMessage(tuiSongTongZhi.id, string.Format(GameDataUtils.GetChineseContent(tuiSongTongZhi.detail, false), systemOpen.level), DateTime.get_Now().AddSeconds((double)(tuiSongTongZhi.early * 60)), NotificationRepeatInterval.None);
        }
    }
Example #5
0
 private void InstallByApk()
 {
     Debug.LogFormat("InstallByApk", new object[0]);
     UpdateManager.DownloadFileInfo downloadInfo = this.UpdateInfo.GetDownloadInfo(UpdateManager.PatchFileType.Apk);
     NativeCallManager.InstallPackage(downloadInfo.LocalPath);
     this.InstallNext();
 }
 public static byte[] getFromAssets(string fileName)
 {
     return(NativeCallManager.CallSdkApi <byte[]>("getFromAssets", new object[]
     {
         fileName
     }));
 }
Example #7
0
        private string GetNewPatchName()
        {
            int versionCode       = NativeCallManager.GetVersionCode();
            int serverVersionCode = GameManager.Instance.ServerVersionCode;

            return(string.Format("{0}_{1}.patch", versionCode, serverVersionCode));
        }
Example #8
0
    public int GetVolumn()
    {
        double num = NativeCallManager.Native_GetVolume();

        if (num <= 0.0)
        {
            return(0);
        }
        if (num >= 0.0 && num <= 20.0)
        {
            return(1);
        }
        if (num > 20.0 && num <= 40.0)
        {
            return(2);
        }
        if (num > 40.0 && num <= 60.0)
        {
            return(3);
        }
        if (num > 60.0 && num <= 80.0)
        {
            return(4);
        }
        if (num > 80.0 && num <= 90.0)
        {
            return(5);
        }
        return(6);
    }
Example #9
0
 private void OnCheckVersionCodeEnter(int eventID, FSMState preState, FSMState currentState)
 {
     if (!Application.get_isMobilePlatform())
     {
         Debug.Log("非移动平台,跳过更新");
         base.React(UpdateEvent2.True);
     }
     else
     {
         int serverVersionCode = GameManager.Instance.ServerVersionCode;
         int versionCode       = NativeCallManager.GetVersionCode();
         Debug.LogFormat("服务器vc:{0}    客户端vc:{1}", new object[]
         {
             serverVersionCode,
             versionCode
         });
         if (versionCode < serverVersionCode)
         {
             base.React(UpdateEvent2.False);
         }
         else if (versionCode >= serverVersionCode)
         {
             base.React(UpdateEvent2.True);
         }
     }
 }
Example #10
0
    public void Notification_GuildQuestion()
    {
        if (GuildManager.Instance.GetGuildId() <= 0L)
        {
            return;
        }
        int num = 4;

        if (!this.IsLocalPushOn(num))
        {
            return;
        }
        if (!this.IsSystemOn(num))
        {
            return;
        }
        TuiSongTongZhi tuiSongTongZhi = DataReader <TuiSongTongZhi> .Get(num);

        if (tuiSongTongZhi != null)
        {
            string value = DataReader <GongHuiXinXi> .Get("QuestionTime").value;

            string[] array = value.Split(new char[]
            {
                ','
            });
            if (array.Length > 0)
            {
                DateTime dateTime = this.GetDateTime(0, array[0]);
                int      id       = tuiSongTongZhi.id;
                NativeCallManager.NotificationMessage(id, GameDataUtils.GetChineseContent(tuiSongTongZhi.detail, false), dateTime, NotificationRepeatInterval.Day);
            }
        }
    }
 public static void GetApkMd5Async(Action <string> OnGetCallback)
 {
     if (string.IsNullOrEmpty(NativeCallManager.ApkMd5))
     {
         Debug.Log("GetApkMd5Async begin");
         string dataPath = NativeCallManager.GetApkPath();
         Debug.LogFormat("dataPath :{0}", new object[]
         {
             dataPath
         });
         Loom.Current.RunAsync(delegate
         {
             NativeCallManager.ApkMd5 = MD5Util.EncryptFile(dataPath);
             Debug.LogFormat("apk md5 :{0}", new object[]
             {
                 NativeCallManager.ApkMd5
             });
             if (OnGetCallback != null)
             {
                 OnGetCallback.Invoke(NativeCallManager.ApkMd5);
                 Debug.Log("GetApkMd5Async end");
             }
         });
     }
     else if (OnGetCallback != null)
     {
         OnGetCallback.Invoke(NativeCallManager.ApkMd5);
     }
 }
Example #12
0
 public void SubmitExtendData(OnSDKResultCallback callback, string type, string data)
 {
     NativeCallManager.CallSdkApi("submitExtendData", new object[]
     {
         type,
         data
     });
 }
 public static bool ContainsInAssets(string dir, string fileName)
 {
     return(NativeCallManager.CallSdkApi <bool>("containsInAssets", new object[]
     {
         dir,
         fileName
     }));
 }
Example #14
0
 private void OnRestartEnter(int eventID, FSMState preState, FSMState currentState)
 {
     DialogBoxUIViewModel.Instance.ShowAsConfirm("提示", "更新完毕,是否现在重启?", delegate
     {
         NativeCallManager.Restart();
     }, "确 定", "button_orange_1", UINodesManager.T4RootOfSpecial);
     DialogBoxUIView.Instance.isClick = false;
 }
Example #15
0
 public string GetSDKName()
 {
     if (SDKManager.IsCanChangeSDKType)
     {
         return(this.GetSDKName(SDKManager.TestSDKType));
     }
     return(this.GetSDKName(NativeCallManager.GetSDKType()));
 }
Example #16
0
 public void Login(OnSDKResultCallback callback, int type)
 {
     this.RegisterCallback("login", callback);
     NativeCallManager.CallSdkApi("login", new object[]
     {
         type
     });
 }
Example #17
0
    public void Pay(string productId, string productName, double price)
    {
        string order = SDKManager.GetOrder(productId, productName, price);

        NativeCallManager.CallSdkApi("pay", new object[]
        {
            order
        });
    }
Example #18
0
    private void InstallByApkPatch()
    {
        this.InstallUpdate = new Action(this.InstallByApkPatchUpdate);
        Debug.LogFormat("InstallByApkPatch", new object[0]);
        string newApk  = this.GetNewApkPath();
        string current = NativeCallManager.GetApkPath();
        string patch   = this.GetNewPatchPath();

        Loom.Current.RunAsync(delegate
        {
            FileInfo fileInfo = new FileInfo(newApk);
            if (fileInfo.get_Exists() && fileInfo.get_Length() >= (long)this.UpdateInfo.CurrentApkInfo.ApkFileInfo.FileSize)
            {
                string text = MD5Util.EncryptFile(newApk);
                if (this.UpdateInfo.CurrentApkInfo.ApkFileInfo.Md5.Equals(text))
                {
                    Loom.Current.QueueOnMainThread(delegate
                    {
                        NativeCallManager.InstallPackage(newApk);
                        this.InstallNext();
                    });
                }
                else
                {
                    this.ClearApk();
                    this.ClearApkPatch();
                    Action onClick = delegate
                    {
                        this.ReactSync(UpdateEvent.False);
                    };
                    Loom.Current.QueueOnMainThread(delegate
                    {
                        this.ShowDownloadFailed(onClick);
                    });
                }
            }
            else
            {
                string directoryName = Path.GetDirectoryName(newApk);
                DirectoryUtil.CreateIfNotExist(directoryName);
                FileHelper.DeleteIfExist(newApk);
                this.MergeFile = new FileInfo(newApk);
                using (FileStream fileStream = File.Open(current, 3, 1, 1))
                {
                    using (FileStream fileStream2 = File.Open(newApk, 2, 2))
                    {
                        BinaryPatchUtility.Apply(fileStream, () => File.Open(patch, 3, 1, 1), fileStream2);
                    }
                }
                Loom.Current.QueueOnMainThread(delegate
                {
                    this.InstallByApkPatch();
                });
            }
        });
    }
Example #19
0
 public void SpeechPlay(string name)
 {
     Debug.LogError("==>Voice: SpeechPlay file name = " + name);
     if (string.IsNullOrEmpty(name))
     {
         name = "sp_ro";
     }
     Debug.LogError("==>Voice: SpeechPlay file exist is " + File.Exists(VoiceSDKManager.GetFilePath(name)));
     NativeCallManager.Native_PlayRecording(VoiceSDKManager.GetFilePath(name));
 }
Example #20
0
    public static void CleanNotification()
    {
        List <int> pushIDs = NativeCallManager.GetPushIDs();

        for (int i = 0; i < pushIDs.get_Count(); i++)
        {
            LocalForAndroidManager.CancelNotification(pushIDs.get_Item(i));
        }
        LocalForAndroidManager.AndroidJC.CallStatic("CancelAll", new object[0]);
    }
Example #21
0
 public void SpeechStopPlay()
 {
     this.mIsInPlaying = false;
     NativeCallManager.Native_StopPlayRecording();
     if (this.m_actionStop != null)
     {
         this.m_actionStop.Invoke();
         this.m_actionStop = null;
     }
 }
Example #22
0
 private void RecordApkInfo()
 {
     Debug.Log("查询apk更新方式(整包or补丁包)");
     NativeCallManager.GetApkMd5Async(delegate(string x)
     {
         Loom.Current.QueueOnMainThread(delegate
         {
             this.DoRecordApkInfo(x);
         });
     });
 }
Example #23
0
    public static string GetConfigTxt(string fileName, string suffix = ".txt")
    {
        fileName = fileName.ToLower();
        string text = Path.Combine(AppConst.ResourcePath, fileName + suffix);

        if (File.Exists(text))
        {
            return(File.OpenText(text).ReadToEnd());
        }
        return(Encoding.get_UTF8().GetString(NativeCallManager.getFromAssets(fileName + suffix)));
    }
Example #24
0
    public void SpeechRecordStart()
    {
        SoundManager.Instance.TurnOnOff2VoiceTalk(false);
        this.SpeechStopPlay();
        string filePath = VoiceSDKManager.GetFilePath("sp_ro");

        if (File.Exists(filePath))
        {
            File.Delete(filePath);
        }
        NativeCallManager.Native_StartRecording(VoiceSDKManager.GetFilePath("sp_ro"));
    }
Example #25
0
    private string GetNewPatchName()
    {
        Debug.Log("GetNewPatchName");
        int versionCode = NativeCallManager.GetVersionCode();

        Debug.LogFormat("currentCode :{0}", new object[]
        {
            versionCode
        });
        int serverVersionCode = GameManager.Instance.ServerVersionCode;

        return(string.Format("{0}_{1}_{2}.patch", versionCode, serverVersionCode, NativeCallManager.GetApkMd5()));
    }
Example #26
0
 public string GetApkPatchUrl(string relToPkgName)
 {
     if (string.IsNullOrEmpty(this.ApkPatchRoot))
     {
         Debug.Log("GetApkPatchUrl");
         string androidPackageName = NativeCallManager.GetAndroidPackageName();
         Debug.LogFormat("package name :{0}", new object[]
         {
             androidPackageName
         });
         this.ApkPatchRoot = string.Format("{0}/apkPatch/{1}/{2}", this.PatchUrlRoot, androidPackageName, this.ServerVersionCode);
     }
     return(string.Format("{0}/{1}", this.ApkPatchRoot, relToPkgName));
 }
Example #27
0
 private void InstallNew(bool isFinish)
 {
     TimerHeap.DelTimer(this.t);
     TimerHeap.DelTimer(this.tm);
     if (isFinish)
     {
         NewContinueUI.OpenAsNormal(GameDataUtils.GetChineseContent(621297, false), GameDataUtils.GetChineseContent(621305, false), delegate
         {
             NativeCallManager.InstallPackage(Path.Combine(GameManager.AssetBundleBuildRoot, "Apocalypse.apk"));
         }, new Action(ClientApp.QuitApp), GameDataUtils.GetChineseContent(621271, false), GameDataUtils.GetChineseContent(621272, false));
     }
     else
     {
         NewContinueUI.OpenAsNormal(GameDataUtils.GetChineseContent(621297, false), GameDataUtils.GetChineseContent(621304, false), new Action(this.DownloadInstallPackage), new Action(ClientApp.QuitApp), GameDataUtils.GetChineseContent(621285, false), GameDataUtils.GetChineseContent(621286, false));
     }
 }
Example #28
0
    private void OnCheckVersionEnter(int eventID, FSMState preState, FSMState currentState)
    {
        bool flag = false;

        if (Singleton <SwitchFile> .S.IsFileExist(SwitchFile.FileName.NoUpdate))
        {
            flag = false;
        }
        else if (Application.get_platform() == 11)
        {
            DateTime newTarget   = this.StringToDateTime(GameManager.Instance.ResVersion);
            DateTime coreVersion = this.GetCoreVersion();
            if (this.IsNewThan(newTarget, coreVersion))
            {
                Debug.Log("更新corePatch");
                this.UpdateInfo.IsCoreUpdate = true;
                flag = true;
            }
            DateTime extendVersion = this.GetExtendVersion();
            if (this.IsNewThan(newTarget, extendVersion))
            {
                Debug.Log("更新extendVersion");
                this.UpdateInfo.IsExtendUpdate = true;
                flag = true;
            }
            if (this.ShouldExtendDownload && extendVersion.Equals(UpdateManager.DefaultExtendVersion))
            {
                Debug.Log("下载extend");
                this.UpdateInfo.IsDownloadExtend = true;
                flag = true;
            }
            int versionCode = NativeCallManager.GetVersionCode();
            if (GameManager.Instance.ServerVersionCode > versionCode)
            {
                this.UpdateInfo.VersionCode = GameManager.Instance.ServerVersionCode;
                flag = true;
            }
        }
        if (flag)
        {
            base.React(UpdateEvent.True);
        }
        else
        {
            base.React(UpdateEvent.False);
        }
    }
Example #29
0
 private void Update()
 {
     if (this.mIsWaittingOfRecordFinished && NativeCallManager.Native_RecordFinished())
     {
         Debug.Log("***mIsWaittingOfRecordFinished finished!!!");
         this.mIsWaittingOfRecordFinished = false;
         if (this.mRecordFinished != null)
         {
             this.mRecordFinished.Invoke();
         }
     }
     if (this.mIsInPlaying && NativeCallManager.Native_IsPlayRecordingFinished())
     {
         Debug.Log("***speech play finished!!!");
         this.SpeechStopPlayWithResetMusic();
     }
 }
Example #30
0
        private void OnCheckUpdateWayEnter(int eventID, FSMState preState, FSMState currentState)
        {
            Debug.Log("查询更新方式(整包or补丁包)");
            string dataPath = Application.get_dataPath();

            NativeCallManager.GetApkMd5Async(delegate(string x)
            {
                if (!this.CurrentPatchInfo.PatchFileInfo.ContainsKey(x))
                {
                    base.ReactSync(UpdateEvent2.True);
                }
                else
                {
                    base.ReactSync(UpdateEvent2.False);
                }
            });
        }