예제 #1
0
        /// <summary>
        /// Executes this pattern instance
        /// </summary>
        public void Execute()
        {
            Employee employee = new Employee
            {
                Name        = "John",
                BloodGroup  = BloodGroup.ABNegetive,
                DateOfBirth = new DateTime(2010, 1, 1),
                Department  = new Department {
                    Name = "ABC"
                },
                IsActive        = true,
                TotalExperience = 2.4f
            };

            // Deep Copy
            var deep = employee.Clone() as Employee;

            deep.Department.Name = "XYZ";

            if (employee.Department.Name != deep.Department.Name)
            {
                BubbleDisplay.Info(Resources.NON_IDENTICAL_OBJECT);
            }

            // Shallow Copy
            var shallow = employee.Clone(false) as Employee;

            shallow.Department.Name = "JKL";

            if (employee.Department.Name == shallow.Department.Name)
            {
                BubbleDisplay.Info(Resources.IDENTICAL_OBJECT);
            }
        }
    public ConversationResponseDisplay(GameObject prefab)
    {
        responseMessageDisplay = string.Empty;

        gameObject     = prefab;
        bubbleElements = new BubbleDisplay(prefab);
        Active         = false;
    }
    private void OnEnable()
    {
        ConversationBubbleOrientationManager.InitializeSprites(leftBubble, centerBubble, rightBubble);

        bubbleElements = new BubbleDisplay(this.gameObject, isResponse);

        builder = new StringBuilder();

        currentOrientation = ConversationBubbleOrientation.Center;
    }
예제 #4
0
        /// <summary>
        /// Executes this pattern instance
        /// </summary>
        public void Execute()
        {
            var b1 = LoadBalancer.GetLoadBalancer();
            var b2 = LoadBalancer.GetLoadBalancer();
            var b3 = LoadBalancer.GetLoadBalancer();
            var b4 = LoadBalancer.GetLoadBalancer();

            // Confirm these are the same instance
            if (b1 == b2 && b2 == b3 && b3 == b4)
            {
                BubbleDisplay.Info(Resources.IDENTICAL_OBJECT);
            }

            // Next, load balance 15 requests for a server
            var balancer = LoadBalancer.GetLoadBalancer();

            for (int i = 0; i < 15; i++)
            {
                string serverName = balancer.NextServer.Name;
                BubbleDisplay.Info("Dispatch request to: " + serverName);
            }
        }
예제 #5
0
 public void Copy(BubbleDisplay bubble)
 {
     SetBackingImage(bubble.BackingSprite);
     rectTransform.localPosition = bubble.rectTransform.localPosition;
     rectTransform.localScale    = bubble.rectTransform.localScale;
 }