Example #1
0
        private void UpdateCompanionStatus(CompanionStatus inStatus, PriorCompanionSlotState inState)
        {
            // Image
            inStatus.CompanionSliderFill.sprite = inState.PriorUIIcon;

            // Slider value
            inStatus.CompanionSlider.value = inState.PriorCooldown;

            // Use Count
            if (inState.PriorUseCount == CompanionConstants.UnlimitedCharges)
            {
                inStatus.CompanionUseCountText.text = "";
            }
            else
            {
                inStatus.CompanionUseCountText.text = inState.PriorUseCount.ToString();

                inStatus.CompanionUseCountText.color = inState.PriorUseCount == 0 ? Color.red : Color.white;
            }

            // Active
            inStatus.CompanionSliderFill.CrossFadeAlpha(inState.PriorActive ? 1.0f : IconDisableAlpha, 0.0f, true);
            inStatus.CompanionSliderFill.type       = Image.Type.Filled;
            inStatus.CompanionSliderFill.fillMethod = Image.FillMethod.Vertical;
        }
Example #2
0
 public static CompanionStatus CreateCompanionStatus(int id, int definitionId, int level, PlayerStatus playerStatus, CellCoord coord)
 {
     //IL_0015: Unknown result type (might be due to invalid IL or missing references)
     if (RuntimeData.companionDefinitions.TryGetValue(definitionId, out CompanionDefinition value))
     {
         return(CompanionStatus.Create(id, value, level, playerStatus, (Vector2Int)coord));
     }
     Log.Error(FightEventErrors.EntityCreationFailed <CompanionStatus, CompanionDefinition>(id, definitionId), 90, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
     return(null);
 }
        public bool TryGetEntity <T>(DynamicValueContext context, out T entity) where T : class, IEntity
        {
            DynamicValueFightContext dynamicValueFightContext = context as DynamicValueFightContext;

            if (dynamicValueFightContext != null)
            {
                foreach (T item in dynamicValueFightContext.fightStatus.EnumerateEntities <T>())
                {
                    CompanionStatus companionStatus = item as CompanionStatus;
                    if (companionStatus != null && companionStatus.ownerId == dynamicValueFightContext.playerId && companionStatus.definition.get_id() == m_companion.value)
                    {
                        entity = item;
                        return(true);
                    }
                }
            }
            entity = null;
            return(false);
        }
Example #4
0
 public override void UpdateStatus(FightStatus fightStatus)
 {
     if (fightStatus.TryGetEntity(ownerId, out PlayerStatus entityStatus))
     {
         CompanionStatus companionStatus = CreateCompanionStatus(concernedEntity, entityDefId, level, entityStatus, refCoord);
         if (companionStatus != null)
         {
             fightStatus.AddEntity(companionStatus);
         }
         if (entityStatus.isLocalPlayer)
         {
             FightCastManager.CheckCompanionInvoked(entityDefId);
         }
     }
     else
     {
         Log.Error(FightEventErrors.PlayerNotFound(ownerId), 32, "C:\\BuildAgents\\AgentB\\work\\cub_client_win64_develop\\client\\DofusCube.Unity\\Assets\\Core\\Code\\Fight\\Events\\CompanionAddedEvent.cs");
     }
     FightLogicExecutor.FireUpdateStatus(fightStatus.fightId, EventCategory.EntityAddedOrRemoved);
 }
Example #5
0
        public static IEnumerator CreateCompanionCharacterObject(FightStatus fightStatus, CompanionStatus companionStatus, PlayerStatus ownerStatus, int x, int y, Direction direction)
        {
            CompanionDefinition companionDefinition = (CompanionDefinition)companionStatus.definition;

            if (!(null == companionDefinition))
            {
                CompanionCharacterObject companionCharacterObject = FightObjectFactory.CreateCompanionCharacterObject(companionDefinition, x, y, direction);
                if (!(null == companionCharacterObject))
                {
                    companionStatus.view = companionCharacterObject;
                    yield return(companionCharacterObject.LoadAnimationDefinitions(companionDefinition.defaultSkin.value));

                    companionCharacterObject.Initialize(fightStatus, ownerStatus, companionStatus);
                    yield return(companionCharacterObject.Spawn());
                }
            }
        }