예제 #1
0
        private static void AddDecalDoubleWithOffset(
            Settings settings,
            List <ITextureResource> textures,
            Vector2Ushort size,
            INoiseSelector noiseSelector,
            DrawOrder drawOrder = DrawOrder.GroundDecals,
            bool requiresFullSizeNoiseCoverage = false,
            bool canFlipHorizontally           = true)
        {
            settings.AddDecal(
                new ProtoTileDecal(textures,
                                   size: size,
                                   drawOrder: drawOrder,
                                   requiresCompleteNoiseSelectorCoverage: requiresFullSizeNoiseCoverage,
                                   noiseSelector: noiseSelector,
                                   canFlipHorizontally: canFlipHorizontally));

            // add the same decal but with a little offset (to make a more dense diagonal placement)
            settings.AddDecal(
                new ProtoTileDecal(textures,
                                   size: size,
                                   drawOrder: drawOrder,
                                   offset: Vector2Ushort.One,
                                   requiresCompleteNoiseSelectorCoverage: requiresFullSizeNoiseCoverage,
                                   noiseSelector: noiseSelector,
                                   canFlipHorizontally: canFlipHorizontally));
        }
예제 #2
0
        public ProtoTileDecal(
            IReadOnlyList <ITextureResource> textureResources,
            Vector2Ushort size,
            INoiseSelector noiseSelector,
            Vector2Ushort?interval           = null,
            DecalHidingSetting hidingSetting = DecalHidingSetting.StructureOrFloorObject,
            DrawOrder drawOrder  = DrawOrder.GroundDecals,
            Vector2Ushort offset = default,
            bool requiresCompleteNoiseSelectorCoverage = false,
            bool canFlipHorizontally = true,
            bool requiresCompleteProtoTileCoverage = false,
            IReadOnlyList <ProtoTileGroundTexture> requiredGroundTextures = null)
        {
            this.Size   = size;
            this.Offset = offset;
            this.RequiresCompleteNoiseSelectorCoverage = requiresCompleteNoiseSelectorCoverage;
            this.NoiseSelector          = noiseSelector;
            this.TextureResources       = textureResources;
            this.DrawOrder              = drawOrder;
            this.HidingSetting          = hidingSetting;
            this.RequiredGroundTextures = requiredGroundTextures?.Count > 0
                                              ? requiredGroundTextures
                                              : null;

            this.Interval = new Vector2Ushort((ushort)(this.Size.X + (interval?.X ?? 0)),
                                              (ushort)(this.Size.Y + (interval?.Y ?? 0)));

            this.CanFlipHorizontally = canFlipHorizontally;
            this.RequiresCompleteProtoTileCoverage = requiresCompleteProtoTileCoverage;
        }
예제 #3
0
 public ProtoTileDecal(
     string localTextureFilePath,
     Vector2Ushort size,
     INoiseSelector noiseSelector,
     Vector2Ushort?interval           = null,
     DecalHidingSetting hidingSetting = DecalHidingSetting.StructureOrFloorObject,
     DrawOrder drawOrder  = DrawOrder.GroundDecals,
     Vector2Ushort offset = default,
     bool requiresCompleteNoiseSelectorCoverage = false,
     bool canFlipHorizontally = true,
     bool requiresCompleteProtoTileCoverage = false,
     IReadOnlyList <ProtoTileGroundTexture> requiredGroundTextures = null)
     : this(CollectTextures(localTextureFilePath),
            size,
            noiseSelector,
            interval,
            hidingSetting,
            drawOrder,
            offset,
            requiresCompleteNoiseSelectorCoverage,
            canFlipHorizontally,
            requiresCompleteProtoTileCoverage,
            requiredGroundTextures)
 {
 }
