示例#1
0
        /// <summary>
        ///     Event handler for the DoWork function in the download file BackgroundWorker
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Help_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                ///Initiate an FTP request
                FtpWebRequest request = (FtpWebRequest)WebRequest.Create($"ftp://{Properties.Settings.Default.IP}/config.xml");
                request.Timeout     = 10000;
                request.Method      = WebRequestMethods.Ftp.DownloadFile;
                request.Credentials = new NetworkCredential("anonymous", "");

                string lines = null;

                using (var reader = new StreamReader(request.GetResponse().GetResponseStream()))
                    lines = reader.ReadToEnd();

                ///Get the XML Text of the file on the RoboRIO
                MainEditor.Dispatcher.Invoke(DispatcherPriority.Normal,
                                             new Action(() => { MainEditor.Clear(); MainEditor.AppendText(lines); }));

                FtpWebResponse response = (FtpWebResponse)request.GetResponse();

                response.Close();
                MessageBox.Show($"{response.StatusDescription}", "Download", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            catch (Exception ex)
            {
                MessageBox.Show($"Exception thrown in connection\n{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                MessageBox.Show($"Download Failed", "Fail", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
示例#2
0
        public void GotoNext()
        {
            if (this.Diff == null)
            {
                return;
            }
            MainEditor.GrabFocus();

            int line = MainEditor.Caret.Line;
            int max = -1, searched = -1;

            foreach (var hunk in LeftDiff)
            {
                max = System.Math.Max(hunk.InsertStart, max);
                if (hunk.InsertStart < line)
                {
                    searched = System.Math.Max(hunk.InsertStart, searched);
                }
            }
            if (max >= 0)
            {
                MainEditor.Caret.Line = searched < 0 ? max : searched;
                MainEditor.CenterToCaret();
            }
        }
        /// <summary>
        /// Save current file
        /// </summary>
        /// <param name="saveAs">true: show save as diaglog</param>
        /// <param name="newEncoding">not null: use new encoding to save file</param>
        /// <returns>true : if file saved</returns>
        public bool SaveFile(bool saveAs, Encoding newEncoding = null)
        {
            string filePath2Save = CurrentFilePath;

            if (string.IsNullOrEmpty(CurrentFilePath) || saveAs)
            {
                filePath2Save = NewFilePath(CurrentFilePath);
                if (filePath2Save == null)
                {
                    return(false);
                }
            }

            if (newEncoding != null)
            {
                MainEditor.Encoding = newEncoding;
            }
            MainEditor.Save(filePath2Save);
            if (CurrentFilePath != filePath2Save)
            {
                UpdateLastUsedFile(filePath2Save);
            }

            UpdateEditor(filePath2Save);
            DocumentSavedEvent?.Invoke();
            return(true);
        }
示例#4
0
        Tuple <List <Cairo.Rectangle>, List <Cairo.Rectangle> > GetDiffPaths(List <Mono.TextEditor.Utils.Hunk> diff, TextEditor editor, Hunk hunk)
        {
            if (!diffCache.ContainsKey(diff))
            {
                diffCache[diff] = new Dictionary <Hunk, Tuple <List <Cairo.Rectangle>, List <Cairo.Rectangle> > > ();
            }
            var pathCache = diffCache[diff];

            Tuple <List <Cairo.Rectangle>, List <Cairo.Rectangle> > result;

            if (pathCache.TryGetValue(hunk, out result))
            {
                return(result);
            }

            var words    = BreakTextInWords(editor, hunk.RemoveStart, hunk.Removed);
            var cmpWords = BreakTextInWords(MainEditor, hunk.InsertStart, hunk.Inserted);

            var wordDiff = new List <Hunk> (Diff.GetDiff(words.Select(w => editor.GetTextAt(w)).ToArray(),
                                                         cmpWords.Select(w => MainEditor.GetTextAt(w)).ToArray()));

            result = Tuple.Create(CalculateChunkPath(editor, wordDiff, words, true),
                                  CalculateChunkPath(MainEditor, wordDiff, cmpWords, false));

            pathCache[hunk] = result;
            return(result);
        }
示例#5
0
        public void GotoPrev()
        {
            if (this.Diff == null)
            {
                return;
            }
            MainEditor.GrabFocus();

            int line = MainEditor.Caret.Line;
            int min = Int32.MaxValue, searched = Int32.MaxValue;

            foreach (var hunk in this.LeftDiff)
            {
                min = System.Math.Min(hunk.InsertStart, min);
                if (hunk.InsertStart > line)
                {
                    searched = System.Math.Min(hunk.InsertStart, searched);
                }
            }
            if (min < Int32.MaxValue)
            {
                MainEditor.Caret.Line = searched == Int32.MaxValue ? min : searched;
                MainEditor.CenterToCaret();
            }
        }
示例#6
0
文件: ToolMenu.cs 项目: PipeRift/Yume
 private void UpdateItems()
 {
     if (MainEditor.IsSetup())
     {
         itemTypes = GetDB().GetNames().ToArray();
     }
 }
        private void OnEnable()
        {
            Target = (SocketBehaviour)target;

            MainEditor.LoadAddons(Target, AddOnTarget.SocketBehaviour);

            Target.PartOffsets = Target.PartOffsets.ToList().OrderBy(item => item.Part.Id).ToList();
        }
示例#8
0
        public AutomatedTestingSuite(MainEditor editor)
        {
            InitializeComponent();
            _mainEditor = editor;

            //ToDo: We should really use a BackgroundWorker class/thread and do the
            //work there, then push progress updates to the UI via the ReportProgress
            //method. This will keep the UI (and the cancel button xD) responsive.
        }
示例#9
0
        public AutomatedTestingSuite(MainEditor editor)
        {
            InitializeComponent();
            _mainEditor = editor;

            //ToDo: We should really use a BackgroundWorker class/thread and do the
            //work there, then push progress updates to the UI via the ReportProgress
            //method. This will keep the UI (and the cancel button xD) responsive.
        }
示例#10
0
    static void Init()
    {
        MainEditor window = (MainEditor)EditorWindow.GetWindow(typeof(MainEditor));

        window.position = new Rect(0, 20, 800, 400);
        window.Crear();

        window.Show();
    }
示例#11
0
    public static void Init()
    {
        try
        {
            if (!IsForIntegration)
            {
                if (!EditorUtility.DisplayDialog("Easy Build System - Quick Start",
                                                 "The Quick Start function allows you to use the default placement system with the default settings.\n\n" +
                                                 "You will find more information on this function in the documentation included in the system.\n\n" +
                                                 "If you Check that your scene contains a Main Camera.\n\n" +
                                                 "Do you want run the Quick Start?", "Yes", "No"))
                {
                    return;
                }
            }

            if (Camera.main != null)
            {
                if (FindObjectOfType <DesktopBuilderBehaviour>() == null)
                {
                    Camera.main.gameObject.AddComponent <DesktopBuilderBehaviour>();
                }
                else
                {
                    Debug.LogError("<b><color=red>[Easy Build System]</color></b> : The component <b>Desktop Builder Behaviour</b> already exists.");

                    return;
                }
            }

            MainEditor.CheckLayers();

            GameObject ResourceManager = (GameObject)Resources.Load("Prefabs/" + MANAGER_PREFAB_NAME);

            if (ResourceManager == null)
            {
                Debug.LogError("<b><color=red>[Easy Build System]</color></b> : The gameObject with the name (Easy Build System - Build Manager) does not exists !");

                return;
            }

            GameObject Manager = Instantiate(ResourceManager);

            Manager.name = MANAGER_PREFAB_NAME;

            if (!IsForIntegration)
            {
                Debug.Log("<b><color=cyan>[Easy Build System]</color></b> : You can now use the system with the default settings !");
            }

            IsForIntegration = false;
        }
        catch (Exception ex)
        {
            Debug.LogError("<b><color=red>[Easy Build System]</color></b> : " + ex.Message);
        }
    }
示例#12
0
        internal void InitToolbar(MainEditor editor)
        {
            _editor = editor;
            _toolbarList.Add(new ToolbarStandard());

            foreach (var bar in _toolbarList)
            {
                bar.InitToolbar(editor);
            }
        }
示例#13
0
        internal void InitMainMenu(MainEditor editor)//DevExpress.XtraBars.BarManager barMgr, DevExpress.XtraBars.Bar menuBar)
        {
            _editor = editor;
            _menuGroupList.Add(new MenuGroupFile());

            foreach (var group in _menuGroupList)
            {
                group.InitMenu(editor);
            }
        }
示例#14
0
文件: PanelFind.cs 项目: radtek/Tools
        internal override void InitializeComponent(MainEditor editor)
        {
            _editor = editor;

            // _listFind
            this._listFind.BackColor = System.Drawing.SystemColors.Window;
            this._listFind.Dock      = System.Windows.Forms.DockStyle.Fill;
            this._listFind.Location  = new System.Drawing.Point(0, 0);
            this._listFind.Name      = "_listFind";
            this._listFind.Size      = new System.Drawing.Size(799, 82);
            this._listFind.TabIndex  = 4;
            this._listFind.Text      = "";
            InitializeCtrl(this._listFind, "Find", $"Find", DevExpress.XtraBars.Docking.DockingStyle.Bottom);
        }
示例#15
0
        internal override void InitializeComponent(MainEditor editor)
        {
            _editor = editor;

            // _tree
            this._tree.AllowDrop     = true;
            this._tree.Dock          = System.Windows.Forms.DockStyle.Fill;
            this._tree.HideSelection = false;
            this._tree.LineColor     = System.Drawing.Color.Empty;
            this._tree.Location      = new System.Drawing.Point(0, 0);
            this._tree.Name          = "_tree";
            this._tree.Size          = new System.Drawing.Size(228, 277);
            this._tree.TabIndex      = 1;
            InitializeCtrl(this._tree, "Solution", DevExpress.XtraBars.Docking.DockingStyle.Left);
        }
示例#16
0
        internal override void InitializeComponent(MainEditor editor)
        {
            _editor = editor;

            // _output
            this._output.BackColor = System.Drawing.SystemColors.Window;
            this._output.Dock      = System.Windows.Forms.DockStyle.Fill;
            this._output.Location  = new System.Drawing.Point(0, 0);
            this._output.Name      = "_output";
            this._output.ReadOnly  = true;
            this._output.Size      = new System.Drawing.Size(799, 82);
            this._output.TabIndex  = 3;
            this._output.Text      = "";
            InitializeCtrl(this._output, "Output", $"Output", DevExpress.XtraBars.Docking.DockingStyle.Bottom);
        }
示例#17
0
        protected override void InitMenuButton()
        {
            // File
            _itemGroup = new DevExpress.XtraBars.BarSubItem()
            {
                Caption = "File (&F)",
                Name    = "File",
                Id      = MainEditor.GetItemID()
            };
            _editor.BarMgr.Items.Add(this._itemGroup);
            _editor.BarMgr.MainMenu.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(this._itemGroup));

            // Button Menu
            InitMenuButton("New Solution (&N)", "NewSolution");
            InitMenuButton("Quit (&X)", "Quit", true, new DevExpress.XtraBars.BarShortcut(System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4));
        }
示例#18
0
        internal override void InitializeComponent(MainEditor editor)
        {
            _editor = editor;

            // _propertyGrid
            this._propertyGrid.BackColor             = System.Drawing.SystemColors.Control;
            this._propertyGrid.Dock                  = System.Windows.Forms.DockStyle.Fill;
            this._propertyGrid.ImeMode               = System.Windows.Forms.ImeMode.Off;
            this._propertyGrid.Location              = new System.Drawing.Point(0, 0);
            this._propertyGrid.Name                  = "_propertyGrid";
            this._propertyGrid.Size                  = new System.Drawing.Size(199, 554);
            this._propertyGrid.TabIndex              = 0;
            this._propertyGrid.PropertyValueChanged += new System.Windows.Forms.PropertyValueChangedEventHandler(this._propertyGrid_PropertyValueChanged);
            this._propertyGrid.Enter                += new System.EventHandler(this._propertyGrid_Enter);
            InitializeCtrl(this._propertyGrid, "Property", DevExpress.XtraBars.Docking.DockingStyle.Right);
        }
示例#19
0
        private static void InsertPanels(MainEditor editor, List <PanelControl> panels)
        {
            if (panels.Count <= 0)
            {
                return;
            }
            if (panels.Count == 1)
            {
                ((System.ComponentModel.ISupportInitialize)(editor.DockMgr)).BeginInit();
                editor.Controls.Add(panels[0].DockPanel);
                editor.DockMgr.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] {
                    panels[0].DockPanel
                });
                ((System.ComponentModel.ISupportInitialize)(editor.DockMgr)).EndInit();
            }
            else
            {
                DevExpress.XtraBars.Docking.DockPanel dockPanel = new DevExpress.XtraBars.Docking.DockPanel();
                ((System.ComponentModel.ISupportInitialize)(editor.DockMgr)).BeginInit();
                dockPanel.SuspendLayout();

                foreach (var panel in panels)
                {
                    dockPanel.Controls.Add(panel.DockPanel);
                }
                dockPanel.ActiveChild  = panels[0].DockPanel;
                dockPanel.Dock         = panels[0].DockPanel.Dock;
                dockPanel.ID           = Guid.NewGuid();
                dockPanel.Location     = new System.Drawing.Point(3, 25);
                dockPanel.Name         = "_dockPanel";
                dockPanel.OriginalSize = new System.Drawing.Size(199, 224);
                dockPanel.Size         = new System.Drawing.Size(199, 224);
                dockPanel.Tabbed       = true;
                dockPanel.Text         = "";

                editor.Controls.Add(dockPanel);
                editor.DockMgr.RootPanels.AddRange(new DevExpress.XtraBars.Docking.DockPanel[] {
                    dockPanel
                });

                dockPanel.ResumeLayout(false);
                ((System.ComponentModel.ISupportInitialize)(editor.DockMgr)).EndInit();
            }
        }
