Exemplo n.º 1
0
 public void LeftMouseDown(ref EditorData data, Point gridPosition)
 {
     mInitial = gridPosition;
     mPrevious = gridPosition;
     data.SelectedEntities.Clear();
     mouseDown = true;
 }
Exemplo n.º 2
0
 public LevelObject(BehaviourModel.ObjectBehaviourModel _behaviourmodel, RenderObject _renderaspect, ResourceCollectorXNA.Engine.Render.Materials.Material _material, RaycastBoundObject _raycastaspect, EditorData ed)
 {
     behaviourmodel = _behaviourmodel;
     renderaspect = _renderaspect;
     raycastaspect = _raycastaspect;
     editorAspect = ed;
     material = _material;
 }
Exemplo n.º 3
0
 public void LeftMouseDown(ref EditorData data, System.Drawing.Point gridPosition)
 {
     mPrevious = gridPosition;
     mPainting = true;
     data.SelectedEntities.Clear();
     data.SelectedEntities.Add(data.Level.SelectEntity(gridPosition));
     data.Level.RemoveEntity(data.SelectedEntities, true);
     data.SelectedEntities.Clear();
 }
Exemplo n.º 4
0
 public void LeftMouseUp(ref EditorData data, Point gridPosition)
 {
     if (data.OnDeck == null) return;
     var entity = data.OnDeck.Copy();
     entity.Location = gridPosition;
     data.Level.AddEntity(entity, gridPosition, true);
     data.SelectedEntities.Clear();
     data.SelectedEntities.Add(entity);
 }
Exemplo n.º 5
0
        public void RightMouseDown(ref EditorData data, Point gridPosition)
        {
            if(data.SelectedEntities.Count != 1) return;

            var properties = new AdditionalProperties(data.Level.SelectEntity(gridPosition).Properties);
            properties.Editable = false;
            if (properties.ShowDialog() == DialogResult.OK)
                data.Level.SelectEntity(gridPosition).Properties = properties.Properties;
        }
Exemplo n.º 6
0
 public void MouseMove(ref EditorData data, Panel panel, Point gridPosition)
 {
     if (mouseDown&&!mPrevious.Equals(gridPosition))
     {
         data.SelectedEntities = data.Level.SelectEntities(mInitial, gridPosition, true);
         mPrevious = gridPosition;
         panel.Invalidate(panel.DisplayRectangle);
     }
 }
 private void SetReadOnly(int end)
 {
     for (int i = 0; i <= end; ++i)
     {
         EditorData.PlacedObjects[i].Clear();
         EditorData.Grids[i].ReadOnly = true;
     }
     EditorData.UpdateAllowVisualTransformChanges(DataHolder.IsWindow);
     SceneView.RepaintAll();
 }
Exemplo n.º 8
0
        public ImaginaryEditableObject(Type constructionType, EditorData editorData)
        {
            if (!constructionType.IsEditable())
            {
                throw new ArgumentException($"ConstructionType is not editable! ConstructionType = {constructionType}");
            }

            TypeData   = new TypeData(constructionType.AssemblyQualifiedName);
            EditorData = editorData;
        }
Exemplo n.º 9
0
 public void MouseMove(ref EditorData data, Panel panel, Point gridPosition)
 {
     if (!_mPrevious.Equals(gridPosition) && data.SelectedEntities.Count > 0 && _mouseDown)
     {
         //Keep an eye on this. The SelectedEntities can return an empty list
         data.Level.MoveEntity(data.SelectedEntities,
             new Size(Point.Subtract(gridPosition, new Size(_mPrevious))), false);
         _mPrevious = gridPosition;
         panel.Invalidate(panel.DisplayRectangle);
     }
 }
Exemplo n.º 10
0
        protected override void ReadConstructionInfo(BinaryReader reader)
        {
            TypeData = new TypeData(reader);

            EditorData = EditorData.GetEmpty();

            for (var i = 0; i < reader.ReadInt32(); i++)
            {
                EditorData.Add(reader.ReadString(), reader.ReadString());
            }
        }
Exemplo n.º 11
0
        public static EditorData GenEditorData(int caretLine, int caretPos, string focusedModuleCode, params string[] otherModuleCodes)
        {
            var cache = ResolutionTests.CreateCache(otherModuleCodes);
            var ed    = new EditorData {
                ParseCache = cache
            };

            UpdateEditorData(ed, caretLine, caretPos, focusedModuleCode);

            return(ed);
        }
Exemplo n.º 12
0
        public async Task <IActionResult> Create([Bind("ContentId,EditorContent")] EditorData editorData)
        {
            if (ModelState.IsValid)
            {
                _context.Add(editorData);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(editorData));
        }
