Beispiel #1
0
        public override void Init(NodeBook nRoot, Node parent)
        {
            base.Init(nRoot, parent);

            foreach (var sn in this)
            {
                sn?.Init(nRoot, this);
            }
        }
        public void AddOrReplace(NodeBook nb)
        {
            var el = all.GetByIGotName(nb);

            if (el != null)
            {
                if (Shortcuts.CurrentNode != null && Shortcuts.CurrentNode.parentBook == el)
                {
                    Shortcuts.CurrentNode = null;
                }
                all[all.IndexOf(el)] = nb;
            }
            else
            {
                all.Add(nb);
            }
        }
        public bool TryGetLoadedBook(string bookName, string authorName, out NodeBook nodeBook)
        {
            var book = TryGetBook(bookName, authorName);

            if (book == null)
            {
                nodeBook = null;
                return(false);
            }

            if (book.GetType() == typeof(NodeBook_OffLoaded))
            {
                book = (book as NodeBook_OffLoaded).LoadBook();
            }

            nodeBook = book as NodeBook;

            return(nodeBook != null);
        }
Beispiel #4
0
        public void OnClassTypeChange(object previousInstance)
        {
            if (!(previousInstance is Base_Node other))
            {
                return;
            }

            parentNode                   = other.parentNode;
            parentBook                   = other.parentBook;
            visualRepresentation         = other.visualRepresentation;
            previousVisualRepresentation = other.previousVisualRepresentation;

            if (!QcUnity.IsNullOrDestroyed_Obj(visualRepresentation))
            {
                pegi.GameView.ShowNotification("Changing Node Type");
                visualRepresentation.OnSourceNodeUpdate(this);
            }
            else
            {
                pegi.GameView.ShowNotification("Source Node was empty, couldn't change");
            }
        }
Beispiel #5
0
 bool LoadLinkedBook(out NodeBook book) => Shortcuts.books.TryGetLoadedBook(linkedBookName, linkedBookAuthor, out book);
 public bool TryGetLoadedBook(IBookReference reff, out NodeBook nodeBook)
 => TryGetLoadedBook(reff.BookName, reff.AuthorName, out nodeBook);
        public bool Inspect()
        {
            var changed = false;

            var newBook = "Books ".edit_List(ref all, ref _inspectedBook, ref changed);

            if (newBook != null)
            {
                newBook.authorName = Shortcuts.users.current.Name;
            }

            if (_inspectedBook == -1)
            {
                #region Paste Options

                if (_replaceReceived != null)
                {
                    if (_replaceReceived.NameForPEGI.enter(ref _inspectReplacementOption))
                    {
                        _replaceReceived.Nested_Inspect();
                    }
                    else
                    {
                        if (icon.Done.ClickUnFocus())
                        {
                            var el = all.GetByIGotName(_replaceReceived);
                            if (el != null)
                            {
                                all[all.IndexOf(el)] = _replaceReceived;
                            }
                            else
                            {
                                all.Add(_replaceReceived);
                            }

                            _replaceReceived = null;
                        }

                        if (icon.Close.ClickUnFocus())
                        {
                            _replaceReceived = null;
                        }
                    }
                }
                else
                {
                    string tmp = "";
                    if ("Paste Messaged Book".edit(140, ref tmp) || CfgExtensions.DropStringObject(out tmp))
                    {
                        var book = new NodeBook();
                        book.DecodeFromExternal(tmp);
                        if (all.GetByIGotName(book.NameForPEGI) == null)
                        {
                            all.Add(book);
                        }
                        else
                        {
                            _replaceReceived = book;
                        }
                    }
                }
                pegi.nl();

                #endregion
            }
            return(changed);
        }