IEnumerator ShareScreenshot()
    {
        isProcessing = true;

        yield return(new WaitForEndOfFrame());

        ScreenCapture.CaptureScreenshot("screenshot.png", 2);
        string destination = Path.Combine(Application.persistentDataPath, "screenshot.png");

        yield return(new WaitForSecondsRealtime(0.3f));

        if (!Application.isEditor)
        {
            AndroidJavaClass  intentClass  = new AndroidJavaClass("android.content.Intent");
            AndroidJavaObject intentObject = new AndroidJavaObject("android.content.Intent");
            intentObject.Call <AndroidJavaObject>("setAction", intentClass.GetStatic <string>("ACTION_SEND"));
            AndroidJavaClass  uriClass  = new AndroidJavaClass("android.net.Uri");
            AndroidJavaObject uriObject = uriClass.CallStatic <AndroidJavaObject>("parse", "file://" + destination);
            intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_STREAM"),
                                                  uriObject);
            intentObject.Call <AndroidJavaObject>("putExtra", intentClass.GetStatic <string>("EXTRA_TEXT"),
                                                  text1);// );
            intentObject.Call <AndroidJavaObject>("setType", "image/jpeg");
            AndroidJavaClass  unity           = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
            AndroidJavaObject currentActivity = unity.GetStatic <AndroidJavaObject>("currentActivity");
            AndroidJavaObject chooser         = intentClass.CallStatic <AndroidJavaObject>("createChooser",
                                                                                           intentObject, "Выберете приложение");
            currentActivity.Call("startActivity", chooser);

            yield return(new WaitForSecondsRealtime(1));
        }

        yield return(new WaitUntil(() => isFocus));

        //CanvasShareObj.SetActive(false);
        isProcessing = false;
        if (!ach.achievments[9].get)
        {
            ach.getAch(9);
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        //if (!PlayerPrefs.HasKey("get100000"))
        //{
        //    PlayerPrefs.SetInt("get100000", 0);
        //}
        StartCoroutine(dl.LoginOrInsertData(deviceID, nickname));
        //int plS = PlayerPrefs.GetInt("get100000");
        //if (plS != 1)
        //{
        //    getR = false;
        //}
        //else
        //{
        //    getR = true;
        //}
        //if (gold > 30000)
        //{
        //    gold = 40;
        //}
        //if (int.Parse(dl.res[1]) >= 100000 && !getR)
        //{
        //    thanksPanel.SetActive(true);
        //    gold += 100;
        //    getR = true;
        //    PlayerPrefs.SetInt("get100000", 1);
        //}
        //print(StringCipher.Encrypt("Какой-то текст"));
        //print(StringCipher.Decrypt("2QO8XdO1vwYddW7fB/71+v8As3GRql7liST1HCn1nbE="));
        GetResolutionScreen();
        AvatarSet();
        sld.value = 0.59f;
        auth();
        silverText.text = convertMoney(silver); //отображаем серебро в панели на главной
        goldText.text   = gold.ToString();      //отображаем золото в панели на главной
        for (int i = 0; i < cases.Length; i++)
        {
            GameObject A = Instantiate(casePref, casePref.transform.position = new Vector3(0, 0, 0), Quaternion.identity) as GameObject;
            A.transform.SetParent(caseContainer.transform, false);
            A.transform.GetChild(0).GetComponent <Image>().sprite = cases[i].picture;
            A.transform.GetChild(1).GetComponent <Text>().text    = cases[i].price.ToString();
            A.transform.GetChild(3).GetComponent <Text>().text    = LangSystem.lng.namesCases[i]; // cases[i].name;
            int id = cases[i].id;
            A.transform.GetChild(0).GetComponent <Button>().onClick.AddListener(delegate { OpenPreview(id); });
        }
        #region Тут альфа-значения для тогглов в настройках. Для теста задаем булку в инспекторе. Не цикл, потому что touchOne и touchSecond
        if (SettingsBool[0])
        {
            bgToggle[0].color = color[1];
            touchOne[0].transform.localPosition          = new Vector2(77.5f, touchOne[0].transform.localPosition.y);
            touchOne[1].transform.localPosition          = new Vector2(221f, touchOne[1].transform.localPosition.y);
            touchOne[2].transform.localPosition          = new Vector2(-31.665f, touchOne[2].transform.localPosition.y);
            gameObject.GetComponent <AudioSource>().mute = false;
        }
        else
        {
            bgToggle[0].color = color[0];
            touchOne[0].transform.localPosition          = new Vector2(-77.5f, touchOne[0].transform.localPosition.y);
            touchOne[1].transform.localPosition          = new Vector2(31.665f, touchOne[1].transform.localPosition.y);
            touchOne[2].transform.localPosition          = new Vector2(-221f, touchOne[2].transform.localPosition.y);
            gameObject.GetComponent <AudioSource>().mute = true;
        }
        if (SettingsBool[1])
        {
            bgToggle[1].color = color[1];
            touchSecond[0].transform.localPosition = new Vector2(77.5f, touchSecond[0].transform.localPosition.y);
            touchSecond[1].transform.localPosition = new Vector2(221f, touchSecond[1].transform.localPosition.y);
            touchSecond[2].transform.localPosition = new Vector2(-31.665f, touchSecond[2].transform.localPosition.y);
        }
        else
        {
            bgToggle[1].color = color[0];
            touchSecond[0].transform.localPosition = new Vector2(-77.5f, touchSecond[0].transform.localPosition.y);
            touchSecond[1].transform.localPosition = new Vector2(31.665f, touchSecond[1].transform.localPosition.y);
            touchSecond[2].transform.localPosition = new Vector2(-221f, touchSecond[2].transform.localPosition.y);
        }
        #endregion

        //Тут альфа-значения для тогглов в превью.
        DefaultUPDToggle();

        //print(Base64Encode("Какой-то текст"));
        //print(Base64Decode("0JrQsNC60L7QuS3RgtC+INGC0LXQutGB0YI="));
        if (!ach.achievments[0].get)
        {
            ach.getAch(0);
        }
        int perc = ((int)(((float)(casesNum - Cases_Level[level - 1]) / (Cases_Level[level] - Cases_Level[level - 1])) * 100));
        percent.text          = perc + "%";
        fillSlider.fillAmount = (float)perc / 100;
        sld.value             = (float)perc / 100;
    }