Пример #1
0
    public void draw()
    {
        GameEvent ge = (GameEvent)node.Content;

        string[] editors        = EventEditorFactory.Intance.CurrentEventEditors;
        int      editorSelected = 0;

        for (int i = 1; i < editors.Length; i++)
        {
            if (editors [i].ToLower() == ge.Name.ToLower())
            {
                editorSelected = i;
            }
        }

        int was = editorSelected;

        editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
        if (currentEditor == null || was != editorSelected)
        {
            if (currentEditor != null)
            {
                currentEditor.detachEvent(ge);
            }

            ge.Name       = "";
            currentEditor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);
            currentEditor.useEvent(ge);
        }

        currentEditor.draw();

        /**
         *  Game event synchronization
         * */

        if (!(ge.getParameter("synchronous") is bool))
        {
            ge.setParameter("synchronous", false);
        }
        ge.setParameter("synchronous", EditorGUILayout.Toggle("Synchronous",
                                                              (ge.getParameter("synchronous") == null)?false:(bool)ge.getParameter("synchronous")));

        if ((bool)ge.getParameter("synchronous"))
        {
            EditorGUILayout.HelpBox("Notice that if there is no EventFinished event, the game will stuck.", MessageType.Warning);
        }

        /**
         * Synchronization end
         * */

        node.Content = currentEditor.Result;

        if (Event.current.type != EventType.layout)
        {
            node.ChildSlots = 1;
        }
    }
Пример #2
0
    static void Init()
    {
        EventEditor eventEd = EditorWindow.GetWindow <EventEditor>();

        if (Selection.activeGameObject != null)
        {
            eventEd.currentEvent = Selection.activeGameObject.GetComponent <Event>();
        }
    }
Пример #3
0
    public EventEditorFactoryImp()
    {
        this.eventEditors = new List<EventEditor> ();
        this.eventEditors.Add (new MoveEventEditor ());
        this.eventEditors.Add (new ChangeSwitchEventEditor ());
        this.eventEditors.Add (new AddItemEditor ());

        this.defaultEventEditor = new DefaultEventEditor ();
    }
Пример #4
0
        public EventEditorFactoryImp()
        {
            this.eventEditors = new List <EventEditor> ();
            this.eventEditors.Add(new ChangeSwitchEventEditor());
            this.eventEditors.Add(new AddItemEditor());


            this.defaultEventEditor = new DefaultEventEditor();
        }
Пример #5
0
    public void draw()
    {
        GameEvent ge = (GameEvent)node.Content;
        string[] editors = EventEditorFactory.Intance.CurrentEventEditors;
        int editorSelected = 0;

        for (int i = 1; i< editors.Length; i++)
            if (editors [i].ToLower () == ge.Name.ToLower ())
                editorSelected = i;

        int was = editorSelected;

        editorSelected = EditorGUILayout.Popup (editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
        if (currentEditor == null || was != editorSelected)
        {
            if(currentEditor != null)
                currentEditor.detachEvent(ge);

            ge.Name = "";
            currentEditor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);
            currentEditor.useEvent(ge);
        }

        currentEditor.draw();

        /**
         *  Game event synchronization
         * */

        if (!(ge.getParameter("synchronous") is bool)) ge.setParameter("synchronous", false);
        ge.setParameter("synchronous", EditorGUILayout.Toggle("Synchronous",
            (ge.getParameter("synchronous") == null)?false:(bool) ge.getParameter("synchronous")));

        if((bool)ge.getParameter("synchronous"))
            EditorGUILayout.HelpBox("Notice that if there is no EventFinished event, the game will stuck.", MessageType.Warning);
        /**
         * Synchronization end
         * */

        node.Content = currentEditor.Result;

        if (Event.current.type != EventType.layout){
            int l = node.Childs.Length;
            if (l != 1) {
                if(l == 0) node.addNewChild();
                else while(l > 1){
                    node.removeChild(l-1);
                    l--;
                }
            }
        }
    }
Пример #6
0
        protected override void NodeContentInspectorGUI()
        {
            SerializableGameEvent ge = (SerializableGameEvent)target;

            string[] editors        = EventEditorFactory.Intance.CurrentEventEditors;
            int      editorSelected = 0;

            for (int i = 1; i < editors.Length; i++)
            {
                if (ge != null && editors[i].ToLower() == ge.Name.ToLower())
                {
                    editorSelected = i;
                }
            }

            int was = editorSelected;

            editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
            if (currentEditor == null || was != editorSelected)
            {
                if (currentEditor != null && ge != null)
                {
                    currentEditor.detachEvent(ge);
                }

                if (ge != null)
                {
                    ge.Name = "";
                }

                currentEditor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);
                currentEditor.useEvent(ge);
            }

            currentEditor.draw();

            /**
             *  Game event synchronization
             * */

            if (!(ge.getParameter("synchronous") is bool))
            {
                ge.setParameter("synchronous", false);
            }
            ge.setParameter("synchronous", EditorGUILayout.Toggle("Synchronous",
                                                                  (ge.getParameter("synchronous") == null) ? false : (bool)ge.getParameter("synchronous")));

            if ((bool)ge.getParameter("synchronous"))
            {
                EditorGUILayout.HelpBox("Notice that if there is no EventFinished event, the game will stuck.", MessageType.Warning);
            }
        }
