Ejemplo n.º 1
0
        /// <summary>
        /// Load Saved data
        /// </summary>
        private void OnEnable()
        {
            websiteSettings = Resources.Load <WebsiteSettings>("WebsiteSettingsData");
            if (websiteSettings == null)
            {
                CreateWebsiteSettings();
                websiteSettings = Resources.Load <WebsiteSettings>("WebsiteSettingsData");
            }

            LoadSettings(websiteSettings);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create settings data if is does not exists
        /// </summary>
        private void CreateWebsiteSettings()
        {
            WebsiteSettings asset = CreateInstance <WebsiteSettings>();

            if (!AssetDatabase.IsValidFolder("Assets/GleyPlugins/InternetAvailability/Resources"))
            {
                AssetDatabase.CreateFolder("Assets/GleyPlugins/InternetAvailability", "Resources");
                AssetDatabase.Refresh();
            }

            AssetDatabase.CreateAsset(asset, "Assets/GleyPlugins/InternetAvailability/Resources/WebsiteSettingsData.asset");
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Call this method to check the Internet availability of the device
        /// </summary>
        /// <param name="completeMethod"></param>
        public void CheckConnection(UnityAction <ConnectionResult> completeMethod)
        {
            if (Application.internetReachability == NetworkReachability.NotReachable)
            {
                completeMethod(ConnectionResult.NetorkCardDisabled);
                return;
            }

            WebsiteSettings websiteSettings = Resources.Load <WebsiteSettings>("WebsiteSettingsData");

            availableServers = websiteSettings.websitesToPing.Count;
            for (int i = 0; i < websiteSettings.websitesToPing.Count; i++)
            {
                StartCoroutine(TestURL(websiteSettings.websitesToPing[i], completeMethod));
            }
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Load settings
 /// </summary>
 /// <param name="websiteSettings"></param>
 private void LoadSettings(WebsiteSettings websiteSettings)
 {
     websitesToPing = websiteSettings.websitesToPing;
 }