コード例 #1
0
ファイル: AnimatedSprite.cs プロジェクト: gen-xu/MelloMario
        public AnimatedSprite(
            Texture2D texture,
            int columns,
            int rows,
            int x         = 0,
            int y         = 0,
            int width     = 2,
            int height    = 2,
            int interval  = Const.ANIMATION_INTERVAL,
            ZIndex zIndex = ZIndex.Item) : base(
                texture,
                new Rectangle(
                    x * Const.TEXTURE_GRID,
                    y * Const.TEXTURE_GRID,
                    width * Const.TEXTURE_GRID,
                    height * Const.TEXTURE_GRID),
                zIndex)
        {
            this.columns  = columns;
            this.rows     = rows;
            this.interval = interval;

            // note: copied from base constructor
            refSource = new Rectangle(
                x * Const.TEXTURE_GRID,
                y * Const.TEXTURE_GRID,
                width * Const.TEXTURE_GRID,
                height * Const.TEXTURE_GRID);

            frames  = 0;
            elapsed = 0;
        }
コード例 #2
0
        public override XElement ToXml(LazyLoadingMaterialDictionary materialDictionary)
        {
            if (Material != null)
            {
                materialDictionary.LoadMaterial(Material.Path);
            }
            XElement?texPathXEle = Material != null ? new XElement("TexturePath", materialDictionary.GetTexturePathByName(Material.Name)) : null;

            XElement result = new XElement(this.GetType().Name,
                                           Position.ToXml("Position"),
                                           Size.ToXml("Size"),
                                           texPathXEle,
                                           new XElement("Rotation", Rotation.ToString(CultureInfo.InvariantCulture)),
                                           new XElement("Opacity", Opacity.ToString(CultureInfo.InvariantCulture)),
                                           new XElement("Z-Index", ZIndex.ToString(CultureInfo.InvariantCulture))
                                           );

            if (!string.IsNullOrEmpty(Id))
            {
                result.Add(new XAttribute("Id", Id));
            }

            if (!string.IsNullOrEmpty(Class))
            {
                result.Add(new XAttribute("Class", Class));
            }

            return(result);
        }
コード例 #3
0
ファイル: MudTheme.cs プロジェクト: zHaytam/MudBlazor
 public MudTheme()
 {
     Palette          = new Palette();
     LayoutProperties = new LayoutProperties();
     Shadows          = new Shadow();
     ZIndex           = new ZIndex();
 }
コード例 #4
0
        private bool BackgroundConverter()
        {
            if (Util.TryGet(out backgroundType, token, "Property", "Type"))
            {
                Debug.WriteLine("Deserialize fail: Type of background is not given!");
            }
            ZIndex zIndex = Util.TryGet(out string s, token, "Property", "ZIndex")
                ? (ZIndex)Enum.Parse(typeof(ZIndex), s)
                : ZIndex.Background0;

            createFunc  = point => (IGameObject)Activator.CreateInstance(type, world, point, backgroundType, zIndex);
            objFullSize = createFunc(new Point()).Boundary.Size;
            if (produceMode is ProduceMode.One)
            {
                objectStack.Push(createFunc(objPoint));
            }
            else
            {
                foreach (IGameObject obj in Util.BatchRecCreate(createFunc, objPoint, quantity, objFullSize, ignoredSet))
                {
                    objectStack.Push(obj);
                }
            }
            return(true);
        }
コード例 #5
0
ファイル: MudTheme.cs プロジェクト: weiplanet/MudBlazor
 public MudTheme()
 {
     Palette          = new Palette();
     PaletteDark      = Palette.ConvertToDarkTheme(new Palette());
     Shadows          = new Shadow();
     Typography       = new Typography();
     LayoutProperties = new LayoutProperties();
     ZIndex           = new ZIndex();
 }
コード例 #6
0
 public TextSprite(string text, SpriteFont font, Point size, ZIndex zIndex, float fontSize = 18f) : base(
         size,
         zIndex)
 {
     this.text     = text;
     this.font     = font;
     this.fontSize = fontSize;
     color         = Color.White;
 }
