Ejemplo n.º 1
0
        public IngameScene()
        {
            var engineScreens = ScreensCollection.GetScreens();

            Logger.Debug($"Loaded '{engineScreens.Count}' screens");
            var ingameScreens = new List <IngameScreen>(engineScreens.Count);

            for (var i = 0; i < engineScreens.Count; i++)
            {
                ingameScreens.Add(new IngameScreen(this, i, engineScreens[i].EgineScreen, engineScreens[i].Messages));
            }

            for (var i = 0; i < Save.LastLevel; i++)
            {
                ingameScreens[i].MarkDone();
            }

            _screens = ingameScreens.AsReadOnly();
            _currentlySelectedScreen   = Save.LastLevel;
            _currentScreenRenderOffset = Save.LastLevel;

            _levelProceedBlockEffect = new LevelProceedBlockEffect();
            _pauseView = new PauseView();

            _controlsWidget = new ControlsWidget {
                IsHiding = Save.LastLevel > 1
            };
            _creditsWidget = new CreditsWidget();
            SubtitleWidget = new SubtitleWidget();

            if (Save.LastLevel > 0)
            {
                _creditsWidget.IsFinished = true;
            }
        }
Ejemplo n.º 2
0
    //Change to the next menu.
    public void ChangeMenu(DialogMenu next_menu)
    {
        //If we are advancing to a new menu: Advance
        if (current_menu != next_menu)
        {
            if (next_menu)
            {
                next_menu.SetVisible(true);
            }

            current_menu = next_menu;

            if (current_menu)
            {
                subtitle.SetText(current_menu.original_prompt);
            }
            else
            {
                OnFinish();
            }
        }
        //If we are staying at the same menu: Don't advance and reset timers and original prompt
        else
        {
            current_menu.DeselectAllWidgets();
            current_menu.ResetEndCond();

            subtitle.SetText(current_menu.original_prompt);
        }

        subtitle = GetComponentInChildren <SubtitleWidget>();

        if (!subtitle)
        {
            Debug.Log("Error: no subtitle");
            Destroy(gameObject);
        }
    }
    //Change to the next menu.
    public void ChangeMenu(DialogMenu next_menu)
    {
        //If we are advancing to a new menu: Advance
        if(current_menu != next_menu)
        {
            if(next_menu)
                next_menu.SetVisible(true);

            current_menu = next_menu;

            if(current_menu)
                subtitle.SetText(current_menu.original_prompt);
            else
                OnFinish();
        }
        //If we are staying at the same menu: Don't advance and reset timers and original prompt
        else
        {
            current_menu.DeselectAllWidgets();
            current_menu.ResetEndCond();

            subtitle.SetText(current_menu.original_prompt);
        }

        subtitle = GetComponentInChildren<SubtitleWidget>();

        if(!subtitle)
        {
            Debug.Log ("Error: no subtitle");
            Destroy(gameObject);
        }
    }
    // Use this for initialization
    void Start()
    {
        menu_position = get_menu_position();

        //Guard against default bad menu scale
        if(menu_scale == Vector3.zero){ menu_scale = Vector3.one; }

        //Load all tea dialog clips
        Object[] objs = Resources.LoadAll("AudioClips/TeaDialog/DialogClips");
        clips = new List<AudioClip>();
        foreach(Object obj in objs)
        {
            AudioClip clip = obj as AudioClip;
            clips.Add(clip);
        }

        //Record all good responses clips
        objs = Resources.LoadAll("AudioClips/TeaDialog/GoodResponses");
        good_response_clips = new List<AudioClip>();
        foreach(Object obj in objs)
            good_response_clips.Add(obj as AudioClip);

        //Record all bad responses clips
        objs = Resources.LoadAll("AudioClips/TeaDialog/BadResponses");
        bad_response_clips = new List<AudioClip>();
        foreach(Object obj in objs)
            bad_response_clips.Add(obj as AudioClip);

        excluded_choices = new List<string>();

        SetResponsesFromXML();

        subtitle = GetComponentInChildren<SubtitleWidget>();

        if(!subtitle)
        {
            Debug.Log("Error: no subtitle");
            Destroy(gameObject);
        }

        if(generate_static_tree)
        {
            //Get all the menus attached. (Don't attach any if you want to dynamically create the tree;
            //this is probably always the case except when debugging.
            DialogMenu[] amenus = GetComponentsInChildren<DialogMenu>();
            foreach(DialogMenu menu in amenus)
            {
                menus.Add(menu);

                foreach(Widget w in menu.widgets)
                {
                    //Debug.Log ("added widget " + w.name + " of menu " + menu.name);
                    w.OnWidgetClick += OnWidgetClick;
                }
            }
        }
        else
        {
            CreateTreeFromXML();

            for(int i=0;i<menus.Count;i++)
            {
                menus[i].tree = this;

                //Neatly arrange the menu's widgets
                menus[i].ArrangeWidgets();

                foreach(Widget w in menus[i].widgets)
                {
                    w.OnWidgetClick += OnWidgetClick;
                    ((DialogWidget)w).DialogMenu = GetChoiceMenuFromName(((DialogWidget)w).choicemenu_name);
                }

                if(menus[i].dialog_tree_state == DialogTreeState.Wait)
                {
                    menus[i].OnEndCond += OnEndCond;
                }

                //All menu's next menus are the ones that come after them in the XML
                if(i < menus.Count - 1)
                {
                    menus[i].next_menu = menus[i+1];
                    menus[i].orig_next_menu = menus[i+1];
                }

            }

            if(Settings.debug && Settings.menu_to_jump_to != "")
                current_menu = GetChoiceMenuFromName(Settings.menu_to_jump_to);
            else
                current_menu = menus[0];
        }

        subtitle.SetText(current_menu.original_prompt);
    }