Exemplo n.º 13
0
        void LoadNodeNetworkSettingsOk(Window callingWindow)
        {
            AxisFlippingSettings axisFlippingSettings =
                ((PropertyGrid <AxisFlippingSettings>)callingWindow.Parent).SelectedObject;

            EditorData.LoadNodeNetwork(
                mNameOfNodeNetwork,
                axisFlippingSettings.CopyYToZ,
                axisFlippingSettings.FlipY,
                axisFlippingSettings.MakeYZero);
        }
    //[Editor]
    private static void Editor(ref EditorData currentEditorData)
    {
        Output.Log("CustomHierarchyObject editor opened.");
        if (currentEditorData["Text"] is not null)
        {
            Output.Log("Do you want to set a new value for Text?");
            if (!GetBool())
            {
                goto SetPointlessBool;
            }
        }

        Output.Log("Choose a value for Text:");
        currentEditorData["Text"] = Console.ReadLine();
SetPointlessBool:
        if (currentEditorData["PointlessBool"] is not null)
        {
            Output.Log("Do you want to set a new value for PointlessBool?");
            if (!GetBool())
            {
                goto Exit;
            }
        }

        Output.Log("Choose true or false for Pointless bool:");
        currentEditorData["PointlessBool"] = GetBool().ToString();
Exit:

        // TODO: equivalent to this should be part of the Editor UI system in the future.
        bool GetBool()
        {
GetBool:
            switch (Console.ReadLine().ToLower())
            {
            case "y":
            case "yes":
            case "true":
            case "t":
            case "correct":
                return(true);

            case "n":
            case "no":
            case "false":
            case "f":
            case "incorrect":
                return(false);

            default:
                Output.ErrorLog("Invalid input, retrying.");
                goto GetBool;
            }
        }
    }
Exemplo n.º 15
0
        protected override void ProcessDroppedFile(string fileName)
        {
            string extension = FileManager.GetExtension(fileName);

            switch (extension)
            {
            case "scnx":
                EditorData.LoadScene(fileName);
                break;
            }
        }
Exemplo n.º 16
0
        public static void UpdateEditorData(EditorData ed, int caretLine, int caretPos, string focusedModuleCode)
        {
            var mod  = DParser.ParseString(focusedModuleCode);
            var pack = ed.ParseCache [0] as MutableRootPackage;

            pack.AddModule(mod);

            ed.ModuleCode    = focusedModuleCode;
            ed.SyntaxTree    = mod;
            ed.CaretLocation = new CodeLocation(caretPos, caretLine);
            ed.CaretOffset   = DocumentHelper.LocationToOffset(focusedModuleCode, caretLine, caretPos);
        }
Exemplo n.º 17
0
        public override void ProcessCommandLineArgument(string argument)
        {
            string extension = FileManager.GetExtension(argument);

            switch (extension)
            {
            case "nntx":
                EditorData.LoadNodeNetwork(argument, false, false, false);

                break;
            }
        }
Exemplo n.º 18
0
        public GameForm()
            : base()
        {
            sGameForm = this;

            // Don't give it a ShapeCollection to edit - make it null.
            EditorData.Initialize(null);
            GuiData.Initialize();
            sGameForm.Text = "PolygonEditor - untitled file";

            this.DragEnter += new System.Windows.Forms.DragEventHandler(this.GameForm_DragDrop);
        }
Exemplo n.º 19
0
        internal void LoadScene()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();

            fileDialog.FileName = "*.scnx";

            var dialogResult = fileDialog.ShowDialog();

            if (dialogResult == DialogResult.OK)
            {
                EditorData.LoadScene(fileDialog.FileName);
            }
        }
Exemplo n.º 20
0
        internal void AddSpline()
        {
            Spline spline = new Spline();

            EditorData.SplineList.Add(spline);

            EditorData.InitializeSplineAfterCreation(spline);
            // Refresh tree view after InitializeSplineAfterCreation
            // so that the new Spline has a name
            AppCommands.Self.Gui.RefreshTreeView();

            AppState.Self.CurrentSpline = spline;
        }
Exemplo n.º 21
0
        public void Init()
        {
            if (!IsPrefab)
            {
                bool existed = PoissonHelperInternalStorage.Instance.RemoveAndAdd(DataHolder, this);

                EditorData.InitVisual(DataHolder.ModeData, DataHolder.Data[DataHolder.UIData.SelectedLevelIndex], (DataHolder.IsWindow) ? null : (PoissonPlacer)DataHolder, DataHolder.IsWindow, !existed);
                if (!DataHolder.IsWindow)
                {
                    DataHolder.ModeData.Surface = ((PoissonPlacer)DataHolder).gameObject;
                }
            }
        }
Exemplo n.º 22
0
 public void MouseMove(ref EditorData data, Panel panel, Point gridPosition)
 {
     if (data.OnDeck == null || !data.OnDeck.Paintable) return;
     if (data.Level.SelectEntity(gridPosition) == null && _mPainting && !_mPrevious.Equals(gridPosition))
     {
         var entity = data.OnDeck.Copy();
         entity.Location = gridPosition;
         data.Level.AddEntity(entity, gridPosition, true);
         data.SelectedEntities.Clear();
         data.SelectedEntities.Add(entity);
         _mPrevious = gridPosition;
         panel.Invalidate(panel.DisplayRectangle);
     }
 }
