Пример #1
0
        private void ServerAddNodeNoCheckGroup(TechNode techNode)
        {
            if (!techNode.IsAvailable)
            {
                return;
            }

            if (this.Nodes.Contains(techNode))
            {
                return;
            }

            this.Nodes.Add(techNode);
            var character = this.Character;

            Api.Logger.Info("Tech node added: " + techNode.ShortId, character);
            Api.SafeInvoke(() => CharacterTechNodeAddedOrRemoved?.Invoke(character, techNode, isAdded: true));

            // add all required nodes recursively
            var currentNode = techNode;

            do
            {
                this.ServerAddNodeNoCheckGroup(currentNode);
                currentNode = currentNode.RequiredNode;
            }while (currentNode != null);

            character.SharedSetFinalStatsCacheDirty();
        }
        /// <summary>
        /// Remove node and all dependent nodes.
        /// </summary>
        public void ServerRemoveNode(TechNode techNode)
        {
            if (!this.Nodes.Remove(techNode))
            {
                return;
            }

            Api.SafeInvoke(() => CharacterTechNodeAddedOrRemoved?.Invoke(this.Character, techNode, isAdded: false));

            // remove all the dependent nodes
            foreach (var dependentNode in techNode.DependentNodes)
            {
                this.ServerRemoveNode(dependentNode);
            }
        }