コード例 #7
0
ファイル: Node.cs プロジェクト: xiaoxiongnpu/NodeGraph
        public override void WriteXml(XmlWriter writer)
        {
            base.WriteXml(writer);

            //{ Begin Creation info : You need not deserialize this block in ReadXml().
            // These are automatically serialized in FlowChart.ReadXml().
            writer.WriteAttributeString("ViewModelType", ViewModel.GetType().FullName);
            writer.WriteAttributeString("Owner", Owner.Guid.ToString());
            //} End creation info.

            writer.WriteAttributeString("Header", Header);
            writer.WriteAttributeString("HeaderBackgroundColor", HeaderBackgroundColor.ToString());
            writer.WriteAttributeString("HeaderFontColor", HeaderFontColor.ToString());
            writer.WriteAttributeString("AllowEditingHeader", AllowEditingHeader.ToString());

            writer.WriteAttributeString("AllowCircularConnection", AllowCircularConnection.ToString());

            writer.WriteAttributeString("X", X.ToString());
            writer.WriteAttributeString("Y", Y.ToString());
            writer.WriteAttributeString("ZIndex", ZIndex.ToString());

            writer.WriteStartElement("InputFlowPorts");
            foreach (var port in InputFlowPorts)
            {
                writer.WriteStartElement("FlowPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("OutputFlowPorts");
            foreach (var port in OutputFlowPorts)
            {
                writer.WriteStartElement("FlowPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("InputPropertyPorts");
            foreach (var port in InputPropertyPorts)
            {
                writer.WriteStartElement("PropertyPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();

            writer.WriteStartElement("OutputPropertyPorts");
            foreach (var port in OutputPropertyPorts)
            {
                writer.WriteStartElement("PropertyPort");
                port.WriteXml(writer);
                writer.WriteEndElement();
            }
            writer.WriteEndElement();
        }
コード例 #8
0
 public Background(IWorld world, Point location, string backGroundType, ZIndex zIndex) : base(
         world,
         location,
         new Point(32, 32))
 {
     BackGroundType = backGroundType;
     targetZIndex   = zIndex;
     UpdateSprite();
 }
コード例 #9
0
ファイル: SpriteFactory.cs プロジェクト: gen-xu/MelloMario
        public ISprite CreateSceneSprite(string type, ZIndex zIndex)
        {
            switch (type)
            {
            case "ShortCloud":
                return(new StaticSprite(GetTexture("BlockSheet"), 0, 40, 6, 4, zIndex));

            case "ShortSmileCloud":
                return(new StaticSprite(GetTexture("BlockSheet"), 8, 42, 2, 2, zIndex));

            case "LongCloud":
                return(new StaticSprite(GetTexture("BlockSheet"), 16, 44, 8, 2, zIndex));

            case "LongSmileCloud":
                return(new StaticSprite(GetTexture("BlockSheet"), 10, 40, 6, 4, zIndex));

            case "CastleTop":
                return(new StaticSprite(GetTexture("BlockSheet"), 22, 0, 2, 2, zIndex));

            case "CastleTopSolid":
                return(new StaticSprite(GetTexture("BlockSheet"), 22, 2, 2, 2, zIndex));

            case "CastleBody":
                return(new StaticSprite(GetTexture("BlockSheet"), 26, 0, 2, 2, zIndex));

            case "CastleDoorLeft":
                return(new StaticSprite(GetTexture("BlockSheet"), 24, 0, 2, 2, zIndex));

            case "CastleDoorRight":
                return(new StaticSprite(GetTexture("BlockSheet"), 28, 0, 2, 2, zIndex));

            case "CastleDoorTop":
                return(new StaticSprite(GetTexture("BlockSheet"), 24, 2, 2, 2, zIndex));

            case "CastleDoor":
                return(new StaticSprite(GetTexture("BlockSheet"), 26, 2, 2, 2, zIndex));

            case "Bush":
                return(new StaticSprite(GetTexture("BlockSheet"), 23, 18, 5, 2, zIndex));

            case "LeftTriangle":
                return(new StaticSprite(GetTexture("BlockSheet"), 16, 16, 2, 2, zIndex));

            case "RightTriangle":
                return(new StaticSprite(GetTexture("BlockSheet"), 20, 16, 2, 2, zIndex));

            case "Arc":
                return(new StaticSprite(GetTexture("BlockSheet"), 18, 21, 2, 3, zIndex));

            case "Rectangle":
                return(new StaticSprite(GetTexture("BlockSheet"), 16, 18, 2, 2, zIndex));

            default:
                return(null);
            }
        }
コード例 #10
0
ファイル: UIState.cs プロジェクト: CXUtk/UI-Editor
        public int CompareTo(object obj)
        {
            var other = obj as UIState;

            if (ZIndex != other.ZIndex)
            {
                return(ZIndex.CompareTo(other.ZIndex));
            }
            return(TimeGetFocus.CompareTo(other.TimeGetFocus));
        }
コード例 #11
0
 public FlashingAnimatedSprite(
     Texture2D texture,
     int columns,
     int rows,
     int x         = 0,
     int y         = 0,
     int width     = 2,
     int height    = 2,
     int interval  = Const.ANIMATION_INTERVAL,
     ZIndex zIndex = ZIndex.Item) : base(texture, columns, rows, x, y, width, height, interval, zIndex)
 {
 }
コード例 #12
0
 public GameObject CreateMovingObject(Tsx tsx, Vector2 location, ZIndex zIndex)
 {
     return(Entity.Create("TsxMovingObject", new Transform2(location, new Size2(tsx.TileWidth, tsx.TileHeight), zIndex))
            .Add((o, r) => new Texture(r.LoadTexture(tsx.ImageSource, o)))
            .Add(o => new Animation(0, o.Get <Texture>()))
            .Add(o => CreateMotionAnimationStates(tsx, o.Get <Texture>().Value))
            .Add(new Motion2(new Velocity2()))
            .Add(new Collision())
            .Add(new BoxCollider(Transform2.Zero))
            .Add(new MotionState())
            .Add(CreateBoxColliderStates(tsx)));
 }
コード例 #13
0
        public JsonValue ToJson(JsonSerializer serializer)
        {
            var json = new JsonObject();

            Id.Serialize(json, serializer, "id");
            Left.Serialize(json, serializer, "left");
            Name.Serialize(json, serializer, "image");
            Rotation.Serialize(json, serializer, "rotate");
            Top.Serialize(json, serializer, "top");
            ZIndex.Serialize(json, serializer, "zIndex");

            return(json);
        }
コード例 #14
0
ファイル: StaticSprite.cs プロジェクト: gen-xu/MelloMario
 public StaticSprite(
     Texture2D texture,
     int x         = 0,
     int y         = 0,
     int width     = 2,
     int height    = 2,
     ZIndex zIndex = ZIndex.Item) : base(
         texture,
         new Rectangle(
             x * Const.TEXTURE_GRID,
             y * Const.TEXTURE_GRID,
             width * Const.TEXTURE_GRID,
             height * Const.TEXTURE_GRID),
         zIndex)
 {
 }
コード例 #15
0
        //void PageInit(object sender, EventArgs e)
        //{
        //    Page.Form.Controls.Add(this);
        //}

        private void RenderModalBackground()
        {
            if (this.Visible)
            {
                this.Attributes.CssStyle.Add("z-index", (ZIndex + 1).ToString());

                // modal background creation
                HtmlGenericControl div = new HtmlGenericControl(HtmlTextWriterTag.Div.ToString());
                div.Attributes.Add("class", "modalbackground");
                div.Style.Add("z-index", ZIndex.ToString()); // HtmlTextWriterStyle.ZIndex rendered without hypen
                div.Style.Add("opacity", string.Format(".{0}", ModalBackgroundOpacity / 10));
                div.Style.Add(HtmlTextWriterStyle.Filter.ToString(), string.Format("alpha(opacity={0})", ModalBackgroundOpacity));
                div.ID = string.Format("{0}_modal", this.ID);

                Page.Form.Style.Add(HtmlTextWriterStyle.Height.ToString(), "100%");
                Page.Form.Controls.Add(div);
            }
        }
コード例 #16
0
 //singleton pattern
 void Awake()
 {
     if (control == null)
     {
         control = this;
         DontDestroyOnLoad(this.gameObject);
     }
     else if (control != this)
     {
         Destroy(gameObject);
     }
     player           = GameObject.Find("Player");
     cameraController = GameObject.Find("Main Camera").GetComponent <CameraController>();
     guiController    = GameObject.Find("GUI").GetComponent <GUIController>();
     zIndexManager    = GameObject.Find("ZIndexManager").GetComponent <ZIndex>();
     //globally set the FPS to 60 maximum;
     Application.targetFrameRate = 60;
     currentScene = new SceneStats();
 }
コード例 #17
0
ファイル: ModalSpace.cs プロジェクト: koder05/progs
        private ZIndex GetZIndex(ActionBlock modal, DependencyObject parent, ZIndex parentIdx)
        {
            if (parent == modal)
            {
                return(parentIdx);
            }

            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
            {
                var newIdx = new ZIndex(parentIdx.Index);
                newIdx.Add(i);
                var ret = GetZIndex(modal, VisualTreeHelper.GetChild(parent, i), newIdx);
                if (ret != null)
                {
                    return(ret);
                }
            }

            return(null);
        }
コード例 #18
0
            public override void WriteTo(XmlWriter xmlWriter)
            {
                xmlWriter.WriteStartElement("Image");
                {
                    xmlWriter.WriteAttributeString("Name", Name);

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Top", Item.Top.ToString());
                        xmlWriter.WriteElementString("Width", Item.Width.ToString());
                    }

                    if (!IsTableOrMatrixSubItem)
                    {
                        xmlWriter.WriteElementString("Left", Item.Left.ToString());
                        xmlWriter.WriteElementString("Height", Item.Height.ToString());
                    }

                    if (ImageBox.Action != null)
                    {
                        RAction rAction = new RAction(ImageBox.Action);
                        rAction.WriteTo(xmlWriter);
                    }

                    //Style
                    //base.Write(xmlWriter);
                    RStyle rStyle = new RStyle(this, Item.Style);
                    rStyle.WriteTo(xmlWriter);

                    xmlWriter.WriteElementString("ZIndex", ZIndex.ToString());

                    RBaseImage rBaseImage = new RBaseImage(ImageBox.Image);
                    rBaseImage.WriteTo(xmlWriter);
                }
                xmlWriter.WriteEndElement();
            }
コード例 #19
0
 protected BaseTextureSprite(Texture2D texture, Rectangle source, ZIndex zIndex) : base(source.Size, zIndex)
 {
     this.texture = texture;
     this.source  = source;
     color        = Color.White;
 }
コード例 #20
0
ファイル: ModalSpace.cs プロジェクト: koder05/fogel-ba
        private ZIndex GetZIndex(ActionBlock modal, DependencyObject parent, ZIndex parentIdx)
        {
            if (parent == modal)
                return parentIdx;

            for (int i = 0; i < VisualTreeHelper.GetChildrenCount(parent); i++)
            {
                var newIdx = new ZIndex(parentIdx.Index);
                newIdx.Add(i);
                var ret = GetZIndex(modal, VisualTreeHelper.GetChild(parent, i), newIdx);
                if (ret != null)
                    return ret;
            }

            return null;
        }
コード例 #21
0
        private void RenderScriptBlock(HtmlTextWriter output)
        {
            output.AddAttribute(HtmlTextWriterAttribute.Type, "text/javascript");
            output.RenderBeginTag(HtmlTextWriterTag.Script);

            output.Write("var ");
            output.Write(ClientID);
            output.Write("_obj = new ModalPopup('");
            output.Write(ClientID);
            output.Write("', '");
            output.Write(OpenElementClientID);
            output.Write("', ");
            if (!string.IsNullOrEmpty(CloseElementClientID))
            {
                output.Write("'");
                output.Write(CloseElementClientID);
                output.Write("', ");
            }
            else
            {
                output.Write("false, ");
            }

            //Options
            output.Write("{");
            if (Width != Unit.Empty)
            {
                output.Write(String.Format("width: {0},", Width.ToString()));
            }
            if (Height != Unit.Empty)
            {
                output.Write(String.Format("height: {0},", Height.ToString()));
            }

            output.Write(String.Format("overlayOpacity: {0}, ", OverlayOpacity.ToString()));
            output.Write(String.Format("zIndex: {0}", ZIndex.ToString()));

            if (OverlayColor != Color.Empty)
            {
                output.Write(String.Format(", overlayBackgroundColor: '{0}'", ColorTranslator.ToHtml(OverlayColor)));
            }

            if (!string.IsNullOrEmpty(OnClientBeforeOpen))
            {
                output.Write(RenderCallback("beforeOpen", OnClientBeforeOpen));
            }

            if (!string.IsNullOrEmpty(OnClientAfterOpen))
            {
                output.Write(RenderCallback("afterOpen", OnClientAfterOpen));
            }

            if (!string.IsNullOrEmpty(OnClientBeforeClose))
            {
                output.Write(RenderCallback("beforeClose", OnClientBeforeClose));
            }

            if (!string.IsNullOrEmpty(OnClientAfterClose))
            {
                output.Write(RenderCallback("afterClose", OnClientAfterClose));
            }

            output.Write("});");

            output.RenderEndTag();
        }
コード例 #22
0
ファイル: UIElement.cs プロジェクト: btbaggin/SmallEngine
 public int CompareTo(UIElement other)
 {
     return(ZIndex.CompareTo(other.ZIndex));
 }
コード例 #23
0
ファイル: SpriteFactory.cs プロジェクト: gen-xu/MelloMario
 public ISprite CreateTitle(ZIndex zIndex)
 {
     return(new StaticSprite(GetTexture("Title"), 0, 0, 22, 11, zIndex));
 }
コード例 #24
0
ファイル: ModalSpace.cs プロジェクト: koder05/progs
        private ZIndex GetGlobalZIndex(ActionBlock modal)
        {
            var idx = new ZIndex();

            return(GetZIndex(modal, Application.Current.MainWindow, idx));
        }
コード例 #25
0
        public Personalizacion()
        {
            Palette = new Palette()
            {
                Primary          = Colors.Blue.Darken1,
                Secondary        = Colors.DeepPurple.Accent2,
                Background       = Colors.Grey.Lighten5,
                AppbarBackground = Colors.Blue.Darken1,
                DrawerBackground = "#FFF",
                DrawerText       = "rgba(0,0,0, 0.7)",
                Success          = "#06d79c"
            };

            LayoutProperties = new LayoutProperties()
            {
                DefaultBorderRadius = "15px"
            };

            Typography = new Typography()
            {
                Default = new Default()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = ".875rem",
                    FontWeight    = 400,
                    LineHeight    = 1.43,
                    LetterSpacing = ".01071em"
                },
                H1 = new H1()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "6rem",
                    FontWeight    = 300,
                    LineHeight    = 1.167,
                    LetterSpacing = "-.01562em"
                },
                H2 = new H2()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "3.75rem",
                    FontWeight    = 300,
                    LineHeight    = 1.2,
                    LetterSpacing = "-.00833em"
                },
                H3 = new H3()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "3rem",
                    FontWeight    = 400,
                    LineHeight    = 1.167,
                    LetterSpacing = "0"
                },
                H4 = new H4()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "2.125rem",
                    FontWeight    = 400,
                    LineHeight    = 1.235,
                    LetterSpacing = ".00735em"
                },
                H5 = new H5()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "1.5rem",
                    FontWeight    = 400,
                    LineHeight    = 1.334,
                    LetterSpacing = "0"
                },
                H6 = new H6()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "1.25rem",
                    FontWeight    = 400,
                    LineHeight    = 1.6,
                    LetterSpacing = ".0075em"
                },
                Button = new Button()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = ".875rem",
                    FontWeight    = 500,
                    LineHeight    = 1.75,
                    LetterSpacing = ".02857em"
                },
                Body1 = new Body1()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = "1rem",
                    FontWeight    = 400,
                    LineHeight    = 1.5,
                    LetterSpacing = ".00938em"
                },
                Body2 = new Body2()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = ".875rem",
                    FontWeight    = 400,
                    LineHeight    = 1.43,
                    LetterSpacing = ".01071em"
                },
                Caption = new Caption()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = ".75rem",
                    FontWeight    = 400,
                    LineHeight    = 1.66,
                    LetterSpacing = ".03333em"
                },
                Subtitle2 = new Subtitle2()
                {
                    FontFamily    = new[] { "Segoe UI", "Helvetica", "Arial", "sans-serif" },
                    FontSize      = ".875rem",
                    FontWeight    = 500,
                    LineHeight    = 1.57,
                    LetterSpacing = ".00714em"
                }
            };
            Shadows = new Shadow();
            ZIndex  = new ZIndex();
        }
コード例 #26
0
ファイル: ModalSpace.cs プロジェクト: koder05/fogel-ba
 private ZIndex GetGlobalZIndex(ActionBlock modal)
 {
     var idx = new ZIndex();
     return GetZIndex(modal, Application.Current.MainWindow, idx);
 }
コード例 #27
0
 protected BaseSprite(Point size, ZIndex zIndex)
 {
     PixelSize   = size;
     this.zIndex = zIndex;
     visible     = true;
 }