Exemplo n.º 1
0
            public static void SetHidden(CreatureBoardAsset creatureBoardAsset, bool hidden)
            {
                //Log.Debug($"SetHidden - hidden: {hidden}");
                IOldPersistentEffect persistentEffect = creatureBoardAsset.GetPersistentEffect();

                if (persistentEffect == null)
                {
                    Log.Error($"persistentEffect == null");
                    return;
                }

                persistentEffect.Hidden = hidden;
                CreatureManager.SetCreatureExplicitHideState(creatureBoardAsset.Creature.CreatureId, hidden);

                // Hide or show adornments:
                GameObject effectOrb = GetEffectOrb(creatureBoardAsset);

                foreach (string key in persistentEffect.Indicators.Keys)
                {
                    bool indicatorVisible = persistentEffect.Indicators[key];
                    bool shouldBeVisible  = !hidden && indicatorVisible;
                    SetOrbIndicatorVisible(effectOrb, shouldBeVisible, key);
                }

                if (persistentEffect is SuperPersistentEffect superPersistentEffect && superPersistentEffect.VisibilityMatchesBase)
                {
                    GameObject attachedParentGameObject = creatureBoardAsset.GetAttachedParentGameObject();
                    if (attachedParentGameObject != null)
                    {
                        attachedParentGameObject.SetActive(!hidden);
                    }
                    else
                    {
                        Log.Error($"Unable to find attached parent game object! Cannot hide this control!");
                    }
                }

                creatureBoardAsset.SavePersistentEffect(persistentEffect);
            }
Exemplo n.º 2
0
            public static void SetRotationLocked(CreatureBoardAsset creatureBoardAsset, bool locked)
            {
                //Log.Debug($"SetRotationLocked - locked: {locked}");
                IOldPersistentEffect persistentEffect = creatureBoardAsset.GetPersistentEffect();

                if (persistentEffect == null)
                {
                    Log.Error($"persistentEffect == null");
                    return;
                }

                //Log.Debug($"SetRotationLocked - IsVisible: {creatureBoardAsset.IsVisible}");
                SetSpinLockVisible(creatureBoardAsset, locked && creatureBoardAsset.IsVisible);

                persistentEffect.RotationIsLocked = locked;
                if (locked)
                {
                    persistentEffect.LockedRotation = creatureBoardAsset.GetRotationDegrees();
                }

                creatureBoardAsset.SavePersistentEffect(persistentEffect);
            }