예제 #4
0
        protected override void UpdateDrawOrder()
        {
            base.UpdateDrawOrder();
            int height = Area.Height;

            foreach (IMenuComponent c in DrawOrder)
            {
                if (!c.Visible)
                {
                    return;
                }
                Rectangle r = c.GetRegion();
                int       b = r.Y + r.Height;
                if (b > height)
                {
                    height = b;
                }
            }
            if (height > Area.Height)
            {
                BarOffset = zoom12;
            }
            else
            {
                BarOffset = 0;
            }
            InnerHeight = (int)Math.Ceiling((height - Area.Height) / (double)zoom10);
            // Remove components that do not intersect the collection viewport from both the draw and event order
            Rectangle self = new Rectangle(0, -(ScrollOffset * zoom10), Area.Width, Area.Height);

            DrawOrder  = DrawOrder.FindAll(c => c.GetRegion().Intersects(self));
            EventOrder = EventOrder.FindAll(c => c.GetRegion().Intersects(self));
        }
예제 #5
0
        public ScrollingTex(string texture, Vector2 velocity, DrawOrder layer)
        {
            Texture  = ResourceManager.GetTexture(texture);
            Position = Vector2.Zero;

            _velocity = velocity;
            _layer    = layer;
        }
예제 #6
0
 public RendererSavedProperties(
     DrawOrder drawOrder,
     Vector2D positionOffset,
     double drawOrderOffsetY)
 {
     this.drawOrder        = drawOrder;
     this.positionOffset   = positionOffset;
     this.drawOrderOffsetY = drawOrderOffsetY;
 }
        public DefaultIndoorMapMaterial(Material material, Color diffuseColor, DrawOrder drawOrder, Material prepassMaterial)
        {
            MaterialInstance  = material;
            m_diffuseColor    = diffuseColor;
            m_drawOrder       = drawOrder;
            m_prepassMaterial = prepassMaterial;

            OnStreamingTextureReceived += OnStreamingTextureReceivedHandler;
        }
예제 #8
0
        public EditorComponent(Editor editor)
        {
            this.editor = editor;

            enabled = true;
            visible = true;

            drawOrder = new DrawOrder();
        }
예제 #9
0
        public MenuSelector(DrawOrder layer = DrawOrder.SUBMENU_SELECTOR)
            : base(Vector2.Zero, "arrows", 7, 7, layer)
        {
            AddAnimation("disabledLeft", CreateAnimFrameArray(0), 0, false);
            AddAnimation("disabledRight", CreateAnimFrameArray(2), 0, false);
            AddAnimation("enabledLeft", CreateAnimFrameArray(0, 1), 6, true);
            AddAnimation("enabledRight", CreateAnimFrameArray(3, 2), 6, true);

            Play("disabledRight");
        }
예제 #10
0
        public static float GetDrawingZ(DrawOrder order, float gridy)
        {
            float z = (float)order;

            if (order == DrawOrder.ENTITIES)
            {
                z += gridy / (GameConstants.SCREEN_HEIGHT_IN_PIXELS + 1); //+1 to prevent z-fighting with next layer
            }
            return(z / (float)DrawOrder.HITBOX);
        }
예제 #11
0
        public ExplosionPreset(
            ProtoObjectCharredGround protoObjectCharredGround,
            double serverDamageApplyDelay,
            TextureAtlasResource[] spriteAtlasResources,
            ReadOnlySoundResourceSet soundSet,
            Color?spriteColorAdditive,
            Color?spriteColorMultiplicative,
            double spriteBrightness,
            double spriteAnimationDuration,
            Size2F spriteSize,
            DrawOrder spriteDrawOrder,
            double blastwaveDelay,
            double blastwaveAnimationDuration,
            Color blastWaveColor,
            Size2F blastwaveSizeFrom,
            Size2F blastwaveSizeTo,
            double lightWorldSize,
            double lightDuration,
            Color lightColor,
            float screenShakesDuration,
            float screenShakesWorldDistanceMin,
            float screenShakesWorldDistanceMax,
            byte soundsCuesNumber)
        {
            this.ServerDamageApplyDelay = serverDamageApplyDelay;
            this.SpriteAtlasResources   = spriteAtlasResources;
            this.SoundSet                  = soundSet;
            this.SpriteColorAdditive       = spriteColorAdditive;
            this.SpriteColorMultiplicative = spriteColorMultiplicative ?? Colors.White;
            this.SpriteBrightness          = (float)spriteBrightness;
            this.SpriteAnimationDuration   = spriteAnimationDuration;
            this.SpriteSize                = spriteSize;

            this.BlastwaveDelay             = blastwaveDelay;
            this.BlastwaveAnimationDuration = blastwaveAnimationDuration;
            this.BlastWaveColor             = blastWaveColor;
            this.BlastwaveSizeFrom          = blastwaveSizeFrom;
            this.BlastwaveSizeTo            = blastwaveSizeTo;

            this.LightWorldSize = lightWorldSize;
            this.LightDuration  = lightDuration;
            this.LightColor     = lightColor;

            this.ScreenShakesDuration         = screenShakesDuration;
            this.ScreenShakesWorldDistanceMin = screenShakesWorldDistanceMin;
            this.ScreenShakesWorldDistanceMax = screenShakesWorldDistanceMax;
            this.SoundsCuesNumber             = soundsCuesNumber;
            this.SpriteDrawOrder          = spriteDrawOrder;
            this.ProtoObjectCharredGround = protoObjectCharredGround;

            if (this.SoundSet.Count == 0)
            {
                Api.Logger.Warning("No sounds in the explosion sounds preset - please check the sounds path");
            }
        }
