Ejemplo n.º 1
0
    protected override void OnOpenState()
    {
        if (!m_data.IsActiveSession)
        {
            m_currentSession = new GameSession(m_data.Character, m_data.Level);
            m_currentSession.LoadSession();

            //if the level is the first one, we show the tutorial screen and when that screen is closes, we start the session.
            if (m_data.LevelIndex == 0)
            {
                m_tutorialScreen = UIManager.Instance.RequestView <TutorialScreen>();
                m_tutorialScreen.InitializeTutorialView(OnContinueButtonPressed);
            }
            else
            {
                m_currentSession.StartSession();
            }
        }
        else
        {
            m_currentSession = m_data.ActiveSession;
        }

        if (m_data.BlackScreenInstance != null)
        {
            m_data.BlackScreenInstance.Close();
        }

        m_hud = UIManager.Instance.RequestView <GameHUDView>();
        m_hud.InitializeGameHUD(m_data.Character.InitialHP);
        m_hud.SetScoreText(0);
        m_currentSession.OnLifeLost     += OnLifeLost;
        m_currentSession.OnScoreChanged += OnScoreChanged;
    }
    public void Click(ControllerInformation controller)
    {
        Ray ray = new Ray(controller.trackedObj.transform.position, controller.trackedObj.transform.forward);

        Debug.DrawRay(transform.position, transform.forward * 100f);
        RaycastHit[] hits = Physics.RaycastAll(ray, 100f, layer);
        if (hits.Length > 0)
        {
            foreach (var hit in hits)
            {
                UITracked tracker = hit.collider.GetComponent <UITracked>();

                if (tracker != null)
                {
                    VRTopic        topic  = tracker.trackedUIObject.GetComponent <VRTopic>();
                    TutorialScreen screen = topic.GetComponentInParent <TutorialScreen>();
                    if (tracker.transform.position.y > screen.getLowerBorder().position.y - toleranceForOutsideRecognition && tracker.transform.position.y < screen.getUpperBorder().position.y + toleranceForOutsideRecognition)
                    {
                        screen.selectedTopic = topic;
                    }
                    break;
                }
            }
        }
    }
Ejemplo n.º 3
0
 protected void InstantKill()
 {
     if (playingScreen == this)
     {
         StopMovie();
         RemoveSubtitles();
         playingScreen   = null;
         transitionSpeed = -2f;
     }
 }
Ejemplo n.º 4
0
    void Start()
    {
        menuController = GetComponent<MenuKeysController>();
        credits = GetComponent<CreditsScreen>();
        credits.enabled = false;
        tutorial = GetComponent<TutorialScreen>();
        tutorial.enabled = false;

        rect = new Rect(Screen.width / 2 - LarguraTitulo / 2, 60, LarguraTitulo, 100);
    }
Ejemplo n.º 5
0
        public void ReloadContent(Director director)
        {
            mDirector = director;

            Console.Out.WriteLine(mTutorialState);

            if (Level is Tutorial)
            {
                mTutorialScreen = new TutorialScreen(mDirector)
                {
                    TutorialState = mTutorialState
                };
                mLoadTutorialScreen = true;
            }
        }
Ejemplo n.º 6
0
 internal void Show()
 {
     if (playingScreen != null || isVisible || inTransition)
     {
         pendingPlay = 1f;
         return;
     }
     pendingPlay     = -1f;
     isVisible       = true;
     playingScreen   = this;
     inTransition    = true;
     transitionSpeed = 0.8f;
     MusicManager.instance.Pause();
     onSound.PlayOneShot();
     lockedVOAndSubtitles = true;
     currentLine          = null;
     SubtitleManager.instance.ClearSubtitle();
 }
Ejemplo n.º 7
0
 public void DoorsClosed()
 {
     OneClickCover.SetActive(false);
     if (menuToTransitionTo)
     {
         menuToTransitionTo.SetActive(!menuToTransitionTo.activeSelf);
     }
     if (menuToTransitionTo.gameObject.activeInHierarchy && menuToTransitionTo == ManagementTutorial.gameObject)
     {
         ManagementTutorial.NextStep();
         TutorialScreen.SetActive(false);
     }
     else if (menuToTransitionTo.gameObject.activeInHierarchy && menuToTransitionTo == GameplayTutorial.gameObject)
     {
         GameplayTutorial.NextStep();
         TutorialScreen.SetActive(false);
     }
 }