示例#20
0
        protected DevExpress.XtraBars.BarButtonItem InitMenuButton(string caption, string name, bool bGroup = false, DevExpress.XtraBars.BarShortcut st = null)
        {
            DevExpress.XtraBars.BarButtonItem btItem = new DevExpress.XtraBars.BarButtonItem()
            {
                Caption = caption,
                Name    = name,
                Id      = MainEditor.GetItemID()
            };
            if (st != null)
            {
                btItem.ItemShortcut = st;
            }
            btItem.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ButtonItemClick);

            _editor.BarMgr.Items.Add(btItem);
            _itemGroup.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(btItem, bGroup));
            _itemList.Add(btItem);
            return(btItem);
        }
示例#21
0
文件: PanelMgr.cs 项目: radtek/Tools
        internal void InitPanels(MainEditor editor)
        {
            List <PanelControl> lefts   = new List <PanelControl>();
            List <PanelControl> rights  = new List <PanelControl>();
            List <PanelControl> tops    = new List <PanelControl>();
            List <PanelControl> buttoms = new List <PanelControl>();

            AddPanel add_panel = p => { p.InitializeComponent(editor); _mpPanel[p.DockPanel.Name] = p; };

            add_panel(new PanelSolution());
            add_panel(new PanelProperty());
            add_panel(new PanelOutput());
            add_panel(new PanelFind());

            foreach (var item in _mpPanel)
            {
                var ctrl = item.Value;
                switch (ctrl.DockPanel.Dock)
                {
                case DevExpress.XtraBars.Docking.DockingStyle.Left:
                    lefts.Add(ctrl);
                    break;

                case DevExpress.XtraBars.Docking.DockingStyle.Right:
                    rights.Add(ctrl);
                    break;

                case DevExpress.XtraBars.Docking.DockingStyle.Top:
                    tops.Add(ctrl);
                    break;

                case DevExpress.XtraBars.Docking.DockingStyle.Bottom:
                    buttoms.Add(ctrl);
                    break;
                }
            }

            InsertPanels(editor, lefts);
            InsertPanels(editor, rights);
            InsertPanels(editor, tops);
            InsertPanels(editor, buttoms);
        }
        public void Load(string filePath, Encoding encoding = null)
        {
            LoadFileInfo(filePath);

            if (!IsEditorViewLoaded)
            {
                CurrentFilePath = filePath;
            }
            else if ((filePath != null) && File.Exists(filePath))
            {
                GherkinFileInfo fileInfo = m_AppSettings.GetFileInfo(filePath);
                MainEditor.Encoding = encoding ?? GetEncoding(fileInfo);
                MainEditor.Load(filePath);
                HideHSplitView = !NeedShowHSplitView(filePath);
                HideVSplitView = !NeedShowVSplitView(filePath);
                m_AppSettings.UpdateCodePage(filePath, MainEditor.Encoding.CodePage);
                ScrollCursorTo(fileInfo.CursorLine, fileInfo.CursorColumn);
                EventAggregator <FileLoadedArg> .Instance.Publish(this, new FileLoadedArg());

                UpdateEditor(filePath);
                UpdateFoldingsByDefault();
            }
        }
