当前位置: 首页>>代码示例>>C#>>正文


C# Skin类代码示例

本文整理汇总了C#中Skin的典型用法代码示例。如果您正苦于以下问题:C# Skin类的具体用法?C# Skin怎么用?C# Skin使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Skin类属于命名空间,在下文中一共展示了Skin类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BuyGachapon

    public void BuyGachapon()
    {
        // Check if there is not enough cash
        if (!PlayerSetting.TakeCoins(GachaponMachine.Cost))
        {
            // Do not allow buying
            return;
        }

        // Generate the skin
        rewardSkin = GachaponMachine.GetRandomSkin();

        if (rewardSkin != null)
        {
            // Set the reward image
            rewardImage.sprite = rewardSkin.PreviewSprite;

            // Set the reward name
            RewardText.text = rewardSkin.SkinName;

            // Play the animation
            startAnimation();

            // Store the skin
            PlayerSetting.AddToSkinStorage(rewardSkin);
        }
    }
开发者ID:Pycorax,项目名称:SP4Unity,代码行数:27,代码来源:GachaponScreen.cs

示例2: Layout

        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(Skin.Base skin)
        {
            base.Layout(skin);

            m_ScrollButton[0].Width = Height;
            m_ScrollButton[0].Dock = Pos.Left;

            m_ScrollButton[1].Width = Height;
            m_ScrollButton[1].Dock = Pos.Right;

            m_Bar.Height = ButtonSize;
            m_Bar.Padding = new Padding(ButtonSize, 0, ButtonSize, 0);

            float barWidth = (m_ViewableContentSize / m_ContentSize) * (Width - (ButtonSize * 2));

            if (barWidth < ButtonSize * 0.5f)
                barWidth = (int)(ButtonSize * 0.5f);

            m_Bar.Width = (int)(barWidth);
            m_Bar.IsHidden = Width - (ButtonSize * 2) <= barWidth;

            //Based on our last scroll amount, produce a position for the bar
            if (!m_Bar.IsHeld)
            {
                SetScrollAmount(ScrollAmount, true);
            }
        }
开发者ID:petya2164,项目名称:ZsharpGameEditor,代码行数:31,代码来源:HorizontalScrollBar.cs

示例3: Merge

        partial void Merge(Skin entity, SkinDTO dto, object state)
        {
            if (state == null)
            {
                throw new ArgumentNullException("state", "Precondition: state is IResponse");
            }

            var response = state as IResponse;
            if (response == null)
            {
                throw new ArgumentException("Precondition: state is IResponse", "state");
            }

            entity.Culture = response.Culture;
            entity.SkinId = dto.Id;
            entity.Name = dto.Name;

            if (dto.Flags != null)
            {
                entity.Flags = this.skinFlagsConverter.Convert(dto.Flags, state);
            }

            if (dto.Restrictions != null)
            {
                entity.Restrictions = this.itemRestrictionsConverter.Convert(dto.Restrictions, state);
            }

            // Process the URI. Note since the V2 api the URI doesn't have to be built by hand anymore.
            // It is stored as a a string in the response.
            // Question: Shouled we split the URI for user convenience or not??
            // TODO: yes we should split the URI. Not for convencience, but because 'Skin' implements 'IRenderable'
            entity.IconFileUrl = new Uri(dto.IconUrl, UriKind.Absolute);
        }
开发者ID:tigerbytes,项目名称:GW2.NET,代码行数:33,代码来源:SkinConverter.cs

示例4: NewAttachment

    // this is the attachment loader which will hook into Futile's AtlasManager for the attachment/element data
    public Attachment NewAttachment(Skin skin, AttachmentType type, String name)
    {
        switch(type){
            case AttachmentType.region:

                FAtlasElement element = Futile.atlasManager.GetElementWithName(name);
                RegionAttachment attachment = new RegionAttachment(name);

                if(element != null){
                    attachment.Texture = element;
                    attachment.SetUVs(element.uvBottomLeft.x, element.uvBottomLeft.y, element.uvTopRight.x, element.uvTopRight.y, false);
                    attachment.RegionOffsetX = 0.0f;
                    attachment.RegionOffsetY = 0.0f;
                    attachment.RegionWidth = element.sourceSize.x;
                    attachment.RegionHeight = element.sourceSize.y;
                    attachment.RegionOriginalWidth = element.sourceSize.x;
                    attachment.RegionOriginalHeight = element.sourceSize.y;

                }else{
                    attachment.Texture = null;
                    attachment.SetUVs(0.0f, 0.0f, 0.0f, 0.0f, false);
                    attachment.RegionOffsetX = 0.0f;
                    attachment.RegionOffsetY = 0.0f;
                    attachment.RegionWidth = 0.0f;
                    attachment.RegionHeight = 0.0f;
                    attachment.RegionOriginalWidth = 0.0f;
                    attachment.RegionOriginalHeight = 0.0f;

                    Debug.Log("Element [" + name + "] not found in Futile.AtlasManager");
                }
                return attachment;
        }
        throw new Exception("Unknown attachment type: " + type);
    }
