/* * SPDX-License-Identifier: AGPL-3.0-or-later * Copyright (C) 2025 Sergej Görzen * This file is part of xAPI4Unity. */ using System; using UnityEngine; using xAPI4Unity.Editor.Parser; namespace xAPI4Unity.Editor.Settings { /// /// Stores settings related to the local source of xAPI definitions. /// [Serializable] public class LocalSourceSettings : ISettings { [SerializeField] public string path = DefaultValues.RepoPath; [SerializeField] public int selectedOptionIndex = 0; // Selected source option [SerializeField] public string repoUrl = DefaultValues.RepoUrl; [SerializeField] public string repoDownloadUrl = DefaultValues.RepoDownloadUrl; [SerializeField] public string repoBranch = DefaultValues.RepoBranch; [SerializeField] public int gitCloneAmount = 0; // Counter for cloning operations /// /// Gets the download filename based on the branch. /// public string DownloadFilename => "xapi-" + repoBranch; /// /// Constructs the full download URL for the repository zip file. /// public string GetDownloadUrl() => $"{repoDownloadUrl}/-/archive/{repoBranch}/{DownloadFilename}.zip"; /// public T Clone() { return (T)(object)(new LocalSourceSettings() { path = path }); } /// public bool Equals(ISettings s) => (s as LocalSourceSettings)?.path == path; /// /// Generates a unique branch name for cloning operations. /// /// A unique branch name string. public string GetNewBranchName() => $"xapi-4-unity-{Application.productName.ClearName()}-{gitCloneAmount++}"; } }