Ejemplo n.º 8
0
    private IEnumerator Spawn()
    {
        spawned = true;


        GameObject explosion = Instantiate(explosionPrefab, transform.position, Quaternion.identity);

        Destroy(explosion, 1);

        screen = Instantiate(screenPrefab).GetComponent <TutorialScreen>();
        screen.transform.position = transform.position + spawnOffset;

        Vector3 rot = GameObject.FindObjectOfType <SteamVR_Camera>().transform.rotation.eulerAngles;

        rot.x  = 0;
        rot.z  = 0;
        rot.y -= 90;

        screen.transform.rotation = Quaternion.Euler(rot);
        yield return(new WaitForSeconds(2));
    }
Ejemplo n.º 9
0
 public MainScreen()
 {
     InitializeComponent();
     //Story.SetNext(64);
     TutorialScreen.BringToFront();
     TutorialScreen.Show();
     CharacterName.Text = "";
     LabelODa.Text      = LabelOHP.Text = LabelDa.Text = LabelHP.Text = LabelLv.Text = "";
     kill    = hp = da = 0;
     lv      = 'C';
     Rank[1] = 'C';
     Rank[2] = 'B';
     Rank[3] = 'A';
     Rank[4] = 'S';
     FightButton.Hide();
     EscapeButton.Hide();
     FuncButton.Hide();
     da = 10;
     hp = 10;
     PocDefine();
 }
Ejemplo n.º 10
0
        protected override void Initialize()
        {
            /*
             * graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft;
             * graphics.PreferredBackBufferHeight = 480;
             * graphics.PreferredBackBufferWidth = 800;
             * graphics.ApplyChanges();
             */

            textureHandler = new TextureHandler(GraphicsDevice);
            gameScreen     = new GameScreen(this, textureHandler);
            pauseScreen    = new PauseScreen(this, textureHandler);
            loadScreen     = new LoadScreen(this, textureHandler);
            gameOverScreen = new GameOverScreen(this, textureHandler);
            mainMenuScreen = new MainMenuScreen(this, textureHandler);
            aboutScreen    = new AboutScreen(this, textureHandler);
            tutorialScreen = new TutorialScreen(this, textureHandler);
            currentScreen  = loadScreen;

            initializeAccelerometer();
            base.Initialize();
        }
Ejemplo n.º 11
0
    private void Update()
    {
        if (pendingPlay > 0f)
        {
            float num = pendingPlay - Time.deltaTime;
            Show();
            pendingPlay = num;
        }
        if (!videoLoaded)
        {
            return;
        }
        if (endTimer > 0f)
        {
            endTimer -= Time.deltaTime;
            if (endTimer <= 0f)
            {
                StopMovie();
            }
        }
        if (movie != null && movieMaterialInstance == null)
        {
            if (movie.texture != null)
            {
                movieMaterialInstance = Object.Instantiate(HFFResources.instance.PCLinearMovieFixGame);
            }
            reinitMaterial = true;
        }
        if (reinitMaterial && movie != null && movieMaterialInstance != null)
        {
            reinitMaterial = false;
            if (movieMaterialInstance != null)
            {
                movieMaterialInstance.mainTexture = movie.texture;
                movieMaterialInstance.SetTexture("_EmissionMap", movie.texture);
            }
            renderer.sharedMaterial = movieMaterialInstance;
        }
        if (movie != null && subtitles != null && transitionPhase != 0f && transitionSpeed > 0f && inTransition)
        {
            time = audiosourceTime;
            if (currentLine != null && !currentLine.ShouldShow(time))
            {
                if (lockedVOAndSubtitles)
                {
                    SubtitleManager.instance.ClearSubtitle();
                }
                currentLine = null;
            }
            if (currentLine == null)
            {
                currentLine = subtitles.GetLineToDisplay(time);
                if (currentLine != null && lockedVOAndSubtitles)
                {
                    SubtitleManager.instance.SetSubtitle(ScriptLocalization.Get("SUBTITLES/" + currentLine.key));
                }
            }
        }
        if (!inTransition)
        {
            return;
        }
        if (transitionPhase == 0f && transitionSpeed > 0f && movie != null)
        {
            renderer.sharedMaterial = movieMaterialInstance;
            audiosourceStart        = Time.unscaledTime;
            lockedVOAndSubtitles    = true;
            movie.Play();
        }
        transitionPhase = Mathf.Clamp01(transitionPhase + Time.deltaTime * transitionSpeed);
        float num2 = Ease.easeInOutQuad(0f, 1f, transitionPhase);
        float num3 = width / 16f * 9f;

        Create2SidedMesh((0f - width) / 2f * num2, (0f - num3) / 2f, width / 2f * num2, num3 / 2f, 0.5f - num2 / 2f, 0f, 0.5f + num2 / 2f, 1f);
        mesh.vertices = meshVerts;
        mesh.uv       = uvs;
        mesh.RecalculateNormals();
        mesh.RecalculateBounds();
        filter.sharedMesh = mesh;
        collider.size     = ((num2 != 0f) ? new Vector3(width * num2, num3, 0.1f) : Vector3.zero);
        if (transitionPhase == 0f && transitionSpeed < 0f)
        {
            if (playingScreen == this)
            {
                playingScreen = null;
            }
            inTransition = false;
            StopMovie();
            RemoveSubtitles();
            renderer.sharedMaterial = blankMaterial;
            GrabManager.Release(base.gameObject);
        }
    }
