Пример #1
0
 override public void SetVisibilityMode(VisibilityMode vmode, bool forcedRefresh)
 {
     if (vmode == visibilityMode && !forcedRefresh)
     {
         return;
     }
     if (vmode == VisibilityMode.Invisible | vmode == VisibilityMode.LayerCutHide)
     {
         if (model != null)
         {
             model.SetActive(false);
         }
     }
     else
     {
         if (visibilityMode == VisibilityMode.Invisible | visibilityMode == VisibilityMode.LayerCutHide)
         {
             if (model == null)
             {
                 PrepareModel();
             }
             else
             {
                 model.SetActive(true);
             }
         }
     }
     visibilityMode = vmode;
     base.SetVisibilityMode(visibilityMode, true);
 }
Пример #2
0
 virtual public void SetVisibilityMode(VisibilityMode vmode, bool forcedRefresh)
 {
     if (visibilityMode != vmode | forcedRefresh)
     {
         if (vmode != VisibilityMode.LayerCutCancel & visibilityMode == VisibilityMode.LayerCutHide)
         {
             return;
         }
         visibilityMode = vmode;
         visibilityChangedEvent?.Invoke(visibilityMode, forcedRefresh);
         if (extension != null && (vmode == VisibilityMode.Invisible | vmode == VisibilityMode.LayerCutCancel | vmode == VisibilityMode.LayerCutHide))
         {
             var slist = extension.GetStructuresList();
             if (slist != null && slist.Count != 0)
             {
                 foreach (var s in slist)
                 {
                     s?.SetVisibility(vmode);
                 }
             }
         }
         if (mainStructure != null && !mainStructureIsABlocker && !mainStructure.IsIPlanable())
         {
             mainStructure.SetVisibility(vmode, forcedRefresh);
         }
     }
 }
Пример #3
0
        EnvironmentObject(Dwarrowdelf.TerrainGen.TerrainData terrain, VisibilityMode visMode, IntVector3 startLocation)
            : base(ObjectType.Environment)
        {
            this.Version = 1;
            this.VisibilityMode = visMode;

            terrain.GetData(out m_tileGrid, out m_levelMap);

            this.Size = terrain.Size;

            this.StartLocation = startLocation;

            InitFlags();
            VerifyLevelMap();

            m_contentArray = new KeyedObjectCollection[this.Depth];
            for (int i = 0; i < this.Depth; ++i)
                m_contentArray[i] = new KeyedObjectCollection();

            m_originalNumTrees = ParallelEnumerable.Range(0, this.Size.Depth).Sum(z =>
            {
                int sum = 0;
                for (int y = 0; y < this.Size.Height; ++y)
                    for (int x = 0; x < this.Size.Width; ++x)
                        if (GetTileData(x, y, z).HasTree)
                            sum++;

                return sum;
            });
        }
Пример #4
0
        private void ToVisibility()
        {
            VisibilityMode = VisibilityMode.Hidden;

            if (ListView)
            {
                VisibilityMode |= VisibilityMode.ListView;
            }

            if (DetailView)
            {
                VisibilityMode |= VisibilityMode.DetailView;
            }

            if (CreateView)
            {
                VisibilityMode |= VisibilityMode.CreateView;
            }

            if (UpdateView)
            {
                VisibilityMode |= VisibilityMode.UpdateView;
            }

            if (DeleteView)
            {
                VisibilityMode |= VisibilityMode.DeleteView;
            }
        }
Пример #5
0
 public static void InputAccessible(MnBaseElement model, VisibilityMode visibleMode, ref Dictionary <string, object> attributeList)
 {
     if (model.VisibleMode != VisibilityMode.Both && model.VisibleMode != visibleMode)
     {
         attributeList.Add("hidden", "");
     }
 }