开发者ID:anhuishuqi,项目名称:Futile-SpineSprite,代码行数:35,代码来源:GSpineAttachmentLoader.cs

示例5: DrawNumbers

 public static void DrawNumbers(SpriteBatch batch, Skin skin, int amount, int x, int y)
 {
     batch.Draw(skin.numBox, new Vector2(x - 8, y - 8), Color.White);
     int[] amountNums = new int[3];
     if (amount >= 0)
     {
         if (amount > 999) amount = 999;
         amountNums[0] = (amount - (amount % 100)) / 100;
         amountNums[1] = ((amount - amountNums[0] * 100) - ((amount - amountNums[0] * 100) % 10)) / 10;
         amountNums[2] = amount - (amountNums[0] * 100) - (amountNums[1] * 10);
         batch.Draw(skin.numbers[amountNums[0]], new Rectangle(x, y, 13, 23), Color.White);
         batch.Draw(skin.numbers[amountNums[1]], new Rectangle(x + 13, y, 13, 23), Color.White);
         batch.Draw(skin.numbers[amountNums[2]], new Rectangle(x + 26, y, 13, 23), Color.White);
     }
     else
     {
         char[] amountParts = new char[10];
         amountParts = amount.ToString().ToCharArray();
         if (amount < 0 & amount > -10) amountNums[1] = 0;
         else amountNums[1] = int.Parse(amountParts[amountParts.GetUpperBound(0) - 1].ToString());
         amountNums[2] = int.Parse(amountParts[amountParts.GetUpperBound(0)].ToString());
         if (amount < 0 & amount > -10) amountNums[1] = 0;
         batch.Draw(skin.numbers[10], new Rectangle(x, y, 13, 23), Color.White);
         batch.Draw(skin.numbers[amountNums[1]], new Rectangle(x + 13, y, 13, 23), Color.White);
         batch.Draw(skin.numbers[amountNums[2]], new Rectangle(x + 26, y, 13, 23), Color.White);
     }
 }
开发者ID:SSheldon,项目名称:ZuneMinesweeper,代码行数:27,代码来源:MinesweeperGame.cs

示例6: getFieldBuilder

 /// <summary>
 /// Gets corresponding widget builder based on input type
 /// </summary>
 /// <param name="field">holds information about input type</param>
 /// <param name="skin">passed to builders to define look of widgets</param>
 /// <returns>corresponding widget builder</returns>
 public AbstractWidgetBuilder getFieldBuilder(AFField field, Skin skin)
 {
     if (Utils.IsFieldWritable(field.getFieldInfo().getWidgetType()))
     {
         return new TextWidgetBuilder(skin, field);
     }
     if (field.getFieldInfo().getWidgetType().Equals(SupportedWidgets.CALENDAR))
     {
         return new DateWidgetBuilder(skin, field);
     }
     if (field.getFieldInfo().getWidgetType().Equals(SupportedWidgets.OPTION))
     {
         return new OptionWidgetBuilder(skin, field);
     }
     if (field.getFieldInfo().getWidgetType().Equals(SupportedWidgets.DROPDOWNMENU))
     {
         return new DropDownWidgetBuilder(skin, field);
     }
     if (field.getFieldInfo().getWidgetType().Equals(SupportedWidgets.CHECKBOX))
     {
         return new CheckboxWidgetBuilder(skin, field);
     }
     if (field.getFieldInfo().getWidgetType().Equals(SupportedWidgets.PASSWORD))
     {
         return new PasswordWidgetBuilder(skin, field);
     }
     Debug.WriteLine("BUILDER FOR " + field.getFieldInfo().getWidgetType() + " NOT FOUND");
     return null;
 }