Ejemplo n.º 12
0
        /// <summary>
        /// The handle method of the Tutorial. Triggers events, like for examples infoboxes.
        /// </summary>
        private void HandleTutorial()
        {
            switch (mTutorialState)
            {
            case "Beginning":
                if (mTutorialScreen.TutorialState == "AwaitingUserAction")
                {
                    mTutorialState = "Settler";
                }
                break;

            case "Settler":
                if (mDirector.GetMilitaryManager.PlayerPlatformCount == 1)
                {
                    mTutorialState = "UI_FirstPlatform";
                    mTutorialScreen.TutorialState = "UI_FirstPlatform";
                }
                break;

            case "UI_FirstPlatform":
                if (mDirector.GetMilitaryManager.PlayerPlatformCount == 2)
                {
                    mTutorialState = "UI_SecondPlatform";
                    mTutorialScreen.TutorialState = "UI_SecondPlatform";
                }
                break;

            case "UI_SecondPlatform":
                if (mDirector.GetMilitaryManager.PlayerPlatformCount == 3)
                {
                    mTutorialState = "CivilUnits_Build";
                    mTutorialScreen.TutorialState = "CivilUnits_Build";
                }
                break;

            case "CivilUnits_Build":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex())
                    .GetNumberOfAssigned()[1] > 0)
                {
                    mTutorialState = "UserInterface_ProducePlatform";
                    mTutorialScreen.TutorialState = "UserInterface_ProducePlatform";
                }
                break;

            case "UserInterface_ProducePlatform":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex())
                    .GetNumberOfProdPlatforms() > 0)
                {
                    mTutorialState = "Factory";
                    mTutorialScreen.TutorialState = "Factory";
                }
                break;

            case "Factory":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex())
                    .GetNumberOfProdPlatforms() > 1)
                {
                    mTutorialState = "SelectedPlatform_ActionAssignment";
                    mTutorialScreen.TutorialState = "SelectedPlatform_ActionAssignment";
                }
                break;

            case "SelectedPlatform_ActionAssignment":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex())
                    .GetNumberOfAssigned()[1] < 1)
                {
                    mTutorialState = "CivilUnits_Logistics";
                    mTutorialScreen.TutorialState = "CivilUnits_Logistics";
                }
                break;

            case "CivilUnits_Logistics":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[2] > 0)
                {
                    mTutorialState = "BuildGeneralUnit";
                    mTutorialScreen.TutorialState = "BuildGeneralUnit";
                }
                break;

            case "BuildGeneralUnit":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[4] > 0)
                {
                    mTutorialState = "BuildDefenseBuilding";
                    mTutorialScreen.TutorialState = "BuildDefenseBuilding";
                }
                break;

            case "BuildDefenseBuilding":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[3] == 0)
                {
                    mTutorialState = "Force-Deactivation";
                    mTutorialScreen.TutorialState = "Force-Deactivation";
                }
                break;

            case "Force-Deactivation":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[4] == 0)
                {
                    mTutorialState = "Powerhouse";
                    mTutorialScreen.TutorialState = "Powerhouse";
                }
                break;

            case "Powerhouse":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[0] > 0)
                {
                    mTutorialState = "Barracks";
                    mTutorialScreen.TutorialState = "Barracks";
                }
                break;

            case "Barracks":
                if (mDirector.GetDistributionDirector
                    .GetManager(StructureMap.GetPlatformList().First.Value.GetGraphIndex()).GetNumberOfAssigned()[2] > 2)
                {
                    mTutorialState = "create_MilitaryUnit";
                    mTutorialScreen.TutorialState = "create_MilitaryUnit";
                }
                break;

            case "create_MilitaryUnit":
                if (mDirector.GetMilitaryManager.PlayerUnitCount > 0)
                {
                    mTutorialState = "finalPopup";
                    mTutorialScreen.TutorialState = "finalPopup";
                }
                break;

            case "finalPopup":
                var assignedUnitsList = mDirector.GetDistributionDirector.GetManager(StructureMap.GetPlatformList().
                                                                                     First.Value.GetGraphIndex()).GetNumberOfAssigned();
                if (assignedUnitsList[0] == 0 && assignedUnitsList[1] == 0 && assignedUnitsList[2] == 0 && assignedUnitsList[3] == 0)
                {
                    mTutorialState = "EndOfTutorial";
                    mTutorialScreen.TutorialState = "EndOfTutorial  ";
                }
                break;

            case "EndOfTutorial":
                mTutorialState = "noAction";
                mScreenManager.RemoveScreen();
                Win();
                break;

            case "noAction":
                break;

            default:
                mTutorialScreen = new TutorialScreen(mDirector);
                mTutorialScreen.TutorialState = "Beginning";
                mTutorialState = "Beginning";
                mScreenManager.AddScreen(mTutorialScreen);
                break;
            }
        }
