コード例 #1
0
ファイル: PerfectFXView.cs プロジェクト: Apelmon/FitPose
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        _text = GetComponent <TextMeshProUGUI>();
        if (_text == null)
        {
            throw new NullReferenceException("ScoreDisplayView - text is missing!");
        }

        Scale       = Vector3.one;
        _text.color = new Color(_text.color.r, _text.color.g, _text.color.b, 1.0f);

        if (_originalPos == Vector2.one * 1000)
        {
            _originalPos = rectTransform.anchoredPosition;
        }
        else
        {
            rectTransform.anchoredPosition = _originalPos;
        }

        Rotation = new Vector3(0, 0, Rand.game.Int(-15, 15));

        LinkedEntity.isViewEnable = true;

        LinkedEntity.AddViewEnableListener(this);
        LinkedEntity.AddViewEnableRemovedListener(this);
    }
コード例 #2
0
        private LinkedEntity Clone(LinkedEntity source)
        {
            return(new LinkedEntity
            {
                EntityType = source.EntityType,
                SourceSystemName = source.SourceSystemName,
                SourceSystemId = source.SourceSystemId,

                Name = source.Name,
                Type = source.Type,
                SubType = source.SubType,
                Status = source.Status,
                OpenDate = source.OpenDate,
                CloseDate = source.CloseDate,
                Urn = source.Urn,
                Ukprn = source.Ukprn,
                Uprn = source.Uprn,
                CompaniesHouseNumber = source.CompaniesHouseNumber,
                CharitiesCommissionNumber = source.CharitiesCommissionNumber,
                AcademyTrustCode = source.AcademyTrustCode,
                DfeNumber = source.DfeNumber,
                LocalAuthorityCode = source.LocalAuthorityCode,
                ManagementGroupType = source.ManagementGroupType,
                ManagementGroupId = source.ManagementGroupId,
                ManagementGroupCode = source.ManagementGroupCode,
                ManagementGroupUkprn = source.ManagementGroupUkprn,
                ManagementGroupCompaniesHouseNumber = source.ManagementGroupCompaniesHouseNumber,

                LinkType = source.LinkType,
                LinkedBy = source.LinkedBy,
                LinkedReason = source.LinkedReason,
                LinkedAt = source.LinkedAt,
            });
        }
コード例 #3
0
ファイル: HumanoidView.cs プロジェクト: Apelmon/FitPose
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        _points = new List <Transform>()
        {
            _body.transform,
            _leftFootPole.transform,
            _leftFootTarget.transform,
            _rightFootPole.transform,
            _rightFootTarget.transform,
            _leftHandPole.transform,
            _leftHandTarget.transform,
            _rightHandPole.transform,
            _rightHandTarget.transform,
        };

        _pointsPoses = new List <PosePointData>()
        {
            _poseConfig.Body,
            _poseConfig.LeftFootPole,
            _poseConfig.LeftFootTarget,
            _poseConfig.RightFootPole,
            _poseConfig.RightFootTarget,
            _poseConfig.LeftHandPole,
            _poseConfig.LeftHandTarget,
            _poseConfig.RightHandPole,
            _poseConfig.RightHandTarget
        };

        LinkedEntity.AddAnyPoseValueListener(this);
    }
コード例 #4
0
        void RecalculateLOP()
        {
            LOP = Blood + Phlegm + YellowBile + BlackBile;

            if (DieOfUnbalance && LOP > 0)
            {
                float bloodRatio      = Blood / LOP;
                float phlegmRatio     = Phlegm / LOP;
                float yellowBileRatio = YellowBile / LOP;
                float blackBileRatio  = BlackBile / LOP;
                if (bloodRatio > 0.6f || phlegmRatio > 0.6f || yellowBileRatio > 0.6f || blackBileRatio > 0.6f)
                {
                    LinkedEntity.Destroy();
                }
                else
                {
                    // On compte le nombre de ratios au dessus de 0.4f.
                    int overUnbalanceRatio = new[] { bloodRatio > 0.4f, phlegmRatio > 0.4f, yellowBileRatio > 0.4f, blackBileRatio > 0.4f }.Count(x => x);
                    if (overUnbalanceRatio >= 2)
                    {
                        LinkedEntity.Destroy();
                    }
                }
            }
            else if (LOP == 0)
            {
                LinkedEntity.Destroy();
            }
        }