예제 #12
0
 protected override void KeyPressed(KeyEventArgs e)
 {
     if (e.KeyCode == KeyCode.F1)
     {
         _order = DrawOrder.BackToFront;
     }
     else if (e.KeyCode == KeyCode.F2)
     {
         _order = DrawOrder.FrontToBack;
     }
 }
예제 #13
0
        public DocumentData(IMessageBus messageBus, ulong highestEntityId)
        {
            MessageBus = messageBus;
            RootNodes  = new NodeCollection(messageBus, null);
            DrawOrder  = new DrawOrder(messageBus);
            IdSequence = new Sequence(highestEntityId);

            Nodes              = new EntityCollection <Node>();
            Animations         = new EntityCollection <Animation>();
            PropertyAnimations = new EntityCollection <PropertyAnimation>();
            Keys = new EntityCollection <Key>();
        }
예제 #14
0
        public CheckBox(Vector2 position, bool current, MenuStyle style, DrawOrder layer = DrawOrder.AUDIO_SLIDER)
        {
            _box = new Spritesheet(ResourceManager.GetTexture("checkbox", true), 11, 11);

            _pos = position;

            _turnedOn = current;

            _layer = layer;

            _style = style;
        }
        public ClientLandClaimAreaRenderer(
            Color zoneColor,
            DrawOrder drawOrder,
            int inflateSize = 0)
        {
            this.drawOrder   = drawOrder;
            this.inflateSize = inflateSize;
            this.material    = CreateRenderingMaterial();
            this.material.EffectParameters.Set("Color", zoneColor);

            this.sceneObject = Api.Client.Scene.CreateSceneObject(
                nameof(ClientLandClaimAreaRenderer) + " with color=" + zoneColor);
        }
예제 #16
0
        public Layer(KhvGame game, string name, bool transparent, bool visible, Size size, TileEngine tileEngine)
        {
            this.name = name;

            Transparent = transparent;
            Visible     = visible;

            this.size       = size;
            this.tileEngine = tileEngine;

            drawOrder  = new DrawOrder(name);
            components = new LayerComponentManager();
        }
예제 #17
0
        public TextWriter(int x, int y, int width, int height)
        {
            Opacity = 1;
            Speed   = DefaultTextSpeed;
            _text   = "";

            characterLines = new List <List <TextCharacter> >();

            WriteArea = new Rectangle(x, y, width, height);

            drawLayer = DrawOrder.TEXT;

            ResetTextProgress();
        }
예제 #18
0
        public Entity(Vector2 pos, DrawOrder layer)
            : base(pos)
        {
            _animations = new List <Anim>();

            frameWidth  = 0;
            frameHeight = 0;

            this.layer = layer;
            _opacity   = 1f;

            scale      = 1;
            _lastScale = scale;
        }
예제 #19
0
        public Entity(Vector2 pos, int frameWidth, int frameHeight, DrawOrder layer)
            : base(pos, frameWidth, frameHeight)
        {
            _animations = new List <Anim>();

            this.frameWidth  = frameWidth;
            this.frameHeight = frameHeight;

            this.layer = layer;
            _opacity   = 1f;

            scale      = 1;
            _lastScale = scale;
        }
