예제 #1
0
        public override void Init(bool setToDefaultValues = false)
        {
            FSystem.LockDsp();
            Bands.Clear();

            var gainValues = !setToDefaultValues && EqualizerSettings != null ? EqualizerSettings.GainValues : null;

            foreach (var value in EqDefaultValues)
            {
                var band = GetEqualizerBand(IsEnabled, value[0], value[1], value[2]);

                if (band == null)
                {
                    continue;
                }
                ((FmodEqualizerBand)band).PropertyChanged += (sender, e) =>
                {
                    if (e.PropertyName == "Gain")
                    {
                        SaveEqualizerSettings();
                    }
                };

                if (gainValues != null && gainValues.TryGetValue(band.BandCaption, out float savedValue))
                {
                    band.Gain = savedValue;
                }
                Bands.Add(band);
            }
            FSystem.UnlockDsp();
        }
    public ButtonSystem()
    {
        instance = this;
        SystemHolder.allSystems.Add(this);

        Texture2D cursor = Resources.Load <Texture2D>("Pixel Cursors/Cursors/basic_01");

        Cursor.SetCursor(cursor, new Vector2(10, 5), CursorMode.Auto);
    }
    public PointerSystem()
    {
        instance = this;
        SystemHolder.allSystems.Add(this);

        _selectedGO.addEntryCallback(objectSelection);
        //_selectedGO.addExitCallback(objectUnselection);
        _unselectedGO.addEntryCallback(objectUnselection);
    }
예제 #4
0
        public override void DeInit()
        {
            FSystem.LockDsp();

            foreach (var band in Bands)
            {
                band.Remove();
            }

            FSystem.UnlockDsp();
        }
예제 #5
0
    public MoveSystem()
    {
        instance = this;
        SystemHolder.allSystems.Add(this);
        SystemHolder.pausableSystems.Add(this);

        Grid grid = Object.FindObjectOfType <Grid>();

        if (grid != null)
        {
            myMaps = grid.GetComponent <GridMap>();
        }
    }
예제 #6
0
        public override IEqualizerBand GetEqualizerBand(bool isActive, float centerValue, float bandwithValue, float gainValue)
        {
            Dsp dspParamEq = null;

            if (isActive)
            {
                FSystem.CreateDspByType(Fmod.CoreDSP.DspType.Parameq, out dspParamEq);

                FChannel.AddDsp(ChannelControlDspIndex.Tail, dspParamEq);

                dspParamEq.SetParameterFloat((int)DspParamEq.Center, centerValue);

                dspParamEq.SetParameterFloat((int)DspParamEq.Center, bandwithValue);

                dspParamEq.SetParameterFloat((int)DspParamEq.Gain, gainValue);

                dspParamEq.SetActive(true);
            }

            var band = new FmodEqualizerBand(FChannel, dspParamEq, centerValue, gainValue, isActive);

            return(band);
        }
 public FactorySystem()
 {
     instance = this;
     SystemHolder.allSystems.Add(this);
     SystemHolder.pausableSystems.Add(this);
 }
 public BlockingSystem()
 {
     instance = this;
     SystemHolder.allSystems.Add(this);
     SystemHolder.pausableSystems.Add(this);
 }
예제 #9
0
        /// <summary>Parse all systems and inspect their families</summary>
        public void synchronizeFamilies()
        {
            // avoid to inspect System in playing mode
            if (Application.isPlaying)
            {
                return;
            }

            availableFamilies = new List <FamilyAssociation>();

            // Load all FSystem included into assembly
#if NET3_5
            System.Type[] systemTypes = (from assembly in System.AppDomain.CurrentDomain.GetAssemblies()
#else
            System.Type[] systemTypes = (from assembly in System.AppDomain.CurrentDomain.GetAssemblies().Where(p => !p.IsDynamic)
#endif
                                         from type in assembly.GetExportedTypes()
                                         where (type.IsClass == true && type.IsAbstract == false && type.IsSubclassOf(typeof(FSystem)) == true)
                                         select type).ToArray();
            // Parse all FSystems
            for (int i = 0; i < systemTypes.Length; ++i)
            {
                System.Type systemType = systemTypes [i];
                try{
                    // Create instance of FSystem in order to know its Families types
                    FSystem system = (FSystem)System.Activator.CreateInstance(systemType);
                    // Load all members of this System
                    MemberInfo[] members = systemType.GetMembers(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
                    foreach (MemberInfo member in members)
                    {
                        if (member.MemberType == MemberTypes.Field)
                        {
                            FieldInfo field = (FieldInfo)member;
                            if (field.FieldType == typeof(FYFY.Family))
                            {
                                Family f = (Family)field.GetValue(system);
                                if (f != null)                                  // could be null if family is declared but not instantiated
                                // Check if this family is equivalent to another family already loaded
                                {
                                    string equivFamily = null;
                                    foreach (FamilyAssociation f_alreadyStored in availableFamilies)
                                    {
                                        if (f.Equals(f_alreadyStored.family))
                                        {
                                            equivFamily = f_alreadyStored.equivWith;
                                        }
                                    }
                                    // store data and link with equivalent family
                                    FamilyAssociation entry = new FamilyAssociation();
                                    entry.systemName = systemType.FullName;
                                    entry.familyName = field.Name;
                                    entry.family     = f;
                                    if (equivFamily != null)
                                    {
                                        entry.equivWith = equivFamily;
                                    }
                                    else
                                    {
                                        entry.equivWith = "equivWith_" + entry.systemName + "_" + entry.familyName;
                                    }
                                    availableFamilies.Add(entry);
                                }
                            }
                        }
                    }
                } catch (Exception) {
                    UnityEngine.Debug.LogError(systemType.FullName + ": Instance creation failed (all families of this system are ignored). MonitoringManager requires to instantiate your systems in order to inspect their families. Common solution: Check in your constructor if Application.isPlaying is true.");
                }
            }

            // Check if associations between FamilyMonitoring components and new available families are still stable
            for (int i = f_monitors.Count - 1; i >= 0; i--)
            {
                bool found = false;
                foreach (FamilyAssociation fa in availableFamilies)
                {
                    if (fa.family.Equals(f_monitors[i].descriptor))
                    {
                        found = true;                         // we found one
                        f_monitors[i].equivalentName  = fa.equivWith;
                        f_monitors[i].gameObject.name = fa.equivWith;
                        break;
                    }
                }
                if (!found)
                {
                    DestroyImmediate(f_monitors[i].gameObject);
                }
            }
        }
 public GrowthAndLiveSystem()
 {
     instance = this;
     SystemHolder.allSystems.Add(this);
     SystemHolder.pausableSystems.Add(this);
 }
 public UISystem()
 {
     instance = this;
     SystemHolder.allSystems.Add(this);
 }