Beispiel #1
0
        // Use this for initialization
        private void Start()
        {
            //Initialazing lists
            _canvases           = new Dictionary <string, Canvas>();
            _stories            = new Dictionary <string, Story>();
            _panels             = new List <GameObject>();
            ElementsToCrossfade = new List <GameObject>();

            //add panels to the list
            FillPanels();

            //show the main menu control bar
            ShowPanel(FindPanel.GO("ControlBar"));

            //get stories from internet
            _stories = Resources.GetStoriesFromInternet();

            // add ExitGame callback to ExitButton listener
            FindButton.Named("ExitButton").onClick.AddListener(ExitGame);

            //Testing text transition (fade in)
            var text = FindText.Named("TextGameTitle");

            VisualEffects.SetTextTransparent(text);
            ElementsToCrossfade.Add(text.gameObject);



            //Canvas initialization
            var mainMenuCanvas = FindCanvas.Named("MainMenuCanvas");

            mainMenuCanvas.transform.SetAsLastSibling();
            _canvases["mainMenuCanvas"] = mainMenuCanvas;



            foreach (var story in Stories.Values)
            {
                var cnv = Instantiate(FindCanvas.Named("StoryCanvas"));
                cnv.name = story.SnakeCase() + "_canvas";
                _canvases[story.SnakeCase()] = cnv;
            }



            /*Button initialization
             * _exitButton = GameObject.Find("btnExit").GetComponent<Button>();
             *
             *
             * //Assigning Methods to Unity actions
             * _exit += ExitGame;
             *
             *
             * //Assigning Unity actions to button Events
             * _exitButton.onClick.AddListener(_exit);
             */
        }