Пример #1
1
        public LogoElement(InterfaceElement parent, Vector2 location)
            : base(parent, location)
        {
            Opacity = 1f;

            Size = Program.Logo.Size;
        }
Пример #2
0
        public LogoElement(InterfaceElement parent, Vector2 location)
            : base(parent, location)
        {
            Opacity = 1f;

            Size = Program.Logo.Size;
        }
Пример #3
0
        public MenuElement(InterfaceElement parent, Vector2 location, BitmapFont font)
            : base(parent, location)
        {
            Opacity = 1f;

            this.Font = font;
            Location  = new Vector2(0f, Location.Y);
            Size      = new Vector2(Parent.Size.X, 0f);
        }
Пример #4
0
        public MenuElement(InterfaceElement parent, Vector2 location, BitmapFont font)
            : base(parent, location)
        {
            Opacity = 1f;

            this.Font = font;
            Location = new Vector2(0f, Location.Y);
            Size = new Vector2(Parent.Size.X, 0f);
        }
Пример #5
0
        public TextElement(InterfaceElement parent, Vector2 location, BitmapFont font, string text, HAlign h, VAlign v)
            : base(parent, location)
        {
            Opacity = 1f;

            this.Text   = text;
            this.Font   = font;
            this.hAlign = h;
            this.vAlign = v;
        }
Пример #6
0
        public TextElement(InterfaceElement parent, Vector2 location, BitmapFont font, string text, HAlign h, VAlign v)
            : base(parent, location)
        {
            Opacity = 1f;

            this.Text = text;
            this.Font = font;
            this.hAlign = h;
            this.vAlign = v;
        }
        public void InvalidRegisterChildTest()
        {
            var ns     = new NameSpaceElement(new PhysicalStorage(PathA));
            var sample = new DelegateElement(ns, ScopeCategories.Public, false);

            AttachName(sample, "BinOp");

            Assert.Throws <ArgumentException>(() =>
                                              _ = new InterfaceElement(sample, ScopeCategories.Public, false, false));
            Assert.Throws <ArgumentException>(() =>
                                              _ = new ClassElement(sample, ScopeCategories.Public, false, false, false, false, false));
        }
Пример #8
0
        private void CompileBase(string path, InterfaceElement elem)
        {
            switch (elem.Type)
            {
            case InterfaceElementType.Element: Compile(path, elem); break;

            case InterfaceElementType.Panel: Compile(path, elem as InterfacePanel); break;

            case InterfaceElementType.Label: Compile(path, elem as InterfaceLabel); break;

            default: throw new Exception($"Unsopported element type [{elem.Type}].");
            }
            foreach (var sub_elem in elem.Elements)
            {
                CompileBase(path, sub_elem);
            }
        }
Пример #9
0
        public void Build()
        {
            interfaceElements = GetComponentsInChildren <InterfaceElement>();

            for (int i = 0; i < interfaceElements.Length; i++)
            {
                InterfaceElement interfaceElement = interfaceElements[i];

                RectTransform rectTransform = interfaceElement.gameObject.GetComponent <RectTransform>();
                rectTransform.sizeDelta  = dimension;
                rectTransform.localScale = scale;
                rectTransform.rotation   = Quaternion.Euler(rotation);

                switch (layout)
                {
                case Layout.GRID:
                    rectTransform.localPosition = new Vector3(
                        origin.x + (flipX ? -1 : 1) * (margin.x + rectTransform.rect.width) * (i % cellSize),
                        origin.y + (flipY ? -1 : 1) * (margin.y + rectTransform.rect.height) * (i / cellSize),
                        0.0f
                        );
                    break;

                case Layout.HORIZONTAL:
                    rectTransform.localPosition = new Vector3(
                        origin.x + (flipX ? -1 : 1) * (margin.x + rectTransform.rect.width) * i,
                        origin.y,
                        0.0f
                        );
                    break;

                case Layout.VERTICAL:
                    rectTransform.localPosition = new Vector3(
                        origin.x,
                        origin.y + (flipY ? -1 : 1) * (margin.y + rectTransform.rect.height) * i,
                        0.0f
                        );
                    break;
                }
            }
        }
Пример #10
0
            public CElement(InterfaceElement elem)
            {
                PositionX = elem.PositionX;
                PositionY = elem.PositionY;
                ExtentX   = elem.ExtentX;
                ExtentY   = elem.ExtentY;

                Constraints.AnchorU = (Anchor)elem.AnchorU;
                Constraints.AnchorL = (Anchor)elem.AnchorL;
                Constraints.AnchorD = (Anchor)elem.AnchorD;
                Constraints.AnchorR = (Anchor)elem.AnchorR;

                Constraints.OffsetU = elem.OffsetU;
                Constraints.OffsetL = elem.OffsetL;
                Constraints.OffsetD = elem.OffsetD;
                Constraints.OffsetR = elem.OffsetR;

                Resizable = elem.Resizable;

                Count = elem.Elements.Count;
            }
        void OnEnable()
        {
            InterfaceElement targetCast = (target as InterfaceElement);

            targetCast.hideFlags = HideFlags.HideInInspector;

            //Hide Canvas Group
            CanvasGroup canvasGroup = targetCast.GetComponent <CanvasGroup>();

            if (canvasGroup != null)
            {
                canvasGroup.hideFlags = HideFlags.HideInInspector;
            }

            //Hide Canvas Renderer
            CanvasRenderer canvasRenderer = targetCast.GetComponent <CanvasRenderer>();

            if (canvasRenderer != null)
            {
                canvasRenderer.hideFlags = HideFlags.HideInInspector;
            }

            //Hide Rectangle Transform
            RectTransform rectTransform = targetCast.GetComponent <RectTransform>();

            if (rectTransform != null)
            {
                rectTransform.hideFlags = HideFlags.HideInInspector;
            }

            //Hide Image
            Image image = targetCast.GetComponent <Image>();

            if (image != null)
            {
                image.hideFlags = HideFlags.HideInInspector;
            }
        }
        GenerateGetAncestorsSample()
        {
            var list = new List <IDiscriminatedElement>();

            IDiscriminatedElement parent = new NameSpaceElement(new PhysicalStorage(PathA));

            AttachName(parent, "Outer");
            list.Add(parent);

            parent = new NameSpaceElement(parent);
            AttachName(parent, "Inner");
            list.Add(parent);

            parent = new InterfaceElement(parent, ScopeCategories.Public, false, false);
            AttachName(parent, "IOuter");
            list.Add(parent);

            var sample = new DelegateElement(parent, ScopeCategories.Public, false);

            AttachName(sample, "BinaryOp");

            list.Reverse();
            yield return(sample, list);
        }
