Exemple #1
0
        public void AddSceneHierarchyView(IEnumerable <GameObject> objects)
        {
            var stackElement = Instantiate(templates.sceneHierarchyView, parent);

            stackElement.gameObject.SetActive(true);

            stackElement.Init(
                objects,
                target =>
            {
                var children = new List <GameObject>();
                foreach (Transform child in target.transform)
                {
                    children.Add(child.gameObject);
                }

                if (children.Count > 0)
                {
                    AddSceneHierarchyView(children.ToArray());
                }
            },
                AddInspectorView);

            stack.Add(stackElement.gameObject);
            OnStackChanged?.Invoke();
        }
Exemple #2
0
 public void Back()
 {
     if (stack.Count > 0)
     {
         var obj = stack[stack.Count - 1];
         stack.Remove(obj);
         Destroy(obj);
         OnStackChanged?.Invoke();
     }
 }
Exemple #3
0
 public void ClearStack()
 {
     for (var i = stack.Count - 1; i >= 0; i--)
     {
         var element = stack[i];
         Destroy(element);
         stack.Remove(element);
     }
     OnStackChanged?.Invoke();
 }
Exemple #4
0
        public void AddShelfView(InspectorShelf shelf)
        {
            var stackElement = Instantiate(templates.shelfView, parent);

            stackElement.gameObject.SetActive(true);

            stackElement.Init(shelf.Items, AddInspectorView);

            stack.Add(stackElement.gameObject);
            OnStackChanged?.Invoke();
        }
Exemple #5
0
        public void AddInspectorView(object targetObject, InspectorConfig config)
        {
            if (targetObject == null)
            {
                throw new ArgumentNullException(nameof(targetObject));
            }
            if (targetObject.GetType().IsPrimitive)
            {
                throw new ArgumentException("Target object cannot be a primitive type", nameof(targetObject));
            }

            var stackElement = Instantiate(templates.inspectorView, parent);

            stackElement.gameObject.SetActive(true);

            stackElement.InspectObject(targetObject, config);
            stack.Add(stackElement.gameObject);
            OnStackChanged?.Invoke();
        }
Exemple #6
0
 private void callStackChanged(uint address)
 {
     OnStackChanged?.Invoke(address);
 }
Exemple #7
0
 /// <summary>
 /// Вызывает событие
 /// изменение стека
 /// </summary>
 /// <param name="eventData">
 /// Данные события
 /// </param>
 protected void Notify(StackEventData <T> eventData)
 {
     OnStackChanged?.Invoke(this, eventData);
 }
        public void ResearchItem(Item item)
        {
            var itemProgressionRaw = GetItemProgressionRaw(item, out var progressionItem);

            if (itemProgressionRaw.max < 0)
            {
                return;
            }

            if (itemProgressionRaw.current >= itemProgressionRaw.max)
            {
                if (ModManager.Instance.ModMode == ModMode.Buy)
                {
                    OnStackChanged?.Invoke(0);
                }

                return;
            }

            var needCount = itemProgressionRaw.max - itemProgressionRaw.current;

            var progressCount = item.Stack > needCount ? needCount : item.Stack;

            var itemQuality = (ItemQuality)((item as Object)?.Quality ?? 0);

            if (itemQuality >= ItemQuality.Normal)
            {
                progressionItem.ResearchCount += progressCount;
            }

            if (itemQuality >= ItemQuality.Silver)
            {
                progressionItem.ResearchCountSilver += progressCount;
            }

            if (itemQuality >= ItemQuality.Gold)
            {
                progressionItem.ResearchCountGold += progressCount;
            }

            if (itemQuality >= ItemQuality.Iridium)
            {
                progressionItem.ResearchCountIridium += progressCount;
            }

            //sync with host
            if (!Context.IsMainPlayer)
            {
                SendItemResearchMessage(item, progressionItem);
            }

            if (item.Stack >= progressCount)
            {
                OnResearchCompleted();
            }

            if (ModManager.Instance.ModMode == ModMode.Buy)
            {
                OnStackChanged?.Invoke(0);
            }
            else
            {
                OnStackChanged?.Invoke(item.Stack - progressCount);
            }
        }