Пример #6
0
    public void SetVisibilityMode(VisibilityMode vm, bool forcedRefresh)
    {
        if (visibilityMode != vm | forcedRefresh)
        {
            if (visibilityMode == VisibilityMode.LayerCutHide)
            {
                if (vm != VisibilityMode.LayerCutCancel)
                {
                    return;
                }
            }

            visibilityMode = vm;
            if (extension != null)
            {
                extension.SetVisibility(vm);
            }
            else
            {
                if (mainStructure != null)
                {
                    if (mainStructure.IsIPlanable())
                    {
                        (mainStructure as IPlanable).IPlanable_SetVisibility(vm);
                    }
                    else
                    {
                        mainStructure.SetVisibility(vm, forcedRefresh);
                    }
                }
            }
        }
    }
Пример #7
0
    }                                                                      //ignore structures visibility

    public void IPlanable_SetVisibility(VisibilityMode vmode)
    {
        if (vmode != visibilityMode && planes != null && planes.Count != 0)
        {
            foreach (var p in planes.Values)
            {
                p.SetVisibilityMode(vmode);
            }
            visibilityMode = vmode;
        }
    }
Пример #8
0
 internal void SetVisibility(VisibilityMode mode, int timeout)
 {
     if (IsBluetoothEnabled)
     {
         int ret = Interop.Bluetooth.SetVisibility(mode, timeout);
         if (ret != (int)BluetoothError.None)
         {
             Log.Error(Globals.LogTag, "Failed to set visibility, Error - " + (BluetoothError)ret);
             BluetoothErrorFactory.ThrowBluetoothException(ret);
         }
     }
     else
     {
         BluetoothErrorFactory.ThrowBluetoothException((int)BluetoothError.NotEnabled);
     }
 }
Пример #9
0
 public void IPlanable_SetVisibility(VisibilityMode vmode)
 {
     if (vmode != visibilityMode)
     {
         if (upperPlane != null)
         {
             upperPlane.SetVisibilityMode(vmode);
         }
         if (bottomPlane != null)
         {
             bottomPlane.SetVisibilityMode(vmode);
         }
         transform.GetChild(0).gameObject.SetActive(vmode != VisibilityMode.Invisible & vmode != VisibilityMode.LayerCutHide);
         visibilityMode = vmode;
     }
 }
Пример #10
0
        private void RegisterVisibilityChangedEvent()
        {
            _visibilityChangedCallback = (int result, int mode, IntPtr userData) =>
            {
                if (_visibilityModeChanged != null)
                {
                    VisibilityMode visibility = (VisibilityMode)mode;
                    BluetoothError res        = (BluetoothError)result;
                    _visibilityModeChanged(null, new VisibilityModeChangedEventArgs(res, visibility));
                }
            };
            int ret = Interop.Bluetooth.SetVisibilityModeChangedCallback(_visibilityChangedCallback, IntPtr.Zero);

            if (ret != (int)BluetoothError.None)
            {
                Log.Error(Globals.LogTag, "Failed to set visibility mode changed callback, Error - " + (BluetoothError)ret);
            }
        }
Пример #11
0
 public void SetElementsVisibleMode(VisibilityMode visibleMode)
 {
     Elements.ForEach(e =>
     {
         e.VisibleMode = visibleMode;
         if (e is MnSection)
         {
             (e as MnSection).Elements.ForEach(e2 =>
             {
                 e2.VisibleMode = visibleMode;
                 if (e2 is MnSection)
                 {
                     (e2 as MnSection).Elements.ForEach(e3 => { e3.VisibleMode = visibleMode; });
                 }
             });
         }
     });
 }
Пример #12
0
        private void SetRead(Binding bnd, UIElement ctl, IAuthorizeReadWrite source)
        {
            bool           canRead        = source.CanReadProperty(bnd.Path.Path);
            VisibilityMode visibilityMode = GetNotVisibleMode(ctl);

            if (canRead)
            {
                switch (visibilityMode)
                {
                case VisibilityMode.Collapsed:
                    if (ctl.Visibility == Visibility.Collapsed)
                    {
                        ctl.Visibility = Visibility.Visible;
                    }
                    break;

                case VisibilityMode.Hidden:
                    if (ctl.Visibility == Visibility.Hidden)
                    {
                        ctl.Visibility = Visibility.Visible;
                    }
                    break;

                default:
                    break;
                }
            }
            else
            {
                switch (visibilityMode)
                {
                case VisibilityMode.Collapsed:
                    ctl.Visibility = Visibility.Collapsed;
                    break;

                case VisibilityMode.Hidden:
                    ctl.Visibility = Visibility.Hidden;
                    break;

                default:
                    break;
                }
            }
        }