Пример #13
0
    // Read and extract into InterfaceRight class each attribut of node name "group"
    InterfaceElement check_attribute_group(XmlReader xml_reader)
    {
        InterfaceElement s_InterfaceElement = new InterfaceElement();
        s_InterfaceElement.mse_type = 0;
        s_InterfaceElement.b_toggle_type = false;
        s_InterfaceElement.s_content = "undefined";
        s_InterfaceElement.s_text_area = "Choose a title";

        if (xml_reader.HasAttributes)
        {
            while (xml_reader.MoveToNextAttribute() != false)
            {
                bool valide_type = true;
                string save_type = "";
                string save_readstring = "";
                string save_content = "";

                // if type exist, else, a button will be created
                if ((save_type = xml_reader.GetAttribute("type")) != null)
                {
                    if (Enum.IsDefined(typeof(me_button_type),save_type) == true)
                        s_InterfaceElement.mse_type = (me_button_type)Enum.Parse(typeof(me_button_type), save_type);
                    else
                        valide_type = false;
                }

                // if content as attribute or string exist, else, "undefined" has been saved
                if ((save_content = xml_reader.GetAttribute("content")) != null || (save_readstring = xml_reader.ReadString()) != null)
                {
                    s_InterfaceElement.s_content = save_content != null ? save_content : save_readstring;
                    if (valide_type == false)
                        s_InterfaceElement.s_content += " (Coming Soon)";
                }
            }
        }
        return s_InterfaceElement;
    }
Пример #14
0
 private void Compile(string path, InterfaceElement res)
 {
     Writer.Write((int)Type.Element);
     (new CElement(res)).Write(Writer);
 }
Пример #15
0
 private void openRucksack()
 {
     rucksack = new RucksackInterface(player);
     player.AddInterfaceElement(rucksack);
 }
Пример #16
0
        private void Start()
        {
            interfaceAnimation = GetComponent <InterfaceAnimation>();
            interfaceElements  = GetComponentsInChildren <InterfaceElement>();

            if (interfaceAnimation.duration == 0)
            {
                Debug.LogWarning("You must specify a duration for your animation to run.");
                return;
            }

            for (int i = 0; i < interfaceElements.Length; i++)
            {
                InterfaceElement   interfaceElement = interfaceElements[i];
                InterfaceAnimation animation        = interfaceElement.GetComponent <InterfaceAnimation>();
                RectTransform      rectTransform    = interfaceElement.gameObject.GetComponent <RectTransform>();

                // HEHE THIS IS A NUMBER
                animation.duration = interfaceAnimation.duration;

                // COPY VECTORS
                animation.translation = interfaceAnimation.translation;
                animation.rotation    = interfaceAnimation.rotation;
                animation.scale       = interfaceAnimation.scale;

                // COPY ANIMATION CURVES
                animation.translationCurve = interfaceAnimation.translationCurve;
                animation.rotationCurve    = interfaceAnimation.rotationCurve;
                animation.scaleCurve       = interfaceAnimation.scaleCurve;


                switch (layout)
                {
                case Layout.GRID:
                    animation.translation = new Vector3(
                        animation.translation.x + origin.x + (flipX ? -1 : 1) * (margin.x + rectTransform.rect.width) * (i % cellSize),
                        animation.translation.y + origin.y + (flipY ? -1 : 1) * (margin.y + rectTransform.rect.height) * (i / cellSize),
                        0.0f
                        );
                    break;

                case Layout.HORIZONTAL:
                    animation.translation = new Vector3(
                        animation.translation.x + origin.x + (flipX ? -1 : 1) * (margin.x + rectTransform.rect.width) * i,
                        animation.translation.y + origin.y,
                        0.0f
                        );
                    break;

                case Layout.VERTICAL:
                    animation.translation = new Vector3(
                        animation.translation.x + origin.x,
                        animation.translation.y + origin.y + (flipY ? -1 : 1) * (margin.y + rectTransform.rect.height) * i,
                        0.0f
                        );
                    break;
                }
            }

            for (int i = 0; i < interfaceElements.Length; i++)
            {
                InterfaceElement   interfaceElement = interfaceElements[i];
                InterfaceAnimation animation        = interfaceElement.GetComponent <InterfaceAnimation>();
                if (!animation.independent)
                {
                    StartCoroutine(animation.Animate((i + 1) * animationInterval));
                }
            }
        }