开发者ID:matyapav,项目名称:AFSwinx,代码行数:35,代码来源:WidgetBuilderFactory.cs

示例7: RenderFocus

        /// <summary>
        /// Renders the focus overlay.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void RenderFocus(Skin.Base skin)
        {
            if (InputHandler.KeyboardFocus != this) return;
            if (!IsTabable) return;

            skin.DrawKeyboardHighlight(this, RenderBounds, 0);
        }
开发者ID:LawlietRyuuzaki,项目名称:gwen-dotnet,代码行数:11,代码来源:LabeledRadioButton.cs

示例8: PopUpPanel

        /// <summary>
        /// Extension of the Panel which has Button to close itself and Label with title.
        /// Position is calculate from given width and height (1/4 of the width and 1/5 of the height).
        /// Also panel width and height is calculate as 1/2 of the width and 4/7 of the hight.
        /// </summary>
        /// <param name="screenWidth">The width od screen.</param>
        /// <param name="screenHeight">The height od screen.</param>
        /// <param name="text">The title text.</param>
        /// <param name="name">The name of the panel.</param>
        /// <param name="rowHeight">The height of the title label.</param>
        /// <param name="panelSkin">The skin of the creating panel.</param>
        /// <param name="buttonSkin">The skin of the the closing button.</param>
        public PopUpPanel(int screenWidth, int screenHeight, string text, string name, int rowHeight, Skin panelSkin, Skin buttonSkin)
        {
            Width = screenWidth / 2;
            Height = screenHeight * 4 / 7;
            Location = new Point(screenWidth / 4, screenHeight / 5);
            Skin = panelSkin;
            ResizeMode = ResizeModes.None;
            Padding = new Thickness(5, 10, 0, 0);
            Name = name;

            // Title label
            var label = new Label() {
                Size = new Size(Width / 2, rowHeight),
                Text = text,
                Location = new Point(Width / 4, 0),
                TextStyle = {
                    Alignment = Miyagi.Common.Alignment.TopCenter
                }
            };

            Controls.Add(label);
            Button closeButton = new CloseButton(name) {
                Size = new Size(Width / 3, Height / 12),
                Location = new Point(Width * 5 / 8, Height * 7 / 8),
                Skin = buttonSkin,
                Text = "Cancel",
                TextStyle = new TextStyle {
                    Alignment = Alignment.MiddleCenter
                }
            };

            Controls.Add(closeButton);
        }
开发者ID:vavrekmichal,项目名称:StrategyGame,代码行数:45,代码来源:PopUpPanel.cs

示例9: MotionlessKiller

 public MotionlessKiller(Point top, Skin skin)
     : base(top, new Size(0, 0))
 {
     switch (skin)
     {
         case Skin.EringiUp:
             eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_S.png");
             Size = new Size(32, 32);
             break;
         case Skin.EringiDown:
             eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringiDownS.png");
             Size = new Size(32, 32);
             break;
         case Skin.BambooSpear:
             eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/bambooSpear.png");
             Size = new Size(32, 32);
             break;
         case Skin.LongEringiTrap01:
             eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_L_left01.png");
             Size=new Size(32,32);
             break;
         default:
             throw new ArgumentOutOfRangeException("skin", skin, null);
     }
 }
开发者ID:TUS-OSK,项目名称:shuntamu,代码行数:25,代码来源:MotionlessKiller.cs

示例10: Layout

        /// <summary>
        /// Lays out the control's interior according to alignment, padding, dock etc.
        /// </summary>
        /// <param name="skin">Skin to use.</param>
        protected override void Layout(Skin.Base skin)
        {
            base.Layout(skin);

            m_ScrollButton[0].Height = Width;
            m_ScrollButton[0].Dock = Pos.Top;

            m_ScrollButton[1].Height = Width;
            m_ScrollButton[1].Dock = Pos.Bottom;

            m_Bar.Width = ButtonSize;
            m_Bar.Padding = new Padding(0, ButtonSize, 0, ButtonSize);

            float barHeight = 0.0f;
            if (m_ContentSize > 0.0f) barHeight = (m_ViewableContentSize/m_ContentSize)*(Height - (ButtonSize*2));

            if (barHeight < ButtonSize*0.5f)
                barHeight = (int) (ButtonSize*0.5f);

            m_Bar.Height = (int) (barHeight);
            m_Bar.IsHidden = Height - (ButtonSize*2) <= barHeight;

            //Based on our last scroll amount, produce a position for the bar
            if (!m_Bar.IsHeld)
            {
                SetScrollAmount(ScrollAmount, true);
            }
        }