Пример #7
0
        private void buttonNewEvent_Click(object sender, EventArgs e)
        {
            EventEditor  tce    = new EventEditor(Session, this.Individual);
            DialogResult result = tce.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                //this.Individual.SightingHistory.Add(tce.State);
                this.individualEventBindingSource.Add(tce.State);
                Session.SaveOrUpdate(tce.State);
                this.RefreshLabels();
            }
        }
        public EventEditorFactoryImp()
        {
            this.eventEditors = new List <EventEditor> ();

            var methods = AttributesUtil.GetMethodsWith <GameEventAttribute>(typeof(EventedEventManager), true);

            foreach (var m in methods)
            {
                this.eventEditors.Add(new AttributeEventEditor(new GameEventConfig(m.Key, m.Value)));
            }

            /*this.eventEditors.Add (new ChangeSwitchEventEditor ());
             * this.eventEditors.Add (new AddItemEditor ());
             * this.eventEditors.Add(new MoveEventEditor());
             */

            this.defaultEventEditor = new DefaultEventEditor();
        }
Пример #9
0
    public void draw()
    {
        GameEvent ge = (GameEvent)node.Content;

        string[] editors        = EventEditorFactory.Intance.CurrentEventEditors;
        int      editorSelected = 0;

        if (ge.Name == null)
        {
            ge.Name = "";
        }
        for (int i = 1; i < editors.Length; i++)
        {
            if (editors[i].ToLower() == ge.Name.ToLower())
            {
                editorSelected = i;
            }
        }
        int was = editorSelected;

        editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
        if (was != editorSelected && editorSelected == 0)
        {
            ge.Name = "";
        }
        EventEditor editor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);

        editor.useEvent(ge);

        editor.draw();

        ge.setParameter("synchronous", EditorGUILayout.Toggle("Synchronous",
                                                              (ge.getParameter("synchronous") == null) ? false : (bool)ge.getParameter("synchronous")));
        if ((bool)ge.getParameter("synchronous"))
        {
            EditorGUILayout.HelpBox("Notice that if there is no EventFinished event, the game will stuck.", MessageType.Warning);
        }

        node.Content = editor.Result;

        if (Event.current.type != EventType.layout)
        {
            int l = node.Childs.Length;
            if (l != 1)
            {
                if (l == 0)
                {
                    node.addNewChild();
                }
                else
                {
                    while (l > 1)
                    {
                        node.removeChild(l - 1);
                        l--;
                    }
                }
                //this.Repaint ();
            }
        }
    }