Пример #13
0
        private int OnTestObjectVisible(void *pMessage, void *pAreaObject, void *pPlayerGameObject)
        {
            NwGameObject?areaObject        = CNWSObject.FromPointer(pAreaObject).ToNwObjectSafe <NwGameObject>();
            NwCreature?  playerGameObject  = CNWSObject.FromPointer(pPlayerGameObject).ToNwObjectSafe <NwCreature>();
            NwPlayer?    controllingPlayer = playerGameObject?.ControllingPlayer;

            if (areaObject == null || controllingPlayer == null || areaObject == playerGameObject)
            {
                return(testObjectVisibleHook.CallOriginal(pMessage, pAreaObject, pPlayerGameObject));
            }

            VisibilityMode personalOverride   = GetPersonalOverride(controllingPlayer, areaObject);
            VisibilityMode globalOverride     = GetGlobalOverride(areaObject);
            VisibilityMode visibilityOverride = personalOverride != VisibilityMode.Default ? personalOverride : globalOverride != VisibilityMode.Default ? globalOverride : VisibilityMode.Default;

            int retVal;

            switch (visibilityOverride)
            {
            case VisibilityMode.Hidden:
                retVal = false.ToInt();
                break;

            case VisibilityMode.DMOnly:
                retVal = controllingPlayer.IsDM ? testObjectVisibleHook.CallOriginal(pMessage, pAreaObject, pPlayerGameObject) : false.ToInt();
                break;

            case VisibilityMode.AlwaysVisible:
                retVal = true.ToInt();
                break;

            case VisibilityMode.AlwaysVisibleDMOnly:
                retVal = controllingPlayer.IsDM.ToInt();
                break;

            case VisibilityMode.Default:
            case VisibilityMode.Visible:
            default:
                retVal = testObjectVisibleHook.CallOriginal(pMessage, pAreaObject, pPlayerGameObject);
                break;
            }

            return(retVal);
        }
Пример #14
0
    public void SetVisibility(VisibilityMode vmode, bool forcedRefresh)
    {
        byte vm = (byte)vmode;
        bool?newDrawMode;

        if (vm >= (byte)VisibilityMode.HugeObjectsLOD)
        {
            newDrawMode = null;
        }
        else
        {
            if (vm < (byte)VisibilityMode.SmallObjectsLOD)
            {
                newDrawMode = false;
            }
            else
            {
                newDrawMode = true;
            }
        }
        if (newDrawMode != usingLOD | forcedRefresh)
        {
            usingLOD = newDrawMode;
            if (usingLOD == null)
            {
                model.SetActive(false);
                spriter.enabled = false;
            }
            else
            {
                if (usingLOD == true)
                {
                    model.SetActive(false);
                    spriter.enabled = true;
                }
                else
                {
                    model.SetActive(true);
                    spriter.enabled = false;
                }
            }
        }
    }
Пример #15
0
        EnvironmentObject(Dwarrowdelf.TerrainGen.TerrainData terrain, VisibilityMode visMode, IntVector3 startLocation)
            : base(ObjectType.Environment)
        {
            this.Version        = 1;
            this.VisibilityMode = visMode;

            terrain.GetData(out m_tileGrid, out m_levelMap);

            this.Size = terrain.Size;

            this.StartLocation = startLocation;

            InitFlags();
            VerifyLevelMap();

            m_contentArray = new KeyedObjectCollection[this.Depth];
            for (int i = 0; i < this.Depth; ++i)
            {
                m_contentArray[i] = new KeyedObjectCollection();
            }

            m_originalNumTrees = ParallelEnumerable.Range(0, this.Size.Depth).Sum(z =>
            {
                int sum = 0;
                for (int y = 0; y < this.Size.Height; ++y)
                {
                    for (int x = 0; x < this.Size.Width; ++x)
                    {
                        if (GetTileData(x, y, z).HasTree)
                        {
                            sum++;
                        }
                    }
                }

                return(sum);
            });
        }