Exemplo n.º 23
0
    public void Compile(SDKConfig sdkConfig, ChannelInfo channelInfo, string filePath)
    {
        string smaliPath           = filePath + "\\smali";
        string JavaCompileTempPath = PathTool.GetCurrentPath() + "\\JavaCompileTempPath";
        string JavaCompileSrcPath  = PathTool.GetCurrentPath() + "\\JavaCompileTempPath\\Src";
        string JavaCompileLibPath  = PathTool.GetCurrentPath() + "\\JavaCompileTempPath\\Lib";
        string JavaFilePath        = JavaCompileTempPath + "\\smali.java";
        string classFilePath       = JavaCompileTempPath + "\\Class";
        string dexFilePath         = JavaCompileTempPath + "\\smali.dex";

        CmdService cmd = new CmdService(OutPut, errorCallBack);

        //构造编译环境
        //创建Java类(替换关键字)
        for (int i = 0; i < sdkConfig.customJavaClass.Count; i++)
        {
            string javaName = JavaCompileSrcPath + "\\" + sdkConfig.customJavaClass[i].key + ".java";
            string s        = ReplaceKeyWord(sdkConfig.customJavaClass[i].value, channelInfo);
            FileTool.WriteStringByFile(javaName, s);
        }

        //复制Java库
        string libs = "";

        for (int i = 0; i < sdkConfig.customJavaLibrary.Count; i++)
        {
            string p = JavaCompileLibPath + "\\" + FileTool.GetFileNameByPath(sdkConfig.customJavaLibrary[i]);
            libs += p + ";";
            FileTool.CreateFilePath(p);

            string libPath = EditorData.SdkLibPath + sdkConfig.customJavaLibrary[i];
            File.Copy(libPath, p, true);
        }

        //创建导出目录
        FileTool.CreatePath(classFilePath);

        //Java to class
        cmd.Execute("javac  -classpath " + libs + " " + JavaCompileSrcPath + "\\*.java -d " + classFilePath);

        //class to dex
        cmd.Execute("java -jar " + EditorData.GetDxPath() + " --verbose --dex --output=" + dexFilePath + " " + classFilePath);

        //dex to smali
        cmd.Execute("java -jar baksmali-2.1.3.jar --o=" + smaliPath + " " + dexFilePath);

        //删除临时目录
        FileTool.DeleteDirectory(JavaCompileTempPath);
        Directory.Delete(JavaCompileTempPath);
    }
Exemplo n.º 24
0
        public override void FrameUpdate()
        {
            EditorData.Update();

            if (EditorData.Scene != null)
            {
                foreach (SpriteGrid spriteGrid in EditorData.Scene.SpriteGrids)
                {
                    spriteGrid.Manage();
                }
            }

            base.FrameUpdate();
        }
Exemplo n.º 25
0
        public static EditorData CreateEditorData(Document EditorDocument, DModule Ast, CodeCompletionContext ctx, char triggerChar = '\0')
        {
            bool removeChar = char.IsLetter(triggerChar) || triggerChar == '_' || triggerChar == '@';

            var deltaOffset = 0;            //removeChar ? 1 : 0;

            var caretOffset   = ctx.TriggerOffset - (removeChar ? 1 : 0);
            var caretLocation = new CodeLocation(ctx.TriggerLineOffset - deltaOffset, ctx.TriggerLine);
            var codeCache     = CreateCacheList(EditorDocument);

            var ed = new EditorData
            {
                CaretLocation = caretLocation,
                CaretOffset   = caretOffset,
                ModuleCode    = removeChar ? EditorDocument.Editor.Text.Remove(ctx.TriggerOffset - 1, 1) : EditorDocument.Editor.Text,
                SyntaxTree    = Ast,
                ParseCache    = codeCache
            };

            if (EditorDocument.HasProject)
            {
                var cfg = EditorDocument.Project.GetConfiguration(Ide.IdeApp.Workspace.ActiveConfiguration) as DProjectConfiguration;

                if (cfg != null)
                {
                    ed.GlobalDebugIds   = cfg.CustomDebugIdentifiers;
                    ed.IsDebug          = cfg.DebugMode;
                    ed.DebugLevel       = cfg.DebugLevel;
                    ed.GlobalVersionIds = cfg.GlobalVersionIdentifiers;
                    double d;
                    int    v;
                    if (Double.TryParse(EditorDocument.Project.Version, out d))
                    {
                        ed.VersionNumber = (int)d;
                    }
                    else if (Int32.TryParse(EditorDocument.Project.Version, out v))
                    {
                        ed.VersionNumber = v;
                    }
                }
            }

            if (ed.GlobalVersionIds == null)
            {
                ed.GlobalVersionIds = VersionIdEvaluation.GetOSAndCPUVersions();
            }

            return(ed);
        }
Exemplo n.º 26
0
        public EditorData MakeEditorData()
        {
            var editorData = new EditorData
            {
                ParseCache       = _cacheView,
                IsDebug          = _isDebug,
                DebugLevel       = _debugLevel,
                VersionNumber    = _versionNumber,
                GlobalDebugIds   = _debugIds,
                GlobalVersionIds = _versionIds
            };

            editorData.NewResolutionContexts();
            return(editorData);
        }