コード例 #5
0
 void ExecuteCanalise()
 {
     if (CurrentSpell != null)
     {
         bool    canCast = true;
         float[] costs   = SpellsManager.GetSpellByID(CurrentSpell.GetSpell().ID).OnCastCosts;
         if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetBlood() < costs[0])
         {
             canCast = false;
         }
         if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetPhlegm() < costs[1])
         {
             canCast = false;
         }
         if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetYellowBile() < costs[2])
         {
             canCast = false;
         }
         if (((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).GetBlackBile() < costs[3])
         {
             canCast = false;
         }
         if (canCast)
         {
             ((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent))).RemoveHumors(costs);
             CurrentSpell.ExecuteOnCanalise();
         }
         else
         {
             ExecuteEnd();
             Debugger.Log("Pas assez d'humeur par rapoort au coût de ce sort !");
         }
     }
 }
コード例 #6
0
        private void Awake()
        {
            World world = Container.Resolve <World>();

            world.Subscribe <CancelMessage>(delegate {
                if (!gameObject.activeSelf)
                {
                    return;
                }
                Destroy(gameObject);
            });


            world.Subscribe <SubmitMessage>(delegate {
                if (!gameObject.activeSelf)
                {
                    return;
                }
                HandleComponent handle = LinkedEntity.Get <HandleComponent>();
                handle.Entity.ApplyCommand(new ProcessActionCommand(
                                               handle.Action,
                                               LinkedEntity.Get <PositionComponent>().Value
                                               ));

                gameObject.SetActive(false);
            });
        }
コード例 #7
0
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        _rigidbody = GetComponent <Rigidbody>();

        LinkedEntity.AddRigidbody(this);
    }
コード例 #8
0
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        LinkedEntity.AddViewEnableListener(this);
        LinkedEntity.AddViewEnableRemovedListener(this);

        AddListener();
    }
コード例 #9
0
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        Enabled = false;
        LinkedEntity.isTutorial = true;

        LinkedEntity.AddViewEnableListener(this);
        LinkedEntity.AddViewEnableRemovedListener(this);
    }
コード例 #10
0
ファイル: MonsterTestState.cs プロジェクト: RagtagShawn/Igor
		public override LinkedEntity<MonsterTestBase> EditorDuplicate(LinkedEntity<MonsterTestBase> DerivedDuplicateInto = null)
		{
			MonsterTestState DuplicateInto = (MonsterTestState)DerivedDuplicateInto;
			
			if(DuplicateInto == null)
			{
				DuplicateInto = new MonsterTestState();
			}
			
			return base.EditorDuplicate(DuplicateInto);
		}
コード例 #11
0
ファイル: CameraView.cs プロジェクト: Apelmon/FitPose
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        _camera = GetComponent <Camera>();

        LinkedEntity.isMainCamera = true;
        LinkedEntity.AddCamera(this);
        LinkedEntity.AddPosition(Position);

        AddDefaultListeners();
    }
コード例 #12
0
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        Enabled = false;
        LinkedEntity.isLevelProgressBar = true;

        LinkedEntity.AddViewEnableListener(this);
        LinkedEntity.AddViewEnableRemovedListener(this);

        var levelListenerEntity = contexts.gameState.CreateEntity();

        levelListenerEntity.AddAnyCurrentLevelListener(this);
    }
コード例 #13
0
    public override void Initialize(Contexts contexts, IEntity entity)
    {
        base.Initialize(contexts, entity);

        _buttonsInteracteBuffer = new bool[_buttons.Length];

        LinkedEntity.isViewEnable   = false;
        LinkedEntity.isInteractable = false;
        OnInteractableRemoved(null);

        LinkedEntity.AddViewEnableListener(this);
        LinkedEntity.AddViewEnableRemovedListener(this);
        LinkedEntity.AddInteractableListener(this);
        LinkedEntity.AddInteractableRemovedListener(this);
    }
