Ejemplo n.º 1
0
        public void Decode(string tg, CfgData data)
        {
            switch (tg)
            {
            case "gSys2": data.Decode_Dictionary(out presentationSystemPerNodeConfigs); break;

            // DEPRECATED (TMP)
            case "gSys":
                Dictionary <string, CfgData> dicTmp;
                data.Decode_Dictionary(out dicTmp);
                foreach (var pair in dicTmp)
                {
                    var cfg = new PresentationSystemConfigurations();
                    pair.Value.DecodeInto(out cfg.perNodeConfigs);
                    presentationSystemPerNodeConfigs[pair.Key] = cfg;
                }
                break;
            }
        }
Ejemplo n.º 2
0
        public override bool Inspect()
        {
            bool changed = false;

            if (gameNode != null)
            {
                if (icon.Save.Click("Exit Game Node & Save"))
                {
                    FromGameToNode();
                    return(true);
                }

                "GN: {0}".F(gameNode.GetNameForInspector()).write();

                if (icon.Close.Click("Exit Game Node in Fail").nl())
                {
                    FromGameToNode(true);
                }
                else
                {
                    return(gameNode.Nested_Inspect());
                }
            }

            InspectionTabs().nl();


            if (_inspectedItems == (int)InspectedItem.Triggers)
            {
                base.Inspect().nl(ref changed);
            }


            if (_inspectedItems == (int)InspectedItem.CurrentNode)
            {
                var source = CurrentNode;

                if (pegi.conditional_enter(source != null, ref _inspectedNodeStuff, 0))
                {
                    if (source.visualRepresentation == null)
                    {
                        "Node is not currently visualized".write();

                        /* if ("Force Show".Click("Hidden. Click to show visual representation."))
                         * {
                         *   Shortcuts.visualLayer.Show(source);
                         * }*/
                    }
                    //else if ("Force Hide".Click("Visible. Click To Hide Visual Representation."))
                    //  Shortcuts.visualLayer.Hide(source);

                    pegi.nl();

                    pegi.Try_Nested_Inspect(source.visualRepresentation).nl(ref changed);
                }
                else

                if (CurrentNode != null)
                {
                    CurrentNode.NameForPEGI.write(PEGI_Styles.ListLabel);

                    if (_inspectedNodeStuff != -1)
                    {
                        pegi.nl();
                    }
                }

                pegi.nl();

                if (pegi.conditional_enter(SelectedPresentationMode, ref _inspectedNodeStuff, 1))
                {
                    SelectedPresentationMode.Nested_Inspect().changes(ref changed);
                }

                if (CurrentNode != null)
                {
                    if (_inspectedNodeStuff == -1)
                    {
                        "Tree Mode".write(100);
                        if (PresentationMode.all.selectTypeTag(ref CurrentNode.visualStyleTag).changes(ref changed))
                        {
                            SetPresentationMode(CurrentNode);
                        }
                    }
                }

                pegi.nl();

                int index = 2;

                foreach (var system in presentationSystems)
                {
                    if (system.GetNameForInspector_Uobj().enter(ref _inspectedNodeStuff, index).nl())
                    {
                        PresentationSystemConfigurations cfg;
                        if (!presentationSystemPerNodeConfigs.TryGetValue(system.ClassTag, out cfg))
                        {
                            if ("Add {0} configs".F(system.GetNameForInspector()).Click().nl(ref changed))
                            {
                                cfg = new PresentationSystemConfigurations();
                                presentationSystemPerNodeConfigs.Add(system.ClassTag, cfg);
                            }
                        }
                        else
                        {
                            cfg.InspectFor(CurrentNode.AsNode, system).nl(ref changed);
                        }
                    }

                    index++;
                }
            }

            pegi.nl();

            if (!shortcuts)
            {
                "Shortcuts".edit(ref shortcuts).nl(ref changed);
            }
            else if (_inspectedItems == (int)InspectedItem.Books)
            {
                shortcuts.Nested_Inspect().nl(ref changed);
            }

            if (_inspectedItems == (int)InspectedItem.Users)
            {
                Shortcuts.users.Nested_Inspect(ref changed);
            }

            if (_inspectedItems == -1)
            {
                "Presentation Modes [For Node Tree]"
                .enter_List_UObj(ref presentationControllers, ref _inspectedBackground, ref _inspectedDebugItem, 0)
                .nl(ref changed);

                "Game Controllers".enter_List_UObj(ref gameNodeControllers, ref _inspectedDebugItem, 1).nl(ref changed);

                "Presentation Systems".enter_List_UObj(ref presentationSystems, ref _inspectedSingleton, ref _inspectedDebugItem, 2).nl(ref changed);

                "Textures".enter_Inspect(textureDownloader, ref _inspectedDebugItem, 3).nl_ifNotEntered(ref changed);

                if ("Assets".enter(ref _inspectedDebugItem, 4).nl())
                {
                    if (Shortcuts.Assets.Nested_Inspect().nl())
                    {
                        Shortcuts.Instance.SetToDirty();
                    }
                }

                /* if ("Test Web Requests".enter(ref _inspectedDebugItem, 5).nl())
                 * {
                 *   if (testRequest == null)
                 *   {
                 *       "Test URL".edit(90, ref _testUrl).nl();
                 *       if ("Get".Click())
                 *       {
                 *           testRequest = UnityWebRequest.Get(_testUrl);
                 *           testRequest.SendWebRequest();
                 *       }
                 *   }
                 *   else
                 *   {
                 *
                 *       if ("Dispose Request".Click().nl())
                 *       {
                 *           testRequest.Abort();
                 *           testRequest.Dispose();
                 *           testRequest = null;
                 *       }
                 *       else
                 *       {
                 *
                 *           if (testRequest.isNetworkError)
                 *           {
                 *               "Error".nl(PEGI_Styles.ListLabel);
                 *               pegi.writeBig(testRequest.error);
                 *           }
                 *           else
                 *           {
                 *               if (!testRequest.isDone)
                 *                   "Progress: {0}".F(testRequest.downloadProgress).nl();
                 *               else
                 *               {
                 *                   "Done".write();
                 *
                 *                   if ("Read Content".Click().nl())
                 *                       _testDownloadedCode = testRequest.downloadHandler.text;
                 *
                 *               }
                 *           }
                 *       }
                 *   }
                 *
                 *   if (!_testDownloadedCode.IsNullOrEmpty())
                 *   {
                 *       if ("Clear".Click().nl())
                 *           _testDownloadedCode = null;
                 *       else
                 *           pegi.editBig(ref _testDownloadedCode);
                 *   }
                 * }*/

                if ("Presentation System Cfgs".enter(ref _inspectedDebugItem, 6).nl())
                {
                    "Cfgs".edit_Dictionary(ref presentationSystemPerNodeConfigs, ref _inspectedPresSysCfg).nl();
                }

                if (_inspectedDebugItem == -1)
                {
                    pegi.toggleDefaultInspector(this).nl();

                    "Lerp by {0}, portion: {1}".F(_ld.dominantParameter, _ld.MinPortion).nl();

                    "Playtime UI".toggleIcon(ref Shortcuts.showPlaytimeUI).nl();

                    if ("Encode / Decode Test".Click(ref changed))
                    {
                        OnDisable();
                        OnEnable();
                    }

                    pegi.nl();
                }
            }

            if (changed && SelectedPresentationMode)
            {
                SelectedPresentationMode.OnLogicUpdate();
            }

            return(changed);
        }