using UnityEngine;
using System.Collections;
using System.Collections.Generic;
namespace Gaia
{
///
/// Gaia compatible extension publisher
///
public class GaiaCompatiblePublisher
{
///
/// Publisher name
///
public string m_publisherName;
///
/// Are we folded out in the intalled tab
///
public bool m_installedFoldedOut;
///
/// Are we folded out in the compatible tab
///
public bool m_compatibleFoldedOut;
///
/// The packages that belong to this publisher
///
private Dictionary m_packages = new Dictionary();
///
/// Get an existing package, or null if its not there
///
/// Package name to get
/// Package if we have it, or null if we dont
public GaiaCompatiblePackage GetPackage(string packageName)
{
GaiaCompatiblePackage package;
if (m_packages.TryGetValue(packageName, out package))
{
return package;
}
return null;
}
///
/// Get a list of the packages being managed for this publisher
///
///
public List GetPackages()
{
List packages = new List(m_packages.Values);
packages.Sort((a, b) => a.m_packageName.CompareTo(b.m_packageName));
return packages;
}
///
/// Return the number of installed packages
///
/// The number of installed packages
public int InstalledPackages()
{
int installedExtensions = 0;
foreach (KeyValuePair kvp in m_packages)
{
if (kvp.Value.m_isInstalled)
{
installedExtensions++;
}
}
return installedExtensions;
}
///
/// Return the number of compatible packages
///
/// The number of compatible packages
public int CompatiblePackages()
{
int compatiblePackages = 0;
foreach (KeyValuePair kvp in m_packages)
{
if (kvp.Value.m_isCompatible)
{
compatiblePackages++;
}
}
return compatiblePackages;
}
///
/// Add a package
///
///
public void AddPackage(GaiaCompatiblePackage package)
{
m_packages.Add(package.m_packageName, package);
}
}
}