Ejemplo n.º 5
0
    // Use this for initialization
    void Start()
    {
        menu_position = get_menu_position();

        //Guard against default bad menu scale
        if (menu_scale == Vector3.zero)
        {
            menu_scale = Vector3.one;
        }

        //Load all tea dialog clips
        Object[] objs = Resources.LoadAll("AudioClips/TeaDialog/DialogClips");
        clips = new List <AudioClip>();
        foreach (Object obj in objs)
        {
            AudioClip clip = obj as AudioClip;
            clips.Add(clip);
        }

        //Record all good responses clips
        objs = Resources.LoadAll("AudioClips/TeaDialog/GoodResponses");
        good_response_clips = new List <AudioClip>();
        foreach (Object obj in objs)
        {
            good_response_clips.Add(obj as AudioClip);
        }

        //Record all bad responses clips
        objs = Resources.LoadAll("AudioClips/TeaDialog/BadResponses");
        bad_response_clips = new List <AudioClip>();
        foreach (Object obj in objs)
        {
            bad_response_clips.Add(obj as AudioClip);
        }

        excluded_choices = new List <string>();

        SetResponsesFromXML();

        subtitle = GetComponentInChildren <SubtitleWidget>();

        if (!subtitle)
        {
            Debug.Log("Error: no subtitle");
            Destroy(gameObject);
        }

        if (generate_static_tree)
        {
            //Get all the menus attached. (Don't attach any if you want to dynamically create the tree;
            //this is probably always the case except when debugging.
            DialogMenu[] amenus = GetComponentsInChildren <DialogMenu>();
            foreach (DialogMenu menu in amenus)
            {
                menus.Add(menu);

                foreach (Widget w in menu.widgets)
                {
                    //Debug.Log ("added widget " + w.name + " of menu " + menu.name);
                    w.OnWidgetClick += OnWidgetClick;
                }
            }
        }
        else
        {
            CreateTreeFromXML();

            for (int i = 0; i < menus.Count; i++)
            {
                menus[i].tree = this;

                //Neatly arrange the menu's widgets
                menus[i].ArrangeWidgets();

                foreach (Widget w in menus[i].widgets)
                {
                    w.OnWidgetClick += OnWidgetClick;
                    ((DialogWidget)w).DialogMenu = GetChoiceMenuFromName(((DialogWidget)w).choicemenu_name);
                }

                if (menus[i].dialog_tree_state == DialogTreeState.Wait)
                {
                    menus[i].OnEndCond += OnEndCond;
                }

                //All menu's next menus are the ones that come after them in the XML
                if (i < menus.Count - 1)
                {
                    menus[i].next_menu      = menus[i + 1];
                    menus[i].orig_next_menu = menus[i + 1];
                }
            }

            if (Settings.debug && Settings.menu_to_jump_to != "")
            {
                current_menu = GetChoiceMenuFromName(Settings.menu_to_jump_to);
            }
            else
            {
                current_menu = menus[0];
            }
        }

        subtitle.SetText(current_menu.original_prompt);
    }