Exemplo n.º 27
0
 /// <summary>
 /// 接收GridUI的对象和数据
 /// </summary>
 private void InitGridUIAttribute()
 {
     mEditorData          = GridUIAttributeManager.GetInstance().editorData;
     mSprites             = GridUIAttributeManager.GetInstance().allSprites;
     mGridListManager     = GridUIAttributeManager.GetInstance().gridListManager;
     mGridBaseListManager = GridUIAttributeManager.GetInstance().gridBaseListManager;
     mGameBackground      = GridUIAttributeManager.GetInstance().GameBackground;
     mGridBg         = GridUIAttributeManager.GetInstance().GridBg;
     mGrid           = GridUIAttributeManager.GetInstance().Grid;
     mGridDataList   = GridUIAttributeManager.GetInstance().gridDataList;
     mDoorDataList   = GridUIAttributeManager.GetInstance().doorDataList;
     mIceDataList    = GridUIAttributeManager.GetInstance().iceDataList;
     mBasketDataList = GridUIAttributeManager.GetInstance().basketDataList;
     mTimboDataList  = GridUIAttributeManager.GetInstance().timboDataList;
 }
Exemplo n.º 28
0
        public static EditorData GetEditorData(MonoDevelop.Ide.Gui.Document doc = null)
        {
            var ed = new EditorData();

            if (doc == null)
            {
                doc = IdeApp.Workbench.ActiveDocument;
            }

            if (doc == null ||
                doc.FileName == FilePath.Null ||
                IdeApp.ProjectOperations.CurrentSelectedSolution == null)
            {
                return(null);
            }

            var editor = doc.GetContent <ITextBuffer>();

            if (editor == null)
            {
                return(null);
            }

            int line, column;

            editor.GetLineColumnFromPosition(editor.CursorPosition, out line, out column);
            ed.CaretLocation = new CodeLocation(column, line);
            ed.CaretOffset   = editor.CursorPosition;

            var ast = doc.ParsedDocument as ParsedDModule;

            var Project = doc.Project as DProject;

            ed.SyntaxTree = ast.DDom as DModule;
            ed.ModuleCode = editor.Text;

            if (ed.SyntaxTree == null)
            {
                return(null);
            }

            // Encapsule editor data for resolving
            ed.ParseCache = Project != null ?
                            Project.ParseCache :
                            ParseCacheList.Create(DCompilerService.Instance.GetDefaultCompiler().ParseCache);

            return(ed);
        }
Exemplo n.º 29
0
    void OnEnable()
    {
        //data = SheetDataManager.LoadList();

        SheetData = new SheetData();
        if (SheetDataManager.isEditorDataExist())
        {
            EditorData = SheetDataManager.Load();
        }
        else
        {
            EditorData = new EditorData();
            SheetDataManager.Save(EditorData);
        }
        SectionNo = 0;
    }
Exemplo n.º 30
0
            static ImaginaryScript CreateImaginaryScript(Type type)
            {
                if (type.IsEditable())
                {
                    EditorData editorData = EditorData.GetEmpty();
                    EditableSystem.OpenEditor(type, ref editorData);
                    return(new ImaginaryScript(new ImaginaryEditableObject(type, editorData)));
                }

                if (type.GetConstructors().Length > 0)
                {
                    return(new ImaginaryScript(new ImaginaryConstructableObject(type, GetConstructorParameters(type))));
                }

                return(new ImaginaryScript(new ImaginaryConstructableObject(type)));
            }
Exemplo n.º 31
0
        public void LeftMouseUp(ref EditorData data, System.Drawing.Point gridPosition)
        {
            ArrayList topEntity = new ArrayList();

            try
            {
                if (data.SelectedEntities.Count == 0)
                    data.SelectedEntities.Add(data.Level.SelectEntity(gridPosition));
                data.Level.RemoveEntity(data.SelectedEntities, true);
                data.SelectedEntities.Clear();
            }
            catch (Exception e)
            {
                //If the tile is empty, fail silently
            }
        }
Exemplo n.º 32
0
        public static INode GetNode(EditorData ed, string id, ref ResolutionContext ctxt)
        {
            if (ctxt == null)
            {
                ctxt = ResolutionContext.Create(ed, true);
            }

            DToken tk;
            var    bt = DParser.ParseBasicType(id, out tk);
            var    t  = TypeDeclarationResolver.ResolveSingle(bt, ctxt);

            var n = (t as DSymbol).Definition;

            Assert.That(n, Is.Not.Null);
            return(n);
        }
Exemplo n.º 33
0
        public override TooltipItem GetItem(TextEditor editor, int offset)
        {
            // Note: Normally, the document already should be open
            var doc = IdeApp.Workbench.GetDocument(editor.Document.FileName);

            if (doc == null)
            {
                return(null);
            }

            var ast = doc.GetDAst();

            // Due the first note, the AST already should exist
            if (ast == null)
            {
                return(null);
            }

            // Get code cache
            var codeCache = DResolverWrapper.CreateParseCacheView(doc);

            // Create editor context
            var line = editor.GetLineByOffset(offset);

            var ed = new EditorData {
                CaretOffset   = offset,
                CaretLocation = new CodeLocation(offset - line.Offset, editor.OffsetToLineNumber(offset)),
                ModuleCode    = editor.Text,
                ParseCache    = codeCache,
                SyntaxTree    = ast
            };

            // Let the engine build all contents
            LooseResolution.NodeResolutionAttempt att;
            ISyntaxRegion sr;
            var           rr = LooseResolution.ResolveTypeLoosely(ed, out att, out sr, true);

            // Create tool tip item
            if (rr != null)
            {
                return(new TooltipItem(new TTI {
                    t = rr, sr = sr
                }, offset, 1));
            }

            return(null);
        }
