Beispiel #1
0
        internal void Initialize(ElevenConfig gameConfig, GamePreviewItem preview, Color color)
        {
            this.gameConfig  = gameConfig;
            this.previewItem = preview;
            titleText.text   = gameConfig.gameName;

            foreach (var image in images)
            {
                HSBColor hsbColor = new HSBColor(color);
                hsbColor.brightness = image.brightness;
                hsbColor.alpha      = image.alpha;
                image.image.color   = hsbColor.ToColor();
            }

            button.onClick.AddListener(PlayGame);
        }
Beispiel #2
0
        void Start()
        {
            buttonColors.Shuffle();

            CreateBuffer(previewGameContentParent, buttonColors[(Config.Instance.games.Count - 1) % buttonColors.Length]);
            CreateBuffer(selectGameContentParent, buttonColors[(Config.Instance.games.Count - 1) % buttonColors.Length]);
            for (int i = 0; i < Config.Instance.games.Count; i++)
            {
                var game = Config.Instance.games[i];

                GameSelectButton selectInstance  = Instantiate <GameSelectButton>(selectButtonPrefab);
                GamePreviewItem  previewInstance = Instantiate <GamePreviewItem>(previewItemPrefab);
                Color            color           = buttonColors[i % buttonColors.Length];

                previewInstance.Initialize(game, selectInstance, color);
                previewInstance.transform.SetParent(previewGameContentParent.transform);
                previewInstance.transform.localScale = Vector3.one;
//				previewInstance.transform.SetSiblingIndex(previewGameContentParent.transform.childCount - 2);

                selectInstance.Initialize(game, previewInstance, color);
                selectInstance.transform.SetParent(selectGameContentParent.transform);
                selectInstance.transform.localScale = Vector3.one;
//				selectInstance.transform.SetSiblingIndex(selectGameContentParent.transform.childCount - 2);

                games.Add(selectInstance);
            }
            CreateBuffer(previewGameContentParent, buttonColors[(Config.Instance.games.Count - 1) % buttonColors.Length]);
            CreateBuffer(selectGameContentParent, buttonColors[(Config.Instance.games.Count) % buttonColors.Length]);

            if (games.Count > 0)
            {
                EventSystem.current.SetSelectedGameObject(games[games.Count / 2].gameObject);
            }


#if PARTY_MODE
            WaitToStart();
#endif
        }