コード例 #14
0
        /// <summary>
        ///     Queries a collection resource for a single item, async.
        /// </summary>
        /// <typeparam name="TOut">The type of the t out.</typeparam>
        /// <param name="objFunc">The object function.</param>
        /// <returns>Task&lt;TOut[]&gt;.</returns>
        public async Task <TOut> QueryAsync <TOut>(Func <IEnumerable <TCollection>, LinkedEntity <TOut> > objFunc)
            where TOut : class, ICrestResource <TOut>
        {
            CollectionResource <T, TCollection> collection = this;
            List <TCollection> list = collection.Items.ToList();

            if (EveCrest.EnableAutomaticPaging)
            {
                while (collection.Next != null)
                {
                    collection = await EveCrest.LoadAsync(collection.Next).ConfigureAwait(false);

                    list.AddRange(collection.Items);
                }
            }
            LinkedEntity <TOut> item = objFunc.Invoke(list);

            return(await EveCrest.LoadAsync(item).ConfigureAwait(false));
        }
コード例 #15
0
        void Cast(uint spellID, object target)
        {
            Spell s = SpellsManager.GetSpellByID(spellID);

            if (s != null)
            {
                bool    canCast = true;
                float[] costs   = s.OnCastCosts;
                if (LinkedEntity.GetComponent <HumorsComponent>() != null)
                {
                    HumorsComponent humors = ((HumorsComponent)LinkedEntity.GetComponent(typeof(HumorsComponent)));
                    if (humors.GetBlood() < costs[0])
                    {
                        canCast = false;
                    }
                    else if (humors.GetPhlegm() < costs[1])
                    {
                        canCast = false;
                    }
                    else if (humors.GetYellowBile() < costs[2])
                    {
                        canCast = false;
                    }
                    else if (humors.GetBlackBile() < costs[3])
                    {
                        canCast = false;
                    }
                }
                if (canCast)
                {
                    if (LinkedEntity.GetComponent <HumorsComponent>() != null)
                    {
                        LinkedEntity.GetComponent <HumorsComponent>().RemoveHumors(costs);
                    }
                    CurrentSpell = s.Cast(LinkedEntity, target);
                }
                else
                {
                    Debugger.Log("Pas assez d'humeur par rapport au coût de ce sort !");
                }
            }
        }
コード例 #16
0
        /// <summary>
        /// Appelle "OnSynch" de tous les Components implémentants IEntitySynchroniser de cette entité.
        /// Synchronise également la Position, la Rotation, la Cellule actuelle,
        /// la taille, et la hauteur.
        /// </summary>
        public void OnSynch()
        {
            if (SynchData == null)
            {
                Debugger.Log("ERREUR : le SynchData n'a pas été initialisé !", UnityEngine.Color.red);
                return;
            }
            // Synchronisation des propriétés basiques :
            LinkedEntity.Position = (BloodAndBileEngine.SerializableVector3)SynchData.GetSynchInfo("Position");
            LinkedEntity.Rotation = (BloodAndBileEngine.SerializableQuaternion)SynchData.GetSynchInfo("Rotation");
            LinkedEntity.SetCellID((int)SynchData.GetSynchInfo("CurrentCell"));
            LinkedEntity.Size   = (float)SynchData.GetSynchInfo("Size");
            LinkedEntity.Height = (float)SynchData.GetSynchInfo("Height");

            // Synchronisation des Components
            // Pour chaque ComponentSynchronizationDataObject, on vérifie que l'entité
            // possède le component correspondant, puis on exécute le GetSynch() sur ce dernier.
            // Si l'entité n'a pas le component, on lui ajoute.
            foreach (ComponentSynchronizationDataObject componentData in SynchData.GetComponentSynchData())
            {
                EntityComponent component = LinkedEntity.GetComponent(componentData.ComponentType);
                if (component != null)
                {
                    if (component is IEntitySynchroniser)
                    {
                        ((IEntitySynchroniser)(component)).OnSynch(componentData); // On lance la synchronisation.
                    }
                }
                else // On ajoute le component
                {
                    component = LinkedEntity.AddComponent(componentData.ComponentType);
                    if (component != null && component is IEntitySynchroniser)
                    {
                        ((IEntitySynchroniser)(component)).OnSynch(componentData);
                    }
                }
            }
        }
