コード例 #1
0
    public void OnEnterSector(Collider2D collision)
    {
        var points = new Collider2D[50];
        var count  = collision.GetContacts(points);

        if (count < points.Length)
        {
            System.Array.Resize(ref points, count);
        }
        bool foundBlade = false;

        for (int i = 0; i < points.Length; i++)
        {
            if (points[i].gameObject != gameObject && points[i].gameObject.tag == "Blade")
            {
                selectedBlade = points[i].GetComponent <BladeView>();
                if (!selectedBlade)
                {
                    selectedBlade = points[i].GetComponentInParent <BladeView>();
                }

                if (selectedBlade)
                {
                    foundBlade = selectedBlade.gizmoidHolder.gizmoids.Count < 6;
                    break;
                }
            }
        }
        if (!foundBlade)
        {
            selectedBlade = null;
        }
        DisplaySectorSelector(collision.transform.eulerAngles.z, foundBlade);
    }
コード例 #2
0
        public void OnXamlRendered(FrameworkElement control)
        {
            bladeView = control.FindChildByName("BladeView") as BladeView;
            addBlade  = control.FindChildByName("AddBlade") as Button;

            if (addBlade != null)
            {
                addBlade.Click += OnAddBladeButtonClicked;
            }

            resources = control.Resources;
        }
コード例 #3
0
        /// <summary>
        /// Returns the ordinal position in the set for the element that is associated with the automation peer.
        /// </summary>
        /// <returns>
        /// The ordinal position in the set.
        /// </returns>
        protected override int GetPositionInSetCore()
        {
            int positionInSet = base.GetPositionInSetCore();

            if (positionInSet != -1)
            {
                return(positionInSet);
            }

            BladeItem owner  = this.OwnerBladeItem;
            BladeView parent = owner.ParentBladeView;

            positionInSet = parent.IndexFromContainer(owner);

            return(positionInSet);
        }
コード例 #4
0
        /// <summary>
        /// Returns the size of the set where the element that is associated with the automation peer is located.
        /// </summary>
        /// <returns>
        /// The size of the set.
        /// </returns>
        protected override int GetSizeOfSetCore()
        {
            int sizeOfSet = base.GetSizeOfSetCore();

            if (sizeOfSet != -1)
            {
                return(sizeOfSet);
            }

            BladeItem owner  = this.OwnerBladeItem;
            BladeView parent = owner.ParentBladeView;

            sizeOfSet = parent.Items.Count;

            return(sizeOfSet);
        }
コード例 #5
0
        public void ShouldConfigureBladeViewAutomationPeer()
        {
            const string automationName = "MyAutomationBlades";
            const string name           = "MyBlades";

            var bladeView = new BladeView();
            var bladeViewAutomationPeer = FrameworkElementAutomationPeer.CreatePeerForElement(bladeView) as BladeViewAutomationPeer;

            Assert.IsNotNull(bladeViewAutomationPeer, "Verify that the AutomationPeer is BladeViewAutomationPeer.");

            bladeView.Name = name;
            Assert.IsTrue(bladeViewAutomationPeer.GetName().Contains(name), "Verify that the UIA name contains the given Name of the BladeView.");

            bladeView.SetValue(AutomationProperties.NameProperty, automationName);
            Assert.IsTrue(bladeViewAutomationPeer.GetName().Contains(automationName), "Verify that the UIA name contains the given AutomationProperties.Name of the BladeView.");
        }
コード例 #6
0
    public void HandleImpact(BladeView blade, GameObject gameObject)
    {
        if (blade.bladeData.spriteStates.Count > 1)
        {
            blade.spriteRenderer.sprite = blade.bladeData.spriteStates[1];
        }
        blade.GetComponent <Collider2D>().enabled = false;
        blade.enabled = false;

        var en = gameObject.GetComponent <EntityView>();

        if (!en && gameObject.transform.parent != null)
        {
            en = gameObject.GetComponentInParent <EntityView>();
        }
        if (en)
        {
            en.SelfDestruct();
        }
    }
コード例 #7
0
 public void OnDragEnd(PointerEventData eventData)
 {
     CheckSector();
     if (selectedBlade && selectedBlade.gizmoidHolder.gizmoids.Count < 6 && gizmoidData != null)
     {
         selectedBlade.gizmoidHolder.PlacePreview(gizmoidData, preview);
         if (eventData.pointerDrag)
         {
             var unitSelect = eventData.pointerDrag.GetComponent <UnitSelectorButton>();
             if (unitSelect)
             {
                 unitSelect.Acquire();
             }
         }
         preview       = null;
         selectedBlade = null;
     }
     sectorSelector.gameObject.SetActive(false);
     transform.position = new Vector3(10, 0, 0);
     gameObject.SetActive(false);
 }
        /// <summary>
        /// Gets the collection of elements that are represented in the UI Automation tree as immediate
        /// child elements of the automation peer.
        /// </summary>
        /// <returns>The children elements.</returns>
        protected override IList <AutomationPeer> GetChildrenCore()
        {
            BladeView owner = OwningBladeView;

            ItemCollection items = owner.Items;

            if (items.Count <= 0)
            {
                return(null);
            }

            List <AutomationPeer> peers = new List <AutomationPeer>(items.Count);

            for (int i = 0; i < items.Count; i++)
            {
                if (owner.ContainerFromIndex(i) is BladeItem element)
                {
                    peers.Add(FromElement(element) ?? CreatePeerForElement(element));
                }
            }

            return(peers);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="BladeViewAutomationPeer"/> class.
 /// </summary>
 /// <param name="owner">
 /// The <see cref="BladeView" /> that is associated with this <see cref="T:Windows.UI.Xaml.Automation.Peers.BladeViewAutomationPeer" />.
 /// </param>
 public BladeViewAutomationPeer(BladeView owner)
     : base(owner)
 {
 }
コード例 #10
0
    public BladeView GetAvailableBlade(int aisle)
    {
        BladeView selectedBlade = null;

        return(selectedBlade);
    }