Exemplo n.º 1
0
        public void AddFigure(int SightingId, string Source, string Alternative, string Caption)
        {
            var context  = new WildlifeContext();
            var sighting = context.Sighting.Where((e) => e.Id == SightingId).First();
            var figure   = new FigureModel();

            sighting.FigureList.Add(figure);
            figure.Source      = Source;
            figure.Alternative = Alternative;
            figure.Caption     = Caption;
            context.SaveChanges();
        }
Exemplo n.º 2
0
        private static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var mainForm    = new MainForm();
            var figureModel = new FigureModel();

            var presenter = new Presenter.Presenter(mainForm, figureModel);

            Application.Run(mainForm);
        }
Exemplo n.º 3
0
        public ActionResult AddFigure(FigureModel model)
        {
            SessionModelCollector sessionModel = this.GetFromSession <SessionModelCollector>("ProjectInfo");

            if (sessionModel.Figures == null)
            {
                sessionModel.Figures = new List <FigureModel>();
            }

            model.Image = searchImageByPath(model.ImagePath);
            sessionModel.Figures.Add(model);                //add the new model to the list

            this.AddToSession("ProjectInfo", sessionModel); //save in session
            return(RedirectToAction("FigureList"));
        }
Exemplo n.º 4
0
        public ActionResult EditFigure(int id)
        {
            SessionModelCollector sessionModel = this.GetFromSession <SessionModelCollector>("ProjectInfo");

            if (sessionModel.Figures != null)
            {
                if (sessionModel.Figures[id] != null)
                {
                    FigureModel model = sessionModel.Figures[id];
                    model.ImagePaths = getImagePaths();
                    return(View(model));
                }
            }

            return(View("AddModel"));
        }
Exemplo n.º 5
0
    public FigureFacade Load(FigureFacade.Recipe recipe, FigureDefinition parentDefinition)
    {
        FigureDefinition definition = FigureDefinition.Load(dataDir, recipe.name, parentDefinition);

        var model = new FigureModel(definition)
        {
            IsVisible       = recipe.isVisible,
            ShapeName       = recipe.shape,
            MaterialSetName = recipe.materialSet
        };

        var controlVertexProvider = ControlVertexProvider.Load(device, shaderCache, definition);

        var facade = new FigureFacade(device, shaderCache, definition, model, controlVertexProvider, figureRendererLoader);

        return(facade);
    }
Exemplo n.º 6
0
        private static FigureModel ConvertFigure(Figure figure)
        {
            FigureModel ret = null;

            if (figure != null)
            {
                ret = new FigureModel
                {
                    Color  = ConvertFigureColor(figure.Color),
                    Type   = ConvertFigureType(figure.Type),
                    Row    = figure.Row,
                    Column = figure.Column,
                    Moves  = new List <MoveModel>()
                };
            }
            return(ret);
        }
Exemplo n.º 7
0
        public List <FigureModel> GetFigure(string sessionKey, int gameId)
        {
            //hard code
            //  return this.data.figureRepository.GetGameFigures(gameId);
            FigureRepository figureRepository = data.GetFigureRepository();
            var figures = figureRepository.GetGameFigures(gameId);
            List <FigureModel> returnList = new List <FigureModel>();

            foreach (var figure in figures)
            {
                var checkListForDuplicate = returnList.Find(x => x.PosCol == figure.PositionCol && x.PosRow == figure.PositionRow);

                if (figure.GameId == gameId && checkListForDuplicate == null)
                {
                    returnList.Add(FigureModel.ConvertToModel(figure));
                }
            }
            return(returnList);
        }
