コード例 #1
0
        public ActionResult Details(int id)
        {
            var model = db.Get(id);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
コード例 #2
0
    public void Awake()
    {
        eventDispatcher       = Service.Get <EventDispatcher>();
        dataEntityCollection  = Service.Get <CPDataEntityCollection>();
        sceneDataEntityHandle = dataEntityCollection.FindEntityByName("ActiveSceneData");
        lightingController    = base.gameObject.AddComponent <LightingController>();
        IGameData gameData = Service.Get <IGameData>();

        lightingDefs   = gameData.Get <Dictionary <int, LightingDefinition> >();
        musicDefs      = gameData.Get <Dictionary <int, MusicTrackDefinition> >();
        decorationDefs = gameData.Get <Dictionary <int, DecorationDefinition> >();
        structureDefs  = gameData.Get <Dictionary <int, StructureDefinition> >();
        eventDispatcher.AddListener <SceneTransitionEvents.SceneSwapLoadStarted>(onSceneSwapLoadStarted);
    }
コード例 #3
0
        private void InitializeControls()
        {
            if (!(objectManipulationInputController.CurrentlySelectedObject != null))
            {
                return;
            }
            ManipulatableObject componentInParent  = objectManipulationInputController.CurrentlySelectedObject.GetComponentInParent <ManipulatableObject>();
            ObjectManipulator   componentInParent2 = objectManipulationInputController.CurrentlySelectedObject.GetComponentInParent <ObjectManipulator>();

            if (!(componentInParent2 != null))
            {
                return;
            }
            switch (componentInParent.Type)
            {
            case DecorationLayoutData.DefinitionType.Structure:
                HideRotationControls();
                HideScaleControls();
                break;

            case DecorationLayoutData.DefinitionType.Decoration:
            {
                IGameData gameData = Service.Get <IGameData>();
                Dictionary <int, DecorationDefinition> dictionary = gameData.Get <Dictionary <int, DecorationDefinition> >();
                if (dictionary.ContainsKey(componentInParent.DefinitionId))
                {
                    DecorationDefinition def = dictionary[componentInParent.DefinitionId];
                    ConfigureScalingOptions(def, componentInParent2);
                    ConfigureRotationOptions(def, componentInParent2);
                }
                break;
            }
            }
        }
コード例 #4
0
 public IActionResult OnGet(int id)
 {
     Game = _gameConverter.ToEditModel(_gameData.Get(id));
     if (Game == null)
     {
         return(NotFound());
     }
     return(Page());
 }
コード例 #5
0
        private void Awake()
        {
            dataEntityCollection       = Service.Get <CPDataEntityCollection>();
            eventDispatcher            = Service.Get <EventDispatcher>();
            decorationInventoryService = Service.Get <DecorationInventoryService>();
            sceneHandle = dataEntityCollection.FindEntityByName("ActiveSceneData");
            awakeEvents = new EventChannel(eventDispatcher);
            awakeEvents.AddListener <SceneTransitionEvents.LayoutGameObjectsLoaded>(onLayoutGameObjectsLoaded);
            sceneModifiers = new ISceneModifier[1]
            {
                new EditModeModifier(this)
            };
            IGameData gameData = Service.Get <IGameData>();

            decorationDefinitions = gameData.Get <Dictionary <int, DecorationDefinition> >();
            structureDefinitions  = gameData.Get <Dictionary <int, StructureDefinition> >();
            SceneRefs.Set(this);
        }
コード例 #6
0
ファイル: Edit.cshtml.cs プロジェクト: rikribbers/soccer
 public IActionResult OnGet(int id)
 {
     Game = _gameConverter.ToEditModel(_gameData.Get(id));
     Id   = id;
     if (Game == null)
     {
         return(RedirectToAction("Index", "Home"));
     }
     return(Page());
 }
コード例 #7
0
 public IActionResult OnPost()
 {
     // The trick here is that we always store the data in the database
     // as the user might want to get back to this page
     foreach (var prediction in Predictions)
     {
         if (prediction.HalftimeScore != null || prediction.FulltimeScore != null)
         {
             var p = _predictionConverter.ToEntity(prediction, Context);
             p.User = _userData.Get(MyUser.Id);
             p.Game = _gameData.Get(prediction.GameId);
             if (prediction.Id < 1)
             {
                 _predictionData.Add(p);
             }
             else
             {
                 _predictionData.Update(p);
             }
         }
     }
     return(RedirectToPage("MyPredictions"));
 }