Ejemplo n.º 13
0
    private IEnumerator EnableScreenCoroutine(TutorialScreen screen)
    {
        yield return(new WaitForSeconds(1f));

        screen.EnableScreen();
    }
Ejemplo n.º 14
0
 public void ToggleHelp()
 {
     TutorialScreen.toggleHelp();
 }
Ejemplo n.º 15
0
        private void PocDefine()
        {
            if (endflag)
            {
                this.Close();
                return;
            }
            int type = Story.GetStoryType();

            Addflag = true;
            //0 as Normal Story Line
            //1 as chararcter Screen
            //2 as Request
            if (type == 0)
            {
                onType = 0;
                TutorialScreen.Show();
                CharacterScreen.Hide();
                SetTutorialPic(Story.GetPicID());
                AddText(Story.GetStoryText());
            }
            if (type == 99)
            {
                onType = 0;
                CreateHero c = new CreateHero();
                AddText(Story.GetStoryText());
                c.ShowDialog();
                Story.next++;
                PocDefine();
                return;
            }
            if (type == 98)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                HandleEventString(Story.GetEventID());
                SetOtherPic(Story.GetPicID());
                AddText(Story.GetStoryText());
                Request r = new Request(Story.GetRequestID());
                r.ShowDialog();
                name = r.name;
            }
            if (type == 97)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                HandleEventString(Story.GetEventID());
                SetOtherPic(Story.GetPicID());
                AddText(Story.GetStoryText());
                nextflag        = false;
                attacknum       = 3;
                FuncButton.Text = "攻擊鈕-剩餘3次";
                FuncButton.Show();
            }
            if (type == 96)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                HandleEventString(Story.GetEventID());
                SetOtherPic(Story.GetPicID());
                AddText(Story.GetStoryText());
                LevelUP u = new LevelUP(1, 1, 2, "請使用++這個運算子來為想要提升之能力升級,請注意項目名稱和別忘了加上分號。打完後記得按ENTER確認唷!");
                u.ShowDialog();
                SetCharacter(u);
                Story.next++;
                PocDefine();
                return;
            }
            if (type == 95)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                HandleEventString(Story.GetEventID());
                SetOtherPic(Story.GetPicID());
                AddText(Story.GetStoryText());
                HandleEventString(Story.GetEventID());
                nextflag = false;
                FightButton.Show();
                EscapeButton.Show();
                Story.next++;
                return;
            }
            if (type == 1)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                HandleEventString(Story.GetEventID());
                SetOtherPic(Story.GetPicID());
                if (Addflag)
                {
                    AddText(Story.GetStoryText());
                }
            }

            if (type == 2)
            {
                onType = 1;
                TutorialScreen.Hide();
                CharacterScreen.Show();
                SetOtherPic(Story.GetPicID());
                HandleEventString(Story.GetEventID());
                AddText(Story.GetStoryText());
                MainCharacter.Image = Image.FromFile(Application.StartupPath + "\\myHero.jpg");
                Request r = new Request(Story.GetRequestID());
                r.ShowDialog();
                Story.next++;
                PocDefine();
                return;
            }
            if (type == 999)
            {
                onType = 0;
                TutorialScreen.Show();
                CharacterScreen.Hide();
                SetTutorialPic(Story.GetPicID());
                AddText(Story.GetStoryText());
                endflag = true;
            }
            Story.next++;
        }