Exemplo n.º 1
0
        public KitControllerStatus PageFromState(out Page page)
        {
            if (PlayerSettings.Android.minSdkVersion.CompareTo(MinimumSdkVersion) < 0)
            {
                EditorUtility.DisplayDialog(
                    "Minimum SDK Version",
                    "The latest version of Twitter requires Android SDK version 14 or above. Please change the 'Minimum API Level' property within the Player to at least 'Android 4.0'.",
                    "OK"
                    );
                page = null;
                return(KitControllerStatus.CurrentPage);
            }

            List <Settings.InstalledKit> installedKits = Settings.Instance.InstalledKits;

            Settings.InstalledKit twitterKit = installedKits.Find(kit => kit.Name.Equals(Twitter, StringComparison.OrdinalIgnoreCase));

            switch (twitterKit.InstallationStatus)
            {
            case Settings.KitInstallationStatus.Installed:
                return(ShowInstalledPage(out page));

            case Settings.KitInstallationStatus.Imported:
                return(ShowInstallationFlowPage(Settings.Instance.FlowSequence, out page));

            case Settings.KitInstallationStatus.Configured:
            default:
                return(ShowConfiguredPage(out page));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        //	This makes it easy to create, name and place unique new ScriptableObject asset files.
        /// </summary>
        public static void CreateAssets(OCDelegate[] assets)
        {
            string path = AssetDatabase.GetAssetPath(Selection.activeObject);

            if (path == "")
            {
                path = "Assets";
            }
            else
            if (Path.GetExtension(path) != "")
            {
                path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
            }

            path += "/OpenCog Assets/OtherAssets/ActionConditions/";

            foreach (OCDelegate asset in assets)
            {
                string     basePath      = path + asset.Name + " " + typeof(OCDelegate).Name + ".asset";
                OCDelegate existingAsset = (OCDelegate)AssetDatabase.LoadAssetAtPath(basePath, typeof(OCDelegate));

                if (existingAsset != null)
                {
                    AssetDatabase.DeleteAsset(basePath);
                }

                string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(basePath);
                AssetDatabase.CreateAsset(asset, assetPathAndName);
            }


            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = assets[0];
        }
Exemplo n.º 3
0
        /// <summary>Check target is prefab in play mode</summary>
        /// <see cref="http://forum.unity3d.com/threads/i-found-the-solution-for-checking-if-a-gameobject-is-prefab-ghost-or-not.272958/"/>
        /// <param name="self"></param>
        /// <returns></returns>
        private static bool IsPrefab(GameObject self)
        {
#if UNITY_EDITOR
            return(EditorUtility.IsPersistent(self));
#else
            return(self.scene.rootCount == 0);

            // return self.scene.buildIndex < 0;
#endif
        }
Exemplo n.º 4
0
        /// <summary>
        //	This makes it easy to create, name and place unique new ScriptableObject asset files.
        /// </summary>
        public static void CreateAsset <T>(T asset) where T : ScriptableObject
        {
            string path = AssetDatabase.GetAssetPath(Selection.activeObject);

            if (path == "")
            {
                path = "Assets";
            }
            else
            if (Path.GetExtension(path) != "")
            {
                path = path.Replace(Path.GetFileName(AssetDatabase.GetAssetPath(Selection.activeObject)), "");
            }

            string assetPathAndName = AssetDatabase.GenerateUniqueAssetPath(path + "/New " + typeof(T).ToString() + ".asset");

            AssetDatabase.CreateAsset(asset, assetPathAndName);

            AssetDatabase.SaveAssets();
            EditorUtility.FocusProjectWindow();
            Selection.activeObject = asset;
        }