コード例 #1
0
        public void Initialize()
        {
            // Add a Button
            panel.AddComponent <Button>();
            panel.GetComponent <Button>().onClick.AddListener(() => instance.TutorialIndicatorTouched(id));

            TutorialElement te = panel.GetComponent <TutorialElement>();

            if (te != null)
            {
                te.id = id;
            }
        }
コード例 #2
0
    void DynamicTutorialAction(TutorialElement tutorialElement)
    {
        // 동적할당 조건 - 변수가 바뀌거나, 기존에 없는경우.
        int beforeMount = tutorialElement.maxTutorialAction;

        int nowMount =
            EditorGUILayout.IntField("튜토리얼 수행작업", tutorialElement.maxTutorialAction);


        // 값 할당은 0이상인경우.
        if (nowMount >= 0)
        {
            tutorialElement.maxTutorialAction = nowMount;

            // 값이 커지면 동적할당.
            // 1 이상인경우 동적할당
            // 동적할당 시 기존 값은 전달해야한다.


            // 1. 기존 값 백업
            TutorialAction[] tempTutorialAction = tutorialElement.tutorialActions;

            // 2. 새 값 생성
            tutorialElement.tutorialActions = new TutorialAction[nowMount];

            // 3. 0이면 null처리
            if (nowMount == 0)
            {
                tutorialElement.tutorialActions = null;
            }

            for (int i = 0; i < nowMount; i++)
            {
                // 기존 값이 있으면 기존 값 사용
                if (i < beforeMount)
                {
                    tutorialElement.tutorialActions[i] = tempTutorialAction[i];
                }

                // 새 값이면 할당
                else
                {
                    tutorialElement.tutorialActions[i] = new TutorialAction();
                }
            }
        }
    }
コード例 #3
0
        private void LoadTutorial()
        {
            tutorial = new TutorialElement();

            tutorialRoot.AddChild(tutorial);

            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "The main board with the pictures is shown here");
            Rectangle time = UpperMenu.Instance.timerBackground.backgroundArea;

            tutorial.AddRectangle(new Point(time.Left, time.Top), new Point(time.Right, time.Bottom),
                                  "The timer is set here. In Time mode, it is counting down, otherwise it is counting up");

            tutorial.AddRectangle(new Point(6 * GameManager.Width / 7, 0), new Point(GameManager.Width, GameManager.Height / 8),
                                  "You can finish your game with the button here");

            tutorial.AddRectangle(new Point(0, 7 * GameManager.Height / 8), new Point(GameManager.Width, GameManager.Height),
                                  "The images to find can be found in the footer", delegate()
            {
                levelManager.ContinueGame();
            });

            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "Try to find " + levelManager.ImagesToFind.ToFind[0].Name);


            tutorial.AddRectangle(new Point(0, GameManager.Height / 8),
                                  new Point(GameManager.Width, 7 * GameManager.Height / 8),
                                  "That's it, have fun!", delegate()
            {
                levelManager.ContinueGame();
                NewGameMenu.Tutorial = false;
            });
        }
コード例 #4
0
 public void RemoveFromTutorialElementsList(TutorialElement x)
 {
     tutorialElements.Remove(x);
 }
コード例 #5
0
    public override void OnInspectorGUI()
    {
        // 임시로 쥐로 설정한다.
        TutorialElement[] tutorialPlayer = tutorialGuide.mouseTutorialElements;


        // 1. 쥐 튜토리얼 수 받기
        DynamicTutorialElement();

        int count = tutorialGuide.maxMouseTutorialCount;

        EditorGUI.indentLevel++;

        for (int i = 0; i < count; i++)
        {
            EditorGUILayout.Space();
            EditorGUILayout.LabelField("--- " + (i + 1) + " 번째 튜토리얼 사항" + " ---");


            // 간단하게 튜토리얼 속성 사용
            TutorialElement nowElement = tutorialPlayer[i];

            // 조건 동적생성
            DynamicTutorialCondition(nowElement);

            // 액션 동적생성
            DynamicTutorialAction(nowElement);



            EditorGUILayout.Space();
            EditorGUILayout.Space();


            // 조건 설정
            int conditionCount = nowElement.maxTutorialCondition;

            for (int dtc = 0; dtc < conditionCount; dtc++)
            {
                // 간단하게 사용하기 위해 정의
                TutorialCondition nowCondition = nowElement.tutorialConditions[dtc];

                // 1. 타입 지정
                nowCondition.tutorialConditionType =
                    (TutorialCondition.EnumTutorialCondition)EditorGUILayout.EnumPopup
                        ("조건 정의",
                        nowCondition.tutorialConditionType);

                // 2. 타입별로 인스펙터 조절
                SettingConditionInspector(nowCondition);

                EditorGUILayout.Space();
            }



            EditorGUILayout.Space();
            EditorGUILayout.LabelField("-------------------");
            EditorGUILayout.Space();



            int actionCount = nowElement.maxTutorialAction;

            for (int dta = 0; dta < actionCount; dta++)
            {
                // 간단하게 설정하기
                TutorialAction nowAction = nowElement.tutorialActions[dta];


                // 1. 타입 지정
                nowAction.tutorialActionType =
                    (TutorialAction.EnumTutorialAction)EditorGUILayout.EnumPopup
                        ("액션 정의",
                        nowAction.tutorialActionType);

                // 2. 타입별로 인스펙터 조절
                SettingActionInspector(nowAction);

                EditorGUILayout.Space();
            }
        }
        EditorGUI.indentLevel--;
    }