Пример #16
0
        protected virtual void UpdateProperties()
        {
            if (PropertyBlock == null)
            {
                return;
            }

            var color = PropertyBlock.GetVector(ColorPropId);

            color.w = Opacity;
            PropertyBlock.SetVector(ColorPropId, color);
            PropertyBlock.SetColor(WireframeColorPropId, new Color(color.x, color.y, color.z, Opacity));

            if (Opacity > 0.99f)
            {
                Visibility = VisibilityMode.Opaque;
            }
            else
            {
                Visibility = Opacity < DisableThreshold ?
                             VisibilityMode.Disabled : VisibilityMode.Transparent;
            }
        }
Пример #17
0
        static public HelperVisible createVisibility(MonoBehaviour mono, VisibilityMode mode)
        {
            HelperVisible visibility = null;

            Debug.Assert(mono != null, "need mono here");

            switch (mode)
            {
            case VisibilityMode.SPRITE: visibility = new HelperVisibleSprite(mono); break;

            case VisibilityMode.MESH: visibility = new HelperVisibleMesh(mono); break;

            case VisibilityMode.UI: visibility = new HelperVisibleUi(mono); break;

            case VisibilityMode.SKINNED: visibility = new HelperVisibleSkinned(mono); break;

            case VisibilityMode.NONE: break;

            default: Debug.LogError("this visibilty mode (" + mode.ToString() + ") is not implem yet"); break;
            }

            return(visibility);
        }
Пример #18
0
 public void IPlanable_SetVisibility(VisibilityMode vmode)
 {
     if (visibilityMode == vmode)
     {
         return;
     }
     if (upperPlane != null)
     {
         upperPlane.SetVisibilityMode(vmode);
     }
     if (model != null)
     {
         if (vmode == VisibilityMode.Invisible | vmode == VisibilityMode.LayerCutHide)
         {
             model.SetActive(false);
         }
         else
         {
             model.SetActive(true);
         }
     }
     visibilityMode = vmode;
 } // no multimaterial planes
Пример #19
0
 public void SetVisibility(VisibilityMode vmode, bool forcedRefresh)
 {
     if (planes != null && planes.Count > 0)
     {
         byte vismask = myBlock.myChunk.GetVisibilityMask(myBlock.pos);
         vismask &= existingPlanesMask;
         int pmask = 0;
         foreach (var p in planes.Values)
         {
             if (vmode != VisibilityMode.Invisible & vmode != VisibilityMode.LayerCutHide)
             {
                 pmask = (1 << p.faceIndex);
                 if ((pmask & vismask) != 0)
                 {
                     p.SetVisibilityMode(vmode, forcedRefresh);
                 }
             }
             else
             {
                 p.SetVisibilityMode(vmode, forcedRefresh);
             }
         }
     }
 }
Пример #20
0
 protected override void INLINE_SetVisibility(VisibilityMode vmode)
 {
 }                                                                      //ignore structures visibility
 /// <summary>
 /// Initializes a new instance of <see cref="AuthenticatedFilterAttribute" /> class.
 /// </summary>
 /// <param name="mode">Specified whether the field should be shown or hidden when the user is authenticated.</param>
 public AuthenticatedFilterAttribute(VisibilityMode mode = VisibilityMode.Show)
 {
     Mode = mode;
 }
Пример #22
0
 public virtual Element SetVisibilityMode(VisibilityMode mode)
 {
     string strMode = "";
     switch (mode)
     {
         case VisibilityMode.Visibility:
             strMode = "Ext.Element.VISIBILITY";
             break;
         case VisibilityMode.Display:
             strMode = "Ext.Element.DISPLAY";
             break;
         default:
             throw new ArgumentOutOfRangeException("mode");
     }
     this.Call("setVisibilityMode", new JRawValue(strMode));
     return this;
 }