예제 #20
0
파일: Marker.cs 프로젝트: JordanFisher/WAL
        public void Draw(DrawOrder CurrentDrawOrder)
        {
            if (Hide)
            {
                return;
            }

            foreach (var marker in Markers)
            {
                if (marker.MyDrawOrder == CurrentDrawOrder)
                {
                    marker.Draw();
                }
            }
        }
예제 #21
0
        public Entity(Vector2 pos, int frameWidth, int frameHeight, DrawOrder layer)
            : base(pos, frameWidth, frameHeight)
        {
            _animations = new List <Anim>();

            this.layer = layer;
            opacity    = 1f;

            scale      = 1;
            _lastScale = scale;

            color = Color.White;

            SetFrame(0);
        }
예제 #22
0
        public TextWriter(int x, int y, int width, int height)
        {
            Speed = DefaultTextSpeed;
            _text = "";

            letterProgress = 0;
            _stepProgress  = 0;
            _newWord       = false;
            WroteCharacter = false;

            characters = new List <TextCharacter>();

            WriteArea = new Rectangle(x, y, width, height);

            drawLayer = DrawOrder.TEXT;
        }
예제 #23
0
        public TextWriter()
        {
            Speed = DefaultTextSpeed;
            _text = "";

            letterProgress = 0;
            _stepProgress  = 0;
            _newWord       = false;
            _newLine       = false;
            WroteCharacter = false;
            WriteArea      = new Rectangle(0, 0, 200, 200);

            characters = new List <TextCharacter>();

            drawLayer = DrawOrder.TEXT;
        }
예제 #24
0
        public AudioSlider(Vector2 pos, float current, float min, float max, float stepSize, MenuStyle style, DrawOrder drawOrder = DrawOrder.AUDIO_SLIDER)
            : base(pos, 68)
        {
            this.min      = min;
            this.max      = max;
            this.stepSize = stepSize;
            this.current  = current;
            layer         = drawOrder;
            start         = current;

            _slider       = new Spritesheet(ResourceManager.GetTexture("volume_bar", true), 60, 12);
            _sliderInside = ResourceManager.GetTexture("volume_bar_inside", true);
            _sliderBg     = ResourceManager.GetTexture("volume_bar_bg", true);

            _style = style;
        }
예제 #25
0
        private static void OnPreferencesGUI()
        {
            try {
                scroll = EditorGUILayout.BeginScrollView(scroll, false, false);

                EditorGUILayout.Separator();
                GUI.enabled = Enabled.Value = EditorGUILayout.Toggle(Enabled, Enabled);
                EditorGUILayout.Separator();
                Offset.Value = EditorGUILayout.IntField(Offset, Offset);
                EditorGUILayout.Separator();

                Tree.Value                 = EditorGUILayout.Toggle(Tree, Tree);
                Warnings.Value             = EditorGUILayout.Toggle(Warnings, Warnings);
                Tooltips.Value             = EditorGUILayout.Toggle(Tooltips, Tooltips);
                Selection.Value            = EditorGUILayout.Toggle(Selection, Selection);
                Trailing.Value             = EditorGUILayout.Toggle(Trailing, Trailing);
                AllowSelectingLocked.Value = EditorGUILayout.Toggle(AllowSelectingLocked, AllowSelectingLocked);

                EditorGUILayout.Separator();

                Separators.Value    = (StripType)EditorGUILayout.EnumPopup(Separators, Separators);
                LabelType.Value     = (MiniLabelType)EditorGUILayout.EnumPopup(LabelType, LabelType);
                GUI.enabled         = Enabled && DrawOrder.Contains(DrawType.Static);
                StaticAskMode.Value = (StaticMode)EditorGUILayout.EnumPopup(StaticAskMode, StaticAskMode);
                GUI.enabled         = Enabled;

                EditorGUILayout.Separator();

                DrawOrder        = rList.list.Cast <DrawType>().ToList();
                rList.displayAdd = Menu.GetItemCount() > 0;
                rList.DoLayoutList();

                GUI.enabled = true;
                EditorGUILayout.EndScrollView();

                if (GUILayout.Button("Use Defaults", GUILayout.Width(120f)))
                {
                    DeleteSavedValues();
                }

                Styles.ReloadTooltips();
                EditorApplication.RepaintHierarchyWindow();
            }
            catch (Exception e) {
                EditorGUILayout.HelpBox(e.ToString(), MessageType.Error);
            }
        }
