Наследование: MonoBehaviour
Пример #1
0
    public bool partOverlappingShip(GameObject part)
    {
        Collider2D[] overlappingColliders = Physics2D.OverlapCircleAll(part.transform.position, 8.0f);;
        if (overlappingColliders.Length > 0)
        {
            for (uint i = 0; i < overlappingColliders.Length; i++)
            {
                GameObject gO       = overlappingColliders[i].gameObject;
                Part_Info  partInfo = gO.GetComponent <Part_Info>();
                if (partInfo == null)
                {
                    continue;
                }

                int shipID = partInfo.ShipID;
                if (shipID > 0)
                {
                    if (Vector2.Distance(part.transform.position, gO.transform.position) < part.GetComponent <BoxCollider2D>().size.x *0.4f)
                    {
                        return(true);
                    }
                }
            }
        }
        return(false);
    }
        /// <summary> Saves the data stored in this instance of the 
        /// element to the provided bibliographic object </summary>
        /// <param name="Bib"> Object to populate this element from </param>
        public override void Populate_From_Bib(SobekCM_Item Bib)
        {
            // Just save this object
            serialHierarchyObject = Bib.Bib_Info.Series_Part_Info;
            serialInfo = Bib.Behaviors.Serial_Info;

            // Check the type for default
            if (Bib.Bib_Info.SobekCM_Type == TypeOfResource_SobekCM_Enum.Newspaper )
                newspaper = true;
        }
        /// <summary> Constructor for a new Serial_Hierarchy_Form_Element, used in the metadata
        /// template to display and allow the user to edit notes about a  
        /// bibliographic package. </summary>
        public Serial_Hierarchy_Form_Element() : base("SerialHierarchy")
        {
            // Set the type of this object
            base.type = Element_Type.SerialHierarchy;
            base.display_subtype = "form";

            // Set some immutable characteristics
            always_single = true;
            always_mandatory = false;

            base.thisBox.DoubleClick += thisBox_Click;
            base.thisBox.KeyDown += thisBox_KeyDown;
            base.thisBox.ReadOnly = true;
            base.thisBox.BackColor = Color.White;

            serialHierarchyObject = new Part_Info();
            newspaper = false;

            listenForChange = false;
        }
Пример #4
0
 public Ship getShip(GameObject myGO)
 {
     Collider2D[] collidersInRadius = Physics2D.OverlapCircleAll(myGO.transform.position, 1.0f);
     if (collidersInRadius.Length > 0)
     {
         for (uint i = 0; i < collidersInRadius.Length; i++)
         {
             Collider2D coll2D = collidersInRadius[i];
             //coll2D.gameObject.GetComponent<Component_Color>().getColor();		need something like this to get ship part colors later on
             Part_Info partInfo = coll2D.gameObject.GetComponent <Part_Info>();
             if (partInfo != null)
             {
                 int shipID = partInfo.ShipID;
                 if (shipID > 0)
                 {
                     return(getShip(shipID));
                 }
             }
         }
     }
     return(null);
 }
Пример #5
0
        public void Set_PartInfo(Part_Info PartInfo, Serial_Info SerialInfo, bool isNewspaper)
        {
            partInfo   = PartInfo;
            serialInfo = SerialInfo;

            volumeDisplayTextBox.Text = partInfo.Enum1;
            if (partInfo.Enum1_Index >= 0)
            {
                volumeOrderTextBox.Text = partInfo.Enum1_Index.ToString();
            }

            issueDisplayTextBox.Text = partInfo.Enum2;
            if (partInfo.Enum2_Index >= 0)
            {
                issueOrderTextBox.Text = partInfo.Enum2_Index.ToString();
            }

            partDisplayTextBox.Text = partInfo.Enum3;
            if (partInfo.Enum3_Index >= 0)
            {
                partOrderTextBox.Text = partInfo.Enum3_Index.ToString();
            }

            yearDisplayTextBox.Text = partInfo.Year;
            if (partInfo.Year_Index >= 0)
            {
                yearOrderTextBox.Text = partInfo.Year_Index.ToString();
            }

            monthDisplayTextBox.Text = partInfo.Month;
            if (partInfo.Month_Index >= 0)
            {
                monthOrderTextBox.Text = partInfo.Month_Index.ToString();
            }

            dayDisplayTextBox.Text = partInfo.Day;
            if (partInfo.Day_Index >= 0)
            {
                dayOrderTextBox.Text = partInfo.Day_Index.ToString();
            }

            if (serialInfo.Count > 0)
            {
                if (partInfo.Year == serialInfo[0].Display)
                {
                    yearDisplayTextBox.Focus();
                    chronRadioButton.Checked = true;
                }
                else
                {
                    volumeDisplayTextBox.Focus();
                    enumRadioButton.Checked = true;
                }
            }
            else
            {
                // If no default, set it by type
                if (isNewspaper)
                {
                    yearDisplayTextBox.Focus();
                    chronRadioButton.Checked = true;
                }
                else
                {
                    volumeDisplayTextBox.Focus();
                    enumRadioButton.Checked = true;
                }
            }


            dayOrderTextBox.TextChanged      += textChanged;
            dayDisplayTextBox.TextChanged    += textChanged;
            monthOrderTextBox.TextChanged    += textChanged;
            monthDisplayTextBox.TextChanged  += textChanged;
            yearOrderTextBox.TextChanged     += textChanged;
            yearDisplayTextBox.TextChanged   += textChanged;
            partOrderTextBox.TextChanged     += textChanged;
            partDisplayTextBox.TextChanged   += textChanged;
            issueOrderTextBox.TextChanged    += textChanged;
            issueDisplayTextBox.TextChanged  += textChanged;
            volumeDisplayTextBox.TextChanged += textChanged;
            volumeOrderTextBox.TextChanged   += textChanged;

            enumRadioButton.CheckedChanged  += checkedChanged;
            chronRadioButton.CheckedChanged += checkedChanged;
        }