Exemplo n.º 34
0
        public void addEmitterOkClick(FlatRedBall.Gui.Window callingWindow)
        {
            Emitter newEmitter = new Emitter();

            SpriteManager.AddEmitter(newEmitter);

            ShapeManager.AddPolygon(newEmitter.EmissionBoundary);

            EditorData.SetDefaultValuesOnEmitter(newEmitter);

            EditorData.Emitters.Add(newEmitter);

            newEmitter.Name = ((TextInputWindow)callingWindow).Text;

            newEmitter.Texture = FlatRedBallServices.Load <Texture2D>("content/redball.bmp",
                                                                      AppState.Self.PermanentContentManager);
        }
Exemplo n.º 35
0
        public List <EditorData> GetAllEditors()
        {
            var path = CommonHelper.MapPath(Path.Combine(PluginPaths.PluginFolder, PluginPaths.EditorsFolder)).Replace("\\~\\", "\\");

            Directory.CreateDirectory(path);
            var editorFolders = Directory.EnumerateDirectories(path).ToList();
            var editors       = new List <EditorData>();

            foreach (var editorFolder in editorFolders)
            {
                if (EditorData.IsValidEditorFolder(editorFolder))
                {
                    editors.Add(new EditorData(editorFolder));
                }
            }
            return(editors);
        }
Exemplo n.º 36
0
 public static EditorData Load()
 {
     if (File.Exists(saveDataPath + @"\EditorData"))
     {
         using (StreamReader sr = new StreamReader(saveDataPath + @"\EditorData"))
         {
             string     newjson = sr.ReadToEnd();
             EditorData newData = JsonUtility.FromJson <EditorData>(newjson);
             return(newData);
         }
     }
     else
     {
         Debug.LogError("The creation of directoryPath is fail");
         return(null);
     }
 }
Exemplo n.º 37
0
    //saving the levle (thanks to brakeys save and load tutorial)
    public void SaveLevel()
    {
        BinaryFormatter bin = new BinaryFormatter();

        // needed for custom level names
        string path = Application.persistentDataPath + "/" + FileName + ".ple";

        FileStream stream = new FileStream(path, FileMode.Create);

        GameObject[] objects = GameObject.FindGameObjectsWithTag("EditorOBJ");

        EditorData data = new EditorData(objects);

        Debug.Log(path);

        bin.Serialize(stream, data);
        stream.Close();
    }
Exemplo n.º 38
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            FlatRedBallServices.Update(gameTime);
            // TODO: Add your update logic here


            EditorData.Update();

            if (EditorData.Scene != null)
            {
                foreach (SpriteGrid spriteGrid in EditorData.Scene.SpriteGrids)
                {
                    spriteGrid.Manage();
                }
            }

            base.Update(gameTime);
        }
Exemplo n.º 39
0
        public void MouseMove(ref EditorData data, System.Windows.Forms.Panel panel, System.Drawing.Point gridPosition)
        {
            ArrayList topEntity = new ArrayList();
            Entity entity = data.Level.SelectEntity(gridPosition);

            if (entity != null && mPainting && !mPrevious.Equals(gridPosition))
                try
                {
                    data.SelectedEntities.Clear();
                    topEntity.Add(entity);
                    data.Level.RemoveEntity(topEntity, true);
                    mPrevious = gridPosition;
                    panel.Invalidate(panel.DisplayRectangle);
                }
                catch (Exception e)
                {
                    //If the tile is empty, fail silently
                }
        }
Exemplo n.º 40
0
        public void MouseMove(ref EditorData data, Panel panel, Point gridPosition)
        {
            var topEntity = new ArrayList();
            var entity = data.Level.SelectEntity(gridPosition);

            if (entity != null && _mPainting && !_mPrevious.Equals(gridPosition))
                try
                {
                    data.SelectedEntities.Clear();
                    topEntity.Add(entity);
                    data.Level.RemoveEntity(topEntity, true);
                    _mPrevious = gridPosition;
                    panel.Invalidate(panel.DisplayRectangle);
                }
                catch (Exception)
                {
                    //If the tile is empty, fail silently
                }
        }
        private void CreateModeUI(float halfWidth)
        {
            EditorGUILayout.BeginVertical(BoxStyle, GUILayout.MaxWidth(halfWidth * 2 + ColumnGap + ((DataHolder.IsWindow) ? 0 : LeftMarginInspector)));
            halfWidth -= (DataHolder.IsWindow) ? BoxMargin : BoxMargin * 0.5f;

            EditorGUILayout.BeginHorizontal(RowStyle);
            EditorGUILayout.BeginVertical(LeftColumnFoldoutStyle, GUILayout.MaxWidth(halfWidth + ((DataHolder.IsWindow) ? 0 : LeftMarginInspector)));
            EditorGUILayout.BeginHorizontal(RowStyle);

            UIData.ModeCategory = EditorGUILayout.Foldout(UIData.ModeCategory, "Mode", true, FoldoutStyle);

            bool isDisabled = EditorData.Grids[0].ReadOnly;

            using (new EditorGUI.DisabledScope(isDisabled))
            {
                EditorGUI.BeginChangeCheck();
                ModeData.Mode = (DistributionMode)EditorGUILayout.EnumPopup(ModeData.Mode, PopupStyle);
                if (EditorGUI.EndChangeCheck())
                {
                    EditorData.UpdateVisualMode(ModeData);
                    SceneView.RepaintAll();
                }

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();
            }
            EditorGUILayout.BeginVertical(RightColumnStyle, GUILayout.MaxWidth(halfWidth));
            ModeData.RealtimePreview = EditorGUILayout.Toggle("Realtime preview:", ModeData.RealtimePreview, ToggleStyle);
            EditorGUILayout.EndVertical();
            EditorGUILayout.EndHorizontal();

            using (new EditorGUI.DisabledScope(isDisabled))
            {
                if (UIData.ModeCategory)
                {
                    CreateModeSpecificUI(halfWidth);
                }
            }

            EditorGUILayout.EndVertical();

            GUILayout.Label("", GUI.skin.horizontalSlider);
        }