コード例 #17
0
        // Met à jour l'objet "EntitySynchroniserObject" lié à cette instance.
        public override void Update(float deltaTime)
        {
            // A chaque synchronisation : récolte des données de synchronisation auprès de chaque
            // component de l'entité implémentant IEntitySynchroniser.
            // Ajoute également les informations de base de l'entité : Position, Rotation, Cellule actuelle,
            // taille, hauteur.

            // Synchronisation des Components.
            foreach (EntityComponent component in LinkedEntity.GetComponents())
            {
                if (component is IEntitySynchroniser)
                {
                    SynchData.SetComponentSynchInfo(component.GetType(), ((IEntitySynchroniser)component).GetSynchInfo());
                }
            }

            // Synchronisation des infos de base
            SynchData.SetBasicSynchInfo("Position", LinkedEntity.Position);
            SynchData.SetBasicSynchInfo("Rotation", LinkedEntity.Rotation);
            SynchData.SetBasicSynchInfo("CurrentCell", LinkedEntity.CurrentCellID);
            SynchData.SetBasicSynchInfo("Size", LinkedEntity.Size);
            SynchData.SetBasicSynchInfo("Height", LinkedEntity.Height);
        }
コード例 #18
0
 /// <summary>
 /// Queries the asynchronous.
 /// </summary>
 /// <typeparam name="TOut">The type of the t out.</typeparam>
 /// <typeparam name="TParam">The type of the t parameter.</typeparam>
 /// <param name="objFunc">The object function.</param>
 /// <param name="param">The parameter.</param>
 /// <returns>Task&lt;TOut&gt;.</returns>
 public Task <TOut> QueryAsync <TOut, TParam>(Func <T, Href <TOut> > objFunc, LinkedEntity <TParam> param)
     where TOut : class, ICrestResource <TOut> where TParam : IQueryParameter <TParam>
 {
     return(EveCrest.LoadAsync(objFunc.Invoke(this as T), param));
 }
コード例 #19
0
 /// <summary>
 /// Queries the specified object function.
 /// </summary>
 /// <typeparam name="TOut">The type of the t out.</typeparam>
 /// <typeparam name="TParam">The type of the t parameter.</typeparam>
 /// <param name="objFunc">The object function.</param>
 /// <param name="param">The parameter.</param>
 /// <returns>TOut.</returns>
 public TOut Query <TOut, TParam>(Func <T, Href <TOut> > objFunc, LinkedEntity <TParam> param)
     where TOut : class, ICrestResource <TOut> where TParam : IQueryParameter <TParam>
 {
     return(QueryAsync(objFunc, param).Result);
 }
コード例 #20
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AutopilotWaypoint" /> class.
 /// </summary>
 public AutopilotWaypoint()
 {
     SolarSystem = new LinkedEntity <SolarSystem>();
 }
コード例 #21
0
 /// <summary>
 /// Loads the specified URI.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TParam">The type of the t parameter.</typeparam>
 /// <param name="uri">The URI.</param>
 /// <param name="param">The parameter.</param>
 /// <returns>T.</returns>
 public T Load <T, TParam>(Href <T> uri, LinkedEntity <TParam> param) where T : class, ICrestResource <T> where TParam : IQueryParameter <TParam>
 {
     return(LoadAsync(uri, param).Result);
 }
コード例 #22
0
 /// <summary>
 /// Loads the asynchronous.
 /// </summary>
 /// <typeparam name="T"></typeparam>
 /// <typeparam name="TParam">The type of the t parameter.</typeparam>
 /// <param name="uri">The URI.</param>
 /// <param name="param">The parameter.</param>
 /// <returns>Task&lt;T&gt;.</returns>
 public Task <T> LoadAsync <T, TParam>(Href <T> uri, LinkedEntity <TParam> param) where T : class, ICrestResource <T> where TParam : IQueryParameter <TParam>
 {
     return(uri == null
         ? Task.FromResult(default(T))
         : getAsync <T>((createQueryString(uri.Uri, QueryParameters.GetParameterName <TParam>(), param.Href.ToString()))));
 }
