Example #1
0
        private void CreateContentTable(List <EditorIniBlock> blocks)
        {
            this.archetypes = new Dictionary <string, ArchetypeInfo>(StringComparer.OrdinalIgnoreCase);

            foreach (EditorIniBlock block in blocks)
            {
                KeyValuePair <string, ArchetypeInfo> info = SystemParser.GetArchetypeInfo(block);
                if (info.Key != null)
                {
                    this.archetypes[info.Key] = info.Value;
                }
            }
        }
        public void Select(TableBlock block)
        {
            // return if object is already selected

            /*if (this.presenter.SelectedContent != null && this.presenter.SelectedContent.Block.Id == block.Id)
             * {
             *  return;
             * }*/

            if (block.Visibility)
            {
                bool isModelPreview = this.presenter.ViewerType == ViewerType.SolarArchetype || this.presenter.ViewerType == ViewerType.ModelPreview;
                if (isModelPreview)
                {
                    ContentBaseList.ClearAll(this.presenter);
                    this.presenter.ClearDisplay(false);
                    this.presenter.Add(block);
                }

                // select object
                ContentBase content = this.presenter.FindContent(block);
                if (content != null)
                {
                    ContentBaseList.AddItem(this.presenter, content);

                    if (isModelPreview)
                    {
                        // focus and zoom into object
                        this.presenter.LookAtAndZoom(content, 1.25, false);
                    }

                    return;
                }
            }
            else
            {
                // show selection box for invisible objects
                ContentBase content = Presenter.CreateContent(block.ObjectType);
                if (content != null)
                {
                    SystemParser.SetValues(content, block, false);
                    ContentBaseList.AddItem(this.presenter, content);
                    return;
                }
            }

            // deselect currect selection if nothing could be selected
            this.Deselect();
        }
Example #3
0
        public void Select(TableBlock block)
        {
            // return if object is already selected
            if (_presenter.SelectedContent != null && _presenter.SelectedContent.Block.Id == block.Id)
            {
                return;
            }

            if (block.Visibility)
            {
                bool isModelPreview = _presenter.ViewerType == ViewerType.SolarArchetype || _presenter.ViewerType == ViewerType.ModelPreview;
                if (isModelPreview)
                {
                    _presenter.SelectedContent = null;
                    _presenter.ClearDisplay(false);
                    _presenter.Add(block);
                }

                // select object
                ContentBase content = _presenter.FindContent(block);
                if (content != null)
                {
                    _presenter.SelectedContent = content;

                    if (isModelPreview)
                    {
                        // focus and zoom into object
                        _presenter.LookAtAndZoom(content, 1.25, false);
                    }
                    return;
                }
            }
            else
            {
                // show selection box for invisible objects
                ContentBase content = Presenter.CreateContent(block.ObjectType);
                if (content != null)
                {
                    SystemParser.SetValues(content, block, false);
                    _presenter.SelectedContent = content;
                    return;
                }
            }

            // deselect currect selection if nothing could be selected
            Deselect();
        }
Example #4
0
    private void Initialize(JSONNode root)
    {
        Device = new DeviceModel();

        var systemNameNode = root["systems"]["name"];
        var systemName     = systemNameNode.Value.ToString();

        Device.SystemName = systemName;

        var sysCount = root["systems"]["count"].AsInt;

        for (int i = 1; i <= sysCount; i++)
        {
            var sysTag       = string.Format("sys{0}", i);
            var systemParser = new SystemParser(root["systems"][sysTag]);

            Device.SubSystems.Add(systemParser.System);
        }
    }
Example #5
0
        protected void LoadSystem(string[] files)
        {
            // var fileName = ;

            var file = files.FirstOrDefault(x => x.EndsWith("data.json"));

            if (!string.IsNullOrEmpty(file))
            {
                // var fileContents = Encoding.UTF8.GetString(ReadAllBytes(file));

                var jsonParser = new SystemParser(file, _fileLoadHelper, targetEngine);

                jsonParser.CalculateSteps();

                while (jsonParser.completed == false)
                {
                    jsonParser.NextStep();
                }
            }
        }
Example #6
0
        private void SetBlockType(TableBlock block)
        {
            switch (this.ViewerType)
            {
            case ViewerType.System:
                SystemParser.SetObjectType(block, this.Archetype);
                break;

            case ViewerType.Universe:
                SystemParser.SetUniverseObjectType(block);
                break;

            case ViewerType.SolarArchetype:
                SystemParser.SetSolarArchetypeObjectType(block);
                break;

            case ViewerType.ModelPreview:
                SystemParser.SetModelPreviewObjectType(block);
                break;
            }
        }
Example #7
0
        private void LoadSystem(Dictionary <string, byte[]> files)
        {
            var fileName = "data.json";

            if (files.ContainsKey(fileName))
            {
                var fileContents = Encoding.UTF8.GetString(files[fileName]);

//                AddParser(new SystemParser(fileContents, targetEngine));
                var jsonParser = new SystemParser(targetEngine, fileContents);

                jsonParser.CalculateSteps();

                while (jsonParser.completed == false)
                {
                    jsonParser.NextStep();
                }
            }
//            else
//            {
//                throw new Exception("Can't find 'data.json' file");
//            }
        }
        public override Army Parse(string armyString)
        {
            SystemParser parser = GetParserForGameSystem(gameSystem);

            return(parser.Parse(armyString));
        }