Пример #10
0
        private static void OnGUI(UnityModManager.ModEntry modEntry)
        {
            if (!Enabled)
            {
                return;
            }
            IsModGUIShown = true;
            if (!IsInGame)
            {
                UI.Label("ToyBox has limited functionality from the main menu".yellow().bold());
            }
            if (!UI.IsWide)
            {
                UI.Label("Note ".magenta().bold() + "ToyBox was designed to offer the best user experience at widths of 1920 or higher. Please consider increasing your resolution up of at least 1920x1080 (ideally 4k) and go to Unity Mod Manager 'Settings' tab to change the mod window width to at least 1920.  Increasing the UI scale is nice too when running at 4k".orange().bold());
            }
            try {
                var e = Event.current;
                UI.userHasHitReturn   = e.keyCode == KeyCode.Return;
                UI.focusedControlName = GUI.GetNameOfFocusedControl();
                if (caughtException != null)
                {
                    UI.Label("ERROR".red().bold() + $": caught exception {caughtException}");
                    UI.ActionButton("Reset".orange().bold(), () => { ResetGUI(modEntry); }, UI.AutoWidth());
                    return;
                }
#if false
                using (UI.HorizontalScope()) {
                    UI.Label("Suggestions or issues click ".green(), UI.AutoWidth());
                    UI.LinkButton("here", "https://github.com/cabarius/ToyBox/issues");
                    UI.Space(50);
                    UI.Label("Chat with the Authors, Narria et all on the ".green(), UI.AutoWidth());
                    UI.LinkButton("WoTR Discord", "https://discord.gg/wotr");
                }
#endif
                UI.TabBar(ref settings.selectedTab,
                          () => {
                    if (BlueprintLoader.Shared.IsLoading)
                    {
                        UI.Label("Blueprints".orange().bold() + " loading: " + BlueprintLoader.Shared.progress.ToString("P2").cyan().bold());
                    }
                    else
                    {
                        UI.Space(25);
                    }
                },
                          new NamedAction("Bag of Tricks", () => BagOfTricks.OnGUI()),
                          new NamedAction("Level Up", () => LevelUp.OnGUI()),
                          new NamedAction("Party", () => PartyEditor.OnGUI()),
                          new NamedAction("Loot", () => PhatLoot.OnGUI()),
                          new NamedAction("Enchantment", () => EnchantmentEditor.OnGUI()),
#if false
                          new NamedAction("Playground", () => Playground.OnGUI()),
#endif
                          new NamedAction("Search 'n Pick", () => BlueprintBrowser.OnGUI()),
                          new NamedAction("Crusade", () => CrusadeEditor.OnGUI()),
                          new NamedAction("Armies", () => ArmiesEditor.OnGUI()),
                          new NamedAction("Events/Decrees", () => EventEditor.OnGUI()),
                          new NamedAction("Etudes", () => EtudesEditor.OnGUI()),
                          new NamedAction("Quests", () => QuestEditor.OnGUI()),
                          new NamedAction("Settings", () => SettingsUI.OnGUI())
                          );
            }
            catch (Exception e) {
                Console.Write($"{e}");
                caughtException = e;
            }
        }
Пример #11
0
    //int selectedTexture;
    public override void OnInspectorGUI()
    {
        EditorGUI.BeginChangeCheck();

        serializedObject.Update();

        SerializedProperty cell       = serializedObject.FindProperty("destination");
        SerializedProperty modep      = serializedObject.FindProperty("mode");
        SerializedProperty gep        = serializedObject.FindProperty("sge");
        SerializedProperty checkablep = serializedObject.FindProperty("checkable");

        EditorGUILayout.PropertyField(cell);

        modep.intValue = GUILayout.Toolbar(modep.intValue, new string[] { "Always", "Event trigger", "Checkable" });

        switch (modep.intValue)
        {
        case 1: {
            SerializableGameEvent ge = gep.objectReferenceValue as SerializableGameEvent;

            if (ge == null)
            {
                ge = ScriptableObject.CreateInstance <SerializableGameEvent> ();
            }

            string[] editors        = EventEditorFactory.Intance.CurrentEventEditors;
            int      editorSelected = 0;
            if (ge.Name == null)
            {
                ge.Name = "";
            }
            for (int i = 1; i < editors.Length; i++)
            {
                if (editors [i].ToLower() == ge.Name.ToLower())
                {
                    editorSelected = i;
                }
            }
            int was = editorSelected;

            editorSelected = EditorGUILayout.Popup(editorSelected, EventEditorFactory.Intance.CurrentEventEditors);
            if (was != editorSelected && editorSelected == 0)
            {
                ge.Name = "";
            }
            EventEditor editor = EventEditorFactory.Intance.createEventEditorFor(editors[editorSelected]);
            editor.useEvent(ge);

            editor.draw();
            ge = editor.Result;

            gep.objectReferenceValue = ge;
        }
        break;

        case 2: {
            Checkable c              = (Checkable)checkablep.objectReferenceValue;
            string[]  editors        = ForkEditorFactory.Intance.CurrentForkEditors;
            int       editorSelected = EditorGUILayout.Popup(
                ForkEditorFactory.Intance.ForkEditorIndex(c),
                ForkEditorFactory.Intance.CurrentForkEditors
                );

            ForkEditor editor = ForkEditorFactory.Intance.createForkEditorFor(editors[editorSelected]);

            editor.useFork(c);

            editor.draw();

            checkablep.objectReferenceValue = editor.Result;
        } break;
        }


        if (EditorGUI.EndChangeCheck())
        {
        }

        serializedObject.ApplyModifiedProperties();
    }
Пример #12
0
 static void Init()
 {
     upIcon   = (Texture)AssetDatabase.LoadAssetAtPath(IconPath + "upIcon.png", typeof(Texture));
     downIcon = (Texture)AssetDatabase.LoadAssetAtPath(IconPath + "downIcon.png", typeof(Texture));
     EventEditor window = (EventEditor)EditorWindow.GetWindow(typeof(EventEditor));
 }
Пример #13
0
    private static void CreateWindow()
    {
        EventEditor window = EditorWindow.GetWindow <EventEditor>();

        window.Show();
    }