예제 #1
0
        public void RemoveStatus(ViewStatusClass viewStatusClass)
        {
            Image imageToFree;

            if (_classesToStatusImages.TryGetValue(viewStatusClass, out imageToFree))
            {
                _classesToStatusImages.Remove(viewStatusClass);
                PoolingManager.Free(PoolingManager.StatusImage, imageToFree.gameObject);
            }
        }
예제 #2
0
 public void SetStatus(ViewStatusClass viewStatusClass, ActorStatusDefinition statusDefinition)
 {
     try
     {
         if (statusDefinition == null)
         {
             EntityUiPresenter.RemoveStatus(viewStatusClass);
         }
         else
         {
             EntityUiPresenter.SetStatus(viewStatusClass, statusDefinition);
         }
     }
     catch (Exception e)
     {
         Debug.LogError(e.Message + ", stack trace: " + e.StackTrace);
     }
 }
예제 #3
0
        public void SetStatus(ViewStatusClass viewStatusClass, ActorStatusDefinition statusDefinition)
        {
            Image statusImage;

            if (_classesToStatusImages.ContainsKey(viewStatusClass))
            {
                statusImage = _classesToStatusImages[viewStatusClass];
            }
            else
            {
                statusImage = PoolingManager.Fetch(PoolingManager.StatusImage, _statusesGroup.transform.position,
                                                   Quaternion.identity, _statusesGroup.transform)
                              .GetComponent <Image>();
                _classesToStatusImages[viewStatusClass] = statusImage;
            }
            statusImage.sprite = statusDefinition.Icon;
            statusImage.transform.localPosition = Vector3.zero;
            statusImage.transform.localScale    = new Vector3(1, 1, 1);
            LayoutRebuilder.ForceRebuildLayoutImmediate(_statusesGroup.GetComponent <RectTransform>());            // prevents statuses from laying one on top of another
        }