예제 #1
0
    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);
        }
    }
예제 #2
0
        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);
        }
예제 #3
0
 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);
     }
 }
예제 #4
0
        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);
            }
        }
예제 #5
0
 /// <summary>
 /// Function invoked after layout.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void PostLayout(Skin.Base skin)
 {
     foreach (Base child in Children) // ok?
     {
         child.Position(m_Pos);
     }
 }
        /// <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);
            }
        }
예제 #7
0
        protected override void InitializeCore()
        {
            ShowDebug = true;

            Skin skin = new Skin(new TextureAtlas(Context.GraphicsDevice, "Data/uiskin.atlas"));
            skin.Add("white", Color.White);
            skin.Add("red", Color.Red);
            skin.Add("default-font", new BitmapFont(Context.GraphicsDevice, "Data/default.fnt", false));
            skin.Add("default", new TextButtonStyle() {
                Down = skin.GetDrawable("default-round-down"),
                Up = skin.GetDrawable("default-round"),
                Font = skin.GetFont("default-font"),
                FontColor = skin.GetColor("white"),
            });
            _stage = new Stage(Context.Window.ClientBounds.Width, Context.Window.ClientBounds.Height, false, Context.GraphicsDevice);

            Context.Input.Processor = _stage;

            TextButton button = new TextButton("Button " + 0, skin) {
                X = 200, Y = 200, Width = 150, Height = 100,
                /*X = _rand.Next(0, Context.GraphicsDevice.Viewport.Width - 200),
                Y = _rand.Next(0, Context.GraphicsDevice.Viewport.Height - 100),
                Width = _rand.Next(50, 200),
                Height = _rand.Next(0, 100),*/
            };
            _stage.AddActor(button);

            Context.Window.ClientSizeChanged += (s, e) => {
                _stage.SetViewport(Context.Window.ClientBounds.Width, Context.Window.ClientBounds.Height, false);
            };
        }
예제 #8
0
		public override void initialize( Table table, Skin skin )
		{
			var button = new TextButton( _name, skin );
			button.onClicked += onButtonClicked;

			// we could have zero or 1 param
			var parameters = ( _memberInfo as MethodInfo ).GetParameters();
			if( parameters.Length == 0 )
			{
				table.add( button );
				return;
			}

			var parameter = parameters[0];
			_parameterType = parameter.ParameterType;

			_textField = new TextField( _parameterType.GetTypeInfo().IsValueType ? Activator.CreateInstance( _parameterType ).ToString() : "", skin );
			_textField.shouldIgnoreTextUpdatesWhileFocused = false;

			// add a filter for float/int
			if( _parameterType == typeof( float ) )
				_textField.setTextFieldFilter( new FloatFilter() );
			if( _parameterType == typeof( int ) )
				_textField.setTextFieldFilter( new DigitsOnlyFilter() );
			if( _parameterType == typeof( bool ) )
				_textField.setTextFieldFilter( new BoolFilter() );

			table.add( button );
			table.add( _textField ).setMaxWidth( 70 );
		}
    // 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);
    }
예제 #10
0
        public SkinManager(string filePath, PictureBox pictureBox)
        {
            _pictureBox = pictureBox;

            // Brushes
            _brushPerType = new Dictionary<ComponentType, Brush>
            {
                {ComponentType.Key, new SolidBrush(Color.FromArgb(Alpha, Color.Blue))},
                {ComponentType.Screen, new SolidBrush(Color.FromArgb(Alpha, Color.Red))},
                {ComponentType.Maximized, new SolidBrush(Color.FromArgb(Alpha, Color.Green))}
            };

            // Path
            SkinPath = filePath;

            _undo = new UndoRedoManager<Skin>(10);
            _skin = new Skin(SkinPath);
            _undo.SaveState(_skin);
            _undo.UndoRedoStateChanged += (o, args) => OnComponentsChanged();

            _pictureBox.Size = new Size(_skin.SkinSize.Width * 3, _skin.SkinSize.Height * 3);

            // PictureBox events
            pictureBox.Paint += (o, args) => Paint(args.Graphics);
            pictureBox.MouseDown += pictureBox_MouseDown;
            pictureBox.MouseUp += pictureBox_MouseUp;
            pictureBox.MouseLeave += pictureBox_MouseLeave;
            pictureBox.MouseMove += pictureBox_MouseMove;
        }
예제 #11
0
 /// <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;
 }
예제 #12
0
 /// <summary>
 /// Function invoked after layout.
 /// </summary>
 /// <param name="skin">Skin to use.</param>
 protected override void PostLayout(Skin.Base skin)
 {
     foreach (GUIControl child in Children) // ok?
     {
         child.SetPosition(m_Pos, 0, 0);
     }
 }
예제 #13
0
        /// <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;
        }
예제 #14
0
		public void initialize( Table table, Skin skin )
		{
			table.getRowDefaults().setPadTop( 10 );
			table.add( name.Replace( "PostProcessor", string.Empty ) ).getElement<Label>().setFontScale( 1f ).setFontColor( new Color( 241, 156, 0 ) );

			// if we have a component, stick a bool for enabled here
			if( target != null )
			{
				_enabledCheckbox = new CheckBox( string.Empty, skin );
				_enabledCheckbox.programmaticChangeEvents = false;

				if( target is Component )
					_enabledCheckbox.isChecked = ( (Component)target ).enabled;
				else if( target is PostProcessor )
					_enabledCheckbox.isChecked = ((PostProcessor)target ).enabled;
				
				_enabledCheckbox.onChanged += newValue =>
				{
					if( target is Component )
						((Component)target).enabled = newValue;
					else if( target is PostProcessor )
						( (PostProcessor)target ).enabled = newValue;
				};

				table.add( _enabledCheckbox ).right();
			}
			table.row();

			foreach( var i in _inspectors )
			{
				i.initialize( table, skin );
				table.row();
			}
		}
예제 #15
0
        private static string skinName(Skin skin)
        {
            switch(skin)
            {
            case Skin.FlagBrowser:
                return "FlagBrowserSkin";
            case Skin.Window1:
                return "KSP window 1";
            case Skin.Window2:
                return "KSP window 2";
            case Skin.Window3:
                return "KSP window 3";
            case Skin.Window4:
                return "KSP window 4";
            case Skin.Window5:
                return "KSP window 5";
            case Skin.Window6:
                return "KSP window 6";
            case Skin.Window7:
                return "KSP window 7";
            case Skin.OrbitMap:
                return "OrbitMapSkin";
            case Skin.PlaqueDialog:
                return "PlaqueDialogSkin";
            case Skin.Default:
                return "Default";
            }

            return "";
        }
        /// <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);
            }
        }
    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;
    }
예제 #18
0
        public static void SetSkin(Skin newSkin)
        {
            if (newSkin != skin && IsUnlocked(newSkin))
            {
                GameObject go = null;

                foreach (GameObject g in _instance.skins)
                {
                    theme = g.GetComponent<Theme>();
                    if (theme.horizonSkin == newSkin)
                    {
                        foreach (Transform child in _instance.transform)
                        {
                            Destroy(child.gameObject);
                        }
                        go = Instantiate(g, new Vector3(0f, 0f, 0f), Quaternion.identity);
                        go.gameObject.transform.parent = _instance.transform;
                        go.gameObject.transform.localPosition = Vector3.zero;
                        skin = newSkin;
                        ProgressManager.GetProgress().settings.skin = skin;

                        GameObject bgCam = GameObject.FindGameObjectWithTag("BackgroundCam");
                        bgCam.GetComponent<Camera>().backgroundColor = theme.backgorundColor;

                        break;
                    }
                }
            }
        }
예제 #19
0
        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;
            }
        }
        public static void On_Skin_Init(Skin self)
        {
            if ((graphicsTex == null) || (graphicsTex.GraphicsDevice != GnomanEmpire.Instance.GraphicsDevice) || graphicsTex.IsDisposed)
            {
                graphicsTex = CustomTextureManager.GetFromAssemblyResource(Assembly.GetExecutingAssembly(), "Faark.Gnomoria.Mods.Resources.maxButtons.png");
                //Texture2D.FromStream(GnomanEmpire.Instance.GraphicsDevice, Assembly.GetExecutingAssembly().GetManifestResourceStream( "Faark.Gnomoria.Mods.Resources.maxButtons.png"));
            }
            var maxImg = new SkinImage();
            maxImg.Resource = graphicsTex; // warning have to load it here!
            maxImg.Name = "Window.MaximizeButton";
            self.Images.Add(maxImg);

            var mySkinLayer = new SkinLayer();
            mySkinLayer.Name = "Control";
            mySkinLayer.Alignment = Alignment.MiddleLeft;
            mySkinLayer.ContentMargins = new Margins(6);
            mySkinLayer.SizingMargins = new Margins(6);
            mySkinLayer.Image = maxImg;
            mySkinLayer.Height = 28;
            mySkinLayer.Width = 28;
            mySkinLayer.States.Disabled.Index = 2;
            mySkinLayer.States.Enabled.Index = 2;
            mySkinLayer.States.Focused.Index = 0;
            mySkinLayer.States.Hovered.Index = 0;
            mySkinLayer.States.Pressed.Index = 2;
            mySkinLayer.Text = new SkinText(self.Controls["Window.CloseButton"].Layers[0].Text);

            var mySkinControl = new SkinControl();
            mySkinControl.Inherits = "Button";
            mySkinControl.ResizerSize = 4;
            mySkinControl.DefaultSize = new Size(28, 28);
            mySkinControl.Name = "Window.MaximizeButton";
            mySkinControl.Layers.Add(mySkinLayer);
            self.Controls.Add(mySkinControl);
        }
    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;
    }
        /// <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);
        }