Exemplo n.º 42
0
 public void LeftMouseUp(ref EditorData data, Point gridPosition)
 {
     if(gridPosition.Equals(_mInitial))
     {
         if(!data.CtrlHeld) data.SelectedEntities.Clear();
         var selected = data.Level.SelectEntity(gridPosition);
         if (selected != null && !data.SelectedEntities.Contains(selected))
             data.SelectedEntities.Add(selected);
         else if (selected == null && !data.CtrlHeld)
             data.SelectedEntities.Clear();
     }
     if (data.SelectedEntities.Count > 0)
     {
         data.Level.MoveEntity(data.SelectedEntities,
             new Size(Point.Subtract(_mInitial, new Size(gridPosition))), false);
         data.Level.MoveEntity(data.SelectedEntities,
             new Size(Point.Subtract(gridPosition, new Size(_mInitial))), true);
     }
     _mouseDown = false;
 }
Exemplo n.º 43
0
 public void LeftMouseDown(ref EditorData data, System.Drawing.Point gridPosition)
 {
 }
Exemplo n.º 44
0
 public void LeftMouseDown(ref EditorData data, Point gridPosition)
 {
     _mPrevious = _mInitial = gridPosition;
     _mouseDown = true;
 }
Exemplo n.º 45
0
 public void LeftMouseUp(ref EditorData data, Point gridPosition)
 {
     _mPainting = false;
 }
