示例#1
0
        void Update()
        {
            if (mSelectionGroup == null)
            {
                return;
            }

            if (Input.GetKeyDown(KeyCode.Alpha1 + Index - 1))
            {
                if (Input.GetKey(KeyCode.LeftControl))
                {
                    mSelectionGroup.Set();
                }
                else if (Input.GetKey(KeyCode.LeftShift))
                {
                    mSelectionGroup.Add();
                }
                else
                {
                    mSelectionGroup.Select();
                }
            }

            var count = mSelectionGroup.Members.Count(go => go != null);

            CountTarget.text = count > 0 ? count.ToString() : "";

            var firstInGroup = mSelectionGroup.Members.FirstOrDefault(v => v != null);

            if (firstInGroup != null)
            {
                IconTarget.sprite = firstInGroup.Icon;
            }
            else
            {
                IconTarget.sprite = EmptySprite;
            }
        }