Exemplo n.º 8
0
    public CharactersMenuLevel(FigureDefinition definition, FigureModel model)
    {
        var materialSetDict = definition.MaterialSetOptions.ToDictionary(item => item.Label, item => item);

        var shapesMenuLevel    = new ShapesMenuLevel(definition, model);
        var materialsMenuLevel = new MaterialsMenuLevel(definition, model);
        var advancedMenuLevel  = new StaticMenuLevel(
            new SubLevelMenuItem("Shape", shapesMenuLevel),
            new SubLevelMenuItem("Skin", materialsMenuLevel)
            );

        items = new List <IMenuItem> {
        };
        items.Add(new SubLevelMenuItem("Mix & Match", advancedMenuLevel));
        foreach (var shape in definition.ShapeOptions)
        {
            if (materialSetDict.TryGetValue(shape.Label, out var materialSet))
            {
                items.Add(new CharacterMenuItem(model, shape, materialSet));
            }
        }
    }
Exemplo n.º 9
0
 public VisibilityToggleMenuItem(string label, FigureModel model)
 {
     this.label = label;
     this.model = model;
 }
 public MaterialSetMenuItem(FigureModel model, MaterialSetOption materialSet)
 {
     this.model       = model;
     this.materialSet = materialSet;
 }
Exemplo n.º 11
0
    public FigureFacade(Device device, ShaderCache shaderCache, FigureDefinition definition, FigureModel model, ControlVertexProvider controlVertexProvider, FigureRendererLoader figureRendererLoader)
    {
        this.definition            = definition;
        this.model                 = model;
        this.controlVertexProvider = controlVertexProvider;
        this.figureRendererLoader  = figureRendererLoader;

        model.MaterialSetChanged += Model_MaterialSetChanged;
        SyncMaterialSet();
    }
Exemplo n.º 12
0
 public CharacterMenuItem(FigureModel model, Shape shape, MaterialSetOption materialSet)
 {
     this.model       = model;
     this.shape       = shape;
     this.materialSet = materialSet;
 }
Exemplo n.º 13
0
 public ShapesMenuItem(FigureModel model, Shape shape)
 {
     this.model = model;
     this.shape = shape;
 }
Exemplo n.º 14
0
 public ShapesMenuLevel(FigureDefinition definition, FigureModel model)
 {
     this.definition = definition;
     this.model      = model;
 }
    public CharactersMenuLevel(List <Character> characters, FigureDefinition definition, FigureModel model)
    {
        var shapesMenuLevel    = new ShapesMenuLevel(definition, model);
        var materialsMenuLevel = new MaterialsMenuLevel(definition, model);
        var advancedMenuLevel  = new StaticMenuLevel(
            new SubLevelMenuItem("Shape", shapesMenuLevel),
            new SubLevelMenuItem("Skin", materialsMenuLevel)
            );

        var detailsMenuLevel = new MaterialSetVariantsMenuLevel(definition, model);

        items = new List <IMenuItem> {
        };
        items.Add(new SubLevelMenuItem("Mix & Match", advancedMenuLevel));
        items.Add(new SubLevelMenuItem("Character Details", detailsMenuLevel));
        foreach (var character in characters)
        {
            items.Add(new CharacterMenuItem(model, character));
        }
    }
Exemplo n.º 16
0
 public MaterialSetVariantMenuItem(FigureModel model, MultiMaterialSettings.VariantCategory category, MultiMaterialSettings.Variant variant)
 {
     this.model    = model;
     this.category = category;
     this.variant  = variant;
 }
Exemplo n.º 17
0
 public MaterialSetVariantsMenuLevel(FigureDefinition definition, FigureModel model)
 {
     this.definition = definition;
     this.model      = model;
 }
Exemplo n.º 18
0
 public FigureFacade(Device device, ShaderCache shaderCache, FigureDefinition definition, FigureModel model, ControlVertexProvider controlVertexProvider, FigureRendererLoader figureRendererLoader)
 {
     this.definition            = definition;
     this.model                 = model;
     this.controlVertexProvider = controlVertexProvider;
     this.figureRendererLoader  = figureRendererLoader;
 }
 public CharacterMenuItem(FigureModel model, Character character)
 {
     this.model     = model;
     this.character = character;
 }