示例#23
0
        protected DevExpress.XtraBars.BarButtonItem InitToolButton(string caption, string name, Image image, bool bGroup = false, DevExpress.XtraBars.BarShortcut st = null)
        {
            DevExpress.XtraBars.BarButtonItem item = new DevExpress.XtraBars.BarButtonItem()
            {
                Name    = name,
                Caption = caption,
                //Hint = "新建",  // exception because font is wrong, i don't know why yet
                Id = MainEditor.GetItemID()
            };
            if (image != null)
            {
                item.Glyph = image;
            }
            if (st != null)
            {
                item.ItemShortcut = st;
            }
            item.ItemClick += new DevExpress.XtraBars.ItemClickEventHandler(this.ButtonItemClick);

            _editor.BarMgr.Items.Add(item);
            _itemGroup.LinksPersistInfo.Add(new DevExpress.XtraBars.LinkPersistInfo(item, bGroup));
            _itemList.Add(item);
            return(item);
        }
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);

            #region Inspector

            GUILayout.BeginVertical("Easy Build System - Android Builder Behaviour", "window", GUILayout.Height(10));

            GUILayout.BeginVertical("box");

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.BeginHorizontal();

            GUILayout.Label("Android Builder Behaviour Settings", EditorStyles.largeLabel);

            #region Builder Behaviour Settings

            if (GUILayout.Button(DefaultInspector ? "Advanced Inspector" : "Default Inspector", GUILayout.Width(130)))
            {
                DefaultInspector = !DefaultInspector;
            }

            if (GUILayout.Button(AllIsOpen ? "Fold In" : "Fold Out", GUILayout.Width(80)))
            {
                BaseFoldout    = !BaseFoldout;
                ModesFoldout   = !ModesFoldout;
                PreviewFoldout = !PreviewFoldout;
                InputsFoldout  = !InputsFoldout;
                AudioFoldout   = !AudioFoldout;
                AddonsFoldout  = !AddonsFoldout;
                AllIsOpen      = !AllIsOpen;
            }

            if (GUILayout.Button(Help ? "Hide Help" : "Show Help", GUILayout.Width(100)))
            {
                Help = !Help;
            }

            GUI.color = Color.white;

            GUILayout.EndHorizontal();

            if (Help)
            {
                EditorGUILayout.HelpBox("This component contains all the behaviours whose can be executed by the player during the runtime on mobile.\n" +
                                        "It require the Build Manager prefab in the scene with an Parts Collection, otherwise it will be useless.\n" +
                                        "Note : Also check that this component is only present once in your scene, otherwise it can cause problems.", MessageType.Info);

                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Open Documentation Link"))
                {
                    Application.OpenURL(Constants.DOCS_LINK);
                }

                GUI.color = Color.white;
            }

            if (DefaultInspector)
            {
                DrawDefaultInspector();

                GUILayout.EndVertical();

                GUILayout.EndVertical();

                serializedObject.ApplyModifiedProperties();

                GUILayout.Space(10);

                return;
            }

            GUI.enabled = false;

            EditorGUILayout.ObjectField("Script", target, typeof(BuilderBehaviour), true);

            GUI.enabled = true;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            BaseFoldout = EditorGUILayout.Foldout(BaseFoldout, "Base Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (BaseFoldout)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("CameraType"), new GUIContent("Camera Placement Type :", "This allows to define the raycast origin type.\n" +
                                                                                                          "First Person : The raycast origin come from camera center.\n" +
                                                                                                          "Top Down : The raycast origin come from mouse position.\n" +
                                                                                                          "Third Person : The raycast origin come from reference Transform Point."));

                if (((RayType)serializedObject.FindProperty("CameraType").enumValueIndex) == RayType.TopDown)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("RaycastAnchorTransform"), new GUIContent("Top Down Anchor Transform :", "This allows to define the origin transform where the ray will be sent (Optional)."));
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("SnapThreshold"), new GUIContent("Top Down Snap Threshold :", "This allows to define the threshold distance on which the preview can will be moved in allowed status."));
                }
                else if (((RayType)serializedObject.FindProperty("CameraType").enumValueIndex) == RayType.ThirdPerson)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("RaycastOriginTransform"), new GUIContent("Third Person Origin Transform :", "This allows to define the origin transform where the ray will be sent."));
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("ActionDistance"), new GUIContent("Raycast Placement Distance :", "This allows to define the maximum distance on which the preview can will be moved in allowed status."));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("OutOfRangeDistance"), new GUIContent("Raycast Out Of Range  Distance :", "This allows to define the maximum out of range distance on which the preview can will be moved in denied status. (0 = Use only Placement Distance)"));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("RayDetection"), new GUIContent("Raycast Detection Type :", "This allows to define the accuracy raycast type.\nIt is advisable to use the following types :\nLine if you've sockets with the type (Attachment).\nOverlap if you've sockets with the type (Point)."));

                if (serializedObject.FindProperty("RayDetection").enumValueIndex == (int)DetectionType.Overlap)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("OverlapAngles"), new GUIContent("Raycast Overlap Angles :", "This allows to define the maximum angles to detect the sockets."));
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("RaycastOffset"), new GUIContent("Raycast Forward Offset :", "This allows to define the raycast offset on axis (Z)."));
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Builder Behaviour Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Builder Modes Settings", EditorStyles.largeLabel);

            #region Builder Modes Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            ModesFoldout = EditorGUILayout.Foldout(ModesFoldout, "Modes Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (ModesFoldout)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("UsePlacementMode"), new GUIContent("Use Placement Mode :", "This allows to allow the placement mode."));

                if (serializedObject.FindProperty("UsePlacementMode").boolValue)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ResetModeAfterPlacement"), new GUIContent("Reset Mode After Placement Action :", "This allows to reset the mode to (None) after the placement."));
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("UseDestructionMode"), new GUIContent("Use Destruction Mode :", "This allows to allow the destruction mode."));

                if (serializedObject.FindProperty("UseDestructionMode").boolValue)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("ResetModeAfterDestruction"), new GUIContent("Reset Mode After Destruction Action :", "This allows to reset the mode to (None) after the destruction."));
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("UseEditionMode"), new GUIContent("Use Edition Mode :", "This allows to allow the edition mode."));
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Builder Modes Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Builder Preview Settings", EditorStyles.largeLabel);

            #region Builder Preview Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            PreviewFoldout = EditorGUILayout.Foldout(PreviewFoldout, "Preview Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (PreviewFoldout)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("UsePreviewCamera"), new GUIContent("Use Through Preview :", "This allows to use the preview camera, this will allows to see through the mesh like terrain details."));

                if (serializedObject.FindProperty("UsePreviewCamera").boolValue)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewCamera"), new GUIContent("Through Preview Camera :", "This allows to define the preview camera will be used."));

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewLayer"), new GUIContent("Through Preview Layer :", "This allows to define the preview layer that the camera can see."), true);
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("LockRotation"), new GUIContent("Lock Preview Rotation :", "This allows to make that the preview look the camera rotation."));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewMovementOnlyAllowed"), new GUIContent("Preview Movement Only Possible :", "This allows to move the preview only if has not collider."));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewMovementType"), new GUIContent("Preview Movement Type :", "This allows to define the preview movement type."));

                if ((MovementType)serializedObject.FindProperty("PreviewMovementType").enumValueIndex == MovementType.Smooth)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewSmoothTime"), new GUIContent("Preview Movement Smooth Time :", "This allows to define the smooth time movement."));
                }

                if ((MovementType)serializedObject.FindProperty("PreviewMovementType").enumValueIndex == MovementType.Grid)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewGridSize"), new GUIContent("Preview Grid Size :", "This allows to define the grid size on which the preview will be moved."));

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("PreviewGridOffset"), new GUIContent("Preview Grid Offset :", "This allows to define the grid offset for the preview position."));
                }
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Builder Preview Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Builder Audio Settings", EditorStyles.largeLabel);

            #region Builder Audio Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            AudioFoldout = EditorGUILayout.Foldout(AudioFoldout, "Audio Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            GUI.color = Color.white;

            if (AudioFoldout)
            {
                EditorGUILayout.HelpBox("To use the placements and destructions sounds, add below your Audio Source component also that the clips.\n" +
                                        "If the Audio Source field is empty, no clips will be played during the runtime.", MessageType.Warning);

                EditorGUILayout.PropertyField(serializedObject.FindProperty("Source"), new GUIContent("Audio Source :", "This source is the source on which the sounds will be played."));

                GUILayout.BeginHorizontal();

                GUILayout.Space(13);

                EditorGUILayout.PropertyField(serializedObject.FindProperty("PlacementClips"), new GUIContent("Placement Audio Sound(s) :", "Placement clips at play when a preview is placed (Played randomly)."), true);

                GUILayout.EndHorizontal();

                GUILayout.BeginHorizontal();

                GUILayout.Space(13);

                EditorGUILayout.PropertyField(serializedObject.FindProperty("DestructionClips"), new GUIContent("Destructions Audio Sound(s) :", "Destruction clips at play when a part is destroyed (Played randomly."), true);

                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Builder Audio Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Builder Add-Ons Settings", EditorStyles.largeLabel);

            #region Builder Add-Ons Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            AddonsFoldout = EditorGUILayout.Foldout(AddonsFoldout, "Add-Ons Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (AddonsFoldout)
            {
                MainEditor.DrawAddons(Target, AddOnTarget.BuilderBehaviour);
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Builder Add-Ons Settings

            GUILayout.EndVertical();

            GUILayout.EndVertical();

            #endregion Inspector

            serializedObject.ApplyModifiedProperties();

            GUILayout.Space(10);
        }
        private void OnEnable()
        {
            Target = (BuilderBehaviour)target;

            MainEditor.LoadAddons(Target, AddOnTarget.BuilderBehaviour);
        }
示例#26
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);

            #region Inspector

            GUILayout.BeginVertical("Easy Build System - Socket Behaviour", "window", GUILayout.MaxHeight(10));

            GUILayout.BeginVertical("box");

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.BeginHorizontal();

            GUILayout.Label("Socket Behaviour Settings", EditorStyles.largeLabel);

            #region Socket Behaviour Settings

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(DefaultInspector ? "Advanced Inspector" : "Default Inspector", GUILayout.Width(130)))
            {
                DefaultInspector = !DefaultInspector;
            }

            if (GUILayout.Button(AllIsOpen ? "Fold In" : "Fold Out", GUILayout.Width(80)))
            {
                BaseFoldout    = !BaseFoldout;
                OffsetsFoldout = !OffsetsFoldout;
                AddonsFoldout  = !AddonsFoldout;
                AllIsOpen      = !AllIsOpen;
            }

            if (GUILayout.Button(Help ? "Hide Help" : "Show Help", GUILayout.Width(100)))
            {
                Help = !Help;
            }

            GUI.color = Color.white;

            GUILayout.EndHorizontal();

            if (Help)
            {
                EditorGUILayout.HelpBox("This component allows to snap with the Builder Behaviour the Parts Behaviour according the offset settings during the runtime.\n" +
                                        "Sockets can cause problems if they are misconfigured, If it disable off unnaturally, please change their offset or radius.", MessageType.Info);

                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Open Documentation Link"))
                {
                    Application.OpenURL(Constants.DOCS_LINK);
                }

                GUI.color = Color.white;
            }

            if (DefaultInspector)
            {
                DrawDefaultInspector();

                GUILayout.EndVertical();

                GUILayout.EndVertical();

                serializedObject.ApplyModifiedProperties();

                GUILayout.Space(10);

                return;
            }

            GUI.enabled = false;

            EditorGUILayout.ObjectField("Script", target, typeof(SocketBehaviour), true);

            GUI.enabled = true;

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            BaseFoldout = EditorGUILayout.Foldout(BaseFoldout, "Base Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (BaseFoldout)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Type"), new GUIContent("Socket Type :", "This allows to define the socket type."));

                if ((SocketType)serializedObject.FindProperty("Type").enumValueIndex == SocketType.Socket)
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("Radius"), new GUIContent("Socket Radius :", "This allows to define the socket radius point.\nYou can decrease the socket radius to improve the precision during the detection."));
                }
                else
                {
                    EditorGUILayout.PropertyField(serializedObject.FindProperty("AttachmentBounds"), new GUIContent("Socket Attachment Bounds :", "This allows to define the attachment bounds."));
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("DisableOnGroundContact"), new GUIContent("Disable On Terrain/Surface Contact :", "This allows to define if the socket will be disable if she's entering in collision with the terrain or the surface."));
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Socket Behaviour Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Socket Offset(s) Settings", EditorStyles.largeLabel);

            #region Socket Offsets Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            OffsetsFoldout = EditorGUILayout.Foldout(OffsetsFoldout, "Offsets Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (OffsetsFoldout)
            {
                GUILayout.BeginHorizontal();

                GUILayout.Space(13);

                GUILayout.BeginVertical();

                if (Target.PartOffsets.Count == 0)
                {
                    GUILayout.BeginHorizontal("box");

                    GUI.color = new Color(1.5f, 1.5f, 0f);

                    GUILayout.Label("The list does not contains of offset part(s), No part(s) will may be snap on it.");

                    GUI.color = Color.white;

                    GUILayout.EndHorizontal();
                }
                else
                {
                    int Index = 0;

                    foreach (PartOffset Offset in Target.PartOffsets)
                    {
                        if (Offset == null || Offset.Part == null)
                        {
                            Target.PartOffsets.Remove(Offset);

                            EditorUtility.SetDirty(target);

                            return;
                        }

                        GUILayout.BeginHorizontal("box");

                        GUILayout.BeginVertical();

                        GUILayout.BeginHorizontal();

                        GUILayout.Label("(ID:" + Offset.Part.Id + ") " + Offset.Part.Name, EditorStyles.largeLabel);

                        if (PreviewPart != null && int.Parse(PreviewPart.name) == Offset.Part.Id)
                        {
                            GUI.color = new Color(1.5f, 1.5f, 0f);

                            if (GUILayout.Button("Cancel Preview", GUILayout.Width(100)))
                            {
                                ClearPreview();
                            }
                        }
                        else
                        {
                            GUI.color = MainEditor.GetEditorColor;

                            if (GUILayout.Button("Preview Part", GUILayout.Width(100)))
                            {
                                ClearPreview();

                                CurrentOffset = Offset;

                                CreatePreview(Offset);
                            }
                        }

                        GUI.color = Color.white;

                        GUI.color = new Color(1.5f, 0, 0);

                        if (GUILayout.Button("Remove", GUILayout.Width(80)))
                        {
                            Target.PartOffsets.Remove(Offset);

                            ClearPreview();

                            return;
                        }

                        GUI.color = Color.white;

                        GUILayout.EndHorizontal();

                        GUILayout.Space(5);

                        EditorGUI.BeginChangeCheck();

                        Offset.Position       = EditorGUILayout.Vector3Field(new GUIContent("Offset Position : ", "This allows to set the position of part that will snapped on this socket."), Offset.Position);
                        Offset.Rotation       = EditorGUILayout.Vector3Field(new GUIContent("Offset Rotation : ", "This allows to set the rotation of part that will snapped on this socket."), Offset.Rotation);
                        Offset.UseCustomScale = EditorGUILayout.Toggle(new GUIContent("Offset Use Custom Scale : ", "This allows to define whether the part to be snap to this socket will have a specific scale, otherwise it will be the scale only of the part."), Offset.UseCustomScale);

                        if (Offset.UseCustomScale)
                        {
                            Offset.Scale = EditorGUILayout.Vector3Field(new GUIContent("Offset Scale : ", "This allows to define the specific scale of the part that will be snapped on this socket."), Offset.Scale);
                        }

                        if (EditorGUI.EndChangeCheck())
                        {
                            if (PreviewPart != null)
                            {
                                if (PreviewPart.name == Offset.Part.Id.ToString())
                                {
                                    PreviewPart.transform.position   = Target.transform.TransformPoint(Offset.Position);
                                    PreviewPart.transform.rotation   = Quaternion.Euler(Offset.Rotation);
                                    PreviewPart.transform.localScale = Offset.UseCustomScale ? Offset.Scale : (Target.transform.parent != null ? Target.transform.parent.localScale : Target.transform.localScale);
                                }

                                EditorUtility.SetDirty(target);
                            }
                        }

                        GUI.color = MainEditor.GetEditorColor;

                        if (!ShowPartOffsetEditor || CurrentOffset != Offset)
                        {
                            if (GUILayout.Button("Edit Offset Part"))
                            {
                                SceneHelper.Focus(target, DrawCameraMode.Textured);

                                if (PreviewPart != null)
                                {
                                    DestroyImmediate(PreviewPart);
                                }

                                CurrentOffsetIndex = Index;

                                CurrentOffset = Offset;

                                ShowPartOffsetEditor = true;
                            }
                        }
                        else if (CurrentOffset == Offset)
                        {
                            GUI.color = Color.white;

                            EditorGUILayout.HelpBox("The position, rotation as well as the scale of the current part displayed, will be exactly the same in runtime.", MessageType.Info);

                            GUI.color = new Color(0f, 1.5f, 1.5f);

                            if (GUILayout.Button("Close"))
                            {
                                SceneHelper.UnFocus();

                                ShowPartOffsetEditor = false;

                                Target.PartOffsets[CurrentOffsetIndex] = CurrentOffset;

                                EditorUtility.SetDirty(target);

                                Debug.Log("<b><color=cyan>[Easy Build System]</color></b> : The offsets changes were saved.");
                            }
                        }

                        GUI.color = Color.white;

                        GUILayout.Space(2);

                        GUILayout.EndVertical();

                        GUILayout.EndHorizontal();

                        Index++;
                    }
                }

                try
                {
                    GUILayout.BeginVertical("box");

                    GUILayout.BeginHorizontal();

                    PrefabField = (PartBehaviour)EditorGUILayout.ObjectField(new GUIContent("Base Part :", "Part at add to the list for the snap according to the offset on this socket in runtime."), PrefabField, typeof(PartBehaviour), false);

                    GUILayout.EndHorizontal();

                    GUILayout.BeginVertical();

                    GUI.enabled = PrefabField != null;

                    GUI.color = MainEditor.GetEditorColor;

                    if (GUILayout.Button("Add New Offset Part"))
                    {
                        if (PrefabField == null)
                        {
                            Debug.LogError("<b><color=cyan>[Easy Build System]</color></b> : Empty field.");
                            return;
                        }

                        if (Target.PartOffsets.Find(entry => entry.Part.Name == PrefabField.Name) == null)
                        {
                            ClearPreview();

                            PartOffset Offset = new PartOffset(PrefabField);

                            Target.PartOffsets.Add(Offset);

                            CurrentOffset = Offset;

                            CreatePreview(Offset);

                            PrefabField = null;

                            Repaint();
                        }
                        else
                        {
                            Debug.LogError("<b><color=cyan>[Easy Build System]</color></b> : This part already exists in the collection.");
                        }
                    }

                    GUI.color = Color.white;

                    GUI.enabled = true;

                    GUI.color = new Color(1.5f, 1.5f, 0f);

                    if (GUILayout.Button("Clear All Offset Part(s) List"))
                    {
                        if (EditorUtility.DisplayDialog("Easy Build System - Information", "Do you want remove all the offset part(s) from the collection ?", "Ok", "Cancel"))
                        {
                            Target.PartOffsets.Clear();

                            Debug.Log("<b><color=cyan>[Easy Build System]</color></b> : The collection has been clear !.");
                        }
                    }

                    GUI.color = Color.white;

                    GUILayout.EndVertical();

                    GUILayout.Space(3);

                    GUILayout.EndVertical();
                }
                catch { }

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Socket Offsets Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Socket Utilities Settings", EditorStyles.largeLabel);

            #region Socket Utilities Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            UtilitiesFoldout = EditorGUILayout.Foldout(UtilitiesFoldout, "Utilities Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (UtilitiesFoldout)
            {
                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Duplicate Socket (Inverse)"))
                {
                    GameObject Duplicate = Instantiate(Target.gameObject, Target.transform.parent);

                    Duplicate.name = Target.transform.name;

                    Vector3 Inverse = new Vector3(-Target.transform.localPosition.x, Target.transform.localPosition.y, -Target.transform.localPosition.z);

                    Duplicate.transform.localPosition = Inverse;

                    Selection.activeGameObject = Duplicate;
                }

                GUI.color = Color.white;
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Socket Utilities Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Socket Add-Ons Settings", EditorStyles.largeLabel);

            #region Socket Add-Ons Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            AddonsFoldout = EditorGUILayout.Foldout(AddonsFoldout, "Add-Ons Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (AddonsFoldout)
            {
                MainEditor.DrawAddons(Target, AddOnTarget.SocketBehaviour);
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Socket Add-Ons Settings

            GUILayout.EndVertical();

            GUILayout.EndVertical();

            #endregion Inspector

            GUILayout.Space(10);

            serializedObject.ApplyModifiedProperties();

            if (CurrentOffset != null)
            {
                if (PreviewPart != null)
                {
                    PreviewPart.transform.position = Target.transform.TransformPoint(CurrentOffset.Position);
                    PreviewPart.transform.rotation = Target.transform.rotation * Quaternion.Euler(CurrentOffset.Rotation);
                }
            }

            if (GUI.changed)
            {
                Target.PartOffsets = Target.PartOffsets.ToList().OrderBy(item => item.Part.Id).ToList();
            }
        }
示例#27
0
    public void Draw()
    {
        if (MainEditor.singletonInstance == null)
        {
            //GUILayout.Box ("Editting required the RPG Story editor to be opened");
            //return;
        }

        if (Application.isPlaying)
        {
            return;
        }

        ChatEventObject myTarget = (ChatEventObject)target;

        myTarget.assetType = (AssetType)EditorGUILayout.EnumPopup("Asset Type", myTarget.assetType);


        //MainEditor.singletonInstance.GetCharacterStrings ();
        string[] characterStrings = MainEditor.GetCharacterStrings(conversationList.characters, true, myTarget.assetType);

        if (myTarget.assetType == AssetType.story)
        {
            characterStrings = MainEditor.GetChaptersStrings(conversationList.stories [0].chapters, true);
        }

        myTarget.lastCharIndex = myTarget.characterIndex;

        myTarget.characterIndex++;
        myTarget.characterIndex = EditorGUILayout.Popup("", myTarget.characterIndex, characterStrings, GUILayout.Width(200));
        myTarget.characterIndex--;

        //Debug.Log (myTarget.characterIndex);

        if (myTarget.lastCharIndex != myTarget.characterIndex)
        {
            //Make sure your conversation is different now.
            Debug.Log("Character changed");

            myTarget.conversationEvents = new List <ChatEventObject.ConversationEvents> ();


            //You should instead have a library of characters

            ChatEventObject[] allEventCharacters = GameObject.FindObjectsOfType <ChatEventObject> ();

            List <ChatEventObject> listOfSameCharacters = new List <ChatEventObject> ();

            for (int i = 0; i < allEventCharacters.Length; i++)
            {
                if (allEventCharacters [i].characterIndex == myTarget.characterIndex)
                {
                    listOfSameCharacters.Add(allEventCharacters [i]);
                }
            }

            if (myTarget.characterIndex != -1)
            {
                if (myTarget.assetType == AssetType.story)
                {
                    myTarget.name = myTarget.characterIndex.ToString() + conversationList.stories [0].chapters [myTarget.characterIndex].name;
                }

                if (myTarget.assetType == AssetType.character)
                {
                    myTarget.name = conversationList.characters [myTarget.characterIndex].name;
                }

                //Debug.Log (listOfSameCharacters.Count + " " + conversationList.characters [myTarget.characterIndex].name + " in scene");
            }
            else
            {
                myTarget.name = "none";
            }

            //This is the second more later one
            if (listOfSameCharacters.Count >= 2)
            {
                for (int i = 0; i < listOfSameCharacters.Count; i++)
                {
                    if (listOfSameCharacters [i] != myTarget)
                    {
                        myTarget.conversationEvents = listOfSameCharacters [i].conversationEvents;
                        break;
                    }
                }
            }
        }


        //Check if character has changed and has updated (Copy the other ones)

        if (myTarget != null)
        {
            if (Selection.activeGameObject != myTarget.gameObject)
            {
                return;
            }
        }

        try {
            this.serializedObject.Update();

            #region CONVERSATION EVENTS
            List <ConversationList.Conversations> conversations = conversationList.characters [myTarget.characterIndex].conversations;

            //EditorGUILayout.PropertyField (this.serializedObject.FindProperty ("eventPages").GetArrayElementAtIndex (p), true);


            int count = this.serializedObject.FindProperty("conversationEvents").arraySize;

            //this.serializedObject.FindProperty ("conversationEvents").DeleteArrayElementAtIndex (0);



            if (conversations.Count > count)
            {
                ChatEventObject.ConversationEvents conversationEvent = new ChatEventObject.ConversationEvents();
                conversationEvent.name = "Conversation Events ";
                myTarget.conversationEvents.Add(conversationEvent);
            }

            if (count > conversations.Count)
            {
                myTarget.conversationEvents.RemoveAt(0);
            }

            for (int i = 0; i < count; i++)
            {
                SerializedProperty pageProp = this.serializedObject.FindProperty("conversationEvents").GetArrayElementAtIndex(i);
                SerializedProperty it       = pageProp.Copy();

                //EditorGUILayout.PropertyField (pageProp);

                #region PAGE EVENTS
                List <ConversationList.Pages> pages = conversationList.characters [myTarget.characterIndex].conversations [i].pages;


                while (myTarget.conversationEvents [i].eventPages.Count > pages.Count)
                {
                    myTarget.conversationEvents [i].eventPages.RemoveAt(myTarget.conversationEvents [i].eventPages.Count - 1);
                }


                while (it.Next(true))                    // or NextVisible, also, the bool argument specifies whether to enter on children or not
                //Debug.Log (it.name);
                {
                    if (it.name == "eventPages")
                    {
                        break;
                    }
                }

                //Draw page stuff here

                for (int p = 0; p < pages.Count; p++)
                {
                    if (myTarget.conversationEvents [i].eventPages.Count < pages.Count)
                    {
                        ChatEventObject.EventPages eventPage = new ChatEventObject.EventPages();
                        eventPage.name = "Page Events " + p;
                        //myTarget.conversationEvents [i].eventPages.Add (eventPage);
                    }

                    myTarget.conversationEvents [i].eventPages [p].name = "Event Page " + p.ToString();

                    /*
                     * GUILayout.Box ("Inspector Info");
                     * if (it.arraySize - 1 >= p)
                     *      EditorGUILayout.PropertyField (it.GetArrayElementAtIndex (p), true);
                     */
                }

                if (myTarget.eventPages.Count > pages.Count)
                {
                    myTarget.eventPages.Clear();
                }

                #endregion
            }
            #endregion

            //EditorGUILayout.PropertyField (this.serializedObject.FindProperty ("conversationEvents"), true);

            //Type type = obj.GetType ();
            //PropertyInfo[] properties = type.GetProperties ();

            EditorGUILayout.PropertyField(this.serializedObject.FindProperty("conversationEvents"), true);

            myTarget.onPageProp  = this.serializedObject.FindProperty("conversationEvents");
            myTarget.onStartProp = this.serializedObject.FindProperty("onStartEvents");
            myTarget.onEndProp   = this.serializedObject.FindProperty("onEndEvents");

            myTarget.onStartObject = this.serializedObject;
            this.serializedObject.ApplyModifiedProperties();
        } catch {
        }
    }
示例#28
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);

            #region Inspector

            GUILayout.BeginVertical("Easy Build System - Group Behaviour", "window", GUILayout.Height(10));

            GUILayout.BeginVertical("box");

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.BeginHorizontal();

            GUILayout.Label("Group Behaviour Settings", EditorStyles.largeLabel);

            #region Group Behaviour Settings

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(DefaultInspector ? "Advanced Inspector" : "Default Inspector", GUILayout.Width(130)))
            {
                DefaultInspector = !DefaultInspector;
            }

            if (GUILayout.Button(AllIsOpen ? "Fold In" : "Fold Out", GUILayout.Width(80)))
            {
                AddonsFoldout = !AddonsFoldout;
                AllIsOpen     = !AllIsOpen;
            }

            if (GUILayout.Button(Help ? "Hide Help" : "Show Help", GUILayout.Width(100)))
            {
                Help = !Help;
            }

            GUI.color = Color.white;

            GUILayout.EndHorizontal();

            if (Help)
            {
                EditorGUILayout.HelpBox("This component allows to save and load of Group Behaviour which contains of Parts Behaviour during the edit/runtime.\n" +
                                        "The data below can be shared and loaded if the Build Manager use the same Id's in the Parts Collection.", MessageType.Info);

                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Open Documentation Link"))
                {
                    Application.OpenURL(Constants.DOCS_LINK);
                }

                GUI.color = Color.white;
            }

            if (DefaultInspector)
            {
                DrawDefaultInspector();

                GUILayout.EndVertical();

                GUILayout.EndVertical();

                serializedObject.ApplyModifiedProperties();

                GUILayout.Space(10);

                return;
            }

            GUI.enabled = false;

            EditorGUILayout.ObjectField("Script", target, typeof(AreaBehaviour), true);

            GUI.enabled = true;

            GUI.color = Color.white;

            if (Application.isPlaying)
            {
                GUILayout.BeginHorizontal();

                GUILayout.BeginVertical();

                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Save As Blueprint..."))
                {
                    BlueprintData Data = ScriptableObjectExtension.CreateAsset <BlueprintData>("New Empty Blueprint");

                    Data.name  = Target.name;
                    Data.Model = Target.GetModel();
                    Data.Data  = Target.GetModel().EncodeToStr();

                    Debug.Log("<b><color=cyan>[Easy Build System]</color></b> : The blueprint model has been saved.");
                }

                if (GUILayout.Button("Destroy Group"))
                {
                    Destroy(Target.gameObject);

                    Debug.Log("<b><color=cyan>[Easy Build System]</color></b> : The group has been destroyed.");
                }

                GUI.enabled = true;

                GUI.color = Color.white;

                GUILayout.EndVertical();

                GUILayout.EndHorizontal();
            }

            #endregion Group Behaviour Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Group Add-On(s) Settings", EditorStyles.largeLabel);

            #region Group Add-Ons Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            AddonsFoldout = EditorGUILayout.Foldout(AddonsFoldout, "Add-Ons Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (AddonsFoldout)
            {
                MainEditor.DrawAddons(Target, AddOnTarget.GroupBehaviour);
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Group Add-Ons Settings

            GUILayout.EndVertical();

            GUILayout.EndVertical();

            #endregion Inspector

            serializedObject.ApplyModifiedProperties();

            GUILayout.Space(10);
        }