Exemplo n.º 46
0
        public static LevelObject LevelObjectFromDescription(
            ResourceCollector.Content.LevelObjectDescription description,
            ResourceCollector.Pack packs)
        {
            if (description.Enginereadedobject.Count==0)
            {
                //рендераспект - мб один на несколько объектов
                RenderObject renderaspect = loadro(description, packs);
                Material m = loadMaterial(description.matname, packs);
                //его тоже удалят
                RaycastBoundObject raycastaspect = loadrcbo(description, packs);

                #region lalala
                /*switch (description.BehaviourType)
            {
                case ResourceCollector.Content.WorldObjectDescription.objectmovingbehaviourmodel:
                    {
                        throw new Exception("Unsupported behaviour model!");
                    }break;
                case ResourceCollector.Content.WorldObjectDescription.objectphysiccharcontrollerbehaviourmodel:
                    {
                        StillDesign.PhysX.ActorDescription ObjectActorDescription = new StillDesign.PhysX.ActorDescription();

                        if (description.ShapeType == 0)
                        {
                            if (description.PhysXShapeType == 0)
                            {
                                StillDesign.PhysX.BoxShapeDescription boxshape = new StillDesign.PhysX.BoxShapeDescription(description.ShapeSize);
                                boxshape.LocalRotation = Microsoft.Xna.Framework.Matrix.CreateRotationX(Microsoft.Xna.Framework.MathHelper.PiOver2);
                                ObjectActorDescription.Shapes.Add(boxshape);
                            }
                            else if (description.PhysXShapeType == 1)
                            {
                                StillDesign.PhysX.CapsuleShapeDescription capsshape = new StillDesign.PhysX.CapsuleShapeDescription(description.ShapeSize.X, description.ShapeSize.Z);
                                capsshape.LocalRotation = Microsoft.Xna.Framework.Matrix.CreateRotationX(Microsoft.Xna.Framework.MathHelper.PiOver2);
                                ObjectActorDescription.Shapes.Add(capsshape);
                            }
                        }
                        else if (description.ShapeType == 1)
                        {
                            CollisionMesh physicCM = new CollisionMesh();
                            physicCM = packs.GetObject(description.RCCMName, physicCM) as CollisionMesh;

                            ObjectActorDescription.Shapes.Add(physicCM.CreatreConvexShape(scene.Core));
                        }

                        ObjectActorDescription.BodyDescription = new StillDesign.PhysX.BodyDescription(description.Mass);
                        Microsoft.Xna.Framework.Matrix MassCenterMatrix;
                        Microsoft.Xna.Framework.Matrix.CreateTranslation(ref description.CenterOfMass, out MassCenterMatrix);
                        ObjectActorDescription.BodyDescription.MassLocalPose = MassCenterMatrix;

                        ObjectActor = scene.CreateActor(ObjectActorDescription);
                        ObjectActor.RaiseBodyFlag(StillDesign.PhysX.BodyFlag.FrozenRotation);
                        foreach (var c in ObjectActor.Shapes)
                        {
                            c.Group = 31;
                        }

                    } break;
                case ResourceCollector.Content.WorldObjectDescription.objectstaticbehaviourmodel:
                    {

                    }break;
                case ResourceCollector.Content.WorldObjectDescription.objectphysicbehaviourmodel:
                    {
                        StillDesign.PhysX.ActorDescription ObjectActorDescription = new StillDesign.PhysX.ActorDescription();
                        if (description.ShapeType == 0)
                        {
                            if (description.PhysXShapeType == 0)
                            {
                                StillDesign.PhysX.BoxShapeDescription boxshape = new StillDesign.PhysX.BoxShapeDescription(description.ShapeSize);
                                Microsoft.Xna.Framework.Matrix m;
                                Microsoft.Xna.Framework.Vector3 v = description.ShapeRotationAxis;
                                Microsoft.Xna.Framework.Matrix.CreateFromAxisAngle(ref v, description.ShapeRotationAngle, out m);
                                boxshape.LocalRotation = m;

                                ObjectActorDescription.Shapes.Add(boxshape);
                            }
                            else if (description.PhysXShapeType == 1)
                            {
                                StillDesign.PhysX.CapsuleShapeDescription capsshape = new StillDesign.PhysX.CapsuleShapeDescription(description.ShapeSize.X,description.ShapeSize.Z);
                                Microsoft.Xna.Framework.Matrix m;
                                Microsoft.Xna.Framework.Vector3 v = description.ShapeRotationAxis;
                                Microsoft.Xna.Framework.Matrix.CreateFromAxisAngle(ref v, description.ShapeRotationAngle, out m);
                                capsshape.LocalRotation = m;

                                ObjectActorDescription.Shapes.Add(capsshape);
                            }
                        }
                        else if (description.ShapeType == 1)
                        {
                            CollisionMesh physicCM = new CollisionMesh();
                            physicCM = packs.GetObject(description.RCCMName, physicCM) as CollisionMesh;

                            if (description.IsStatic)
                                ObjectActorDescription.Shapes.Add(physicCM.CreateTriangleMeshShape(scene.Core));
                            else
                                ObjectActorDescription.Shapes.Add(physicCM.CreatreConvexShape(scene.Core));
                        }

                        if (description.IsStatic)
                        {
                            ObjectActorDescription.BodyDescription = null;
                        }
                        else
                        {
                            ObjectActorDescription.BodyDescription = new StillDesign.PhysX.BodyDescription(description.Mass);
                            Microsoft.Xna.Framework.Matrix MassCenterMatrix;
                            Microsoft.Xna.Framework.Matrix.CreateTranslation(ref description.CenterOfMass, out MassCenterMatrix);
                            ObjectActorDescription.BodyDescription.MassLocalPose = MassCenterMatrix;
                        }
                        ObjectActor = scene.CreateActor(ObjectActorDescription);
                        if (description.IsStatic)
                        {
                            foreach (var c in ObjectActor.Shapes)
                            {
                                c.Group = 1;
                            }
                        }
                        else
                        {
                            foreach (var c in ObjectActor.Shapes)
                            {
                                c.Group = 31;
                            }
                        }

                        //CONTACT REPORT DISABLED TEMPORARY
                        //ObjectActor.ContactReportFlags = StillDesign.PhysX.ContactPairFlag.All;
                    }break;
                default:
                    {
                        throw new Exception("Unsupported behaviour model!");
                    } break;
            }*/
                #endregion

                Logic.BehaviourModel.ObjectBehaviourModel behaviourmodel = null;
                switch (description.BehaviourType)
                {
                    case ResourceCollector.Content.LevelObjectDescription.objectmovingbehaviourmodel:
                        {
                            throw new Exception("Unsupported behaviour model!");
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectphysiccharcontrollerbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectPhysicControllerBehaviourModel(/*_actor*/);
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectstaticbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectStaticBehaviourModel();
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectphysicbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectPhysicBehaviourModel(/*_actor*/);
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectBonerelatedbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectBoneRelatedBehaviourModel(/*_actor*/);
                        } break;

                    default:
                        {
                            throw new Exception("Unsupported behaviour model!");
                        } break;
                }
                //её гк удалит
                EditorData ed = new EditorData(description.name, ObjectEditorType.SolidObject);
                LevelObject createdobject = new LevelObject(behaviourmodel, renderaspect, m, raycastaspect, ed);
                description.Enginereadedobject.Add(createdobject);
                return createdobject;
            }
            else
            {
                LevelObject createdobject = description.Enginereadedobject[0] as LevelObject;
                RenderObject ro = loadro(description, packs);
                Material m = loadMaterial(description.matname, packs);

                Logic.BehaviourModel.ObjectBehaviourModel behaviourmodel = null;
                switch (description.BehaviourType)
                {
                    case ResourceCollector.Content.LevelObjectDescription.objectmovingbehaviourmodel:
                        {
                            throw new Exception("Unsupported behaviour model!");
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectphysiccharcontrollerbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectPhysicControllerBehaviourModel(/*_actor*/);
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectstaticbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectStaticBehaviourModel();
                        } break;
                    case ResourceCollector.Content.LevelObjectDescription.objectphysicbehaviourmodel:
                        {
                            behaviourmodel = new Logic.BehaviourModel.ObjectPhysicBehaviourModel(/*_actor*/);
                        } break;
                    default:
                        {
                            throw new Exception("Unsupported behaviour model!");
                        } break;
                }

                RaycastBoundObject raycastaspect = loadrcbo(description, packs);
                EditorData ed = new EditorData(createdobject.editorAspect.DescriptionName, createdobject.editorAspect.objtype);
                LevelObject createdobject1 = new LevelObject(behaviourmodel, ro, m, raycastaspect, ed);
                description.Enginereadedobject.Add(createdobject1);
                return createdobject1;
            }
        }