Пример #23
0
 protected override void INLINE_SetVisibility(VisibilityMode vmode)
 {
     // нужно переопределение, чтобы не действовали функции предков
 }
Пример #24
0
 internal static extern int SetVisibility(VisibilityMode visibilityMode, int duration);
Пример #25
0
 /// <summary>
 /// Initializes a new instance of <see cref="RoleFilterAttribute" /> class.
 /// </summary>
 /// <param name="roleNames">Comma-separated list of roles. The rule is matched if the user is in any of the roles.</param>
 /// <param name="mode">Specified whether the field should be shown or hidden when the user is in any of the roles.</param>
 public RoleFilterAttribute(string roleNames, VisibilityMode mode = VisibilityMode.Show)
 {
     Mode      = mode;
     RoleNames = roleNames.Split(',', ';').Select(s => s.Trim()).ToArray();
 }
Пример #26
0
        public void SetPersonalOverride(NwPlayer player, NwObject target, VisibilityMode visibilityMode)
        {
            InternalVariableEnum <VisibilityMode> value = InternalVariables.PlayerVisibilityOverride(player, target);

            value.Value = visibilityMode;
        }
 /// <summary>
 /// Initializes a new instance of <see cref="ViewFilterAttribute" /> class.
 /// </summary>
 /// <param name="viewNames">Comma-separated list of views. The rule is matched if the current view is one of the values of this parameter.</param>
 /// <param name="mode">Specified whether the field should be shown or hidden when the rule is matched.</param>
 public ViewFilterAttribute(string viewNames, VisibilityMode mode = VisibilityMode.Show)
 {
     ViewNames = viewNames.Split(',', ';').Select(v => v.Trim()).ToArray();
     Mode      = mode;
 }
Пример #28
0
        public static EnvironmentObject Create(World world, Dwarrowdelf.TerrainGen.TerrainData terrain, VisibilityMode visMode,
			IntVector3 startLocation)
        {
            var ob = new EnvironmentObject(terrain, visMode, startLocation);
            ob.Initialize(world);
            return ob;
        }
 /// <summary>
 /// Initializes a new instance of <see cref="ViewFilterAttribute" /> class.
 /// </summary>
 /// <param name="mode">Specified whether the field should be shown or hidden.</param>
 public UnmatchedFilterAttribute(VisibilityMode mode)
 {
     Mode = mode;
 }
Пример #30
0
 internal VisibilityModeChangedEventArgs(BluetoothError result, VisibilityMode mode)
 {
     _result = result;
     _mode   = mode;
 }
Пример #31
0
 /// <summary>
 /// Sets the value controlling how controls
 /// bound to non-readable properties will be rendered.
 /// </summary>
 public static void SetNotVisibleMode(DependencyObject obj, VisibilityMode mode)
 {
     obj.SetValue(NotVisibleModeProperty, mode);
 }
Пример #32
0
        public void SetGlobalOverride(NwGameObject target, VisibilityMode visibilityMode)
        {
            InternalVariableEnum <VisibilityMode> value = InternalVariables.GlobalVisibilityOverride(target);

            value.Value = visibilityMode;
        }
 public Visibility(VisibilityMode visibility)
 {
     Mode = visibility;
 }
Пример #34
0
 public void SetVisibilityMode(VisibilityMode vmode)
 {
     SetVisibilityMode(vmode, false);
 }
Пример #35
0
        public override void ReceiveObjectData(BaseGameObjectData _data)
        {
            var data = (EnvironmentObjectData)_data;

            base.ReceiveObjectData(_data);

            // XXX we currently always get the map size
            if (!data.Size.IsEmpty)
                m_tileGrid.SetSize(data.Size);

            this.VisibilityMode = data.VisibilityMode;
        }