예제 #23
0
 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);
     }
 }
예제 #24
0
        /// <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);
        }
    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 attachmentParameters = null;
        for (int i = 0; i < sprites.inst.spriteDefinitions.Length; ++i) {
            tk2dSpriteDefinition def = sprites.inst.spriteDefinitions[i];
            if (def.name == name) {
                attachmentParameters = def;
                break;
            }
        }

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

        Vector2 minTexCoords = Vector2.one;
        Vector2 maxTexCoords = Vector2.zero;
        for (int i = 0; i < attachmentParameters.uvs.Length; ++i) {
            Vector2 uv = attachmentParameters.uvs[i];
            minTexCoords = Vector2.Min(minTexCoords, uv);
            maxTexCoords = Vector2.Max(maxTexCoords, uv);
        }

        Texture texture = attachmentParameters.material.mainTexture;
        int width = (int)(Mathf.Abs(maxTexCoords.x - minTexCoords.x) * texture.width);
        int height = (int)(Mathf.Abs(maxTexCoords.y - minTexCoords.y) * texture.height);

        bool rotated = (attachmentParameters.flipped == tk2dSpriteDefinition.FlipMode.Tk2d);

        if (rotated) {
            float temp = minTexCoords.x;
            minTexCoords.x = maxTexCoords.x;
            maxTexCoords.x = temp;
        }

        RegionAttachment attachment = new RegionAttachment(name);

        attachment.SetUVs(
            minTexCoords.x,
            maxTexCoords.y,
            maxTexCoords.x,
            minTexCoords.y,
            rotated
        );

        // TODO - Set attachment.RegionOffsetX/Y. What units does attachmentParameters.untrimmedBoundsData use?!
        attachment.RegionWidth = width;
        attachment.RegionHeight = height;
        attachment.RegionOriginalWidth = width;
        attachment.RegionOriginalHeight = height;

        return attachment;
    }
예제 #26
0
파일: Button.cs 프로젝트: jaquadro/MonoGdx
 public Button(Skin skin, string styleName)
     : base(skin)
 {
     Initialize();
     Style = skin.Get<ButtonStyle>(styleName);
     Width = PrefWidth;
     Height = PrefHeight;
 }
예제 #27
0
 // Use this for initialization
 void Start()
 {
     skins = new Skin [4];
     skins [0] = new Skin ("Huguinho", "character1");
     skins [1] = new Skin ("Zezinho", "character2");
     skins [2] = new Skin ("Luizinho", "character3");
     skins [3] = new Skin ("Pateta", "character4");
 }
예제 #28
0
 public void SkinConstructorTest()
 {
     string name = string.Empty; 
     string description = string.Empty; 
     bool useFrames = false; 
     var target = new Skin(name, description, useFrames);
     Assert.AreEqual(name, target.Name);
 }
예제 #29
0
 /// <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);
     if (AutoSizeToContents)
     {
         DoSizeToContents();
     }
 }
예제 #30
0
        /// <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)
        {
            if (null == Parent)
                return;

            //Move to our current position to force clamping - is this a hack?
            MoveTo(X, Y);
        }
예제 #31
0
 internal Section(Skin host, string name)
 {
     this.host = host;
     Name      = name;
 }