Exemplo n.º 47
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            // определение директории исполняемого файла приложения
            exeDir = ScadaUtils.NormalDir(Path.GetDirectoryName(Application.ExecutablePath));

            // локализация приложения
            if (!Localization.UseRussian)
            {
                string langDir = exeDir + "lang\\";
                string errMsg;

                if (Localization.LoadDictionaries(langDir, "ScadaData", out errMsg))
                    CommonPhrases.Init();
                else
                    ScadaUtils.ShowError(errMsg);

                if (Localization.LoadDictionaries(langDir, "ScadaSchemeEditor", out errMsg))
                {
                    Localization.TranslateForm(this, "Scada.Scheme.Editor.FrmMain");
                    SchemePhrases.InitStatic();
                    openFileDialog.Filter = saveFileDialog.Filter = SchemePhrases.FileFilter;
                }
                else
                {
                    ScadaUtils.ShowError(errMsg);
                }
            }

            // инициализация данных
            SchemeApp schemeApp = SchemeApp.InitSchemeApp(SchemeApp.WorkModes.Edit);
            schemeUrl = exeDir + "web\\ScadaScheme.html?editMode=true";
            editorData = schemeApp.EditorData;
            editorData.SelectElement = SelectElement;
            editorData.SetFormTitle = SetFormTitle;
            log = schemeApp.Log;
            elemClipboard = null;
            schemeSvcHost = null;
            domainSvcHost = null;
            schemeExThread = null;

            // проверка запуска второй копии программы
            try
            {
                bool createdNew;
                mutex = new Mutex(true, "ScadaSchemeEditorMutex", out createdNew);

                if (!createdNew)
                {
                    ScadaUtils.ShowInfo("SCADA-Редактор схем уже запущен.\nВторая копия будет закрыта.");
                    Close();
                    return;
                }
            }
            catch (Exception ex)
            {
                log.WriteAction("Ошибка при проверке запуска второй копии программы: " + ex.Message,
                    Log.ActTypes.Exception);
            }

            // запуск WCF-служб
            if (StartWCF())
            {
                // создание и запуск потока для обмена данными со схемой
                schemeExThread = new Thread(SchemeExchange);
                schemeExThread.Start();

                // настройка элементов управления
                miEditCut.Enabled = btnEditCut.Enabled = false;
                miEditCopy.Enabled = btnEditCopy.Enabled = false;
                miEditPaste.Enabled = btnEditPaste.Enabled = false;
                miSchemeCancelAddElem.Enabled = btnSchemeCancelAddElem.Enabled = false;
                miSchemeDelElem.Enabled = btnSchemeDelElem.Enabled = false;

                // создание новой схемы
                miFileNew_Click(null, null);
            }
            else
            {
                // блокировка элементов управления
                foreach (ToolStripItem item in miFile.DropDown.Items)
                    item.Enabled = item == miFileExit;
                foreach (ToolStripItem item in miEdit.DropDown.Items)
                    item.Enabled = false;
                foreach (ToolStripItem item in miScheme.DropDown.Items)
                    item.Enabled = false;
                foreach (ToolStripItem item in toolMain.Items)
                    item.Enabled = false;
            }
        }
Exemplo n.º 48
0
 public void MouseMove(ref EditorData data, Panel panel, Point gridPosition)
 {
 }
Exemplo n.º 49
0
 public void MouseMove(ref EditorData data, Panel panel, System.Drawing.Point gridPosition)
 {
 }
Exemplo n.º 50
0
 public void LeftMouseUp(ref EditorData data, System.Drawing.Point gridPosition)
 {
     mPainting = false;
 }
Exemplo n.º 51
0
 public void RightMouseUp(ref EditorData data, System.Drawing.Point gridPosition)
 {
 }
Exemplo n.º 52
0
 public void RightMouseUp(ref EditorData data, Point gridPosition)
 {
 }
Exemplo n.º 53
0
 public void LeftMouseUp(ref EditorData data, Point gridPosition)
 {
     mouseDown = false;
 }
Exemplo n.º 54
0
    void OnSelectionChange()
    {
        GameObject gameObject = Selection.activeGameObject;
        if (!gameObject) {
            data = null;
            return;
        }
        data = gameObject.GetComponent<EditorData> ();

        Repaint ();
    }
Exemplo n.º 55
0
 public void LeftMouseDown(ref EditorData data, Point gridPosition)
 {
 }