Exemplo n.º 1
0
 public void LoadBackScene()
 {
     if (!SGScenes.LoadBackScene())
     {
         StartCoroutine(SGEnvironment.Quit());
     }
 }
Exemplo n.º 2
0
    private static void ReceiveExternalCallAndroid(string param = "arguments")
    {
        string            arguments = "";
        AndroidJavaClass  up        = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
        AndroidJavaObject ca        = up.GetStatic <AndroidJavaObject>("currentActivity");
        AndroidJavaObject intent    = ca.Call <AndroidJavaObject>("getIntent");
        bool hasExtra = intent.Call <bool>("hasExtra", "arguments");

        if (hasExtra)
        {
            AndroidJavaObject extras = intent.Call <AndroidJavaObject>("getExtras");
            arguments = extras.Call <string>("getString", param);

            SGDebug.Log("Received external call: " + arguments);

            SGEnvironment.SetExternalCallParam(arguments);

            // dispose
            extras.Dispose();
        }
        // dispose
        up.Dispose();
        ca.Dispose();
        intent.Dispose();
    }
Exemplo n.º 3
0
 private void OnValueChanged_ForceCrashlytics()
 {
     if (forceCrashlytics.isOn)
     {
         forceCrashlytics.isOn = false;
         SGDebug.ForceException();
         StartCoroutine(SGEnvironment.Quit());
     }
 }
Exemplo n.º 4
0
    private void SetDynamicLink()
    {
        string sceneName = SGEnvironment.GetDynamicLink(dynamicLinkSceneParam);

        if (!string.IsNullOrEmpty(sceneName))
        {
            SceneManager.LoadScene(sceneName);
        }
    }
Exemplo n.º 5
0
 void CheckGenuineApp()
 {
     if (checkGenuineApp)
     {
         if (!SGSecurity.CheckGenuine())
         {
             SGDebug.LogWarning("CheckGenuine=false");
             SGDebug.SetCustomKey("CheckGenuine", "False");
             SGDebug.ForceException();
             StartCoroutine(SGEnvironment.Quit());
         }
     }
 }
Exemplo n.º 6
0
    public static void OnDynamicLink(object sender, EventArgs args)
    {
        if (!setupReady)
        {
            return;
        }

        var    dynamicLinkEventArgs = args as ReceivedDynamicLinkEventArgs;
        string link = dynamicLinkEventArgs.ReceivedDynamicLink.Url.OriginalString;

        SGDebug.Log("Received dynamic link: " + link);

        SGEnvironment.SetDynamicLink(link);
    }
    public void OnClick()
    {
        // restore sounds
        SGSound.SoundLevel = 1;
        SGSound.MusicLevel = 1;

        // restore storages
        SGStorage.ClearGenericPrefs();

        // delete files
        SGSaveLoad.DeleteLocal();

        // load boot scene
        StartCoroutine(SGEnvironment.Quit());
    }
Exemplo n.º 8
0
    private void TextInfo()
    {
        textInfo.text = "INFORMATIONS";
        // time
        textInfo.text += "\nDate Time: " + System.DateTime.Now.ToString("MM/dd/yyyy hh:mm:ss");

        // user
        textInfo.text += "\nUser name: " + SGFirebase.userName;
        textInfo.text += "\nUser email: " + SGFirebase.userEmail;
        textInfo.text += "\nUser id: " + SGFirebase.userId;

        // screen
        textInfo.text += "\nScreen dpi: " + Screen.dpi;
        textInfo.text += "\nScreen orientation: " + Screen.orientation;
        textInfo.text += "\nScreen dimension pixels: " + Screen.width + "x" + Screen.height;

        // some player prefs
        foreach (string key in SGStorage.GetGenericPrefs())
        {
            textInfo.text += "\nGenericPrefs : " + key + "=" + SGStorage.GetGenericPref(key);
        }

        // environment
        textInfo.text += "\nProduct: " + SGEnvironment.GetProdutcName() + " " + SGEnvironment.GetVersion();
        textInfo.text += "\nProduct company name: " + Application.companyName;
        textInfo.text += "\nProduct absolute url: " + Application.absoluteURL;
        textInfo.text += "\nProduct build GUID: " + Application.buildGUID;
        textInfo.text += "\nProduct identifier: " + Application.identifier;
        textInfo.text += "\nProduct installer name: " + Application.installerName;
        textInfo.text += "\nProduct internet reachability: " + Application.internetReachability;
        textInfo.text += "\nProduct data path: " + Application.dataPath;
        textInfo.text += "\nProduct persistent data path: " + Application.persistentDataPath;
        textInfo.text += "\nProduct streaming assets path: " + Application.streamingAssetsPath;
        textInfo.text += "\nProduct temporary cache path: " + Application.temporaryCachePath;
        textInfo.text += "\nUnity: " + SGEnvironment.GetUnityVersion();
        textInfo.text += "\nDevice platform: " + Application.platform;
        textInfo.text += "\nDevice unique identifier: " + SystemInfo.deviceUniqueIdentifier;
        textInfo.text += "\nDevice name: " + SystemInfo.deviceName;
        textInfo.text += "\nDevice model: " + SystemInfo.deviceModel;
        textInfo.text += "\nDevice SO: " + SystemInfo.operatingSystem;
        textInfo.text += "\nDevice system language: " + Application.systemLanguage;
        textInfo.text += "\nDevice type: " + SystemInfo.deviceType;
        textInfo.text += "\nDevice memory size: " + SystemInfo.systemMemorySize.ToString();
        textInfo.text += "\nDevice processors: " + SystemInfo.processorCount.ToString();
        textInfo.text += "\nFirebase Ready: " + SGFirebase.SetupReady.ToString();
    }
Exemplo n.º 9
0
    /// <summary>
    /// Verificar via remote settings a necessita de atualização do App, verificando a versão
    /// https://console.firebase.google.com/project/learn-english-gamification/config
    /// </summary>
    private void CheckUpgrade()
    {
        string upgrade = SGFirebase.RemoteSettings(remoteSettingsAppUpgrade, SGEnvironment.GetVersion());

        upgrade = upgrade.Trim();

        // check
        if (string.IsNullOrEmpty(upgrade))
        {
            return;
        }
        // check
        if (upgrade == SGEnvironment.GetVersion())
        {
            return;
        }

        // split parts
        string[] newVersion = upgrade.Split('.');
        string[] version    = SGEnvironment.GetVersion().Split('.');

        // check
        if (newVersion.Length < 2 || version.Length < 2)
        {
            return;
        }

        // upgrade immediately or later
        if (newVersion[0] != version[0])
        {
            Debug.LogWarning("Upgrade Immediately: Old " + version[1] + " - New " + newVersion[1]);
            msgUpgradeNow.SetActive(true);
        }
        else if (newVersion[1] != version[1])
        {
            Debug.LogWarning("Upgrade: Old " + version[1] + " - New " + newVersion[1]);
            msgUpgrade.SetActive(true);
        }
    }
Exemplo n.º 10
0
 public void OnClick_UpgradeNow()
 {
     StartCoroutine(SGEnvironment.Quit());
 }
Exemplo n.º 11
0
 public void Copy(string message, int firstCharacterIndex, int characterCount)
 {
     // clipboard
     SGEnvironment.SetClipboard(message);
 }