开发者ID:LawlietRyuuzaki,项目名称:gwen-dotnet,代码行数:32,代码来源:VerticalScrollBar.cs

示例11: MotionKiller

        public MotionKiller(Point top, Point ereatop, Size ereasize,int moveX,int moveY,Skin skin)
            : base(top, new Size(32, 32))
        {
            Erea = new MotionlessObject(ereatop, ereasize);
            Erea.IsSolid = false;
            Erea.BeHitEvent += () =>
            {
                _isTrigered = true;
            };
            x = moveX;
            y = moveY;

            switch (skin)
            {
                case Skin.EringiUp:
                    eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_S.png");
                    Size = new Size(32, 32);
                    break;
                case Skin.EringiDown:
                    eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringiDownS.png");
                    Size = new Size(32, 32);
                    break;
                case Skin.LongEringiTrap02:
                    eringiHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_L_left02.png");
                    Size = new Size(32, 32);
                    break;
                default:
                    throw new ArgumentOutOfRangeException("skin", skin, null);
            }
        }
开发者ID:TUS-OSK,项目名称:shuntamu,代码行数:30,代码来源:MotionKiller.cs

示例12: VanishKiller

        public VanishKiller(Point top,Point triggerTop,Size triggerSize,Skin skin)
            : base(top, new Size(32,32))
        {
            skinHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_S.png");
            Trigger = new MotionlessObject(triggerTop, triggerSize);
            Trigger.IsSolid = false;
            Trigger.BeHitEvent += () =>
            {
                _isTriggered = true;
            };

            switch (skin)
            {
                case Skin.EringiUp:
                    skinHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringi_S.png");
                    Size = new Size(32, 32);
                    break;
                case Skin.EringiDown:
                    skinHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/eringiDownS.png");
                    Size = new Size(32, 32);
                    break;
                case Skin.LongEringiUp:
                    skinHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/longEringiUp.png");
                    Size = new Size(32, 64);
                    break;
                case Skin.LongEringiDown:
                    skinHandle = DX.LoadGraph(@"../../IWBT素材/ブロック/longEringiDown.png");
                     Size = new Size(32, 64);
                    break;
            }
        }
开发者ID:TUS-OSK,项目名称:shuntamu,代码行数:31,代码来源:VanishKiller.cs

示例13: NewRegionAttachment

    public RegionAttachment NewRegionAttachment(Skin skin, String name, String path)
    {
        FAtlasElement element = Futile.atlasManager.GetElementWithName(name);
        RegionAttachment attachment = new RegionAttachment(name);

        if(element != null){
            attachment.RendererObject = element;
            attachment.SetUVs(element.uvBottomLeft.x, element.uvBottomLeft.y, element.uvTopRight.x, element.uvTopRight.y, false);
            attachment.RegionOffsetX = 0.0f;
            attachment.RegionOffsetY = 0.0f;
            attachment.RegionWidth = element.sourceSize.x;
            attachment.RegionHeight = element.sourceSize.y;
            attachment.RegionOriginalWidth = element.sourceSize.x;
            attachment.RegionOriginalHeight = element.sourceSize.y;

        }else{
            attachment.RendererObject = null;
            attachment.SetUVs(0.0f, 0.0f, 0.0f, 0.0f, false);
            attachment.RegionOffsetX = 0.0f;
            attachment.RegionOffsetY = 0.0f;
            attachment.RegionWidth = 0.0f;
            attachment.RegionHeight = 0.0f;
            attachment.RegionOriginalWidth = 0.0f;
            attachment.RegionOriginalHeight = 0.0f;

            Debug.Log("Element [" + name + "] not found in Futile.AtlasManager");
        }
        return attachment;
    }
开发者ID:Grizzlage,项目名称:Futile-SpineSprite,代码行数:29,代码来源:GSpineAttachmentLoader.cs