コード例 #6
0
ファイル: NewGameMenu.cs プロジェクト: csatari/pixeek
        public override void DrawMenu()
        {
            MenuSpriteElement bg = new MenuSpriteElement("GUI/newgame_menu.jpg", new Rectangle(0, 0, GameManager.Width, GameManager.Height));

            Root.AddChild(bg);

            // exit button
            {
                Rectangle exitRect = new Rectangle(GameManager.Width - 152, 1, 151, 71);
                MenuButtonElement exitButton = new MenuButtonElement(exitRect, delegate()
                {
                    Menu.GoToScene(MainMenu.Instance);
                });
                exitButton.AddChild(new MenuSpriteElement("GUI/button_bg", exitRect, "BACK"));
                bg.AddChild(exitButton);
            }

            // music settings
            {
                musicRect = new Rectangle(GameManager.Width - 500, 1, 151, 71);
                MenuButtonElement musicButton = new MenuButtonElement(musicRect, delegate()
                {
                    if (!music)
                    {
                        music     = true;
                        musicText = "MUSIC: ON";
                    }
                    else
                    {
                        music     = false;
                        musicText = "MUSIC: OFF";
                    }
                    musicSpriteElement.Text = musicText;
                });
                musicSpriteElement = new MenuSpriteElement("GUI/button_bg", musicRect, musicText);
                musicButton.AddChild(musicSpriteElement);
                bg.AddChild(musicButton);
            }

            //vibration settings
            {
                vibRect = new Rectangle(GameManager.Width - 345, 1, 190, 71);
                MenuButtonElement vibButton = new MenuButtonElement(vibRect, delegate()
                {
                    if (!vibration)
                    {
                        vibration = true;
                        vibText   = "VIBRATION: ON";
                    }
                    else
                    {
                        vibration = false;
                        vibText   = "VIBRATION: OFF";
                    }
                    vibrationSpriteElement.Text = vibText;
                });
                vibrationSpriteElement = new MenuSpriteElement("GUI/button_bg", vibRect, vibText);
                vibButton.AddChild(vibrationSpriteElement);
                bg.AddChild(vibButton);
            }

            // difficulty selector
            {
                difficultySelector = new MainMenuPlainSelector <Difficulty>(Difficulty.NORMAL);
                bg.AddChild(difficultySelector);

                difficultySelector.BaseX  = Convert.ToInt32(0.279 * GameManager.Width);
                difficultySelector.BaseY  = Convert.ToInt32(0.359 * GameManager.Height);
                difficultySelector.YDiff  = Convert.ToInt32(0.085 * GameManager.Height);
                difficultySelector.Width  = Convert.ToInt32(0.12 * GameManager.Width);
                difficultySelector.Height = Convert.ToInt32(0.077 * GameManager.Height);


                difficultySelector.AddElement("EASY", Difficulty.EASY);
                difficultySelector.AddElement("NORMAL", Difficulty.NORMAL);
                difficultySelector.AddElement("HARD", Difficulty.HARD);
            }

            //gamemode selector
            {
                gamemodeSelector = new MainMenuPlainSelector <GameMode>(GameMode.NORMAL);
                bg.AddChild(gamemodeSelector);

                gamemodeSelector.BaseX  = Convert.ToInt32(0.077 * GameManager.Width);
                gamemodeSelector.BaseY  = Convert.ToInt32(0.359 * GameManager.Height);
                gamemodeSelector.YDiff  = Convert.ToInt32(0.085 * GameManager.Height);
                gamemodeSelector.Width  = Convert.ToInt32(0.15 * GameManager.Width);
                gamemodeSelector.Height = Convert.ToInt32(0.077 * GameManager.Height);

                if (SinglePlayer)
                {
                    gamemodeSelector.AddElement("NORMAL", GameMode.NORMAL);
                    gamemodeSelector.AddElement("ENDLESS", GameMode.ENDLESS);
                    gamemodeSelector.AddElement("TIME", GameMode.TIME);
                    gamemodeSelector.Selected = GameMode.NORMAL;
                }
                else
                {
                    gamemodeSelector.AddElement("FIGHT", GameMode.FIGHT);
                    gamemodeSelector.AddElement("TIMER", GameMode.TIMER);
                    gamemodeSelector.Selected = GameMode.FIGHT;
                }
            }

            //play button
            {
                playRect = new Rectangle(Convert.ToInt32(0.78125 * GameManager.Width), Convert.ToInt32(0.444 * GameManager.Height), Convert.ToInt32(0.114 * GameManager.Width), Convert.ToInt32(0.0583 * GameManager.Height));
                MenuButtonElement playButton = new MenuButtonElement(playRect,
                                                                     delegate()
                {
                    if (gamemodeSelector.Selected == GameMode.FIGHT || gamemodeSelector.Selected == GameMode.TIMER)
                    {
                        return;                                                                                                 //nincs megvalósítva a multiplayer :(
                    }
                    gameModel = new Game.GameModel(MainMenu.imageDatabase, gamemodeSelector.Selected, difficultySelector.Selected, music, vibration, null, null);
                    NewGame(gamemodeSelector.Selected, difficultySelector.Selected, music, vibration);
                    GameManager.Instance.SwitchScene(gameModel);
                }
                                                                     );
                bg.AddChild(playButton);
                playButton.AddChild(new MenuSpriteElement("GUI/button_play.png", playRect));
            }

            if (NewGameMenu.Tutorial)
            {
                //tutorial
                tutorial = new TutorialElement();

                bg.AddChild(tutorial);

                tutorial.AddRectangle(new Point((GameManager.Width / 2) + 50, GameManager.Height / 3), new Point((GameManager.Width / 2) + 50, GameManager.Height / 3),
                                      "This is the first place you see when you want to play.");
                tutorial.AddRectangle(new Point(gamemodeSelector.BaseX, gamemodeSelector.BaseY), new Point(gamemodeSelector.BaseX + gamemodeSelector.Width, gamemodeSelector.BaseY + gamemodeSelector.GetHeight()),
                                      "Here you can select the gamemode you want");
                tutorial.AddRectangle(new Point(gamemodeSelector.BaseX, gamemodeSelector.BaseY), new Point(gamemodeSelector.BaseX + gamemodeSelector.Width, gamemodeSelector.BaseY + gamemodeSelector.GetHeightOfElement(1)),
                                      "In Normal mode you have a fixed number of images \nand you need to find them fast for higher scores");
                tutorial.AddRectangle(new Point(gamemodeSelector.BaseX, gamemodeSelector.BaseY + gamemodeSelector.GetHeightOfElement(1)), new Point(gamemodeSelector.BaseX + gamemodeSelector.Width, gamemodeSelector.BaseY + gamemodeSelector.GetHeightOfElement(2)),
                                      "In Endless mode you have infinite number of images for training");
                tutorial.AddRectangle(new Point(gamemodeSelector.BaseX, gamemodeSelector.BaseY + gamemodeSelector.GetHeightOfElement(2)), new Point(gamemodeSelector.BaseX + gamemodeSelector.Width, gamemodeSelector.BaseY + gamemodeSelector.GetHeightOfElement(3)),
                                      "In Time mode you have a fixed number of images \nbut only half minutes. Your score will be multiplied\nwith the seconds remaining");
                tutorial.AddRectangle(new Point(gamemodeSelector.BaseX, gamemodeSelector.BaseY), new Point(gamemodeSelector.BaseX + gamemodeSelector.Width, gamemodeSelector.BaseY + gamemodeSelector.GetHeight()),
                                      "Please select a gamemode!");

                tutorial.AddRectangle(new Point(difficultySelector.BaseX, difficultySelector.BaseY), new Point(difficultySelector.BaseX + difficultySelector.Width, difficultySelector.BaseY + difficultySelector.GetHeight()),
                                      "You can choose from difficulties, we have three here");
                tutorial.AddRectangle(new Point(difficultySelector.BaseX, difficultySelector.BaseY), new Point(difficultySelector.BaseX + difficultySelector.Width, difficultySelector.BaseY + gamemodeSelector.GetHeightOfElement(1)),
                                      "In easy mode you get less tasks and pure images");
                tutorial.AddRectangle(new Point(difficultySelector.BaseX, difficultySelector.BaseY + difficultySelector.GetHeightOfElement(1)), new Point(difficultySelector.BaseX + difficultySelector.Width, difficultySelector.BaseY + difficultySelector.GetHeightOfElement(2)),
                                      "In normal mode you get average tasks and \nsome of the images are rotated, blurred or colored");
                tutorial.AddRectangle(new Point(difficultySelector.BaseX, difficultySelector.BaseY + difficultySelector.GetHeightOfElement(2)), new Point(difficultySelector.BaseX + difficultySelector.Width, difficultySelector.BaseY + difficultySelector.GetHeightOfElement(3)),
                                      "In hard mode you get a lot of tasks and \nall of the images are rotated, blurred or colored");
                tutorial.AddRectangle(new Point(difficultySelector.BaseX, difficultySelector.BaseY), new Point(difficultySelector.BaseX + difficultySelector.Width, difficultySelector.BaseY + difficultySelector.GetHeight()),
                                      "Please choose a mode if the selected is not good for you");

                tutorial.AddRectangle(new Point(musicRect.Left, musicRect.Top), new Point(musicRect.Right, musicRect.Bottom),
                                      "You can set the music here, if you want");
                tutorial.AddRectangle(new Point(vibRect.Left, vibRect.Top), new Point(vibRect.Right, vibRect.Bottom),
                                      "And the vibration too");

                tutorial.AddRectangle(new Point(playRect.Left - 10, playRect.Top - 10), new Point(playRect.Right + 10, playRect.Bottom + 10),
                                      "If all set, please click on the Play button now");
                tutorial.ShowNextTutorial();
            }
        }