예제 #26
0
파일: Marker.cs 프로젝트: JordanFisher/WAL
        public Marker(World world, vec2 pos, vec2 size, Texture2D texture, float alpha_fade = -1, int frames = 1, float frame_length = .1f, DrawOrder DrawOrder = DrawOrder.AfterTiles, float alpha = 1, vec2 dsize_dt = default(vec2))
        {
            this.world = world;

            this.alpha     = alpha;
            this.dalpha_dt = alpha_fade;

            this.pos      = pos;
            this.size     = size;
            this.dsize_dt = dsize_dt;

            this.frames       = frames;
            this.frame_length = frame_length;

            quad         = new RectangleQuad(pos - size / 2, pos + size / 2, vec2.Zero, vec(1.0f / frames, 1));
            this.texture = texture;

            this.MyDrawOrder = DrawOrder;
        }
예제 #27
0
        public GLSpriteRenderer(GraphicsDevice device, Camera camera, DrawOrder order)
        {
            this.Camera = camera;
            this.Order  = order;

            this.vertices    = new Vertex2[dataSize];
            this.vertexCount = 0;

            this.batches    = new Batch[dataSize];
            this.batchCount = 0;

            this.SetupBuffers();
            this.SetupLayout(device);
            this.SetupShaderProgram(device);

            this.program.SetVertexData(this.vertexBuffer, this.layout);
            this.textureParameter = this.program.GetUniformNameHandle("Texture");
            this.state.Setup();
        }
예제 #28
0
        public ClientLandClaimGroupsRendererManager(
            Color zoneColor,
            DrawOrder drawOrder,
            bool isGraceAreaRenderer = false)
        {
            this.drawOrder           = drawOrder;
            this.isGraceAreaRenderer = isGraceAreaRenderer;

            this.material = ClientLandClaimGroupRenderer.CreateRenderingMaterial();
            this.material.EffectParameters.Set("Color", zoneColor);

            this.sceneObject = Api.Client.Scene.CreateSceneObject(nameof(ClientLandClaimGroupsRendererManager)
                                                                  + " "
                                                                  + zoneColor);

            this.callbackGetRendererFromCache  = this.GetRendererFromCache;
            this.callbackReturnRendererToCache = this.ReturnRendererToCache;

            this.UpdateByTimer();
        }
예제 #29
0
        /// <summary>
        /// Add new <see cref="IJCIWGameComponent"/>.
        /// </summary>
        /// <param name="gameComponent">The <see cref="IJCIWGameComponent"/>.</param>
        /// <param name="drawOrder">The <see cref="DrawOrder"/>.</param>
        public void AddGameComponent(IJCIWGameComponent gameComponent, DrawOrder drawOrder)
        {
            if (drawOrder == DrawOrder.AfterGUI)
            {
                lock (gameComponentsAfter)
                {
                    gameComponentsAfter.Add(gameComponent);
                }
            }
            else
            {
                if (drawOrder == DrawOrder.BeforeGUI)
                {
                    lock (gameComponentsBefore)
                    {
                        gameComponentsBefore.Add(gameComponent);
                    }
                }
            }

            gameComponent.Initialize(Window.GraphicsDevice);
        }
예제 #30
0
파일: KmlOverlay.cs 프로젝트: hnjm/libKml
        public override XmlNode ToXml(XmlNode parent)
        {
            // add the feature stuff
            base.ToXml(parent);

            // child nodes
            if (null != Colour)
            {
                XmlNode nodColour = Colour.ToXml(parent);
                parent.AppendChild(nodColour);
            }

            XmlNode nodDrawOrder = parent.OwnerDocument.CreateNode(XmlNodeType.Element, "drawOrder", string.Empty);

            nodDrawOrder.InnerText = DrawOrder.ToString();
            parent.AppendChild(nodDrawOrder);

            if (null != _icon)
            {
                parent.AppendChild(_icon.ToXml(parent));
            }

            return(null);
        }