Exemplo n.º 1
0
 public Standard(int iStandard=0,bool isNew=true)
 {
     this.Value = iStandard;
     if (Value == 0) Value = 6;
     if (Value>= 6 && Value<= 12)
     {
         Type = Profile.ProfileType.School_Student;
     }
     else if (Value >= 31 && Value <= 33)
     {
         Type = Profile.ProfileType.MBA_Student;
     }
     init();
     if (isNew)
     {
         AddSubjects();
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Adds to a list of profiles that contain the specified type.
        /// </summary>
        /// <param name="objType">The type of object to retrieve the profiles for.</param>
        /// <param name="profileNames">A list of profiles that contain the specifeid type.</param>
        private void GetProfilesForType(Type objType, Profile.ProfileType profileType, List <string> profileNames)
        {
            for (int i = 0; i < m_Profiles.Length; ++i)
            {
                if (m_Profiles[i].Type != profileType)
                {
                    continue;
                }
                Dictionary <Type, Profile.StateElement[]> typeStateMap;
                if (!m_ProfileStateMap.TryGetValue(m_Profiles[i].Name, out typeStateMap))
                {
                    continue;
                }

                // Add the profile name if the type exists.
                if (typeStateMap.ContainsKey(objType) && !profileNames.Contains(m_Profiles[i].Name))
                {
                    profileNames.Add(m_Profiles[i].Name);
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Returns a list of profiles that have been added to the specified GameObject.
        /// </summary>
        /// <param name="gameObject">The GameObject to retrieve the profiles for.</param>
        /// <param name="type">The type of profiles that should be shown.</param>
        /// <returns>A list of profiles that have been added to the specified GameObject.</returns>
        public List <string> GetProfilesForGameObject(GameObject gameObject, Profile.ProfileType type)
        {
            Initialize();

            var profileNames = new List <string>();

            if (gameObject == null)
            {
                // All of the profiles for the specfied type should be shown if the GameObject is null.
                if (m_Profiles != null)
                {
                    for (int i = 0; i < m_Profiles.Length; ++i)
                    {
                        if (type != m_Profiles[i].Type)
                        {
                            continue;
                        }
                        profileNames.Add(m_Profiles[i].Name);
                    }
                }
                return(profileNames);
            }
            var stateBehaviors = gameObject.GetComponents <StateBehavior>();

            for (int i = 0; i < stateBehaviors.Length; ++i)
            {
                GetProfilesForType(stateBehaviors[i].GetType(), type, profileNames);

                // The GameObject may contain the UltimateCharacterLocomotion component where the
                // movement types, abilities, item abilities, and effects also need to be searched.
                if (stateBehaviors[i] is Character.UltimateCharacterLocomotion)
                {
                    var characterLocomotion = stateBehaviors[i] as Character.UltimateCharacterLocomotion;

                    characterLocomotion.DeserializeMovementTypes();
                    for (int j = 0; j < characterLocomotion.MovementTypes.Length; ++j)
                    {
                        GetProfilesForType(characterLocomotion.MovementTypes[j].GetType(), type, profileNames);
                    }

                    characterLocomotion.DeserializeAbilities();
                    if (characterLocomotion.Abilities != null)
                    {
                        for (int j = 0; j < characterLocomotion.Abilities.Length; ++j)
                        {
                            GetProfilesForType(characterLocomotion.Abilities[j].GetType(), type, profileNames);
                        }
                    }

                    characterLocomotion.DeserializeItemAbilities();
                    if (characterLocomotion.ItemAbilities != null)
                    {
                        for (int j = 0; j < characterLocomotion.ItemAbilities.Length; ++j)
                        {
                            GetProfilesForType(characterLocomotion.ItemAbilities[j].GetType(), type, profileNames);
                        }
                    }

                    characterLocomotion.DeserializeEffects();
                    if (characterLocomotion.Effects != null)
                    {
                        for (int j = 0; j < characterLocomotion.Effects.Length; ++j)
                        {
                            GetProfilesForType(characterLocomotion.Effects[j].GetType(), type, profileNames);
                        }
                    }
                }

                // The GameObject may contain the CameraController component where the view types also need to be searched.
                if (stateBehaviors[i] is UltimateCharacterController.Camera.CameraController)
                {
                    var cameraController = stateBehaviors[i] as UltimateCharacterController.Camera.CameraController;

                    cameraController.DeserializeViewTypes();
                    for (int j = 0; j < cameraController.ViewTypes.Length; ++j)
                    {
                        GetProfilesForType(cameraController.ViewTypes[j].GetType(), type, profileNames);
                    }
                }
            }

            return(profileNames);
        }
Exemplo n.º 4
0
        private bool HandleProfile(StreamDeckDeviceInfo deviceInfo, Dictionary <Profile.ProfileType, Profile.ProfileData> profiles, Profile.ProfileType stateType, bool state)
        {
            if (!profiles.ContainsKey(stateType))
            {
                return(false);
            }

            if (!_lastStatus.ContainsKey(deviceInfo.Id))
            {
                _lastStatus.Add(deviceInfo.Id, null);
            }

            if (state && _lastStatus[deviceInfo.Id] != stateType.ToString())
            {
                var p = profiles[stateType];

                Logger.Instance.LogMessage(TracingLevel.DEBUG, "switch profile " + stateType + " to " + p.Name + " for " + p.DeviceType);

                Connection.SwitchProfileAsync(p.Name);

                _lastStatus[deviceInfo.Id] = stateType.ToString();
            }

            return(state);
        }
Exemplo n.º 5
0
        private bool HandleProfile(StreamDeckDeviceInfo deviceInfo, Dictionary <Profile.ProfileType, Profile.ProfileData> profiles, Profile.ProfileType stateType, bool state)
        {
            var key = stateType + deviceInfo.Id;

            if (!_lastStatus.ContainsKey(key))
            {
                _lastStatus.Add(key, null);
            }

            if (state && _lastStatus[key] != true)
            {
                foreach (var p in profiles.Where(x => x.Key == stateType))
                {
                    Logger.Instance.LogMessage(TracingLevel.DEBUG, "switch profile " + stateType + " to " + p.Value.Name + " for " + p.Value.DeviceType);

                    Connection.SwitchProfileAsync(p.Value.Name);
                }
            }

            _lastStatus[key] = state;

            if (state && stateType != Profile.ProfileType.Main)
            {
                _lastStatus[Profile.ProfileType.Main + deviceInfo.Id] = false;
            }

            return(state);
        }