コード例 #23
0
        private async Task <LinkedEntity> MapToEntityAsync(Establishment establishment, DateTime date, CancellationToken cancellationToken)
        {
            // Translate
            var translatedType = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderType, SourceSystemNames.GetInformationAboutSchools,
                                                                            establishment.EstablishmentTypeGroup.Code, cancellationToken);

            var translatedSubType = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderSubType, SourceSystemNames.GetInformationAboutSchools,
                                                                               establishment.TypeOfEstablishment.Code, cancellationToken);

            var translatedStatus = await _translation.TranslateEnumValueAsync(EnumerationNames.ProviderStatus, SourceSystemNames.GetInformationAboutSchools,
                                                                              establishment.EstablishmentStatus.Code, cancellationToken);

            // Build entity provider details
            var entity = new LinkedEntity
            {
                LinkedAt         = DateTime.Now,
                LinkedBy         = "HistoricalDataPreparer",
                EntityType       = EntityTypeLearningProvider,
                SourceSystemName = SourceSystemNames.GetInformationAboutSchools,
                SourceSystemId   = establishment.Urn.ToString(),
                Name             = establishment.EstablishmentName,
                Type             = translatedType,
                SubType          = translatedSubType,
                Status           = translatedStatus,
                OpenDate         = establishment.OpenDate,
                CloseDate        = establishment.CloseDate,
                Urn   = establishment.Urn,
                Ukprn = establishment.Ukprn,
                Uprn  = establishment.Uprn,
                CompaniesHouseNumber      = establishment.CompaniesHouseNumber,
                CharitiesCommissionNumber = establishment.CharitiesCommissionNumber,
                AcademyTrustCode          = establishment.Trusts?.Code,
                DfeNumber          = $"{establishment.LA.Code}/{establishment.EstablishmentNumber}",
                LocalAuthorityCode = establishment.LA.Code,
            };

            // Add management group details
            var group = establishment.Trusts != null && !string.IsNullOrEmpty(establishment.Trusts.Code)
                ? await _preparedGiasRepository.GetGroupAsync(long.Parse(establishment.Trusts.Code), date, cancellationToken)
                : null;

            if (group == null && establishment.Federations != null && !string.IsNullOrEmpty(establishment.Federations.Code))
            {
                group = await _preparedGiasRepository.GetGroupAsync(long.Parse(establishment.Federations.Code), date, cancellationToken);
            }

            if (group != null)
            {
                var translatedGroupType = await _translation.TranslateEnumValueAsync(
                    EnumerationNames.ManagementGroupType, SourceSystemNames.GetInformationAboutSchools, group.GroupType, cancellationToken);

                entity.ManagementGroupType  = translatedGroupType;
                entity.ManagementGroupId    = group.Uid.ToString();
                entity.ManagementGroupCode  = $"{translatedGroupType}-{group.Uid}";
                entity.ManagementGroupUkprn = group.Ukprn;
                entity.ManagementGroupCompaniesHouseNumber = group.CompaniesHouseNumber;
            }
            else
            {
                var translatedGroupType = await _translation.TranslateEnumValueAsync(
                    EnumerationNames.ManagementGroupType, SourceSystemNames.GetInformationAboutSchools, LocalAuthority.ManagementGroupType, cancellationToken);

                entity.ManagementGroupType = translatedGroupType;
                entity.ManagementGroupId   = establishment.LA.Code;
                entity.ManagementGroupCode = $"{translatedGroupType}-{establishment.LA.Code}";
            }

            // Return
            return(entity);
        }
コード例 #24
0
 public override void Initialise(BloodAndBileEngine.WorldState.WorldState worldState)
 {
     Mover = (EntityMover)LinkedEntity.GetComponent(typeof(EntityMover));
 }
コード例 #25
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="UIMarketDetails" /> class.
 /// </summary>
 public UIMarketDetails()
 {
     ItemType = new LinkedEntity <ItemType>();
 }
コード例 #26
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="ContactItem" /> class.
 /// </summary>
 public ContactItem()
 {
     Contact = new LinkedEntity <string>();
 }