示例14: prepareField

        /// <summary>
        ///  Prepares field with all needed information including UI representation.
        /// </summary>
        /// <param name="properties">information about a field, needed for e.g setting id of field</param>
        /// <param name="road">if not empty, field belongs to some inner class. This fact must be set into fields id.</param>
        /// <param name="skin">defines the look of field</param>
        /// <returns>prepared field with all needed information</returns>
        public AFField prepareField(AFFieldInfo properties, StringBuilder road, Skin skin)
        {

            AFField field = new AFField(properties);
            field.setId(road.ToString() + properties.getId());

            //LABEL
            TextBlock label = buildLabel(properties, skin);
            field.setLabel(label);

            //ERROR TEXT
            TextBlock errorView = buildErrorView(skin);
            field.setErrorView(errorView);

            //Input view
            FrameworkElement widget = null;
            AbstractWidgetBuilder widgetBuilder = WidgetBuilderFactory.getInstance().getFieldBuilder(field, skin);
            if (widgetBuilder != null && (widget = widgetBuilder.buildFieldView()) != null)
            {
                field.setWidgetBuilder(widgetBuilder);
                field.setFieldView(widget);
            }

            //put it all together
            //when field is not visible don't even add it to form;
            FrameworkElement completeView = buildCompleteView(field, skin);
            if (!properties.isVisible())
            {
                completeView.Visibility = Visibility.Collapsed;
            }
            field.setCompleteView(completeView);
            return field;
        }
开发者ID:matyapav,项目名称:AFSwinx,代码行数:40,代码来源:FieldBuilder.cs

示例15: NewAttachment

    public Attachment NewAttachment(Skin skin, AttachmentType type, String name)
    {
        if (type != AttachmentType.region)
            throw new Exception("Unknown attachment type: " + type);

        // Strip folder names.
        int index = name.LastIndexOfAny(new char[] {'/', '\\'});
        if (index != -1)
            name = name.Substring(index + 1);

        tk2dSpriteDefinition def = sprites.GetSpriteDefinition(name);

        if (def == null)
            throw new Exception("Sprite not found in atlas: " + name + " (" + type + ")");
        if (def.complexGeometry)
            throw new NotImplementedException("Complex geometry is not supported: " + name + " (" + type + ")");
        if (def.flipped == tk2dSpriteDefinition.FlipMode.TPackerCW)
            throw new NotImplementedException("Only 2D Toolkit atlases are supported: " + name + " (" + type + ")");

        RegionAttachment attachment = new RegionAttachment(name);

        Vector2 minTexCoords = Vector2.one;
        Vector2 maxTexCoords = Vector2.zero;
        for (int i = 0; i < def.uvs.Length; ++i) {
            Vector2 uv = def.uvs[i];
            minTexCoords = Vector2.Min(minTexCoords, uv);
            maxTexCoords = Vector2.Max(maxTexCoords, uv);
        }
        bool rotated = def.flipped == tk2dSpriteDefinition.FlipMode.Tk2d;
        if (rotated) {
            float temp = minTexCoords.x;
            minTexCoords.x = maxTexCoords.x;
            maxTexCoords.x = temp;
        }
        attachment.SetUVs(
            minTexCoords.x,
            maxTexCoords.y,
            maxTexCoords.x,
            minTexCoords.y,
            rotated
        );

        attachment.RegionOriginalWidth = (int)(def.untrimmedBoundsData[1].x / def.texelSize.x);
        attachment.RegionOriginalHeight = (int)(def.untrimmedBoundsData[1].y / def.texelSize.y);

        attachment.RegionWidth = (int)(def.boundsData[1].x / def.texelSize.x);
        attachment.RegionHeight = (int)(def.boundsData[1].y / def.texelSize.y);

        float x0 = def.untrimmedBoundsData[0].x - def.untrimmedBoundsData[1].x / 2;
        float x1 = def.boundsData[0].x - def.boundsData[1].x / 2;
        attachment.RegionOffsetX = (int)((x1 - x0) / def.texelSize.x);

        float y0 = def.untrimmedBoundsData[0].y - def.untrimmedBoundsData[1].y / 2;
        float y1 = def.boundsData[0].y - def.boundsData[1].y / 2;
        attachment.RegionOffsetY = (int)((y1 - y0) / def.texelSize.y);

        attachment.RendererObject = def.material;

        return attachment;
    }
开发者ID:nomad512,项目名称:spine-runtimes,代码行数:60,代码来源:SpriteCollectionAttachmentLoader.cs


注:本文中的Skin类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。