示例#29
0
    public CardModule(MainEditor mainEditor)
    {
        this.mainEditor = mainEditor;

        manager = (GameManager)GameObject.FindObjectOfType(typeof(GameManager));
    }
示例#30
0
        public override void OnInspectorGUI()
        {
            serializedObject.Update();

            GUILayout.Space(10);

            #region Inspector

            GUILayout.BeginVertical("Easy Build System - Area Behaviour", "window", GUILayout.Height(10));

            GUILayout.BeginVertical("box");

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.BeginHorizontal();

            GUILayout.Label("Area Behaviour Settings", EditorStyles.largeLabel);

            #region Area Behaviour Settings

            GUILayout.FlexibleSpace();

            if (GUILayout.Button(DefaultInspector ? "Advanced Inspector" : "Default Inspector", GUILayout.Width(130)))
            {
                DefaultInspector = !DefaultInspector;
            }

            if (GUILayout.Button(AllIsOpen ? "Fold In" : "Fold Out", GUILayout.Width(80)))
            {
                BaseFoldout   = !BaseFoldout;
                AddonsFoldout = !AddonsFoldout;
                AllIsOpen     = !AllIsOpen;
            }

            if (GUILayout.Button(Help ? "Hide Help" : "Show Help", GUILayout.Width(100)))
            {
                Help = !Help;
            }

            GUI.color = Color.white;

            GUILayout.EndHorizontal();

            if (Help)
            {
                EditorGUILayout.HelpBox("This component allow/deny the placement or the destruction according the radius during the runtime.\n" +
                                        "It can also attached as childs to avoid the close placement.", MessageType.Info);

                GUI.color = MainEditor.GetEditorColor;

                if (GUILayout.Button("Open Documentation Link"))
                {
                    Application.OpenURL(Constants.DOCS_LINK);
                }

                GUI.color = Color.white;
            }

            if (DefaultInspector)
            {
                DrawDefaultInspector();

                GUILayout.EndVertical();

                GUILayout.EndVertical();

                serializedObject.ApplyModifiedProperties();

                GUILayout.Space(10);

                return;
            }

            GUI.enabled = false;

            EditorGUILayout.ObjectField("Script", target, typeof(AreaBehaviour), true);

            GUI.enabled = true;

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            BaseFoldout = EditorGUILayout.Foldout(BaseFoldout, "Base Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (BaseFoldout)
            {
                EditorGUILayout.PropertyField(serializedObject.FindProperty("Radius"), new GUIContent("Area Radius :", "This allows to define the radius of area."));

                EditorGUILayout.PropertyField(serializedObject.FindProperty("AllowPlacement"), new GUIContent("Allow Placement In Area :", "This allows the placement in the area of part(s) from the collection below."));

                if (serializedObject.FindProperty("AllowPlacement").boolValue)
                {
                    GUILayout.BeginHorizontal();

                    GUILayout.Space(13);

                    EditorGUILayout.PropertyField(serializedObject.FindProperty("AllowPartPlacement"), new GUIContent("Allow Part(s) In Area :", "This allows to define the part(s) that can be placed."), true);

                    GUILayout.EndHorizontal();
                }

                EditorGUILayout.PropertyField(serializedObject.FindProperty("AllowDestruction"), new GUIContent("Allow Destruction In Area :", "This allows the destruction of all the part(s) in the area."));
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Area Behaviour Settings

            GUI.color = MainEditor.GetEditorColor;

            GUILayout.Label("Area Add-On(s) Settings", EditorStyles.largeLabel);

            #region Area Add-Ons Settings

            GUI.color = Color.white;

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            AddonsFoldout = EditorGUILayout.Foldout(AddonsFoldout, "Add-Ons Section Settings");

            GUILayout.EndHorizontal();

            GUILayout.BeginHorizontal();

            GUILayout.Space(13);

            GUILayout.BeginVertical();

            if (AddonsFoldout)
            {
                MainEditor.DrawAddons(Target, AddOnTarget.AreaBehaviour);
            }

            GUILayout.EndVertical();

            GUILayout.EndHorizontal();

            #endregion Area Add-Ons Settings

            GUILayout.EndVertical();

            GUILayout.EndVertical();

            #endregion Inspector

            serializedObject.ApplyModifiedProperties();

            GUILayout.Space(10);
        }
示例#31
0
        private void OnEnable()
        {
            Target = (AreaBehaviour)target;

            MainEditor.LoadAddons(Target, AddOnTarget.AreaBehaviour);
        }