コード例 #1
0
        void OnEnable()
        {
            _target = (ParticleSortingTrick)target;
            if (bPrefab = PrefabHelper.IsPrefab(_target.gameObject))
            {
                return;
            }

            _target.Update_Child(true);

            _fFudgeMax = serializedObject.FindProperty("fFudgeMax");
        }
コード例 #2
0
        public override void OnInspectorGUI()
        {
            if (bDrawDefaultInspector)
            {
                DrawDefaultInspector();
            }

            MonoBehaviour mb = target as MonoBehaviour;

            if (PrefabHelper.IsPrefab(mb.gameObject))
            {
                return;
            }

            var type = target.GetType();

            bool bPrintLabel = false;

            foreach (var method in type.GetMethods(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance))
            {
                ParameterInfo[] parameters = method.GetParameters();
                var             attributes = method.GetCustomAttributes(typeof(MethodBTN_MonoBehaviour.MethodBTNAttribute), true);
                if (attributes.Length > 0)
                {
                    if (!bPrintLabel)
                    {
                        EditorGUILayout.Separator();
                        EditorGUILayout.LabelField("[Method Button]", EditorStyles.boldLabel);
                        bPrintLabel = true;
                    }
                    MethodBTN_MonoBehaviour.MethodBTNAttribute attribute = ((MethodBTN_MonoBehaviour.MethodBTNAttribute)attributes[0]);
                    bool bEnable = !attribute.bPlayModeOnly || Application.isPlaying;
                    using (new EditorGUI.DisabledGroupScope(!bEnable))
                    {
                        if (GUILayout.Button(string.Format("{0} {1}()", bEnable ? "" : "[allowed during Playing]", method.Name)))
                        {
                            Debug.Log(string.Format("MethodBTNAttribute Launch Detected! : {0} {1}", target, method.Name));
                            method.Invoke(target, parameters.Length == 0 ? null : attribute.args);
                        }
                    }
                }
            }
        }
コード例 #3
0
        public static TileWand CreateAsset(string path, IsoTile tile)
        {
            TileWand newTileWand = ScriptableObject.CreateInstance <TileWand>();

            string _path = AssetDatabase.GenerateUniqueAssetPath(path + ".asset");

            AssetDatabase.CreateAsset(newTileWand, _path);

            GameObject tileGameObject = tile.gameObject;

            if (!PrefabHelper.IsPrefab(tileGameObject))
            {
                tileGameObject = PrefabHelper.CreatePrefab(AssetDatabase.GenerateUniqueAssetPath(path + ".prefab"), tileGameObject);
            }

            // Revert All Lightings
            tile = IsoTile.Find(tileGameObject);
            tile.LightRecivers_RevertAll();
            tile.LightRecivers_RemoveAll(false);

            IsometricSortingOrder iso = tile.GetComponent <IsometricSortingOrder>();

            iso.Clear_Backup(false);

            newTileWand.Prefab = tileGameObject;

            MakeIcon(newTileWand);

            if (newTileWand != null)
            {
                // AssetDatabase.AddObjectToAsset(tilePrefab, newTileWand);
                EditorUtility.SetDirty(newTileWand);
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }

            if (newTileWand == null)
            {
                newTileWand = AssetDatabase.LoadAssetAtPath <TileWand>(_path);
            }

            return(newTileWand);
        }