Example #1
0
    public void SetModel(LevelMeta.ChartSection section)
    {
        this.section = section;
        Difficulty   = Difficulty.Parse(section.type);

        gradientMesh.SetGradient(Difficulty.Gradient);
        name.text  = !section.name.IsNullOrEmptyTrimmed() ? section.name : Difficulty.Name;
        level.text = "LV." + Difficulty.ConvertToDisplayLevel(section.difficulty);

        LayoutFixer.Fix(transform);
    }
Example #2
0
    public IEnumerator Share()
    {
        if (isSharing)
        {
            yield break;
        }

        isSharing = true;
        Context.Haptic(HapticTypes.SoftImpact, true);
        Context.AudioManager.Get("Navigate3").Play(ignoreDsp: true);

        var levelMeta = Context.SelectedLevel.Meta;

        yield return(new WaitForEndOfFrame());

        var screenshot = new Texture2D(UnityEngine.Screen.width, UnityEngine.Screen.height, TextureFormat.RGB24, false);

        screenshot.ReadPixels(new Rect(0, 0, UnityEngine.Screen.width, UnityEngine.Screen.height), 0, 0);
        screenshot.Apply();

        var tmpPath = Path.Combine(Application.temporaryCachePath,
                                   DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + ".png");

        File.WriteAllBytes(tmpPath, screenshot.EncodeToPNG());

        Destroy(screenshot);

        var diff      = Difficulty.ConvertToDisplayLevel(levelMeta.GetDifficultyLevel(Context.SelectedDifficulty.Id));
        var shareText = $"#cytoid [Lv.{diff}] {levelMeta.artist} - {levelMeta.title} / Charter: {levelMeta.charter}";

        if (uploadRecordSuccess)
        {
            shareText += $"\n{Context.WebsiteUrl}/levels/{levelMeta.id}";
        }

        new NativeShare()
        .AddFile(tmpPath)
        .SetText(shareText)
        .Share();

        isSharing = false;
    }
Example #3
0
 public void SetModel(Difficulty difficulty, int level)
 {
     text.text = Difficulty.ConvertToDisplayLevel(level);
     gradientMeshEffect.SetGradient(difficulty.Gradient);
 }