예제 #32
0
        public object GetItem(uint TypeID)
        {
            switch (GetItemGroup(TypeID))
            {
            case IFFGROUP.ITEM_TYPE_CHARACTER:
            {
                return(Character.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_HAIR_STYLE:
            {
                return(HairStyle.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_PART:
            {
                return(Part.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CLUB:
            {
                return(Club.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_BALL:
            {
                return(Ball.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_USE:
            {
                return(Items.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CADDIE:
            {
                return(Caddie.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CADDIE_ITEM:
            {
                return(CaddieItem.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_SETITEM:
            {
                return(SetItem.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_SKIN:
            {
                return(Skin.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_MASCOT:
            {
                return(Mascot.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CARD:
            {
                return(Card.GetItem(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_AUX:
            {
                return(AuxPart.GetItem(TypeID));
            }

            default:
            {
                Console.WriteLine($"ItemGroup_Un -> {GetItemGroup(TypeID)}");
            }
            break;
            }
            throw new NotImplementedException();
        }
    void OnEnable()
    {
        mode            = this.serializedObject.FindProperty("mode");
        boneName        = this.serializedObject.FindProperty("boneName");
        zPosition       = this.serializedObject.FindProperty("zPosition");
        position        = this.serializedObject.FindProperty("position");
        rotation        = this.serializedObject.FindProperty("rotation");
        scale           = this.serializedObject.FindProperty("scale");
        overrideAlpha   = this.serializedObject.FindProperty("overrideAlpha");
        parentReference = this.serializedObject.FindProperty("parentReference");
        flip            = this.serializedObject.FindProperty("flip");
        flipX           = this.serializedObject.FindProperty("flipX");

        EvaluateFlags();

        if (utilityBone.valid == false && skeletonUtility != null && skeletonUtility.skeletonRenderer != null)
        {
            skeletonUtility.skeletonRenderer.Reset();
        }

        canCreateHingeChain = CanCreateHingeChain();

        boundingBoxTable.Clear();

        if (multiObject)
        {
            return;
        }

        if (utilityBone.bone == null)
        {
            return;
        }

        var  skeleton  = utilityBone.bone.Skeleton;
        int  slotCount = skeleton.Slots.Count;
        Skin skin      = skeleton.Skin;

        if (skeleton.Skin == null)
        {
            skin = skeleton.Data.DefaultSkin;
        }

        currentSkinName = skin.Name;
        for (int i = 0; i < slotCount; i++)
        {
            Slot slot = skeletonUtility.skeletonRenderer.skeleton.Slots[i];
            if (slot.Bone == utilityBone.bone)
            {
                List <Attachment> attachments = new List <Attachment>();


                skin.FindAttachmentsForSlot(skeleton.FindSlotIndex(slot.Data.Name), attachments);

                List <BoundingBoxAttachment> boundingBoxes = new List <BoundingBoxAttachment>();
                foreach (var att in attachments)
                {
                    if (att is BoundingBoxAttachment)
                    {
                        boundingBoxes.Add((BoundingBoxAttachment)att);
                    }
                }

                if (boundingBoxes.Count > 0)
                {
                    boundingBoxTable.Add(slot, boundingBoxes);
                }
            }
        }
    }
예제 #34
0
 public static Color BaseColor(Skin skin)
 {
     return(skin == Skin.Dark ? DarkBaseColor : LightBaseColor);
 }
예제 #35
0
// Menu

        private static void OnLoadingComplete(EventArgs args)
        {
            if (!_Player.ChampionName.Contains("Ashe"))
            {
                return;
            }
            Chat.Print("Doctor's Ashe Loaded!", Color.Orange);
            Q = new Spell.Active(SpellSlot.Q, 600);
            W = new Spell.Skillshot(SpellSlot.W, 1200, SkillShotType.Linear, 0, int.MaxValue, 60);
            W.AllowedCollisionCount = 0;
            E = new Spell.Skillshot(SpellSlot.E, 10000, SkillShotType.Linear);
            E.AllowedCollisionCount = int.MaxValue;
            R = new Spell.Skillshot(SpellSlot.R, 3000, SkillShotType.Linear, 250, 1600, 100);
            R.AllowedCollisionCount = -1;
            Botrk = new Item(ItemId.Blade_of_the_Ruined_King);
            Bil   = new Item(3144, 475f);
            Thm   = new Font(Drawing.Direct3DDevice, new FontDescription {
                FaceName = "Tahoma", Height = 32, Weight = FontWeight.Bold, OutputPrecision = FontPrecision.Default, Quality = FontQuality.ClearType
            });
            Menu = MainMenu.AddMenu("Doctor's Ashe", "Ashe");
            Menu.AddGroupLabel("Mercedes7");
            ComboMenu = Menu.AddSubMenu("Combo Settings", "Combo");
            ComboMenu.AddGroupLabel("Combo Settings");
            ComboMenu.Add("ComboQ", new CheckBox("Use [Q] Reset AA"));
            ComboMenu.Add("ComboW", new CheckBox("Use [W] Combo"));
            ComboMenu.Add("ComboMode", new ComboBox("W Mode:", 1, "Fast [W]", "[W] Reset AA"));
            ComboMenu.Add("ComboR", new CheckBox("Use [R] Combo"));
            ComboMenu.Add("KeepCombo", new CheckBox("Keep Mana For [R]", false));
            ComboMenu.AddGroupLabel("Ultimate Aoe Settings");
            ComboMenu.Add("RAoe", new CheckBox("Use [R] Aoe"));
            ComboMenu.Add("minRAoe", new Slider("Use [R] Aoe If Hit x Enemies", 2, 1, 5));
            ComboMenu.AddGroupLabel("Ultimate Selected Target Settings");
            ComboMenu.Add("ComboSL", new KeyBind("Use [R] On Selected Target", false, KeyBind.BindTypes.HoldActive, 'Y'));
            ComboMenu.AddGroupLabel("KillSteal Settings");
            ComboMenu.Add("RKs", new CheckBox("Use [R] KillSteal"));
            ComboMenu.Add("WKs", new CheckBox("Use [W] KillSteal"));
            ComboMenu.Add("RKb", new KeyBind("Semi Manual [R] KillSteal", false, KeyBind.BindTypes.HoldActive, 'T'));

            HarassMenu = Menu.AddSubMenu("Harass Settings", "Harass");
            HarassMenu.AddGroupLabel("Harass Settings");
            HarassMenu.Add("HarassQ", new CheckBox("Use [Q] Harass"));
            HarassMenu.Add("HarassW", new CheckBox("Use [W] Harass"));
            HarassMenu.Add("KeepHarass", new CheckBox("Keep Mana For [R]", false));
            HarassMenu.Add("manaHarass", new Slider("Mana Harass", 50, 0, 100));

            LaneClearMenu = Menu.AddSubMenu("Laneclear Settings", "Clear");
            LaneClearMenu.AddGroupLabel("Laneclear Settings");
            LaneClearMenu.Add("ClearQ", new CheckBox("Use [Q] Laneclear", false));
            LaneClearMenu.Add("ClearW", new CheckBox("Use [W] Laneclear", false));
            LaneClearMenu.Add("minw", new Slider("Number Hit Minions Use [W]", 2, 1, 6));
            LaneClearMenu.Add("manaFarm", new Slider("Mana LaneClear", 60, 0, 100));

            JungleClearMenu = Menu.AddSubMenu("JungleClear Settings", "JungleClear");
            JungleClearMenu.AddGroupLabel("JungleClear Settings");
            JungleClearMenu.Add("jungleQ", new CheckBox("Use [Q] JungleClear"));
            JungleClearMenu.Add("jungleW", new CheckBox("Use [W] JungleClear"));
            JungleClearMenu.Add("manaJung", new Slider("Mana JungleClear", 20, 0, 100));

            Items = Menu.AddSubMenu("Items Settings", "Items");
            Items.AddGroupLabel("Items Settings");
            Items.Add("BOTRK", new CheckBox("Use [Botrk]"));
            Items.Add("ihp", new Slider("My HP Use BOTRK <=", 50));
            Items.Add("ihpp", new Slider("Enemy HP Use BOTRK <=", 50));

            Misc = Menu.AddSubMenu("Misc Settings", "Draw");
            Misc.AddGroupLabel("Anti Gapcloser");
            Misc.Add("antiGap", new CheckBox("Anti Gapcloser", false));
            Misc.Add("antiRengar", new CheckBox("Anti Rengar KhaZix", false));
            Misc.Add("inter", new CheckBox("Use [R] Interupt"));
            Misc.AddGroupLabel("Drawings Settings");
            Misc.Add("Draw_Disabled", new CheckBox("Disabled Drawings", false));
            Misc.Add("DrawW", new CheckBox("Draw [W]", false));
            Misc.Add("Notifications", new CheckBox("Alerter Can Kill With [R]"));

            Skin = Menu.AddSubMenu("Skin Changer", "SkinChanger");
            Skin.Add("checkSkin", new CheckBox("Use Skin Changer", false));
            Skin.Add("skin.Id", new ComboBox("Skin Mode", 6, "1", "2", "3", "4", "5", "6", "7", "8", "9"));

            Game.OnUpdate                    += Game_OnUpdate;
            Drawing.OnDraw                   += Drawing_OnDraw;
            Gapcloser.OnGapcloser            += Gapcloser_OnGapCloser;
            Interrupter.OnInterruptableSpell += Interupt;
            Orbwalker.OnPostAttack           += ResetAttack;
            GameObject.OnCreate              += GameObject_OnCreate;
        }
예제 #36
0
        void OnGUI()
        {
            try
            {
                selectedTab = GUILayout.Toolbar(selectedTab, toolbarLabels);
                switch (selectedTab)
                {
                case 0:
                    if (m_DevLogEntries != null && m_ScreenCaptures != null)     // We are correctly configured
                    {
                        entryScrollPosition         = EditorGUILayout.BeginScrollView(entryScrollPosition);
                        m_MediaPanel.ScreenCaptures = m_ScreenCaptures;
                        m_EntryPanel.entries        = m_DevLogEntries;
                        m_EntryPanel.OnGUI();

                        Skin.StartSection("Posting", false);

                        m_EntryPanel.DevLogPostingGUI();

                        bool canPostToAll;
                        if (!string.IsNullOrEmpty(m_EntryPanel.shortText))
                        {
                            canPostToAll  = DiscordPostingGUI();
                            canPostToAll &= TwitterPostingGUI();

                            if (canPostToAll)
                            {
                                if (GUILayout.Button("Post to All"))
                                {
                                    DevLogEntry entry = PostToDevLogAndTwitter();
                                    Discord.PostEntry(entry);
                                }
                            }
                        }
                        Skin.EndSection();

                        EditorGUILayout.Space();

                        m_MediaPanel.CaptureCamera  = m_CaptureCamera;
                        m_MediaPanel.ScreenCaptures = m_ScreenCaptures;
                        m_MediaPanel.OnGUI();
                        EditorGUILayout.EndScrollView();
                    }
                    else
                    {
                        SettingsTabUI();
                    }
                    break;

                case 1:
                    if (m_DevLogPanel == null)
                    {
                        m_DevLogPanel = new DevLogPanel(m_DevLogEntries);
                    }

                    m_DevLogPanel.ScreenCaptures = m_ScreenCaptures;
                    m_DevLogPanel.entries        = m_DevLogEntries;
                    m_DevLogPanel.OnGUI();
                    break;

                case 2:
                    m_SchedulingPanel.OnGUI();
                    break;

                case 3:
                    m_GitPanel.OnGUI();
                    break;

                case 4:
                    SettingsTabUI();
                    break;
                }
            } catch (InvalidCastException e)
            {
                //TODO Don't silently catch errors
                // this is a workaround. An exception is thrown when a new scene is loaded.
                Repaint();
            }
        }
예제 #37
0
        void OnGUI()
        {
            Tooltip = null;

            // Make the box texture opaque
            if (boxTexture == null)
            {
                if (EditorGUIUtility.isProSkin)
                {
                    // Make a copy of the old texture
                    var oldTex = GUI.skin.box.normal.background;
                    var tmp    = RenderTexture.GetTemporary(oldTex.width, oldTex.height);

                    Graphics.Blit(oldTex, tmp);
                    RenderTexture previous = RenderTexture.active;
                    RenderTexture.active = tmp;
                    boxTexture           = new Texture2D(oldTex.width, oldTex.height);
                    boxTexture.ReadPixels(new Rect(0, 0, tmp.width, tmp.height), 0, 0);
                    RenderTexture.active = previous;
                    RenderTexture.ReleaseTemporary(tmp);

                    // Remove alpha
                    var colors = boxTexture.GetPixels();
                    for (int i = 0; i < colors.Length; ++i)
                    {
                        // Pro background color is RGB(64, 64, 64)
                        colors[i].r = 0.2196f + (colors[i].r * colors[i].a);
                        colors[i].g = 0.2196f + (colors[i].g * colors[i].a);
                        colors[i].b = 0.2196f + (colors[i].b * colors[i].a);
                        colors[i].a = 1;
                    }

                    boxTexture.SetPixels(colors);
                    boxTexture.Apply();
                }
                else
                {
                    boxTexture = GUI.skin.box.normal.background;
                }
            }
            if (flatTexture == null)
            {
                flatTexture            = new Texture2D(1, 1);
                flatTexture.filterMode = FilterMode.Point;
                flatTexture.SetPixels(new Color[1] {
                    Color.white
                });
                flatTexture.Apply();
            }

            rectCache = rectCache ?? new Dictionary <Socket, Rect>();
            rectCache.Clear();

            autoRepaintOnSceneChange = true;
            wantsMouseMove           = true;

            Offset = new Vector2(
                Mathf.RoundToInt(Offset.x),
                Mathf.RoundToInt(Offset.y)
                );

            var graphRect = GetGraphRect();

            var mousePos = Event.current.mousePosition;

            GraphPosition = new Vector2(
                mousePos.x - graphRect.xMin - Offset.x,
                -mousePos.y + graphRect.yMin + Offset.y
                );

            // Top Toolbar
            var toolbarHeight = Vector2.up * TOOLBAR_HEIGHT;

            var topToolbarRect = new Rect(position);

            topToolbarRect.position = Vector2.zero;
            topToolbarRect.size    -= new Vector2(10, 0);
            topToolbarRect.height   = toolbarHeight.y;

            XGUI.ResetToStyle(null);
            XGUI.BeginArea(new Rect(0, 0, position.width - 10, TOOLBAR_HEIGHT));
            XGUI.BeginHorizontal();

            var oldGraph = Graph;

            XGUI.ResetToStyle(null);
            XGUI.BeginVertical();
            XGUI.FlexibleSpace();
            Graph = XGUI.ObjectField(Graph, false);
            if (Graph != oldGraph)
            {
                CenterView();
            }
            XGUI.FlexibleSpace();
            XGUI.EndVertical();

            XGUI.FlexibleSpace();

            XGUI.ResetToStyle(GUI.skin.button);
            if (XGUI.Button("Variables"))
            {
                VariablesEditor.Launch(this);
            }

            XGUI.EndHorizontal();
            XGUI.EndArea();

            // Bottom Toolbar
            XGUI.ResetToStyle(null);
            XGUI.BeginArea(new Rect(0, position.size.y - TOOLBAR_HEIGHT, position.width - 10, TOOLBAR_HEIGHT));
            XGUI.BeginHorizontal();

            XGUI.ResetToStyle(GUI.skin.button);
            XGUI.Enabled = Graph != null;
            snap         = XGUI.ToggleButton(snap, "Snap");

            XGUI.ResetToStyle(GUI.skin.button);
            XGUI.Enabled = Graph != null;
            if (XGUI.Button("Center View"))
            {
                CenterView();
            }

            XGUI.FlexibleSpace();

            if (graphRect.Contains(mousePos))
            {
                XGUI.ResetToStyle(GUI.skin.label);
                XGUI.Alignment = TextAnchor.MiddleRight;
                XGUI.Label(
                    string.Format("{0}, {1}", GraphPosition.x, GraphPosition.y),
                    XGUI.ExpandHeight(true));
            }

            XGUI.EndHorizontal();
            XGUI.EndArea();

            // Draw the graph
            {
                XGUI.ResetToStyle(null);
                XGUI.BackgroundColor   = Skin.canvasColor;
                XGUI.Normal.background = flatTexture;
                XGUI.Box(graphRect);

                // Make the clipping window for the graph
                graphRect.position += Vector2.one * GRAPH_PADDING;
                graphRect.size     -= Vector2.one * GRAPH_PADDING * 2;
                XGUI.ResetToStyle(null);
                XGUI.BeginClip(graphRect);

                // Draw the graph
                var gridRect = new Rect(Vector2.zero, graphRect.size);
                DrawGrid(gridRect);
                if (Graph != null && Graph.Nodes != null)
                {
                    // Make a copy since nodes may reorder the list when drawn
                    var nodes = new List <Node>(Graph.Nodes);

                    // Draw nodes
                    foreach (var node in nodes)
                    {
                        NodeEditor.DrawNode(this, node);
                    }

                    // Draw links
                    if (Target is Socket)
                    {
                        var socket = (Socket)Target;

                        if (rectCache.ContainsKey(socket))
                        {
                            DrawConnection(rectCache[socket].center,
                                           Event.current.mousePosition,
                                           socket.IsInput(Graph), true,
                                           Skin.tempLinkColor);
                        }
                    }
                    foreach (var link in Graph.Links)
                    {
                        if (!rectCache.ContainsKey(link.FromSocket) ||
                            !rectCache.ContainsKey(link.ToSocket))
                        {
                            continue;
                        }

                        var from = rectCache[link.FromSocket].center;
                        var to   = rectCache[link.ToSocket].center;

                        var socketType = link.FromSocket.GetSocketType(Graph);
                        var color      = Skin.objectSocketColor;
                        if (socketType == typeof(ExecType))
                        {
                            color = Skin.execSocketColor;
                        }
                        if (socketType.IsPrimitive)
                        {
                            color = Skin.primitiveSocketColor;
                        }

                        if (search.IsOpen)
                        {
                            color = Skin.TintColor(color, Skin.disabledSocketTint);
                        }
                        DrawConnection(from, to, false, false, color);
                    }
                }

                // Draw Tooltip
                if (Tooltip != null)
                {
                    Tooltip.OnGUI();
                }

                // Search box
                search.OnGUI(this);

                GUI.EndClip();
            }

            if (Graph == null)
            {
                CenterViewOn(Vector2.zero);

                var menuRect = new Rect();
                menuRect.size   = new Vector2(300, 200);
                menuRect.center = graphRect.center;
                GUI.Box(menuRect, GUIContent.none);
                GUILayout.BeginArea(menuRect);
                GUILayout.FlexibleSpace();
                GUILayout.BeginHorizontal(GUILayout.Height(150));
                GUILayout.FlexibleSpace();
                GUILayout.BeginVertical(GUILayout.Width(250));

                GUILayout.FlexibleSpace();

                GUILayout.BeginHorizontal();
                var size      = GUI.skin.label.fontSize;
                var alignment = GUI.skin.label.alignment;
                GUI.skin.label.fontSize  = 20;
                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                GUILayout.Label("Leylines");
                GUI.skin.label.fontSize  = size;
                GUI.skin.label.alignment = alignment;
                GUILayout.EndHorizontal();

                GUILayout.FlexibleSpace();

                GUILayout.BeginVertical(GUILayout.Height(130));
                var rich = GUI.skin.label.richText;
                GUI.skin.label.richText  = true;
                GUI.skin.label.alignment = TextAnchor.MiddleCenter;
                GUILayout.Label("<b>No Graph Loaded</b>");
                GUI.skin.label.richText  = rich;
                GUI.skin.label.alignment = alignment;
                GUILayout.EndVertical();

                GUILayout.EndVertical();
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();
                GUILayout.EndArea();
            }

            switch (Event.current.type)
            {
            case EventType.MouseDown:
                Target = this;
                GUI.FocusControl(null);
                Event.current.Use();
                break;

            case EventType.MouseDrag:
                if (Graph == null)
                {
                    break;
                }
                if (ReferenceEquals(Target, this))
                {
                    Offset += Event.current.delta;
                    Event.current.Use();
                }
                break;

            case EventType.MouseUp:
                if (ReferenceEquals(Target, this))
                {
                    Target = null;
                    GUI.FocusControl(null);
                }
                if (Target != null && Target.GetType() == typeof(Socket))
                {
                    var clipPos = Event.current.mousePosition;
                    clipPos.y -= topToolbarRect.size.y + GRAPH_PADDING;
                    var socket = (Socket)Target;
                    if (socket.IsInput(Graph))
                    {
                        search.SetWantedOutputContext(this, socket);
                    }
                    else
                    {
                        search.SetWantedInputContext(this, socket);
                    }
                    search.Open(clipPos, GraphPosition, Graph.Policy, true);
                    Target = search;
                    GUI.FocusControl("search_field");
                    Event.current.Use();
                }
                if (Event.current.button == 1 && Graph != null)
                {
                    if (graphRect.Contains(Event.current.mousePosition))
                    {
                        var clipPos = Event.current.mousePosition;
                        clipPos.y -= topToolbarRect.size.y + GRAPH_PADDING;
                        search.UnsetContext();
                        search.Open(clipPos, GraphPosition, Graph.Policy);
                        Target = search;
                        GUI.FocusControl("search_field");
                        Event.current.Use();
                    }
                }
                break;

            case EventType.DragUpdated:
                if (DragAndDrop.objectReferences.Length == 1)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                }
                else
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                }
                Event.current.Use();
                break;

            case EventType.DragPerform:
                if (DragAndDrop.objectReferences.Length == 1)
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;
                    DragAndDrop.AcceptDrag();

                    var obj  = DragAndDrop.objectReferences[0];
                    var type = obj.GetType();

                    var node   = CreateInstance <DynamicNode>();
                    var socket = new DynamicSocket(type.Name, type, type.Name,
                                                   SocketFlags.AllowMultipleLinks | SocketFlags.Editable);
                    socket.SocketValue = obj;
                    node.DisplayName   = obj.GetType().Name;
                    node.AddOutputSocket(socket);
                    AddNode(node, GraphPosition);
                }
                else
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Rejected;
                }
                Event.current.Use();
                break;
            }

            Repaint();

            if (GUI.changed && Graph != null && !Graph.Equals(null))
            {
                EditorUtility.SetDirty(Graph);
            }
        }
예제 #38
0
    public static SkeletonAnimation SpawnAnimatedSkeleton(SkeletonDataAsset skeletonDataAsset, Skin skin = null)
    {
        GameObject        go   = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(SkeletonAnimation));
        SkeletonAnimation anim = go.GetComponent <SkeletonAnimation>();

        anim.skeletonDataAsset = skeletonDataAsset;

        bool requiresNormals = false;

        foreach (Material m in anim.skeletonDataAsset.atlasAsset.materials)
        {
            if (m.shader.name.Contains("Lit"))
            {
                requiresNormals = true;
                break;
            }
        }

        anim.calculateNormals = requiresNormals;

        if (skin == null)
        {
            skin = skeletonDataAsset.GetSkeletonData(true).DefaultSkin;
        }

        anim.Reset();

        anim.skeleton.SetSkin(skin);
        anim.initialSkinName = skin.Name;

        anim.skeleton.Update(1);
        anim.state.Update(1);
        anim.state.Apply(anim.skeleton);
        anim.skeleton.UpdateWorldTransform();

        return(anim);
    }
예제 #39
0
        public StringSet(Skin skin) : this()
        {
            foreach (var block in skin.Blocks)
            {
                switch (block)
                {
                case ConstraintBlock constraintBlock:
                {
                    AddString(constraintBlock.BoneName);
                    AddString(constraintBlock.SourceBoneName);

                    switch (constraintBlock.Data)
                    {
                    case DirectionConstraintData directionData:
                        AddString(directionData.Field20);
                        break;

                    case PositionConstraintData positionData:
                        AddString(positionData.Field20);
                        break;
                    }

                    break;
                }

                case ExpressionBlock expressionBlock:
                    AddString(expressionBlock.BoneName);
                    break;

                case MotionBlock motionBlock:
                {
                    AddString(motionBlock.Name);
                    foreach (var bone in motionBlock.Bones)
                    {
                        AddString(bone.Name);
                    }

                    break;
                }

                case OsageBlock osageBlock:
                {
                    AddString(osageBlock.ExternalName);

                    foreach (var osageBone in osageBlock.Bones)
                    {
                        AddString(osageBone.Name);
                        AddString(osageBone.SiblingName);
                    }

                    AddString(osageBlock.InternalName);
                    break;
                }
                }
            }

            foreach (var node in skin.Bones.Where(node => node.IsEx))
            {
                AddString(node.Name);
            }

            void AddString(string value)
            {
                if (!string.IsNullOrEmpty(value) && !mStrings.Contains(value))
                {
                    mStrings.Add(value);
                }
            }
        }
    protected override void PopulateMenu(GenericMenu menu, SerializedProperty property, SpineAttachment targetAttribute, SkeletonData data)
    {
        List <Skin>      validSkins       = new List <Skin>();
        SkeletonRenderer skeletonRenderer = null;

        var component = property.serializedObject.targetObject as Component;

        if (component != null)
        {
            if (component.GetComponentInChildren <SkeletonRenderer>() != null)
            {
                skeletonRenderer = component.GetComponentInChildren <SkeletonRenderer>();
                //if (skeletonDataAsset != skeletonRenderer.skeletonDataAsset) Debug.LogWarning("DataField SkeletonDataAsset and SkeletonRenderer/SkeletonAnimation's SkeletonDataAsset do not match. Remove the explicit dataField parameter of your [SpineAttachment] field.");
                skeletonDataAsset = skeletonRenderer.skeletonDataAsset;
            }
        }

        if (skeletonRenderer != null && targetAttribute.currentSkinOnly)
        {
            if (skeletonRenderer.skeleton.Skin != null)
            {
                validSkins.Add(skeletonRenderer.skeleton.Skin);
            }
            else
            {
                validSkins.Add(data.Skins.Items[0]);
            }
        }
        else
        {
            foreach (Skin skin in data.Skins)
            {
                if (skin != null)
                {
                    validSkins.Add(skin);
                }
            }
        }

        List <string> attachmentNames  = new List <string>();
        List <string> placeholderNames = new List <string>();

        string prefix = "";

        if (skeletonRenderer != null && targetAttribute.currentSkinOnly)
        {
            menu.AddDisabledItem(new GUIContent(skeletonRenderer.gameObject.name + " (SkeletonRenderer)"));
        }
        else
        {
            menu.AddDisabledItem(new GUIContent(skeletonDataAsset.name));
        }

        menu.AddSeparator("");

        menu.AddItem(new GUIContent("Null"), property.stringValue == "", HandleSelect, new SpineDrawerValuePair("", property));

        menu.AddSeparator("");

        Skin defaultSkin = data.Skins.Items[0];

        SerializedProperty slotProperty = property.serializedObject.FindProperty(targetAttribute.slotField);
        string             slotMatch    = "";

        if (slotProperty != null)
        {
            if (slotProperty.propertyType == SerializedPropertyType.String)
            {
                slotMatch = slotProperty.stringValue.ToLower();
            }
        }

        foreach (Skin skin in validSkins)
        {
            string skinPrefix = skin.Name + "/";

            if (validSkins.Count > 1)
            {
                prefix = skinPrefix;
            }

            for (int i = 0; i < data.Slots.Count; i++)
            {
                if (slotMatch.Length > 0 && data.Slots.Items[i].Name.ToLower().Contains(slotMatch) == false)
                {
                    continue;
                }

                attachmentNames.Clear();
                placeholderNames.Clear();

                skin.FindNamesForSlot(i, attachmentNames);
                if (skin != defaultSkin)
                {
                    defaultSkin.FindNamesForSlot(i, attachmentNames);
                    skin.FindNamesForSlot(i, placeholderNames);
                }


                for (int a = 0; a < attachmentNames.Count; a++)
                {
                    string attachmentPath = attachmentNames[a];
                    string menuPath       = prefix + data.Slots.Items[i].Name + "/" + attachmentPath;
                    string name           = attachmentNames[a];

                    if (targetAttribute.returnAttachmentPath)
                    {
                        name = skin.Name + "/" + data.Slots.Items[i].Name + "/" + attachmentPath;
                    }

                    if (targetAttribute.placeholdersOnly && placeholderNames.Contains(attachmentPath) == false)
                    {
                        menu.AddDisabledItem(new GUIContent(menuPath));
                    }
                    else
                    {
                        menu.AddItem(new GUIContent(menuPath), name == property.stringValue, HandleSelect, new SpineDrawerValuePair(name, property));
                    }
                }
            }
        }
    }
예제 #41
0
        public bool IsBuyable(uint TypeID)
        {
            switch (GetItemGroup(TypeID))
            {
            case IFFGROUP.ITEM_TYPE_BALL:
            {
                return(Ball.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CLUB:
            {
                return(Club.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CHARACTER:
            {
                return(Character.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_PART:
            {
                return(Part.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_HAIR_STYLE:
            {
                return(HairStyle.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_USE:
            {
                return(Items.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CADDIE:
            {
                return(Caddie.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CADDIE_ITEM:
            {
                return(CaddieItem.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_SETITEM:
            {
                return(SetItem.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_SKIN:
            {
                return(Skin.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_MASCOT:
            {
                return(Mascot.IsBuyable(TypeID));
            }

            case IFFGROUP.ITEM_TYPE_CARD:
            {
                return(Card.IsBuyable(TypeID));
            }
            }
            return(false);
        }
예제 #42
0
 public BoundingBoxAttachment NewBoundingBoxAttachment(Skin skin, string name)
 {
     return(null);
 }
예제 #43
0
 public MeshAttachment NewMeshAttachment(Skin skin, string name, string path)
 {
     return(null);
 }
예제 #44
0
        /// <summary>
        /// Display the settings UI.
        /// </summary>
        public void SettingsTabUI()
        {
            string newPath;

            Skin.StartSection("Capture Storage", false);

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Captures Save Folder");
            string originalPath = Settings.CaptureFileFolderPath;

            Settings.CaptureFileFolderPath = EditorGUILayout.TextField(Settings.CaptureFileFolderPath, GUILayout.Height(40));
            if (GUILayout.Button("Browse"))
            {
                newPath = EditorUtility.OpenFolderPanel("Select a folder in which to save captures", Settings.CaptureFileFolderPath, "");
                if (!string.IsNullOrEmpty(newPath))
                {
                    Settings.CaptureFileFolderPath = newPath;
                }
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("File Organizaton");
            EditorGUILayout.BeginVertical();
            Settings.OrganizeCapturesByProject = EditorGUILayout.ToggleLeft("Organize in Project sub folders (e.g. 'root/Project')", Settings.OrganizeCapturesByProject);
            Settings.OrganizeCapturesByScene   = EditorGUILayout.ToggleLeft("Organize in Scene sub folders (e.g. 'root/Project/Scene')", Settings.OrganizeCapturesByScene);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            Skin.EndSection();


            Skin.StartSection("Camera", false);
            if (!m_CaptureCamera)
            {
                m_CaptureCamera = Camera.main;
            }
            if (!m_CaptureCamera)
            {
                EditorGUILayout.LabelField("No main camera in scene, please tag a camera as MainCamera or select a camera here.");
            }

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Camera for captures");
            m_CaptureCamera = (Camera)EditorGUILayout.ObjectField(m_CaptureCamera, typeof(Camera), true);
            EditorGUILayout.EndHorizontal();
            Skin.EndSection();

            Skin.StartSection("Dev Log Objects", false);
            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Dev Log Storage");
            string existingPath = AssetDatabase.GetAssetPath(m_DevLogEntries);

            m_DevLogEntries = EditorGUILayout.ObjectField(m_DevLogEntries, typeof(DevLogEntries), true) as DevLogEntries;
            if (m_DevLogEntries == null)
            {
                if (GUILayout.Button("Create"))
                {
                    string filename = "Assets/Dev Log " + Application.version + ".asset";
                    m_DevLogEntries = ScriptableObject.CreateInstance <DevLogEntries>();
                    AssetDatabase.CreateAsset(m_DevLogEntries, filename);
                    AssetDatabase.SaveAssets();
                }
            }
            newPath = AssetDatabase.GetAssetPath(m_DevLogEntries);
            if (existingPath != newPath)
            {
                Settings.DevLogScriptableObjectPath = newPath;
            }
            EditorGUILayout.EndHorizontal();

            EditorGUILayout.BeginHorizontal();
            EditorGUILayout.PrefixLabel("Screen Capture Storage");
            existingPath     = AssetDatabase.GetAssetPath(m_ScreenCaptures);
            m_ScreenCaptures = EditorGUILayout.ObjectField(m_ScreenCaptures, typeof(DevLogScreenCaptureCollection), true) as DevLogScreenCaptureCollection;
            if (m_ScreenCaptures == null)
            {
                if (GUILayout.Button("Create"))
                {
                    string filename = "Assets/Screen Captures " + Application.version + ".asset";
                    m_ScreenCaptures = ScriptableObject.CreateInstance <DevLogScreenCaptureCollection>();
                    AssetDatabase.CreateAsset(m_ScreenCaptures, filename);
                    AssetDatabase.SaveAssets();
                    Settings.ScreenCaptureScriptableObjectPath = filename;
                }
            }
            newPath = AssetDatabase.GetAssetPath(m_ScreenCaptures);
            if (existingPath != newPath)
            {
                Settings.ScreenCaptureScriptableObjectPath = newPath;
            }
            EditorGUILayout.EndHorizontal();
            Skin.EndSection();

            m_DiscordPanel.OnSettingsGUI();

            m_TwitterPanel.OnSettingsGUI();

            DevHelpersGUI();

            EditorGUILayout.LabelField("Welcome to " + Application.productName + " v" + Application.version);

            Skin.EndSection();
        }
예제 #45
0
        public RegionAttachment NewRegionAttachment(Skin skin, string name, string path)
        {
            RegionAttachment attachment = new RegionAttachment(name);

            Texture2D   tex        = sprite.texture;
            int         instanceId = tex.GetInstanceID();
            AtlasRegion atlasRegion;
            bool        cachedMaterialExists = atlasTable.TryGetValue(instanceId, out atlasRegion);

            if (!cachedMaterialExists)
            {
                // Setup new material.
                var material = new Material(shader);
                if (sprite.packed)
                {
                    material.name = "Unity Packed Sprite Material";
                }
                else
                {
                    material.name = sprite.name + " Sprite Material";
                }
                material.mainTexture = tex;

                // Create faux-region to play nice with SkeletonRenderer.
                atlasRegion = new AtlasRegion();
                var page = new AtlasPage();
                page.rendererObject = material;
                atlasRegion.page    = page;

                // Cache it.
                atlasTable[instanceId] = atlasRegion;
            }

            Rect texRect = sprite.textureRect;

            // Normalize rect to UV space of packed atlas
            texRect.x      = Mathf.InverseLerp(0, tex.width, texRect.x);
            texRect.y      = Mathf.InverseLerp(0, tex.height, texRect.y);
            texRect.width  = Mathf.InverseLerp(0, tex.width, texRect.width);
            texRect.height = Mathf.InverseLerp(0, tex.height, texRect.height);

            Bounds  bounds = sprite.bounds;
            Vector2 boundsMin = bounds.min, boundsMax = bounds.max;
            Vector2 size                = bounds.size;
            float   spriteUnitsPerPixel = 1f / sprite.pixelsPerUnit;

            bool rotated = false;

            if (sprite.packed)
            {
                rotated = sprite.packingRotation == SpritePackingRotation.Any;
            }

            attachment.SetUVs(texRect.xMin, texRect.yMax, texRect.xMax, texRect.yMin, rotated);
            attachment.RendererObject = atlasRegion;
            attachment.SetColor(Color.white);
            attachment.ScaleX               = 1;
            attachment.ScaleY               = 1;
            attachment.RegionOffsetX        = sprite.rect.width * (0.5f - InverseLerp(boundsMin.x, boundsMax.x, 0)) * spriteUnitsPerPixel;
            attachment.RegionOffsetY        = sprite.rect.height * (0.5f - InverseLerp(boundsMin.y, boundsMax.y, 0)) * spriteUnitsPerPixel;
            attachment.Width                = size.x;
            attachment.Height               = size.y;
            attachment.RegionWidth          = size.x;
            attachment.RegionHeight         = size.y;
            attachment.RegionOriginalWidth  = size.x;
            attachment.RegionOriginalHeight = size.y;
            attachment.UpdateOffset();

            return(attachment);
        }
    public static SkeletonAnimator InstantiateSkeletonAnimator(SkeletonDataAsset skeletonDataAsset, Skin skin = null)
    {
        GameObject go = new GameObject(skeletonDataAsset.name.Replace("_SkeletonData", ""), typeof(MeshFilter), typeof(MeshRenderer), typeof(Animator), typeof(SkeletonAnimator));

        if (skeletonDataAsset.controller == null)
        {
            SkeletonBaker.GenerateMecanimAnimationClips(skeletonDataAsset);
        }

        go.GetComponent <Animator>().runtimeAnimatorController = skeletonDataAsset.controller;

        SkeletonAnimator anim = go.GetComponent <SkeletonAnimator>();

        anim.skeletonDataAsset = skeletonDataAsset;

        bool requiresNormals = false;

        foreach (AtlasAsset atlasAsset in anim.skeletonDataAsset.atlasAssets)
        {
            foreach (Material m in atlasAsset.materials)
            {
                if (m.shader.name.Contains("Lit"))
                {
                    requiresNormals = true;
                    break;
                }
            }
        }

        anim.calculateNormals = requiresNormals;

        SkeletonData data = skeletonDataAsset.GetSkeletonData(true);

        if (data == null)
        {
            for (int i = 0; i < skeletonDataAsset.atlasAssets.Length; i++)
            {
                string reloadAtlasPath = AssetDatabase.GetAssetPath(skeletonDataAsset.atlasAssets[i]);
                skeletonDataAsset.atlasAssets[i] = (AtlasAsset)AssetDatabase.LoadAssetAtPath(reloadAtlasPath, typeof(AtlasAsset));
            }

            data = skeletonDataAsset.GetSkeletonData(true);
        }

        if (skin == null)
        {
            skin = data.DefaultSkin;
        }

        if (skin == null)
        {
            skin = data.Skins.Items[0];
        }

        anim.Reset();

        anim.skeleton.SetSkin(skin);
        anim.initialSkinName = skin.Name;

        anim.skeleton.Update(1);
        anim.skeleton.UpdateWorldTransform();
        anim.LateUpdate();

        return(anim);
    }
예제 #47
0
 public static DColor BaseDColor(Skin skin)
 {
     return(skin == Skin.Dark ? kDarkBaseDColor : kLightBaseDColor);
 }
 public RegionAttachment NewRegionAttachment(Skin skin, string name, string path)
 {
     requirementList.Add(path);
     return(new RegionAttachment(name));
 }
예제 #49
0
        public void LoadOptions(GenericReader reader)
        {
            int version = reader.ReadInt();

            if (version >= 3)
            {
                c_MultiC = reader.ReadInt();
            }
            if (version >= 2)
            {
                c_Karma = reader.ReadInt();
            }

            c_ReadReceipt = reader.ReadBool();
            c_QuickBar    = reader.ReadBool();
            c_ExtraPm     = reader.ReadBool();
            c_Status      = (OnlineStatus)reader.ReadInt();

            Mobile m;
            int    count = reader.ReadInt();

            for (int i = 0; i < count; ++i)
            {
                m = reader.ReadMobile();
                if (m != null)
                {
                    c_Sounds[m] = reader.ReadInt();
                }
                else
                {
                    reader.ReadInt();
                }
            }

            c_GlobalMC     = reader.ReadInt();
            c_GlobalCC     = reader.ReadInt();
            c_GlobalGC     = reader.ReadInt();
            c_GlobalFC     = reader.ReadInt();
            c_GlobalWC     = reader.ReadInt();
            c_SystemC      = reader.ReadInt();
            c_MsgC         = reader.ReadInt();
            c_PerPage      = reader.ReadInt();
            c_DefaultSound = reader.ReadInt();
            c_StaffC       = reader.ReadInt();
            c_Avatar       = reader.ReadInt();
            c_MenuSkin     = (Skin)reader.ReadInt();
            c_GlobalAccess = reader.ReadBool();
            c_Global       = reader.ReadBool();
            c_GlobalM      = reader.ReadBool();
            c_GlobalC      = reader.ReadBool();
            c_GlobalG      = reader.ReadBool();
            c_GlobalF      = reader.ReadBool();
            c_GlobalW      = reader.ReadBool();
            c_Banned       = reader.ReadBool();
            c_FriendsOnly  = reader.ReadBool();
            c_MsgSound     = reader.ReadBool();
            c_ByRequest    = reader.ReadBool();
            c_FriendAlert  = reader.ReadBool();
            c_SevenDays    = reader.ReadBool();
            c_WhenFull     = reader.ReadBool();
            c_IrcRaw       = reader.ReadBool();
            c_AwayMsg      = reader.ReadString();
            c_Signature    = reader.ReadString();
            c_BannedUntil  = reader.ReadDateTime();

            if (c_BannedUntil > DateTime.Now)
            {
                Ban(c_BannedUntil - DateTime.Now);
            }
            else
            {
                RemoveBan();
            }
        }
 public SkinnedMeshAttachment NewSkinnedMeshAttachment(Skin skin, string name, string path)
 {
     requirementList.Add(path);
     return(new SkinnedMeshAttachment(name));
 }
예제 #51
0
        protected void LoadSkins()
        {
            List <string> skinNames = new List <string>();

            Guid?nullable = Skinning.StarterKitGuid(Node.GetCurrent().template);

            if (nullable.HasValue)
            {
                InstalledPackage p = InstalledPackage.GetByGuid(nullable.Value.ToString());
                if (p.Data.SkinRepoGuid != null && p.Data.SkinRepoGuid != Guid.Empty && p.Data.SkinRepoGuid.ToString() != repoGuid)
                {
                    this.repo = cms.businesslogic.packager.repositories.Repository.getByGuid(p.Data.SkinRepoGuid.ToString());
                }
            }

            if (!(nullable.HasValue && Skinning.HasAvailableSkins(Node.GetCurrent().template)))
            {
                this.pChangeSkin.Visible = false;
            }
            else if (this.repo.HasConnection())
            {
                try
                {
                    var skins = this.repo.Webservice.Skins(nullable.ToString());
                    this.rep_starterKitDesigns.DataSource = skins;
                    this.rep_starterKitDesigns.DataBind();

                    foreach (var s in skins)
                    {
                        if (!skinNames.Contains(s.Text))
                        {
                            skinNames.Add(s.Text);
                        }
                    }
                }
                catch (Exception exception)
                {
                    LogHelper.Error <SkinCustomizer>("An error occurred", exception);
                }
            }
            else
            {
                this.ShowConnectionError();
            }

            //check for local skins

            List <string> localSkins = new List <string>();
            DirectoryInfo dirInfo    = new DirectoryInfo(IOHelper.MapPath(SystemDirectories.Masterpages));

            foreach (DirectoryInfo subDur in dirInfo.GetDirectories())
            {
                var skinFile = subDur.GetFiles("skin.xml");

                if (skinFile.Length > 0)
                {
                    string c = Skin.GetSkinNameFromFile(skinFile[0].FullName);

                    if (!skinNames.Contains(c))
                    {
                        localSkins.Add(c);
                    }
                }
            }

            if (localSkins.Count > 0)
            {
                rep_starterKitDesignsLocal.DataSource = localSkins;
                rep_starterKitDesignsLocal.DataBind();
            }
            else
            {
                localSkinsContainer.Visible = false;
            }
        }
예제 #52
0
        protected override void OnLoad(IRenderArgs args)
        {
            Skin skin = _playerProfileService?.CurrentProfile?.Skin;

            if (skin == null)
            {
                Alex.Resources.ResourcePack.TryGetBitmap("entity/alex", out var rawTexture);
                skin = new Skin()
                {
                    Slim    = true,
                    Texture = TextureUtils.BitmapToTexture2D(Alex.GraphicsDevice, rawTexture)
                };
            }

            var entity = new PlayerMob("", null, null, skin.Texture);

            entity.Inventory.IsPeInventory = true;
            entity.ShowItemInHand          = true;

            AddChild(_playerView =
                         new GuiEntityModelView(
                             entity /*new PlayerMob("", null, null, skin.Texture, skin.Slim)*/)                    /*"geometry.humanoid.customSlim"*/
            {
                BackgroundOverlay = new Color(Color.Black, 0.15f),

                Margin = new Thickness(15, 15, 5, 40),

                Width  = 92,
                Height = 128,

                Anchor = Alignment.BottomRight,
            });

            AddChild(new GuiButton("Change Skin", ChangeSKinBtnPressed)
            {
                Anchor         = Alignment.BottomRight,
                Modern         = false,
                TranslationKey = "",
                Margin         = new Thickness(15, 15, 6, 15),
                Width          = 90,
                //Enabled = false
            });

            AutoResetEvent reset = new AutoResetEvent(false);

            Alex.UIThreadQueue.Enqueue(() =>
            {
                using (MemoryStream ms =
                           new MemoryStream(ResourceManager.ReadResource("Alex.Resources.GradientBlur.png")))
                {
                    BackgroundOverlay = (TextureSlice2D)GpuResourceManager.GetTexture2D(this, args.GraphicsDevice, ms);
                }

                BackgroundOverlay.RepeatMode = TextureRepeatMode.Stretch;
                reset.Set();
            });
            reset.WaitOne();
            reset.Dispose();

            BackgroundOverlay.Mask = new Color(Color.White, 0.5f);

            _splashText.Text    = SplashTexts.GetSplashText();
            Alex.IsMouseVisible = true;

            Alex.GameStateManager.AddState("serverlist", new MultiplayerServerSelectionState(_backgroundSkyBox));
            //Alex.GameStateManager.AddState("profileSelection", new ProfileSelectionState(_backgroundSkyBox));
        }
        public HeroWithUnlockables(BinaryReader br, MajorVersion gameMajorVersion)
        {
            this.skin       = br.ReadSkin32();
            this.weaponSkin = br.ReadWeaponSkin32();

            this.highlightIntro = br.ReadHighlightIntro32();

            int numSprays = br.ReadInt32();

            this.sprays = br.ReadSpray32s(numSprays);

            int numVoiceLines = br.ReadInt32();

            this.voiceLines = br.ReadVoiceLine32s(numVoiceLines);

            int numEmotes = br.ReadInt32();

            this.emotes = br.ReadEmote32s(numEmotes);

            // might be to do with team affiliation? seems to be either 0 or 1 depending on team - not sure about -1??
            if (gameMajorVersion >= new MajorVersion(1, 17, VersionBranch.None))
            {
                this.unknownInV17 = br.ReadInt32();
                Debug.Assert(unknownInV17 == -1 || unknownInV17 == 0 || unknownInV17 == 1 || unknownInV17 == 4);
            }

            this.hero = br.ReadHero64();

            // AI players in custom matches have no HighlightIntro, no unlocks, and always use classic skins
            // Bots in the Junkenstein/Uprising modes sometimes use non-classic skins.
            if (highlightIntro == HighlightIntro.None)
            {
                Debug.Assert(this.sprays.Length == 0);
                Debug.Assert(this.voiceLines.Length == 0);
                Debug.Assert(this.emotes.Length == 0);
                Debug.Assert(
                    ($"{skin}" == $"{hero}_Classic") ||
                    (hero == Hero.Junkrat && skin == Skin.Junkrat_DrJunkenstein) ||
                    (hero == Hero.Mercy && skin == Skin.Mercy_Witch) ||
                    (hero == Hero.Reaper && skin == Skin.Reaper_Dracula) ||
                    (hero == Hero.Roadhog && skin == Skin.Roadhog_JunkensteinsMonster) ||
                    (hero == Hero.Orisa && skin == Skin.Orisa_NullSector) ||
                    (hero == Hero.UprisingEvent_00000173 && skin == Skin.UprisingEvent_00000173_Classic) ||
                    (hero == Hero.UprisingEvent_00000178 && skin == Skin.UprisingEvent_00000178_Classic) ||
                    (hero == Hero.UprisingEvent_00000179 && skin == Skin.UprisingEvent_00000179_Classic) ||
                    (hero == Hero.RetributionEvent_000001AC && skin == Skin.RetributionEvent_000001AC_Classic) ||
                    (hero == Hero.RetributionEvent_000001B8 && skin == Skin.RetributionEvent_000001B8_Classic) ||
                    (hero == Hero.RetributionEvent_000001BA && skin == Skin.RetributionEvent_000001BA_Classic) ||
                    (hero == Hero.RetributionEvent_000001BB && skin == Skin.RetributionEvent_000001BB_Classic) ||
                    (hero == Hero.RetributionEvent_000001CE && skin == Skin.RetributionEvent_000001CE_Classic)
                    );
                Debug.Assert(
                    ($"{weaponSkin}" == $"{hero}_Classic") ||
                    (hero == Hero.Junkrat && weaponSkin == WeaponSkin.Junkrat_DrJunkenstein) ||
                    (hero == Hero.Mercy && weaponSkin == WeaponSkin.Mercy_Witch) ||
                    (hero == Hero.Reaper && weaponSkin == WeaponSkin.Reaper_Dracula) ||
                    (hero == Hero.Roadhog && weaponSkin == WeaponSkin.Roadhog_JunkensteinsMonster) ||
                    (hero == Hero.Orisa && weaponSkin == WeaponSkin.Orisa_NullSector) ||
                    (hero == Hero.UprisingEvent_00000173 && weaponSkin == WeaponSkin.UprisingEvent_00000173_Classic) ||
                    (hero == Hero.UprisingEvent_00000178 && weaponSkin == WeaponSkin.UprisingEvent_00000178_Classic) ||
                    (hero == Hero.UprisingEvent_00000179 && weaponSkin == WeaponSkin.UprisingEvent_00000179_Classic) ||
                    (hero == Hero.RetributionEvent_000001AC && weaponSkin == WeaponSkin.RetributionEvent_000001AC_Classic) ||
                    (hero == Hero.RetributionEvent_000001B8 && weaponSkin == WeaponSkin.RetributionEvent_000001B8_Classic) ||
                    (hero == Hero.RetributionEvent_000001BA && weaponSkin == WeaponSkin.RetributionEvent_000001BA_Classic) ||
                    (hero == Hero.RetributionEvent_000001BB && weaponSkin == WeaponSkin.RetributionEvent_000001BB_Classic) ||
                    (hero == Hero.RetributionEvent_000001CE && weaponSkin == WeaponSkin.RetributionEvent_000001CE_Classic)
                    );
            }

            // Ensure that unlocks are correctly mapped to heroes
            UnlockValidator.RunForHeroWithUnlocks(hero, skin, weaponSkin, highlightIntro, sprays, emotes, voiceLines);
        }
예제 #54
0
 public SkinEventArgs(Skin skin)
 {
     _Skin = skin;
 }
예제 #55
0
    bool CheckTextureInSkin()
    {
        Texture2D textureInSkin = null;
        Skin      customSkin    = SkinManager.Instance.currentSkin;

        Note note = nCon.note;

        Note.NoteType    noteType    = NoteVisualsManager.GetVisualNoteType(note);
        Note.SpecialType specialType = NoteVisualsManager.IsStarpower(note);

        int arrayPos = GetSpriteArrayPos(note);

        if (Globals.ghLiveMode)
        {
            if (noteType == Note.NoteType.Strum)
            {
                if (specialType == Note.SpecialType.StarPower)
                {
                    textureInSkin = customSkin.sp_strum_ghl[arrayPos];
                }
                else
                {
                    textureInSkin = customSkin.reg_strum_ghl[arrayPos];
                }
            }
            else if (noteType == Note.NoteType.Hopo)
            {
                if (specialType == Note.SpecialType.StarPower)
                {
                    textureInSkin = customSkin.sp_hopo_ghl[arrayPos];
                }
                else
                {
                    textureInSkin = customSkin.reg_hopo_ghl[arrayPos];
                }
            }
            // Tap notes
            else
            {
                if (!note.IsOpenNote())
                {
                    if (specialType == Note.SpecialType.StarPower)
                    {
                        textureInSkin = customSkin.sp_tap_ghl[arrayPos];
                    }
                    else
                    {
                        textureInSkin = customSkin.reg_tap_ghl[arrayPos];
                    }
                }
            }
        }
        else
        {
            if (noteType == Note.NoteType.Strum)
            {
                if (specialType == Note.SpecialType.StarPower)
                {
                    textureInSkin = customSkin.sp_strum[arrayPos];
                }
                else
                {
                    textureInSkin = customSkin.reg_strum[arrayPos];
                }
            }
            else if (noteType == Note.NoteType.Hopo)
            {
                if (specialType == Note.SpecialType.StarPower)
                {
                    textureInSkin = customSkin.sp_hopo[arrayPos];
                }
                else
                {
                    textureInSkin = customSkin.reg_hopo[arrayPos];
                }
            }
            // Tap notes
            else if (noteType == Note.NoteType.Tap)
            {
                if (note.guitarFret != Note.GuitarFret.Open)
                {
                    if (specialType == Note.SpecialType.StarPower)
                    {
                        textureInSkin = customSkin.sp_tap[arrayPos];
                    }
                    else
                    {
                        textureInSkin = customSkin.reg_tap[arrayPos];
                    }
                }
            }
            else if (noteType == Note.NoteType.Cymbal)
            {
                if (specialType == Note.SpecialType.StarPower)
                {
                    textureInSkin = customSkin.sp_cymbal[arrayPos];
                }
                else
                {
                    textureInSkin = customSkin.reg_cymbal[arrayPos];
                }
            }
        }

        return(textureInSkin);
    }
	public BoundingBoxAttachment NewBoundingBoxAttachment (Skin skin, String name) {
		return new BoundingBoxAttachment(name);
	}
예제 #57
0
 public PathAttachment NewPathAttachment(Skin skin, string name)
 {
     return(null);
 }
예제 #58
0
 public static void addSkin(Skin skin)
 {
     skins.Add(skin);
 }
예제 #59
0
        public OperationDetails UpdateSkin(SkinDTO item)
        {
            if (item == null)
            {
                return(new OperationDetails(false, "ОбЪект ссылается на null", this.ToString()));
            }
            Skin _oldSkin = Database.Skins.Get(item.Id);

            if (_oldSkin == null)
            {
                return(new OperationDetails(false, "Не удалось найти объект", this.ToString()));
            }
            if (_oldSkin.Game.Name != item.Game.Name)
            {
                Game _game = Database.Games.Find(x => x.Name == item.Game.Name)?.FirstOrDefault();
                if (_game == null)
                {
                    return(new OperationDetails(false, "Не удалось найти игру с таким названием", this.ToString()));
                }
                _oldSkin.Game = _game;
            }
            if (_oldSkin.SkinRarity.RarityName != _oldSkin.SkinRarity.RarityName)
            {
                SkinRarity _skinRarity = Database.SkinRareties.Find(x => x.RarityName == item.SkinRarity.RarityName)?.FirstOrDefault();
                if (_skinRarity == null)
                {
                    _skinRarity = new SkinRarity {
                        RarityName = item.SkinRarity.RarityName
                    };
                }
                _oldSkin.SkinRarity = _skinRarity;
            }
            if (_oldSkin.SkinType.TypeName != item.SkinType.TypeName)
            {
                SkinType _skinType = Database.SkinTypes.Find(x => x.TypeName == item.SkinType.TypeName)?.FirstOrDefault();
                if (_skinType == null)
                {
                    _skinType = new SkinType {
                        TypeName = item.SkinType.TypeName
                    };
                }
                _oldSkin.SkinType = _skinType;
            }
            foreach (var i in item.Images)
            {
                if (i != null && i.Photo != _oldSkin.Images.FirstOrDefault().Photo)
                {
                    Image image = Database.Images.Find(x => x.Photo == i.Photo)?.FirstOrDefault();
                    if (image == null)
                    {
                        image = new Image()
                        {
                            Photo = i.Photo, Text = i.Text
                        };
                    }
                    _oldSkin.Images.Add(image);
                }
            }
            _oldSkin.Name  = item.Name;
            _oldSkin.Price = item.Price;
            _oldSkin.Sale  = item.Sale;

            Database.Skins.Update(_oldSkin);
            Database.Save();
            return(new OperationDetails(true, "Скин успешно изменён", this.ToString()));
        }
예제 #60
0
 public SkinnedBackground(Skin skin, string fallbackTextureName)
     : base(fallbackTextureName)
 {
     this.skin = skin;
 }