public Dictionary <AttachNode, List <string> > GetMounts()
        {
            Dictionary <AttachNode, List <string> > mounts = new Dictionary <AttachNode, List <string> >();
            ConfigNode node = KIS_Shared.GetBaseConfigNode(this);

            foreach (ConfigNode mountNode in node.GetNodes("MOUNT"))
            {
                if (mountNode.HasValue("attachNode") && mountNode.HasValue("allowedPartName"))
                {
                    string     attachNodeName = mountNode.GetValue("attachNode");
                    AttachNode an             = this.part.findAttachNode(attachNodeName);
                    if (an == null)
                    {
                        KIS_Shared.DebugError("GetMountNodes - Node : " + attachNodeName + " not found !");
                        continue;
                    }

                    List <string> allowedPartNames = new List <string>();
                    foreach (string partName in mountNode.GetValues("allowedPartName"))
                    {
                        allowedPartNames.Add(partName.Replace('_', '.'));
                    }
                    mounts.Add(an, allowedPartNames);
                }
            }
            return(mounts);
        }
Example #2
0
        /// <inheritdoc/>
        public override void OnItemUse(KIS_Item item, KIS_Item.UseFrom useFrom)
        {
            pageList.Clear();
            var node = KIS_Shared.GetBaseConfigNode(this);

            foreach (string page in node.GetValues("page"))
            {
                pageList.Add(page);
            }
            if (pageList.Count > 0)
            {
                pageIndex = 0;
                pageTotal = pageList.Count;
                guiObj    = new GameObject("KISManualDialog-" + part.flightID);
                var dlg = guiObj.AddComponent <GuiDialog>();
                dlg.dialogFunction = GuiReader;

                pageTexture = GameDatabase.Instance.GetTexture(pageList[0], false);
                UISoundPlayer.instance.Play(bookOpenSndPath);
            }
            else
            {
                DebugEx.Info("The book has no pages configured");
            }
        }
Example #3
0
        /// <inheritdoc/>
        public override void OnItemUse(KIS_Item item, KIS_Item.UseFrom useFrom)
        {
            pageList.Clear();
            var node = KIS_Shared.GetBaseConfigNode(this);

            foreach (string page in node.GetValues("page"))
            {
                pageList.Add(page);
            }
            if (pageList.Count > 0)
            {
                pageIndex   = 0;
                pageTotal   = pageList.Count;
                pageTexture = GameDatabase.Instance.GetTexture(pageList[0], false);
                showPage    = true;
                UISoundPlayer.instance.Play(bookOpenSndPath);
            }
            else
            {
                Debug.LogError("The book has no pages configured");
            }
        }