public void Start()
        {
            GameDatas = GameDataService.Get();

            var icons = new List <Icon>(GameDatas.Count);

            var canvas = GameObject.Find("MainCanvas").GetComponent <Canvas>() as Canvas;

            foreach (var gameData in GameDatas)
            {
                icons.Add(Icon.Instantiate(iconPrefab, canvas, gameData.Sprite, gameData.ExeAsExecutable));
            }

            IconList          = new IconList(icons);
            IconsAnimBehavior = new IconsAnimBehavior_3Box(
                IconList,
                selectingTransform,
                selectingFrameTransform,
                prevTransform,
                prevFramTransform,
                nextTransform,
                nextFramTransform,
                nonSelectingTransform);

            SelectingFrame = FindObjectOfType <SelectingFrame>() as SelectingFrame;

            IconsAnimBehavior.OnSelectingChanged += UpdateGameState;
            IconsAnimBehavior.OnSelectingChanged += (_) => { ToggleColorIconExistence(); };

            var iconFlexAnim = IconList.Selecting.GetComponent <IconFlexibleAnimator>();

            iconFlexAnim.OnAnimationStarted += () => { IsPlayingAnimation = true; };
            iconFlexAnim.OnAnimationEnded   += () =>
            {
                IsPlayingAnimation = false;
                if (SelectingFrame.PositionNum != SelectingFrame.Position.GameIcon)
                {
                    return;
                }
                SelectingFrame.DisplayGameIconFrame(true);
            };

            backgroundVideoPlayer.url = Path.GetFullPath("ExternalFiles/movie.mp4");

            UpdateGameState(0);
            ToggleColorIconExistence();
        }
示例#2
0
        public IActionResult Game(int id)
        {
            var game = _gameDataService.Get(id);

            if (game == null)
            {
                return(NotFound());
            }

            return((GameStates)game.State switch
            {
                GameStates.Created => View("~/Views/Home/Game.Created.cshtml", game),
                GameStates.Queued => View("~/Views/Home/Game.Queued.cshtml", game),
                GameStates.Played => View(game),
                GameStates.Error => View("~/Views/Home/Game.Error.cshtml", game),
                _ => throw new ArgumentOutOfRangeException()
            });
示例#3
0
 public string Get(int id)
 {
     return(_gameDataService.Get(id).Json);
 }